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:
81
library/server/wsf_html/form/field/wsf_form_field_set.e
Normal file
81
library/server/wsf_html/form/field/wsf_form_field_set.e
Normal file
@@ -0,0 +1,81 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
WSF_FORM_FIELD_SET
|
||||
|
||||
inherit
|
||||
WSF_FORM_ITEM
|
||||
|
||||
WSF_FORM_COMPOSITE
|
||||
|
||||
WSF_WITH_CSS_ID
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
initialize_with_count (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
legend: detachable READABLE_STRING_8
|
||||
|
||||
is_collapsible: BOOLEAN
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_legend (v: like legend)
|
||||
do
|
||||
legend := v
|
||||
end
|
||||
|
||||
set_collapsible (b: BOOLEAN)
|
||||
do
|
||||
is_collapsible := b
|
||||
if b then
|
||||
add_css_class ("collapsible")
|
||||
else
|
||||
remove_css_class ("collapsible")
|
||||
end
|
||||
end
|
||||
|
||||
set_collapsed (b: BOOLEAN)
|
||||
do
|
||||
if b then
|
||||
add_css_class ("collapsed")
|
||||
else
|
||||
remove_css_class ("collapsed")
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
do
|
||||
a_html.append ("<fieldset")
|
||||
append_css_class_to (a_html, Void)
|
||||
append_css_id_to (a_html)
|
||||
append_css_style_to (a_html)
|
||||
|
||||
a_html.append (">%N")
|
||||
if attached legend as leg then
|
||||
a_html.append ("<legend>" + leg + "</legend>%N")
|
||||
end
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
c.item.append_to_html (a_theme, a_html)
|
||||
end
|
||||
a_html.append ("%N</fieldset>%N")
|
||||
end
|
||||
|
||||
end
|
||||
89
library/server/wsf_html/form/field/wsf_form_textarea.e
Normal file
89
library/server/wsf_html/form/field/wsf_form_textarea.e
Normal file
@@ -0,0 +1,89 @@
|
||||
note
|
||||
description: "Summary description for {WSF_FORM_INPUT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_FORM_TEXTAREA
|
||||
|
||||
inherit
|
||||
WSF_FORM_FIELD
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
default_value: detachable READABLE_STRING_GENERAL
|
||||
|
||||
rows: INTEGER
|
||||
|
||||
cols: INTEGER
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_rows (i: like rows)
|
||||
do
|
||||
rows := i
|
||||
end
|
||||
|
||||
set_cols (i: like cols)
|
||||
do
|
||||
cols := i
|
||||
end
|
||||
|
||||
set_text_value (s: like default_value)
|
||||
do
|
||||
set_default_value (s)
|
||||
end
|
||||
|
||||
set_value (v: detachable WSF_VALUE)
|
||||
do
|
||||
if attached {WSF_STRING} v as s then
|
||||
set_text_value (s.value)
|
||||
else
|
||||
set_text_value (Void)
|
||||
end
|
||||
end
|
||||
|
||||
set_default_value (v: like default_value)
|
||||
do
|
||||
default_value := v
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_item_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
do
|
||||
a_html.append ("<textarea name=%""+ name +"%"")
|
||||
if rows > 0 then
|
||||
a_html.append (" rows=%"" + rows.out + "%"")
|
||||
end
|
||||
if cols > 0 then
|
||||
a_html.append (" cols=%"" + cols.out + "%"")
|
||||
end
|
||||
|
||||
append_css_class_to (a_html, Void)
|
||||
append_css_id_to (a_html)
|
||||
append_css_style_to (a_html)
|
||||
|
||||
if is_readonly then
|
||||
a_html.append (" readonly=%"readonly%">")
|
||||
else
|
||||
a_html.append (">")
|
||||
end
|
||||
if attached default_value as dft then
|
||||
a_html.append (a_theme.html_encoded (dft))
|
||||
end
|
||||
a_html.append ("</textarea>")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user