01: /* MilDevice.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Mon May 14 19:26:50 2007, Created by henrihen
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.mil.device;
20:
21: import org.zkoss.mil.au.out.AuGoHome;
22:
23: import org.zkoss.zk.ui.Executions;
24: import org.zkoss.zk.au.AuResponse;
25: import org.zkoss.zk.device.GenericDevice;
26:
27: /**
28: * Represents the device supporting MIL (Mobile Interactive Language).
29: *
30: * @author henrichen
31: */
32: public class MilDevice extends GenericDevice {
33: /**
34: * Go to ZK Mobile home page. ZK Mobile home page is the main control page where end user
35: * can input a new URL and visit a new web application.
36: *
37: * @param url the default URL input in URL location. null means keep as is.
38: */
39: public static void goHome(String url) {
40: if (url != null && !url.startsWith("http://")
41: && !url.startsWith("https://") && !url.startsWith("~.")) {
42: url = Executions.getCurrent().getContextPath() + url;
43: }
44: addAuResponse(new AuGoHome(url));
45: }
46:
47: private static final void addAuResponse(AuResponse response) {
48: Executions.getCurrent().addAuResponse(response.getCommand(),
49: response);
50: }
51:
52: //Device//
53: public String getContentType() {
54: return "text/xml;charset=UTF-8";
55: }
56: }
|