|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 include("../../embeddedControlImplLibrary.js") |
|
20 include("../editors/editorLibrary.js") |
|
21 |
|
22 function CAknEnumeratedTextPopup() { |
|
23 } |
|
24 |
|
25 ////////////// |
|
26 |
|
27 // note that laf will be null if a display model was not created |
|
28 CAknEnumeratedTextPopup.prototype.validate = function(instance, laf) { |
|
29 var properties = instance.properties; |
|
30 |
|
31 var messages = null; |
|
32 if (properties.items.length == 0) { |
|
33 messages = new java.util.ArrayList(); |
|
34 messages.add(createSimpleModelError(instance, |
|
35 "items", |
|
36 lookupString("ErrorEmptyList"), |
|
37 [instance.name])); |
|
38 } else if (properties.active >= properties.items.length) { |
|
39 messages = new java.util.ArrayList(); |
|
40 messages.add(createSimpleModelError(instance, |
|
41 "active", |
|
42 lookupString("ErrorInvalidValue"), |
|
43 [instance.name, properties.active, properties.items.length])); |
|
44 } |
|
45 |
|
46 return messages; |
|
47 } |
|
48 |
|
49 // note that laf will be null if a display model was not created |
|
50 CAknEnumeratedTextPopup.prototype.queryPropertyChange = function(instance, propertyPath, |
|
51 newVal, laf) { |
|
52 |
|
53 var properties = instance.properties; |
|
54 var message = null; |
|
55 |
|
56 // Don't toss away any list changes at this point; otherwise, |
|
57 // the user will endure a dialog and have it all thrown away. |
|
58 // Better to let them go back and re-edit. |
|
59 |
|
60 if (propertyPath == "active" |
|
61 && properties.active >= properties.items.length) { |
|
62 message = formatString(lookupString("ErrorInvalidValue"), |
|
63 [instance.name, properties.active, properties.items.length]); |
|
64 } |
|
65 |
|
66 return message; |
|
67 } |
|
68 |