|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Window
public class Window
A generic window.
Unlike other elements, each Window is an independent ID space
(by implementing IdSpace).
It means a window and all its descendants forms a ID space and
the ID of each of them is unique in this space.
You could retrieve any of them in this space by calling AbstractComponent.getFellow(java.lang.String).
If a window X is a descendant of another window Y, X's descendants are not visible in Y's space. To retrieve a descendant, say Z, of X, you have to invoke Y.getFellow('X').getFellow('Z').
Events:
onMove, onOpen, onClose, onOK, onCacnel and onCtrlKey.
Note: to have better performance, onOpen is sent only if a
non-deferrable event listener is registered
(see Deferrable).
onClose is sent when the close button is pressed
(if isClosable() is true). The window has to detach or hide
the window. By default, onClose() detaches the window. To prevent
it from detached, you have to call Event.stopPropagation()
to prevent onClose() is called.
On the other hand, onOpen is sent when a popup
window (i.e., getMode() is popup) is closed due to user's activity
(such as press ESC). This event is only a notification.
In other words, the popup is hidden before the event is sent to the server.
The application cannot prevent the window from being hidden.
| Nested Class Summary | |
|---|---|
protected class |
Window.ExtraCtrl
A utility class to implement AbstractComponent.getExtraCtrl(). |
| Field Summary |
|---|
| Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
Window()
|
|
Window(java.lang.String title,
java.lang.String border,
boolean closable)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
|
void |
doEmbedded()
Makes this window as embeded with other components (Default). |
void |
doHighlighted()
Makes this window as highlited. |
void |
doModal()
Makes this window as a modal dialog. |
void |
doOverlapped()
Makes this window as overlapped with other components. |
void |
doPopup()
Makes this window as popup, which is overlapped with other component and auto-hiden when user clicks outside of the window. |
java.lang.String |
getBorder()
Returns the border. |
Caption |
getCaption()
Returns the caption of this window. |
java.lang.String |
getContentSclass()
Returns the style class used for the content block. |
java.lang.String |
getContentStyle()
Returns the CSS style for the content block of the window. |
java.lang.String |
getCtrlKeys()
Returns what keystrokes to intercept. |
java.lang.String |
getMode()
Returns the current mode. |
java.lang.String |
getOuterAttrs()
|
java.lang.String |
getPosition()
Returns how to position the window at the client screen. |
protected java.lang.String |
getRealStyle()
|
java.lang.String |
getSclass()
Returns the style class. |
java.lang.String |
getTitle()
Returns the title. |
java.lang.String |
getTitleSclass()
Returns the style class used for the title. |
boolean |
inEmbedded()
Returns whether this is embedded with other components (Default). |
boolean |
inHighlighted()
Returns whether this is a highlighted window. |
boolean |
inModal()
Returns whether this is a modal dialog. |
boolean |
inOverlapped()
Returns whether this is a overlapped window. |
boolean |
inPopup()
Returns whether this is a popup window. |
boolean |
insertBefore(org.zkoss.zk.ui.Component child,
org.zkoss.zk.ui.Component insertBefore)
|
boolean |
isClosable()
Returns whether to show a close button on the title bar. |
boolean |
isSizable()
Returns whether the window is sizable. |
protected java.lang.Object |
newExtraCtrl()
|
void |
onChildRemoved(org.zkoss.zk.ui.Component child)
|
void |
onClose()
Process the onClose event sent when the close button is pressed. |
void |
onModal()
Process the onModal event by making itself a modal window. |
void |
setBorder(java.lang.String border)
Sets the border (either none or normal). |
void |
setClosable(boolean closable)
Sets whether to show a close button on the title bar. |
void |
setContentStyle(java.lang.String style)
Sets the CSS style for the content block of the window. |
void |
setCtrlKeys(java.lang.String ctrlKeys)
Sets what keystrokes to intercept. |
void |
setDraggable(java.lang.String draggable)
|
void |
setMode(int mode)
Sets the mode to overlapped, popup, modal, embedded or highlighted. |
void |
setMode(java.lang.String name)
Sets the mode to overlapped, popup, modal, embedded or highlighted. |
void |
setPage(org.zkoss.zk.ui.Page page)
|
void |
setParent(org.zkoss.zk.ui.Component parent)
|
void |
setPosition(java.lang.String pos)
Sets how to position the window at the client screen. |
void |
setSizable(boolean sizable)
Sets whether the window is sizable. |
void |
setTitle(java.lang.String title)
Sets the title. |
boolean |
setVisible(boolean visible)
Changes the visibility of the window. |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getAllOnClickAttrs, getContext, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setPopup, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
addEventListener, appendAsapAttr, focus, getDraggable, getDroppable, getHeight, getLeft, getRealStyleFlags, getStyle, getTooltiptext, getTop, getWidth, getZIndex, isAsapRequired, removeEventListener, setClass, setDroppable, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZIndex |
| Methods inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
addAnnotation, addAnnotation, addEventHandler, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getEventHandler, getExtraCtrl, getFellow, getFellowIfAny, getId, getListenerIterator, getMold, getMoldURI, getNamespace, getPage, getParent, getPropagatee, getRoot, getSpaceOwner, getUuid, getVariable, invalidate, isChildable, isListenerAvailable, isVisible, onChildAdded, onDrawNewChild, onWrongValue, redraw, removeAttribute, removeAttribute, removeChild, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setVariable, smartUpdate, smartUpdate, smartUpdate, toString, unsetVariable |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zk.ui.IdSpace |
|---|
getFellow, getFellowIfAny |
| Constructor Detail |
|---|
public Window()
public Window(java.lang.String title,
java.lang.String border,
boolean closable)
title - the window title (see setTitle(java.lang.String)).border - the border (see setBorder(java.lang.String)).closable - whether it is closable (see setClosable(boolean)).| Method Detail |
|---|
public Caption getCaption()
public java.lang.String getBorder()
The border actually controls what CSS class to use: If border is null, it implies "none". If border is "normal", the class called "window" is used. If not, the class called "window-border" (e.g., "window-none").
If you also specify the CSS class (HtmlBasedComponent.setClass(java.lang.String)), it
overwrites whatever border you specify here.
Default: "none".
public void setBorder(java.lang.String border)
border - the border. If null or "0", "none" is assumed.
Since 2.4.1, We assume "0" to be "none".public java.lang.String getTitle()
Caption to define
a more sophiscated caption (aka., title).
If a window has a caption whose label (LabelElement.getLabel())
is not empty, then this attribute is ignored.
Default: empty.
public void setTitle(java.lang.String title)
public java.lang.String getCtrlKeys()
Default: null.
public void setCtrlKeys(java.lang.String ctrlKeys)
throws org.zkoss.zk.ui.UiException
The string could be a combination of the following:
For example,
Note: it doesn't support Ctrl+Alt, Shift+Ctrl, Shift+Alt or Shift+Ctrl+Alt.
org.zkoss.zk.ui.UiExceptionpublic java.lang.String getMode()
public void setMode(java.lang.String name)
throws java.lang.InterruptedException
Notice: Events.ON_MODAL is posted if you specify
"modal" to this method and in a thread other than an event
listener (Events.inEventListener()).
In other words, if this method is called with modal and
not in any event listener, the mode won't be changed
immediately (until Events.ON_MODAL is processed later).
name - the mode which could be one of
"embedded", "overlapped", "popup", "modal", "highlighted".
Note: it cannot be "modal". Use doModal() instead.
java.lang.InterruptedException - thrown if "modal" is specified,
and one of the following conditions occurs:
1) the desktop or the Web application is being destroyed, or
2) DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String).
To tell the difference, check the getMessage method of InterruptedException.
public void setMode(int mode)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionsetMode(String)public boolean inModal()
public boolean inEmbedded()
doEmbedded()public boolean inOverlapped()
public boolean inPopup()
public boolean inHighlighted()
public void doModal()
throws java.lang.InterruptedException,
org.zkoss.zk.ui.SuspendNotAllowedException
HtmlBasedComponent.getLeft() and
HtmlBasedComponent.getTop()).
Notice: Events.ON_MODAL is posted if you specify
"modal" to this method and in a thread other than an event
listener (Events.inEventListener()).
In other words, if this method is called with modal and
not in any event listener, the mode won't be changed
immediately (until Events.ON_MODAL is processed later).
org.zkoss.zk.ui.SuspendNotAllowedException - if there are too many suspended
processing thread than the deployer allows.
By default, there is no limit of # of suspended threads.
java.lang.InterruptedException - thrown if the desktop or
the Web application is being destroyed, or
DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String).
To tell the difference, check the getMessage method of InterruptedException.public void doOverlapped()
public void doPopup()
public void doHighlighted()
public void doEmbedded()
public boolean isClosable()
public void setClosable(boolean closable)
Default: false.
You can intercept the default behavior by either overriding
onClose(), or listening the onClose event.
Note: the close button won't be displayed if no title or caption at all.
public boolean isSizable()
public void setSizable(boolean sizable)
Default: false.
public java.lang.String getPosition()
Default: null which depends on getMode():
If overlapped or popup, HtmlBasedComponent.setLeft(java.lang.String) and HtmlBasedComponent.setTop(java.lang.String) are
assumed. If modal or highlighted, it is centered.
public void setPosition(java.lang.String pos)
pos - how to position. It can be null (the default), or
a combination of the following values (by separating with comma).
HtmlBasedComponent.setTop(java.lang.String) and HtmlBasedComponent.setLeft(java.lang.String)
are both ignored.HtmlBasedComponent.setLeft(java.lang.String) is ignored.HtmlBasedComponent.setLeft(java.lang.String) is ignored.HtmlBasedComponent.setTop(java.lang.String) is ignored.HtmlBasedComponent.setTop(java.lang.String) is ignored.For example, "left,center" means to position it at the center of the left edge.
public void onClose()
Default: detach itself.
public void onModal()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic java.lang.String getContentStyle()
public void setContentStyle(java.lang.String style)
Default: null.
public java.lang.String getContentSclass()
If getBorder() is "normal", "wc-sclass" is returned,
where sclass is the value returned by getSclass().
Otherwise, "wc-mode-border",
where border is the value returned by getBorder().
public java.lang.String getTitleSclass()
It returns "wt-sclass" is returned,
where sclass is the value returned by getSclass().
public java.lang.String getSclass()
HtmlBasedComponent.setSclass(java.lang.String) is not called
or called with null or empty), it returns getMode().
In other words, the style class is, by default, the same as
the mode name.
getSclass in class org.zkoss.zk.ui.HtmlBasedComponent
public boolean insertBefore(org.zkoss.zk.ui.Component child,
org.zkoss.zk.ui.Component insertBefore)
insertBefore in interface org.zkoss.zk.ui.ComponentinsertBefore in class org.zkoss.zk.ui.AbstractComponentpublic void onChildRemoved(org.zkoss.zk.ui.Component child)
onChildRemoved in interface org.zkoss.zk.ui.ComponentonChildRemoved in class org.zkoss.zk.ui.AbstractComponentpublic void setPage(org.zkoss.zk.ui.Page page)
setPage in interface org.zkoss.zk.ui.ComponentsetPage in class org.zkoss.zk.ui.AbstractComponentpublic void setParent(org.zkoss.zk.ui.Component parent)
setParent in interface org.zkoss.zk.ui.ComponentsetParent in class org.zkoss.zk.ui.AbstractComponentpublic boolean setVisible(boolean visible)
Note: If a modal dialog becomes invisible, the modal state
will be ended automatically. In other words, the mode (getMode())
will become OVERLAPPED and the suspending thread is resumed.
setVisible in interface org.zkoss.zk.ui.ComponentsetVisible in class org.zkoss.zk.ui.AbstractComponentpublic void setDraggable(java.lang.String draggable)
setDraggable in class org.zkoss.zk.ui.HtmlBasedComponentprotected java.lang.String getRealStyle()
getRealStyle in class org.zkoss.zk.ui.HtmlBasedComponentpublic java.lang.String getOuterAttrs()
getOuterAttrs in class XulElementpublic java.lang.Object clone()
clone in interface org.zkoss.zk.ui.Componentclone in class org.zkoss.zk.ui.AbstractComponentprotected java.lang.Object newExtraCtrl()
newExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||