|
1 /* |
|
2 © Copyright 2008 Nokia Corporation. All rights reserved. |
|
3 |
|
4 IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia |
|
5 Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation |
|
6 and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If |
|
7 you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example |
|
8 Widget files. |
|
9 |
|
10 In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia |
|
11 grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example |
|
12 Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML, |
|
13 CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60 |
|
14 Widgets. |
|
15 |
|
16 If you redistribute the WRTKit and Example files, you must retain this entire notice in all such |
|
17 redistributions of the WRTKit and Example files. |
|
18 |
|
19 You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products |
|
20 that include the WRTKit and Example files without the prior written explicit agreement with Nokia. |
|
21 Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by |
|
22 Nokia herein, including but not limited to any patent rights that may be infringed by your products that |
|
23 incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files |
|
24 may be incorporated. |
|
25 |
|
26 The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO |
|
27 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED |
|
28 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A |
|
29 PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION |
|
30 ALONE OR IN COMBINATION WITH YOUR PRODUCTS. |
|
31 |
|
32 IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR |
|
33 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
34 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
35 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR |
|
36 DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY |
|
37 OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, |
|
38 EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
39 |
|
40 */ |
|
41 |
|
42 /////////////////////////////////////////////////////////////////////////////// |
|
43 // The Separator class is used to provide a visual separator in a list. |
|
44 |
|
45 // Constructor. |
|
46 function Separator(id) { |
|
47 if (id != UI_NO_INIT_ID) { |
|
48 this.init(id); |
|
49 } |
|
50 } |
|
51 |
|
52 // Separator inherits from Control. |
|
53 Separator.prototype = new Control(UI_NO_INIT_ID); |
|
54 |
|
55 // Reference to the separator element. |
|
56 Separator.prototype.separatorElement = null; |
|
57 |
|
58 // Separator row element. |
|
59 Separator.prototype.tableRowElement = null; |
|
60 |
|
61 // Left cell element. |
|
62 Separator.prototype.tableLeftCellElement = null; |
|
63 |
|
64 // Center cell element. |
|
65 Separator.prototype.tableCenterCellElement = null; |
|
66 |
|
67 // Right cell element. |
|
68 Separator.prototype.tableRightCellElement = null; |
|
69 |
|
70 // Initializer - called from constructor. |
|
71 Separator.prototype.init = function(id) { |
|
72 uiLogger.debug("Separator.init(" + id + ")"); |
|
73 |
|
74 // call superclass initializer |
|
75 Control.prototype.init.call(this, id, null); |
|
76 |
|
77 // remove caption and control elements |
|
78 this.assemblyElement.removeChild(this.captionElement); |
|
79 this.assemblyElement.removeChild(this.controlElement); |
|
80 |
|
81 // create separator |
|
82 this.separatorElement = document.createElement("table"); |
|
83 this.tableRowElement = document.createElement("tr"); |
|
84 this.tableLeftCellElement = document.createElement("td"); |
|
85 this.tableCenterCellElement = document.createElement("td"); |
|
86 this.tableRightCellElement = document.createElement("td"); |
|
87 this.tableRowElement.appendChild(this.tableLeftCellElement); |
|
88 this.tableRowElement.appendChild(this.tableCenterCellElement); |
|
89 this.tableRowElement.appendChild(this.tableRightCellElement); |
|
90 this.separatorElement.appendChild(this.tableRowElement); |
|
91 this.assemblyElement.appendChild(this.separatorElement); |
|
92 |
|
93 // update style |
|
94 this.updateStyleFromState(); |
|
95 } |
|
96 |
|
97 // Returns the enabled state for the control. |
|
98 Separator.prototype.isEnabled = function() { |
|
99 return true; |
|
100 } |
|
101 |
|
102 // Returns the focusable state for the control. |
|
103 Separator.prototype.isFocusable = function() { |
|
104 return false; |
|
105 } |
|
106 |
|
107 // Updates the style of the control to reflects the state of the control. |
|
108 Separator.prototype.updateStyleFromState = function() { |
|
109 uiLogger.debug("Separator.updateStyleFromState()"); |
|
110 |
|
111 // set element class names |
|
112 this.setClassName(this.rootElement, "Control"); |
|
113 this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal"); |
|
114 this.setClassName(this.separatorElement, "Separator"); |
|
115 this.setClassName(this.tableRowElement, "SeparatorRow"); |
|
116 this.setClassName(this.tableLeftCellElement, "SeparatorLeftCell"); |
|
117 this.setClassName(this.tableCenterCellElement, "SeparatorCenterCell"); |
|
118 this.setClassName(this.tableRightCellElement, "SeparatorRightCell"); |
|
119 } |