|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Device
Represents a client device.
For example, the HTML browsers with Ajax are called AjaxDevice
,
the XML output called org.zkoss.zml.device.XmlDevice,
and the MIL device called org.zkoss.mil.device.MilDevice.
Note: the same device is shared by all desktops of the same device type.
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 |
getContentType()
Returns the default content type (never null). |
java.lang.String |
getDocType()
Returns the default doc type, or null if no doc type at all. |
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 deviceType,
DeviceConfig config)
Initializes the device. |
boolean |
isCacheable()
Returns whether the output can be cached by the client. |
java.lang.Boolean |
isCompatible(java.lang.String userAgent)
Returns whether this device supports the specified client. |
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 unavailmsg)
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). |
Method Detail |
---|
boolean isSupported(int func)
func
- the function.java.lang.String getType()
boolean isCacheable()
java.lang.String getUnavailableMessage()
java.lang.String setUnavailableMessage(java.lang.String unavailmsg)
unavailmsg
- the unavailable message.
java.lang.Boolean isCompatible(java.lang.String userAgent)
userAgent
- represents a client.
For HTTP clients, It is the user-agent header.
Execution.getUserAgent()
,
Devices.getDeviceByClient(java.lang.String)
java.lang.Class getServerPushClass()
ServerPush
) for this device, or null if the default is used.
java.lang.Class setServerPushClass(java.lang.Class cls)
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.
java.lang.String getContentType()
java.lang.String getDocType()
void addEmbedded(java.lang.String content)
As the method name suggests, the embedded contents are accumulated and all generated to the output.
java.lang.String getEmbedded()
void init(java.lang.String deviceType, DeviceConfig config)
deviceType
- the device type (never null)config
- the configuration to initialize the device (never null)void sessionWillPassivate(Desktop desktop)
void sessionDidActivate(Desktop desktop)
java.lang.Object[] matches(java.lang.String userAgent)
userAgent
- represents a client (i.e., HTTP's user-agent).
void reloadMessages(java.util.Locale locale) throws java.io.IOException
Notice that this method only reloads the standard messages. The application has to update the component's content (such as labels) manually if necessary.
Limitation: it reloads only the messages of ZK Client Engine and ZUL components. It does not reload messages loaded by your own JavaScript codes.
locale
- the locale. If null, Locales.getCurrent()
is assumed.
java.io.IOException
java.lang.String packageToPath(java.lang.String pkg)
java.lang.String toAbsolutePath(java.lang.String path)
path
- the path (never null).
It is assumed to be a relative path if not starting with '/' or '~'.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |