Make recommended changes
- Implicit casting - Use same_string
This commit is contained in:
@@ -26,10 +26,10 @@ feature -- Update event
|
||||
update
|
||||
do
|
||||
if attached on_update_agent as a then
|
||||
a.call ([])
|
||||
a.call (Void)
|
||||
end
|
||||
if attached on_update_page_agent as a then
|
||||
a.call ([])
|
||||
a.call (Void)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,21 +41,21 @@ feature --States
|
||||
-- Return state which contains the current html and if there is an event handle attached
|
||||
do
|
||||
Result := Precursor
|
||||
Result.put (create {JSON_NUMBER}.make_integer (page), create {JSON_STRING}.make_json ("page"))
|
||||
Result.put (create {JSON_NUMBER}.make_integer (page_size), create {JSON_STRING}.make_json ("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 (page), "page")
|
||||
Result.put (create {JSON_NUMBER}.make_integer (page_size), "page_size")
|
||||
Result.put (create {JSON_NUMBER}.make_integer (row_count), "row_count")
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
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
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,12 +40,12 @@ feature --EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
if Current.control_name.is_equal (cname) then
|
||||
if event.is_equal ("next") then
|
||||
if Current.control_name.same_string (cname) then
|
||||
if event.same_string ("next") then
|
||||
datasource.set_page (datasource.page + 1)
|
||||
elseif event.is_equal ("prev") then
|
||||
elseif event.same_string ("prev") then
|
||||
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
|
||||
datasource.set_page (i)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user