01: /* ListItemFactory.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 22, 2007 9:11:34 AM, 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.factory;
20:
21: import org.xml.sax.Attributes;
22: import org.zkoss.zkmob.Listable;
23: import org.zkoss.zkmob.UiManager;
24: import org.zkoss.zkmob.ZkComponent;
25: import org.zkoss.zkmob.ui.ZkDesktop;
26: import org.zkoss.zkmob.ui.ZkListItem;
27:
28: /**
29: * An UiFactory that create a ListItem Ui component.
30: * @author henrichen
31: *
32: */
33: public class ListItemFactory extends AbstractUiFactory {
34:
35: public ListItemFactory(String name) {
36: super (name);
37: }
38:
39: public ZkComponent create(ZkComponent parent, String tag,
40: Attributes attrs, String hostURL, String pathURL) {
41: final String id = attrs.getValue("id"); //id
42: final String label = attrs.getValue("lb"); //label
43: final String src = attrs.getValue("im");
44: //TODO: font not supported yet
45:
46: ZkListItem component = null;
47: if (parent instanceof ZkDesktop) { //createComponent directly
48: component = new ZkListItem(id, label, src);
49: } else {
50: component = new ZkListItem(id, label, src);
51: component.setParent(parent);
52: }
53:
54: return component;
55: }
56: }
|