Code improvement
Cosmetic (comments, names, formatting)
This commit is contained in:
@@ -10,13 +10,13 @@ deferred class
|
||||
feature --Event handling
|
||||
|
||||
set_on_update_agent (f: PROCEDURE [ANY, TUPLE])
|
||||
--Set update listener
|
||||
-- Set update listener
|
||||
do
|
||||
on_update_agent := f
|
||||
end
|
||||
|
||||
update
|
||||
--Trigger update listener
|
||||
-- Trigger update listener
|
||||
do
|
||||
if attached on_update_agent as a then
|
||||
a.call (Void)
|
||||
@@ -76,4 +76,14 @@ feature -- Properties
|
||||
|
||||
on_update_agent: detachable PROCEDURE [ANY, TUPLE]
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -6,12 +6,21 @@ note
|
||||
deferred class
|
||||
WSF_ENTITY
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
item alias "[]"(a_field: READABLE_STRING_GENERAL): detachable ANY
|
||||
item alias "[]" (a_field: READABLE_STRING_GENERAL): detachable ANY
|
||||
-- Value for field item `a_field'.
|
||||
deferred
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -25,13 +25,14 @@ feature -- Render
|
||||
-- Return the rendered column cell for a specific entity (row)
|
||||
do
|
||||
if attached e.item (field_name) as data then
|
||||
Result := data.out
|
||||
--| FIXME: .out may not be the best rendering for objects...
|
||||
Result := data.out
|
||||
else
|
||||
Result := "[VOID]"
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Properties
|
||||
feature -- Access
|
||||
|
||||
header: STRING_32
|
||||
|
||||
@@ -41,4 +42,14 @@ feature -- Properties
|
||||
|
||||
field_name: STRING_32
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PAGABLE}."
|
||||
author: ""
|
||||
description: "Summary description for {WSF_PAGABLE_DATASOURCE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -8,7 +7,6 @@ deferred class
|
||||
WSF_PAGABLE_DATASOURCE [G -> WSF_ENTITY]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_DATASOURCE [G]
|
||||
redefine
|
||||
state,
|
||||
@@ -16,16 +14,16 @@ inherit
|
||||
update
|
||||
end
|
||||
|
||||
feature --Event handling
|
||||
feature -- Event handling
|
||||
|
||||
set_on_update_page_agent (f: PROCEDURE [ANY, TUPLE])
|
||||
--Set paging update listener
|
||||
-- Set paging update listener
|
||||
do
|
||||
on_update_page_agent := f
|
||||
end
|
||||
|
||||
update
|
||||
--Trigger update listeners
|
||||
-- Trigger update listeners
|
||||
do
|
||||
Precursor
|
||||
if attached on_update_page_agent as a then
|
||||
@@ -81,4 +79,14 @@ feature -- Properties
|
||||
|
||||
on_update_page_agent: detachable PROCEDURE [ANY, TUPLE]
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -48,16 +48,19 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
|
||||
feature --Event handling
|
||||
|
||||
handle_callback (cname: LIST[STRING_32]; event: STRING_32; event_parameter: detachable ANY)
|
||||
handle_callback (cname: LIST [READABLE_STRING_GENERAL]; event: READABLE_STRING_GENERAL; event_parameter: detachable ANY)
|
||||
-- Handle goto/next/prev events
|
||||
do
|
||||
if Current.control_name.same_string (cname[1]) then
|
||||
if control_name.same_string_general (cname.first) then
|
||||
if event.same_string ("next") then
|
||||
datasource.set_page (datasource.page + 1)
|
||||
elseif event.same_string ("prev") then
|
||||
datasource.set_page (datasource.page - 1)
|
||||
elseif event.same_string ("goto") then
|
||||
if attached {STRING_32}event_parameter as p and then attached p.to_integer as i then
|
||||
if
|
||||
attached {READABLE_STRING_GENERAL} event_parameter as p and then
|
||||
attached p.to_integer as i
|
||||
then
|
||||
datasource.set_page (i)
|
||||
end
|
||||
end
|
||||
@@ -96,4 +99,14 @@ feature -- Properties
|
||||
|
||||
datasource: WSF_PAGABLE_DATASOURCE [G]
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ inherit
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make ( a_datasource: WSF_DATASOURCE [G])
|
||||
make (a_datasource: WSF_DATASOURCE [G])
|
||||
local
|
||||
p: WSF_PAGINATION_CONTROL [G]
|
||||
do
|
||||
@@ -28,7 +28,7 @@ feature {NONE} -- Initialization
|
||||
datasource := a_datasource
|
||||
datasource.set_on_update_agent (agent update)
|
||||
if attached {WSF_PAGABLE_DATASOURCE [G]} a_datasource as ds then
|
||||
create p.make ( ds)
|
||||
create p.make (ds)
|
||||
add_control (p)
|
||||
pagination_control := p
|
||||
end
|
||||
@@ -61,41 +61,52 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
feature -- Rendering
|
||||
|
||||
render_item (item: G): STRING_32
|
||||
--Render item
|
||||
-- Render item
|
||||
deferred
|
||||
end
|
||||
|
||||
render_body: STRING_32
|
||||
--Render Body
|
||||
-- Render Body
|
||||
do
|
||||
Result := ""
|
||||
create Result.make_empty
|
||||
across
|
||||
datasource.data as entity
|
||||
datasource.data as ic
|
||||
loop
|
||||
Result.append (render_item (entity.item))
|
||||
Result.append (render_item (ic.item))
|
||||
end
|
||||
end
|
||||
|
||||
render: STRING_32
|
||||
--Render repeater inclusive paging if paging is available
|
||||
-- Render repeater inclusive paging if paging is available
|
||||
local
|
||||
content: STRING_32
|
||||
do
|
||||
content := render_tag_with_tagname ("div", render_body, "", "repeater_content")
|
||||
Result := ""
|
||||
create Result.make_empty
|
||||
across
|
||||
controls as c
|
||||
controls as ic
|
||||
loop
|
||||
Result := c.item.render + Result
|
||||
-- CHECK: Prepend ? or Append?
|
||||
Result.prepend (ic.item.render)
|
||||
end
|
||||
-- Fix generator name since the user will extend this class to define item_render
|
||||
Result := render_tag_with_generator_name ("WSF_REPEATER_CONTROL", content + Result, "")
|
||||
end
|
||||
|
||||
feature -- Properties
|
||||
feature -- Access
|
||||
|
||||
datasource: WSF_DATASOURCE [G]
|
||||
|
||||
pagination_control: detachable WSF_PAGINATION_CONTROL [G]
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user