author | John Kern <johnk@symbian.org> |
Mon, 29 Mar 2010 13:59:08 -0700 | |
changeset 287 | acfa94f7e231 |
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 TextArea class implements a multi line text entry control. |
|
20 |
||
21 |
// Constructor. |
|
22 |
function TextArea(id, caption, value, rows) { |
|
23 |
if (id != UI_NO_INIT_ID) { |
|
24 |
this.init(id, caption, value, rows); |
|
25 |
} |
|
26 |
} |
|
27 |
||
28 |
// TextArea inherits from TextEntryControl. |
|
29 |
TextArea.prototype = new TextEntryControl(UI_NO_INIT_ID); |
|
30 |
||
31 |
// Initializer - called from constructor. |
|
32 |
TextArea.prototype.init = function(id, caption, value, rows) { |
|
33 |
uiLogger.debug("TextArea.init(" + id + ", " + caption + ", " + value + ", " + rows + ")"); |
|
34 |
||
35 |
// call superclass initializer |
|
36 |
TextEntryControl.prototype.init.call(this, id, caption); |
|
37 |
||
38 |
// create the peer element |
|
39 |
this.peerElement = document.createElement("textarea"); |
|
40 |
// default rowcount is 3 if not defined |
|
41 |
// width always comes from style but is a required attribute |
|
42 |
this.peerElement.rows = (rows != null) ? rows : 3; |
|
43 |
this.peerElement.cols = 20; |
|
44 |
this.controlElement.appendChild(this.peerElement); |
|
45 |
||
46 |
// set the value |
|
47 |
this.peerElement.value = (value == null) ? "" : value; |
|
48 |
||
49 |
// bind event listeners |
|
50 |
this.bindTextEntryControlListeners(); |
|
51 |
||
52 |
// update the style |
|
53 |
this.updateStyleFromState(); |
|
102
30e0796f3ebb
Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
73
diff
changeset
|
54 |
}; |
73 | 55 |
|
56 |
// Updates the style of the control to reflects the state of the control. |
|
57 |
TextArea.prototype.updateStyleFromState = function() { |
|
58 |
uiLogger.debug("TextArea.updateStyleFromState()"); |
|
59 |
||
60 |
// determine the state name |
|
61 |
var stateName = this.getStyleStateName(); |
|
62 |
||
63 |
// set element class names |
|
64 |
this.setClassName(this.rootElement, "Control"); |
|
65 |
this.setClassName(this.controlElement, "ControlElement"); |
|
66 |
this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName); |
|
67 |
this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName); |
|
68 |
||
69 |
// set peer element class names |
|
70 |
var peerStateName = this.isEnabled() ? stateName : "Disabled"; |
|
71 |
this.setClassName(this.peerElement, "TextArea TextArea" + stateName); |
|
102
30e0796f3ebb
Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
73
diff
changeset
|
72 |
}; |