Fix event handler
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
note
|
||||
description: "Summary description for {WSF_AGENT_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_AGENT_VALIDATOR [G]
|
||||
inherit
|
||||
WSF_VALIDATOR [G]
|
||||
create
|
||||
make_with_agent
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_agent (h:like handler; e: STRING)
|
||||
do
|
||||
make (e)
|
||||
handler := h
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
is_valid (input: G): BOOLEAN
|
||||
do
|
||||
|
||||
Result := handler.item ( [input])
|
||||
end
|
||||
|
||||
|
||||
handler: FUNCTION[ANY,TUPLE[G],BOOLEAN]
|
||||
end
|
||||
@@ -84,8 +84,8 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
Precursor (states)
|
||||
create sub_states.make
|
||||
value_control.read_state_changes (sub_states)
|
||||
if sub_states.count>0 then
|
||||
if attached {JSON_OBJECT}states.item (control_name) as changes then
|
||||
if sub_states.count > 0 then
|
||||
if attached {JSON_OBJECT} states.item (control_name) as changes then
|
||||
changes.put (sub_states, "controls")
|
||||
else
|
||||
create control_state.make
|
||||
@@ -113,16 +113,19 @@ 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 STRING)
|
||||
-- Pass callback to subcontrols
|
||||
do
|
||||
if cname[1].same_string (control_name) then
|
||||
if cname [1].same_string (control_name) then
|
||||
cname.go_i_th (1)
|
||||
cname.remove
|
||||
if event.same_string ("validate") then
|
||||
validate
|
||||
if cname.is_empty then
|
||||
if event.same_string ("validate") then
|
||||
validate
|
||||
end
|
||||
else
|
||||
value_control.handle_callback (cname, event, event_parameter)
|
||||
end
|
||||
value_control.handle_callback (cname, event, event_parameter)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
Precursor (states)
|
||||
create sub_states.make
|
||||
read_subcontrol_state_changes (sub_states)
|
||||
if sub_states.count>0 then
|
||||
if attached {JSON_OBJECT}states.item (control_name) as changes then
|
||||
if sub_states.count > 0 then
|
||||
if attached {JSON_OBJECT} states.item (control_name) as changes then
|
||||
changes.put (sub_states, "controls")
|
||||
else
|
||||
create control_state.make
|
||||
@@ -138,11 +138,15 @@ feature -- Event handling
|
||||
if equal (cname [1], control_name) then
|
||||
cname.go_i_th (1)
|
||||
cname.remove
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.handle_callback (cname, event, event_parameter)
|
||||
if not cname.is_empty then
|
||||
across
|
||||
controls as c
|
||||
until
|
||||
cname.is_empty
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.handle_callback (cname, event, event_parameter)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
note
|
||||
description: "Summary description for {WSF_STATELESS_MULTI_CONTROL}."
|
||||
author: ""
|
||||
@@ -80,6 +81,8 @@ feature -- Event handling
|
||||
do
|
||||
across
|
||||
controls as c
|
||||
until
|
||||
cname.is_empty
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.handle_callback (cname, event, event_parameter)
|
||||
|
||||
Reference in New Issue
Block a user