01: /* ChoiceGroupFactory.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 15, 2007 3:29: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:
23: import org.xml.sax.Attributes;
24: import org.zkoss.zkmob.ZkComponent;
25: import org.zkoss.zkmob.UiManager;
26: import org.zkoss.zkmob.ui.ZkDesktop;
27: import org.zkoss.zkmob.ui.ZkChoiceGroup;
28:
29: /**
30: * An UiFactory that create a ChoiceGroupFactory Ui component.
31: * @author henrichen
32: *
33: */
34: public class ChoiceGroupFactory extends AbstractUiFactory {
35:
36: public ChoiceGroupFactory(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 choiceTypeStr = attrs.getValue("tp"); //choiceType
45: final String onSelectStr = attrs.getValue("os"); //onSelect
46: final int choiceType = Integer.parseInt(choiceTypeStr);
47: final ZkDesktop zk = ((ZkComponent) parent).getZkDesktop();
48: final ZkChoiceGroup component = new ZkChoiceGroup(zk, id,
49: label, choiceType, onSelectStr == null ? null
50: : new Boolean("t".equals(onSelectStr)));
51:
52: UiManager.applyItemProperties(parent, component, attrs);
53:
54: return component;
55: }
56: }
|