Added wsf_html documentation in the doc/workbook.

Also improved the structure of `wsf_html` library.
Added a few widgets.
This commit is contained in:
2017-02-14 19:37:03 +01:00
parent b93cb17f7c
commit 5dc9d82df7
43 changed files with 401 additions and 33 deletions

View File

@@ -0,0 +1,26 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
WSF_FORM_DIV
inherit
WSF_WIDGET_DIV
undefine
extend
end
WSF_FORM_COMPOSITE
create
make,
make_with_item,
make_with_items,
make_with_text,
make_with_text_and_css_id,
make_with_item_and_css_id
end

View File

@@ -8,16 +8,24 @@ class
WSF_FORM
inherit
WSF_WIDGET
WSF_FORM_COMPOSITE
WSF_WITH_HTML_ATTRIBUTE
WSF_WITH_CSS_ID
WSF_WITH_CSS_CLASS
WSF_WITH_CSS_STYLE
create
make
feature {NONE} -- Initialization
make (a_action: READABLE_STRING_8; a_id: READABLE_STRING_8)
make (a_action: READABLE_STRING_8; a_id: detachable READABLE_STRING_8)
do
action := a_action
id := a_id
@@ -33,8 +41,8 @@ feature -- Access
action: READABLE_STRING_8
-- URL for the web form
id: READABLE_STRING_8
-- Id of the form
id: detachable READABLE_STRING_8
-- Optional id of the form
is_get_method: BOOLEAN
do
@@ -56,9 +64,10 @@ feature -- Access
feature -- Basic operation
process (req: WSF_REQUEST; a_before_callback, a_after_callback: detachable PROCEDURE [WSF_FORM_DATA])
-- Process Current form with request `req'
-- agent `a_before_callback' is called before the validation
-- agent `a_after_callback' is called after the validation
-- Process Current form with request `req`,
-- and build `last_data: WSF_FORM_DATA` object containing the field values.
-- agent `a_before_callback` is called before the validation
-- agent `a_after_callback` is called after the validation
local
fd: WSF_FORM_DATA
do
@@ -120,22 +129,18 @@ feature -- Conversion
local
s: STRING_8
do
a_html.append ("<form action=%""+ action +"%" id=%""+ id +"%" method=%""+ method +"%"")
a_html.append ("<form action=%""+ action +"%"")
a_html.append (" method=%""+ method +"%"")
if attached encoding_type as enctype then
a_html.append (" enctype=%""+ enctype +"%"")
end
if not html_classes.is_empty then
create s.make_empty
across
html_classes as cl
loop
if not s.is_empty then
s.extend (' ')
end
s.append (cl.item)
end
a_html.append (" class=%"" + s + "%" ")
if attached id as l_id then
a_html.append (" id=%""+ l_id +"%"")
end
append_css_id_to (a_html)
append_css_class_to (a_html, html_classes)
append_css_style_to (a_html)
append_html_attributes_to (a_html)
a_html.append (">%N")
across
items as c
@@ -145,10 +150,4 @@ feature -- Conversion
a_html.append ("</form>%N")
end
to_html (a_theme: WSF_THEME): STRING_8
do
create Result.make_empty
append_to_html (a_theme, Result)
end
end

View File

@@ -1,6 +1,5 @@
note
description: "Summary description for {WSF_WIDGET_TABLE}."
author: ""
description: "Summary description for {WSF_WIDGET_AGENT_TABLE}."
date: "$Date$"
revision: "$Revision$"

View File

@@ -5,15 +5,21 @@ note
revision : "$Revision$"
class
WSF_FORM_DIV
WSF_WIDGET_DIV
inherit
WSF_FORM_ITEM
WSF_WIDGET
WSF_FORM_COMPOSITE
WSF_WIDGET_COMPOSITE
WSF_WITH_CSS_ID
WSF_WITH_CSS_CLASS
WSF_WITH_CSS_STYLE
WSF_WITH_HTML_ATTRIBUTE
create
make,
make_with_item,
@@ -71,14 +77,14 @@ feature -- Conversion
append_css_class_to (a_html, Void)
append_css_id_to (a_html)
append_css_style_to (a_html)
a_html.append (">%N")
append_html_attributes_to (a_html)
a_html.append (">")
across
items as c
loop
c.item.append_to_html (a_theme, a_html)
end
a_html.append ("%N</div>%N")
a_html.append ("</div>%N")
end
end

View File

@@ -0,0 +1,97 @@
note
description: "Summary description for {WSF_WIDGET_IMAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_WIDGET_IMAGE
inherit
WSF_WIDGET
WSF_WITH_CSS_ID
WSF_WITH_CSS_CLASS
WSF_WITH_CSS_STYLE
WSF_WITH_HTML_ATTRIBUTE
create
make
feature {NONE} -- Initialization
make (a_src: READABLE_STRING_8)
do
src := a_src
end
feature -- Access
src: READABLE_STRING_8
-- `src` html attribute.
alt: detachable READABLE_STRING_8
-- Alternate text for Current image.
width: detachable READABLE_STRING_8
-- Optional width value.
height: detachable READABLE_STRING_8
-- Optional height value.
feature -- Change
set_src (v: like src)
do
src := v
end
set_alt (v: like alt)
do
alt := v
end
set_width (v: like width)
do
width := v
end
set_height (v: like height)
do
height := v
end
feature -- Conversion
append_to_html (a_theme: WSF_THEME; a_html: STRING_8)
do
a_html.append ("<img src=%"")
a_html.append (src)
a_html.append ("%"")
if attached alt as l_alt then
a_html.append (" alt=%"")
a_html.append (l_alt)
a_html.append ("%"")
end
if attached width as w then
a_html.append (" width=%"")
a_html.append (w)
a_html.append ("%"")
end
if attached height as h then
a_html.append (" height=%"")
a_html.append (h)
a_html.append ("%"")
end
append_css_id_to (a_html)
append_css_style_to (a_html)
append_css_class_to (a_html, css_classes)
append_html_attributes_to (a_html)
a_html.append ("/>")
end
end