Make recommended changes
- Implicit casting - Use same_string
This commit is contained in:
@@ -33,7 +33,7 @@ feature -- Implementation
|
|||||||
loop
|
loop
|
||||||
if c.item.as_lower.has_substring (input.as_lower) then
|
if c.item.as_lower.has_substring (input.as_lower) then
|
||||||
create o.make
|
create o.make
|
||||||
o.put (create {JSON_STRING}.make_json (c.item), "value")
|
o.put (create {JSON_STRING}.make_json(c.item), "value")
|
||||||
Result.add (o)
|
Result.add (o)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ feature -- Update event
|
|||||||
update
|
update
|
||||||
do
|
do
|
||||||
if attached on_update_agent as a then
|
if attached on_update_agent as a then
|
||||||
a.call ([])
|
a.call (Void)
|
||||||
end
|
end
|
||||||
if attached on_update_page_agent as a then
|
if attached on_update_page_agent as a then
|
||||||
a.call ([])
|
a.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,21 +41,21 @@ feature --States
|
|||||||
-- Return state which contains the current html and if there is an event handle attached
|
-- Return state which contains the current html and if there is an event handle attached
|
||||||
do
|
do
|
||||||
Result := Precursor
|
Result := Precursor
|
||||||
Result.put (create {JSON_NUMBER}.make_integer (page), create {JSON_STRING}.make_json ("page"))
|
Result.put (create {JSON_NUMBER}.make_integer (page), "page")
|
||||||
Result.put (create {JSON_NUMBER}.make_integer (page_size), create {JSON_STRING}.make_json ("page_size"))
|
Result.put (create {JSON_NUMBER}.make_integer (page_size), "page_size")
|
||||||
Result.put (create {JSON_NUMBER}.make_integer (row_count), create {JSON_STRING}.make_json ("row_count"))
|
Result.put (create {JSON_NUMBER}.make_integer (row_count), "row_count")
|
||||||
end
|
end
|
||||||
|
|
||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
do
|
do
|
||||||
Precursor (new_state)
|
Precursor (new_state)
|
||||||
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("page")) as new_page then
|
if attached {JSON_NUMBER} new_state.item ("page") as new_page then
|
||||||
page := new_page.item.to_integer
|
page := new_page.item.to_integer
|
||||||
end
|
end
|
||||||
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("page_size")) as new_page_size then
|
if attached {JSON_NUMBER} new_state.item ("page_size") as new_page_size then
|
||||||
page_size := new_page_size.item.to_integer
|
page_size := new_page_size.item.to_integer
|
||||||
end
|
end
|
||||||
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("row_count")) as new_row_count then
|
if attached {JSON_NUMBER} new_state.item ("row_count") as new_row_count then
|
||||||
row_count := new_row_count.item.to_integer
|
row_count := new_row_count.item.to_integer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ feature --EVENT HANDLING
|
|||||||
|
|
||||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||||
do
|
do
|
||||||
if Current.control_name.is_equal (cname) then
|
if Current.control_name.same_string (cname) then
|
||||||
if event.is_equal ("next") then
|
if event.same_string ("next") then
|
||||||
datasource.set_page (datasource.page + 1)
|
datasource.set_page (datasource.page + 1)
|
||||||
elseif event.is_equal ("prev") then
|
elseif event.same_string ("prev") then
|
||||||
datasource.set_page (datasource.page - 1)
|
datasource.set_page (datasource.page - 1)
|
||||||
elseif event.is_equal ("goto") then
|
elseif event.same_string ("goto") then
|
||||||
if attached event_parameter as p and then attached p.to_integer as i then
|
if attached event_parameter as p and then attached p.to_integer as i then
|
||||||
datasource.set_page (i)
|
datasource.set_page (i)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ feature -- State
|
|||||||
state: JSON_OBJECT
|
state: JSON_OBJECT
|
||||||
do
|
do
|
||||||
Result := Precursor {WSF_INPUT_CONTROL}
|
Result := Precursor {WSF_INPUT_CONTROL}
|
||||||
Result.put (create {JSON_STRING}.make_json (template), create {JSON_STRING}.make_json ("template"))
|
Result.put (create {JSON_STRING}.make_json (template), "template")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Callback
|
feature -- Callback
|
||||||
@@ -48,8 +48,8 @@ feature -- Callback
|
|||||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||||
do
|
do
|
||||||
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
|
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
|
||||||
if cname.is_equal (control_name) and event.is_equal ("autocomplete") then
|
if cname.same_string (control_name) and event.same_string ("autocomplete") then
|
||||||
state_changes.put (create_json_list.item ([text]), create {JSON_STRING}.make_json ("suggestions"))
|
state_changes.put (create_json_list.item ([text]), "suggestions")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
-- Restore text from json
|
-- Restore text from json
|
||||||
do
|
do
|
||||||
if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("text")) as new_text then
|
if attached {JSON_STRING} new_state.item ("text") as new_text then
|
||||||
text := new_text.unescaped_string_32
|
text := new_text.unescaped_string_32
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -37,8 +37,8 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
-- Return state which contains the current text and if there is an event handle attached
|
-- Return state which contains the current text and if there is an event handle attached
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
Result.put (create {JSON_STRING}.make_json (text), "text")
|
||||||
Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), create {JSON_STRING}.make_json ("callback_change"))
|
Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), "callback_change")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature --EVENT HANDLING
|
feature --EVENT HANDLING
|
||||||
@@ -51,9 +51,9 @@ feature --EVENT HANDLING
|
|||||||
|
|
||||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||||
do
|
do
|
||||||
if Current.control_name.is_equal (cname) and attached change_event as cevent then
|
if Current.control_name.same_string (cname) and attached change_event as cevent then
|
||||||
if event.is_equal ("change") then
|
if event.same_string ("change") then
|
||||||
cevent.call ([])
|
cevent.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -67,9 +67,9 @@ feature -- Implementation
|
|||||||
|
|
||||||
set_text (t: STRING)
|
set_text (t: STRING)
|
||||||
do
|
do
|
||||||
if not t.is_equal (text) then
|
if not t.same_string (text) then
|
||||||
text := t
|
text := t
|
||||||
state_changes.replace (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
state_changes.replace (create {JSON_STRING}.make_json (text), "text")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ feature -- State handling
|
|||||||
|
|
||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
do
|
do
|
||||||
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("progress")) as new_progress then
|
if attached {JSON_NUMBER} new_state.item ("progress") as new_progress then
|
||||||
progress := new_progress.item.to_integer
|
progress := new_progress.item.to_integer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -48,8 +48,8 @@ feature -- Event handling
|
|||||||
|
|
||||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||||
do
|
do
|
||||||
if cname.is_equal (control_name) and event.is_equal ("progress_fetch") then
|
if cname.same_string (control_name) and event.same_string ("progress_fetch") then
|
||||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress_value), create {JSON_STRING}.make_json ("progress"))
|
state_changes.put (create {JSON_NUMBER}.make_integer (progress_value), "progress")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ feature --Change progress
|
|||||||
no_progress_source: not (attached progress_source)
|
no_progress_source: not (attached progress_source)
|
||||||
do
|
do
|
||||||
progress := p
|
progress := p
|
||||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress), create {JSON_STRING}.make_json ("progress"))
|
state_changes.put (create {JSON_NUMBER}.make_integer (progress), "progress")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ feature
|
|||||||
state: JSON_OBJECT
|
state: JSON_OBJECT
|
||||||
do
|
do
|
||||||
Result := Precursor
|
Result := Precursor
|
||||||
Result.put (create {JSON_NUMBER}.make_integer (max), create {JSON_STRING}.make_json ("max"))
|
Result.put (create {JSON_NUMBER}.make_integer (max), "max")
|
||||||
end
|
end
|
||||||
|
|
||||||
max: INTEGER
|
max: INTEGER
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ feature
|
|||||||
state: JSON_OBJECT
|
state: JSON_OBJECT
|
||||||
do
|
do
|
||||||
Result := Precursor
|
Result := Precursor
|
||||||
Result.put (create {JSON_NUMBER}.make_integer (min), create {JSON_STRING}.make_json ("min"))
|
Result.put (create {JSON_NUMBER}.make_integer (min), "min")
|
||||||
end
|
end
|
||||||
|
|
||||||
min: INTEGER
|
min: INTEGER
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ feature
|
|||||||
state: JSON_OBJECT
|
state: JSON_OBJECT
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (create {JSON_STRING}.make_json ("WSF_REGEXP_VALIDATOR"), create {JSON_STRING}.make_json ("name"))
|
Result.put (create {JSON_STRING}.make_json ("WSF_REGEXP_VALIDATOR"), "name")
|
||||||
Result.put (create {JSON_STRING}.make_json (regexp_string), create {JSON_STRING}.make_json ("expression"))
|
Result.put (create {JSON_STRING}.make_json (regexp_string), "expression")
|
||||||
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
|
Result.put (create {JSON_STRING}.make_json (error), "error")
|
||||||
end
|
end
|
||||||
|
|
||||||
regexp_string: STRING
|
regexp_string: STRING
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ feature
|
|||||||
state: JSON_OBJECT
|
state: JSON_OBJECT
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (create {JSON_STRING}.make_json (generator), create {JSON_STRING}.make_json ("name"))
|
Result.put (create {JSON_STRING}.make_json (generator), "name")
|
||||||
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
|
Result.put (create {JSON_STRING}.make_json (error), "error")
|
||||||
end
|
end
|
||||||
|
|
||||||
is_valid (input: G): BOOLEAN
|
is_valid (input: G): BOOLEAN
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
-- Restore text from json
|
-- Restore text from json
|
||||||
do
|
do
|
||||||
if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("text")) as new_text then
|
if attached {JSON_STRING} new_state.item ("text") as new_text then
|
||||||
text := new_text.unescaped_string_32
|
text := new_text.unescaped_string_32
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -38,8 +38,8 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
-- Return state which contains the current text and if there is an event handle attached
|
-- Return state which contains the current text and if there is an event handle attached
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
Result.put (create {JSON_STRING}.make_json (text), "text")
|
||||||
Result.put (create {JSON_BOOLEAN}.make_boolean (attached click_event), create {JSON_STRING}.make_json ("callback_click"))
|
Result.put (create {JSON_BOOLEAN}.make_boolean (attached click_event), "callback_click")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature --EVENT HANDLING
|
feature --EVENT HANDLING
|
||||||
@@ -52,8 +52,8 @@ feature --EVENT HANDLING
|
|||||||
|
|
||||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||||
do
|
do
|
||||||
if Current.control_name.is_equal (cname) and attached click_event as cevent then
|
if Current.control_name.same_string (cname) and attached click_event as cevent then
|
||||||
cevent.call ([])
|
cevent.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -66,9 +66,9 @@ feature
|
|||||||
|
|
||||||
set_text (t: STRING)
|
set_text (t: STRING)
|
||||||
do
|
do
|
||||||
if not t.is_equal (text) then
|
if not t.same_string (text) then
|
||||||
text := t
|
text := t
|
||||||
state_changes.replace (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
state_changes.replace (create {JSON_STRING}.make_json (text), "text")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ feature -- Validation
|
|||||||
set_error (e: STRING)
|
set_error (e: STRING)
|
||||||
do
|
do
|
||||||
error := e
|
error := e
|
||||||
state_changes.replace (create {JSON_STRING}.make_json (e), create {JSON_STRING}.make_json ("error"))
|
state_changes.replace (create {JSON_STRING}.make_json (e), "error")
|
||||||
end
|
end
|
||||||
|
|
||||||
validate
|
validate
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
-- Restore html from json
|
-- Restore html from json
|
||||||
do
|
do
|
||||||
if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("html")) as new_html then
|
if attached {JSON_STRING} new_state.item ("html") as new_html then
|
||||||
html := new_html.unescaped_string_32
|
html := new_html.unescaped_string_32
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -36,7 +36,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
|||||||
-- Return state which contains the current html and if there is an event handle attached
|
-- Return state which contains the current html and if there is an event handle attached
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (create {JSON_STRING}.make_json (html), create {JSON_STRING}.make_json ("html"))
|
Result.put (create {JSON_STRING}.make_json (html), "html")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature --EVENT HANDLING
|
feature --EVENT HANDLING
|
||||||
@@ -54,9 +54,9 @@ feature -- Implementation
|
|||||||
|
|
||||||
set_html (t: STRING)
|
set_html (t: STRING)
|
||||||
do
|
do
|
||||||
if not t.is_equal (html) then
|
if not t.same_string (html) then
|
||||||
html := t
|
html := t
|
||||||
state_changes.replace (create {JSON_STRING}.make_json (html), create {JSON_STRING}.make_json ("html"))
|
state_changes.replace (create {JSON_STRING}.make_json (html), "html")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user