org.zkoss.zk.device
Class GenericDevice

java.lang.Object
  extended by org.zkoss.zk.device.GenericDevice
All Implemented Interfaces:
Device
Direct Known Subclasses:
AjaxDevice

public abstract class GenericDevice
extends java.lang.Object
implements Device

A skeletal implementation of Device.

Since:
3.0.0
Author:
tomyeh

Constructor Summary
GenericDevice()
           
 
Method Summary
 java.lang.String getDocType()
          Returns null to indicate not to generate <!
 java.lang.Class getServerPushClass()
          Returns the class that implements the server-push feature (ServerPush) for this device, or null if the default is used.
 java.lang.String getTimeoutURI()
          Returns the timeout URI for this device.
 java.lang.String getType()
          Returns the device type.
 java.lang.String getUnavailableMessage()
          Returns the unavailable message that is shown to the client if the client doesn't support this device.
 void init(java.lang.String type, DeviceConfig config)
          Initializes the device.
 boolean isCacheable()
          Return true to indicate it is cacheable.
 void sessionDidActivate(Desktop desktop)
          Notification that the desktop, which owns this device, has just been activated (aka., deserialized) by the Web container.
 void sessionWillPassivate(Desktop desktop)
          Notification that the desktop, which owns this device, is about to be passivated (aka., serialized) by the Web container.
 java.lang.Class setServerPushClass(java.lang.Class cls)
          Sets the class that implements the server-push feature (ServerPush) for this device, or null to use the default.
 java.lang.String setTimeoutURI(java.lang.String timeoutURI)
          Sets the timeout URI.
 java.lang.String setUnavailableMessage(java.lang.String msg)
          Sets the unavailable message that is shown to the client if the client doesn't support this device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.device.Device
getContentType
 

Constructor Detail

GenericDevice

public GenericDevice()
Method Detail

getType

public java.lang.String getType()
Description copied from interface: Device
Returns the device type.

Specified by:
getType in interface Device

isCacheable

public boolean isCacheable()
Return true to indicate it is cacheable.

Specified by:
isCacheable in interface Device

getUnavailableMessage

public java.lang.String getUnavailableMessage()
Description copied from interface: Device
Returns the unavailable message that is shown to the client if the client doesn't support this device.

Specified by:
getUnavailableMessage in interface Device
Returns:
the unavailable message, or null if no such message

setUnavailableMessage

public java.lang.String setUnavailableMessage(java.lang.String msg)
Description copied from interface: Device
Sets the unavailable message that is shown to the client if the client doesn't support this device.

Specified by:
setUnavailableMessage in interface Device
Parameters:
msg - the unavailable message.
Returns:
the previous unavailable message, or null if not such message

getTimeoutURI

public java.lang.String getTimeoutURI()
Description copied from interface: Device
Returns the timeout URI for this device. It is used to show the error message if the desktop being requested is not found. It is usually caused by session timeout.

Default: null (to shown an error message).

Specified by:
getTimeoutURI in interface Device

setTimeoutURI

public java.lang.String setTimeoutURI(java.lang.String timeoutURI)
Description copied from interface: Device
Sets the timeout URI. It is used to show the error message if the desktop being requested is not found. It is usually caused by session timeout.

Specified by:
setTimeoutURI in interface Device
Parameters:
timeoutURI - the timeout URI. If empty, it means to reload the same page. If null, an error message is shown instead of redirecting to another page.
Returns:
the previous timeout URI, or null if not available.

setServerPushClass

public java.lang.Class setServerPushClass(java.lang.Class cls)
Description copied from interface: Device
Sets the class that implements the server-push feature (ServerPush) for this device, or null to use the default.

Default: null.

If the professional edition (with zkex.jar) is loaded, the client-polling-based server push (org.zkoss.zkex.ui.impl.PollingServerPush) is the default. If the enterprise edition (with zkmax.jar) is loaded, the COMET-based server push (org.zkoss.zkmax.ui.impl.CometServerPush) is the default.

Specified by:
setServerPushClass in interface Device
Returns:
the previous class, or null if not available.

getServerPushClass

public java.lang.Class getServerPushClass()
Description copied from interface: Device
Returns the class that implements the server-push feature (ServerPush) for this device, or null if the default is used.

Specified by:
getServerPushClass in interface Device

getDocType

public java.lang.String getDocType()
Returns null to indicate not to generate <!DOCTYPE> at all.

Specified by:
getDocType in interface Device

init

public void init(java.lang.String type,
                 DeviceConfig config)
Description copied from interface: Device
Initializes the device. A device is created for each desktop, and this method is called when it is associated to the desktop.

Specified by:
init in interface Device
Parameters:
type - the device type (never null)
config - the configuration to initialize the device (never null)

sessionWillPassivate

public void sessionWillPassivate(Desktop desktop)
Description copied from interface: Device
Notification that the desktop, which owns this device, is about to be passivated (aka., serialized) by the Web container.

Specified by:
sessionWillPassivate in interface Device

sessionDidActivate

public void sessionDidActivate(Desktop desktop)
Description copied from interface: Device
Notification that the desktop, which owns this device, has just been activated (aka., deserialized) by the Web container.

Specified by:
sessionDidActivate in interface Device


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.