author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 15 Apr 2010 16:00:54 -0700 | |
changeset 308 | c521df56b15d |
parent 273 | b1f63c2c240c |
permissions | -rw-r--r-- |
210
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
1 |
/** |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
2 |
* Copyright (c) 2009-2010 Symbian Foundation and/or its subsidiary(-ies). |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
3 |
* All rights reserved. |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
8 |
* |
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
9 |
* Initial Contributors: |
273
b1f63c2c240c
Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
211
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
b1f63c2c240c
Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
211
diff
changeset
|
11 |
* |
210
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
12 |
* Contributors: |
273
b1f63c2c240c
Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
211
diff
changeset
|
13 |
* |
b1f63c2c240c
Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
211
diff
changeset
|
14 |
* Description: |
b1f63c2c240c
Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
211
diff
changeset
|
15 |
* |
210
0f7abfd6ae62
Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents:
102
diff
changeset
|
16 |
*/ |
73 | 17 |
|
18 |
/////////////////////////////////////////////////////////////////////////////// |
|
19 |
// The TextField class implements a single line text entry control. |
|
20 |
||
21 |
// Constructor. |
|
22 |
function TextField(id, caption, value, masked) { |
|
23 |
if (id != UI_NO_INIT_ID) { |
|
24 |
this.init(id, caption, value, masked); |
|
25 |
} |
|
26 |
} |
|
27 |
||
28 |
// TextField inherits from TextEntryControl. |
|
29 |
TextField.prototype = new TextEntryControl(UI_NO_INIT_ID); |
|
30 |
||
31 |
// Initializer - called from constructor. |
|
32 |
TextField.prototype.init = function(id, caption, value, masked) { |
|
33 |
uiLogger.debug("TextField.init(" + id + ", " + caption + ", " + value + ", " + masked + ")"); |
|
34 |
||
35 |
// call superclass initializer |
|
36 |
TextEntryControl.prototype.init.call(this, id, caption); |
|
37 |
||
38 |
// create the peer element |
|
39 |
this.peerElement = document.createElement("input"); |
|
40 |
this.peerElement.type = masked ? "password" : "text"; |
|
41 |
this.controlElement.appendChild(this.peerElement); |
|
42 |
||
43 |
// set the value |
|
44 |
this.peerElement.value = (value == null) ? "" : value; |
|
45 |
||
46 |
// bind event listeners |
|
47 |
this.bindTextEntryControlListeners(); |
|
48 |
||
49 |
// update the style |
|
50 |
this.updateStyleFromState(); |
|
102
30e0796f3ebb
Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
73
diff
changeset
|
51 |
}; |
73 | 52 |
|
53 |
// Updates the style of the control to reflects the state of the control. |
|
54 |
TextField.prototype.updateStyleFromState = function() { |
|
55 |
uiLogger.debug("TextField.updateStyleFromState()"); |
|
56 |
||
57 |
// determine the state name |
|
58 |
var stateName = this.getStyleStateName(); |
|
59 |
||
60 |
// set element class names |
|
61 |
this.setClassName(this.rootElement, "Control"); |
|
62 |
this.setClassName(this.controlElement, "ControlElement"); |
|
63 |
this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName); |
|
64 |
this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName); |
|
65 |
||
66 |
// set peer element class names |
|
67 |
var peerStateName = this.isEnabled() ? stateName : "Disabled"; |
|
68 |
this.setClassName(this.peerElement, "TextField TextField" + peerStateName); |
|
102
30e0796f3ebb
Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
73
diff
changeset
|
69 |
}; |