01: /* GaugeFactory.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 15, 2007 3:21: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.factory;
20:
21: import javax.microedition.lcdui.Alert;
22: import javax.microedition.lcdui.Form;
23: import javax.microedition.lcdui.Gauge;
24: import org.xml.sax.Attributes;
25: import org.zkoss.zkmob.ZkComponent;
26: import org.zkoss.zkmob.UiManager;
27: import org.zkoss.zkmob.ui.ZkDesktop;
28: import org.zkoss.zkmob.ui.ZkGauge;
29:
30: /**
31: * An UiFactory that create a Gauge Ui component.
32: * @author henrichen
33: *
34: */
35: public class GaugeFactory extends AbstractUiFactory {
36: public GaugeFactory(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 maxValueStr = attrs.getValue("mv"); //maxValue
45: final String initialValueStr = attrs.getValue("iv"); //initialValue
46: final String interactiveStr = attrs.getValue("it"); //interactive
47: final boolean interactive = "t"
48: .equalsIgnoreCase(interactiveStr);
49: final int maxValue = Integer.parseInt(maxValueStr);
50: final int initialValue = Integer.parseInt(initialValueStr);
51: final ZkDesktop zk = ((ZkComponent) parent).getZkDesktop();
52:
53: final ZkGauge component = new ZkGauge(zk, id, label,
54: interactive, maxValue, initialValue);
55:
56: UiManager.applyItemProperties(parent, component, attrs);
57:
58: return component;
59: }
60:
61: }
|