diff --git a/draft/library/wsf_js_widget/kernel/autocompletion/wsf_simple_autocompletion.e b/draft/library/wsf_js_widget/kernel/autocompletion/wsf_simple_autocompletion.e index 19f900f8..ca9c014b 100644 --- a/draft/library/wsf_js_widget/kernel/autocompletion/wsf_simple_autocompletion.e +++ b/draft/library/wsf_js_widget/kernel/autocompletion/wsf_simple_autocompletion.e @@ -27,7 +27,7 @@ feature -- Implementation autocompletion (input: STRING): JSON_ARRAY -- Implementation local - o: JSON_OBJECT + o: WSF_JSON_OBJECT do create Result.make_array across @@ -35,7 +35,7 @@ feature -- Implementation loop if c.item.as_lower.has_substring (input.as_lower) then create o.make - o.put (create {JSON_STRING}.make_json (c.item), "value") + o.put_string (c.item, "value") Result.add (o) end end diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_datasource.e b/draft/library/wsf_js_widget/kernel/grid/wsf_datasource.e index 7a7a7e4e..601276a1 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_datasource.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_datasource.e @@ -25,19 +25,19 @@ feature --Event handling feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Return state which contains the current sort_column and sort_direction do create Result.make if attached sort_column as a_sort_column then - Result.put (create {JSON_STRING}.make_json (a_sort_column), "sort_column") + Result.put_string (a_sort_column, "sort_column") else Result.put (create {JSON_NULL}, "sort_column") end - Result.put (create {JSON_BOOLEAN}.make_boolean (sort_direction), "sort_direction") + Result.put_boolean (sort_direction, "sort_direction") end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore sort_column and sort_direction from json do if attached {JSON_STRING} new_state.item ("sort_column") as new_sort_column then diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_pagable_datasource.e b/draft/library/wsf_js_widget/kernel/grid/wsf_pagable_datasource.e index e6324baf..64d2a9fe 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_pagable_datasource.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_pagable_datasource.e @@ -35,16 +35,16 @@ feature --Event handling feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Return state which contains the current page, page_size and row_count do Result := Precursor - Result.put (create {JSON_NUMBER}.make_integer (page), "page") - Result.put (create {JSON_NUMBER}.make_integer (page_size), "page_size") - Result.put (create {JSON_NUMBER}.make_integer (row_count), "row_count") + Result.put_integer (page, "page") + Result.put_integer (page_size, "page_size") + Result.put_integer (row_count, "row_count") end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore page, page_size and row_count from json do Precursor (new_state) diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e b/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e index bcb4eb27..0023bea2 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e @@ -26,13 +26,13 @@ feature {NONE} feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Return empty do create Result.make end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- There is no state to restore states do end diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e b/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e index 7aa6e61f..c7fcefb5 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e @@ -38,15 +38,15 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management state_changes.replace (datasource.state, "datasource") end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore datasource state from json do - if attached {JSON_OBJECT} new_state.item ("datasource") as datasource_state then + if attached {WSF_JSON_OBJECT} new_state.item ("datasource") as datasource_state then datasource.set_state (datasource_state) end end - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Return state which contains the current datasource state do create Result.make diff --git a/draft/library/wsf_js_widget/kernel/input/wsf_autocomplete_control.e b/draft/library/wsf_js_widget/kernel/input/wsf_autocomplete_control.e index 8223ac33..1e4e4ba9 100644 --- a/draft/library/wsf_js_widget/kernel/input/wsf_autocomplete_control.e +++ b/draft/library/wsf_js_widget/kernel/input/wsf_autocomplete_control.e @@ -39,10 +39,10 @@ feature {NONE} -- Initialization feature -- State - state: JSON_OBJECT + state: WSF_JSON_OBJECT do Result := Precursor {WSF_INPUT_CONTROL} - Result.put (create {JSON_STRING}.make_json (template), "template") + Result.put_string (template, "template") end feature -- Callback diff --git a/draft/library/wsf_js_widget/kernel/input/wsf_checkbox_control.e b/draft/library/wsf_js_widget/kernel/input/wsf_checkbox_control.e index fc7ad30e..45891b33 100644 --- a/draft/library/wsf_js_widget/kernel/input/wsf_checkbox_control.e +++ b/draft/library/wsf_js_widget/kernel/input/wsf_checkbox_control.e @@ -26,7 +26,7 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore text from json do if attached {JSON_BOOLEAN} new_state.item ("checked") as new_checked then @@ -34,13 +34,13 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - state: JSON_OBJECT + state: WSF_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_BOOLEAN}.make_boolean (checked), "checked") - Result.put (create {JSON_STRING}.make_json (checked_value), "checked_value") - Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), "callback_change") + Result.put_boolean (checked, "checked") + Result.put_string (checked_value, "checked_value") + Result.put_boolean (attached change_event, "callback_change") end feature --Event handling diff --git a/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e b/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e index c3a3481b..73243508 100644 --- a/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e +++ b/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e @@ -26,7 +26,7 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore text from json do if attached {JSON_STRING} new_state.item ("text") as new_text then @@ -34,12 +34,12 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - state: JSON_OBJECT + state: WSF_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), "text") - Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), "callback_change") + Result.put_string (text, "text") + Result.put_boolean (attached change_event, "callback_change") end feature --Event handling diff --git a/draft/library/wsf_js_widget/kernel/progressbar/wsf_progress_control.e b/draft/library/wsf_js_widget/kernel/progressbar/wsf_progress_control.e index 51b7c171..ff51c6d7 100644 --- a/draft/library/wsf_js_widget/kernel/progressbar/wsf_progress_control.e +++ b/draft/library/wsf_js_widget/kernel/progressbar/wsf_progress_control.e @@ -33,17 +33,17 @@ feature {NONE} -- Initialization feature -- State handling - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) do if attached {JSON_NUMBER} new_state.item ("progress") as new_progress then progress := new_progress.item.to_integer end end - state: JSON_OBJECT + state: WSF_JSON_OBJECT do create Result.make - Result.put (create {JSON_NUMBER}.make_integer (progress_value), "progress") + Result.put_integer (progress_value, "progress") end feature -- Event handling @@ -51,7 +51,7 @@ feature -- Event handling handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING) do if cname.same_string (control_name) and event.same_string ("progress_fetch") then - state_changes.put (create {JSON_NUMBER}.make_integer (progress_value), "progress") + state_changes.put_integer (progress_value, "progress") end end @@ -75,7 +75,7 @@ feature -- Change valid_input_value: p >= 0 and p <= 100 do progress := p - state_changes.put (create {JSON_NUMBER}.make_integer (progress), "progress") + state_changes.put_integer (progress, "progress") end feature -- Implementation diff --git a/draft/library/wsf_js_widget/kernel/slider/wsf_image_slider_control.e b/draft/library/wsf_js_widget/kernel/slider/wsf_image_slider_control.e index 7e1f4948..1f3fcce7 100644 --- a/draft/library/wsf_js_widget/kernel/slider/wsf_image_slider_control.e +++ b/draft/library/wsf_js_widget/kernel/slider/wsf_image_slider_control.e @@ -29,11 +29,11 @@ feature {NONE} -- Initialization feature -- State handling - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) do end - state: JSON_OBJECT + state: WSF_JSON_OBJECT do create Result.make end diff --git a/draft/library/wsf_js_widget/kernel/validator/wsf_max_validator.e b/draft/library/wsf_js_widget/kernel/validator/wsf_max_validator.e index 58ea1c56..2dc91970 100644 --- a/draft/library/wsf_js_widget/kernel/validator/wsf_max_validator.e +++ b/draft/library/wsf_js_widget/kernel/validator/wsf_max_validator.e @@ -35,10 +35,10 @@ feature -- Implementation feature -- State - state: JSON_OBJECT + state: WSF_JSON_OBJECT do Result := Precursor - Result.put (create {JSON_NUMBER}.make_integer (max), "max") + Result.put_integer (max, "max") end feature -- Properties diff --git a/draft/library/wsf_js_widget/kernel/validator/wsf_min_validator.e b/draft/library/wsf_js_widget/kernel/validator/wsf_min_validator.e index b93d9c15..68d299d8 100644 --- a/draft/library/wsf_js_widget/kernel/validator/wsf_min_validator.e +++ b/draft/library/wsf_js_widget/kernel/validator/wsf_min_validator.e @@ -35,10 +35,10 @@ feature -- Implementation feature -- State - state: JSON_OBJECT + state: WSF_JSON_OBJECT do Result := Precursor - Result.put (create {JSON_NUMBER}.make_integer (min), "min") + Result.put_integer (min, "min") end feature -- Properties diff --git a/draft/library/wsf_js_widget/kernel/validator/wsf_regexp_validator.e b/draft/library/wsf_js_widget/kernel/validator/wsf_regexp_validator.e index 6394d327..95fd6d94 100644 --- a/draft/library/wsf_js_widget/kernel/validator/wsf_regexp_validator.e +++ b/draft/library/wsf_js_widget/kernel/validator/wsf_regexp_validator.e @@ -40,12 +40,12 @@ feature -- Implementation feature -- State - state: JSON_OBJECT + state: WSF_JSON_OBJECT do create Result.make - Result.put (create {JSON_STRING}.make_json ("WSF_REGEXP_VALIDATOR"), "name") - Result.put (create {JSON_STRING}.make_json (regexp_string), "expression") - Result.put (create {JSON_STRING}.make_json (error), "error") + Result.put_string ("WSF_REGEXP_VALIDATOR", "name") + Result.put_string (regexp_string, "expression") + Result.put_string (error, "error") end feature -- Properties diff --git a/draft/library/wsf_js_widget/kernel/validator/wsf_validator.e b/draft/library/wsf_js_widget/kernel/validator/wsf_validator.e index e21df037..0a769637 100644 --- a/draft/library/wsf_js_widget/kernel/validator/wsf_validator.e +++ b/draft/library/wsf_js_widget/kernel/validator/wsf_validator.e @@ -17,12 +17,12 @@ feature {NONE} -- Initialization feature -- Access - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- JSON state of this validator do create Result.make - Result.put (create {JSON_STRING}.make_json (generator), "name") - Result.put (create {JSON_STRING}.make_json (error), "error") + Result.put_string (generator, "name") + Result.put_string (error, "error") end is_valid (input: G): BOOLEAN diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e index 08ede96d..8dd9ba5d 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e @@ -27,7 +27,7 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore text from json do if attached {JSON_STRING} new_state.item ("text") as new_text then @@ -35,12 +35,12 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - state: JSON_OBJECT + state: WSF_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), "text") - Result.put (create {JSON_BOOLEAN}.make_boolean (attached click_event), "callback_click") + Result.put_string (text, "text") + Result.put_boolean (attached click_event, "callback_click") end feature --Event handling diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e index 761e0207..11e34cde 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e @@ -40,49 +40,49 @@ feature -- Actions start_modal(url:STRING; title:STRING) --Start a modal window containg an other or the same page local - modal:JSON_OBJECT + modal:WSF_JSON_OBJECT do create modal.make - modal.put (create {JSON_STRING}.make_json("start_modal"), "type") - modal.put (create {JSON_STRING}.make_json(url), "url") - modal.put (create {JSON_STRING}.make_json(title), "title") + modal.put_string ("start_modal", "type") + modal.put_string (url, "url") + modal.put_string (title, "title") actions.add (modal) end show_alert(mesage:STRING) --Start a modal window containg an other or the same page local - modal:JSON_OBJECT + modal:WSF_JSON_OBJECT do create modal.make - modal.put (create {JSON_STRING}.make_json("show_alert"), "type") - modal.put (create {JSON_STRING}.make_json(mesage), "message") + modal.put_string ("show_alert", "type") + modal.put_string (mesage, "message") actions.add (modal) end feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT - load_state (new_states: JSON_OBJECT) + load_state (new_states: WSF_JSON_OBJECT) -- Select state stored with `control_name` as key do - if attached {JSON_OBJECT} new_states.item ("state") as new_state_obj then + if attached {WSF_JSON_OBJECT} new_states.item ("state") as new_state_obj then set_state (new_state_obj) end end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Before we process the callback. We restore the state of control. deferred end - full_state: JSON_OBJECT + full_state: WSF_JSON_OBJECT -- Return state of object do create Result.make Result.put (state, "state") end - read_state_changes (states: JSON_OBJECT) + read_state_changes (states: WSF_JSON_OBJECT) -- Add a new entry in the `states_changes` JSON object with the `control_name` as key and the `state` as value do if state_changes.count > 0 then @@ -102,14 +102,14 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT end end - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Returns the current state of the Control as JSON. This state will be transfered to the client. deferred ensure controls_not_defined: not (attached Result.item ("controls")) end - state_changes: JSON_OBJECT + state_changes: WSF_JSON_OBJECT feature -- Rendering diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e index bc1adac7..43cd1938 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e @@ -48,24 +48,24 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - load_state (new_states: JSON_OBJECT) + load_state (new_states: WSF_JSON_OBJECT) -- Pass new_states to subcontrols do Precursor (new_states) - if attached {JSON_OBJECT} new_states.item ("controls") as ct and then attached {JSON_OBJECT} ct.item (value_control.control_name) as value_state then + if attached {WSF_JSON_OBJECT} new_states.item ("controls") as ct and then attached {WSF_JSON_OBJECT} ct.item (value_control.control_name) as value_state then value_control.load_state (value_state) end end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Set new state do value_control.set_state (new_state) end - full_state: JSON_OBJECT + full_state: WSF_JSON_OBJECT local - controls_state: JSON_OBJECT + controls_state: WSF_JSON_OBJECT do Result := Precursor create controls_state.make @@ -73,14 +73,14 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management Result.put (controls_state, "controls") end - read_state_changes (states: JSON_OBJECT) + read_state_changes (states: WSF_JSON_OBJECT) -- Read states_changes in subcontrols do Precursor (states) value_control.read_state_changes (states) end - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Read state local validator_description: JSON_ARRAY @@ -92,7 +92,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management loop validator_description.add (v.item.state) end - Result.put (create {JSON_STRING}.make_json (value_control.control_name), "value_control") + Result.put_string (value_control.control_name, "value_control") Result.put (validator_description, "validators") end diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_html_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_html_control.e index fda72b26..2637a182 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_html_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_html_control.e @@ -25,7 +25,7 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Restore html from json do if attached {JSON_STRING} new_state.item ("html") as new_html then @@ -33,11 +33,11 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - state: JSON_OBJECT + state: WSF_JSON_OBJECT -- Return state which contains the current html and if there is an event handle attached do create Result.make - Result.put (create {JSON_STRING}.make_json (html), "html") + Result.put_string (html, "html") end feature --Event handling @@ -58,7 +58,7 @@ feature -- Implementation do if not t.same_string (html) then html := t - state_changes.replace (create {JSON_STRING}.make_json (html), "html") + state_changes.replace_with_string (html, "html") end end diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_json_object.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_json_object.e new file mode 100644 index 00000000..a42e114e --- /dev/null +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_json_object.e @@ -0,0 +1,130 @@ +note + description: "Summary description for {WSF_JSON_OBJECT}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_JSON_OBJECT + +inherit + + JSON_OBJECT + +create + make + +feature + + put_string (value: READABLE_STRING_GENERAL; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + require + key_not_present: not has_key (key) + local + l_value: JSON_STRING + do + create l_value.make_json_from_string_32 (value.as_string_32) + put (l_value, key) + end + + put_integer (value: INTEGER_64; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + require + key_not_present: not has_key (key) + local + l_value: JSON_NUMBER + do + create l_value.make_integer (value) + put (l_value, key) + end + + put_natural (value: NATURAL_64; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + require + key_not_present: not has_key (key) + local + l_value: JSON_NUMBER + do + create l_value.make_natural (value) + put (l_value, key) + end + + put_real (value: DOUBLE; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + require + key_not_present: not has_key (key) + local + l_value: JSON_NUMBER + do + create l_value.make_real (value) + put (l_value, key) + end + + put_boolean (value: BOOLEAN; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + require + key_not_present: not has_key (key) + local + l_value: JSON_BOOLEAN + do + create l_value.make_boolean (value) + put (l_value, key) + end + + replace_with_string (value: READABLE_STRING_GENERAL; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + local + l_value: JSON_STRING + do + create l_value.make_json_from_string_32 (value.as_string_32) + replace (l_value, key) + end + + replace_with_integer (value: INTEGER_64; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + local + l_value: JSON_NUMBER + do + create l_value.make_integer (value) + replace (l_value, key) + end + + replace_with_with_natural (value: NATURAL_64; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + local + l_value: JSON_NUMBER + do + create l_value.make_natural (value) + replace (l_value, key) + end + + replace_with_real (value: DOUBLE; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + local + l_value: JSON_NUMBER + do + create l_value.make_real (value) + replace (l_value, key) + end + + + replace_with_boolean (value: BOOLEAN; key: JSON_STRING) + -- Assuming there is no item of key `key', + -- insert `value' with `key'. + local + l_value: JSON_BOOLEAN + do + create l_value.make_boolean (value) + replace (l_value, key) + end + +end diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e index 6c281c0b..a86f65dc 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e @@ -36,16 +36,16 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - load_state (new_states: JSON_OBJECT) + load_state (new_states: WSF_JSON_OBJECT) -- Pass new_states to subcontrols do Precursor (new_states) - if attached {JSON_OBJECT} new_states.item ("controls") as ct then + if attached {WSF_JSON_OBJECT} new_states.item ("controls") as ct then across controls as c loop if attached {WSF_CONTROL} c.item as cont then - if attached {JSON_OBJECT} ct.item (cont.control_name) as value_state then + if attached {WSF_JSON_OBJECT} ct.item (cont.control_name) as value_state then cont.load_state (value_state) end end @@ -53,15 +53,15 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - set_state (new_state: JSON_OBJECT) + set_state (new_state: WSF_JSON_OBJECT) -- Before we process the callback. We restore the state of control. do end - full_state: JSON_OBJECT + full_state: WSF_JSON_OBJECT -- Read states in subcontrols local - controls_state: JSON_OBJECT + controls_state: WSF_JSON_OBJECT do Result := Precursor create controls_state.make @@ -75,7 +75,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management Result.put (controls_state, "controls") end - read_state_changes (states: JSON_OBJECT) + read_state_changes (states: WSF_JSON_OBJECT) -- Read states_changes in subcontrols do Precursor (states) @@ -88,7 +88,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management end end - state: JSON_OBJECT + state: WSF_JSON_OBJECT --Read state do create Result.make diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e index 31d5d769..3b9861c0 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e @@ -60,7 +60,7 @@ feature -- Implementation event_parameter: detachable STRING event_control_name: detachable STRING states: STRING - states_changes: JSON_OBJECT + states_changes: WSF_JSON_OBJECT json_parser: JSON_PARSER do event_control_name := get_parameter ("control_name") @@ -70,7 +70,7 @@ feature -- Implementation create states.make_empty request.read_input_data_into (states) create json_parser.make_parser (states) - if attached {JSON_OBJECT} json_parser.parse_json as sp then + if attached {WSF_JSON_OBJECT} json_parser.parse_json as sp then set_state (sp) end handle_callback (event_control_name, event, event_parameter) @@ -126,7 +126,7 @@ feature -- Implementation end - read_state_changes (states: JSON_OBJECT) + read_state_changes (states: WSF_JSON_OBJECT) -- Add a new entry in the `states_changes` JSON object with the `control_name` as key and the `state` as value do Precursor (states) @@ -155,24 +155,24 @@ feature -- Event handling feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management - state: JSON_OBJECT + state: WSF_JSON_OBJECT do create Result.make - Result.put (create {JSON_STRING}.make_json (control_name), "id") - Result.put (create {JSON_STRING}.make_json (request.path_info), "url") - Result.put (create {JSON_STRING}.make_json (request.query_string), "url_params") + Result.put_string (control_name, "id") + Result.put_string (request.path_info, "url") + Result.put_string (request.query_string, "url_params") end - set_state (sp: JSON_OBJECT) + set_state (sp: WSF_JSON_OBJECT) do - if attached {JSON_OBJECT} sp.item ("controls") as ct and then attached {JSON_OBJECT} ct.item (control.control_name) as value_state then + if attached {WSF_JSON_OBJECT} sp.item ("controls") as ct and then attached {WSF_JSON_OBJECT} ct.item (control.control_name) as value_state then control.load_state (value_state) end end - full_state: JSON_OBJECT + full_state: WSF_JSON_OBJECT local - controls_state: JSON_OBJECT + controls_state: WSF_JSON_OBJECT do create Result.make create controls_state.make