Communication in both directions (Text control)
Code regrouping
This commit is contained in:
@@ -23,11 +23,24 @@ feature {NONE}
|
||||
click_event := agent donothing
|
||||
end
|
||||
|
||||
feature
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
--UGLY HACK MUST BE REMOVED
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("text")) as new_text then
|
||||
text := new_text.unescaped_string_32
|
||||
end
|
||||
end
|
||||
|
||||
donothing (p: WSF_PAGE_CONTROL)
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
donothing (p: WSF_PAGE_CONTROL) --UGLY HACK MUST BE REMOVED
|
||||
do
|
||||
end
|
||||
|
||||
@@ -43,17 +56,13 @@ feature
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := "<button data-name=%"" + control_name + "%" data-type=%"WSF_BUTTON_CONTROL%">" + text + "</button>"
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
||||
end
|
||||
|
||||
set_text (t: STRING)
|
||||
do
|
||||
text := t
|
||||
|
||||
Reference in New Issue
Block a user