Move project to wsf_js_widget
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_AUTOCOMPLETION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_AUTOCOMPLETION
|
||||
|
||||
feature
|
||||
|
||||
autocompletion (input: STRING): JSON_ARRAY
|
||||
deferred
|
||||
end
|
||||
|
||||
template: detachable STRING
|
||||
|
||||
end
|
||||
@@ -1,46 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_SIMPLE_AUTOCOMPLETION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_SIMPLE_AUTOCOMPLETION
|
||||
|
||||
inherit
|
||||
|
||||
WSF_AUTOCOMPLETION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (l: ITERABLE [STRING])
|
||||
do
|
||||
list := l
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
autocompletion (input: STRING): JSON_ARRAY
|
||||
local
|
||||
o: JSON_OBJECT
|
||||
do
|
||||
create Result.make_array
|
||||
across
|
||||
list as c
|
||||
loop
|
||||
if c.item.as_lower.has_substring (input.as_lower) then
|
||||
create o.make
|
||||
o.put (create {JSON_STRING}.make_json (c.item), "value")
|
||||
Result.add (o)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
list: ITERABLE [STRING]
|
||||
|
||||
end
|
||||
@@ -1,82 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DATASOURCE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DATASOURCE [G -> WSF_ENTITY]
|
||||
|
||||
feature -- Update event
|
||||
|
||||
set_on_update_agent (f: PROCEDURE [ANY, TUPLE])
|
||||
do
|
||||
on_update_agent := f
|
||||
end
|
||||
|
||||
update
|
||||
do
|
||||
if attached on_update_agent as a then
|
||||
a.call (Void)
|
||||
end
|
||||
end
|
||||
|
||||
on_update_agent: detachable PROCEDURE [ANY, TUPLE]
|
||||
|
||||
feature --State
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- Return state which contains the current html and if there is an event handle attached
|
||||
do
|
||||
create Result.make
|
||||
if attached sort_column as a_sort_column then
|
||||
Result.put (create {JSON_STRING}.make_json (a_sort_column), "sort_column")
|
||||
else
|
||||
Result.put (create {JSON_NULL}, "sort_column")
|
||||
end
|
||||
Result.put (create {JSON_BOOLEAN}.make_boolean (sort_direction), "sort_direction")
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
if attached {JSON_NUMBER} new_state.item ("page") as new_page then
|
||||
page := new_page.integer_type
|
||||
end
|
||||
if attached {JSON_NUMBER} new_state.item ("page_size") as new_page_size then
|
||||
page_size := new_page_size.integer_type
|
||||
end
|
||||
if attached {JSON_STRING} new_state.item ("sort_column") as new_sort_column then
|
||||
sort_column := new_sort_column.unescaped_string_32 -- Implicit Conversion !
|
||||
elseif attached {JSON_NULL} new_state.item ("sort_column") as new_sort_column then
|
||||
sort_column := Void
|
||||
end
|
||||
if attached {JSON_BOOLEAN} new_state.item ("sort_direction") as new_sort_direction then
|
||||
sort_direction := new_sort_direction.item
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
set_sort_column (a_sort_column: like sort_column)
|
||||
do
|
||||
sort_column := a_sort_column
|
||||
end
|
||||
|
||||
set_sort_direction (a_sort_direction: like sort_direction)
|
||||
do
|
||||
sort_direction := a_sort_direction
|
||||
end
|
||||
|
||||
page: INTEGER
|
||||
|
||||
page_size: INTEGER
|
||||
|
||||
sort_column: detachable STRING
|
||||
|
||||
sort_direction: BOOLEAN
|
||||
|
||||
data: ITERABLE [G]
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ENTITY}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_ENTITY
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (a_field: READABLE_STRING_GENERAL): detachable ANY
|
||||
-- Value for field item `a_field'.
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,41 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_GRID_COLUMN}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_GRID_COLUMN
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (a_header, a_field: STRING)
|
||||
do
|
||||
header := a_header
|
||||
field_name := a_field
|
||||
sorting_name := a_field
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
header: STRING
|
||||
|
||||
sortable: BOOLEAN
|
||||
|
||||
sorting_name: STRING
|
||||
|
||||
field_name: STRING
|
||||
|
||||
render_column (e: WSF_ENTITY): STRING
|
||||
do
|
||||
if attached e.item (field_name) as data then
|
||||
Result := data.out
|
||||
else
|
||||
Result := "[VOID]"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,70 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_GRID_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_GRID_CONTROL [G -> WSF_ENTITY]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_REPEATER_CONTROL [G]
|
||||
redefine
|
||||
render
|
||||
end
|
||||
|
||||
create
|
||||
make_grid
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_grid (n: STRING; a_columns: ITERABLE [WSF_GRID_COLUMN]; a_datasource: WSF_DATASOURCE [G])
|
||||
do
|
||||
make_repeater (n, a_datasource)
|
||||
columns := a_columns
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
render_item (item: G): STRING
|
||||
do
|
||||
Result := ""
|
||||
across
|
||||
columns as c
|
||||
loop
|
||||
Result.append (render_tag_with_tagname ("td", c.item.render_column (item), "", ""))
|
||||
end
|
||||
Result := render_tag_with_tagname ("tr", Result, "", "")
|
||||
end
|
||||
|
||||
render_header: STRING
|
||||
do
|
||||
Result := ""
|
||||
across
|
||||
columns as c
|
||||
loop
|
||||
Result.append (render_tag_with_tagname ("th", c.item.header, "", ""))
|
||||
end
|
||||
Result := render_tag_with_tagname ("thead", render_tag_with_tagname ("tr", Result, "", ""), "", "")
|
||||
end
|
||||
|
||||
render: STRING
|
||||
local
|
||||
table: STRING
|
||||
do
|
||||
table := render_tag_with_tagname ("table", render_header + render_tag_with_tagname ("tbody", render_body, "", ""), "", "table table-striped")
|
||||
Result := ""
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
Result := c.item.render + Result
|
||||
end
|
||||
Result := render_tag (table + Result, "")
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
columns: ITERABLE [WSF_GRID_COLUMN]
|
||||
|
||||
end
|
||||
@@ -1,40 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_GRID_IMAGE_COLUMN}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_GRID_IMAGE_COLUMN
|
||||
|
||||
inherit
|
||||
|
||||
WSF_GRID_COLUMN
|
||||
rename
|
||||
make as make_column
|
||||
redefine
|
||||
render_column
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (a_header, a_field: STRING)
|
||||
do
|
||||
make_column (a_header, a_field)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render_column (e: WSF_ENTITY): STRING
|
||||
do
|
||||
if attached e.item (field_name) as data then
|
||||
Result := "<img src=%"" + data.out + "%" />"
|
||||
else
|
||||
Result := "[VOID]"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,77 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PAGABLE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_PAGABLE_DATASOURCE [G -> WSF_ENTITY]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_DATASOURCE [G]
|
||||
redefine
|
||||
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
|
||||
-- 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"))
|
||||
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
|
||||
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
|
||||
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
|
||||
row_count := new_row_count.item.to_integer
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
set_page (p: INTEGER)
|
||||
do
|
||||
page := p.min (page_count).max (1)
|
||||
end
|
||||
|
||||
row_count: INTEGER
|
||||
|
||||
page_count: INTEGER
|
||||
do
|
||||
Result := (row_count / page_size).ceiling
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,92 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PAGINATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_PAGINATION_CONTROL [G -> WSF_ENTITY]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
|
||||
create
|
||||
make_paging
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_paging (n: STRING; ds: WSF_PAGABLE_DATASOURCE [G])
|
||||
do
|
||||
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
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- Return state which contains the current html and if there is an event handle attached
|
||||
do
|
||||
create Result.make
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
end
|
||||
|
||||
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
|
||||
datasource.set_page (datasource.page + 1)
|
||||
elseif event.is_equal ("prev") then
|
||||
datasource.set_page (datasource.page - 1)
|
||||
elseif event.is_equal ("goto") then
|
||||
if attached event_parameter as p and then attached p.to_integer as i then
|
||||
datasource.set_page (i)
|
||||
end
|
||||
end
|
||||
datasource.update
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
update
|
||||
do
|
||||
state_changes.replace (create {JSON_STRING}.make_json (render), "_html")
|
||||
end
|
||||
|
||||
render: STRING
|
||||
local
|
||||
paging_start: INTEGER
|
||||
paging_end: INTEGER
|
||||
cssclass: STRING
|
||||
do
|
||||
Result := render_tag_with_tagname ("li", render_tag_with_tagname ("a", "«", "href=%"#%" data-nr=%"prev%"", ""), "", "")
|
||||
paging_start := (datasource.page - 4).max (1)
|
||||
paging_end := (paging_start + 8).min (datasource.page_count)
|
||||
paging_start := (paging_end - 8).max (1)
|
||||
across
|
||||
paging_start |..| paging_end as n
|
||||
loop
|
||||
if n.item = datasource.page then
|
||||
cssclass := "active"
|
||||
else
|
||||
cssclass := ""
|
||||
end
|
||||
Result := Result + render_tag_with_tagname ("li", render_tag_with_tagname ("a", n.item.out, "href=%"#%" data-nr=%"" + n.item.out + "%"", ""), "", cssclass)
|
||||
end
|
||||
Result := Result + render_tag_with_tagname ("li", render_tag_with_tagname ("a", "»", "href=%"#%" data-nr=%"next%"", ""), "", "")
|
||||
Result := render_tag (Result, "")
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
datasource: WSF_PAGABLE_DATASOURCE [G]
|
||||
|
||||
end
|
||||
@@ -1,100 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_REPEATER_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_REPEATER_CONTROL [G -> WSF_ENTITY]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
redefine
|
||||
set_state,
|
||||
state,
|
||||
handle_callback,
|
||||
render
|
||||
end
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_repeater (n: STRING; a_datasource: WSF_DATASOURCE [G])
|
||||
do
|
||||
make_multi_control (n)
|
||||
datasource := a_datasource
|
||||
datasource.set_on_update_agent (agent update)
|
||||
if attached {WSF_PAGABLE_DATASOURCE [G]} a_datasource as ds then
|
||||
create pagination_control.make_paging (n + "_paging", ds)
|
||||
add_control (pagination_control)
|
||||
end
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
update
|
||||
do
|
||||
state_changes.replace (create {JSON_STRING}.make_json (render_body), "_body")
|
||||
state_changes.replace (datasource.state, "datasource")
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
-- Restore html from json
|
||||
do
|
||||
if attached {JSON_OBJECT} new_state.item ("datasource") as datasource_state then
|
||||
datasource.set_state (datasource_state)
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- Return state which contains the current html and if there is an event handle attached
|
||||
do
|
||||
create Result.make
|
||||
Result.put (datasource.state, "datasource")
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
Precursor (cname, event, event_parameter)
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
render_item (item: G): STRING
|
||||
deferred
|
||||
end
|
||||
|
||||
render_body: STRING
|
||||
do
|
||||
Result := ""
|
||||
across
|
||||
datasource.data as entity
|
||||
loop
|
||||
Result.append (render_item (entity.item))
|
||||
end
|
||||
end
|
||||
|
||||
render: STRING
|
||||
local
|
||||
content: STRING
|
||||
do
|
||||
content := render_tag_with_tagname ("div", render_body, "", "repeater_content")
|
||||
Result := ""
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
Result := c.item.render + Result
|
||||
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
|
||||
|
||||
datasource: WSF_DATASOURCE [G]
|
||||
|
||||
pagination_control: detachable WSF_PAGINATION_CONTROL [G]
|
||||
|
||||
end
|
||||
@@ -1,62 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_AUTOCOMPLETE_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_AUTOCOMPLETE_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_INPUT_CONTROL
|
||||
redefine
|
||||
handle_callback,
|
||||
state
|
||||
end
|
||||
|
||||
create
|
||||
make_autocomplete, make_autocomplete_with_agent
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make_autocomplete (n: STRING; c: WSF_AUTOCOMPLETION)
|
||||
do
|
||||
make_autocomplete_with_agent (n, agent c.autocompletion)
|
||||
if attached c.template as t then
|
||||
template := t
|
||||
end
|
||||
end
|
||||
|
||||
make_autocomplete_with_agent (n: STRING; c: FUNCTION [ANY, TUPLE [STRING], JSON_ARRAY])
|
||||
do
|
||||
make_input (n, "")
|
||||
create_json_list := c
|
||||
template := "{{=value}}"
|
||||
end
|
||||
|
||||
feature -- State
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
Result := Precursor {WSF_INPUT_CONTROL}
|
||||
Result.put (create {JSON_STRING}.make_json (template), create {JSON_STRING}.make_json ("template"))
|
||||
end
|
||||
|
||||
feature -- Callback
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
|
||||
if cname.is_equal (control_name) and event.is_equal ("autocomplete") then
|
||||
state_changes.put (create_json_list.item ([text]), create {JSON_STRING}.make_json ("suggestions"))
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Autocomplete
|
||||
|
||||
create_json_list: FUNCTION [ANY, TUPLE [STRING], JSON_ARRAY]
|
||||
|
||||
template: STRING
|
||||
|
||||
end
|
||||
@@ -1,90 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CHECKBOX_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_CHECKBOX_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALUE_CONTROL [BOOLEAN]
|
||||
|
||||
create
|
||||
make_checkbox
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_checkbox (n: STRING; l: STRING; c: STRING)
|
||||
do
|
||||
make_control (n, "input")
|
||||
label := l
|
||||
checked_value := c
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
-- Restore text from json
|
||||
do
|
||||
if attached {JSON_BOOLEAN} new_state.item ("checked") as new_checked then
|
||||
checked := new_checked.item
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- Return state which contains the current text and if there is an event handle attached
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_BOOLEAN}.make_boolean (checked), "checked")
|
||||
Result.put (create {JSON_STRING}.make_json (checked_value), "checked_value")
|
||||
Result.put (create {JSON_BOOLEAN}.make_boolean (attached change_event), "callback_change")
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
set_change_event (e: attached like change_event)
|
||||
-- Set text change event handle
|
||||
do
|
||||
change_event := e
|
||||
end
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
if Current.control_name.same_string (cname) and attached change_event as cevent then
|
||||
if event.same_string ("change") then
|
||||
cevent.call (Void)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
render: STRING
|
||||
local
|
||||
attrs: STRING
|
||||
do
|
||||
attrs := "type=%"checkbox%""
|
||||
if checked then
|
||||
attrs := attrs + " checked"
|
||||
end
|
||||
Result := render_tag_with_tagname ("div", render_tag_with_tagname ("label", render_tag ("", attrs) + " " + label, "", ""), "", "checkbox")
|
||||
end
|
||||
|
||||
value: BOOLEAN
|
||||
do
|
||||
Result := checked
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
label: STRING
|
||||
|
||||
checked: BOOLEAN
|
||||
|
||||
checked_value: STRING
|
||||
|
||||
change_event: detachable PROCEDURE [ANY, TUPLE]
|
||||
|
||||
end
|
||||
@@ -1,45 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CHECKBOX_LIST_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_CHECKBOX_LIST_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALUE_CONTROL [LIST [STRING]]
|
||||
undefine
|
||||
load_state,
|
||||
read_state,
|
||||
read_state_changes
|
||||
end
|
||||
|
||||
WSF_MULTI_CONTROL [WSF_CHECKBOX_CONTROL]
|
||||
|
||||
create
|
||||
make_checkbox_list_control
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_checkbox_list_control (n: STRING)
|
||||
do
|
||||
make_multi_control (n)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
value: LIST [STRING]
|
||||
do
|
||||
create {ARRAYED_LIST [STRING]} Result.make (0)
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if c.item.value then
|
||||
Result.extend (c.item.checked_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,89 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_TEXT_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_INPUT_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALUE_CONTROL [STRING]
|
||||
|
||||
create
|
||||
make_input
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_input (n: STRING; v: STRING)
|
||||
do
|
||||
make_control (n, "input")
|
||||
type := "text"
|
||||
text := v
|
||||
end
|
||||
|
||||
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
|
||||
text := new_text.unescaped_string_32
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- 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 change_event), create {JSON_STRING}.make_json ("callback_change"))
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
set_change_event (e: attached like change_event)
|
||||
-- Set text change event handle
|
||||
do
|
||||
change_event := e
|
||||
end
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
if Current.control_name.is_equal (cname) and attached change_event as cevent then
|
||||
if event.is_equal ("change") then
|
||||
cevent.call ([])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag ("", "type=%"" + type + "%" value=%"" + text + "%"")
|
||||
end
|
||||
|
||||
set_text (t: STRING)
|
||||
do
|
||||
if not t.is_equal (text) then
|
||||
text := t
|
||||
state_changes.replace (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
||||
end
|
||||
end
|
||||
|
||||
value: STRING
|
||||
do
|
||||
Result := text
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
text: STRING
|
||||
|
||||
type: STRING
|
||||
|
||||
change_event: detachable PROCEDURE [ANY, TUPLE []]
|
||||
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PASSWORD_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_PASSWORD_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_INPUT_CONTROL
|
||||
|
||||
create
|
||||
make_password
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_password (n: STRING; v: STRING)
|
||||
do
|
||||
make_input (n, v)
|
||||
type := "password"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_TEXT_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_TEXTAREA_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_INPUT_CONTROL
|
||||
redefine
|
||||
render
|
||||
end
|
||||
|
||||
create
|
||||
make_textarea
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_textarea (n, t: STRING)
|
||||
do
|
||||
make_input (n, t)
|
||||
tag_name := "textarea"
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag (text, "")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,89 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_NAVBAR_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_NAVBAR_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
|
||||
create
|
||||
make_navbar
|
||||
|
||||
feature
|
||||
|
||||
collapse: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
|
||||
nav: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
|
||||
nav_right: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
|
||||
feature
|
||||
|
||||
add_element (c: WSF_STATELESS_CONTROL)
|
||||
do
|
||||
add_element_to_nav (c, nav)
|
||||
end
|
||||
|
||||
add_element_right (c: WSF_STATELESS_CONTROL)
|
||||
do
|
||||
add_element_to_nav (c, nav_right)
|
||||
end
|
||||
|
||||
add_element_to_nav (e: WSF_STATELESS_CONTROL; n: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL])
|
||||
local
|
||||
li: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
do
|
||||
create li.make_with_tag_name ("li")
|
||||
li.add_control (e)
|
||||
n.add_control (li)
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_navbar (b: STRING)
|
||||
local
|
||||
container: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
header: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
collapse_button: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
brand: WSF_BASIC_CONTROL
|
||||
icon_bar: WSF_BASIC_CONTROL
|
||||
do
|
||||
make_multi_control
|
||||
add_class ("navbar navbar-inverse navbar-fixed-top")
|
||||
create container.make_multi_control
|
||||
create header.make_multi_control
|
||||
create collapse_button.make_with_tag_name ("button")
|
||||
create collapse.make_multi_control
|
||||
create nav.make_with_tag_name ("ul")
|
||||
create nav_right.make_with_tag_name ("ul")
|
||||
create brand.make_control ("a")
|
||||
create icon_bar.make_control ("span")
|
||||
container.add_class ("container")
|
||||
header.add_class ("navbar-header")
|
||||
collapse_button.add_class ("navbar-toggle")
|
||||
icon_bar.add_class ("icon-bar")
|
||||
collapse_button.add_control (icon_bar)
|
||||
collapse_button.add_control (icon_bar)
|
||||
collapse_button.add_control (icon_bar)
|
||||
-- collapse_button.set_attributes ("data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"")
|
||||
brand.add_class ("navbar-brand")
|
||||
brand.set_attributes ("href=%"#%"")
|
||||
brand.set_content (b)
|
||||
header.add_control (collapse_button)
|
||||
header.add_control (brand)
|
||||
nav.add_class ("nav navbar-nav")
|
||||
nav_right.add_class ("nav navbar-nav navbar-right")
|
||||
collapse.add_class ("navbar-collapse")
|
||||
collapse.add_control (nav)
|
||||
collapse.add_control (nav_right)
|
||||
container.add_control (header)
|
||||
container.add_control (collapse)
|
||||
add_control (container)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,91 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PROGRESS_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_PROGRESS_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
|
||||
create
|
||||
make_progress, make_progress_with_source
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_progress (n: STRING)
|
||||
do
|
||||
make_control (n, "div")
|
||||
add_class ("progress")
|
||||
progress := 0
|
||||
end
|
||||
|
||||
make_progress_with_source (n: STRING; p: WSF_PROGRESSSOURCE)
|
||||
do
|
||||
make_progress (n)
|
||||
progress_source := p
|
||||
end
|
||||
|
||||
feature -- State handling
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("progress")) as new_progress then
|
||||
progress := new_progress.item.to_integer
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_NUMBER}.make_integer (progress_value), "progress")
|
||||
end
|
||||
|
||||
feature -- Event handling
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
if cname.is_equal (control_name) and event.is_equal ("progress_fetch") then
|
||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress_value), create {JSON_STRING}.make_json ("progress"))
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render: STRING
|
||||
local
|
||||
p: STRING
|
||||
do
|
||||
p := progress_value.out
|
||||
Result := render_tag_with_tagname ("div", "", "role=%"progressbar%" aria-valuenow=%"" + p + "%" aria-valuemin=%"0%" aria-valuemax=%"100%" style=%"width: " + p + "%%;%"", "progress-bar")
|
||||
Result := render_tag (Result, "")
|
||||
end
|
||||
|
||||
feature --Change progress
|
||||
|
||||
set_progress (p: INTEGER)
|
||||
require
|
||||
no_progress_source: not (attached progress_source)
|
||||
do
|
||||
progress := p
|
||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress), create {JSON_STRING}.make_json ("progress"))
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
progress_source: detachable WSF_PROGRESSSOURCE
|
||||
|
||||
progress: INTEGER
|
||||
|
||||
progress_value: INTEGER
|
||||
do
|
||||
Result := progress
|
||||
if attached progress_source as ps then
|
||||
Result := ps.progress
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PROGRESSSOURCE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_PROGRESSSOURCE
|
||||
|
||||
feature
|
||||
|
||||
progress: INTEGER
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DECIMAL_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_DECIMAL_VALIDATOR
|
||||
|
||||
inherit
|
||||
|
||||
WSF_REGEXP_VALIDATOR
|
||||
|
||||
create
|
||||
make_decimal_validator
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_decimal_validator (e: STRING)
|
||||
do
|
||||
make_regexp_validator ("^[0-9]+(\.[0-9]*)?$|^\.[0-9]+$", e)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EMAIL_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_EMAIL_VALIDATOR
|
||||
|
||||
inherit
|
||||
|
||||
WSF_REGEXP_VALIDATOR
|
||||
|
||||
create
|
||||
make_email_validator
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_email_validator (e: STRING)
|
||||
do
|
||||
make_regexp_validator ("^[a-zA-Z0-9._%%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$", e)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,45 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_MAX_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_max_VALIDATOR [G]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALIDATOR [LIST [G]]
|
||||
redefine
|
||||
state
|
||||
end
|
||||
|
||||
create
|
||||
make_max_validator
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_max_validator (m: INTEGER; e: STRING)
|
||||
do
|
||||
make (e)
|
||||
max := m
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
is_valid (input: LIST [G]): BOOLEAN
|
||||
do
|
||||
Result := input.count < max or input.count = max
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
Result := Precursor
|
||||
Result.put (create {JSON_NUMBER}.make_integer (max), create {JSON_STRING}.make_json ("max"))
|
||||
end
|
||||
|
||||
max: INTEGER
|
||||
|
||||
end
|
||||
@@ -1,45 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_MIN_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_MIN_VALIDATOR[G]
|
||||
|
||||
inherit
|
||||
WSF_VALIDATOR [LIST[G]]
|
||||
redefine
|
||||
state
|
||||
end
|
||||
|
||||
create
|
||||
make_min_validator
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_min_validator (m:INTEGER; e: STRING)
|
||||
do
|
||||
make (e)
|
||||
min := m
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
is_valid (input:LIST[G]): BOOLEAN
|
||||
do
|
||||
Result:= input.count > min or input.count = min
|
||||
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
Result := Precursor
|
||||
Result.put (create {JSON_NUMBER}.make_integer (min), create {JSON_STRING}.make_json ("min"))
|
||||
end
|
||||
|
||||
min: INTEGER
|
||||
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PHONE_NUMBER_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_PHONE_NUMBER_VALIDATOR
|
||||
|
||||
inherit
|
||||
|
||||
WSF_REGEXP_VALIDATOR
|
||||
|
||||
create
|
||||
make_with_message
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_with_message (e: STRING)
|
||||
do
|
||||
make_regexp_validator ("", e)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,54 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_REGEXP_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_REGEXP_VALIDATOR
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALIDATOR [STRING]
|
||||
redefine
|
||||
state
|
||||
end
|
||||
|
||||
create
|
||||
make_regexp_validator
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_regexp_validator (r, e: STRING)
|
||||
do
|
||||
make (e)
|
||||
regexp_string := r
|
||||
create regexp
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
is_valid (input: STRING): BOOLEAN
|
||||
do
|
||||
--Only compile when used
|
||||
if not regexp.is_compiled then
|
||||
regexp.compile (regexp_string)
|
||||
end
|
||||
Result := regexp.matches (input)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
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 (regexp_string), create {JSON_STRING}.make_json ("expression"))
|
||||
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
|
||||
end
|
||||
|
||||
regexp_string: STRING
|
||||
|
||||
regexp: REGULAR_EXPRESSION
|
||||
|
||||
end
|
||||
@@ -1,20 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_VALIDATABLE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_VALIDATABLE
|
||||
|
||||
feature
|
||||
|
||||
validate
|
||||
deferred
|
||||
end
|
||||
|
||||
is_valid: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_VALIDATOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_VALIDATOR [G]
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (e: STRING)
|
||||
do
|
||||
error := e
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_STRING}.make_json (generator), create {JSON_STRING}.make_json ("name"))
|
||||
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
|
||||
end
|
||||
|
||||
is_valid (input: G): BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
error: STRING
|
||||
|
||||
end
|
||||
@@ -1,57 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_BASIC_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_BASIC_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_STATELESS_CONTROL
|
||||
|
||||
create
|
||||
make_control,
|
||||
make_with_body
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_control (t: STRING)
|
||||
do
|
||||
make_with_body (t, "", "")
|
||||
end
|
||||
|
||||
make_with_body (t,attr,a_content: STRING)
|
||||
do
|
||||
make (t)
|
||||
attributes := attr
|
||||
content := a_content
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
attributes: STRING
|
||||
|
||||
content: STRING
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag (content, attributes)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
set_attributes (a: STRING)
|
||||
do
|
||||
attributes := a
|
||||
end
|
||||
|
||||
set_content (c: STRING)
|
||||
do
|
||||
content := c
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,81 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_BUTTON_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_BUTTON_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
|
||||
create
|
||||
make_button
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_button (n: STRING; t: STRING)
|
||||
do
|
||||
make_control (n, "button")
|
||||
add_class ("btn")
|
||||
add_class ("btn-default")
|
||||
text := t
|
||||
end
|
||||
|
||||
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
|
||||
text := new_text.unescaped_string_32
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- 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"))
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
set_click_event (e: attached like click_event)
|
||||
-- Set button click event handle
|
||||
do
|
||||
click_event := e
|
||||
end
|
||||
|
||||
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 ([])
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag (text, "")
|
||||
end
|
||||
|
||||
set_text (t: STRING)
|
||||
do
|
||||
if not t.is_equal (text) then
|
||||
text := t
|
||||
state_changes.replace (create {JSON_STRING}.make_json (text), create {JSON_STRING}.make_json ("text"))
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
text: STRING
|
||||
|
||||
click_event: detachable PROCEDURE [ANY, TUPLE []]
|
||||
|
||||
end
|
||||
@@ -1,97 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_STATELESS_CONTROL
|
||||
redefine
|
||||
render_tag
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
control_name: STRING
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_control (n, a_tag_name: STRING)
|
||||
do
|
||||
make (a_tag_name)
|
||||
control_name := n
|
||||
create state_changes.make
|
||||
ensure
|
||||
attached state_changes
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
load_state (new_states: JSON_OBJECT)
|
||||
-- Select state stored with `control_name` as key
|
||||
do
|
||||
if attached {JSON_OBJECT} new_states.item (control_name) as new_state_obj then
|
||||
set_state (new_state_obj)
|
||||
end
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
-- Before we process the callback. We restore the state of control.
|
||||
deferred
|
||||
end
|
||||
|
||||
read_state (states: JSON_OBJECT)
|
||||
-- Add a new entry in the `states` JSON object with the `control_name` as key and the `state` as value
|
||||
do
|
||||
states.put (state, control_name)
|
||||
end
|
||||
|
||||
read_state_changes (states: JSON_OBJECT)
|
||||
-- Add a new entry in the `states_changes` JSON object with the `control_name` as key and the `state` as value
|
||||
do
|
||||
if state_changes.count > 0 then
|
||||
states.put (state_changes, control_name)
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- Returns the current state of the Control as JSON. This state will be transfered to the client.
|
||||
deferred
|
||||
end
|
||||
|
||||
state_changes: JSON_OBJECT
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render_tag (body, attrs: STRING): STRING
|
||||
do
|
||||
Result := render_tag_with_generator_name (generator, body, attrs)
|
||||
end
|
||||
|
||||
render_tag_with_generator_name (a_generator, body, attrs: STRING): STRING
|
||||
local
|
||||
css_classes_string: STRING
|
||||
l_attributes: STRING
|
||||
do
|
||||
css_classes_string := ""
|
||||
across
|
||||
css_classes as c
|
||||
loop
|
||||
css_classes_string := css_classes_string + " " + c.item
|
||||
end
|
||||
l_attributes := "id=%"" + control_name + "%" data-name=%"" + control_name + "%" data-type=%"" + a_generator + "%" " + attrs
|
||||
Result := render_tag_with_tagname (tag_name, body, l_attributes, css_classes_string)
|
||||
end
|
||||
|
||||
feature -- EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
-- Method called if any callback received. In this method you can route the callback to the event handler
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,48 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_FORM_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_FORM_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_MULTI_CONTROL [WSF_CONTROL]
|
||||
|
||||
WSF_VALIDATABLE
|
||||
|
||||
create
|
||||
make_form_control
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_form_control (n: STRING)
|
||||
do
|
||||
make_multi_control (n)
|
||||
tag_name := "form"
|
||||
end
|
||||
|
||||
feature -- Validation
|
||||
|
||||
validate
|
||||
do
|
||||
is_valid := True
|
||||
across
|
||||
controls as c
|
||||
until
|
||||
is_valid = False
|
||||
loop
|
||||
if attached {WSF_VALIDATABLE} c.item as elem then
|
||||
elem.validate
|
||||
if not elem.is_valid then
|
||||
is_valid := False
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_valid: BOOLEAN
|
||||
|
||||
end
|
||||
@@ -1,167 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_FORM_ELEMENT_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_FORM_ELEMENT_CONTROL [G]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
redefine
|
||||
read_state_changes,
|
||||
load_state,
|
||||
read_state
|
||||
end
|
||||
|
||||
WSF_VALIDATABLE
|
||||
|
||||
create
|
||||
make_form_element, make_form_element_with_validators
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_form_element (a_label: STRING; c: WSF_VALUE_CONTROL [G])
|
||||
do
|
||||
make_form_element_with_validators (a_label, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
|
||||
end
|
||||
|
||||
make_form_element_with_validators (a_label: STRING; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]])
|
||||
do
|
||||
make_control (c.control_name + "_container", "div")
|
||||
add_class ("form-group")
|
||||
if attached {WSF_INPUT_CONTROL} c or attached {WSF_TEXTAREA_CONTROL} c then
|
||||
c.add_class ("form-control")
|
||||
end
|
||||
if attached {WSF_HTML_CONTROL} c then
|
||||
c.add_class ("form-control-static")
|
||||
end
|
||||
value_control := c
|
||||
validators := v
|
||||
label := a_label
|
||||
error := ""
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
load_state (new_states: JSON_OBJECT)
|
||||
-- Pass new_states to subcontrols
|
||||
do
|
||||
Precursor (new_states)
|
||||
value_control.load_state (new_states)
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
do
|
||||
value_control.set_state (new_state)
|
||||
end
|
||||
|
||||
read_state (states: JSON_OBJECT)
|
||||
-- Read states in subcontrols
|
||||
do
|
||||
Precursor (states)
|
||||
value_control.read_state (states)
|
||||
end
|
||||
|
||||
read_state_changes (states: JSON_OBJECT)
|
||||
-- Read states_changes in subcontrols
|
||||
do
|
||||
Precursor (states)
|
||||
value_control.read_state_changes (states)
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
--Read state
|
||||
local
|
||||
validator_description: JSON_ARRAY
|
||||
do
|
||||
create Result.make
|
||||
create validator_description.make_array
|
||||
across
|
||||
validators as v
|
||||
loop
|
||||
validator_description.add (v.item.state)
|
||||
end
|
||||
Result.put (create {JSON_STRING}.make_json (value_control.control_name), "value_control")
|
||||
Result.put (validator_description, "validators")
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
-- Pass callback to subcontrols
|
||||
do
|
||||
if cname.same_string (control_name) then
|
||||
if event.same_string ("validate") then
|
||||
validate
|
||||
end
|
||||
else
|
||||
value_control.handle_callback (cname, event, event_parameter)
|
||||
end
|
||||
end
|
||||
|
||||
feature --Implementation
|
||||
|
||||
render: STRING
|
||||
local
|
||||
body: STRING
|
||||
do
|
||||
body := ""
|
||||
if not label.is_empty then
|
||||
body.append ("<label class=%"col-lg-2 control-label%" for=%"" + value_control.control_name + "%">" + label + "</label>")
|
||||
end
|
||||
body.append ("<div class=%"col-lg-10%">")
|
||||
body.append (value_control.render)
|
||||
body.append ("</div>")
|
||||
Result := render_tag (body, "")
|
||||
end
|
||||
|
||||
feature -- Validation
|
||||
|
||||
add_validator (v: WSF_VALIDATOR [G])
|
||||
do
|
||||
validators.extend (v)
|
||||
end
|
||||
|
||||
set_error (e: STRING)
|
||||
do
|
||||
error := e
|
||||
state_changes.replace (create {JSON_STRING}.make_json (e), create {JSON_STRING}.make_json ("error"))
|
||||
end
|
||||
|
||||
validate
|
||||
local
|
||||
current_value: G
|
||||
do
|
||||
current_value := value_control.value
|
||||
is_valid := True
|
||||
across
|
||||
validators as c
|
||||
until
|
||||
not is_valid
|
||||
loop
|
||||
if not c.item.is_valid (current_value) then
|
||||
is_valid := False
|
||||
set_error (c.item.error)
|
||||
end
|
||||
end
|
||||
if is_valid then
|
||||
set_error ("")
|
||||
end
|
||||
end
|
||||
|
||||
is_valid: BOOLEAN
|
||||
|
||||
feature
|
||||
|
||||
value_control: WSF_VALUE_CONTROL [G]
|
||||
|
||||
validators: LIST [WSF_VALIDATOR [G]]
|
||||
|
||||
label: STRING
|
||||
|
||||
error: STRING
|
||||
|
||||
end
|
||||
@@ -1,72 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_html_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_HTML_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_VALUE_CONTROL [STRING]
|
||||
|
||||
create
|
||||
make_html
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make_html (n, t, v: STRING)
|
||||
do
|
||||
make_control (n, t)
|
||||
html := v
|
||||
end
|
||||
|
||||
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
|
||||
html := new_html.unescaped_string_32
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
-- 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"))
|
||||
end
|
||||
|
||||
feature --EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag (html, "")
|
||||
end
|
||||
|
||||
set_html (t: STRING)
|
||||
do
|
||||
if not t.is_equal (html) then
|
||||
html := t
|
||||
state_changes.replace (create {JSON_STRING}.make_json (html), create {JSON_STRING}.make_json ("html"))
|
||||
end
|
||||
end
|
||||
|
||||
value: STRING
|
||||
do
|
||||
Result := html
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
html: STRING
|
||||
|
||||
end
|
||||
@@ -1,126 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_MULTI_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
redefine
|
||||
read_state,
|
||||
read_state_changes,
|
||||
load_state
|
||||
end
|
||||
|
||||
create
|
||||
make_multi_control, make_with_tag_name
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_multi_control (n: STRING)
|
||||
do
|
||||
make_with_tag_name (n, "div")
|
||||
end
|
||||
|
||||
make_with_tag_name (n, t: STRING)
|
||||
do
|
||||
make_control (n, t)
|
||||
controls := create {LINKED_LIST [G]}.make;
|
||||
end
|
||||
|
||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
|
||||
load_state (new_states: JSON_OBJECT)
|
||||
-- Pass new_states to subcontrols
|
||||
do
|
||||
Precursor (new_states)
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.load_state (new_states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_state (new_state: JSON_OBJECT)
|
||||
-- Before we process the callback. We restore the state of control.
|
||||
do
|
||||
end
|
||||
|
||||
read_state (states: JSON_OBJECT)
|
||||
-- Read states in subcontrols
|
||||
do
|
||||
Precursor (states)
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.read_state (states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
read_state_changes (states: JSON_OBJECT)
|
||||
-- Read states_changes in subcontrols
|
||||
do
|
||||
Precursor (states)
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.read_state_changes (states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
state: JSON_OBJECT
|
||||
--Read state
|
||||
do
|
||||
create Result.make
|
||||
end
|
||||
|
||||
feature -- EVENT HANDLING
|
||||
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
-- Pass callback to subcontrols
|
||||
do
|
||||
if equal (cname, control_name) then
|
||||
else
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.handle_callback (cname, event, event_parameter)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := ""
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
Result := c.item.render + Result
|
||||
end
|
||||
Result := render_tag (Result, "")
|
||||
end
|
||||
|
||||
add_control (c: detachable G)
|
||||
do
|
||||
if attached c as d then
|
||||
controls.put_front (d)
|
||||
end
|
||||
end
|
||||
|
||||
controls: LINKED_LIST [G]
|
||||
|
||||
end
|
||||
@@ -1,115 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_PAGE_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_PAGE_CONTROL
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
request := req
|
||||
response := res
|
||||
initialize_controls
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
request: WSF_REQUEST
|
||||
|
||||
response: WSF_RESPONSE
|
||||
|
||||
feature
|
||||
|
||||
initialize_controls
|
||||
-- Initalize all the controls, all the event handles must be set in this function.
|
||||
deferred
|
||||
ensure
|
||||
attached control
|
||||
end
|
||||
|
||||
process
|
||||
-- Function called on page load (not on callback)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
execute
|
||||
-- Entry Point: If request is a callback, restore control states and execute handle then return new state json.
|
||||
-- If request is not a callback. Run process and render the html page
|
||||
local
|
||||
event: detachable STRING
|
||||
event_parameter: detachable STRING
|
||||
control_name: detachable STRING
|
||||
states: detachable STRING
|
||||
states_changes: JSON_OBJECT
|
||||
json_parser: JSON_PARSER
|
||||
do
|
||||
control_name := get_parameter ("control_name")
|
||||
event := get_parameter ("event")
|
||||
event_parameter := get_parameter ("event_parameter")
|
||||
states := get_parameter ("states")
|
||||
if attached event and attached control_name and attached control and attached states then
|
||||
create json_parser.make_parser (states)
|
||||
if attached {JSON_OBJECT} json_parser.parse_json as sp then
|
||||
control.load_state (sp)
|
||||
end
|
||||
control.handle_callback (control_name, event, event_parameter)
|
||||
create states_changes.make
|
||||
control.read_state_changes (states_changes)
|
||||
response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "application/json; charset=ISO-8859-1"]>>)
|
||||
response.put_string (states_changes.representation)
|
||||
else
|
||||
process
|
||||
render
|
||||
end
|
||||
end
|
||||
|
||||
render
|
||||
-- Render and send the HTML Page
|
||||
local
|
||||
data: STRING
|
||||
page: WSF_PAGE_RESPONSE
|
||||
states: JSON_OBJECT
|
||||
do
|
||||
data := "<html><head>"
|
||||
data.append ("<link href=%"/bootstrap.min.css%" rel=%"stylesheet%">")
|
||||
data.append ("<link href=%"/widget.css%" rel=%"stylesheet%">")
|
||||
data.append ("</head><body>")
|
||||
data.append (control.render)
|
||||
data.append ("<script type=%"text/javascript%">window.states=")
|
||||
create states.make
|
||||
control.read_state (states)
|
||||
data.append (states.representation)
|
||||
data.append (";</script>")
|
||||
data.append ("<script src=%"/jquery.min.js%"></script>")
|
||||
data.append ("<script src=%"/typeahead.min.js%"></script>")
|
||||
data.append ("<script src=%"/widget.js%"></script>")
|
||||
data.append ("</body></html>")
|
||||
create page.make
|
||||
page.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "text/html; charset=ISO-8859-1"]>>)
|
||||
page.set_body (data)
|
||||
response.send (page)
|
||||
end
|
||||
|
||||
get_parameter (key: STRING): detachable STRING
|
||||
-- Read query parameter as string
|
||||
local
|
||||
value: detachable WSF_VALUE
|
||||
do
|
||||
Result := VOID
|
||||
value := request.query_parameter (key)
|
||||
if attached value and then value.is_string then
|
||||
Result := value.as_string.value
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE}
|
||||
|
||||
control: WSF_CONTROL
|
||||
|
||||
end
|
||||
@@ -1,77 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_STATELESS_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_STATELESS_CONTROL
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (a_tag_name: STRING)
|
||||
do
|
||||
tag_name := a_tag_name
|
||||
create css_classes.make (0)
|
||||
ensure
|
||||
attached css_classes
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
tag_name: STRING
|
||||
|
||||
css_classes: ARRAYED_LIST [STRING]
|
||||
|
||||
--TODO: Maybe improve
|
||||
|
||||
feature -- Change
|
||||
|
||||
add_class (c: STRING)
|
||||
do
|
||||
css_classes.force (c)
|
||||
end
|
||||
|
||||
render_tag (body, attrs: STRING): STRING
|
||||
local
|
||||
css_classes_string: STRING
|
||||
do
|
||||
create css_classes_string.make_empty
|
||||
across
|
||||
css_classes as c
|
||||
loop
|
||||
css_classes_string.append (" " + c.item)
|
||||
end
|
||||
Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
|
||||
end
|
||||
|
||||
render_tag_with_tagname (tag, body, attrs, css_classes_string: STRING): STRING
|
||||
local
|
||||
l_attributes: STRING
|
||||
do
|
||||
create l_attributes.make_from_string (attrs)
|
||||
if not css_classes_string.is_empty then
|
||||
l_attributes.append (" class=%"")
|
||||
l_attributes.append (css_classes_string)
|
||||
l_attributes.append_character ('%"')
|
||||
end
|
||||
Result := "<" + tag + " " + l_attributes
|
||||
if
|
||||
body.is_empty and
|
||||
not tag.same_string ("textarea") and
|
||||
not tag.same_string ("span") and
|
||||
not tag.same_string ("button") and
|
||||
not tag.same_string ("ul")
|
||||
then
|
||||
Result.append (" />")
|
||||
else
|
||||
Result.append (" >" + body + "</" + tag + ">")
|
||||
end
|
||||
end
|
||||
|
||||
render: STRING
|
||||
-- Return html representation of control
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,50 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_STATELESS_MULTI_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_STATELESS_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_STATELESS_CONTROL
|
||||
|
||||
create
|
||||
make_multi_control, make_with_tag_name
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_multi_control
|
||||
do
|
||||
make_with_tag_name ("div")
|
||||
end
|
||||
|
||||
make_with_tag_name (t: STRING)
|
||||
do
|
||||
make (t)
|
||||
controls := create {LINKED_LIST [G]}.make;
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := ""
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
Result := c.item.render + Result
|
||||
end
|
||||
Result := render_tag (Result, "")
|
||||
end
|
||||
|
||||
add_control (c: G)
|
||||
do
|
||||
controls.put_front (c)
|
||||
end
|
||||
|
||||
controls: LINKED_LIST [G]
|
||||
|
||||
end
|
||||
@@ -1,20 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_VALUE_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_VALUE_CONTROL [G]
|
||||
|
||||
inherit
|
||||
|
||||
WSF_CONTROL
|
||||
|
||||
feature
|
||||
|
||||
value: G
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="wsf_html" uuid="6AAAE037-7E66-4F5D-BED0-0042245C26BC" library_target="wsf_html">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-11-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-11-0 http://www.eiffel.com/developers/xml/configuration-1-11-0.xsd" name="wsf_html" uuid="6AAAE037-7E66-4F5D-BED0-0042245C26BC" library_target="wsf_html">
|
||||
<target name="wsf_html">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
@@ -11,22 +11,11 @@
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="http" location="..\..\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="..\..\..\contrib\library\text\parser\json\library\json-safe.ecf"/>
|
||||
<library name="pcre" location="$ISE_EIFFEL\unstable\library\text\regexp\pcre\pcre-safe.ecf"/>
|
||||
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template-safe.ecf"/>
|
||||
<library name="wsf" location="..\wsf\wsf-safe.ecf"/>
|
||||
<cluster name="api" location=".\api\" recursive="true"/>
|
||||
<cluster name="css" location=".\css\" recursive="true"/>
|
||||
<cluster name="form" location=".\form\" recursive="true"/>
|
||||
<cluster name="webcontrol" location=".\webcontrol\">
|
||||
<cluster name="validators" location=".\webcontrol\validators\"/>
|
||||
<cluster name="input" location=".\webcontrol\input\"/>
|
||||
<cluster name="grid" location=".\webcontrol\grid\"/>
|
||||
<cluster name="autocompletions" location=".\webcontrol\autocompletions\"/>
|
||||
<cluster name="navbar" location=".\webcontrol\navbar\"/>
|
||||
<cluster name="progressbar" location=".\webcontrol\progressbar\"/>
|
||||
</cluster>
|
||||
<cluster name="widget" location=".\widget\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
Reference in New Issue
Block a user