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:
@@ -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$"
|
||||
|
||||
90
library/server/wsf_html/widget/wsf_widget_div.e
Normal file
90
library/server/wsf_html/widget/wsf_widget_div.e
Normal file
@@ -0,0 +1,90 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
WSF_WIDGET_DIV
|
||||
|
||||
inherit
|
||||
WSF_WIDGET
|
||||
|
||||
WSF_WIDGET_COMPOSITE
|
||||
|
||||
WSF_WITH_CSS_ID
|
||||
|
||||
WSF_WITH_CSS_CLASS
|
||||
|
||||
WSF_WITH_CSS_STYLE
|
||||
|
||||
WSF_WITH_HTML_ATTRIBUTE
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_item,
|
||||
make_with_items,
|
||||
make_with_text,
|
||||
make_with_text_and_css_id,
|
||||
make_with_item_and_css_id
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
initialize_with_count (0)
|
||||
end
|
||||
|
||||
make_with_text (s: READABLE_STRING_8)
|
||||
do
|
||||
make_with_item (create {WSF_WIDGET_TEXT}.make_with_text (s))
|
||||
end
|
||||
|
||||
make_with_item (i: WSF_WIDGET)
|
||||
do
|
||||
initialize_with_count (1)
|
||||
extend (i)
|
||||
end
|
||||
|
||||
make_with_items (it: ITERABLE [WSF_WIDGET])
|
||||
do
|
||||
initialize_with_count (2)
|
||||
across
|
||||
it as c
|
||||
loop
|
||||
extend (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
make_with_item_and_css_id (i: WSF_WIDGET; a_css_id: READABLE_STRING_8)
|
||||
do
|
||||
make_with_item (i)
|
||||
set_css_id (a_css_id)
|
||||
end
|
||||
|
||||
make_with_text_and_css_id (s: READABLE_STRING_8; a_css_id: READABLE_STRING_8)
|
||||
do
|
||||
make_with_text (s)
|
||||
set_css_id (a_css_id)
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
do
|
||||
a_html.append ("<div")
|
||||
append_css_class_to (a_html, Void)
|
||||
append_css_id_to (a_html)
|
||||
append_css_style_to (a_html)
|
||||
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 ("</div>%N")
|
||||
end
|
||||
|
||||
end
|
||||
97
library/server/wsf_html/widget/wsf_widget_image.e
Normal file
97
library/server/wsf_html/widget/wsf_widget_image.e
Normal 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
|
||||
Reference in New Issue
Block a user