diff --git a/library/server/wsf_html/webcontrol/wsf_button_control.e b/library/server/wsf_html/webcontrol/wsf_button_control.e index 1dcb968a..9da1feb1 100644 --- a/library/server/wsf_html/webcontrol/wsf_button_control.e +++ b/library/server/wsf_html/webcontrol/wsf_button_control.e @@ -18,7 +18,7 @@ feature {NONE} make_button (n: STRING; t: STRING) do - make (n) + make (n, "button") text := t end diff --git a/library/server/wsf_html/webcontrol/wsf_control.e b/library/server/wsf_html/webcontrol/wsf_control.e index 0ae82d73..aaf3570a 100644 --- a/library/server/wsf_html/webcontrol/wsf_control.e +++ b/library/server/wsf_html/webcontrol/wsf_control.e @@ -25,6 +25,7 @@ feature {NONE} create state_changes.make ensure attached state_changes + attached css_class end feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT diff --git a/library/server/wsf_html/webcontrol/wsf_form_control.e b/library/server/wsf_html/webcontrol/wsf_form_control.e index 04d87df4..8dbd3e8d 100644 --- a/library/server/wsf_html/webcontrol/wsf_form_control.e +++ b/library/server/wsf_html/webcontrol/wsf_form_control.e @@ -12,9 +12,14 @@ inherit WSF_MULTI_CONTROL create - make, make_with_controls + make_form_control feature {NONE} + make_form_control (n: STRING) + do + make_multi_control (n) + tag_name := "form" + end end diff --git a/library/server/wsf_html/webcontrol/wsf_input_control.e b/library/server/wsf_html/webcontrol/wsf_input_control.e deleted file mode 100644 index 9eccdb10..00000000 --- a/library/server/wsf_html/webcontrol/wsf_input_control.e +++ /dev/null @@ -1,84 +0,0 @@ -note - description: "Summary description for {WSF_INPUT_CONTROL}." - author: "" - date: "$Date$" - revision: "$Revision$" - -class - WSF_INPUT_CONTROL - -inherit - - WSF_CONTROL - -create - make_input - -feature {NONE} - - make_input (n, t, v: STRING) - do - make (n) - type := t - value := v - end - -feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT - - set_state (new_state: JSON_OBJECT) - -- Restore value from json - do - if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("value")) as new_value then - value := new_value.unescaped_string_32 - end - end - - state: JSON_OBJECT - -- Return state which contains the current value and if there is an event handle attached - do - create Result.make - Result.put (create {JSON_STRING}.make_json (value), create {JSON_STRING}.make_json ("value")) - Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), create {JSON_STRING}.make_json ("callback_change")) - end - -feature --EVENT HANDLING - - set_change_event (e: attached like change_event) - -- Set input change event handle - do - change_event := e - end - - handle_callback (cname: STRING; event: STRING) - do - if Current.control_name.is_equal (cname) and attached change_event as cevent then - if event.is_equal ("change") then - cevent.call ([]) - end - end - end - -feature - - render: STRING - do - Result := "" - end - - set_value (v: STRING) - do - if not v.is_equal (value) then - value := v - state_changes.replace (create {JSON_STRING}.make_json (value), create {JSON_STRING}.make_json ("value")) - end - end - -feature - - type: STRING - - value: STRING - - change_event: detachable PROCEDURE [ANY, TUPLE []] - -end diff --git a/library/server/wsf_html/webcontrol/wsf_multi_control.e b/library/server/wsf_html/webcontrol/wsf_multi_control.e index a7c7029b..ae3bbae2 100644 --- a/library/server/wsf_html/webcontrol/wsf_multi_control.e +++ b/library/server/wsf_html/webcontrol/wsf_multi_control.e @@ -11,32 +11,23 @@ inherit WSF_CONTROL redefine - make, read_state, read_state_changes, load_state end create - make - + make_multi_control feature {NONE} controls: LINKED_LIST [WSF_CONTROL] - make (n: STRING) + make_multi_control (n: STRING) do - Precursor (n) + make (n, "div") controls := create {LINKED_LIST [WSF_CONTROL]}.make; end - make_with_controls (n: STRING; c: LINKED_LIST [WSF_CONTROL]) - do - control_name := n - controls := c - create state_changes.make - end - feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT load_state (new_states: JSON_OBJECT) diff --git a/library/server/wsf_html/webcontrol/wsf_text_control.e b/library/server/wsf_html/webcontrol/wsf_text_control.e index 1f9029ab..73f2b3f4 100644 --- a/library/server/wsf_html/webcontrol/wsf_text_control.e +++ b/library/server/wsf_html/webcontrol/wsf_text_control.e @@ -18,7 +18,7 @@ feature {NONE} make_text (n: STRING; v: STRING) do - make (n) + make (n, "input") text := v end diff --git a/library/server/wsf_html/webcontrol/wsf_textarea_control.e b/library/server/wsf_html/webcontrol/wsf_textarea_control.e index f859fff9..d552bd41 100644 --- a/library/server/wsf_html/webcontrol/wsf_textarea_control.e +++ b/library/server/wsf_html/webcontrol/wsf_textarea_control.e @@ -9,7 +9,7 @@ class inherit - WSF_CONTROL + WSF_TEXT_CONTROL create make_textarea @@ -18,64 +18,7 @@ feature {NONE} make_textarea (n, t: STRING) do - make (n) - text := t + make_text (n, t) + tag_name := "textarea" end - -feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT - - set_state (new_state: JSON_OBJECT) - -- Restore text from json - 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 - - state: JSON_OBJECT - -- Return state which contains the current text and if there is an event handle attached - do - create Result.make - Result.put (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text")) - Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), create {JSON_STRING}.make_json ("callback_change")) - end - -feature --EVENT HANDLING - - set_change_event (e: attached like change_event) - -- Set text change event handle - do - change_event := e - end - - handle_callback (cname: STRING; event: STRING) - do - if Current.control_name.is_equal (cname) and attached change_event as cevent then - if event.is_equal ("change") then - cevent.call ([]) - end - end - end - -feature - - render: STRING - do - Result := "" - end - - set_text (t: STRING) - do - if not t.is_equal (text) then - text := t - state_changes.replace (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text")) - end - end - -feature - - text: STRING - - change_event: detachable PROCEDURE [ANY, TUPLE []] - end