Change parameter type

This commit is contained in:
YNH Webdev
2013-12-31 21:25:01 +01:00
parent 1ae44e74e7
commit b39dd5c40d
17 changed files with 153 additions and 31 deletions

View File

@@ -48,7 +48,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
feature --Event handling
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
-- Handle goto/next/prev events
do
if Current.control_name.same_string (cname[1]) then
@@ -57,7 +57,7 @@ feature --Event handling
elseif event.same_string ("prev") then
datasource.set_page (datasource.page - 1)
elseif event.same_string ("goto") then
if attached event_parameter as p and then attached p.to_integer as i then
if attached {STRING}event_parameter as p and then attached p.to_integer as i then
datasource.set_page (i)
end
end

View File

@@ -49,7 +49,7 @@ feature -- State
feature -- Callback
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
if cname[1].same_string (control_name) and event.same_string ("autocomplete") then

View File

@@ -54,7 +54,7 @@ feature --Event handling
change_event := e
end
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
if Current.control_name.same_string (cname[1]) and attached change_event as cevent then
if event.same_string ("change") then

View File

@@ -49,7 +49,7 @@ feature --Event handling
change_event := e
end
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
do
if Current.control_name.same_string (cname [1]) and attached change_event as cevent then
if event.same_string ("change") then
@@ -58,6 +58,17 @@ feature --Event handling
end
end
feature -- Upload
start_upload
local
upload: WSF_JSON_OBJECT
do
create upload.make
upload.put_string ("start_upload", "type")
actions.add (upload)
end
feature -- Implementation
value: detachable WSF_PENDING_FILE

View File

@@ -53,7 +53,7 @@ feature --Event handling
change_event := e
end
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
if Current.control_name.same_string (cname[1]) and attached change_event as cevent then
if event.same_string ("change") then

View File

@@ -51,7 +51,7 @@ feature -- State handling
feature -- Event handling
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
if cname[1].same_string (control_name) and event.same_string ("progress_fetch") then
state_changes.put_integer (progress_value, "progress")

View File

@@ -43,7 +43,7 @@ feature -- State handling
feature -- Callback
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
-- Do nothing here
end

View File

@@ -54,7 +54,7 @@ feature --Event handling
click_event := e
end
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
if Current.control_name.same_string (cname[1]) and attached click_event as cevent then
cevent.call (Void)

View File

@@ -52,12 +52,12 @@ feature -- Actions
show_alert (message: STRING)
--Start a modal window containg an other or the same page
local
modal: WSF_JSON_OBJECT
alert: WSF_JSON_OBJECT
do
create modal.make
modal.put_string ("show_alert", "type")
modal.put_string (message, "message")
actions.add (modal)
create alert.make
alert.put_string ("show_alert", "type")
alert.put_string (message, "message")
actions.add (alert)
end
redirect (url: STRING)
@@ -154,7 +154,7 @@ feature -- Rendering
feature -- Event handling
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
-- Method called if any callback received. In this method you can route the callback to the event handler
deferred
end

View File

@@ -121,7 +121,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
feature -- Event handling
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
-- Pass callback to subcontrols
do
if cname [1].same_string (control_name) then

View File

@@ -43,7 +43,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
feature --Event handling
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
do
end

View File

@@ -132,7 +132,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
feature -- Event handling
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
-- Pass callback to subcontrols
do
if equal (cname [1], control_name) then

View File

@@ -59,7 +59,7 @@ feature -- Implementation
-- If request is not a callback. Run process and render the html page
local
event: detachable STRING
event_parameter: detachable STRING
event_parameter: detachable ANY
event_control_name: detachable STRING
states: STRING
states_changes: WSF_JSON_OBJECT
@@ -74,6 +74,11 @@ feature -- Implementation
create json_parser.make_parser (states)
if attached {JSON_OBJECT} json_parser.parse_json as sp then
set_state (sp)
else
if attached request.form_parameter ("file") as o then
response.put_string (o.name)
end
end
handle_callback (event_control_name.split ('-'), event, event_parameter)
create states_changes.make
@@ -147,7 +152,7 @@ feature -- Implementation
feature -- Event handling
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
-- Forward callback to control
do
control.handle_callback (cname, event, event_parameter)

View File

@@ -76,7 +76,7 @@ feature
end
feature -- Event handling
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable STRING)
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
-- Pass callback to subcontrols
do
across