htmlgrid 1.1.7 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/htmlgrid/booleanvalue.rb +14 -14
  3. data/lib/htmlgrid/button.rb +9 -9
  4. data/lib/htmlgrid/centeredcomposite.rb +21 -20
  5. data/lib/htmlgrid/component.rb +214 -197
  6. data/lib/htmlgrid/composite.rb +332 -301
  7. data/lib/htmlgrid/datevalue.rb +12 -12
  8. data/lib/htmlgrid/div.rb +9 -9
  9. data/lib/htmlgrid/divcomposite.rb +44 -43
  10. data/lib/htmlgrid/divform.rb +8 -8
  11. data/lib/htmlgrid/divlist.rb +17 -19
  12. data/lib/htmlgrid/divtemplate.rb +6 -6
  13. data/lib/htmlgrid/dojotoolkit.rb +54 -48
  14. data/lib/htmlgrid/errormessage.rb +47 -43
  15. data/lib/htmlgrid/form.rb +70 -62
  16. data/lib/htmlgrid/formlist.rb +14 -14
  17. data/lib/htmlgrid/grid.rb +111 -67
  18. data/lib/htmlgrid/image.rb +17 -16
  19. data/lib/htmlgrid/infomessage.rb +15 -14
  20. data/lib/htmlgrid/input.rb +34 -32
  21. data/lib/htmlgrid/inputcheckbox.rb +13 -13
  22. data/lib/htmlgrid/inputcurrency.rb +9 -9
  23. data/lib/htmlgrid/inputdate.rb +11 -11
  24. data/lib/htmlgrid/inputfile.rb +13 -12
  25. data/lib/htmlgrid/inputradio.rb +9 -9
  26. data/lib/htmlgrid/inputtext.rb +10 -10
  27. data/lib/htmlgrid/javascript.rb +17 -16
  28. data/lib/htmlgrid/label.rb +53 -49
  29. data/lib/htmlgrid/labeltext.rb +8 -8
  30. data/lib/htmlgrid/link.rb +31 -27
  31. data/lib/htmlgrid/list.rb +121 -110
  32. data/lib/htmlgrid/namedcomponent.rb +28 -25
  33. data/lib/htmlgrid/pass.rb +11 -11
  34. data/lib/htmlgrid/passthru.rb +20 -17
  35. data/lib/htmlgrid/popuplink.rb +41 -39
  36. data/lib/htmlgrid/reset.rb +8 -8
  37. data/lib/htmlgrid/richtext.rb +22 -20
  38. data/lib/htmlgrid/select.rb +28 -26
  39. data/lib/htmlgrid/span.rb +9 -9
  40. data/lib/htmlgrid/spancomposite.rb +18 -18
  41. data/lib/htmlgrid/spanlist.rb +9 -9
  42. data/lib/htmlgrid/staticinput.rb +14 -13
  43. data/lib/htmlgrid/submit.rb +9 -9
  44. data/lib/htmlgrid/template.rb +121 -105
  45. data/lib/htmlgrid/text.rb +9 -9
  46. data/lib/htmlgrid/textarea.rb +19 -17
  47. data/lib/htmlgrid/ulcomposite.rb +22 -22
  48. data/lib/htmlgrid/ullist.rb +9 -9
  49. data/lib/htmlgrid/urllink.rb +38 -36
  50. data/lib/htmlgrid/value.rb +9 -9
  51. data/lib/htmlgrid/version.rb +2 -2
  52. data/test/stub/cgi.rb +10 -7
  53. data/test/suite.rb +3 -3
  54. data/test/test_add_row.rb +12 -13
  55. data/test/test_component.rb +141 -91
  56. data/test/test_composite.rb +85 -46
  57. data/test/test_datevalue.rb +28 -24
  58. data/test/test_divlist.rb +126 -0
  59. data/test/test_dojotoolkit.rb +41 -26
  60. data/test/test_form.rb +89 -73
  61. data/test/test_formlist.rb +77 -65
  62. data/test/test_grid.rb +256 -208
  63. data/test/test_input.rb +37 -31
  64. data/test/test_interaction_list.rb +106 -70
  65. data/test/test_label.rb +91 -77
  66. data/test/test_list.rb +110 -95
  67. data/test/test_select.rb +35 -30
  68. data/test/test_template.rb +66 -55
  69. data/test/test_text.rb +36 -31
  70. metadata +17 -4
  71. data/TooltipDialog.txt +0 -73
  72. data/interaction_no_inline.txt +0 -1216
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,22 +22,23 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Image -- htmlgrid -- 27.11.2002 -- hwyss@ywesee.com
25
+ # Image -- htmlgrid -- 27.11.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/namedcomponent'
27
+ require "htmlgrid/namedcomponent"
28
28
 
29
29
  module HtmlGrid
30
- class Image < NamedComponent
31
- def init
32
- super
33
- if(@lookandfeel)
34
- @attributes['src'] = @lookandfeel.resource(@name)
35
- @attributes['alt'] = @lookandfeel.lookup(@name)
36
- end
37
- #@attributes['border'] = "0"
38
- end
39
- def to_html(context)
40
- context.img(@attributes)
41
- end
42
- end
30
+ class Image < NamedComponent
31
+ def init
32
+ super
33
+ if @lookandfeel
34
+ @attributes["src"] = @lookandfeel.resource(@name)
35
+ @attributes["alt"] = @lookandfeel.lookup(@name)
36
+ end
37
+ # @attributes['border'] = "0"
38
+ end
39
+
40
+ def to_html(context)
41
+ context.img(@attributes)
42
+ end
43
+ end
43
44
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -25,17 +25,18 @@
25
25
  # InfoMessage -- htmlgrid -- 25.08.2003 -- mhuggler@ywesee.com
26
26
 
27
27
  module HtmlGrid
28
- module InfoMessage
29
- private
30
- def info_message
31
- if @session.info?
32
- @session.infos.each { |info|
33
- txt = HtmlGrid::Text.new(info, @model, @session, self)
34
- @grid.insert_row(0, txt)
35
- @grid.set_colspan(0,0)
36
- @grid.add_style('info', 0, 0)
37
- }
38
- end
39
- end
40
- end
28
+ module InfoMessage
29
+ private
30
+
31
+ def info_message
32
+ if @session.info?
33
+ @session.infos.each { |info|
34
+ txt = HtmlGrid::Text.new(info, @model, @session, self)
35
+ @grid.insert_row(0, txt)
36
+ @grid.set_colspan(0, 0)
37
+ @grid.add_style("info", 0, 0)
38
+ }
39
+ end
40
+ end
41
+ end
41
42
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,38 +22,40 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Input -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
25
+ # Input -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/namedcomponent'
27
+ require "htmlgrid/namedcomponent"
28
28
 
29
29
  module HtmlGrid
30
- class Input < NamedComponent
31
- def init
32
- super
33
- @attributes['name'] = @name.to_s
34
- value = nil
35
- if(@model.respond_to?(@name))
36
- value = @model.send(@name)
37
- end
38
- if(value.nil? \
39
- && @session.respond_to?(:user_input))
40
- value = @session.user_input(@name)
41
- end
42
- if(value.nil? && autofill? \
43
- && @session.respond_to?(:get_cookie_input))
44
- value = @session.get_cookie_input(@name)
45
- end
46
- if(value.is_a? RuntimeError)
47
- value = value.value
48
- end
49
- self.value = value
50
- end
51
- def value=(value)
52
- @attributes.store("value", value.to_s)
53
- @value = value
54
- end
55
- def to_html(context)
56
- context.input(@attributes)
57
- end
58
- end
30
+ class Input < NamedComponent
31
+ def init
32
+ super
33
+ @attributes["name"] = @name.to_s
34
+ value = nil
35
+ if @model.respond_to?(@name)
36
+ value = @model.send(@name)
37
+ end
38
+ if value.nil? \
39
+ && @session.respond_to?(:user_input)
40
+ value = @session.user_input(@name)
41
+ end
42
+ if value.nil? && autofill? \
43
+ && @session.respond_to?(:get_cookie_input)
44
+ value = @session.get_cookie_input(@name)
45
+ end
46
+ if value.is_a? RuntimeError
47
+ value = value.value
48
+ end
49
+ self.value = value
50
+ end
51
+
52
+ def value=(value)
53
+ @attributes.store("value", value.to_s)
54
+ @value = value
55
+ end
56
+
57
+ def to_html(context)
58
+ context.input(@attributes)
59
+ end
60
+ end
59
61
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -24,18 +24,18 @@
24
24
  #
25
25
  # InputCheckbox -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
26
26
 
27
- require 'htmlgrid/input'
27
+ require "htmlgrid/input"
28
28
 
29
29
  module HtmlGrid
30
- class InputCheckbox < Input
31
- LABEL = true
32
- def init
33
- super
34
- if(@value)
35
- @attributes.store('checked', true)
36
- end
37
- @attributes.store('value', '1')
38
- @attributes['type'] = 'checkbox'
39
- end
40
- end
30
+ class InputCheckbox < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ if @value
35
+ @attributes.store("checked", true)
36
+ end
37
+ @attributes.store("value", "1")
38
+ @attributes["type"] = "checkbox"
39
+ end
40
+ end
41
41
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,15 +22,15 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # InputCurrency -- htmlgrid -- 14.03.2003 -- hwyss@ywesee.com
25
+ # InputCurrency -- htmlgrid -- 14.03.2003 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/inputtext'
27
+ require "htmlgrid/inputtext"
28
28
 
29
29
  module HtmlGrid
30
- class InputCurrency < InputText
31
- def init
32
- super
33
- @attributes['value'] = @lookandfeel.format_price(@value)
34
- end
35
- end
30
+ class InputCurrency < InputText
31
+ def init
32
+ super
33
+ @attributes["value"] = @lookandfeel.format_price(@value)
34
+ end
35
+ end
36
36
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,17 +22,17 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- #InputDate -- htmlgrid -- 22.04.2003 -- benfay@ywesee.com
25
+ # InputDate -- htmlgrid -- 22.04.2003 -- benfay@ywesee.com
26
26
 
27
- require 'htmlgrid/inputtext'
27
+ require "htmlgrid/inputtext"
28
28
 
29
29
  module HtmlGrid
30
- class InputDate < InputText
31
- def init
32
- super
33
- if(@value.respond_to?(:strftime))
34
- @attributes['value'] = @value.strftime(@lookandfeel.lookup(:date_format))
35
- end
36
- end
37
- end
30
+ class InputDate < InputText
31
+ def init
32
+ super
33
+ if @value.respond_to?(:strftime)
34
+ @attributes["value"] = @value.strftime(@lookandfeel.lookup(:date_format))
35
+ end
36
+ end
37
+ end
38
38
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -24,17 +24,18 @@
24
24
  #
25
25
  # InputFile -- oddb -- 29.07.2003 -- mhuggler@ywesee.com
26
26
 
27
- require 'htmlgrid/namedcomponent'
27
+ require "htmlgrid/namedcomponent"
28
28
 
29
29
  module HtmlGrid
30
- class InputFile < NamedComponent
31
- LABEL = true
32
- def init
33
- super
34
- @attributes["type"] = 'file'
35
- end
36
- def to_html(context)
37
- context.input(@attributes)
38
- end
39
- end
30
+ class InputFile < NamedComponent
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes["type"] = "file"
35
+ end
36
+
37
+ def to_html(context)
38
+ context.input(@attributes)
39
+ end
40
+ end
40
41
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -24,14 +24,14 @@
24
24
  #
25
25
  # InputRadio -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
26
26
 
27
- require 'htmlgrid/input'
27
+ require "htmlgrid/input"
28
28
 
29
29
  module HtmlGrid
30
- class InputRadio < Input
31
- LABEL = true
32
- def init
33
- super
34
- @attributes['type'] = 'radio'
35
- end
36
- end
30
+ class InputRadio < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes["type"] = "radio"
35
+ end
36
+ end
37
37
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,16 +22,16 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # InputText -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
25
+ # InputText -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/input'
27
+ require "htmlgrid/input"
28
28
 
29
29
  module HtmlGrid
30
- class InputText < Input
31
- LABEL = true
32
- def init
33
- super
34
- @attributes['type'] = 'text'
35
- end
36
- end
30
+ class InputText < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes["type"] = "text"
35
+ end
36
+ end
37
37
  end
@@ -1,22 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  # JavaScript -- htmlgrid -- 25.10.2005 -- hwyss@ywesee.com
4
4
 
5
- require 'htmlgrid/component'
5
+ require "htmlgrid/component"
6
6
 
7
7
  module HtmlGrid
8
- class JavaScript < Component
9
- def init
10
- super
11
- @attributes = {
12
- 'type' => 'text/javascript',
13
- 'language'=> 'JavaScript',
14
- }
15
- end
16
- def to_html(context)
17
- context.script(@attributes) {
18
- @value.to_s
19
- }
20
- end
21
- end
8
+ class JavaScript < Component
9
+ def init
10
+ super
11
+ @attributes = {
12
+ "type" => "text/javascript",
13
+ "language" => "JavaScript"
14
+ }
15
+ end
16
+
17
+ def to_html(context)
18
+ context.script(@attributes) {
19
+ @value.to_s
20
+ }
21
+ end
22
+ end
22
23
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,69 +22,73 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Label -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
25
+ # Label -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'delegate'
28
- require 'htmlgrid/namedcomponent'
27
+ require "delegate"
28
+ require "htmlgrid/namedcomponent"
29
29
 
30
30
  module HtmlGrid
31
- class SimpleLabel < NamedComponent
32
- def init
33
- super
34
- @value = @lookandfeel.lookup(@name)
31
+ class SimpleLabel < NamedComponent
32
+ def init
33
+ super
34
+ @value = @lookandfeel.lookup(@name)
35
35
  state = @session.state
36
- if(state.respond_to?(:mandatory?) && state.mandatory?(@name))
36
+ if state.respond_to?(:mandatory?) && state.mandatory?(@name)
37
37
  @value += "*"
38
- end
39
- end
40
- def to_html(context)
41
- context.label(@attributes) { @value }
42
- end
43
- end
44
- class Label < SimpleDelegator
45
- include Enumerable
46
- def initialize(component, session, label_key=nil)
47
- @component = component
48
- @attributes = {}
49
- @session = session
50
- @lookandfeel = session.lookandfeel
51
- @label_key = label_key
52
- if(@component.respond_to? :name)
53
- @attributes['for'] = @component.name.to_s
54
- @label_key ||= @component.name
55
- end
56
- if(@component.respond_to?(:data_origin) \
57
- && (origin = @component.data_origin))
58
- @attributes.store('title', origin.to_s)
59
- end
60
- if(@session.error(@label_key) \
61
- || (@component.respond_to?(:name) && @session.error(@component.name)))
62
- @attributes["class"] = "error"
63
- end
64
- if(@component.respond_to?(:attributes) \
65
- && (id = @component.attributes['id']))
66
- @attributes.store('id', "label_#{id}")
67
- end
68
- super(component)
69
- end
70
- def each
71
- yield self if(@component.respond_to?(:label?) && @component.label?)
72
- yield @component
73
- end
38
+ end
39
+ end
40
+
41
+ def to_html(context)
42
+ context.label(@attributes) { @value }
43
+ end
44
+ end
45
+
46
+ class Label < SimpleDelegator
47
+ include Enumerable
48
+ def initialize(component, session, label_key = nil)
49
+ @component = component
50
+ @attributes = {}
51
+ @session = session
52
+ @lookandfeel = session.lookandfeel
53
+ @label_key = label_key
54
+ if @component.respond_to? :name
55
+ @attributes["for"] = @component.name.to_s
56
+ @label_key ||= @component.name
57
+ end
58
+ if @component.respond_to?(:data_origin) \
59
+ && (origin = @component.data_origin)
60
+ @attributes.store("title", origin.to_s)
61
+ end
62
+ if @session.error(@label_key) \
63
+ || (@component.respond_to?(:name) && @session.error(@component.name))
64
+ @attributes["class"] = "error"
65
+ end
66
+ if @component.respond_to?(:attributes) \
67
+ && (id = @component.attributes["id"])
68
+ @attributes.store("id", "label_#{id}")
69
+ end
70
+ super(component)
71
+ end
72
+
73
+ def each
74
+ yield self if @component.respond_to?(:label?) && @component.label?
75
+ yield @component
76
+ end
77
+
74
78
  def to_html(context)
75
- key = @label_key
79
+ key = @label_key
76
80
  label = @lookandfeel.lookup(key)
77
81
  if !label && @component.respond_to?(:name)
78
- key = @component.name
82
+ key = @component.name
79
83
  label = @lookandfeel.lookup(key)
80
84
  end
81
85
  state = @session.state
82
86
  if label && state.respond_to?(:mandatory?) && state.mandatory?(key)
83
- label += '*'
87
+ label += "*"
84
88
  end
85
89
  if label
86
90
  context.label(@attributes) { label }
87
91
  end
88
92
  end
89
- end
93
+ end
90
94
  end