Added custom-template in examples, as a base template to integrate easily other JS widgets.

Added custom example (based on custom-template project) that demonstrates how to integrate a thirdparty JS component such as d3 within the application using wsf_js_widget.

Removed various unecessary ecf dependencies.
This commit is contained in:
2014-07-07 12:15:18 +02:00
parent 0427f7a8d3
commit f6ebd414d6
53 changed files with 24893 additions and 8 deletions

View File

@@ -0,0 +1,107 @@
note
description: "simple application root class"
date: "$Date$"
revision: "$Revision$"
class
APPLICATION
inherit
WSF_ROUTED_SERVICE
rename
execute as execute_router
end
WSF_FILTERED_SERVICE
WSF_DEFAULT_SERVICE
redefine
initialize
end
WSF_FILTER
rename
execute as execute_router
end
create
make_and_launch
feature {NONE} -- Initialization
initialize
-- Initialize current service.
do
initialize_router
initialize_filter
Precursor
set_service_option ("port", 7070)
end
feature -- Router and Filter
create_filter
-- Create `filter'
local
f, l_filter: detachable WSF_FILTER
do
l_filter := Void
-- Maintenance
create {WSF_MAINTENANCE_FILTER} f
f.set_next (l_filter)
l_filter := f
-- Logging
create {WSF_LOGGING_FILTER} f
f.set_next (l_filter)
l_filter := f
filter := l_filter
end
setup_filter
-- Setup `filter'
local
f: WSF_FILTER
do
from
f := filter
until
not attached f.next as l_next
loop
f := l_next
end
f.set_next (Current)
end
setup_router
do
map_agent_uri ("/", agent execute_hello, Void)
-- 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
router.handle_with_request_methods ("/assets", create {WSF_FILE_SYSTEM_HANDLER}.make_hidden ("assets"), router.methods_GET)
end
feature -- Helper: mapping
map_agent_uri (a_uri: READABLE_STRING_8; a_action: like {WSF_URI_AGENT_HANDLER}.action; rqst_methods: detachable WSF_REQUEST_METHODS)
do
router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, create {WSF_URI_AGENT_HANDLER}.make (a_action)), rqst_methods)
end
feature -- Execution
execute_hello (request: WSF_REQUEST; response: WSF_RESPONSE)
local
page: EMPTY_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
end

View File

@@ -0,0 +1,40 @@
note
description: "Summary description for {BASE_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
BASE_PAGE
inherit
WSF_PAGE_CONTROL
redefine
control,
initialize_controls
end
feature
initialize_controls
do
create control.make
control.add_class ("container")
create navbar.make_with_brand ("EWF JS WIDGET TEMPLATE")
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/%"", "Home"))
create main_control.make ("main_control")
control.add_control (navbar)
control.add_control (main_control)
end
feature -- Properties
main_control: WSF_LAYOUT_CONTROL
control: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
navbar: WSF_NAVBAR_CONTROL
end

View File

@@ -0,0 +1,48 @@
note
description: "Summary description for {EMPTY_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EMPTY_PAGE
inherit
BASE_PAGE
redefine
initialize_controls
end
create
make
feature -- Initialization
initialize_controls
do
Precursor
navbar.set_active (1)
-- Define colum 12/12
main_control.add_column (12)
-- Create button
create button.make ("0")
button.set_click_event (agent do
button.set_text ((button.text.to_integer_32+1).out)
end)
--Add button control
main_control.add_control (1,button)
end
feature -- Implementation
process
do
end
feature
button: WSF_BUTTON_CONTROL
end