Module: Ext
- Defined in:
- lib/selenium-extjs/Ext.rb,
lib/selenium-extjs/Selenium.rb,
lib/selenium-extjs/component/Form.rb,
lib/selenium-extjs/component/Grid.rb,
lib/selenium-extjs/component/Combo.rb,
lib/selenium-extjs/component/Field.rb,
lib/selenium-extjs/component/Panel.rb,
lib/selenium-extjs/component/Button.rb,
lib/selenium-extjs/component/Window.rb,
lib/selenium-extjs/component/FieldSet.rb,
lib/selenium-extjs/component/Component.rb
Defined Under Namespace
Classes: Button, Combo, Component, ComponentMgr, EditorGrid, Field, FieldSet, Form, Grid, Panel, Selenium, TabPanel, Window
Class Method Summary
collapse
Class Method Details
.arguments(args) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/selenium-extjs/Ext.rb', line 49
def self.arguments(args)
if args.is_a? Array
return args.to_json[1..-2] || ""
else
return args.to_json
end
end
|
.build_remote_call(id, method_name, arguments) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/selenium-extjs/Ext.rb', line 57
def self.build_remote_call(id, method_name, arguments)
code = []
code << "(function(_) {"
code << " var r;"
code << " if (typeof _.#{method_name} == 'function') {"
code << " r = _.#{method_name}(#{arguments});"
code << " } else {"
code << " r = _.#{method_name};"
code << " }"
code << " if (typeof r.getId == 'function') {" code << " return 'JSON:' + window.Ext.util.JSON.encode({\"cmpid\":r.getId()});"
code << " } else {"
code << " return r;"
code << " }"
code << "})(window.Ext.getCmp('#{id}'));"
(code.collect {|t| t.strip }).join
end
|
.condition_default(key, value) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/selenium-extjs/Ext.rb', line 36
def self.condition_default(key, value)
key = key.to_s if key.is_a? Symbol
ret = "("
if key.end_with? '_has'
key = key.gsub(/_has$/, '')
ret += "(typeof el.initialConfig.#{key} == 'string' && el.initialConfig.#{key}.indexOf('#{value}') != -1)||"
end
ret += "(el.initialConfig.#{key} && el.initialConfig.#{key} == '#{value}')"
ret += ")"
ret
end
|
.condition_parent(cmp) ⇒ Object
28
29
30
|
# File 'lib/selenium-extjs/Ext.rb', line 28
def self.condition_parent(cmp)
"(TODO)"
end
|
.condition_xtype(xtype) ⇒ Object
32
33
34
|
# File 'lib/selenium-extjs/Ext.rb', line 32
def self.condition_xtype(xtype)
"(el.getXType() == '#{xtype}')"
end
|
.create(xtype, id, parent, selenium) ⇒ Object
24
25
26
|
# File 'lib/selenium-extjs/Ext.rb', line 24
def self.create(xtype, id, parent, selenium)
Ext::ComponentMgr.create(xtype, cls)
end
|
.extfy(method_name) ⇒ Object
convert some ruby-style methods to ext-style
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/selenium-extjs/Ext.rb', line 76
def self.extfy(method_name)
if method_name.end_with? '?'
method_name = "is_" + method_name
method_name.chop!
end
tokens = method_name.split("_")
tmp = tokens.shift
tokens.collect! {|t| t.capitalize }
tokens.unshift tmp
return tokens.join
end
|
.reg(xtype, cls) ⇒ Object