|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zk.device.GenericDevice
public abstract class GenericDevice
A skeletal implementation of Device
.
Constructor Summary | |
---|---|
GenericDevice()
|
Method Summary | |
---|---|
void |
addEmbedded(java.lang.String content)
Adds the content that shall be added to the output generated and sent to the client, when rending a desktop. |
java.lang.String |
getDocType()
Returns null to indicate not to generate <! |
java.lang.String |
getEmbedded()
Returns the content that shall be embedded to the output being generated to the client, or null if no embedded content. |
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 |
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. |
java.lang.Boolean |
isCompatible(java.lang.String userAgent)
Returns null to indicate unknown. |
boolean |
isSupported(int func)
Returns whether the specified function is supported. |
java.lang.Object[] |
matches(java.lang.String userAgent)
Returns the name and version of the client if the given user agent matches this client, or null if not matched or it is a standard browser request. |
java.lang.String |
packageToPath(java.lang.String pkg)
Converts a package to an absolute path that can be accessible by the class loader (classpath). |
void |
reloadMessages(java.util.Locale locale)
Reloads the client-side messages in the specified locale. |
void |
sessionDidActivate(Desktop desktop)
Notification that the desktop, which owns this device, has just been activated (a.k.a., deserialized) by the Web container. |
void |
sessionWillPassivate(Desktop desktop)
Notification that the desktop, which owns this device, is about to be passivated (a.k.a., 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 |
setUnavailableMessage(java.lang.String msg)
Sets the unavailable message that is shown to the client if the client doesn't support this device. |
java.lang.String |
toAbsolutePath(java.lang.String path)
Converts a relative path to an absolute path that can be accessible by the class loader (classpath). |
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 |
---|
public GenericDevice()
Method Detail |
---|
public boolean isSupported(int func)
Device
isSupported
in interface Device
func
- the function.public java.lang.String getType()
Device
getType
in interface Device
public boolean isCacheable()
isCacheable
in interface Device
public java.lang.Boolean isCompatible(java.lang.String userAgent)
isCompatible
in interface Device
userAgent
- represents a client.
For HTTP clients, It is the user-agent header.
Execution.getUserAgent()
,
Devices.getDeviceByClient(java.lang.String)
public java.lang.String getUnavailableMessage()
Device
getUnavailableMessage
in interface Device
public java.lang.String setUnavailableMessage(java.lang.String msg)
Device
setUnavailableMessage
in interface Device
msg
- the unavailable message.
public java.lang.Class setServerPushClass(java.lang.Class cls)
Device
ServerPush
) for this device, or null to use the default.
Default: PollingServerPush
.
If ZK EE (with zkmax.jar) is loaded,
the COMET-based server push (CometServerPush
)
is the default.
setServerPushClass
in interface Device
public java.lang.Class getServerPushClass()
Device
ServerPush
) for this device, or null if the default is used.
getServerPushClass
in interface Device
public java.lang.String getDocType()
getDocType
in interface Device
public void addEmbedded(java.lang.String content)
Device
As the method name suggests, the embedded contents are accumulated and all generated to the output.
addEmbedded
in interface Device
public java.lang.String getEmbedded()
Device
getEmbedded
in interface Device
public java.lang.Object[] matches(java.lang.String userAgent)
This implementation always returns null. That is, it assumes the client is a standard browser.
matches
in interface Device
userAgent
- represents a client (i.e., HTTP's user-agent).
public void reloadMessages(java.util.Locale locale) throws java.io.IOException
Default: throw UnsupportedOperationException.
reloadMessages
in interface Device
locale
- the locale. If null, Locales.getCurrent()
is assumed.
java.io.IOException
public java.lang.String packageToPath(java.lang.String pkg)
Default: throw UnsupportedOperationException.
packageToPath
in interface Device
public java.lang.String toAbsolutePath(java.lang.String path)
Default: throw UnsupportedOperationException.
toAbsolutePath
in interface Device
path
- the path (never null).
It is assumed to be a relative path if not starting with '/' or '~'.public void init(java.lang.String type, DeviceConfig config)
Device
init
in interface Device
type
- the device type (never null)config
- the configuration to initialize the device (never null)public void sessionWillPassivate(Desktop desktop)
Device
sessionWillPassivate
in interface Device
public void sessionDidActivate(Desktop desktop)
Device
sessionDidActivate
in interface Device
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |