|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Window
A 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 Component.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, onMaximize, onMinimize, and onClose.
Note: to have better performance, onOpen is sent only if a non-deferrable
event listener is registered (see Deferrable
).
onMaximize
and onMinimize
are supported. (since
3.5.0)
onClose
is sent when the close button is pressed (if
isClosable()
is true). The window has to detach or hide the window. By
default, Window.onClose()
detaches the window. To prevent
it from detached, you have to call
Event.stopPropagation()
to prevent
Window.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.
Default HtmlBasedComponent.getZclass()
: z-window-getMode()
.(since 3.5.0)
Field Summary |
---|
Fields inherited from interface org.zkoss.zk.ui.Component |
---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
Method Summary | |
---|---|
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 |
getCaptionApi()
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. |
int |
getMinheight()
Returns the minimum height. |
int |
getMinwidth()
Returns the minimum width. |
java.lang.String |
getMode()
Returns the current mode. |
java.lang.String |
getPosition()
Returns how to position the window at the client screen. |
java.lang.String |
getTitle()
Returns 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 |
isClosable()
Returns whether to show a close button on the title bar. |
boolean |
isMaximizable()
Returns whether to display the maximizing button and allow the user to maximize the window. |
boolean |
isMaximized()
Returns whether the window is maximized. |
boolean |
isMinimizable()
Returns whether to display the minimizing button and allow the user to minimize the window. |
boolean |
isMinimized()
Returns whether the window is minimized. |
boolean |
isSizable()
Returns whether the window is sizable. |
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 |
setContentSclass(java.lang.String scls)
Sets the style class used for the content block. |
void |
setContentStyle(java.lang.String style)
Sets the CSS style for the content block of the window. |
void |
setMaximizable(boolean maximizable)
Sets whether to display the maximizing button and allow the user to maximize the window, when a window is maximized, the button will automatically change to a restore button with the appropriate behavior already built-in that will restore the window to its previous size. |
void |
setMaximized(boolean maximized)
Sets whether the window is maximized, and then the size of the window will depend on it to show a appropriate size. |
void |
setMinheight(int minheight)
Sets the minimum height in pixels allowed for this window. |
void |
setMinimizable(boolean minimizable)
Sets whether to display the minimizing button and allow the user to minimize the window. |
void |
setMinimized(boolean minimized)
Sets whether the window is minimized. |
void |
setMinwidth(int minwidth)
Sets the minimum width in pixels allowed for this window. |
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 |
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. |
Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
Methods inherited from interface org.zkoss.zk.ui.ext.Scope |
---|
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute |
Methods inherited from interface org.zkoss.zul.ext.Framable |
---|
isCollapsible |
Methods inherited from interface org.zkoss.zk.ui.IdSpace |
---|
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellow |
Method Detail |
---|
boolean isMaximized()
isMaximized
in interface Framable
void setMaximized(boolean maximized)
inEmbedded()
) or its parent
node. Otherwise, its size will be original size. Note that the maximized
effect will run at client's sizing phase not initial phase.
Default: false.
UiException
- if isMaximizable()
is false.boolean isMaximizable()
Default: false.
isMaximizable
in interface Framable
void setMaximizable(boolean maximizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
boolean isMinimized()
Default: false.
void setMinimized(boolean minimized)
Default: false.
UiException
- if isMinimizable()
is false.boolean isMinimizable()
Default: false.
isMinimizable
in interface Framable
void setMinimizable(boolean minimizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
MinimizeEvent
void setMinheight(int minheight)
Default: 100.
Note: Only applies when isSizable()
= true.
int getMinheight()
Default: 100.
void setMinwidth(int minwidth)
Default: 200.
Note: Only applies when isSizable()
= true.
int getMinwidth()
Default: 200.
Caption getCaptionApi()
java.lang.String getBorder()
getContentSclass()
for more details.
Default: "none".
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".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.
getTitle
in interface Framable
void setTitle(java.lang.String title)
java.lang.String getMode()
void setMode(java.lang.String name) throws java.lang.InterruptedException
Notice: Events.ON_MODAL
is posted if you specify "modal" to this
method. Unlike doModal()
, Events.ON_MODAL
is posted, so
the window will become modal later (since 3.0.4). In other words,
setMode("modal") never suspends the execution of the current thread. On
the other hand, doModal()
will suspends the execution if executed
in an event listener, or throws an exception if not executed in
an event listener.
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.void setMode(int mode) throws java.lang.InterruptedException
java.lang.InterruptedException
setMode(String)
boolean inModal()
boolean inEmbedded()
doEmbedded()
boolean inOverlapped()
boolean inPopup()
boolean inHighlighted()
void doModal() throws java.lang.InterruptedException, SuspendNotAllowedException
HtmlBasedComponent.getLeft()
and HtmlBasedComponent.getTop()
).
Notice: though both setMode("modal") and doModal() both causes the window
to become modal, they are a bit different. doModal causes the event
listener to suspend immediately, while setMode("modal") posts an event (
Events.ON_MODAL
). That is, setMode(java.lang.String)
won't suspend the
execution immediately, but doModal()
will. doModal()
can be
called only in an event listener, while setMode(java.lang.String)
can be called
anytime.
SuspendNotAllowedException
- if 1) not in an event listener;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.void doOverlapped()
void doPopup()
void doHighlighted()
void doEmbedded()
boolean isClosable()
isClosable
in interface Framable
void setClosable(boolean closable)
Default: false.
You can intercept the default behavior by either overriding
Window.onClose()
, or listening the onClose event.
Note: the close button won't be displayed if no title or caption at all.
boolean isSizable()
void setSizable(boolean sizable)
Default: false.
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.
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.HtmlBasedComponent.getTop()
and HtmlBasedComponent.getLeft()
) is an
offset to his parent's let-top corner. (since 3.0.2)For example, "left,center" means to position it at the center of the left edge.
java.lang.String getContentStyle()
void setContentStyle(java.lang.String style)
Default: null.
java.lang.String getContentSclass()
setContentSclass(java.lang.String)
void setContentSclass(java.lang.String scls)
getContentSclass()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |