javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/javax/microedition/lcdui/CanvasGraphicsItemPainter.java
equal
deleted
inserted
replaced
18 |
18 |
19 package javax.microedition.lcdui; |
19 package javax.microedition.lcdui; |
20 |
20 |
21 import com.nokia.mj.impl.rt.legacy.NativeError; |
21 import com.nokia.mj.impl.rt.legacy.NativeError; |
22 import com.nokia.mid.ui.CanvasGraphicsItem; |
22 import com.nokia.mid.ui.CanvasGraphicsItem; |
23 |
23 import com.nokia.mj.impl.rt.support.Finalizer; |
24 |
24 |
25 class CanvasGraphicsItemPainter |
25 class CanvasGraphicsItemPainter |
26 extends com.nokia.mid.ui.CanvasGraphicsItemPainter |
26 extends com.nokia.mid.ui.CanvasGraphicsItemPainter |
27 { |
27 { |
28 // Toolkit |
28 // Toolkit |
31 // Native handle |
31 // Native handle |
32 private int iHandle; |
32 private int iHandle; |
33 |
33 |
34 // Graphics |
34 // Graphics |
35 private Graphics iGraphics; |
35 private Graphics iGraphics; |
|
36 |
|
37 //Object finalizer |
|
38 private Finalizer mFinalizer; |
36 |
39 |
37 // |
40 // |
38 // Repainting |
41 // Repainting |
39 // |
42 // |
40 private boolean iRepaintPending; //waiting for paint to be called |
43 private boolean iRepaintPending; //waiting for paint to be called |
62 |
65 |
63 iCallbackLock = iToolkit.getCallbackLock(); |
66 iCallbackLock = iToolkit.getCallbackLock(); |
64 } |
67 } |
65 |
68 |
66 iGraphics = null; |
69 iGraphics = null; |
|
70 |
|
71 mFinalizer = new Finalizer() |
|
72 { |
|
73 public void finalizeImpl() |
|
74 { |
|
75 registeredFinalize(); |
|
76 } |
|
77 }; |
67 } |
78 } |
68 |
79 |
69 /** |
80 /** |
70 * Hidden default constructor. |
81 * Hidden default constructor. |
71 */ |
82 */ |
243 { |
254 { |
244 graphics.dispose(); |
255 graphics.dispose(); |
245 } |
256 } |
246 } |
257 } |
247 |
258 |
|
259 /* |
|
260 * Disposes the Landmark native peer object, if the handles are valid. |
|
261 * Invalid (negative) handles indicate that their creation failed in the |
|
262 * first place. |
|
263 */ |
|
264 final void registeredFinalize() |
|
265 { |
|
266 synchronized (iToolkit) |
|
267 { |
|
268 if (iHandle > 0) |
|
269 { |
|
270 _dispose(iToolkit.getHandle(), iHandle); |
|
271 iHandle = 0; |
|
272 } |
|
273 } |
|
274 } |
|
275 |
248 // Native methods |
276 // Native methods |
|
277 |
|
278 /* |
|
279 * Disposes the native side peer object. |
|
280 * |
|
281 * @param aToolkitHandle A handle to the LCDUI toolkit. |
|
282 * |
|
283 * @param aNativePeerHandle A handle to the native side peer object. |
|
284 */ |
|
285 private native void _dispose(int aToolkitHandle, int aNativePeerHandle); |
249 |
286 |
250 private native int _createNativePeer( |
287 private native int _createNativePeer( |
251 int aToolkit, |
288 int aToolkit, |
252 int aWidth, |
289 int aWidth, |
253 int aHeight); |
290 int aHeight); |