01: /* ZkSpacer.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 29, 2007 3:29:03 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.Form;
22: import javax.microedition.lcdui.Spacer;
23:
24: import org.zkoss.zkmob.Itemable;
25: import org.zkoss.zkmob.ZkComponent;
26:
27: /**
28: * ZK Spacer.
29: * @author henrichen
30: *
31: */
32: public class ZkSpacer extends Spacer implements ZkComponent, Itemable {
33: private String _id;
34: private ZkDesktop _zk;
35: private ZkForm _form;
36:
37: public ZkSpacer(ZkDesktop zk, String id, int w, int h) {
38: super (w, h);
39: _id = id;
40: _zk = zk;
41: }
42:
43: //--ZkComponent--//
44: public String getId() {
45: return _id;
46: }
47:
48: public ZkComponent getParent() {
49: return (ZkComponent) getForm();
50: }
51:
52: public void setParent(ZkComponent parent) {
53: if (_form != parent) { //yes, !=, not !equals
54: if (_form != null) {
55: _form.removeItem(this );
56: }
57: _form = (ZkForm) parent;
58: ZkDesktop newzk = null;
59: if (_form != null) {
60: _form.appendChild(this );
61: newzk = _form.getZkDesktop();
62: }
63: if (_zk != newzk) {
64: _zk = newzk;
65: }
66: }
67: }
68:
69: public ZkDesktop getZkDesktop() {
70: return _zk;
71: }
72:
73: public void setAttr(String attr, String val) {
74: //TODO:
75: }
76:
77: //--Itemable--//
78: public Form getForm() {
79: return _form;
80: }
81: }
|