Interface IWindow<I extends IAnyGroup>
- All Superinterfaces:
IAnyGroup<IWindow<I>>,IChildable<IWindow<I>,,I> IComponent<IWindow<I>>,IComposite<IWindow<I>,,IAnyGroup> IHtmlBasedComponent<IWindow<I>>,IXulElement<IWindow<I>>
Window component
Support @Action
| Name | Action Type |
|---|---|
| onMove | ActionData: MoveData
Denotes the position of the window is moved by a user. |
| onOpen | ActionData: OpenData
Denotes user has opened or closed a component. |
| onMaximize | ActionData: MaximizeData
Denotes user has maximize a component. |
| onMinimize | ActionData: MinimizeData
Denotes user has minimize a component. |
| onClose | ActionData: OpenData
Denotes the close button is pressed by a user, and the component shall detach itself. |
| onSize | ActionData: SizeData
Denotes the panel's size is updated by a user. |
| onZIndex | ActionData: ZIndexData
Denotes the panel's zindex is updated by a user. |
Support Application Library Properties
-
To set to use Browser's scrollbar or not, you have to specify
withNativeScrollbar(boolean).Or configure it from zk.xml by setting library properties. For example,
<library-property/> <name>org.zkoss.zul.nativebar</name/> <value>false</value/> </library-property/>
Modes
Embedded
An embedded window is placed inline with other components. In this mode, you cannot change its position, since the position is decided by the browser. It is the default mode since it is the most common appearance.
Overlapped
An overlapped window is overlapped with other components, such that users could
drag it around and developer could set its position by IHtmlBasedComponent.withLeft(String)
and IHtmlBasedComponent.withTop(String).
Popup
A popup window is similar to overlapped windows, except it is automatically
closed when user clicks on any component other than the popup window itself
or any of its descendants. Of course, you could dismiss it manually by making it invisible or detaching it.
As its name suggested, it is designed to implement the popup windows.
A typical application is to display information that won't obscure the current
operation and are easy to close. A popup window is usually position around the focal
point (such as a button). It can be done by use of withPosition(String) with "parent".
Modal and Highlighted
By default, a modal window is the same as a highlighted window in stateless.
A modal window provides the so-called modal effect that limits a user from accessing components other than the modal window. Users cannot access anything outside of the modal window, including clicking or tabbing.
Position
In addition to the left and top properties, you can control
the position of an overlapped/popup/modal/highlighted
window by the use of the position attribute. For example, the following code snippet positions
the window to the right-bottom corner.
IWindow.ofMode(Mode.OVERLAPPED).withWidth("300px").withPosition("right,bottom");
The value of the position attribute can be a combination of
the following constants by separating them with comma (,).
Position the window at the center. If left or right is also specified, it means the vertical center. If top or bottom is also specified, it means the horizontal center. If none of left, right, top and bottom is specified, it means the center in both directions.
Both the | |
| Position the window at the left edge.
The | |
| Position the window at the right edge.
The | |
| Position the window at the top.
The | |
| Position the window at the bottom.
The |
- Author:
- katherine
- See Also:
-
Window
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSpecifies the border toIWindowcomponent.static classIWindow.Builder<I extends IAnyGroup>Builds instances of typeIWindow.static enumSpecifies the mode toIWindowcomponentstatic classBuilds an updater of typeIWindowforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StringReturns the border.Returns the caption of this window.Returns the style class used for the content block.Returns the CSS style for the content block of the window.default intReturns the minimum height.default intReturns the minimum width.default StringgetMode()Returns the current mode.Returns how to position the window at the client screen.default StringgetTitle()Returns the title.default StringReturns the client widget class.default booleanReturns whether to show a close button on the title bar.default booleanReturns whether to display the maximizing button and allow the user to maximize the window.default booleanReturns whether the window is maximized.default booleanReturns whether to display the minimizing button and allow the user to minimize the window.default booleanReturns whether the window is minimized.default booleanReturns whether to use Browser's scrollbar or a floating scrollbar (if withfalse).default booleanisShadow()Returns whether to show the shadow of an overlapped/popup/modal window.default booleanReturns whether the window is sizable.of(I... children) Returns the instance with the given any group children.Returns the instance with the given any group children.ofBorder(IWindow.Border border) Returns the instance with the givenIWindow.Borderborder.Returns the instance with the given caption.Returns the instance with the given id.ofMode(IWindow.Mode mode) Returns the instance with the given mode.Returns the instance with the given size, width and heightReturns the instance with the given title.Returns the instance with the given vflex.withAllComponents(Iterable<? extends IAnyGroup> elements) Copy the current immutable object with elements that replace the content ofchildren.withBorder(String border) Returns a copy ofthisimmutable component with the specifiedborder.withBorder(IWindow.Border border) Returns a copy ofthisimmutable component with the specifiedborder.withCaption(ICaption caption) Returns a copy ofthisimmutable component with the specifiedcaption.withClosable(boolean closable) Returns a copy ofthisimmutable component with the specifiedclosable.withContentSclass(String contentSclass) Returns a copy ofthisimmutable component with the specifiedcontentSclass.withContentStyle(String contentStyle) Returns a copy ofthisimmutable component with the specifiedcontentStyle.withMaximizable(boolean maximizable) Returns a copy ofthisimmutable component with the specifiedmaximizable.withMaximized(boolean maximized) Returns a copy ofthisimmutable component with the specifiedmaximized.withMinheight(int minheight) Returns a copy ofthisimmutable component with the specifiedminheight.withMinimizable(boolean minimizable) Returns a copy ofthisimmutable component with the specifiedminimizable.withMinimized(boolean minimized) Returns a copy ofthisimmutable component with the specifiedminimized.withMinwidth(int minwidth) Returns a copy ofthisimmutable component with the specifiedminwidth.Returns a copy ofthisimmutable component with the specifiedmode.withMode(IWindow.Mode mode) Returns a copy ofthisimmutable component with the specifiedmode.withNativeScrollbar(boolean nativeScrollbar) Returns a copy ofthisimmutable component with the specifiednativeScrollbar.withPosition(String position) Returns a copy ofthisimmutable component with the specifiedposition.withShadow(boolean shadow) Returns a copy ofthisimmutable component with the specifiedshadow.withSizable(boolean sizable) Returns a copy ofthisimmutable component with the specifiedsizable.Returns a copy ofthisimmutable component with the specifiedtitle.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.wnd.Window"- Specified by:
getWidgetClassin interfaceIComponent<I extends IAnyGroup>
-
getCaption
Returns the caption of this window. -
withCaption
Returns a copy ofthisimmutable component with the specifiedcaption.Sets the caption child of this component.
- Parameters:
caption- The caption child of the component.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getTitle
Returns the title. Besides this attribute, you could useICaptionto define a more sophisticated caption (a.k.a., title).If a window has a caption whose label (
ILabelElement.getLabel()) is not empty, then this attribute is ignored.Default:
""(empty). -
withTitle
Returns a copy ofthisimmutable component with the specifiedtitle.Sets the title of this component.
- Parameters:
title- The title of this component.Default:
""(empty).- Returns:
- A modified copy of the
thisobject
-
getMode
Returns the current mode.Default:
"embedded" -
withMode
Returns a copy ofthisimmutable component with the specifiedmode.Sets the mode to
"overlapped","popup","modal","embedded"or"highlighted".- Parameters:
mode- The mode of this component.Default:
"embedded".- Returns:
- A modified copy of the
thisobject
-
withMode
- Parameters:
mode- The mode of this component.Default:
"embedded".- Returns:
- A modified copy of the
thisobject
-
getPosition
Returns how to position the window at the client screen. It is meaningless if the embedded mode is used.Default:
nullwhich depends ongetMode(): If overlapped or popup,IHtmlBasedComponent.withLeft(java.lang.String)andIHtmlBasedComponent.withTop(java.lang.String)are assumed. If modal or highlighted, it is centered. -
withPosition
Returns a copy ofthisimmutable component with the specifiedposition.Sets how to position the window at the client screen. It is meaningless if the embedded mode is used.
- Parameters:
position- How to position. It can benull(the default), or a combination of the following values (by separating with comma).- center
- Position the window at the center.
IHtmlBasedComponent.withTop(java.lang.String)andIHtmlBasedComponent.withLeft(java.lang.String)are both ignored. - nocenter
- Not to position the window at the center. A modal window, by default,
will be position at the center. By specifying this value could
prevent it and the real position depends on
IHtmlBasedComponent.withTop(java.lang.String)andIHtmlBasedComponent.withLeft(java.lang.String) - left
- Position the window at the left edge.
IHtmlBasedComponent.withLeft(java.lang.String)is ignored. - right
- Position the window at the right edge.
IHtmlBasedComponent.withLeft(java.lang.String)is ignored. - top
- Position the window at the top edge.
IHtmlBasedComponent.withTop(java.lang.String)is ignored. - bottom
- Position the window at the bottom edge.
IHtmlBasedComponent.withTop(java.lang.String)is ignored. - parent
- Position the window relative to its parent.
That is, the left and top (
IHtmlBasedComponent.getTop()andIHtmlBasedComponent.getLeft()) is an offset to his parent's let-top corner.
For example,
"left,center"means to position it at the center of the left edge.- Returns:
- A modified copy of the
thisobject
-
getContentStyle
Returns the CSS style for the content block of the window.Default:
null -
withContentStyle
Returns a copy ofthisimmutable component with the specifiedcontentStyle.Sets the CSS style for the content block of the window.
- Parameters:
contentStyle- The CSS style for the content block of the window.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getContentSclass
Returns the style class used for the content block.Default:
null -
withContentSclass
Returns a copy ofthisimmutable component with the specifiedcontentSclass.Sets the style class used for the content block.
- Parameters:
contentSclass- The style class used for the content block.Default:
null.- Returns:
- A modified copy of the
thisobject
-
isClosable
default boolean isClosable()Returns whether to show a close button on the title bar. -
withClosable
Returns a copy ofthisimmutable component with the specifiedclosable.Sets whether to show a close button on the title bar. If closable, a button is displayed and the
onCloseaction is sent if a user clicks the button.- Parameters:
closable- Whether to show a close button on the title bar.Default:
false.Note: the close button won't be displayed if no title or caption at all.
- Returns:
- A modified copy of the
thisobject
-
isMaximizable
default boolean isMaximizable()Returns whether to display the maximizing button and allow the user to maximize the window.Default:
false. -
withMaximizable
Returns a copy ofthisimmutable component with the specifiedmaximizable.Sets whether to display the maximizing button and allow the user to maximize the window.
- Parameters:
maximizable- Whether to display the maximizing buttonDefault:
false.- Returns:
- A modified copy of the
thisobject
-
isMinimizable
default boolean isMinimizable()Returns whether to display the minimizing button and allow the user to minimize the window.Default:
false. -
withMinimizable
Returns a copy ofthisimmutable component with the specifiedminimizable.Sets whether to display the minimizing button and allow the user to minimize the window.
- Parameters:
minimizable- Whether to show a minimizing button.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isMaximized
default boolean isMaximized()Returns whether the window is maximized.Default:
false -
withMaximized
Returns a copy ofthisimmutable component with the specifiedmaximized.Sets whether the window is maximized.
- Parameters:
maximized- Whether the window is maximized.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isMinimized
default boolean isMinimized()Returns whether the window is minimized.Default:
false. -
withMinimized
Returns a copy ofthisimmutable component with the specifiedminimized.Sets whether the window is minimized.
- Parameters:
minimized- Whether the window is minimized.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isSizable
default boolean isSizable()Returns whether the window is sizable.Default:
false -
withSizable
Returns a copy ofthisimmutable component with the specifiedsizable.Sets whether the window is sizable.
- Parameters:
sizable- Whether the window is sizable.Default:
false.- Returns:
- A modified copy of the
thisobject
-
getMinheight
default int getMinheight()Returns the minimum height.Default:
100. -
withMinheight
Returns a copy ofthisimmutable component with the specifiedminheight.Sets the minimum height in pixels allowed for this panel. If negative,
100is assumed.- Parameters:
minheight- Whether the panel is sizable.Default:
100.- Returns:
- A modified copy of the
thisobject
-
getMinwidth
default int getMinwidth()Returns the minimum width.Default:
200. -
withMinwidth
Returns a copy ofthisimmutable component with the specifiedminwidth.Sets the minimum width in pixels allowed for this panel. If negative,
200is assumed.- Parameters:
minwidth- Whether the panel is sizable.Default:
200.- Returns:
- A modified copy of the
thisobject
-
getBorder
Returns the border.Default:
"none". -
withBorder
Returns a copy ofthisimmutable component with the specifiedborder.Sets the border. Allowed values include
none(default), andnormalFor more information, please refer to ZK Component Reference: Window.- Parameters:
border- the border. If null,"0"or"false","none"is assumed.- Returns:
- A modified copy of the
thisobject
-
withBorder
Returns a copy ofthisimmutable component with the specifiedborder.Sets the border with the given
border.- Parameters:
border- The border- Returns:
- A modified copy of the
thisobject
-
isShadow
default boolean isShadow()Returns whether to show the shadow of an overlapped/popup/modal window. It is meaningless if it is an embedded window.Default:
true -
withShadow
Returns a copy ofthisimmutable component with the specifiedshadow.Sets whether to show the shadow of an overlapped/popup/modal window.
- Parameters:
shadow- Whether to show the shadow of an overlapped/popup/modal windowDefault:
true- Returns:
- A modified copy of the
thisobject
-
isNativeScrollbar
default boolean isNativeScrollbar()Returns whether to use Browser's scrollbar or a floating scrollbar (if withfalse).Default:
trueto use Browser's scrollbar, if the"org.zkoss.zul.nativebar"library property is not set in zk.xml. -
withNativeScrollbar
Returns a copy ofthisimmutable component with the specifiednativeScrollbar.Sets to use Browser's scrollbar or a floating scrollbar
- Parameters:
nativeScrollbar-trueto use Browser's scrollbar, orfalseto use a floating scrollbar.Default:
true.- Returns:
- A modified copy of the
thisobject
-
withAllComponents
Description copied from interface:ICompositeCopy the current immutable object with elements that replace the content ofchildren. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Specified by:
withAllComponentsin interfaceIComposite<IWindow<I extends IAnyGroup>,IAnyGroup> - Parameters:
elements- An iterable of children elements to set- Returns:
- A modified copy of
thisobject
-
ofVflex
Returns the instance with the given vflex.- Parameters:
vflex- The vertical flex hint.
-
ofTitle
Returns the instance with the given title.- Parameters:
title- The title of the component.
-
ofCaption
Returns the instance with the given caption.- Parameters:
caption- The caption child
-
ofBorder
Returns the instance with the givenIWindow.Borderborder.- Parameters:
border- The border of the component
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
ofSize
Returns the instance with the given size, width and height- Parameters:
width- The width of the componentheight- The height of the component
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
ofMode
Returns the instance with the given mode.- Parameters:
mode- The mode to overlapped, popup, modal, embedded or highlighted
-