| org.zkoss.zul.impl.XulElement org.zkoss.zul.Window
All known Subclasses: org.zkoss.zul.impl.MessageboxDlg, org.zkoss.zul.impl.FileuploadDlg,
Window | public class Window extends XulElement implements IdSpace(Code) | | 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
Window.getFellow .
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
org.zkoss.zk.ui.event.Deferrable ).
onClose is sent when the close button is pressed
(if
Window.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
org.zkoss.zk.ui.event.Event.stopPropagation to prevent
Window.onClose is called.
On the other hand, onOpen is sent when a popup
window (i.e.,
Window.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.
author: tomyeh |
Method Summary | |
public Object | clone() | public void | doEmbedded() Makes this window as embeded with other components (Default). | public void | doHighlighted() Makes this window as highlited. | public void | doModal() Makes this window as a modal dialog. | public void | doOverlapped() Makes this window as overlapped with other components. | public void | doPopup() Makes this window as popup, which is overlapped with other component
and auto-hiden when user clicks outside of the window. | public String | getBorder() Returns the border.
The border actually controls what the content style class is
is used. | public Caption | getCaption() Returns the caption of this window. | public String | getContentSclass() Returns the style class used for the content block. | public String | getContentStyle() Returns the CSS style for the content block of the window. | public String | getCtrlKeys() Returns what keystrokes to intercept. | public static String | getDefaultActionOnShow() Returns the animating name of function. | public String | getMode() Returns the current mode. | public String | getOuterAttrs() | public String | getPosition() Returns how to position the window at the client screen.
It is meaningless if the embedded mode is used.
Default: null which depends on
Window.getMode :
If overlapped or popup,
Window.setLeft and
Window.setTop are
assumed. | protected String | getRealStyle() | public String | getSclass() Returns the style class. | public String | getTitle() Returns the title. | public String | getTitleSclass() Returns the style class used for the title. | public boolean | inEmbedded() Returns whether this is embedded with other components (Default). | public boolean | inHighlighted() Returns whether this is a highlighted window. | public boolean | inModal() Returns whether this is a modal dialog. | public boolean | inOverlapped() Returns whether this is a overlapped window. | public boolean | inPopup() Returns whether this is a popup window. | public boolean | insertBefore(Component child, Component insertBefore) | public boolean | isClosable() Returns whether to show a close button on the title bar. | public boolean | isSizable() Returns whether the window is sizable. | protected Object | newExtraCtrl() | public void | onChildRemoved(Component child) | public void | onClose() Process the onClose event sent when the close button is pressed. | public void | onModal() Process the onModal event by making itself a modal window. | public void | setBorder(String border) Sets the border (either none or normal).
Parameters: border - the border. | public void | setClosable(boolean closable) Sets whether to show a close button on the title bar. | public void | setContentSclass(String scls) Sets the style class used for the content block. | public void | setContentStyle(String style) Sets the CSS style for the content block of the window. | public void | setCtrlKeys(String ctrlKeys) Sets what keystrokes to intercept.
The string could be a combination of the following:
- ^k
- A control key, i.e., Ctrl+k, where k could be a~z, 0~9, #n
- @k
- A alt key, i.e., Alt+k, where k could be a~z, 0~9, #n
- $k
- A shift key, i.e., Shift+k, where k could be #n
- #home
- Home
- #end
- End
- #ins
- Insert
- #del
- Delete
- #left
- Left arrow
- #right
- Right arrow
- #up
- Up arrow
- #down
- Down arrow
- #pgup
- PageUp
- #pgdn
- PageDn
- #f1 #f2 ...
| public static void | setDefaultActionOnShow(String onshow) Sets the action of window component to show the animating effect by default.
Default: null. | public void | setDraggable(String draggable) | public void | setMode(String name) Sets the mode to overlapped, popup, modal, embedded or highlighted.
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).
Parameters: name - the mode which could be one of"embedded", "overlapped", "popup", "modal", "highlighted".Note: it cannot be "modal". | public void | setMode(int mode) Sets the mode to overlapped, popup, modal, embedded or highlighted. | public void | setPage(Page page) | public void | setParent(Component parent) | public void | setPosition(String pos) Sets how to position the window at the client screen.
It is meaningless if the embedded mode is used.
Parameters: pos - how to position. | public void | setSclass(String sclass) | public void | setSizable(boolean sizable) Sets whether the window is sizable. | public void | setTitle(String title) Sets the title. | public boolean | setVisible(boolean visible) Changes the visibility of the window.
Note: If a modal dialog becomes invisible, the modal state
will be ended automatically. |
doEmbedded | public void doEmbedded()(Code) | | Makes this window as embeded with other components (Default).
|
doHighlighted | public void doHighlighted()(Code) | | Makes this window as highlited. The visual effect is
the similar to the modal window, but, like overlapped,
it doesn't suspend (block) the execution at the server.
In other words, it is more like an overlapped window from the
server side's viewpoint.
|
doOverlapped | public void doOverlapped()(Code) | | Makes this window as overlapped with other components.
|
doPopup | public void doPopup()(Code) | | Makes this window as popup, which is overlapped with other component
and auto-hiden when user clicks outside of the window.
|
getBorder | public String getBorder()(Code) | | Returns the border.
The border actually controls what the content style class is
is used. In fact, the name of the border (except "normal")
is generate as part of the style class used for the content block.
Refer to
Window.getContentSclass for more details.
Default: "none".
|
getCaption | public Caption getCaption()(Code) | | Returns the caption of this window.
|
getContentSclass | public String getContentSclass()(Code) | | Returns the style class used for the content block.
If
Window.setContentSclass was called with a non-empty value,
say, "mycnt", then
- Case 1: If
Window.getBorder is "normal", "mycnt" is returned.
- Case 2: Otherwise, "mycnt-border" is returned
where border is the value returned by
Window.getBorder .
If
Window.setContentSclass was not called, or called with null,
then the content style class is decided by
Window.getSclass as follows:
- Case 1: If
Window.getBorder is "normal", "wc-sclass" is
returned, where sclass is the value returned by
Window.getSclass .
- Otherwise, "wc-mode-border",
where border is the value returned by
Window.getBorder .
See Also: Window.setContentSclass |
getContentStyle | public String getContentStyle()(Code) | | Returns the CSS style for the content block of the window.
|
getCtrlKeys | public String getCtrlKeys()(Code) | | Returns what keystrokes to intercept.
Default: null.
|
getDefaultActionOnShow | public static String getDefaultActionOnShow()(Code) | | Returns the animating name of function.
since: 3.0.2 |
getMode | public String getMode()(Code) | | Returns the current mode.
One of "modal", "embedded", "overlapped", "popup", and "highlighted".
|
getPosition | public String getPosition()(Code) | | Returns how to position the window at the client screen.
It is meaningless if the embedded mode is used.
Default: null which depends on
Window.getMode :
If overlapped or popup,
Window.setLeft and
Window.setTop are
assumed. If modal or highlighted, it is centered.
|
getSclass | public String getSclass()(Code) | | Returns the style class.
If the style class is not defined (
Window.setSclass is not called
or called with null or empty), it returns
Window.getMode .
In other words, the style class is, by default, the same as
the mode name.
|
getTitle | public String getTitle()(Code) | | Returns the title.
Besides this attribute, you could use
Caption to define
a more sophiscated caption (aka., title).
If a window has a caption whose label (
Caption.getLabel )
is not empty, then this attribute is ignored.
Default: empty.
|
getTitleSclass | public String getTitleSclass()(Code) | | Returns the style class used for the title.
It returns "wt-sclass" is returned,
where sclass is the value returned by
Window.getSclass .
|
inEmbedded | public boolean inEmbedded()(Code) | | Returns whether this is embedded with other components (Default).
See Also: Window.doEmbedded |
inHighlighted | public boolean inHighlighted()(Code) | | Returns whether this is a highlighted window.
|
inModal | public boolean inModal()(Code) | | Returns whether this is a modal dialog.
|
inOverlapped | public boolean inOverlapped()(Code) | | Returns whether this is a overlapped window.
|
inPopup | public boolean inPopup()(Code) | | Returns whether this is a popup window.
|
isClosable | public boolean isClosable()(Code) | | Returns whether to show a close button on the title bar.
|
isSizable | public boolean isSizable()(Code) | | Returns whether the window is sizable.
|
onClose | public void onClose()(Code) | | Process the onClose event sent when the close button is pressed.
Default: detach itself.
|
setBorder | public void setBorder(String border)(Code) | | Sets the border (either none or normal).
Parameters: border - the border. If null or "0", "none" is assumed.Since 2.4.1, We assume "0" to be "none". |
setClosable | public void setClosable(boolean closable)(Code) | | Sets whether to show a close button on the title bar.
If closable, a button is displayed and the onClose event is sent
if an user clicks the button.
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.
|
setContentStyle | public void setContentStyle(String style)(Code) | | Sets the CSS style for the content block of the window.
Default: null.
|
setCtrlKeys | public void setCtrlKeys(String ctrlKeys) throws UiException(Code) | | Sets what keystrokes to intercept.
The string could be a combination of the following:
- ^k
- A control key, i.e., Ctrl+k, where k could be a~z, 0~9, #n
- @k
- A alt key, i.e., Alt+k, where k could be a~z, 0~9, #n
- $k
- A shift key, i.e., Shift+k, where k could be #n
- #home
- Home
- #end
- End
- #ins
- Insert
- #del
- Delete
- #left
- Left arrow
- #right
- Right arrow
- #up
- Up arrow
- #down
- Down arrow
- #pgup
- PageUp
- #pgdn
- PageDn
- #f1 #f2 ... #f12
- Function keys representing F1, F2, ... F12
For example,
- ^a^d@c#f10#left#right
- It means you want to intercept Ctrl+A, Ctrl+D, Alt+C, F10,
Left and Right.
- ^#left
- It means Ctrl+Left.
- ^#f1
- It means Ctrl+F1.
- @#f3
- It means Alt+F3.
Note: it doesn't support Ctrl+Alt, Shift+Ctrl, Shift+Alt or Shift+Ctrl+Alt.
|
setDefaultActionOnShow | public static void setDefaultActionOnShow(String onshow)(Code) | | Sets the action of window component to show the animating effect by default.
Default: null. In other words, if the property is null, it will refer to
the configuration of zk.xml to find the preference with
"org.zkoss.zul.Window.defaultActionOnShow", if any. For example,
<preference>
<name>org.zkoss.zul.Window.defaultActionOnShow</name>
<value>moveDown</value>
</preference>
Otherwise, the animating
effect is depended on component itself.
In JavaScript, the property will match the same function name with the
prefix "anima.". For example, if the property is "moveDown", the function name
should be "anima.moveDown" accordingly.
Node: The method is available in modal mode only. And if
the onshow command of client-side action has been assigned on the
component, its priority is higher than this method.
For example,
action="onshow:anima.appear(#{self});"
Parameters: onshow - the function name in JavaScript. You could use the followinganimations, e.g. "moveDown", "moveRight", "moveDiagonal", "appear", "slideDown", and so forth. since: 3.0.2 |
setDraggable | public void setDraggable(String draggable)(Code) | | |
setMode | public void setMode(String name) throws InterruptedException(Code) | | Sets the mode to overlapped, popup, modal, embedded or highlighted.
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).
Parameters: name - the mode which could be one of"embedded", "overlapped", "popup", "modal", "highlighted".Note: it cannot be "modal". Use Window.doModal instead. exception: InterruptedException - thrown if "modal" is specified,and one of the following conditions occurs:1) the desktop or the Web application is being destroyed, or2) org.zkoss.zk.ui.sys.DesktopCtrl.ceaseSuspendedThread.To tell the difference, check the getMessage method of InterruptedException. |
setPosition | public void setPosition(String pos)(Code) | | Sets how to position the window at the client screen.
It is meaningless if the embedded mode is used.
Parameters: pos - how to position. It can be null (the default), ora combination of the following values (by separating with comma).- center
- Position the window at the center. Window.setTop and Window.setLeftare both ignored.
- left
- Position the window at the left edge. Window.setLeft is ignored.
- right
- Position the window at the right edge. Window.setLeft is ignored.
- top
- Position the window at the top edge. Window.setTop is ignored.
- bottom
- Position the window at the bottom edge. Window.setTop is ignored.
- parent
- Position the window relative to its parent.That is, the left and top (Window.getTop and Window.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 ofthe left edge. |
setSizable | public void setSizable(boolean sizable)(Code) | | Sets whether the window is sizable.
If true, an user can drag the border to change the window width.
Default: false.
|
setTitle | public void setTitle(String title)(Code) | | Sets the title.
|
setVisible | public boolean setVisible(boolean visible)(Code) | | Changes the visibility of the window.
Note: If a modal dialog becomes invisible, the modal state
will be ended automatically. In other words, the mode (
Window.getMode )
will become
Window.OVERLAPPED and the suspending thread is resumed.
|
|
|