Code improvement
Cosmetic (comments, names, formatting)
This commit is contained in:
@@ -1,20 +1,31 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_AUTOCOMPLETION}."
|
description: "Summary description for {WSF_AUTOCOMPLETION}."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
WSF_AUTOCOMPLETION
|
WSF_AUTOCOMPLETION
|
||||||
|
|
||||||
feature -- Access
|
feature -- Query
|
||||||
|
|
||||||
autocompletion (input: STRING_32): JSON_ARRAY
|
autocompletion (input: READABLE_STRING_GENERAL): JSON_ARRAY
|
||||||
-- JSON array of suggestions that fit the specific input
|
-- JSON array of suggestions that fit the specific input
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
template: detachable STRING_32
|
feature -- Access
|
||||||
|
|
||||||
|
template: detachable READABLE_STRING_32
|
||||||
-- Customizable template
|
-- Customizable template
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ class
|
|||||||
WSF_SIMPLE_AUTOCOMPLETION
|
WSF_SIMPLE_AUTOCOMPLETION
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_AUTOCOMPLETION
|
WSF_AUTOCOMPLETION
|
||||||
|
|
||||||
create
|
create
|
||||||
@@ -16,24 +15,33 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (l: ITERABLE [STRING_32])
|
make (a_list: ITERABLE [READABLE_STRING_32])
|
||||||
-- Initialize
|
-- Initialize with collection `a_list'.
|
||||||
do
|
do
|
||||||
list := l
|
list := a_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
list: ITERABLE [READABLE_STRING_32]
|
||||||
|
-- List containing suggestions
|
||||||
|
|
||||||
feature -- Implementation
|
feature -- Implementation
|
||||||
|
|
||||||
autocompletion (input: STRING_32): JSON_ARRAY
|
autocompletion (a_input: READABLE_STRING_GENERAL): JSON_ARRAY
|
||||||
-- Implementation
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
o: WSF_JSON_OBJECT
|
o: WSF_JSON_OBJECT
|
||||||
|
l_lowered_input: READABLE_STRING_GENERAL
|
||||||
|
l_lowered_item: READABLE_STRING_GENERAL
|
||||||
do
|
do
|
||||||
create Result.make_array
|
create Result.make_array
|
||||||
across
|
l_lowered_input := a_input.as_lower
|
||||||
|
across
|
||||||
list as c
|
list as c
|
||||||
loop
|
loop
|
||||||
if c.item.as_lower.has_substring (input.as_lower) then
|
l_lowered_item := c.item.as_lower
|
||||||
|
if l_lowered_item.has_substring (l_lowered_input) then
|
||||||
create o.make
|
create o.make
|
||||||
o.put_string (c.item, "value")
|
o.put_string (c.item, "value")
|
||||||
Result.add (o)
|
Result.add (o)
|
||||||
@@ -41,7 +49,14 @@ feature -- Implementation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
list: ITERABLE [STRING_32]
|
;note
|
||||||
-- List containing suggestions
|
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
|
end
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ deferred class
|
|||||||
feature --Event handling
|
feature --Event handling
|
||||||
|
|
||||||
set_on_update_agent (f: PROCEDURE [ANY, TUPLE])
|
set_on_update_agent (f: PROCEDURE [ANY, TUPLE])
|
||||||
--Set update listener
|
-- Set update listener
|
||||||
do
|
do
|
||||||
on_update_agent := f
|
on_update_agent := f
|
||||||
end
|
end
|
||||||
|
|
||||||
update
|
update
|
||||||
--Trigger update listener
|
-- Trigger update listener
|
||||||
do
|
do
|
||||||
if attached on_update_agent as a then
|
if attached on_update_agent as a then
|
||||||
a.call (Void)
|
a.call (Void)
|
||||||
@@ -76,4 +76,14 @@ feature -- Properties
|
|||||||
|
|
||||||
on_update_agent: detachable PROCEDURE [ANY, TUPLE]
|
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
|
end
|
||||||
|
|||||||
@@ -6,12 +6,21 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WSF_ENTITY
|
WSF_ENTITY
|
||||||
|
|
||||||
|
|
||||||
feature -- Access
|
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'.
|
-- Value for field item `a_field'.
|
||||||
deferred
|
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
|
end
|
||||||
|
|||||||
@@ -25,13 +25,14 @@ feature -- Render
|
|||||||
-- Return the rendered column cell for a specific entity (row)
|
-- Return the rendered column cell for a specific entity (row)
|
||||||
do
|
do
|
||||||
if attached e.item (field_name) as data then
|
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
|
else
|
||||||
Result := "[VOID]"
|
Result := "[VOID]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Properties
|
feature -- Access
|
||||||
|
|
||||||
header: STRING_32
|
header: STRING_32
|
||||||
|
|
||||||
@@ -41,4 +42,14 @@ feature -- Properties
|
|||||||
|
|
||||||
field_name: STRING_32
|
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
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_PAGABLE}."
|
description: "Summary description for {WSF_PAGABLE_DATASOURCE}."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -8,7 +7,6 @@ deferred class
|
|||||||
WSF_PAGABLE_DATASOURCE [G -> WSF_ENTITY]
|
WSF_PAGABLE_DATASOURCE [G -> WSF_ENTITY]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_DATASOURCE [G]
|
WSF_DATASOURCE [G]
|
||||||
redefine
|
redefine
|
||||||
state,
|
state,
|
||||||
@@ -16,16 +14,16 @@ inherit
|
|||||||
update
|
update
|
||||||
end
|
end
|
||||||
|
|
||||||
feature --Event handling
|
feature -- Event handling
|
||||||
|
|
||||||
set_on_update_page_agent (f: PROCEDURE [ANY, TUPLE])
|
set_on_update_page_agent (f: PROCEDURE [ANY, TUPLE])
|
||||||
--Set paging update listener
|
-- Set paging update listener
|
||||||
do
|
do
|
||||||
on_update_page_agent := f
|
on_update_page_agent := f
|
||||||
end
|
end
|
||||||
|
|
||||||
update
|
update
|
||||||
--Trigger update listeners
|
-- Trigger update listeners
|
||||||
do
|
do
|
||||||
Precursor
|
Precursor
|
||||||
if attached on_update_page_agent as a then
|
if attached on_update_page_agent as a then
|
||||||
@@ -81,4 +79,14 @@ feature -- Properties
|
|||||||
|
|
||||||
on_update_page_agent: detachable PROCEDURE [ANY, TUPLE]
|
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
|
end
|
||||||
|
|||||||
@@ -48,16 +48,19 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature --Event handling
|
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
|
-- Handle goto/next/prev events
|
||||||
do
|
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
|
if event.same_string ("next") then
|
||||||
datasource.set_page (datasource.page + 1)
|
datasource.set_page (datasource.page + 1)
|
||||||
elseif event.same_string ("prev") then
|
elseif event.same_string ("prev") then
|
||||||
datasource.set_page (datasource.page - 1)
|
datasource.set_page (datasource.page - 1)
|
||||||
elseif event.same_string ("goto") then
|
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)
|
datasource.set_page (i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -96,4 +99,14 @@ feature -- Properties
|
|||||||
|
|
||||||
datasource: WSF_PAGABLE_DATASOURCE [G]
|
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
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ inherit
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make ( a_datasource: WSF_DATASOURCE [G])
|
make (a_datasource: WSF_DATASOURCE [G])
|
||||||
local
|
local
|
||||||
p: WSF_PAGINATION_CONTROL [G]
|
p: WSF_PAGINATION_CONTROL [G]
|
||||||
do
|
do
|
||||||
@@ -28,7 +28,7 @@ feature {NONE} -- Initialization
|
|||||||
datasource := a_datasource
|
datasource := a_datasource
|
||||||
datasource.set_on_update_agent (agent update)
|
datasource.set_on_update_agent (agent update)
|
||||||
if attached {WSF_PAGABLE_DATASOURCE [G]} a_datasource as ds then
|
if attached {WSF_PAGABLE_DATASOURCE [G]} a_datasource as ds then
|
||||||
create p.make ( ds)
|
create p.make (ds)
|
||||||
add_control (p)
|
add_control (p)
|
||||||
pagination_control := p
|
pagination_control := p
|
||||||
end
|
end
|
||||||
@@ -61,41 +61,52 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
feature -- Rendering
|
feature -- Rendering
|
||||||
|
|
||||||
render_item (item: G): STRING_32
|
render_item (item: G): STRING_32
|
||||||
--Render item
|
-- Render item
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
render_body: STRING_32
|
render_body: STRING_32
|
||||||
--Render Body
|
-- Render Body
|
||||||
do
|
do
|
||||||
Result := ""
|
create Result.make_empty
|
||||||
across
|
across
|
||||||
datasource.data as entity
|
datasource.data as ic
|
||||||
loop
|
loop
|
||||||
Result.append (render_item (entity.item))
|
Result.append (render_item (ic.item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
render: STRING_32
|
render: STRING_32
|
||||||
--Render repeater inclusive paging if paging is available
|
-- Render repeater inclusive paging if paging is available
|
||||||
local
|
local
|
||||||
content: STRING_32
|
content: STRING_32
|
||||||
do
|
do
|
||||||
content := render_tag_with_tagname ("div", render_body, "", "repeater_content")
|
content := render_tag_with_tagname ("div", render_body, "", "repeater_content")
|
||||||
Result := ""
|
create Result.make_empty
|
||||||
across
|
across
|
||||||
controls as c
|
controls as ic
|
||||||
loop
|
loop
|
||||||
Result := c.item.render + Result
|
-- CHECK: Prepend ? or Append?
|
||||||
|
Result.prepend (ic.item.render)
|
||||||
end
|
end
|
||||||
-- Fix generator name since the user will extend this class to define item_render
|
-- 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, "")
|
Result := render_tag_with_generator_name ("WSF_REPEATER_CONTROL", content + Result, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Properties
|
feature -- Access
|
||||||
|
|
||||||
datasource: WSF_DATASOURCE [G]
|
datasource: WSF_DATASOURCE [G]
|
||||||
|
|
||||||
pagination_control: detachable WSF_PAGINATION_CONTROL [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
|
end
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ feature {NONE} -- Initialization
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_agent (c: FUNCTION [ANY, TUPLE [STRING_32], JSON_ARRAY])
|
make_with_agent (c: FUNCTION [ANY, TUPLE [READABLE_STRING_GENERAL], JSON_ARRAY])
|
||||||
-- Initialize with autocompletion function
|
-- Initialize with autocompletion function
|
||||||
do
|
do
|
||||||
make_input ("")
|
make_input ("")
|
||||||
@@ -53,20 +53,34 @@ feature -- State
|
|||||||
|
|
||||||
feature -- Callback
|
feature -- Callback
|
||||||
|
|
||||||
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)
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
|
Precursor {WSF_INPUT_CONTROL} (cname, event, event_parameter)
|
||||||
if cname [1].same_string (control_name) and event.same_string ("autocomplete") then
|
if
|
||||||
|
cname.first.same_string (control_name) and
|
||||||
|
event.same_string ("autocomplete")
|
||||||
|
then
|
||||||
state_changes.put (create_json_list.item ([text]), "suggestions")
|
state_changes.put (create_json_list.item ([text]), "suggestions")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Properties
|
feature -- Properties
|
||||||
|
|
||||||
create_json_list: FUNCTION [ANY, TUPLE [STRING_32], JSON_ARRAY]
|
create_json_list: FUNCTION [ANY, TUPLE [READABLE_STRING_GENERAL], JSON_ARRAY]
|
||||||
-- The function which is called to give a list of suggestions to a given user input
|
-- The function which is called to give a list of suggestions to a given user input
|
||||||
|
|
||||||
template: STRING_32
|
template: READABLE_STRING_32
|
||||||
-- The template
|
-- The template
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class
|
|||||||
WSF_CHECKBOX_CONTROL
|
WSF_CHECKBOX_CONTROL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_VALUE_CONTROL [BOOLEAN]
|
WSF_VALUE_CONTROL [BOOLEAN]
|
||||||
rename
|
rename
|
||||||
make as make_value_control,
|
make as make_value_control,
|
||||||
@@ -23,14 +22,14 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (l, value: STRING_32)
|
make (a_label, a_value: STRING_32)
|
||||||
-- Initialize with specified label and value
|
-- Initialize with specified label `a_label' and value `a_value'.
|
||||||
require
|
require
|
||||||
value_not_empty: not value.is_empty
|
a_value_not_empty: not a_value.is_empty
|
||||||
do
|
do
|
||||||
make_value_control ("input")
|
make_value_control ("input")
|
||||||
label := l
|
label := a_label
|
||||||
checked_value := value
|
checked_value := a_value
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||||
@@ -60,12 +59,14 @@ feature --Event handling
|
|||||||
change_event := e
|
change_event := e
|
||||||
end
|
end
|
||||||
|
|
||||||
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)
|
||||||
do
|
do
|
||||||
if Current.control_name.same_string (cname [1]) and attached change_event as cevent then
|
if
|
||||||
if event.same_string ("change") then
|
control_name.same_string_general (cname.first) and
|
||||||
cevent.call (Void)
|
attached change_event as cevent and then
|
||||||
end
|
event.same_string ("change")
|
||||||
|
then
|
||||||
|
cevent.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -102,4 +103,14 @@ feature -- Properties
|
|||||||
change_event: detachable PROCEDURE [ANY, TUPLE]
|
change_event: detachable PROCEDURE [ANY, TUPLE]
|
||||||
-- Function to be executed on change
|
-- Function to be executed on change
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -41,11 +41,15 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
local
|
local
|
||||||
id: detachable STRING_32
|
id: detachable STRING_32
|
||||||
do
|
do
|
||||||
if attached {JSON_STRING} new_state.item ("file_name") as new_name and attached {JSON_STRING} new_state.item ("file_type") as new_type and attached {JSON_NUMBER} new_state.item ("file_size") as new_size then
|
if
|
||||||
|
attached {JSON_STRING} new_state.item ("file_name") as new_name and
|
||||||
|
attached {JSON_STRING} new_state.item ("file_type") as new_type and
|
||||||
|
attached {JSON_NUMBER} new_state.item ("file_size") as new_size
|
||||||
|
then
|
||||||
if attached {JSON_STRING} new_state.item ("file_id") as a_id then
|
if attached {JSON_STRING} new_state.item ("file_id") as a_id then
|
||||||
id := a_id.unescaped_string_32
|
id := a_id.unescaped_string_32
|
||||||
end
|
end
|
||||||
create file.make (new_name.unescaped_string_32, new_type.unescaped_string_32, new_size.item.to_integer_32, id);
|
create file.make (new_name.unescaped_string_32, new_type.unescaped_string_32, new_size.item.to_integer_32, id)
|
||||||
end
|
end
|
||||||
if attached {JSON_BOOLEAN} new_state.item ("disabled") as a_disabled then
|
if attached {JSON_BOOLEAN} new_state.item ("disabled") as a_disabled then
|
||||||
disabled := a_disabled.item
|
disabled := a_disabled.item
|
||||||
@@ -73,14 +77,14 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
local
|
local
|
||||||
f_name: detachable STRING_32
|
f_name: detachable STRING_32
|
||||||
f_type: detachable STRING_32
|
f_type: detachable STRING_32
|
||||||
f_size: detachable INTEGER
|
f_size: detachable INTEGER
|
||||||
f_id: detachable STRING_32
|
f_id: detachable STRING_32
|
||||||
do
|
do
|
||||||
if Current.control_name.same_string (cname [1]) then
|
if control_name.same_string_general (cname.first) then
|
||||||
if attached change_event as cevent and event.same_string ("change") then
|
if attached change_event as cevent and event.same_string ("change") then
|
||||||
cevent.call (Void)
|
cevent.call (Void)
|
||||||
elseif attached upload_done_event as udevent and event.same_string ("uploaddone") then
|
elseif attached upload_done_event as udevent and event.same_string ("uploaddone") then
|
||||||
@@ -214,4 +218,14 @@ feature -- Properties
|
|||||||
upload_function: detachable FUNCTION [ANY, TUPLE [ITERABLE [WSF_UPLOADED_FILE]], detachable STRING_32]
|
upload_function: detachable FUNCTION [ANY, TUPLE [ITERABLE [WSF_UPLOADED_FILE]], detachable STRING_32]
|
||||||
-- Store uploaded file and return server side file id
|
-- Store uploaded file and return server side file id
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class
|
|||||||
WSF_INPUT_CONTROL
|
WSF_INPUT_CONTROL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_VALUE_CONTROL [STRING_32]
|
WSF_VALUE_CONTROL [STRING_32]
|
||||||
rename
|
rename
|
||||||
make as make_value_control
|
make as make_value_control
|
||||||
@@ -62,12 +61,14 @@ feature --Event handling
|
|||||||
change_event_set: change_event = e
|
change_event_set: change_event = e
|
||||||
end
|
end
|
||||||
|
|
||||||
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)
|
||||||
do
|
do
|
||||||
if Current.control_name.same_string (cname [1]) and attached change_event as cevent then
|
if
|
||||||
if event.same_string ("change") then
|
control_name.same_string_general (cname.first) and
|
||||||
cevent.call (Void)
|
attached change_event as cevent and then
|
||||||
end
|
event.same_string ("change")
|
||||||
|
then
|
||||||
|
cevent.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -77,12 +78,17 @@ feature -- Rendering
|
|||||||
local
|
local
|
||||||
attr: STRING_32
|
attr: STRING_32
|
||||||
do
|
do
|
||||||
attr := "type=%"" + type + "%" value=%"" + text + "%" "
|
create attr.make (25)
|
||||||
if attached attributes as a then
|
attr.append ("type=%"")
|
||||||
attr.append (a)
|
attr.append (type)
|
||||||
|
attr.append ("%" value=%"")
|
||||||
|
attr.append (text)
|
||||||
|
attr.append ("%" ")
|
||||||
|
if attached attributes as l_attributes then
|
||||||
|
attr.append (l_attributes)
|
||||||
end
|
end
|
||||||
if disabled then
|
if disabled then
|
||||||
attr.append ("disabled=%"disabled%" ")
|
attr.append (" disabled=%"disabled%" ")
|
||||||
end
|
end
|
||||||
Result := render_tag ("", attr)
|
Result := render_tag ("", attr)
|
||||||
end
|
end
|
||||||
@@ -107,13 +113,15 @@ feature -- Change
|
|||||||
if disabled /= b then
|
if disabled /= b then
|
||||||
disabled := b
|
disabled := b
|
||||||
state_changes.replace_with_boolean (disabled, "disabled")
|
state_changes.replace_with_boolean (disabled, "disabled")
|
||||||
|
else
|
||||||
|
check has_key_disabled: (b = False) or else state_changes.has_key ("disabled") end
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
disabled_set: disabled = b
|
disabled_set: disabled = b
|
||||||
state_changes_registered: old b /= b implies state_changes.has_key ("disabled")
|
state_changes_registered: (old b) /= b implies state_changes.has_key ("disabled")
|
||||||
end
|
end
|
||||||
|
|
||||||
set_type (t: STRING_32)
|
set_type (t: READABLE_STRING_32)
|
||||||
-- Set the type of this input control (HTML 'type' attribute)
|
-- Set the type of this input control (HTML 'type' attribute)
|
||||||
do
|
do
|
||||||
type := t
|
type := t
|
||||||
@@ -142,13 +150,23 @@ feature -- Properties
|
|||||||
disabled: BOOLEAN
|
disabled: BOOLEAN
|
||||||
-- Defines if the input field is editable
|
-- Defines if the input field is editable
|
||||||
|
|
||||||
text: STRING_32
|
text: READABLE_STRING_32
|
||||||
-- Text to be displayed
|
-- Text to be displayed
|
||||||
|
|
||||||
type: STRING_32
|
type: READABLE_STRING_32
|
||||||
-- Type of this input control
|
-- Type of this input control
|
||||||
|
|
||||||
change_event: detachable PROCEDURE [ANY, TUPLE]
|
change_event: detachable PROCEDURE [ANY, TUPLE]
|
||||||
-- Procedure to be execued on change
|
-- Procedure to be execued on change
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ note
|
|||||||
panels can be added to this control.
|
panels can be added to this control.
|
||||||
See http://getbootstrap.com/components/#navbar
|
See http://getbootstrap.com/components/#navbar
|
||||||
]"
|
]"
|
||||||
author: ""
|
EIS: "name=Bootstrap navbar", "protocol=URI", "src=http://getbootstrap.com/components/#navbar"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -27,10 +27,10 @@ create
|
|||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
--Initialize
|
-- Initialize
|
||||||
do
|
do
|
||||||
make_multi_control
|
make_multi_control
|
||||||
active_set := false
|
active_set := False
|
||||||
add_class ("navbar navbar-inverse navbar-fixed-top")
|
add_class ("navbar navbar-inverse navbar-fixed-top")
|
||||||
create nav.make_with_tag_name ("ul")
|
create nav.make_with_tag_name ("ul")
|
||||||
create nav_right.make_with_tag_name ("ul")
|
create nav_right.make_with_tag_name ("ul")
|
||||||
@@ -40,13 +40,13 @@ feature {NONE} -- Initialization
|
|||||||
nav_right.add_class ("nav navbar-nav navbar-right")
|
nav_right.add_class ("nav navbar-nav navbar-right")
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_brand (b: STRING_32)
|
make_with_brand (a_brand: READABLE_STRING_32)
|
||||||
-- Initialize with specified brand string
|
-- Initialize with specified `a_brand' string.
|
||||||
do
|
do
|
||||||
make
|
make
|
||||||
brand := b
|
brand := a_brand
|
||||||
ensure
|
ensure
|
||||||
brand_set: brand = b
|
brand_set: brand = a_brand
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Rendering
|
feature -- Rendering
|
||||||
@@ -59,8 +59,8 @@ feature -- Rendering
|
|||||||
temp := render_tag_with_tagname ("span", "", "", "icon-bar")
|
temp := render_tag_with_tagname ("span", "", "", "icon-bar")
|
||||||
temp.multiply (3)
|
temp.multiply (3)
|
||||||
temp := render_tag_with_tagname ("button", temp, "data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"", "navbar-toggle")
|
temp := render_tag_with_tagname ("button", temp, "data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"", "navbar-toggle")
|
||||||
if attached brand as b then
|
if attached brand as l_brand then
|
||||||
temp.append (render_tag_with_tagname ("a", b, "href=%"#%"", "navbar-brand"))
|
temp.append (render_tag_with_tagname ("a", l_brand, "href=%"#%"", "navbar-brand"))
|
||||||
end
|
end
|
||||||
temp := render_tag_with_tagname ("div", temp, "", "navbar-header")
|
temp := render_tag_with_tagname ("div", temp, "", "navbar-header")
|
||||||
nav_string := nav.render
|
nav_string := nav.render
|
||||||
@@ -89,36 +89,36 @@ feature -- Change
|
|||||||
active_set_set: active_set
|
active_set_set: active_set
|
||||||
end
|
end
|
||||||
|
|
||||||
add_list_element_right (l: WSF_STATELESS_CONTROL)
|
add_list_element_right (a_control: WSF_STATELESS_CONTROL)
|
||||||
-- Add element in li tag to right aligned part of navbar
|
-- Add element in li tag to right aligned part of navbar
|
||||||
local
|
local
|
||||||
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
do
|
do
|
||||||
create li.make_with_tag_name ("li")
|
create li.make_with_tag_name ("li")
|
||||||
li.add_control (l)
|
li.add_control (a_control)
|
||||||
add_element_right (li)
|
add_element_right (li)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_list_element (l: WSF_STATELESS_CONTROL)
|
add_list_element (a_control: WSF_STATELESS_CONTROL)
|
||||||
-- Add element in li tag to main nav
|
-- Add element in li tag to main nav
|
||||||
local
|
local
|
||||||
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
do
|
do
|
||||||
create li.make_with_tag_name ("li")
|
create li.make_with_tag_name ("li")
|
||||||
li.add_control (l)
|
li.add_control (a_control)
|
||||||
add_element (li)
|
add_element (li)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_element_right (c: WSF_STATELESS_CONTROL)
|
add_element_right (a_control: WSF_STATELESS_CONTROL)
|
||||||
-- Add element to right aligned part of navbar
|
-- Add element to right aligned part of navbar
|
||||||
do
|
do
|
||||||
nav_right.add_control (c)
|
nav_right.add_control (a_control)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_element (c: WSF_STATELESS_CONTROL)
|
add_element (a_control: WSF_STATELESS_CONTROL)
|
||||||
-- Add element to main nav
|
-- Add element to main nav
|
||||||
do
|
do
|
||||||
nav.add_control (c)
|
nav.add_control (a_control)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
@@ -134,7 +134,7 @@ feature -- Properties
|
|||||||
active_set: BOOLEAN
|
active_set: BOOLEAN
|
||||||
-- This flag is set once a tab has been set as active tab
|
-- This flag is set once a tab has been set as active tab
|
||||||
|
|
||||||
brand: detachable STRING_32
|
brand: detachable READABLE_STRING_32
|
||||||
-- Optional brand of the navbar
|
-- Optional brand of the navbar
|
||||||
|
|
||||||
nav: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
nav: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
@@ -143,4 +143,14 @@ feature -- Properties
|
|||||||
nav_right: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
nav_right: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
-- Right nav
|
-- Right nav
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -59,9 +59,12 @@ feature -- State handling
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
do
|
do
|
||||||
if cname [1].same_string (control_name) and event.same_string ("progress_fetch") then
|
if
|
||||||
|
cname.first.same_string (control_name) and
|
||||||
|
event.same_string ("progress_fetch")
|
||||||
|
then
|
||||||
state_changes.put_integer (progress_value, "progress")
|
state_changes.put_integer (progress_value, "progress")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -73,6 +76,7 @@ feature -- Rendering
|
|||||||
p: STRING_32
|
p: STRING_32
|
||||||
do
|
do
|
||||||
p := progress_value.out
|
p := progress_value.out
|
||||||
|
-- FIXME: string 32 truncated to string 8 !!!
|
||||||
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_with_tagname ("div", "", "role=%"progressbar%" aria-valuenow=%"" + p + "%" aria-valuemin=%"0%" aria-valuemax=%"100%" style=%"width: " + p + "%%;%"", "progress-bar")
|
||||||
Result := render_tag (Result, "")
|
Result := render_tag (Result, "")
|
||||||
end
|
end
|
||||||
@@ -82,7 +86,7 @@ feature -- Change
|
|||||||
set_progress (p: INTEGER)
|
set_progress (p: INTEGER)
|
||||||
-- Set current progress value to specified value. Must be between 0 and 100. Must only be called when no progresssource has been set to this progress control
|
-- Set current progress value to specified value. Must be between 0 and 100. Must only be called when no progresssource has been set to this progress control
|
||||||
require
|
require
|
||||||
no_progress_source: not (attached progress_source)
|
no_progress_source: progress_source = Void
|
||||||
valid_input_value: p >= 0 and p <= 100
|
valid_input_value: p >= 0 and p <= 100
|
||||||
do
|
do
|
||||||
progress := p
|
progress := p
|
||||||
@@ -116,4 +120,14 @@ feature -- Properties
|
|||||||
invariant
|
invariant
|
||||||
progress_in_range: progress >= 0 and progress <= 100
|
progress_in_range: progress >= 0 and progress <= 100
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ feature -- State handling
|
|||||||
|
|
||||||
feature -- Callback
|
feature -- Callback
|
||||||
|
|
||||||
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)
|
||||||
-- Just implementation, nothing special to do here
|
-- Just implementation, nothing special to do here
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
@@ -67,18 +67,21 @@ feature -- Rendering
|
|||||||
|
|
||||||
feature -- Change
|
feature -- Change
|
||||||
|
|
||||||
add_image_with_caption (src, alt, caption: STRING_32)
|
add_image_with_caption (src, alt, a_caption: STRING_32)
|
||||||
-- Add a new image to the slider with specified url, alternative text and caption
|
-- Add a new image to the slider with specified url, alternative text and caption
|
||||||
local
|
local
|
||||||
caption_control: detachable WSF_STATELESS_CONTROL
|
caption_control: detachable WSF_BASIC_CONTROL
|
||||||
do
|
do
|
||||||
if attached caption as c and then not c.is_empty then
|
if
|
||||||
caption_control := create {WSF_BASIC_CONTROL}.make_with_body ("p", "", c)
|
a_caption /= Void and then
|
||||||
|
not a_caption.is_empty
|
||||||
|
then
|
||||||
|
create caption_control.make_with_body ("p", "", a_caption)
|
||||||
end
|
end
|
||||||
add_image_with_caption_control (src, alt, caption_control)
|
add_image_with_caption_control (src, alt, caption_control)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_image_with_caption_control (src, alt: STRING_32; caption: detachable WSF_STATELESS_CONTROL)
|
add_image_with_caption_control (src, alt: STRING_32; a_caption: detachable WSF_STATELESS_CONTROL)
|
||||||
-- Add a new image to the slider, with specified url, alternative text and caption element
|
-- Add a new image to the slider, with specified url, alternative text and caption element
|
||||||
do
|
do
|
||||||
add_control (create {WSF_BASIC_CONTROL}.make_with_body_class ("img", "src=%"" + src + "%" alt=%"" + alt + "%"", "", ""), Void)
|
add_control (create {WSF_BASIC_CONTROL}.make_with_body_class ("img", "src=%"" + src + "%" alt=%"" + alt + "%"", "", ""), Void)
|
||||||
@@ -90,17 +93,17 @@ feature -- Change
|
|||||||
add_image_with_caption (src, alt, "")
|
add_image_with_caption (src, alt, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
add_control (c: WSF_STATELESS_CONTROL; caption: detachable WSF_STATELESS_CONTROL)
|
add_control (a_control: WSF_STATELESS_CONTROL; a_caption: detachable WSF_STATELESS_CONTROL)
|
||||||
-- Add a new control to the slider
|
-- Add a new control to the slider
|
||||||
local
|
local
|
||||||
cl: STRING_32
|
cl: STRING_32
|
||||||
item: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
item: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
do
|
do
|
||||||
create item.make ()
|
create item.make
|
||||||
item.add_class ("item")
|
item.add_class ("item")
|
||||||
item.add_control (c)
|
item.add_control (a_control)
|
||||||
if attached caption as capt then
|
if a_caption /= Void then
|
||||||
item.add_control (capt)
|
item.add_control (a_caption)
|
||||||
end
|
end
|
||||||
cl := ""
|
cl := ""
|
||||||
if slide_wrapper.controls.count = 0 then
|
if slide_wrapper.controls.count = 0 then
|
||||||
@@ -119,4 +122,14 @@ feature -- Properties
|
|||||||
slide_wrapper: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
slide_wrapper: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
-- List of the single slides
|
-- List of the single slides
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ note
|
|||||||
description: "[
|
description: "[
|
||||||
Validator implementation which make sure that the input has
|
Validator implementation which make sure that the input has
|
||||||
the format of an valid email address. This is just a very
|
the format of an valid email address. This is just a very
|
||||||
basic implementation that tests if the given input contains
|
basic implementation that tests if the given input contains a '@'.
|
||||||
a '@'.
|
|
||||||
|
This is a simple checker, it does not handle all the cases.
|
||||||
]"
|
]"
|
||||||
author: ""
|
EIS: "name=Application Techniques for Checking and Transformation of Names RFC3696", "protocol=URI", "src=http://tools.ietf.org/html/rfc3696#section-3"
|
||||||
|
EIS: "name=Email address (wikipedia)", "protocol=URI", "src=http://en.wikipedia.org/wiki/Email_address"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -30,4 +32,14 @@ feature {NONE} -- Initialization
|
|||||||
make_regexp_validator ("^.*@.*$", e)
|
make_regexp_validator ("^.*@.*$", e)
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -32,12 +32,9 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Implementation
|
feature -- Implementation
|
||||||
|
|
||||||
is_valid (input: detachable WSF_FILE_DEFINITION): BOOLEAN
|
is_valid (a_input: detachable WSF_FILE_DEFINITION): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := True
|
Result := a_input /= Void implies a_input.size < max
|
||||||
if attached input as a_input then
|
|
||||||
Result := a_input.size < max
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- State
|
feature -- State
|
||||||
@@ -48,9 +45,19 @@ feature -- State
|
|||||||
Result.put_integer (max, "max")
|
Result.put_integer (max, "max")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Properties
|
feature -- Access
|
||||||
|
|
||||||
max: INTEGER
|
max: INTEGER
|
||||||
-- The maximal allowed value
|
-- The maximal allowed value
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ create
|
|||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (m: INTEGER; e: STRING_32)
|
make (m: INTEGER; e: STRING_32)
|
||||||
-- Initialize with specified maximum and error message which will be displayed on validation failure
|
-- Initialize with specified minimum `m' and error message `e' which will be displayed on validation failure.
|
||||||
do
|
do
|
||||||
make_validator (e)
|
make_validator (e)
|
||||||
max := m
|
max := m
|
||||||
@@ -32,9 +32,9 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Implementation
|
feature -- Implementation
|
||||||
|
|
||||||
is_valid (input: G): BOOLEAN
|
is_valid (a_input: G): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := input.count < max or input.count = max
|
Result := a_input.count < max or a_input.count = max
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- State
|
feature -- State
|
||||||
@@ -50,4 +50,14 @@ feature -- Properties
|
|||||||
max: INTEGER
|
max: INTEGER
|
||||||
-- The maximal allowed value
|
-- The maximal allowed value
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ deferred class
|
|||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (e: STRING_32)
|
make (e: STRING_32)
|
||||||
-- Initialize with specified error message to be displayed on validation failure
|
-- Initialize with specified error message `e' to be displayed on validation failure.
|
||||||
do
|
do
|
||||||
error := e
|
error := e
|
||||||
ensure
|
ensure
|
||||||
@@ -27,9 +27,10 @@ feature -- Access
|
|||||||
create Result.make
|
create Result.make
|
||||||
Result.put_string (generator, "name")
|
Result.put_string (generator, "name")
|
||||||
Result.put_string (error, "error")
|
Result.put_string (error, "error")
|
||||||
|
-- FIXME: is that correct to always send error message??
|
||||||
end
|
end
|
||||||
|
|
||||||
is_valid (input: G): BOOLEAN
|
is_valid (a_input: G): BOOLEAN
|
||||||
-- Perform validation on given input and tell whether validation was successful or not
|
-- Perform validation on given input and tell whether validation was successful or not
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
@@ -37,6 +38,16 @@ feature -- Access
|
|||||||
feature -- Properties
|
feature -- Properties
|
||||||
|
|
||||||
error: STRING_32
|
error: STRING_32
|
||||||
-- The error message if validation fails
|
-- The error message if validation fails.
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -25,32 +25,32 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (tag: STRING_32)
|
make (a_tag: STRING_32)
|
||||||
-- Initialize
|
-- Initialize
|
||||||
require
|
require
|
||||||
tag_not_empty: not tag.is_empty
|
tag_not_empty: not a_tag.is_empty
|
||||||
do
|
do
|
||||||
make_with_body_class (tag, "", "", "")
|
make_with_body_class (a_tag, "", "", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_body (tag, attr, b: STRING_32)
|
make_with_body (a_tag, a_attribs, a_body: STRING_32)
|
||||||
-- Initialize with specific attributes and body
|
-- Initialize with tag `a_tag', specific attributes `a_attribs' and body `a_body'.
|
||||||
require
|
require
|
||||||
tag_not_empty: not tag.is_empty
|
tag_not_empty: not a_tag.is_empty
|
||||||
do
|
do
|
||||||
make_stateless_control (tag)
|
make_stateless_control (a_tag)
|
||||||
attributes := attr
|
attributes := a_attribs
|
||||||
body := b
|
body := a_body
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_body_class (tag, attr, c, b: STRING_32)
|
make_with_body_class (a_tag, a_attribs, a_css_class, a_body: STRING_32)
|
||||||
-- Initialize with specific class, attributes and body
|
-- Initialize with tag `a_tag' specific class `a_css_class', attributes `a_attribs' and body `a_body'.
|
||||||
require
|
require
|
||||||
tag_not_empty: not tag.is_empty
|
tag_not_empty: not a_tag.is_empty
|
||||||
do
|
do
|
||||||
make_with_body (tag, attr, b)
|
make_with_body (a_tag, a_attribs, a_body)
|
||||||
if not c.is_empty then
|
if not a_css_class.is_empty then
|
||||||
css_classes.extend (c)
|
css_classes.extend (a_css_class)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -80,4 +80,14 @@ feature -- Access
|
|||||||
body: STRING_32
|
body: STRING_32
|
||||||
-- Body of this control
|
-- Body of this control
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -62,12 +62,13 @@ feature --Event handling
|
|||||||
click_event_set: click_event = e
|
click_event_set: click_event = e
|
||||||
end
|
end
|
||||||
|
|
||||||
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)
|
||||||
-- Called if the button is clicked.
|
-- Called if the button is clicked.
|
||||||
require else
|
|
||||||
cname_has_element: cname.count > 0
|
|
||||||
do
|
do
|
||||||
if Current.control_name.same_string (cname [1]) and attached click_event as cevent then
|
if
|
||||||
|
control_name.same_string_general (cname.first) and
|
||||||
|
attached click_event as cevent
|
||||||
|
then
|
||||||
cevent.call (Void)
|
cevent.call (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -84,7 +85,7 @@ feature -- Rendering
|
|||||||
attr.append (a)
|
attr.append (a)
|
||||||
end
|
end
|
||||||
if disabled then
|
if disabled then
|
||||||
attr.append ("disabled=%"disabled%" ")
|
attr.append (" disabled=%"disabled%" ")
|
||||||
end
|
end
|
||||||
Result := render_tag (text, attr)
|
Result := render_tag (text, attr)
|
||||||
end
|
end
|
||||||
@@ -109,6 +110,8 @@ feature -- Change
|
|||||||
if disabled /= b then
|
if disabled /= b then
|
||||||
disabled := b
|
disabled := b
|
||||||
state_changes.replace_with_boolean (disabled, "disabled")
|
state_changes.replace_with_boolean (disabled, "disabled")
|
||||||
|
else
|
||||||
|
check (b = False) implies state_changes.has_key ("disabled") end
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
disabled_set: disabled = b
|
disabled_set: disabled = b
|
||||||
@@ -125,4 +128,14 @@ feature -- Properties
|
|||||||
click_event: detachable PROCEDURE [ANY, TUPLE]
|
click_event: detachable PROCEDURE [ANY, TUPLE]
|
||||||
-- Event that is executed when button is clicked
|
-- Event that is executed when button is clicked
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ deferred class
|
|||||||
WSF_CONTROL
|
WSF_CONTROL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_STATELESS_CONTROL
|
WSF_STATELESS_CONTROL
|
||||||
rename
|
rename
|
||||||
make as make_stateless_control
|
make as make_stateless_control
|
||||||
@@ -110,14 +109,14 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
states.put (state_changes, control_name)
|
states.put (state_changes, control_name)
|
||||||
end
|
end
|
||||||
if actions.count > 0 then
|
if actions.count > 0 then
|
||||||
if not attached states.item ("actions") then
|
if states.item ("actions") = Void then
|
||||||
states.put (create {JSON_ARRAY}.make_array, "actions")
|
states.put (create {JSON_ARRAY}.make_array, "actions")
|
||||||
end
|
end
|
||||||
if attached {JSON_ARRAY} states.item ("actions") as action_list then
|
if attached {JSON_ARRAY} states.item ("actions") as action_list then
|
||||||
across
|
across
|
||||||
actions.array_representation as action
|
actions.array_representation as ic
|
||||||
loop
|
loop
|
||||||
action_list.add (action.item)
|
action_list.add (ic.item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -127,42 +126,43 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
-- Returns the current state of the Control as JSON. This state will be transfered to the client.
|
-- Returns the current state of the Control as JSON. This state will be transfered to the client.
|
||||||
deferred
|
deferred
|
||||||
ensure
|
ensure
|
||||||
controls_not_defined: not (attached Result.item ("controls"))
|
controls_not_defined: Result.item ("controls") = Void
|
||||||
end
|
end
|
||||||
|
|
||||||
state_changes: WSF_JSON_OBJECT
|
state_changes: WSF_JSON_OBJECT
|
||||||
|
|
||||||
feature -- Rendering
|
feature -- Rendering
|
||||||
|
|
||||||
render_tag (body: STRING_32; attrs: detachable STRING_32): STRING_32
|
render_tag (body: READABLE_STRING_32; attrs: detachable READABLE_STRING_32): STRING_32
|
||||||
-- Render this control with the specified body and attributes
|
-- Render this control with the specified body and attributes
|
||||||
do
|
do
|
||||||
Result := render_tag_with_generator_name (js_class, body, attrs)
|
Result := render_tag_with_generator_name (js_class, body, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
render_tag_with_generator_name (a_generator, body: STRING_32; attrs: detachable STRING_32): STRING_32
|
render_tag_with_generator_name (a_generator, body: READABLE_STRING_32; attrs: detachable READABLE_STRING_32): STRING_32
|
||||||
-- Render this control with the specified generator name, body and attributes
|
-- Render this control with the specified generator name, body and attributes
|
||||||
local
|
local
|
||||||
css_classes_string: STRING_32
|
l_css_classes_string: STRING_32
|
||||||
l_attributes: STRING_32
|
l_attributes: STRING_32
|
||||||
do
|
do
|
||||||
css_classes_string := ""
|
create l_css_classes_string.make_empty
|
||||||
across
|
across
|
||||||
css_classes as c
|
css_classes as ic
|
||||||
loop
|
loop
|
||||||
css_classes_string := css_classes_string + " " + c.item
|
l_css_classes_string.append_character (' ')
|
||||||
|
l_css_classes_string.append (ic.item)
|
||||||
end
|
end
|
||||||
l_attributes := " data-name=%"" + control_name + "%" data-type=%"" + a_generator + "%" "
|
l_attributes := " data-name=%"" + control_name + "%" data-type=%"" + a_generator + "%" "
|
||||||
if attached attrs as a then
|
if attached attrs as l_attrs then
|
||||||
l_attributes := l_attributes + a
|
l_attributes.append (l_attrs)
|
||||||
end
|
end
|
||||||
if isolate then
|
if isolate then
|
||||||
l_attributes.append (" data-isolation=%"1%"")
|
l_attributes.append (" data-isolation=%"1%"")
|
||||||
end
|
end
|
||||||
Result := render_tag_with_tagname (tag_name, body, l_attributes, css_classes_string)
|
Result := render_tag_with_tagname (tag_name, body, l_attributes, l_css_classes_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
js_class: STRING_32
|
js_class: READABLE_STRING_32
|
||||||
-- The js_class is the name of the corresponding javascript class for this control. If this query is not redefined, it just
|
-- The js_class is the name of the corresponding javascript class for this control. If this query is not redefined, it just
|
||||||
-- returns the name of the Eiffel class. In case of customized controls, either the according javascript functionality has to
|
-- returns the name of the Eiffel class. In case of customized controls, either the according javascript functionality has to
|
||||||
-- be written in a coffeescript class of the same name or this query has to bee redefined and has to return the name of the
|
-- be written in a coffeescript class of the same name or this query has to bee redefined and has to return the name of the
|
||||||
@@ -173,8 +173,11 @@ feature -- Rendering
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
-- Method called if any callback received. In this method the callback can be routed to the event handler
|
-- Method called if any callback received.
|
||||||
|
-- In this method the callback can be routed to the event handler.
|
||||||
|
require
|
||||||
|
cname_is_not_empty: not cname.is_empty
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -219,4 +222,14 @@ feature -- Properties
|
|||||||
-- Used to avoid name conflicts since the children stateful controls of stateless controls are appended to the parent
|
-- Used to avoid name conflicts since the children stateful controls of stateless controls are appended to the parent
|
||||||
-- control state and therefore could have the same name (Stateless multi controls do not add a hierarchy level)
|
-- control state and therefore could have the same name (Stateless multi controls do not add a hierarchy level)
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ feature
|
|||||||
end
|
end
|
||||||
|
|
||||||
remove_control_by_id (id: INTEGER)
|
remove_control_by_id (id: INTEGER)
|
||||||
--Add removes to pending removes list
|
-- Add removes to pending removes list
|
||||||
do
|
do
|
||||||
pending_removes.extend (id)
|
pending_removes.extend (id)
|
||||||
end
|
end
|
||||||
@@ -176,7 +176,7 @@ feature
|
|||||||
Result := "WSF_DYNAMIC_MULTI_CONTROL"
|
Result := "WSF_DYNAMIC_MULTI_CONTROL"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature -- Access
|
||||||
|
|
||||||
items: JSON_ARRAY
|
items: JSON_ARRAY
|
||||||
-- Holds the current items in this control
|
-- Holds the current items in this control
|
||||||
@@ -193,4 +193,14 @@ feature
|
|||||||
invariant
|
invariant
|
||||||
all_items_exist: items.count = controls.count
|
all_items_exist: items.count = controls.count
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|||||||
@@ -29,33 +29,36 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make_without_border (a_label: detachable STRING_32; c: WSF_VALUE_CONTROL [G])
|
make_without_border (a_label: detachable STRING_32; a_control: WSF_VALUE_CONTROL [G])
|
||||||
-- Initialize form element control with a specific label (or 'Void' for no label) and value control
|
-- Initialize Current form element control with a specific label
|
||||||
|
-- (or 'Void' for no label) and value control `a_control'.
|
||||||
do
|
do
|
||||||
make_with_validators (a_label, False, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
|
make_with_validators (a_label, False, a_control, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
|
||||||
end
|
end
|
||||||
|
|
||||||
make (a_label: detachable STRING_32; c: WSF_VALUE_CONTROL [G])
|
make (a_label: detachable STRING_32; a_control: WSF_VALUE_CONTROL [G])
|
||||||
-- Initialize form element control with a specific label (or 'Void' for no label) and value control
|
-- Initialize Current form element control with a specific label
|
||||||
|
-- (or 'Void' for no label) and value control `a_control'.
|
||||||
do
|
do
|
||||||
make_with_validators (a_label, True, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
|
make_with_validators (a_label, True, a_control, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_validators (a_label: detachable STRING_32; show_border: BOOLEAN; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]])
|
make_with_validators (a_label: detachable STRING_32; show_border: BOOLEAN; a_control: WSF_VALUE_CONTROL [G]; a_validators: LIST [WSF_VALIDATOR [G]])
|
||||||
-- Initialize form element control with a specific label (or 'Void' for no label), value control and list of validators
|
-- Initialize Current form element control with a specific label (or 'Void' for no label),
|
||||||
|
-- value control `a_control' and list of validators `a_validators'
|
||||||
do
|
do
|
||||||
make_control ("div")
|
make_control ("div")
|
||||||
add_class ("form-group")
|
add_class ("form-group")
|
||||||
if show_border then
|
if show_border then
|
||||||
if not attached {WSF_VALUE_CONTROL [LIST [ANY]]} c then
|
if attached {WSF_VALUE_CONTROL [LIST [ANY]]} a_control then
|
||||||
c.add_class ("form-control")
|
a_control.add_class ("form-control-static")
|
||||||
else
|
else
|
||||||
c.add_class ("form-control-static")
|
a_control.add_class ("form-control")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
label_width := 2
|
label_width := 2
|
||||||
value_control := c
|
value_control := a_control
|
||||||
validators := v
|
validators := a_validators
|
||||||
label := a_label
|
label := a_label
|
||||||
error := ""
|
error := ""
|
||||||
end
|
end
|
||||||
@@ -94,7 +97,10 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
-- Pass new_states to subcontrols
|
-- Pass new_states to subcontrols
|
||||||
do
|
do
|
||||||
Precursor (new_states)
|
Precursor (new_states)
|
||||||
if attached {JSON_OBJECT} new_states.item ("controls") as ct and then attached {JSON_OBJECT} ct.item (value_control.control_name) as value_state then
|
if
|
||||||
|
attached {JSON_OBJECT} new_states.item ("controls") as ct and then
|
||||||
|
attached {JSON_OBJECT} ct.item (value_control.control_name) as value_state
|
||||||
|
then
|
||||||
value_control.load_state (value_state)
|
value_control.load_state (value_state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -154,13 +160,11 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
-- Pass callback to subcontrols
|
-- Pass callback to subcontrols
|
||||||
require else
|
|
||||||
cname_not_empty: cname.count > 0
|
|
||||||
do
|
do
|
||||||
if cname [1].same_string (control_name) then
|
if cname.first.same_string (control_name) then
|
||||||
cname.go_i_th (1)
|
cname.start
|
||||||
cname.remove
|
cname.remove
|
||||||
if cname.is_empty then
|
if cname.is_empty then
|
||||||
if event.same_string ("validate") then
|
if event.same_string ("validate") then
|
||||||
@@ -179,9 +183,9 @@ feature -- Implementation
|
|||||||
local
|
local
|
||||||
body: STRING_32
|
body: STRING_32
|
||||||
do
|
do
|
||||||
body := ""
|
create body.make_empty
|
||||||
if attached label as l and then not l.is_empty then
|
if attached label as l_label and then not l_label.is_empty then
|
||||||
body.append ("<label class=%"col-lg-" + label_width.out + " control-label%" for=%"" + value_control.control_name + "%">" + l + "</label>")
|
body.append ("<label class=%"col-lg-" + label_width.out + " control-label%" for=%"" + value_control.control_name + "%">" + l_label + "</label>")
|
||||||
body.append ("<div class=%"col-lg-" + (12 - label_width).out + "%">")
|
body.append ("<div class=%"col-lg-" + (12 - label_width).out + "%">")
|
||||||
else
|
else
|
||||||
body.append ("<div class=%"col-lg-12%">")
|
body.append ("<div class=%"col-lg-12%">")
|
||||||
@@ -252,4 +256,14 @@ feature -- Properties
|
|||||||
label_width: INTEGER
|
label_width: INTEGER
|
||||||
-- The bootstrap column span of the label of this form element control
|
-- The bootstrap column span of the label of this form element control
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature --Event handling
|
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)
|
||||||
-- By default, this does nothing
|
-- By default, this does nothing
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
@@ -90,4 +90,14 @@ feature -- Properties
|
|||||||
html: STRING_32
|
html: STRING_32
|
||||||
-- The HTML value of this HTML control
|
-- The HTML value of this HTML control
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ inherit
|
|||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature
|
feature -- Change
|
||||||
|
|
||||||
put_string (value: detachable READABLE_STRING_GENERAL; key: JSON_STRING)
|
put_string (value: detachable READABLE_STRING_GENERAL; key: JSON_STRING)
|
||||||
-- Assuming there is no item of key `key',
|
-- Assuming there is no item of key `key',
|
||||||
@@ -160,4 +160,14 @@ feature
|
|||||||
replace (l_value, key)
|
replace (l_value, key)
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class
|
|||||||
WSF_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
WSF_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_CONTROL
|
WSF_CONTROL
|
||||||
rename
|
rename
|
||||||
make as make_control
|
make as make_control
|
||||||
@@ -32,15 +31,15 @@ feature {NONE} -- Initialization
|
|||||||
make_with_tag_name ("div")
|
make_with_tag_name ("div")
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_tag_name (t: STRING_32)
|
make_with_tag_name (a_tag: STRING_32)
|
||||||
-- Initialize with specified tag
|
-- Initialize with specified tag `a_tag'.
|
||||||
require
|
require
|
||||||
t_not_empty: not t.is_empty
|
a_tag_not_empty: not a_tag.is_empty
|
||||||
do
|
do
|
||||||
make_control (t)
|
make_control (a_tag)
|
||||||
controls := create {ARRAYED_LIST [G]}.make (5);
|
create {ARRAYED_LIST [G]} controls.make (5)
|
||||||
ensure
|
ensure
|
||||||
tag_name_set:tag_name.same_string (t)
|
tag_name_set: tag_name.same_string (a_tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||||
@@ -127,11 +126,11 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
-- If the subcontrol is a stateless multicontrol x. We add the state changes of subcontrols of x directly to sub_states. (Stateless multi controls do not add a hierarchy level)
|
-- If the subcontrol is a stateless multicontrol x. We add the state changes of subcontrols of x directly to sub_states. (Stateless multi controls do not add a hierarchy level)
|
||||||
do
|
do
|
||||||
across
|
across
|
||||||
controls as c
|
controls as ic
|
||||||
loop
|
loop
|
||||||
if attached {WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]} c.item as cont then
|
if attached {WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]} ic.item as cont then
|
||||||
cont.read_subcontrol_state_changes (sub_states)
|
cont.read_subcontrol_state_changes (sub_states)
|
||||||
elseif attached {WSF_CONTROL} c.item as cont then
|
elseif attached {WSF_CONTROL} ic.item as cont then
|
||||||
cont.read_state_changes (sub_states)
|
cont.read_state_changes (sub_states)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -145,19 +144,19 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
-- Pass callback to subcontrols
|
-- Pass callback to subcontrols
|
||||||
do
|
do
|
||||||
if equal (cname [1], control_name) then
|
if cname.first.same_string (control_name) then
|
||||||
cname.go_i_th (1)
|
cname.start
|
||||||
cname.remove
|
cname.remove
|
||||||
if not cname.is_empty then
|
if not cname.is_empty then
|
||||||
across
|
across
|
||||||
controls as c
|
controls as ic
|
||||||
until
|
until
|
||||||
cname.is_empty
|
cname.is_empty
|
||||||
loop
|
loop
|
||||||
if attached {WSF_CONTROL} c.item as cont then
|
if attached {WSF_CONTROL} ic.item as cont then
|
||||||
cont.handle_callback (cname, event, event_parameter)
|
cont.handle_callback (cname, event, event_parameter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -183,11 +182,11 @@ feature -- Rendering
|
|||||||
|
|
||||||
feature
|
feature
|
||||||
|
|
||||||
add_control (c: G)
|
add_control (a_control: G)
|
||||||
-- Add a control to this multi control
|
-- Add a control `a_control' to this multi control.
|
||||||
do
|
do
|
||||||
controls.extend (c)
|
controls.extend (a_control)
|
||||||
if attached {WSF_CONTROL} c as d then
|
if attached {WSF_CONTROL} a_control as d then
|
||||||
d.control_id := controls.count
|
d.control_id := controls.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -197,4 +196,14 @@ feature -- Properties
|
|||||||
controls: ARRAYED_LIST [G]
|
controls: ARRAYED_LIST [G]
|
||||||
-- List of current controls in this multi control
|
-- List of current controls in this multi control
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ deferred class
|
|||||||
WSF_PAGE_CONTROL
|
WSF_PAGE_CONTROL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_CONTROL
|
WSF_CONTROL
|
||||||
rename
|
rename
|
||||||
make as make_control
|
make as make_control
|
||||||
@@ -121,12 +120,26 @@ feature -- Implementation
|
|||||||
|
|
||||||
render: STRING_32
|
render: STRING_32
|
||||||
-- Render the HTML page
|
-- Render the HTML page
|
||||||
local
|
|
||||||
ajax: BOOLEAN
|
|
||||||
do
|
do
|
||||||
ajax := attached get_parameter ("ajax")
|
|
||||||
create Result.make_empty
|
create Result.make_empty
|
||||||
if not ajax then
|
if attached get_parameter ("ajax") as p_ajax then
|
||||||
|
Result.append ("<div data-name=%"" + control_name + "%" data-type=%"WSF_PAGE_CONTROL%">")
|
||||||
|
Result.append (control.render)
|
||||||
|
if attached additional_javascripts as l_additional_javascripts then
|
||||||
|
across
|
||||||
|
l_additional_javascripts as ic
|
||||||
|
loop
|
||||||
|
Result.append ("<script src=%"")
|
||||||
|
Result.append (base_path)
|
||||||
|
Result.append (ic.item)
|
||||||
|
Result.append ("%"></script>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Result.append ("<script type=%"text/javascript%">$(function() {var page= new WSF_PAGE_CONTROL(")
|
||||||
|
Result.append (full_state.representation)
|
||||||
|
Result.append (");page.initialize();});</script>")
|
||||||
|
Result.append ("</div>")
|
||||||
|
else
|
||||||
Result.append ("<html><head>")
|
Result.append ("<html><head>")
|
||||||
Result.append ("<link href=%"")
|
Result.append ("<link href=%"")
|
||||||
Result.append (base_path)
|
Result.append (base_path)
|
||||||
@@ -142,13 +155,13 @@ feature -- Implementation
|
|||||||
Result.append ("<script src=%"")
|
Result.append ("<script src=%"")
|
||||||
Result.append (base_path)
|
Result.append (base_path)
|
||||||
Result.append ("assets/widget.js%"></script>")
|
Result.append ("assets/widget.js%"></script>")
|
||||||
if attached additional_javascripts as ajs then
|
if attached additional_javascripts as l_additional_javascripts then
|
||||||
across
|
across
|
||||||
ajs as js
|
l_additional_javascripts as ic
|
||||||
loop
|
loop
|
||||||
Result.append ("<script src=%"")
|
Result.append ("<script src=%"")
|
||||||
Result.append (base_path)
|
Result.append (base_path)
|
||||||
Result.append (js.item)
|
Result.append (ic.item)
|
||||||
Result.append ("%"></script>")
|
Result.append ("%"></script>")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,23 +169,6 @@ feature -- Implementation
|
|||||||
Result.append (full_state.representation)
|
Result.append (full_state.representation)
|
||||||
Result.append (");page.initialize();});</script>")
|
Result.append (");page.initialize();});</script>")
|
||||||
Result.append ("</body></html>")
|
Result.append ("</body></html>")
|
||||||
else
|
|
||||||
Result.append ("<div data-name=%"" + control_name + "%" data-type=%"WSF_PAGE_CONTROL%">")
|
|
||||||
Result.append (control.render)
|
|
||||||
if attached additional_javascripts as ajs then
|
|
||||||
across
|
|
||||||
ajs as js
|
|
||||||
loop
|
|
||||||
Result.append ("<script src=%"")
|
|
||||||
Result.append (base_path)
|
|
||||||
Result.append (js.item)
|
|
||||||
Result.append ("%"></script>")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Result.append ("<script type=%"text/javascript%">$(function() {var page= new WSF_PAGE_CONTROL(")
|
|
||||||
Result.append (full_state.representation)
|
|
||||||
Result.append (");page.initialize();});</script>")
|
|
||||||
Result.append ("</div>")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -183,34 +179,31 @@ feature -- Implementation
|
|||||||
control.read_state_changes (states)
|
control.read_state_changes (states)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_parameter (key: STRING_32): detachable STRING_32
|
get_parameter (key: READABLE_STRING_GENERAL): detachable STRING_32
|
||||||
-- Read query parameter as string
|
-- Read query parameter as string
|
||||||
local
|
|
||||||
value: detachable WSF_VALUE
|
|
||||||
do
|
do
|
||||||
Result := VOID
|
if
|
||||||
value := request.query_parameter (key)
|
attached {WSF_STRING} request.query_parameter (key) as l_value
|
||||||
if attached value and then value.is_string then
|
then
|
||||||
Result := value.as_string.value
|
Result := l_value.value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
add_javascript (path: STRING_32)
|
add_javascript (path: STRING_32)
|
||||||
local
|
local
|
||||||
ajs: attached like additional_javascripts
|
l_additional_javascripts: like additional_javascripts
|
||||||
do
|
do
|
||||||
if attached additional_javascripts as aajs then
|
l_additional_javascripts := additional_javascripts
|
||||||
ajs := aajs
|
if l_additional_javascripts = Void then
|
||||||
else
|
create l_additional_javascripts.make (1)
|
||||||
create ajs.make (1)
|
additional_javascripts := l_additional_javascripts
|
||||||
end
|
end
|
||||||
ajs.extend (path)
|
l_additional_javascripts.extend (path)
|
||||||
additional_javascripts := ajs
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
-- Forward callback to control
|
-- Forward callback to control
|
||||||
do
|
do
|
||||||
control.handle_callback (cname, event, event_parameter)
|
control.handle_callback (cname, event, event_parameter)
|
||||||
@@ -230,7 +223,10 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
set_state (sp: JSON_OBJECT)
|
set_state (sp: JSON_OBJECT)
|
||||||
-- Set state
|
-- Set state
|
||||||
do
|
do
|
||||||
if attached {JSON_OBJECT} sp.item ("controls") as ct and then attached {JSON_OBJECT} ct.item (control.control_name) as value_state then
|
if
|
||||||
|
attached {JSON_OBJECT} sp.item ("controls") as ct and then
|
||||||
|
attached {JSON_OBJECT} ct.item (control.control_name) as value_state
|
||||||
|
then
|
||||||
control.load_state (value_state)
|
control.load_state (value_state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -246,7 +242,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
Result.put (state, "state")
|
Result.put (state, "state")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature -- Access
|
||||||
|
|
||||||
control_name: STRING_32
|
control_name: STRING_32
|
||||||
-- Name of this page
|
-- Name of this page
|
||||||
@@ -262,4 +258,14 @@ feature {NONE} -- Root control
|
|||||||
additional_javascripts: detachable ARRAYED_LIST [STRING_32]
|
additional_javascripts: detachable ARRAYED_LIST [STRING_32]
|
||||||
-- List containing the additional javascipt files
|
-- List containing the additional javascipt files
|
||||||
|
|
||||||
|
;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
|
end
|
||||||
|
|||||||
@@ -27,43 +27,43 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Change
|
feature -- Change
|
||||||
|
|
||||||
add_class (c: STRING_32)
|
add_class (a_css_class: STRING_32)
|
||||||
-- Add a css class to this control
|
-- Add a css class to this control
|
||||||
require
|
require
|
||||||
c_not_empty: not c.is_empty
|
a_css_class_not_empty: not a_css_class.is_empty
|
||||||
do
|
do
|
||||||
css_classes.force (c)
|
css_classes.force (a_css_class)
|
||||||
ensure
|
ensure
|
||||||
class_added: css_classes.has (c)
|
class_added: css_classes.has (a_css_class)
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_class (c: STRING_32)
|
remove_class (a_css_class: STRING_32)
|
||||||
-- Remove a css class from this control
|
-- Remove a css class from this control
|
||||||
require
|
require
|
||||||
c_not_empty: not c.is_empty
|
c_not_empty: not a_css_class.is_empty
|
||||||
do
|
do
|
||||||
css_classes.start
|
css_classes.start
|
||||||
css_classes.prune_all (c)
|
css_classes.prune_all (a_css_class)
|
||||||
ensure
|
ensure
|
||||||
c_removed: not css_classes.has (c)
|
c_removed: not css_classes.has (a_css_class)
|
||||||
end
|
end
|
||||||
|
|
||||||
append_attribute (a: STRING_32)
|
append_attribute (att: READABLE_STRING_32)
|
||||||
-- Adds the specified attribute to the attribute string of this control
|
-- Adds the specified attribute to the attribute string of this control
|
||||||
require
|
require
|
||||||
a_not_empty: not a.is_empty
|
att_not_empty: not att.is_empty
|
||||||
do
|
do
|
||||||
if attached attributes as attr then
|
if attached attributes as attr then
|
||||||
attr.append (" ")
|
attr.append_character (' ')
|
||||||
attr.append (a)
|
attr.append (att)
|
||||||
else
|
else
|
||||||
attributes := a
|
create attributes.make_from_string (att)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Rendering
|
feature -- Rendering
|
||||||
|
|
||||||
render_tag (body: STRING_32; attrs: detachable STRING_32): STRING_32
|
render_tag (a_body: READABLE_STRING_32; attrs: detachable READABLE_STRING_32): STRING_32
|
||||||
-- Generate HTML of this control with the specified body and attributes
|
-- Generate HTML of this control with the specified body and attributes
|
||||||
local
|
local
|
||||||
css_classes_string: STRING_32
|
css_classes_string: STRING_32
|
||||||
@@ -74,10 +74,10 @@ feature -- Rendering
|
|||||||
loop
|
loop
|
||||||
css_classes_string.append (" " + c.item)
|
css_classes_string.append (" " + c.item)
|
||||||
end
|
end
|
||||||
Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
|
Result := render_tag_with_tagname (tag_name, a_body, attrs, css_classes_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
render_tag_with_tagname (tag, body: STRING_32; attrs: detachable STRING_32; css_classes_string: STRING_32): STRING_32
|
render_tag_with_tagname (tag, a_body: READABLE_STRING_32; attrs: detachable READABLE_STRING_32; css_classes_string: READABLE_STRING_32): STRING_32
|
||||||
-- Generate HTML of the specified tag with specified body, attributes and css classes
|
-- Generate HTML of the specified tag with specified body, attributes and css classes
|
||||||
local
|
local
|
||||||
l_attributes: STRING_32
|
l_attributes: STRING_32
|
||||||
@@ -92,16 +92,33 @@ feature -- Rendering
|
|||||||
l_attributes.append (css_classes_string)
|
l_attributes.append (css_classes_string)
|
||||||
l_attributes.append_character ('%"')
|
l_attributes.append_character ('%"')
|
||||||
end
|
end
|
||||||
Result := "<" + tag + " " + l_attributes
|
create Result.make_empty
|
||||||
|
Result.append_character ('<')
|
||||||
|
Result.append (tag)
|
||||||
|
Result.append_character (' ')
|
||||||
|
Result.append (l_attributes)
|
||||||
-- Check if we have to render a body. For some elements, this is not the case (like textareas) or only if the body is not empty.
|
-- Check if we have to render a body. For some elements, this is not the case (like textareas) or only if the body is not empty.
|
||||||
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") and not tag.same_string ("div") then
|
if
|
||||||
Result.append (" />")
|
a_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") and
|
||||||
|
not tag.same_string ("div")
|
||||||
|
then
|
||||||
|
-- Note: it should be ok to close for textarea, span, ... and so on.
|
||||||
|
|
||||||
|
Result.append ("/>")
|
||||||
else
|
else
|
||||||
Result.append (" >" + body + "</" + tag + ">")
|
Result.append (" >")
|
||||||
|
Result.append (a_body)
|
||||||
|
Result.append ("</")
|
||||||
|
Result.append (tag)
|
||||||
|
Result.append (">")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
render_tag_with_body (body: STRING_32): STRING_32
|
render_tag_with_body (body: READABLE_STRING_32): STRING_32
|
||||||
-- Generate HTML of this control with the specified body
|
-- Generate HTML of this control with the specified body
|
||||||
do
|
do
|
||||||
Result := render_tag (body, attributes)
|
Result := render_tag (body, attributes)
|
||||||
@@ -126,4 +143,14 @@ feature -- Properties
|
|||||||
invariant
|
invariant
|
||||||
tag_name_not_empty: not tag_name.is_empty
|
tag_name_not_empty: not tag_name.is_empty
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ note
|
|||||||
Mutli controls are used as containers for multiple controls, for
|
Mutli controls are used as containers for multiple controls, for
|
||||||
example a form is a multi control.
|
example a form is a multi control.
|
||||||
]"
|
]"
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -11,7 +10,6 @@ class
|
|||||||
WSF_STATELESS_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
WSF_STATELESS_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_MULTI_CONTROL [G]
|
WSF_MULTI_CONTROL [G]
|
||||||
rename
|
rename
|
||||||
make as make_multi_control
|
make as make_multi_control
|
||||||
@@ -34,7 +32,7 @@ feature {NONE} -- Initialization
|
|||||||
make_with_tag_name ("")
|
make_with_tag_name ("")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature -- Change
|
||||||
|
|
||||||
set_control_id (d: INTEGER)
|
set_control_id (d: INTEGER)
|
||||||
-- Set id of this control and update subcontrol prefixes
|
-- Set id of this control and update subcontrol prefixes
|
||||||
@@ -56,17 +54,22 @@ feature
|
|||||||
|
|
||||||
set_subcontrol_prefixes
|
set_subcontrol_prefixes
|
||||||
-- Update subcontrol prefixes
|
-- Update subcontrol prefixes
|
||||||
|
local
|
||||||
|
s: STRING_32
|
||||||
do
|
do
|
||||||
across
|
across
|
||||||
controls as e
|
controls as ic
|
||||||
loop
|
loop
|
||||||
if attached {WSF_CONTROL} e.item as el then
|
if attached {WSF_CONTROL} ic.item as l_control then
|
||||||
el.control_name_prefix := control_name_prefix + control_id.out + "_"
|
create s.make_from_string (control_name_prefix)
|
||||||
|
s.append_integer (control_id)
|
||||||
|
s.append_character ('_')
|
||||||
|
l_control.set_control_name_prefix (s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature -- Change
|
||||||
|
|
||||||
add_control (c: G)
|
add_control (c: G)
|
||||||
-- Add a control to this multi control
|
-- Add a control to this multi control
|
||||||
@@ -80,7 +83,7 @@ feature
|
|||||||
control_added: controls.has (c)
|
control_added: controls.has (c)
|
||||||
end
|
end
|
||||||
|
|
||||||
render_tag (body: STRING_32; attrs: detachable STRING_32): STRING_32
|
render_tag (body: READABLE_STRING_32; attrs: detachable READABLE_STRING_32): STRING_32
|
||||||
-- Generate HTML of this control with the specified body and attributes
|
-- Generate HTML of this control with the specified body and attributes
|
||||||
local
|
local
|
||||||
css_classes_string: STRING_32
|
css_classes_string: STRING_32
|
||||||
@@ -96,7 +99,7 @@ feature
|
|||||||
|
|
||||||
feature -- Event handling
|
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)
|
||||||
-- Pass callback to subcontrols
|
-- Pass callback to subcontrols
|
||||||
do
|
do
|
||||||
across
|
across
|
||||||
@@ -110,4 +113,14 @@ feature -- Event handling
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ deferred class
|
|||||||
WSF_VALUE_CONTROL [G]
|
WSF_VALUE_CONTROL [G]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_CONTROL
|
WSF_CONTROL
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
@@ -22,7 +21,18 @@ feature -- Access
|
|||||||
end
|
end
|
||||||
|
|
||||||
set_value (v: G)
|
set_value (v: G)
|
||||||
|
-- Set `value' to `v'.
|
||||||
deferred
|
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
|
end
|
||||||
|
|||||||
10
draft/library/wsf_js_widget/license.lic
Normal file
10
draft/library/wsf_js_widget/license.lic
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
${NOTE_KEYWORD}
|
||||||
|
copyright: "2011-${YEAR}, 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
|
||||||
|
]"
|
||||||
@@ -30,9 +30,22 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
-- tt
|
||||||
|
-- local
|
||||||
|
-- lst: ARRAYED_LIST [READABLE_STRING_GENERAL]
|
||||||
|
-- do
|
||||||
|
-- create lst.make (3)
|
||||||
|
-- lst.compare_objects
|
||||||
|
-- lst.extend ({STRING_32} "abc")
|
||||||
|
-- if lst.has ("abc") then
|
||||||
|
-- print ("found%N")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
-- Initialize current service.
|
-- Initialize current service.
|
||||||
do
|
do
|
||||||
|
-- tt
|
||||||
initialize_router
|
initialize_router
|
||||||
initialize_filter
|
initialize_filter
|
||||||
Precursor
|
Precursor
|
||||||
|
|||||||
@@ -18,7 +18,17 @@ inherit
|
|||||||
create
|
create
|
||||||
make_news
|
make_news
|
||||||
|
|
||||||
feature --States
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make_news
|
||||||
|
do
|
||||||
|
page := 1
|
||||||
|
page_size := 8
|
||||||
|
query := "eiffel"
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- States
|
||||||
|
|
||||||
state: WSF_JSON_OBJECT
|
state: WSF_JSON_OBJECT
|
||||||
-- Return state which contains the current html and if there is an event handle attached
|
-- Return state which contains the current html and if there is an event handle attached
|
||||||
@@ -35,14 +45,7 @@ feature --States
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature -- Access
|
||||||
|
|
||||||
make_news
|
|
||||||
do
|
|
||||||
page := 1
|
|
||||||
page_size := 8
|
|
||||||
query := "eiffel"
|
|
||||||
end
|
|
||||||
|
|
||||||
data: ITERABLE [GOOGLE_NEWS]
|
data: ITERABLE [GOOGLE_NEWS]
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ feature
|
|||||||
Precursor
|
Precursor
|
||||||
create form.make
|
create form.make
|
||||||
--Number 1
|
--Number 1
|
||||||
create textbox1.make ({STRING_32}"1")
|
create textbox1.make ({STRING_32} "1")
|
||||||
create n1_container.make ({STRING_32}"Number1", textbox1)
|
create n1_container.make ({STRING_32}"Number1", textbox1)
|
||||||
n1_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make ({STRING_32}"Invalid Number"))
|
n1_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make ({STRING_32}"Invalid Number"))
|
||||||
n1_container.add_validator (create {OWN_VALIDATOR}.make_own)
|
n1_container.add_validator (create {OWN_VALIDATOR}.make_own)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {IMAGE_SLIDER_PAGE}."
|
description: "Summary description for {SLIDER_PAGE}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
Reference in New Issue
Block a user