sws 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/DOC.otl +34 -0
- data/doc/Makefile +13 -0
- data/doc/architecture.dia +0 -0
- data/doc/docbook/architecture.png +0 -0
- data/doc/docbook/concepts.docbook +474 -0
- data/doc/docbook/installation.docbook +57 -0
- data/doc/docbook/introduction.docbook +130 -0
- data/doc/docbook/sws_manual.docbook +35 -0
- data/doc/docbook/todo.docbook +38 -0
- data/doc/docbook/tutorial.docbook +594 -0
- data/examples/README +1 -0
- data/examples/addressbook/CardBrowse/CardBrowse.html +43 -0
- data/examples/addressbook/CardBrowse/CardBrowse.rb +65 -0
- data/examples/addressbook/CardBrowse/CardBrowse.sws +92 -0
- data/examples/addressbook/Login/LoginPage.html +12 -0
- data/examples/addressbook/Login/LoginPage.rb +19 -0
- data/examples/addressbook/Login/LoginPage.sws +15 -0
- data/examples/addressbook/README +1 -0
- data/examples/addressbook/addressbook.rb +70 -0
- data/examples/addressbook/application.yaml +8 -0
- data/examples/addressbook/db.yaml +7 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.html +11 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.rb +21 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.sws +25 -0
- data/examples/component_demo/ComponentDemo.rb +21 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.html +18 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.rb +2 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.sws +22 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.html +10 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.rb +9 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.sws +33 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.html +12 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.rb +21 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.sws +40 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.html +11 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.rb +37 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.sws +47 -0
- data/examples/component_demo/GenericDemo/GenericDemo.html +4 -0
- data/examples/component_demo/GenericDemo/GenericDemo.rb +2 -0
- data/examples/component_demo/GenericDemo/GenericDemo.sws +10 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.html +8 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.rb +20 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.sws +19 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.html +11 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.rb +2 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.sws +14 -0
- data/examples/component_demo/PageWrapper/PageWrapper.html +23 -0
- data/examples/component_demo/PageWrapper/PageWrapper.rb +2 -0
- data/examples/component_demo/PageWrapper/PageWrapper.sws +42 -0
- data/examples/component_demo/README +1 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.html +13 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.rb +19 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.sws +20 -0
- data/examples/component_demo/StringDemo/StringDemo.html +5 -0
- data/examples/component_demo/StringDemo/StringDemo.rb +16 -0
- data/examples/component_demo/StringDemo/StringDemo.sws +14 -0
- data/examples/component_demo/application.yaml +28 -0
- data/examples/component_demo/poweredby.jpg +0 -0
- data/examples/component_demo/style.css +1 -0
- data/examples/movies/Menu/Menu.html +3 -0
- data/examples/movies/Menu/Menu.rb +7 -0
- data/examples/movies/Menu/Menu.sws +7 -0
- data/examples/movies/MovieBrowse/MovieBrowse.html +68 -0
- data/examples/movies/MovieBrowse/MovieBrowse.rb +178 -0
- data/examples/movies/MovieBrowse/MovieBrowse.sws +127 -0
- data/examples/movies/README +1 -0
- data/examples/movies/UserBrowse/UserBrowse.html +50 -0
- data/examples/movies/UserBrowse/UserBrowse.rb +69 -0
- data/examples/movies/UserBrowse/UserBrowse.sws +49 -0
- data/examples/movies/application.yaml +11 -0
- data/examples/movies/da.rb +36 -0
- data/examples/movies/dbmovies.rb +44 -0
- data/examples/movies/frameworks/TestFramework/framework.yaml +4 -0
- data/examples/movies/frameworks/TestFramework/resources/im1.jpg +0 -0
- data/examples/movies/images/pbr1b.jpg +0 -0
- data/examples/movies/movies.rb +28 -0
- data/examples/movies/movies.sds +119 -0
- data/examples/movies/movies.sqlite +0 -0
- data/examples/movies/movies_mysql.sql +28 -0
- data/examples/movies/movies_postgres.sql +27 -0
- data/examples/movies/movies_sqlite.sql +28 -0
- data/lib/sws.rb +89 -0
- data/lib/sws/Core/components/CheckBox/CheckBox.api +5 -0
- data/lib/sws/Core/components/CheckBox/CheckBox.rb +45 -0
- data/lib/sws/Core/components/CheckBoxList/CheckBoxList.api +13 -0
- data/lib/sws/Core/components/CheckBoxList/CheckBoxList.rb +54 -0
- data/lib/sws/Core/components/Conditional/Conditional.api +3 -0
- data/lib/sws/Core/components/Conditional/Conditional.html +1 -0
- data/lib/sws/Core/components/Conditional/Conditional.rb +39 -0
- data/lib/sws/Core/components/Conditional/Conditional.sws +2 -0
- data/lib/sws/Core/components/Content/Content.rb +18 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.html +13 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.rb +18 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.sws +16 -0
- data/lib/sws/Core/components/FileUpload/FileUpload.api +16 -0
- data/lib/sws/Core/components/FileUpload/FileUpload.rb +62 -0
- data/lib/sws/Core/components/Form/Form.api +9 -0
- data/lib/sws/Core/components/Form/Form.html +3 -0
- data/lib/sws/Core/components/Form/Form.rb +55 -0
- data/lib/sws/Core/components/Form/Form.sws +12 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.api +10 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.html +1 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.rb +39 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.sws +12 -0
- data/lib/sws/Core/components/GenericElement/GenericElement.api +10 -0
- data/lib/sws/Core/components/GenericElement/GenericElement.rb +34 -0
- data/lib/sws/Core/components/HiddenField/HiddenField.api +7 -0
- data/lib/sws/Core/components/HiddenField/HiddenField.rb +37 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.api +13 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.html +1 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.rb +102 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.sws +12 -0
- data/lib/sws/Core/components/Image/Image.api +11 -0
- data/lib/sws/Core/components/Image/Image.rb +49 -0
- data/lib/sws/Core/components/ImageButton/ImageButton.api +16 -0
- data/lib/sws/Core/components/ImageButton/ImageButton.rb +76 -0
- data/lib/sws/Core/components/Link/Link.api +11 -0
- data/lib/sws/Core/components/Link/Link.rb +39 -0
- data/lib/sws/Core/components/PasswordField/PasswordField.api +7 -0
- data/lib/sws/Core/components/PasswordField/PasswordField.rb +41 -0
- data/lib/sws/Core/components/RadioButton/RadioButton.api +7 -0
- data/lib/sws/Core/components/RadioButton/RadioButton.rb +44 -0
- data/lib/sws/Core/components/RadioButtonList/RadioButtonList.api +20 -0
- data/lib/sws/Core/components/RadioButtonList/RadioButtonList.rb +76 -0
- data/lib/sws/Core/components/Repetition/Repetition.api +10 -0
- data/lib/sws/Core/components/Repetition/Repetition.html +1 -0
- data/lib/sws/Core/components/Repetition/Repetition.rb +137 -0
- data/lib/sws/Core/components/Repetition/Repetition.sws +2 -0
- data/lib/sws/Core/components/ResetButton/ResetButton.api +5 -0
- data/lib/sws/Core/components/ResetButton/ResetButton.rb +28 -0
- data/lib/sws/Core/components/Select/Select.api +24 -0
- data/lib/sws/Core/components/Select/Select.rb +57 -0
- data/lib/sws/Core/components/String/String.api +5 -0
- data/lib/sws/Core/components/String/String.rb +28 -0
- data/lib/sws/Core/components/SubmitButton/SubmitButton.api +6 -0
- data/lib/sws/Core/components/SubmitButton/SubmitButton.rb +53 -0
- data/lib/sws/Core/components/TextArea/TextArea.api +9 -0
- data/lib/sws/Core/components/TextArea/TextArea.rb +28 -0
- data/lib/sws/Core/components/TextField/TextField.api +9 -0
- data/lib/sws/Core/components/TextField/TextField.rb +46 -0
- data/lib/sws/Core/framework.yaml +25 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.api +5 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.html +58 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.rb +34 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.sws +37 -0
- data/lib/sws/JSComponents/framework.yaml +3 -0
- data/lib/sws/adaptor.rb +334 -0
- data/lib/sws/application.rb +604 -0
- data/lib/sws/component.rb +656 -0
- data/lib/sws/cookie.rb +27 -0
- data/lib/sws/direct_action.rb +38 -0
- data/lib/sws/extensions.rb +49 -0
- data/lib/sws/parsers.rb +374 -0
- data/lib/sws/request.rb +308 -0
- data/lib/sws/response.rb +70 -0
- data/lib/sws/session.rb +195 -0
- data/lib/sws/slot.rb +198 -0
- metadata +263 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Represents <INPUT type=image HTML tag
|
4
|
+
# Bindings:
|
5
|
+
# - value (required,default: "Submit") - string to be displayed on the button.
|
6
|
+
# - action - method to be called on button click
|
7
|
+
# - other_tag_string - generic string to add to the tag
|
8
|
+
# - src - URL to image source
|
9
|
+
# - resource - name of the resource to be used as the image
|
10
|
+
# - framework - the framework the resource resides in
|
11
|
+
class ImageButton < FormElement
|
12
|
+
|
13
|
+
|
14
|
+
def initialize (*args)
|
15
|
+
super
|
16
|
+
@action = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
# Overriden method from Component class - sets the action to perform if
|
20
|
+
# the "value" parameter is not empty
|
21
|
+
def update_binding ( key, value )
|
22
|
+
|
23
|
+
#TODO: make these params accessible by user
|
24
|
+
if ( key == "x" || key == "y" )
|
25
|
+
@action = @slots["action"].bound_object()
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
# If the action has been set up (see #update_binding( key,value )) it is
|
32
|
+
# called now. Otherwise just nil is returned.
|
33
|
+
def perform_action ()
|
34
|
+
|
35
|
+
if ( @action )
|
36
|
+
return @action.call()
|
37
|
+
else
|
38
|
+
return nil
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
# Appends #generate_html() output to response
|
45
|
+
def append_to_response ( response )
|
46
|
+
response << generate_html()
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Generates HTML output containing <INPUT type="submit" tag
|
51
|
+
def generate_html ()
|
52
|
+
|
53
|
+
string = "<INPUT TYPE=\"image\" NAME=\"#{element_name()}\" VALUE=\"#{@slots["value"].value}\"#{generic_attr_string()}"
|
54
|
+
if ( slot_bound?( "resource" ) )
|
55
|
+
framework = slot_bound?("framework") ? @slots["framework"].value : "app"
|
56
|
+
src = app().adaptor.base_path() + app().resource_request_handler_key + "/" + framework + "/" + @slots["resource"].value
|
57
|
+
elsif ( slot_bound?("src") )
|
58
|
+
src = @slots["src"].value()
|
59
|
+
end
|
60
|
+
|
61
|
+
string << " src=\"#{src}\""
|
62
|
+
|
63
|
+
["alt", "title"].each do |attr|
|
64
|
+
if ( slot_bound?(attr) )
|
65
|
+
string << " #{@slots[attr].to_tag_attribute}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
string << ">"
|
70
|
+
return string
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Represents <LINK tag
|
4
|
+
# Bindings:
|
5
|
+
# - href (required) - href attribute of the tag
|
6
|
+
# - rel - rel attribute of the tag
|
7
|
+
# - type - type attribute of the tag
|
8
|
+
# - other_tag_string - generic string to add to the tag
|
9
|
+
class Link < Component
|
10
|
+
|
11
|
+
def container? ()
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def append_to_response ( response )
|
17
|
+
response << generate_html()
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def generate_html ()
|
22
|
+
|
23
|
+
string = "<LINK"
|
24
|
+
if ( slot_bound?( "resource" ) )
|
25
|
+
framework = slot_bound?("framework") ? @slots["framework"].value : "app"
|
26
|
+
href = app().adaptor.base_path() + app().resource_request_handler_key + "/" + framework + "/" + @slots["resource"].value
|
27
|
+
else
|
28
|
+
href = @slots["href"].value
|
29
|
+
end
|
30
|
+
string << " href=\"#{href}\""
|
31
|
+
string << bound_slot_string( "rel","type" )
|
32
|
+
string << generic_attr_string() << ">"
|
33
|
+
return string
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Represents tag <INPUT type=password
|
4
|
+
# Bindings:
|
5
|
+
# - value (required,settable) - contents of the password field
|
6
|
+
# - format - method of "value" object to be used before updating it
|
7
|
+
# (eg. you can use to_i() method to get Fixnum object)
|
8
|
+
# - other_tag_string - generic string to add to the tag
|
9
|
+
class PasswordField < FormElement
|
10
|
+
|
11
|
+
|
12
|
+
def generate_html ()
|
13
|
+
return "<INPUT TYPE=\"password\" NAME=\"#{element_name()}.value\" VALUE=\"#{@slots["value"].value}\"#{generic_attr_string()}>"
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def append_to_response ( response )
|
18
|
+
response << generate_html()
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# If the "format" slot value has been set, uses it to format "value" slot
|
23
|
+
# value
|
24
|
+
def update_binding ( key,value )
|
25
|
+
|
26
|
+
if ( key == "value" )
|
27
|
+
if ( slot_bound?("format") )
|
28
|
+
@slots["value"].value = value.method( @slots["format"].value ).call()
|
29
|
+
else
|
30
|
+
@slots["value"].value = value
|
31
|
+
end
|
32
|
+
else
|
33
|
+
#TODO: not sure if necessary - there is no more settable slots beside "value"
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Represens <INPUT type=radio HTML tag.
|
4
|
+
# Bindings:
|
5
|
+
# - checked (required, settable) - if true, the radiobutton will be checked
|
6
|
+
# - disabled - if true, the radiobutton will be rendered inactive.
|
7
|
+
# - other_tag_string - generic string to add to the tag
|
8
|
+
class RadioButton < FormElement
|
9
|
+
|
10
|
+
|
11
|
+
def process_bindings ()
|
12
|
+
|
13
|
+
if ( @parameters["checked"] == "on" )
|
14
|
+
@slots["checked"].value = true
|
15
|
+
else
|
16
|
+
@slots["checked"].value = false
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def append_to_response ( response )
|
23
|
+
response << generate_html()
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# Generates HTML output for radiobutton form element
|
28
|
+
def generate_html ()
|
29
|
+
|
30
|
+
string = "<INPUT type=\"radio\" name=\"#{element_name()}.checked\""
|
31
|
+
if ( @slots["checked"].value() == true || @slots["checked"].value() == "true" )
|
32
|
+
string << " checked"
|
33
|
+
end
|
34
|
+
if ( slot_bound?( "disabled" ) && @slots["disabled"] )
|
35
|
+
string << " disabled"
|
36
|
+
end
|
37
|
+
string << generic_attr_string() << ">"
|
38
|
+
return string
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Represents a list of radiobuttons with the same name.
|
4
|
+
# Bindings:
|
5
|
+
# - list (required) - array of object to be displayed in the form of
|
6
|
+
# radiobuttons
|
7
|
+
# - item (required,settable) - an object to use as list iterator
|
8
|
+
# - selection (required,settable) - object selected from radiobutton list
|
9
|
+
# - display_string - string to display (if not set, the item itself will be
|
10
|
+
# used)
|
11
|
+
# - prefix - HTML code to add before each radiobutton
|
12
|
+
# - suffix - HTML code to add after each radiobutton
|
13
|
+
# - disabled - if true, the radiobuttons will be inactive
|
14
|
+
# - other_tag_string - generic string to add to each <INPUT type=radiobutton
|
15
|
+
# tag
|
16
|
+
class RadioButtonList < ListElement
|
17
|
+
|
18
|
+
|
19
|
+
# Returns value of "selection" slot
|
20
|
+
def selection ()
|
21
|
+
return @slots["selection"].value()
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# Sets the value of "selection" slot
|
26
|
+
def selection= ( selection )
|
27
|
+
|
28
|
+
if ( selection == nil )
|
29
|
+
@slots["selection"].value = nil
|
30
|
+
else
|
31
|
+
@slots["selection"].value = list[selection.to_i]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def process_bindings ()
|
38
|
+
self.selection = @parameters["selection"]
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def generate_html ()
|
43
|
+
|
44
|
+
string = ""
|
45
|
+
generic_string = generic_attr_string()
|
46
|
+
list().each_index do |index|
|
47
|
+
item = list[index]
|
48
|
+
@slots["item"].value = item
|
49
|
+
if ( slot_bound?( "display_string" ) )
|
50
|
+
display_string = @slots["display_string"].value()
|
51
|
+
else
|
52
|
+
display_string = item
|
53
|
+
end
|
54
|
+
if ( slot_bound?( "prefix" ) )
|
55
|
+
string << @slots["prefix"].value()
|
56
|
+
end
|
57
|
+
string << "<INPUT type=\"radio\" name=\"#{element_name()}.selection\" value=#{index}"
|
58
|
+
if ( slot_bound?( "disabled" ) && @slots["disabled"].value() == true )
|
59
|
+
string << " disabled"
|
60
|
+
end
|
61
|
+
if ( selection == item )
|
62
|
+
string << " checked"
|
63
|
+
end
|
64
|
+
string << generic_string << ">\n"
|
65
|
+
string << display_string
|
66
|
+
if ( slot_bound?("suffix") )
|
67
|
+
string << @slots["suffix"].value()
|
68
|
+
end
|
69
|
+
end
|
70
|
+
return string
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<span sws="content"/>
|
@@ -0,0 +1,137 @@
|
|
1
|
+
module SWS
|
2
|
+
|
3
|
+
# Most complex component. Renders its content repeteadly - basing on
|
4
|
+
# list.each. Differs strongly from other components: instead of single
|
5
|
+
# @subcomponents array it has @subcomponent_array, where index is a number
|
6
|
+
# of iteration and value is subcomponent array for this iteration of list
|
7
|
+
# Then in various phases of request loop list is iterated and @subcomponents
|
8
|
+
# is set to proper value retrieved from @subcomponent_array - the phase is
|
9
|
+
# then repeated for each element in @subcomponent_array
|
10
|
+
# Bindings:
|
11
|
+
# - list (required) - array of object to iterate through
|
12
|
+
# - item (required, settable ) - object used as list iterator
|
13
|
+
# - index (settable) - an index of current item in list iterator
|
14
|
+
class Repetition < Component
|
15
|
+
|
16
|
+
|
17
|
+
def initialize ( name, request, parent, slots )
|
18
|
+
super
|
19
|
+
@subcomponent_array = Array.new
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
# Tokenizes binding - retrieves iteration number from binding name and calls
|
24
|
+
# super with @subcomponents set to proper @subcomponent_array[number] object
|
25
|
+
def tokenize_binding ( key,value )
|
26
|
+
|
27
|
+
if ( md = /^(\d+)\.(.*)$/.match( key ) ) #extract iteration number (must be present) and rest of binding
|
28
|
+
@subcomponents = @subcomponent_array [md[1].to_i]
|
29
|
+
super( md[2],value )
|
30
|
+
else #without dot - should never happen here (repetition has no settable bindings)
|
31
|
+
raise( "Cannot set parameter #{key} to value #{value} in Repetition" )
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
# Calls awake repeatedly for each element in @subcomponent_array
|
38
|
+
def awake ()
|
39
|
+
|
40
|
+
@list.each_index do |i|
|
41
|
+
@subcomponents = @subcomponent_array [i]
|
42
|
+
super
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# Calls sleep repeatedly for each element in @subcomponent_array
|
49
|
+
def sleep ()
|
50
|
+
|
51
|
+
@list.each_index do |i|
|
52
|
+
@subcomponents = @subcomponent_array [i]
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# Overriden method of the Component class - initializes elements of
|
60
|
+
# @subcomponent_array and calls super for each one of them
|
61
|
+
def create_component_tree ()
|
62
|
+
|
63
|
+
@list = @slots["list"].value()
|
64
|
+
@list.each_index do |i|
|
65
|
+
@slots["item"].value = @list[i]
|
66
|
+
if ( slot_bound?("index") )
|
67
|
+
@slots["index"].value = i
|
68
|
+
end
|
69
|
+
@subcomponent_array [i] = Array.new()
|
70
|
+
@subcomponents = @subcomponent_array [i]
|
71
|
+
super
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
# Performs action - again, calls super for each element of
|
78
|
+
# @subcomponent_array
|
79
|
+
def perform_action ()
|
80
|
+
|
81
|
+
@list.each_index do |i|
|
82
|
+
|
83
|
+
@slots["item"].value = @list[i]
|
84
|
+
if ( slot_bound?("index") )
|
85
|
+
@slots["index"].value = i
|
86
|
+
end
|
87
|
+
@subcomponents = @subcomponent_array[i]
|
88
|
+
#dirty hack to set bindings to proper values :)
|
89
|
+
@subcomponents.each { |com| com.process_bindings() }
|
90
|
+
next_page = super
|
91
|
+
return next_page if ( next_page )
|
92
|
+
|
93
|
+
end
|
94
|
+
return nil
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
# Processes bindings - calls super for.. guest what? :)
|
100
|
+
def process_bindings ()
|
101
|
+
|
102
|
+
@list.each_index do |i|
|
103
|
+
@slots["item"].value = @list[i]
|
104
|
+
if ( slot_bound?("index") )
|
105
|
+
@slots["index"].value = i
|
106
|
+
end
|
107
|
+
@subcomponents = @subcomponent_array[i]
|
108
|
+
super
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
# Calls super for each element of @subcomponent_array. Number of iteration
|
115
|
+
# is added to the name of the receiver.
|
116
|
+
def append_to_response ( response )
|
117
|
+
|
118
|
+
#store original name of the repetition
|
119
|
+
old_name = @name.dup()
|
120
|
+
@list.each_index do |i|
|
121
|
+
@slots["item"].value = @list[i]
|
122
|
+
if ( slot_bound?("index") )
|
123
|
+
@slots["index"].value = i
|
124
|
+
end
|
125
|
+
@subcomponents = @subcomponent_array[i]
|
126
|
+
# Add iteration number to the end of name - will be necessary in other phases
|
127
|
+
@name << ".#{i}"
|
128
|
+
super
|
129
|
+
# Revert name
|
130
|
+
@name = old_name.dup()
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|