1 /* |
|
2 * Copyright (c) 2007 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 "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: Theme status flag-definition resolver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.tools.themeinstaller.odtconverter; |
|
20 |
|
21 import java.util.Hashtable; |
|
22 |
|
23 /** |
|
24 * Resolver for theme status flag-definition. |
|
25 * Theme status flag-definitions are taken from Xuikon XnThemeManagement.h |
|
26 */ |
|
27 public class ThemeStatusResolver |
|
28 { |
|
29 // Theme status flag-definitions. Theme status flags are bit-masked. |
|
30 |
|
31 // Theme has no specific status. This is a common case. |
|
32 // 0b0000000000000000 |
|
33 public static final int E_XN_THEME_STATUS_NONE = 0x0000; |
|
34 |
|
35 // EXnThemeStatusLicenceeDefault. |
|
36 // This theme is licencee default. It is located on ROM (Z-drive) |
|
37 // 0b0000000000000010 |
|
38 public static final int E_XN_THEME_STATUS_LICENCEE_DEFAULT = 0x0002; |
|
39 |
|
40 // EXnThemeStatusOperatorDefault. This theme is set as operator default. |
|
41 // 0b0000000000000100 |
|
42 public static final int E_XN_THEME_STATUS_OPERATOR_DEFAULT = 0x0004; |
|
43 |
|
44 // EXnThemeStatusUserDefault. This theme has set as user default. |
|
45 // 0b0000000000001000 |
|
46 public static final int E_XN_THEME_STATUS_USER_DEFAULT = 0x0008; |
|
47 |
|
48 // EXnThemeStatusMakeActive. Activates the theme after installation. |
|
49 // 0b0000000000010000 |
|
50 public static final int E_XN_THEME_STATUS_MAKE_ACTIVE = 0x0010; |
|
51 |
|
52 // EXnThemeStatusLicenceeRestorable. This theme is restored when licensee |
|
53 // default theme is restored. When using this flag, the |
|
54 // ThemeStatusLicenceeDefault-flag is also automatically activated. |
|
55 // It is located on ROM (Z-drive) |
|
56 // 0b00000000001000000 |
|
57 public static final int E_XN_THEME_STATUS_LICENCEE_RESTORABLE = 0x0040; |
|
58 |
|
59 // EXnThemeStatusLocked. |
|
60 // 0b00000000010000000 |
|
61 public static final int E_XN_THEME_STATUS_LOCKED = 0x0080; |
|
62 |
|
63 // Theme status keys |
|
64 public static final String THEME_STATUS_NONE = "ThemeStatusNone"; |
|
65 public static final String THEME_STATUS_LOCKED = "ThemeStatusLocked"; |
|
66 public static final String THEME_STATUS_MAKE_ACTIVE = "ThemeStatusMakeActive"; |
|
67 public static final String THEME_STATUS_LICENCEE_DEFAULT = "ThemeStatusLicenceeDefault"; |
|
68 public static final String THEME_STATUS_LICENCEE_RESTORABLE = "ThemeStatusLicenceeRestorable"; |
|
69 public static final String THEME_STATUS_OPERATOR_DEFAULT = "ThemeStatusOperatorDefault"; |
|
70 public static final String THEME_STATUS_USER_DEFAULT = "ThemeStatusUserDefault"; |
|
71 |
|
72 private static Hashtable iThemeStatusResolver; |
|
73 static |
|
74 { |
|
75 iThemeStatusResolver = new Hashtable(); |
|
76 |
|
77 iThemeStatusResolver.put( THEME_STATUS_NONE, new Integer( |
|
78 E_XN_THEME_STATUS_NONE ) ); |
|
79 iThemeStatusResolver.put( THEME_STATUS_LICENCEE_DEFAULT, new Integer( |
|
80 E_XN_THEME_STATUS_LICENCEE_DEFAULT ) ); |
|
81 iThemeStatusResolver.put( THEME_STATUS_OPERATOR_DEFAULT, new Integer( |
|
82 E_XN_THEME_STATUS_OPERATOR_DEFAULT ) ); |
|
83 iThemeStatusResolver.put( THEME_STATUS_USER_DEFAULT, new Integer( |
|
84 E_XN_THEME_STATUS_USER_DEFAULT ) ); |
|
85 iThemeStatusResolver.put( THEME_STATUS_MAKE_ACTIVE, new Integer( |
|
86 E_XN_THEME_STATUS_MAKE_ACTIVE ) ); |
|
87 iThemeStatusResolver.put( THEME_STATUS_LICENCEE_RESTORABLE, |
|
88 new Integer( E_XN_THEME_STATUS_LICENCEE_RESTORABLE ) ); |
|
89 iThemeStatusResolver.put( THEME_STATUS_LOCKED, new Integer( |
|
90 E_XN_THEME_STATUS_LOCKED ) ); |
|
91 } |
|
92 |
|
93 private ThemeStatusResolver() |
|
94 { |
|
95 } |
|
96 |
|
97 /** |
|
98 * Gets the flag definition of the theme status. |
|
99 * |
|
100 * @param aKey theme status |
|
101 * |
|
102 * @return the The flag definition of the theme status |
|
103 * @throws IllegalArgumentException if the key is not mapped to any |
|
104 * value in iThemeStatusResolver |
|
105 */ |
|
106 public static Integer getValue( String aKey ) throws IllegalArgumentException |
|
107 { |
|
108 if( !iThemeStatusResolver.containsKey( aKey ) ) |
|
109 { |
|
110 throw new IllegalArgumentException( "Invalid theme status" ); |
|
111 } |
|
112 |
|
113 return ( Integer ) iThemeStatusResolver.get( aKey ); |
|
114 } |
|
115 } |
|