01: /* ImageItemFactory.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 15, 2007 3:22:57 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.factory;
20:
21: import javax.microedition.lcdui.Form;
22: import javax.microedition.lcdui.Item;
23:
24: import org.xml.sax.Attributes;
25: import org.zkoss.zkmob.UiManager;
26: import org.zkoss.zkmob.ZkComponent;
27: import org.zkoss.zkmob.ui.ZkDesktop;
28: import org.zkoss.zkmob.ui.ZkImageItem;
29:
30: /**
31: * An UiFactory that create a ImageItem Ui component.
32: * @author henrichen
33: *
34: */
35: public class ImageItemFactory extends AbstractUiFactory {
36:
37: public ImageItemFactory(String name) {
38: super (name);
39: }
40:
41: public ZkComponent create(ZkComponent parent, String tag,
42: Attributes attrs, String hostURL, String pathURL) {
43: final String id = attrs.getValue("id"); //id
44: final String label = attrs.getValue("lb"); //label
45: final String altText = attrs.getValue("tx"); //altText
46: final String apperenceModeStr = attrs.getValue("md"); //apperenceMode
47: final String src = attrs.getValue("im");
48: final int apperenceMode = apperenceModeStr != null ? Integer
49: .parseInt(apperenceModeStr) : Item.PLAIN;
50: final ZkDesktop zk = ((ZkComponent) parent).getZkDesktop();
51:
52: final ZkImageItem component = new ZkImageItem(zk, id, label,
53: src, ZkImageItem.LAYOUT_DEFAULT, altText, apperenceMode);
54: UiManager.applyItemProperties(parent, component, attrs);
55:
56: return component;
57: }
58: }
|