Google news example
This commit is contained in:
@@ -16,8 +16,8 @@ feature -- Update event
|
||||
|
||||
update
|
||||
do
|
||||
if attached on_update_agent as a then
|
||||
a.call([])
|
||||
if attached on_update_agent as a then
|
||||
a.call ([])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
note
|
||||
description: "Summary description for {WSF_GRID_IMAGE_COLUMN}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_GRID_IMAGE_COLUMN
|
||||
|
||||
inherit
|
||||
|
||||
WSF_GRID_COLUMN
|
||||
redefine
|
||||
render_column
|
||||
end
|
||||
|
||||
create
|
||||
make_image_column
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_image_column (a_header, a_field: STRING)
|
||||
do
|
||||
make_column (a_header, a_field)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render_column (e: WSF_ENTITY): STRING
|
||||
do
|
||||
if attached e.get (field_name) as data then
|
||||
Result := "<img src=%"" + data.out + "%" />"
|
||||
else
|
||||
Result := "[VOID]"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -12,9 +12,29 @@ inherit
|
||||
WSF_DATASOURCE [G]
|
||||
redefine
|
||||
state,
|
||||
set_state
|
||||
set_state,
|
||||
update
|
||||
end
|
||||
|
||||
feature -- Update event
|
||||
|
||||
set_on_update_page_agent (f: PROCEDURE [ANY, TUPLE []])
|
||||
do
|
||||
on_update_page_agent := f
|
||||
end
|
||||
|
||||
update
|
||||
do
|
||||
if attached on_update_agent as a then
|
||||
a.call ([])
|
||||
end
|
||||
if attached on_update_page_agent as a then
|
||||
a.call ([])
|
||||
end
|
||||
end
|
||||
|
||||
on_update_page_agent: detachable PROCEDURE [ANY, TUPLE []]
|
||||
|
||||
feature --States
|
||||
|
||||
state: JSON_OBJECT
|
||||
|
||||
@@ -21,6 +21,7 @@ feature {NONE}
|
||||
make_control (n, "ul")
|
||||
add_class ("pagination")
|
||||
datasource := ds
|
||||
datasource.set_on_update_page_agent (agent update)
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
@@ -49,16 +50,19 @@ feature --EVENT HANDLING
|
||||
datasource.set_page (i)
|
||||
end
|
||||
end
|
||||
state_changes.replace (create {JSON_STRING}.make_json (render), create {JSON_STRING}.make_json ("_html"))
|
||||
datasource.update
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
update
|
||||
do
|
||||
state_changes.replace (create {JSON_STRING}.make_json (render), create {JSON_STRING}.make_json ("_html"))
|
||||
end
|
||||
|
||||
render: STRING
|
||||
local
|
||||
page_count: INTEGER
|
||||
paging_start: INTEGER
|
||||
paging_end: INTEGER
|
||||
cssclass: STRING
|
||||
|
||||
Reference in New Issue
Block a user