equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 |
17 |
18 package com.nokia.mj.impl.coreui; |
18 package com.nokia.mj.impl.coreui; |
19 |
19 |
20 import java.util.Hashtable; |
20 import java.util.Hashtable; |
21 |
21 |
22 import com.nokia.mj.impl.utils.Logger; |
|
23 import com.nokia.mj.impl.utils.Uid; |
22 import com.nokia.mj.impl.utils.Uid; |
24 |
23 |
25 /** |
24 /** |
26 * A factory type of class for accessing the CoreUi implementation. |
25 * A factory type of class for accessing the CoreUi implementation. |
27 */ |
26 */ |
48 try |
47 try |
49 { |
48 { |
50 Class clazz = Class.forName(className); |
49 Class clazz = Class.forName(className); |
51 sInstance = (CoreUi)clazz.newInstance(); |
50 sInstance = (CoreUi)clazz.newInstance(); |
52 } |
51 } |
53 catch (Throwable t) |
52 catch (Exception e) |
54 { |
53 { |
55 String err = "Not able to instantiate class " + |
54 throw new RuntimeException("Not able to instantiate class " + |
56 className+". Reason is: "; |
55 className+". Reason is: " + e); |
57 Logger.LOG(Logger.EJavaUI, Logger.EInfo, err, t); |
|
58 throw new RuntimeException(err + t); |
|
59 } |
56 } |
60 } |
57 } |
61 } |
58 } |
62 |
59 |
63 /** |
60 /** |
79 } |
76 } |
80 |
77 |
81 /** |
78 /** |
82 * For creating the UI from Java side. This is meant for the pre-warmed |
79 * For creating the UI from Java side. This is meant for the pre-warmed |
83 * VM use case. Calling this method will lead creation of the CoreUI. |
80 * VM use case. Calling this method will lead creation of the CoreUI. |
84 * @param uid The UID of the application. If null NullPointerException |
81 * @param uid The UID of the application. |
85 * will be thrown. |
|
86 * @param backGroundStart Should the UI be put into background. |
82 * @param backGroundStart Should the UI be put into background. |
87 */ |
83 */ |
88 public static void createUi(Uid uid, boolean backGroundStart) |
84 public static void createUi(Uid uid, boolean backGroundStart) |
89 { |
85 { |
90 if (sInstance != null) |
86 if (sInstance != null) |
91 { |
87 { |
92 if (uid == null) |
|
93 { |
|
94 throw new NullPointerException("Null UID when creating UI"); |
|
95 } |
|
96 sInstance.createUiImpl(uid, backGroundStart); |
88 sInstance.createUiImpl(uid, backGroundStart); |
97 } |
89 } |
98 } |
90 } |
99 |
91 |
100 /** |
92 /** |
131 fg = sInstance.isUiInForegroundImpl(); |
123 fg = sInstance.isUiInForegroundImpl(); |
132 } |
124 } |
133 return fg; |
125 return fg; |
134 } |
126 } |
135 |
127 |
136 public static void hideApplication(boolean hide) |
|
137 { |
|
138 if (sInstance != null) |
|
139 { |
|
140 sInstance.hideApplicationImpl(hide); |
|
141 } |
|
142 } |
|
143 |
|
144 protected abstract boolean connectToUiImpl(); |
128 protected abstract boolean connectToUiImpl(); |
145 protected abstract void createUiImpl(Uid uid, boolean backGroundStart); |
129 protected abstract void createUiImpl(Uid uid, boolean backGroundStart); |
146 protected abstract void shutdownRequestImpl(); |
130 protected abstract void shutdownRequestImpl(); |
147 protected abstract void foregroundRequestImpl(); |
131 protected abstract void foregroundRequestImpl(); |
148 protected abstract boolean isUiInForegroundImpl(); |
132 protected abstract boolean isUiInForegroundImpl(); |
149 protected abstract void hideApplicationImpl(boolean hide); |
|
150 } |
133 } |