Make recommended changes

- Implicit casting
- Use same_string
This commit is contained in:
YNH Webdev
2013-09-20 20:49:03 +02:00
parent 0a2883e040
commit b5ef1fbbb5
13 changed files with 47 additions and 47 deletions

View File

@@ -29,7 +29,7 @@ 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
if attached {JSON_STRING} new_state.item ("text") as new_text then
text := new_text.unescaped_string_32
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
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 click_event), create {JSON_STRING}.make_json ("callback_click"))
Result.put (create {JSON_STRING}.make_json (text), "text")
Result.put (create {JSON_BOOLEAN}.make_boolean (attached click_event), "callback_click")
end
feature --EVENT HANDLING
@@ -52,8 +52,8 @@ feature --EVENT HANDLING
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
do
if Current.control_name.is_equal (cname) and attached click_event as cevent then
cevent.call ([])
if Current.control_name.same_string (cname) and attached click_event as cevent then
cevent.call (Void)
end
end
@@ -66,9 +66,9 @@ feature
set_text (t: STRING)
do
if not t.is_equal (text) then
if not t.same_string (text) then
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

View File

@@ -128,7 +128,7 @@ feature -- Validation
set_error (e: STRING)
do
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
validate

View File

@@ -27,7 +27,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
set_state (new_state: JSON_OBJECT)
-- Restore html from json
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
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
do
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
feature --EVENT HANDLING
@@ -54,9 +54,9 @@ feature -- Implementation
set_html (t: STRING)
do
if not t.is_equal (html) then
if not t.same_string (html) then
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