01: /* CommandFactory.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Jun 1, 2007 12:06:30 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.Command;
22:
23: import org.xml.sax.Attributes;
24: import org.zkoss.zkmob.Listable;
25: import org.zkoss.zkmob.UiManager;
26: import org.zkoss.zkmob.ZkComponent;
27: import org.zkoss.zkmob.ui.ZkCommand;
28:
29: /**
30: * An UiFactory that create a Command Ui component.
31: * @author henrichen
32: *
33: */
34: public class CommandFactory extends AbstractUiFactory {
35:
36: public CommandFactory(String name) {
37: super (name);
38: }
39:
40: public ZkComponent create(ZkComponent parent, String tag,
41: Attributes attrs, String hostURL, String pathURL) {
42: final String id = attrs.getValue("id"); //id
43: final String label = attrs.getValue("lb"); //label
44: final String longLabel = attrs.getValue("ll"); //longLabel
45: final String typeStr = attrs.getValue("tp"); //type
46: final int type = Integer.parseInt(typeStr);
47: final String priorityStr = attrs.getValue("pr"); //priority
48: final int priority = Integer.parseInt(priorityStr);
49: final ZkCommand cmd = new ZkCommand(id, label, longLabel, type,
50: priority);
51: cmd.setParent(parent);
52:
53: return cmd;
54: }
55: }
|