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>>
public interface IWindow<I extends IAnyGroup> extends IXulElement<IWindow<I>>, IChildable<IWindow<I>,I>, IAnyGroup<IWindow<I>>, IComposite<IWindow<I>,IAnyGroup>
ImmutableWindowcomponentSupport @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)andIHtmlBasedComponent.withTop(String).Popup
A popup window is similar to
overlappedwindows, 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
leftandtopproperties, you can control the position of anoverlapped/popup/modal/highlightedwindow 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
positionattribute can be a combination of the following constants by separating them with comma (,).Constant Description center Position the window at the center. If leftorrightis also specified, it means the vertical center. Iftoporbottomis also specified, it means the horizontal center. If none ofleft,right,topandbottomis specified, it means the center in both directions.Both the
leftandtopproperty are ignored.left Position the window at the left edge. The
leftproperty is ignored.right Position the window at the right edge. The
leftproperty is ignored.top Position the window at the top. The
topproperty is ignored.bottom Position the window at the bottom. The
topproperty is ignored.- Author:
- katherine
- See Also:
Window
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIWindow.BorderSpecifies the border toIWindowcomponent.static classIWindow.Builder<I extends IAnyGroup>Builds instances of typeIWindow.static classIWindow.ModeSpecifies the mode toIWindowcomponentstatic classIWindow.UpdaterBuilds an updater of typeIWindowforUiAgent.smartUpdate(Locator, SmartUpdater).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.StringgetBorder()Returns the border.ICaptiongetCaption()Returns the caption of this window.java.lang.StringgetContentSclass()Returns the style class used for the content block.java.lang.StringgetContentStyle()Returns the CSS style for the content block of the window.default intgetMinheight()Returns the minimum height.default intgetMinwidth()Returns the minimum width.default java.lang.StringgetMode()Returns the current mode.java.lang.StringgetPosition()Returns how to position the window at the client screen.default java.lang.StringgetTitle()Returns the title.default java.lang.StringgetWidgetClass()Returns the client widget class.default booleanisClosable()Returns whether to show a close button on the title bar.default booleanisMaximizable()Returns whether to display the maximizing button and allow the user to maximize the window.default booleanisMaximized()Returns whether the window is maximized.default booleanisMinimizable()Returns whether to display the minimizing button and allow the user to minimize the window.default booleanisMinimized()Returns whether the window is minimized.default booleanisNativeScrollbar()Returns 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 booleanisSizable()Returns whether the window is sizable.static <I extends IAnyGroup>
IWindow<I>of(I... children)Returns the instance with the given any group children.static <I extends IAnyGroup>
IWindow<I>of(java.lang.Iterable<? extends I> children)Returns the instance with the given any group children.static <I extends IAnyGroup>
IWindow<I>ofBorder(IWindow.Border border)Returns the instance with the givenIWindow.Borderborder.static <I extends IAnyGroup>
IWindow<I>ofCaption(ICaption caption)Returns the instance with the given caption.static <I extends IAnyGroup>
IWindow<I>ofId(java.lang.String id)Returns the instance with the given id.static <I extends IAnyGroup>
IWindow<I>ofMode(IWindow.Mode mode)Returns the instance with the given mode.static <I extends IAnyGroup>
IWindow<I>ofSize(java.lang.String width, java.lang.String height)Returns the instance with the given size, width and heightstatic <I extends IAnyGroup>
IWindow<I>ofTitle(java.lang.String title)Returns the instance with the given title.static <I extends IAnyGroup>
IWindow<I>ofVflex(java.lang.String vflex)Returns the instance with the given vflex.default IWindow<I>withAllComponents(java.lang.Iterable<? extends IAnyGroup> elements)Copy the current immutable object with elements that replace the content ofchildren.IWindow<I>withBorder(java.lang.String border)Returns a copy ofthisimmutable component with the specifiedborder.default IWindow<I>withBorder(IWindow.Border border)Returns a copy ofthisimmutable component with the specifiedborder.IWindow<I>withCaption(ICaption caption)Returns a copy ofthisimmutable component with the specifiedcaption.IWindow<I>withClosable(boolean closable)Returns a copy ofthisimmutable component with the specifiedclosable.IWindow<I>withContentSclass(java.lang.String contentSclass)Returns a copy ofthisimmutable component with the specifiedcontentSclass.IWindow<I>withContentStyle(java.lang.String contentStyle)Returns a copy ofthisimmutable component with the specifiedcontentStyle.IWindow<I>withMaximizable(boolean maximizable)Returns a copy ofthisimmutable component with the specifiedmaximizable.IWindow<I>withMaximized(boolean maximized)Returns a copy ofthisimmutable component with the specifiedmaximized.IWindow<I>withMinheight(int minheight)Returns a copy ofthisimmutable component with the specifiedminheight.IWindow<I>withMinimizable(boolean minimizable)Returns a copy ofthisimmutable component with the specifiedminimizable.IWindow<I>withMinimized(boolean minimized)Returns a copy ofthisimmutable component with the specifiedminimized.IWindow<I>withMinwidth(int minwidth)Returns a copy ofthisimmutable component with the specifiedminwidth.IWindow<I>withMode(java.lang.String mode)Returns a copy ofthisimmutable component with the specifiedmode.default IWindow<I>withMode(IWindow.Mode mode)Returns a copy ofthisimmutable component with the specifiedmode.IWindow<I>withNativeScrollbar(boolean nativeScrollbar)Returns a copy ofthisimmutable component with the specifiednativeScrollbar.IWindow<I>withPosition(java.lang.String position)Returns a copy ofthisimmutable component with the specifiedposition.IWindow<I>withShadow(boolean shadow)Returns a copy ofthisimmutable component with the specifiedshadow.IWindow<I>withSizable(boolean sizable)Returns a copy ofthisimmutable component with the specifiedsizable.IWindow<I>withTitle(java.lang.String title)Returns a copy ofthisimmutable component with the specifiedtitle.-
Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildren
-
Methods 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, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zul.wnd.Window"- Specified by:
getWidgetClassin interfaceIComponent<I extends IAnyGroup>
-
getCaption
@Nullable ICaption getCaption()
Returns the caption of this window.
-
withCaption
IWindow<I> withCaption(@Nullable ICaption caption)
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
default java.lang.String 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
IWindow<I> withTitle(java.lang.String title)
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
default java.lang.String getMode()
Returns the current mode.Default:
"embedded"
-
withMode
IWindow<I> withMode(java.lang.String mode)
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
default IWindow<I> withMode(IWindow.Mode mode)
- Parameters:
mode- The mode of this component.Default:
"embedded".- Returns:
- A modified copy of the
thisobject
-
getPosition
@Nullable java.lang.String 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
IWindow<I> withPosition(@Nullable java.lang.String position)
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
@Nullable java.lang.String getContentStyle()
Returns the CSS style for the content block of the window.Default:
null
-
withContentStyle
IWindow<I> withContentStyle(@Nullable java.lang.String contentStyle)
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
@Nullable java.lang.String getContentSclass()
Returns the style class used for the content block.Default:
null
-
withContentSclass
IWindow<I> withContentSclass(@Nullable java.lang.String contentSclass)
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
IWindow<I> withClosable(boolean closable)
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
IWindow<I> withMaximizable(boolean maximizable)
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
IWindow<I> withMinimizable(boolean minimizable)
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
IWindow<I> withMaximized(boolean maximized)
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
IWindow<I> withMinimized(boolean minimized)
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
IWindow<I> withSizable(boolean sizable)
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
IWindow<I> withMinheight(int minheight)
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
IWindow<I> withMinwidth(int minwidth)
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
default java.lang.String getBorder()
Returns the border.Default:
"none".
-
withBorder
IWindow<I> withBorder(java.lang.String border)
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
default IWindow<I> withBorder(IWindow.Border border)
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
IWindow<I> withShadow(boolean shadow)
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
IWindow<I> withNativeScrollbar(boolean nativeScrollbar)
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
default IWindow<I> withAllComponents(java.lang.Iterable<? extends IAnyGroup> elements)
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
static <I extends IAnyGroup> IWindow<I> ofVflex(java.lang.String vflex)
Returns the instance with the given vflex.- Parameters:
vflex- The vertical flex hint.
-
ofTitle
static <I extends IAnyGroup> IWindow<I> ofTitle(java.lang.String title)
Returns the instance with the given title.- Parameters:
title- The title of the component.
-
ofCaption
static <I extends IAnyGroup> IWindow<I> ofCaption(ICaption caption)
Returns the instance with the given caption.- Parameters:
caption- The caption child
-
ofBorder
static <I extends IAnyGroup> IWindow<I> ofBorder(IWindow.Border border)
Returns the instance with the givenIWindow.Borderborder.- Parameters:
border- The border of the component
-
of
static <I extends IAnyGroup> IWindow<I> of(java.lang.Iterable<? extends I> children)
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
IAnyGroup
-
of
static <I extends IAnyGroup> IWindow<I> of(I... children)
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
IAnyGroup
-
ofSize
static <I extends IAnyGroup> IWindow<I> ofSize(java.lang.String width, java.lang.String height)
Returns the instance with the given size, width and height- Parameters:
width- The width of the componentheight- The height of the component
-
ofId
static <I extends IAnyGroup> IWindow<I> ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
ofMode
static <I extends IAnyGroup> IWindow<I> ofMode(IWindow.Mode mode)
Returns the instance with the given mode.- Parameters:
mode- The mode to overlapped, popup, modal, embedded or highlighted
-
-