uki 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/VERSION +1 -1
  2. data/frameworks/uki/README.rdoc +6 -15
  3. data/frameworks/uki/examples/core-examples/aristo/aristo.js +59 -0
  4. data/frameworks/uki/examples/core-examples/attachment/attachment.js +18 -0
  5. data/frameworks/uki/examples/core-examples/controls/controls.js +59 -0
  6. data/frameworks/uki/examples/core-examples/dnd/dnd.js +70 -0
  7. data/frameworks/uki/examples/core-examples/flow/flow.js +41 -0
  8. data/frameworks/uki/examples/core-examples/list/list.js +78 -0
  9. data/frameworks/uki/examples/core-examples/popup/popup.js +41 -0
  10. data/frameworks/uki/examples/core-examples/resizeToContents/resizeToContents.js +34 -0
  11. data/frameworks/uki/examples/core-examples/scrollPane/scrollPane.js +28 -0
  12. data/frameworks/uki/examples/core-examples/slider/slider.js +23 -0
  13. data/frameworks/uki/examples/core-examples/splitPane/splitPane.js +35 -0
  14. data/frameworks/uki/examples/core-examples/splitPaneExtended/splitPaneExtended.js +39 -0
  15. data/frameworks/uki/examples/core-examples/stress/stress.js +33 -0
  16. data/frameworks/uki/examples/core-examples/table/library.js +1 -0
  17. data/frameworks/uki/examples/core-examples/table/searchable.js +71 -0
  18. data/frameworks/uki/examples/core-examples/table/table.js +92 -0
  19. data/frameworks/uki/examples/core-examples/toolbar/icon.png +0 -0
  20. data/frameworks/uki/examples/core-examples/toolbar/toolbar.js +44 -0
  21. data/frameworks/uki/examples/core-examples/twitter/bubble.png +0 -0
  22. data/frameworks/uki/examples/core-examples/twitter/i/bubble-c.png +0 -0
  23. data/frameworks/uki/examples/core-examples/twitter/i/bubble-h.png +0 -0
  24. data/frameworks/uki/examples/core-examples/twitter/i/bubble-m.png +0 -0
  25. data/frameworks/uki/examples/core-examples/twitter/i/bubble-v.png +0 -0
  26. data/frameworks/uki/examples/core-examples/twitter/i/loading.gif +0 -0
  27. data/frameworks/uki/examples/core-examples/twitter/tweets.json +1 -0
  28. data/frameworks/uki/examples/core-examples/twitter/twitter.js +175 -0
  29. data/frameworks/uki/examples/core-examples/wave/contacts.json +1 -0
  30. data/frameworks/uki/examples/core-examples/wave/i/body/normal-m.png +0 -0
  31. data/frameworks/uki/examples/core-examples/wave/i/body/normal.png +0 -0
  32. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-m.png +0 -0
  33. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.gif +0 -0
  34. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.png +0 -0
  35. data/frameworks/uki/examples/core-examples/wave/i/button/a-down.png +0 -0
  36. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-m.png +0 -0
  37. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.gif +0 -0
  38. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.png +0 -0
  39. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal.png +0 -0
  40. data/frameworks/uki/examples/core-examples/wave/i/button/down-m.png +0 -0
  41. data/frameworks/uki/examples/core-examples/wave/i/button/down-v.gif +0 -0
  42. data/frameworks/uki/examples/core-examples/wave/i/button/down-v.png +0 -0
  43. data/frameworks/uki/examples/core-examples/wave/i/button/down.png +0 -0
  44. data/frameworks/uki/examples/core-examples/wave/i/button/normal-m.png +0 -0
  45. data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.gif +0 -0
  46. data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.png +0 -0
  47. data/frameworks/uki/examples/core-examples/wave/i/button/normal.png +0 -0
  48. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.gif +0 -0
  49. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.png +0 -0
  50. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down.png +0 -0
  51. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.gif +0 -0
  52. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.png +0 -0
  53. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal.png +0 -0
  54. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.gif +0 -0
  55. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.png +0 -0
  56. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down.png +0 -0
  57. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.gif +0 -0
  58. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.png +0 -0
  59. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal.png +0 -0
  60. data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal-m.png +0 -0
  61. data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal.png +0 -0
  62. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down-m.png +0 -0
  63. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down.png +0 -0
  64. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.gif +0 -0
  65. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.png +0 -0
  66. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal.png +0 -0
  67. data/frameworks/uki/examples/core-examples/wave/i/icons-c/drawer.png +0 -0
  68. data/frameworks/uki/examples/core-examples/wave/i/icons-c/inbox.png +0 -0
  69. data/frameworks/uki/examples/core-examples/wave/i/icons-c/pencil.png +0 -0
  70. data/frameworks/uki/examples/core-examples/wave/i/icons-c/skeleton.png +0 -0
  71. data/frameworks/uki/examples/core-examples/wave/i/icons-c/trash.png +0 -0
  72. data/frameworks/uki/examples/core-examples/wave/i/icons-c/who.png +0 -0
  73. data/frameworks/uki/examples/core-examples/wave/i/icons/blue.png +0 -0
  74. data/frameworks/uki/examples/core-examples/wave/i/icons/dots.png +0 -0
  75. data/frameworks/uki/examples/core-examples/wave/i/icons/download.png +0 -0
  76. data/frameworks/uki/examples/core-examples/wave/i/icons/drawer.png +0 -0
  77. data/frameworks/uki/examples/core-examples/wave/i/icons/eye-closed.png +0 -0
  78. data/frameworks/uki/examples/core-examples/wave/i/icons/eye.png +0 -0
  79. data/frameworks/uki/examples/core-examples/wave/i/icons/folder.png +0 -0
  80. data/frameworks/uki/examples/core-examples/wave/i/icons/nosound.png +0 -0
  81. data/frameworks/uki/examples/core-examples/wave/i/icons/play.png +0 -0
  82. data/frameworks/uki/examples/core-examples/wave/i/icons/reply.png +0 -0
  83. data/frameworks/uki/examples/core-examples/wave/i/icons/skeleton.png +0 -0
  84. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.gif +0 -0
  85. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.png +0 -0
  86. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite.png +0 -0
  87. data/frameworks/uki/examples/core-examples/wave/i/icons/trash.png +0 -0
  88. data/frameworks/uki/examples/core-examples/wave/i/icons/unknown.png +0 -0
  89. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.gif +0 -0
  90. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.png +0 -0
  91. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.gif +0 -0
  92. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.png +0 -0
  93. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-m.png +0 -0
  94. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.gif +0 -0
  95. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.png +0 -0
  96. data/frameworks/uki/examples/core-examples/wave/i/panel/blue.png +0 -0
  97. data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.gif +0 -0
  98. data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.png +0 -0
  99. data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.gif +0 -0
  100. data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.png +0 -0
  101. data/frameworks/uki/examples/core-examples/wave/i/panel/white-m.png +0 -0
  102. data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.gif +0 -0
  103. data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.png +0 -0
  104. data/frameworks/uki/examples/core-examples/wave/i/panel/white.png +0 -0
  105. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.gif +0 -0
  106. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.png +0 -0
  107. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.gif +0 -0
  108. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.png +0 -0
  109. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-m.png +0 -0
  110. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.gif +0 -0
  111. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.png +0 -0
  112. data/frameworks/uki/examples/core-examples/wave/i/popup/normal.png +0 -0
  113. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-m.png +0 -0
  114. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.gif +0 -0
  115. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.png +0 -0
  116. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus.png +0 -0
  117. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-m.png +0 -0
  118. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.gif +0 -0
  119. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.png +0 -0
  120. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal.png +0 -0
  121. data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal-m.png +0 -0
  122. data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal.png +0 -0
  123. data/frameworks/uki/examples/core-examples/wave/voloko.jpg +0 -0
  124. data/frameworks/uki/examples/core-examples/wave/wave-theme.js +269 -0
  125. data/frameworks/uki/examples/core-examples/wave/wave.html +29 -0
  126. data/frameworks/uki/examples/core-examples/wave/wave.js +102 -0
  127. data/frameworks/uki/examples/core-examples/wave/waves.json +1 -0
  128. data/frameworks/uki/examples/css/examples.css +23 -0
  129. data/frameworks/uki/examples/css/index.css +0 -0
  130. data/frameworks/uki/examples/css/reset.css +43 -0
  131. data/frameworks/uki/examples/more-examples/radioButton/radioButton.js +17 -0
  132. data/frameworks/uki/examples/more-examples/splitTable/library.js +1 -0
  133. data/frameworks/uki/examples/more-examples/splitTable/searchable.js +71 -0
  134. data/frameworks/uki/examples/more-examples/splitTable/splitTable.js +98 -0
  135. data/frameworks/uki/examples/more-examples/toggleButton/toggleButton.js +14 -0
  136. data/frameworks/uki/examples/more-examples/treeList/i/arrows.png +0 -0
  137. data/frameworks/uki/examples/more-examples/treeList/treeList.js +35 -0
  138. data/frameworks/uki/examples/views/example.haml +8 -0
  139. data/frameworks/uki/examples/views/exampleList.haml +24 -0
  140. data/frameworks/uki/server.rb +84 -0
  141. data/frameworks/uki/spec/support/spec.helper.js +37 -1
  142. data/frameworks/uki/src/uki-core/background/cssBox.js +1 -1
  143. data/frameworks/uki/src/uki-core/builder.js +15 -10
  144. data/frameworks/uki/src/uki-core/dom/dnd.js +2 -1
  145. data/frameworks/uki/src/uki-core/uki.js +1 -1
  146. data/frameworks/uki/src/uki-core/utils.js +10 -3
  147. data/frameworks/uki/src/uki-core/view/base.js +2 -2
  148. data/frameworks/uki/src/uki-theme/airport.js +14 -0
  149. data/frameworks/uki/src/uki-view/view/button.js +4 -6
  150. data/frameworks/uki/src/uki-view/view/label.js +3 -3
  151. data/frameworks/uki/src/uki-view/view/list.js +26 -16
  152. data/frameworks/uki/src/uki-view/view/slider.js +3 -3
  153. data/frameworks/uki/src/uki-view/view/splitPane.js +1 -1
  154. data/frameworks/uki/src/uki-view/view/table.js +3 -3
  155. data/frameworks/uki/src/uki-view/view/table/column.js +1 -1
  156. data/frameworks/uki/src/uki-view/view/textField.js +18 -7
  157. data/uki.gemspec +139 -6
  158. metadata +140 -7
  159. data/frameworks/uki/compiler.jar +0 -0
  160. data/frameworks/uki/run.rb +0 -2
  161. data/frameworks/uki/thin.yaml +0 -11
  162. data/frameworks/uki/uki.rb +0 -38
  163. data/frameworks/uki/uki.ru +0 -2
@@ -0,0 +1,8 @@
1
+ !!!1.1
2
+ %head
3
+ %title= title
4
+ %body
5
+ = html
6
+ - unless DEVELOPMENT
7
+ = File.read File.join(File.dirname(__FILE__), 'ga.txt')
8
+
@@ -0,0 +1,24 @@
1
+ !!!1.1
2
+ %html
3
+ %head
4
+ %meta{ "http-equiv" => "Content-type", "content" => "text/html; charset=utf-8" }
5
+ %title Uki examples
6
+ %link{ :rel => 'stylesheet', :href => '/examples/css/reset.css', :type => 'text/css', :media => 'screen' }
7
+ %link{ :rel => 'stylesheet', :href => '/examples/css/examples.css', :type => 'text/css', :media => 'screen' }
8
+
9
+ %body.text
10
+ %h1 <a href="/">Uki</a> code examples
11
+ %ul
12
+ - lastExample = nil
13
+ - exampleList.each do |example|
14
+ - if lastExample && example[:order] - lastExample[:order] > 100
15
+ %li
16
+ %br
17
+ - lastExample = example
18
+ %li
19
+ %a{:href => example[:path]}= example[:title]
20
+ %small
21
+ %a{:href => "http://github.com/voloko/ukijs.org/tree/master/examples/#{example[:path]}/"} source
22
+ - unless DEVELOPMENT
23
+ = File.read File.join(File.dirname(__FILE__), 'ga.txt')
24
+
@@ -0,0 +1,84 @@
1
+ SERVER_ROOT = File.expand_path(File.dirname(__FILE__))
2
+ DEVELOPMENT = ENV['RACK_ENV'] != 'production'
3
+
4
+ def get_example_page(path)
5
+ name = File.basename(path)
6
+ html_path = File.join(path, name + '.html')
7
+ if(File.exist?(html_path))
8
+ File.read(html_path)
9
+ else
10
+ nil
11
+ end
12
+ end
13
+
14
+ def list_examples(path)
15
+ result = []
16
+ Dir.new(path).each { |name|
17
+ if File.exist?(File.join(path, name, name + '.js'))
18
+ result << name
19
+ elsif !name.start_with?('.') && File.directory?(File.join(path, name))
20
+ result += list_examples(File.join(path, name)).map do |subname|
21
+ File.join(name, subname)
22
+ end
23
+ end
24
+ }
25
+ result
26
+ end
27
+
28
+ def replace_src_paths(html, version_info)
29
+ version = version_info['version']
30
+ html.gsub(%r{src\s*=\s*["']/src/(.*?)\.cjs['"]}, "src='http://static.ukijs.org/pkg/#{version}/\\1.js'")
31
+ end
32
+
33
+ def extract_example_info path, &block
34
+ name = File.basename(path)
35
+ js_path = File.join(path, name + '.js')
36
+ js_contents = File.read(js_path)
37
+ yield js_contents
38
+ end
39
+
40
+ def extract_example_html(path)
41
+ extract_example_info(path) { |js_contents|
42
+ js_contents.match(%r{@example_html((.|[\n\r])*?)\*/})[1] rescue 'No html'
43
+ }
44
+ end
45
+
46
+ def extract_example_title(path)
47
+ extract_example_info(path) { |js_contents|
48
+ js_contents.match(%r{@example_title(.*?)(\*/|$)})[1] rescue 'Untitled'
49
+ }
50
+ end
51
+
52
+ def extract_example_order(path)
53
+ extract_example_info(path) { |js_contents|
54
+ js_contents.match(%r{@example_order(.*?)(\*/|$)})[1].to_i rescue 9e6
55
+ }
56
+ end
57
+
58
+ def encode64(str)
59
+ Base64.encode64(str).gsub("\n", '')
60
+ end
61
+
62
+ set :views, File.join(SERVER_ROOT, 'examples', 'views')
63
+ set :public, File.join(SERVER_ROOT, 'examples')
64
+
65
+ get '/' do
66
+ path = File.join(SERVER_ROOT, 'examples')
67
+ exampleList = list_examples(path).map do |name|
68
+ {
69
+ :path => name + '/',
70
+ :title => extract_example_title(File.join(path, name)),
71
+ :order => extract_example_order(File.join(path, name))
72
+ }
73
+ end.sort { |e1, e2| e1[:order] <=> e2[:order] }.select { |e| e[:order] > 0 }
74
+ haml :exampleList, :locals => { :exampleList => exampleList }
75
+ end
76
+
77
+ get '/:type/:example/' do
78
+ path = File.join(SERVER_ROOT, 'examples', params[:type], params[:example])
79
+ page = get_example_page(path)
80
+ page || haml(:example, :locals => {
81
+ :html => extract_example_html(path),
82
+ :title => extract_example_title(path)}
83
+ )
84
+ end
@@ -1 +1,37 @@
1
- // write your helper methods here
1
+ var triggerEvent,
2
+ mouseButtonsEvent;
3
+ if (document.createEventObject) {
4
+ triggerEvent = function(el, type, params) {
5
+ var event = uki.extend(
6
+ document.createEventObject(),
7
+ params
8
+ );
9
+
10
+ return el.fireEvent('on' + type, event);
11
+ };
12
+ } else {
13
+ triggerEvent = function(el, type, params) {
14
+ var event = document.createEvent('MouseEvents');
15
+ event.initMouseEvent(
16
+ type,
17
+ true,
18
+ true,
19
+ document.defaultView,
20
+ params.detail || 0,
21
+ params.screenX || 0,
22
+ params.screenY || 0,
23
+ params.clientX || 0,
24
+ params.clientY || 0,
25
+ params.ctrlKey || false,
26
+ params.altKey || false,
27
+ params.shiftKey || false,
28
+ params.metaKey || false,
29
+ params.button || 0,
30
+ null
31
+ );
32
+ uki.extend(event);
33
+
34
+ el.dispatchEvent(event);
35
+ };
36
+ }
37
+
@@ -37,7 +37,7 @@ uki.background.CssBox = uki.newClass(new function() {
37
37
  this._container = uki.createElement(
38
38
  'div',
39
39
  options + ';position:absolute;overflow:hidden;z-index:' + (ext.zIndex || '-1') + ';' +
40
- 'left:' + inset.left + ';top:' + inset.top + 'px;right:' + inset.right + 'px;bottom:' + inset.bottom + 'px',
40
+ 'left:' + inset.left + 'px;top:' + inset.top + 'px;right:' + inset.right + 'px;bottom:' + inset.bottom + 'px',
41
41
  ext.innerHTML
42
42
  );
43
43
  this._attached = false;
@@ -23,7 +23,9 @@ include('collection.js');
23
23
  if (ml.length === undefined) ml = [ml];
24
24
  return new uki.Collection(createMulti(ml));
25
25
  };
26
-
26
+
27
+ uki.viewNamespaces = ['uki.view.', ''];
28
+
27
29
  function createMulti (ml) {
28
30
  return uki.map(ml, function(mlRow) { return createSingle(mlRow); });
29
31
  }
@@ -36,18 +38,21 @@ include('collection.js');
36
38
  var c = mlRow.view || mlRow.type,
37
39
  result;
38
40
  if (uki.isFunction(c)) {
39
- result = c();
41
+ result = new c(mlRow.rect);
40
42
  } else if (typeof c === 'string') {
41
- var parts = c.split('.'),
42
- obj = root;
43
- if (!root[parts[0]] || parts[0] == 'Image') {
44
- parts = ['uki', 'view'].concat(parts); // try with default prefix
45
- }
46
- for (var i=0; i < parts.length; i++) {
47
- obj = obj[parts[i]];
43
+ for (var i=0, ns = uki.viewNamespaces; i < ns.length; i++) {
44
+ var parts = (ns[i] + c).split('.'),
45
+ obj = root;
46
+
47
+ for (var j=0; obj && j < parts.length; j++) {
48
+ obj = obj[parts[j]];
49
+ };
50
+ if (obj) {
51
+ result = new obj(mlRow.rect);
52
+ break;
53
+ }
48
54
  };
49
55
  if (!obj) throw 'No view of type ' + c + ' found';
50
- result = new obj(mlRow.rect);
51
56
  } else {
52
57
  result = c;
53
58
  }
@@ -19,7 +19,8 @@ try {
19
19
  typeof doc.createEvent('MouseEvent').dataTransfer == 'object' || // safari
20
20
  doc.createEvent('DragEvent').initDragEvent // w3c support
21
21
  ) {
22
- dnd.nativeDnD = true;
22
+ // Google Chrome has to many issues with native d&d. It is simpler to disable than to fix
23
+ dnd.nativeDnD = !ua.match(/Chrome\/4/);
23
24
  }
24
25
  } catch (e) {}
25
26
 
@@ -28,7 +28,7 @@ root.uki = root.uki || function(val, context) {
28
28
  * @type string
29
29
  * @field
30
30
  */
31
- uki.version = '0.1.3';
31
+ uki.version = '0.2.2';
32
32
  uki.guid = 1;
33
33
 
34
34
  /**
@@ -299,7 +299,7 @@ var utils = {
299
299
  this.init.apply(this, arguments);
300
300
  };
301
301
 
302
- var inheritance, i, startFrom = 0, tmp, baseClasses = [];
302
+ var inheritance, i, startFrom = 0, tmp, baseClasses = [], base, name, copy;
303
303
 
304
304
  if (arguments.length > 1) {
305
305
  if (arguments[0].prototype) { // real inheritance
@@ -312,10 +312,17 @@ var utils = {
312
312
  }
313
313
  }
314
314
  for (i=startFrom; i < arguments.length; i++) {
315
- tmp = arguments[i];
315
+ base = tmp = arguments[i];
316
316
  if (this.isFunction(tmp)) tmp = tmp.apply(tmp, baseClasses);
317
317
  baseClasses.push(tmp);
318
- uki.extend(klass.prototype, arguments[i]);
318
+
319
+ for ( name in base ) {
320
+ copy = base[ name ];
321
+ if ( !base.hasOwnProperty(name) || copy === undefined ) continue;
322
+ klass.prototype[ name ] = copy;
323
+ }
324
+
325
+ // uki.extend(klass.prototype, base);
319
326
  };
320
327
  if (!klass.prototype.init) klass.prototype.init = function() {};
321
328
  return klass;
@@ -18,8 +18,7 @@ uki.view.declare('uki.view.Base', uki.view.Observable, uki.view.Styleable, funct
18
18
 
19
19
  var layoutId = 1;
20
20
 
21
- this.defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;'
22
- + 'font-family:Arial,Helvetica,sans-serif;';
21
+ this.defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;';
23
22
 
24
23
  /**
25
24
  * Base class for all uki views.
@@ -79,6 +78,7 @@ uki.view.declare('uki.view.Base', uki.view.Observable, uki.view.Styleable, funct
79
78
  _styleV: 'top',
80
79
  _firstLayout: true
81
80
  });
81
+ this.defaultCss += uki.theme.style('base');
82
82
  };
83
83
 
84
84
  /**
@@ -304,6 +304,20 @@
304
304
  return handle;
305
305
 
306
306
  }
307
+ },
308
+ styles: {
309
+ base: function() {
310
+ return 'font-family:Arial,Helvetica,sans-serif;';
311
+ },
312
+ 'label': function() {
313
+ return 'font-size:12px;';
314
+ },
315
+ 'button': function() {
316
+ return 'color:#333;text-align:center;font-weight:bold;';
317
+ },
318
+ 'input': function() {
319
+ return 'font-size:11px;';
320
+ }
307
321
  }
308
322
  });
309
323
 
@@ -8,9 +8,9 @@ uki.view.declare('uki.view.Button', uki.view.Label, uki.view.Focusable, function
8
8
  this._setup = function() {
9
9
  Base._setup.call(this);
10
10
  uki.extend(this, {
11
- _inset: new Inset(0, 4),
12
- defaultCss: Base.defaultCss + "cursor:default;-moz-user-select:none;-webkit-user-select:none;" //text-shadow:0 1px 0px rgba(255,255,255,0.8)
11
+ _inset: new Inset(0, 4)
13
12
  });
13
+ this.defaultCss += "cursor:default;-moz-user-select:none;-webkit-user-select:none;" + uki.theme.style('button');
14
14
  };
15
15
 
16
16
  uki.addProps(this, ['backgroundPrefix']);
@@ -47,11 +47,9 @@ uki.view.declare('uki.view.Button', uki.view.Label, uki.view.Focusable, function
47
47
 
48
48
  this._createDom = function() {
49
49
  // dom
50
- this._dom = uki.createElement('div', this.defaultCss + 'color:#333;text-align:center;');
51
- this._label = uki.createElement('div', Base.defaultCss +
52
- "font-size:12px;line-height:12px;white-space:nowrap;"); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
50
+ this._dom = uki.createElement('div', this.defaultCss);
51
+ this._label = uki.createElement('div', this.defaultCss); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
53
52
  this._dom.appendChild(this._label);
54
- this.style('fontWeight', 'bold');
55
53
 
56
54
  this._dom.appendChild(uki.createElement('div', 'left:0;top:0;width:100%;height:100%;position:absolute;background:url(' + uki.theme.imageSrc('x') + ');'));
57
55
 
@@ -9,10 +9,11 @@ uki.view.declare('uki.view.Label', uki.view.Base, function(Base) {
9
9
  _textSelectable: false,
10
10
  _inset: new Inset()
11
11
  });
12
+ this.defaultCss += uki.theme.style('label');
12
13
  };
13
14
 
14
15
  this._style = function(name, value) {
15
- if (value !== undefined && 'font fontFamily fontWeight fontSize textDecoration color'.indexOf(name) != -1) {
16
+ if (value !== undefined && 'font fontFamily fontWeight fontSize textDecoration textOverflow textAlign overflow color'.indexOf(name) != -1) {
16
17
  this._label.style[name] = value;
17
18
  }
18
19
  return Base._style.call(this, name, value);
@@ -85,8 +86,7 @@ uki.view.declare('uki.view.Label', uki.view.Base, function(Base) {
85
86
 
86
87
  this._createDom = function() {
87
88
  Base._createDom.call(this);
88
- this._label = uki.createElement('div', Base.defaultCss +
89
- "font-size:12px;white-space:nowrap;"); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
89
+ this._label = uki.createElement('div', this.defaultCss + 'white-space:nowrap;'); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
90
90
  this._dom.appendChild(this._label);
91
91
  this.textSelectable(this.textSelectable());
92
92
  };
@@ -58,22 +58,25 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
58
58
  this.addRow = function(position, data) {
59
59
  this._data.splice(position, 0, data);
60
60
  var item = this._itemAt(position);
61
+ var container = doc.createElement('div');
62
+
63
+ container.innerHTML = this._rowTemplate.render({
64
+ height: this._rowHeight,
65
+ text: this._render.render(this._data[position], this._rowRect(position), position)
66
+ });
61
67
  if (item) {
62
- var container = doc.createElement('div');
63
-
64
- container.innerHTML = this._rowTemplate.render({
65
- height: this._rowHeight,
66
- text: this._render.render(this._data[position], this._rowRect(position), position)
67
- });
68
68
  item.parentNode.insertBefore(container.firstChild, item);
69
- if (position < this._packs[0].itemTo) {
70
- this._packs[0].itemTo++;
71
- this._packs[1].itemFrom++;
72
- this._packs[1].itemTo++;
73
- this._packs[1].dom.style.top = this._packs[1].itemFrom*this._rowHeight + 'px';
74
- } else {
75
- this._packs[1].itemTo++;
76
- }
69
+ } else {
70
+ this._dom.childNodes[0].appendChild(container.firstChild);
71
+ }
72
+
73
+ if (position <= this._packs[0].itemTo) {
74
+ this._packs[0].itemTo++;
75
+ this._packs[1].itemFrom++;
76
+ this._packs[1].itemTo++;
77
+ this._packs[1].dom.style.top = this._packs[1].itemFrom*this._rowHeight + 'px';
78
+ } else {
79
+ this._packs[1].itemTo++;
77
80
  }
78
81
 
79
82
  // offset selection
@@ -82,6 +85,10 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
82
85
  this._selectedIndexes[i]++;
83
86
  };
84
87
 
88
+ // needed for scrollbar
89
+ this.minSize(new Size(this.minSize().width, this._rowHeight * this._data.length));
90
+ this._relayoutParent();
91
+
85
92
  return this;
86
93
  };
87
94
 
@@ -106,16 +113,19 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
106
113
 
107
114
  this.selectedIndexes = function(indexes) {
108
115
  if (indexes === undefined) return this._selectedIndexes;
109
- var changed = indexes != this._selectedIndexes;
110
116
  this.clearSelection(true);
111
117
  this._selectedIndexes = indexes;
112
118
  for (var i=0; i < this._selectedIndexes.length; i++) {
113
119
  this._setSelected(this._selectedIndexes[i], true);
114
120
  };
115
- if (changed) this.trigger('selection', {source: this});
121
+ this.trigger('selection', {source: this});
116
122
  return this;
117
123
  };
118
124
 
125
+ this.selectedRow = function() {
126
+ return this._data[this.selectedIndex()];
127
+ };
128
+
119
129
  this.selectedRows = function() {
120
130
  return uki.map(this.selectedIndexes(), function(index) {
121
131
  return this._data[index];
@@ -47,11 +47,11 @@ uki.view.declare('uki.view.Slider', uki.view.Base, uki.view.Focusable, function(
47
47
  };
48
48
 
49
49
  this._createDom = function() {
50
- this._dom = uki.createElement('div', Base.defaultCss + 'height:18px;-moz-user-select:none;-webkit-user-select:none;overflow:visible;');
51
- this._handle = uki.createElement('div', Base.defaultCss + 'overflow:hidden;cursor:default;background:url(' + uki.theme.image('x').src + ')');
50
+ this._dom = uki.createElement('div', this.defaultCss + 'height:18px;-moz-user-select:none;-webkit-user-select:none;overflow:visible;');
51
+ this._handle = uki.createElement('div', this.defaultCss + 'overflow:hidden;cursor:default;background:url(' + uki.theme.image('x').src + ')');
52
52
  this._bg = uki.theme.image('slider-handle');
53
53
  this._focusBg = uki.theme.image('slider-focus');
54
- this._focusBg.style.cssText += this._bg.style.cssText += Base.defaultCss + 'top:0;left:0;z-index:-1;position:absolute;';
54
+ this._focusBg.style.cssText += this._bg.style.cssText += this.defaultCss + 'top:0;left:0;z-index:-1;position:absolute;';
55
55
  this._handle.appendChild(this._bg);
56
56
 
57
57
 
@@ -73,7 +73,7 @@ uki.view.declare('uki.view.HSplitPane', uki.view.Container, function(Base) {
73
73
  };
74
74
 
75
75
  this._createDom = function() {
76
- this._dom = uki.createElement('div', Base.defaultCss);
76
+ this._dom = uki.createElement('div', this.defaultCss);
77
77
  for (var i=0, paneML; i < 2; i++) {
78
78
  paneML = { view: 'Container' };
79
79
  paneML.anchors = i == 1 ? 'left top bottom right' :