Added slider demo

This commit is contained in:
Severin Münger
2013-09-24 02:38:36 +02:00
parent a5fa428e98
commit 6908bfe7bf
9 changed files with 82 additions and 31 deletions

View File

@@ -57,7 +57,6 @@ feature -- Router and Filter
create {WSF_LOGGING_FILTER} f create {WSF_LOGGING_FILTER} f
f.set_next (l_filter) f.set_next (l_filter)
l_filter := f l_filter := f
filter := l_filter filter := l_filter
end end
@@ -78,10 +77,10 @@ feature -- Router and Filter
setup_router setup_router
do do
-- router.map (create {WSF_URI_MAPPING}.make ("/hello", create {WSF_AGENT_URI_HANDLER}.make (agent execute_hello)))
map_agent_uri ("/", agent execute_hello, Void) map_agent_uri ("/", agent execute_hello, Void)
map_agent_uri ("/grid", agent grid_demo, Void) map_agent_uri ("/grid", agent grid_demo, Void)
map_agent_uri ("/repeater", agent repeater_demo, Void) map_agent_uri ("/repeater", agent repeater_demo, Void)
map_agent_uri ("/slider", agent slider_demo, Void)
-- NOTE: you could put all those files in a specific folder, and use WSF_FILE_SYSTEM_HANDLER with "/" -- NOTE: you could put all those files in a specific folder, and use WSF_FILE_SYSTEM_HANDLER with "/"
-- this way, it handles the caching and so on -- this way, it handles the caching and so on
@@ -132,6 +131,16 @@ feature -- Execution
page.execute page.execute
end end
slider_demo (request: WSF_REQUEST; response: WSF_RESPONSE)
local
page: IMAGE_SLIDER_PAGE
do
-- To send a response we need to setup, the status code and
-- the response headers.
create page.make (request, response)
page.execute
end
load_file (name: STRING; request: WSF_REQUEST; response: WSF_RESPONSE) load_file (name: STRING; request: WSF_REQUEST; response: WSF_RESPONSE)
local local
f: WSF_FILE_RESPONSE f: WSF_FILE_RESPONSE

View File

@@ -10,6 +10,9 @@ deferred class
inherit inherit
WSF_PAGE_CONTROL WSF_PAGE_CONTROL
redefine
control
end
feature feature
@@ -17,21 +20,21 @@ feature
local local
navbar: WSF_NAVBAR_CONTROL navbar: WSF_NAVBAR_CONTROL
do do
create container.make_multi_control ("container") create control.make_multi_control ("container")
container.add_class ("container") control.add_class ("container")
create navbar.make_navbar_with_brand ("Example") create navbar.make_navbar_with_brand ("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=%"/%"", "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=%"/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=%"/repeater%"", "Repeater"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/slider%"", "Image Slider"))
navbar.add_list_element_right (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"#%"", "About")) navbar.add_list_element_right (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"#%"", "About"))
if not attached get_parameter ("ajax") then if not attached get_parameter ("ajax") then
container.add_control (navbar) control.add_control (navbar)
end end
control := container
end end
feature feature
container: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL] control: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
end end

View File

@@ -22,17 +22,16 @@ feature
initialize_controls initialize_controls
do do
Precursor Precursor
container.add_control (create {WSF_BASIC_CONTROL}.make_with_body("h1","","Grid Demo")) control.add_control (create {WSF_BASIC_CONTROL}.make_with_body("h1","","Grid Demo"))
create datasource.make_news create datasource.make_news
create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make) create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control") search_query.add_class ("form-control")
search_query.set_change_event (agent change_query) search_query.set_change_event (agent change_query)
container.add_control (search_query) control.add_control (search_query)
container.add_control (create {WSF_BASIC_CONTROL}.make_with_body("h2","","Results")) 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 grid.make_grid ("mygrid", <<create {WSF_GRID_COLUMN}.make ("Title", "title"),
create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource) create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource)
container.add_control (grid) control.add_control (grid)
control := container
end end
change_query change_query

View File

@@ -0,0 +1,39 @@
note
description: "Summary description for {IMAGE_SLIDER_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
IMAGE_SLIDER_PAGE
inherit
BASE_PAGE
redefine
initialize_controls
end
create
make
feature -- Implementation
initialize_controls
do
Precursor
create slider.make_slider ("myslider")
slider.add_image ("http://www.placesmustseen.com/wp-content/uploads/2013/01/paris-eiffel-tower.jpg", "Eiffel Tower")
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Image Slider Demo"))
control.add_control (slider)
end
process
do
end
feature -- Properties
slider: WSF_IMAGE_SLIDER_CONTROL
end

View File

@@ -8,6 +8,7 @@ class
REPEATER_PAGE REPEATER_PAGE
inherit inherit
BASE_PAGE BASE_PAGE
redefine redefine
initialize_controls initialize_controls
@@ -21,15 +22,15 @@ feature
initialize_controls initialize_controls
do do
Precursor Precursor
container.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", ""," Repeater Demo")) control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Repeater Demo"))
create datasource.make_news create datasource.make_news
create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make) create search_query.make_autocomplete ("query", create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control") search_query.add_class ("form-control")
search_query.set_change_event (agent change_query) search_query.set_change_event (agent change_query)
container.add_control (search_query) control.add_control (search_query)
container.add_control (create {WSF_BASIC_CONTROL}.make_with_body("h2", "", "Results")) control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h2", "", "Results"))
create repeater.make_repeater ("myrepeater", datasource) create repeater.make_repeater ("myrepeater", datasource)
container.add_control (repeater) control.add_control (repeater)
end end
change_query change_query
@@ -50,4 +51,3 @@ feature
datasource: GOOGLE_NEWS_DATASOURCE datasource: GOOGLE_NEWS_DATASOURCE
end end

View File

@@ -77,15 +77,15 @@ feature
--Result --Result
create result_html.make_html ("txtBox3", "p", "") create result_html.make_html ("txtBox3", "p", "")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make_form_element ("Result", result_html)) form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make_form_element ("Result", result_html))
container.add_control (form) control.add_control (form)
--Progress bar --Progress bar
container.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h4", "", "Autoincrementing progressbar")) control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h4", "", "Autoincrementing progressbar"))
create source.make create source.make
create progress.make_progress_with_source ("progress1", source) create progress.make_progress_with_source ("progress1", source)
source.set_control (progress) source.set_control (progress)
progress.set_isolation (true) progress.set_isolation (true)
container.add_control (progress) control.add_control (progress)
end end
handle_click2 handle_click2

View File

@@ -145,7 +145,7 @@ feature -- Implementation
end end
end end
feature -- EVENT HANDLING feature -- Event handling
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING) handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
-- Forward callback to control -- Forward callback to control
@@ -153,7 +153,7 @@ feature -- EVENT HANDLING
control.handle_callback (cname, event, event_parameter) control.handle_callback (cname, event, event_parameter)
end end
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
state: JSON_OBJECT state: JSON_OBJECT
do do

View File

@@ -63,7 +63,7 @@ feature -- Change
add_image_with_caption (src, alt: STRING; caption: detachable WSF_STATELESS_CONTROL) add_image_with_caption (src, alt: STRING; 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
local local
item: WSF_MULTI_CONTROL item: WSF_STATELESS_MULTI_CONTROL
do do
list.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("li", "data-target=%"#" + control_name + "%" data-slide-to=%"" + list.controls.count.out + "%"", "")); list.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("li", "data-target=%"#" + control_name + "%" data-slide-to=%"" + list.controls.count.out + "%"", ""));
create item.make_multi_control create item.make_multi_control
@@ -77,17 +77,17 @@ feature -- Change
add_image (src, alt: STRING) add_image (src, alt: STRING)
-- Add a new image to the slider, with specified url and alternative text -- Add a new image to the slider, with specified url and alternative text
local local
item: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL] item: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do do
add_image_with_caption (src, alt, Void) add_image_with_caption (src, alt, Void)
end end
feature -- Properties feature -- Properties
list: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL] list: WSF_STATELESS_MULTI_CONTROL
-- List of slider links -- List of slider links
slide_wrapper: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL] slide_wrapper: WSF_STATELESS_MULTI_CONTROL
-- List of the single image slides -- List of the single image slides
end end

View File

@@ -16,12 +16,13 @@
<library name="pcre" location="$ISE_EIFFEL\unstable\library\text\regexp\pcre\pcre-safe.ecf"/> <library name="pcre" location="$ISE_EIFFEL\unstable\library\text\regexp\pcre\pcre-safe.ecf"/>
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template-safe.ecf"/> <library name="uri_template" location="..\..\text\parser\uri_template\uri_template-safe.ecf"/>
<library name="wsf" location="..\wsf\wsf-safe.ecf"/> <library name="wsf" location="..\wsf\wsf-safe.ecf"/>
<cluster name="webcontrol" location=".\webcontrol\"/>
<cluster name="validator" location=".\validator\"/>
<cluster name="input" location=".\input\"/>
<cluster name="grid" location=".\grid\"/>
<cluster name="autocompletion" location=".\autocompletion\"/> <cluster name="autocompletion" location=".\autocompletion\"/>
<cluster name="grid" location=".\grid\"/>
<cluster name="image_slider" location="\home\severin\Documents\EWF\EWF\library\server\wsf_js_widget\"/>
<cluster name="input" location=".\input\"/>
<cluster name="navbar" location=".\navbar\"/> <cluster name="navbar" location=".\navbar\"/>
<cluster name="progressbar" location=".\progressbar\"/> <cluster name="progressbar" location=".\progressbar\"/>
<cluster name="validator" location=".\validator\"/>
<cluster name="webcontrol" location=".\webcontrol\"/>
</target> </target>
</system> </system>