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