01: /* ImageableAlert.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 21, 2007 7:21:31 PM, Created by henrichen
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zkmob.ui;
20:
21: import javax.microedition.lcdui.Alert;
22: import javax.microedition.lcdui.AlertType;
23: import javax.microedition.lcdui.Image;
24:
25: import org.zkoss.zkmob.Imageable;
26: import org.zkoss.zkmob.UiManager;
27: import org.zkoss.zkmob.ZkComponent;
28:
29: /**
30: * Wrapping Alert component with Imageable so its image can be loaded
31: * via {@link org.zkoss.zkmob.ImageRequest}.
32: *
33: * @author henrichen
34: */
35: public class ZkAlert extends Alert implements Imageable, ZkComponent {
36: private String _id;
37: private ZkDesktop _zk;
38: private String _image;
39:
40: public ZkAlert(ZkDesktop zk, String id, String title, String image,
41: String alertText, AlertType alertType) {
42: super (title, alertText, null, alertType);
43: _zk = zk;
44: _id = id;
45: _image = image;
46: UiManager.loadImageOnThread(this , _zk.getHostURL(), _zk
47: .getPathURL(), _image);
48: }
49:
50: //--Imageable--//
51: public void loadImage(Image image) {
52: setImage(image);
53: }
54:
55: public String getImageSrc() {
56: return _image;
57: }
58:
59: //--ZkComponent--//
60: public String getId() {
61: return _id;
62: }
63:
64: public ZkComponent getParent() {
65: return getZkDesktop();
66: }
67:
68: public void setParent(ZkComponent parent) {
69: _zk = (ZkDesktop) parent;
70: }
71:
72: public ZkDesktop getZkDesktop() {
73: return _zk;
74: }
75:
76: public void setAttr(String attr, String val) {
77: //TODO:
78: }
79:
80: }
|