Fix load state error

This commit is contained in:
YNH Webdev
2013-09-28 09:44:39 +02:00
parent cb1a4825d2
commit 1100328fee
16 changed files with 47 additions and 30 deletions

View File

@@ -37,7 +37,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
Result.put_boolean (sort_direction, "sort_direction")
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: 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

View File

@@ -44,7 +44,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
Result.put_integer (row_count, "row_count")
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore page, page_size and row_count from json
do
Precursor (new_state)

View File

@@ -32,7 +32,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
create Result.make
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- There is no state to restore states
do
end

View File

@@ -38,10 +38,10 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
state_changes.replace (datasource.state, "datasource")
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore datasource state from json
do
if attached {WSF_JSON_OBJECT} new_state.item ("datasource") as datasource_state then
if attached {JSON_OBJECT} new_state.item ("datasource") as datasource_state then
datasource.set_state (datasource_state)
end
end

View File

@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore text from json
do
if attached {JSON_BOOLEAN} new_state.item ("checked") as new_checked then

View File

@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore text from json
do
if attached {JSON_STRING} new_state.item ("text") as new_text then

View File

@@ -33,7 +33,7 @@ feature {NONE} -- Initialization
feature -- State handling
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
do
if attached {JSON_NUMBER} new_state.item ("progress") as new_progress then
progress := new_progress.item.to_integer

View File

@@ -29,7 +29,7 @@ feature {NONE} -- Initialization
feature -- State handling
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
do
end

View File

@@ -27,7 +27,7 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore text from json
do
if attached {JSON_STRING} new_state.item ("text") as new_text then

View File

@@ -62,15 +62,15 @@ feature -- Actions
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
load_state (new_states: WSF_JSON_OBJECT)
load_state (new_states: JSON_OBJECT)
-- Select state stored with `control_name` as key
do
if attached {WSF_JSON_OBJECT} new_states.item ("state") as new_state_obj then
if attached {JSON_OBJECT} new_states.item ("state") as new_state_obj then
set_state (new_state_obj)
end
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Before we process the callback. We restore the state of control.
deferred
end

View File

@@ -48,16 +48,16 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
load_state (new_states: WSF_JSON_OBJECT)
load_state (new_states: JSON_OBJECT)
-- Pass new_states to subcontrols
do
Precursor (new_states)
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
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
value_control.load_state (value_state)
end
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Set new state
do
value_control.set_state (new_state)

View File

@@ -25,7 +25,7 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Restore html from json
do
if attached {JSON_STRING} new_state.item ("html") as new_html then

View File

@@ -36,16 +36,16 @@ feature {NONE} -- Initialization
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
load_state (new_states: WSF_JSON_OBJECT)
load_state (new_states: JSON_OBJECT)
-- Pass new_states to subcontrols
do
Precursor (new_states)
if attached {WSF_JSON_OBJECT} new_states.item ("controls") as ct then
if attached {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 {WSF_JSON_OBJECT} ct.item (cont.control_name) as value_state then
if attached {JSON_OBJECT} ct.item (cont.control_name) as value_state then
cont.load_state (value_state)
end
end
@@ -53,7 +53,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
end
end
set_state (new_state: WSF_JSON_OBJECT)
set_state (new_state: JSON_OBJECT)
-- Before we process the callback. We restore the state of control.
do
end

View File

@@ -70,7 +70,7 @@ feature -- Implementation
create states.make_empty
request.read_input_data_into (states)
create json_parser.make_parser (states)
if attached {WSF_JSON_OBJECT} json_parser.parse_json as sp then
if attached {JSON_OBJECT} json_parser.parse_json as sp then
set_state (sp)
end
handle_callback (event_control_name, event, event_parameter)
@@ -161,9 +161,9 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
Result.put_string (request.query_string, "url_params")
end
set_state (sp: WSF_JSON_OBJECT)
set_state (sp: JSON_OBJECT)
do
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
if attached {JSON_OBJECT} sp.item ("controls") as ct and then attached {JSON_OBJECT} ct.item (control.control_name) as value_state then
control.load_state (value_state)
end
end