Merge branch 'widget' of github.com:souvarin/EWF into widget

This commit is contained in:
YNH Webdev
2013-09-06 12:29:14 +02:00
7 changed files with 60 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ inherit
create
make_email_validator
feature
feature{NONE}
make_email_validator (e: STRING)
do

View File

@@ -6,8 +6,11 @@ note
class
WSF_CHECKBOX_CONTROL
inherit
WSF_VALUE_CONTROL[BOOLEAN]
WSF_VALUE_CONTROL [BOOLEAN]
create
make_checkbox

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_CHECKBOX_LIST_CONTROL}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_CHECKBOX_LIST_CONTROL
inherit
WSF_MULTI_CONTROL[WSF_CHECKBOX_CONTROL]
create
make_checkbox_list_control
feature {NONE}
make_checkbox_list_control (n: STRING)
do
make_multi_control (n)
end
end

View File

@@ -9,7 +9,7 @@ class
inherit
WSF_MULTI_CONTROL
WSF_MULTI_CONTROL [WSF_CONTROL]
create
make_form_control
@@ -22,8 +22,24 @@ feature {NONE}
tag_name := "form"
end
feature
feature -- Validation
validate: BOOLEAN
do
Result := True
across
controls as c
until
Result = False
loop
-- TODO: Change generic parameter of elm from ANY to <WILDCARD> if something like that is available in Eiffel.
-- Otherwise, check separately for STRING, LIST...
if attached {WSF_FORM_ELEMENT_CONTROL[ANY]} c.item as elem then
if not elem.is_valid then
Result := False
end
end
end
end
end

View File

@@ -40,12 +40,17 @@ feature {NONE}
feature
is_valid (value: G): BOOLEAN
is_valid (): BOOLEAN
do
Result := True
across
validators as c
until
not Result
loop
if not c.item.validate (value_control.value) then
Result := False
end
end
end
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT

View File

@@ -5,7 +5,7 @@ note
revision: "$Revision$"
class
WSF_MULTI_CONTROL
WSF_MULTI_CONTROL[G -> WSF_CONTROL]
inherit
@@ -18,14 +18,15 @@ inherit
create
make_multi_control
feature {NONE}
controls: LINKED_LIST [WSF_CONTROL]
controls: LINKED_LIST [G]
make_multi_control (n: STRING)
do
make (n, "div")
controls := create {LINKED_LIST [WSF_CONTROL]}.make;
controls := create {LINKED_LIST [G]}.make;
end
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
@@ -106,7 +107,7 @@ feature
Result := render_tag (Result, "")
end
add_control (c: WSF_CONTROL)
add_control (c: G)
do
controls.put_front (c)
end