Fixed creation procedures (make)

This commit is contained in:
severin
2013-11-02 18:34:48 +01:00
parent 1b831375ef
commit 10b950a7e7
28 changed files with 162 additions and 86 deletions

View File

@@ -0,0 +1,27 @@
note
description: "Summary description for {WSF_DROPDOWN_CONTROL}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_DROPDOWN_CONTROL
inherit
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
rename
make as make_multi_control
end
create
make
feature {NONE} -- Initialization
make (n: STRING)
do
make_multi_control (n)
end
end

View File

@@ -10,16 +10,18 @@ class
inherit
WSF_REPEATER_CONTROL [G]
rename
make as make_repeater
redefine
render
end
create
make_grid
make
feature {NONE} -- Initialization
make_grid (n: STRING; a_columns: ITERABLE [WSF_GRID_COLUMN]; a_datasource: WSF_DATASOURCE [G])
make (n: STRING; a_columns: ITERABLE [WSF_GRID_COLUMN]; a_datasource: WSF_DATASOURCE [G])
do
make_repeater (n, a_datasource)
columns := a_columns

View File

@@ -10,13 +10,16 @@ class
inherit
WSF_CONTROL
rename
make as make_control
end
create
make_paging
make
feature {NONE}
make_paging (n: STRING; ds: WSF_PAGABLE_DATASOURCE [G])
make (n: STRING; ds: WSF_PAGABLE_DATASOURCE [G])
do
make_control (n, "ul")
add_class ("pagination")

View File

@@ -10,6 +10,8 @@ deferred class
inherit
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
rename
make as make_multi_control
redefine
set_state,
state,
@@ -18,7 +20,7 @@ inherit
feature {NONE} -- Initialization
make_repeater (n: STRING; a_datasource: WSF_DATASOURCE [G])
make (n: STRING; a_datasource: WSF_DATASOURCE [G])
local
p: WSF_PAGINATION_CONTROL [G]
do
@@ -26,7 +28,7 @@ feature {NONE} -- Initialization
datasource := a_datasource
datasource.set_on_update_agent (agent update)
if attached {WSF_PAGABLE_DATASOURCE [G]} a_datasource as ds then
create p.make_paging (n + "_paging", ds)
create p.make (n + "_paging", ds)
add_control (p)
pagination_control := p
end

View File

@@ -10,26 +10,28 @@ class
inherit
WSF_INPUT_CONTROL
rename
make as make_input
redefine
handle_callback,
state
end
create
make_autocomplete, make_autocomplete_with_agent
make, make_with_agent
feature {NONE} -- Initialization
make_autocomplete (n: STRING; c: WSF_AUTOCOMPLETION)
make (n: STRING; c: WSF_AUTOCOMPLETION)
-- Initialize with specified name and autocompletion
do
make_autocomplete_with_agent (n, agent c.autocompletion)
make_with_agent (n, agent c.autocompletion)
if attached c.template as t then
template := t
end
end
make_autocomplete_with_agent (n: STRING; c: FUNCTION [ANY, TUPLE [STRING], JSON_ARRAY])
make_with_agent (n: STRING; c: FUNCTION [ANY, TUPLE [STRING], JSON_ARRAY])
-- Initialize with specified name and autocompletion function
do
make_input (n, "")

View File

@@ -10,16 +10,19 @@ class
inherit
WSF_VALUE_CONTROL [BOOLEAN]
rename
make as make_value_control
end
create
make_checkbox
make
feature {NONE} -- Initialization
make_checkbox (n, l, c: STRING)
make (n, l, c: STRING)
-- Initialize with specified control name,
do
make_control (n, "input")
make_value_control (n, "input")
label := l
checked_value := c
end

View File

@@ -10,6 +10,8 @@ class
inherit
WSF_VALUE_CONTROL [LIST [STRING]]
rename
make as make_control
undefine
load_state,
full_state,
@@ -17,13 +19,16 @@ inherit
end
WSF_MULTI_CONTROL [WSF_CHECKBOX_CONTROL]
rename
make as make_multi_control
end
create
make_checkbox_list_control
make
feature {NONE} -- Initializaton
make_checkbox_list_control (n: STRING)
make (n: STRING)
-- Initialize with specified control name
do
make_multi_control (n)

View File

@@ -8,10 +8,13 @@ class
WSF_CODEVIEW_CONTROL
inherit
WSF_TEXTAREA_CONTROL
rename
make_textarea as make_codeview
make as make_codeview
end
create
make_codeview
end

View File

@@ -10,16 +10,19 @@ class
inherit
WSF_VALUE_CONTROL [STRING]
rename
make as make_value_control
end
create
make_input
make
feature {NONE} -- Initialization
make_input (n, v: STRING)
make (n, v: STRING)
-- Initialize with specified name and value
do
make_control (n, "input")
make_value_control (n, "input")
type := "text"
text := v
end

View File

@@ -10,13 +10,16 @@ class
inherit
WSF_INPUT_CONTROL
rename
make as make_input
end
create
make_password
make
feature {NONE} -- Initialization
make_password (n, v: STRING)
make (n, v: STRING)
-- Initialize with specified control name and text
do
make_input (n, v)

View File

@@ -10,16 +10,18 @@ class
inherit
WSF_INPUT_CONTROL
rename
make as make_input
redefine
render
end
create
make_textarea
make
feature {NONE} -- Initialization
make_textarea (n, t: STRING)
make (n, t: STRING)
-- Initialize with specified control name and text to be displayed in this textarea
do
make_input (n, t)

View File

@@ -10,16 +10,18 @@ class
inherit
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
rename
make as make_multi_control
redefine
render
end
create
make_navbar, make_navbar_with_brand
make, make_with_brand
feature {NONE} -- Initialization
make_navbar (n: STRING)
make (n: STRING)
--Initialize
do
make_multi_control (n)
@@ -31,10 +33,10 @@ feature {NONE} -- Initialization
nav_right.add_class ("nav navbar-nav navbar-right")
end
make_navbar_with_brand (n, b: STRING)
make_with_brand (n, b: STRING)
-- Initialize with specified brand string
do
make_navbar (n)
make (n)
brand := b
end

View File

@@ -10,13 +10,16 @@ class
inherit
WSF_CONTROL
rename
make as make_control
end
create
make_progress, make_progress_with_source
make, make_with_source
feature {NONE} -- Initialization
make_progress (n: STRING)
make (n: STRING)
-- Initialize with specified control name
do
make_control (n, "div")
@@ -24,10 +27,10 @@ feature {NONE} -- Initialization
progress := 0
end
make_progress_with_source (n: STRING; p: WSF_PROGRESSSOURCE)
make_with_source (n: STRING; p: WSF_PROGRESSSOURCE)
-- Initialize with specified control name and progresssource
do
make_progress (n)
make (n)
progress_source := p
end

View File

@@ -10,20 +10,23 @@ class
inherit
WSF_CONTROL
rename
make as make_control
end
create
make_slider
make
feature {NONE} -- Initialization
make_slider (n: STRING)
make (n: STRING)
-- Initialize with specified name
do
make_control (n, "div")
add_class ("carousel slide")
create list.make_with_tag_name (control_name + "_links", "ol")
list.add_class ("carousel-indicators")
create slide_wrapper.make_multi_control (control_name + "_wrapper")
create slide_wrapper.make (control_name + "_wrapper")
slide_wrapper.add_class ("carousel-inner")
end
@@ -88,7 +91,7 @@ feature -- Change
cl: STRING
item: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do
create item.make_multi_control (control_name + "_item" + slide_wrapper.controls.count.out)
create item.make (control_name + "_item" + slide_wrapper.controls.count.out)
item.add_class ("item")
item.add_control (c)
if attached caption as capt then

View File

@@ -10,13 +10,16 @@ class
inherit
WSF_CONTROL
rename
make as make_control
end
create
make_button
make
feature {NONE} -- Initialization
make_button (n: STRING; t: STRING)
make (n: STRING; t: STRING)
-- Initialize with specified control name and text
do
make_control (n, "button")

View File

@@ -10,19 +10,21 @@ deferred class
inherit
WSF_STATELESS_CONTROL
rename
make as make_stateless_control
redefine
render_tag
end
feature {NONE} -- Initialization
make_control (n, a_tag_name: STRING)
make (n, a_tag_name: STRING)
-- Initialize with specified control name and tag
require
not n.is_empty
not a_tag_name.is_empty
do
make (a_tag_name)
make_stateless_control (a_tag_name)
control_name := n
create state_changes.make
create actions.make_array

View File

@@ -10,15 +10,18 @@ class
inherit
WSF_MULTI_CONTROL [WSF_CONTROL]
rename
make as make_multi_control
end
WSF_VALIDATABLE
create
make_form_control
make
feature {NONE} -- Initialization
make_form_control (n: STRING)
make (n: STRING)
-- Initialize
do
make_multi_control (n)

View File

@@ -10,6 +10,8 @@ class
inherit
WSF_CONTROL
rename
make as make_control
redefine
read_state_changes,
load_state,
@@ -19,17 +21,17 @@ inherit
WSF_VALIDATABLE
create
make_form_element, make_form_element_with_validators
make, make_with_validators
feature {NONE} -- Initialization
make_form_element (a_label: STRING; c: WSF_VALUE_CONTROL [G])
make (a_label: STRING; c: WSF_VALUE_CONTROL [G])
-- Initialize form element control with a specific label and value control
do
make_form_element_with_validators (a_label, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
make_with_validators (a_label, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0))
end
make_form_element_with_validators (a_label: STRING; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]])
make_with_validators (a_label: STRING; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]])
-- Initialize form element control with a specific label, value control and list of validators
do
make_control (c.control_name + "_container", "div")

View File

@@ -10,16 +10,17 @@ class
inherit
WSF_VALUE_CONTROL [STRING]
rename make as make_value_control end
create
make_html
make
feature {NONE} -- Initialization
make_html (n, t, v: STRING)
make (n, t, v: STRING)
-- Initialize
do
make_control (n, t)
make_value_control (n, t)
html := v
end

View File

@@ -10,6 +10,8 @@ class
inherit
WSF_CONTROL
rename
make as make_control
redefine
full_state,
read_state_changes,
@@ -17,11 +19,11 @@ inherit
end
create
make_multi_control, make_with_tag_name
make, make_with_tag_name
feature {NONE} -- Initialization
make_multi_control (n: STRING)
make (n: STRING)
-- Initialize with specified control name and default tag "div"
do
make_with_tag_name (n, "div")
@@ -130,7 +132,7 @@ feature -- Change
add_control (c: G)
-- Add a control to this multi control
do
controls.extend (c)
controls.extend (c)
end
feature -- Properties

View File

@@ -11,7 +11,7 @@ inherit
WSF_CONTROL
rename
make as make_wsf_control
make as make_control
redefine
full_state,
read_state_changes

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="wsf_js_widget" uuid="660D6D82-2218-11E3-86B1-F23C91AEC05E" library_target="wsf_js_widget">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-11-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-11-0 http://www.eiffel.com/developers/xml/configuration-1-11-0.xsd" name="wsf_js_widget" uuid="660D6D82-2218-11E3-86B1-F23C91AEC05E" library_target="wsf_js_widget">
<target name="wsf_js_widget">
<root all_classes="true"/>
<file_rule>
@@ -7,7 +7,7 @@
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="transitional" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoder" location="..\..\..\library\text\encoder\encoder-safe.ecf"/>

View File

@@ -20,15 +20,15 @@ feature
local
btn: WSF_BUTTON_CONTROL
do
create control.make_multi_control ("container")
create control.make ("container")
control.add_class ("container")
create navbar.make_navbar_with_brand ("navbar1", "Example")
create navbar.make_with_brand ("navbar1", "Example")
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/%"", "Home"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/grid%"", "Grid"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/repeater%"", "Repeater"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/slider%"", "Slider"))
navbar.add_list_element_right (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/about%"", "About"))
create btn.make_button ("scode", "Show Code")
create btn.make ("scode", "Show Code")
btn.set_click_event (agent show_code)
btn.set_isolation (true)
btn.add_class ("btn-success")

View File

@@ -12,7 +12,7 @@ inherit
WSF_REPEATER_CONTROL [GOOGLE_NEWS]
create
make_repeater
make
feature

View File

@@ -24,12 +24,12 @@ feature
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", "Grid Demo"))
create datasource.make_news
create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make)
create search_query.make ("query", create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control")
search_query.set_change_event (agent change_query)
control.add_control (search_query)
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h2", "", "Results"))
create grid.make_grid ("mygrid", <<create {WSF_GRID_COLUMN}.make ("Title", "title"), create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource)
create grid.make ("mygrid", <<create {WSF_GRID_COLUMN}.make ("Title", "title"), create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource)
control.add_control (grid)
navbar.set_active (2)
end

View File

@@ -24,9 +24,9 @@ feature -- Implementation
form: WSF_FORM_CONTROL
do
Precursor
create slider.make_slider ("myslider")
create form.make_form_control ("sliderform")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make_form_element ("Input", create {WSF_INPUT_CONTROL}.make_input ("sliderformtext", "Test")))
create slider.make ("myslider")
create form.make ("sliderform")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make ("Input", create {WSF_INPUT_CONTROL}.make ("sliderformtext", "Test")))
--slider.add_control (form, Void)
--slider.add_image ("http://www.placesmustseen.com/wp-content/uploads/2013/01/paris-eiffel-tower.jpg", "Eiffel Tower")
slider.add_image ("http://31.media.tumblr.com/43f3edae3fb569943047077cddf93c79/tumblr_mtw7wdX9cm1st5lhmo1_1280.jpg", "car")

View File

@@ -24,12 +24,12 @@ feature
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Repeater Demo"))
create datasource.make_news
create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make)
create search_query.make ("query", create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control")
search_query.set_change_event (agent change_query)
control.add_control (search_query)
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h2", "", "Results"))
create repeater.make_repeater ("myrepeater", datasource)
create repeater.make ("myrepeater", datasource)
control.add_control (repeater)
navbar.set_active (3)
end

View File

@@ -30,58 +30,58 @@ feature
source: INCREASING_PROGRESSSOURCE
do
Precursor
create form.make_form_control ("panel")
create form.make ("panel")
form.add_class ("form-horizontal")
--Number 1
create textbox1.make_input ("txtBox1", "1")
create n1_container.make_form_element ("Number1", textbox1)
create textbox1.make ("txtBox1", "1")
create n1_container.make ("Number1", textbox1)
n1_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make_decimal_validator ("Invalid Number"))
n1_container.add_validator (create {OWN_VALIDATOR}.make_own)
form.add_control (n1_container)
--Number 2
create textbox2.make_input ("txtBox2", "2")
create n2_container.make_form_element ("Number2", textbox2)
create textbox2.make ("txtBox2", "2")
create n2_container.make ("Number2", textbox2)
n2_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make_decimal_validator ("Invalid Number"))
form.add_control (n2_container)
--Flag autocomplete
create autocompletion1.make_autocomplete ("autocompletion1", create {FLAG_AUTOCOMPLETION}.make)
create n3_container.make_form_element ("Flag Autocomplete", autocompletion1)
create autocompletion1.make ("autocompletion1", create {FLAG_AUTOCOMPLETION}.make)
create n3_container.make ("Flag Autocomplete", autocompletion1)
form.add_control (n3_container)
--Contact autocomplete
create autocompletion2.make_autocomplete ("autocompletion2", create {CONTACT_AUTOCOMPLETION}.make)
create n4_container.make_form_element ("Contact Autocomplete", autocompletion2)
create autocompletion2.make ("autocompletion2", create {CONTACT_AUTOCOMPLETION}.make)
create n4_container.make ("Contact Autocomplete", autocompletion2)
form.add_control (n4_container)
--Google autocomplete
create autocompletion3.make_autocomplete ("autocompletion4", create {GOOGLE_AUTOCOMPLETION}.make)
create n5_container.make_form_element ("Google Autocomplete", autocompletion3)
create autocompletion3.make ("autocompletion4", create {GOOGLE_AUTOCOMPLETION}.make)
create n5_container.make ("Google Autocomplete", autocompletion3)
form.add_control (n5_container)
--Categories
create cklist.make_checkbox_list_control ("categories")
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make_checkbox ("net", "Network", "net"))
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make_checkbox ("os", "Operating Systems", "os"))
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make_checkbox ("fmfp", "Formal Methods and Functional Programming", "fmfp"))
create cats_container.make_form_element ("Categories", cklist)
create cklist.make ("categories")
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make ("net", "Network", "net"))
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make ("os", "Operating Systems", "os"))
cklist.add_control (create {WSF_CHECKBOX_CONTROL}.make ("fmfp", "Formal Methods and Functional Programming", "fmfp"))
create cats_container.make ("Categories", cklist)
cats_container.add_validator (create {WSF_MIN_VALIDATOR [STRING]}.make_min_validator (1, "Choose at least one category"))
cats_container.add_validator (create {WSF_MAX_VALIDATOR [STRING]}.make_max_validator (2, "Choose at most two category"))
form.add_control (cats_container)
--Button 1
create button1.make_button ("sample_button1", "Update")
create button1.make ("sample_button1", "Update")
button1.set_click_event (agent handle_click)
button1.add_class ("col-lg-offset-2")
form.add_control (button1)
--Button 2
create button2.make_button ("sample_button2", "Start Modal Grid")
create button2.make ("sample_button2", "Start Modal Grid")
button2.set_click_event (agent handle_click)
form.add_control (button2)
--Result
create result_html.make_html ("txtBox3", "p", "")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make_form_element ("Result", result_html))
create result_html.make ("txtBox3", "p", "")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make ("Result", result_html))
control.add_control (form)
--Progress bar
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h4", "", "Autoincrementing progressbar"))
create source.make
create progress.make_progress_with_source ("progress1", source)
create progress.make_with_source ("progress1", source)
source.set_control (progress)
progress.set_isolation (true)
control.add_control (progress)