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>
ImmutableWindow
componentSupport @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
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
andtop
properties, you can control the position of anoverlapped
/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 (,
).Constant Description center Position the window at the center. If left
orright
is also specified, it means the vertical center. Iftop
orbottom
is also specified, it means the horizontal center. If none ofleft
,right
,top
andbottom
is specified, it means the center in both directions.Both the
left
andtop
property are ignored.left Position the window at the left edge. The
left
property is ignored.right Position the window at the right edge. The
left
property is ignored.top Position the window at the top. The
top
property is ignored.bottom Position the window at the bottom. The
top
property is ignored.- Author:
- katherine
- See Also:
Window
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IWindow.Border
Specifies the border toIWindow
component.static class
IWindow.Builder<I extends IAnyGroup>
Builds instances of typeIWindow
.static class
IWindow.Mode
Specifies the mode toIWindow
componentstatic class
IWindow.Updater
Builds an updater of typeIWindow
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
getBorder()
Returns the border.ICaption
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.default int
getMinheight()
Returns the minimum height.default int
getMinwidth()
Returns the minimum width.default java.lang.String
getMode()
Returns the current mode.java.lang.String
getPosition()
Returns how to position the window at the client screen.default java.lang.String
getTitle()
Returns the title.default java.lang.String
getWidgetClass()
Returns the client widget class.default boolean
isClosable()
Returns whether to show a close button on the title bar.default boolean
isMaximizable()
Returns whether to display the maximizing button and allow the user to maximize the window.default boolean
isMaximized()
Returns whether the window is maximized.default boolean
isMinimizable()
Returns whether to display the minimizing button and allow the user to minimize the window.default boolean
isMinimized()
Returns whether the window is minimized.default boolean
isNativeScrollbar()
Returns whether to use Browser's scrollbar or a floating scrollbar (if withfalse
).default boolean
isShadow()
Returns whether to show the shadow of an overlapped/popup/modal window.default boolean
isSizable()
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.Border
border.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 ofthis
immutable component with the specifiedborder
.default IWindow<I>
withBorder(IWindow.Border border)
Returns a copy ofthis
immutable component with the specifiedborder
.IWindow<I>
withCaption(ICaption caption)
Returns a copy ofthis
immutable component with the specifiedcaption
.IWindow<I>
withClosable(boolean closable)
Returns a copy ofthis
immutable component with the specifiedclosable
.IWindow<I>
withContentSclass(java.lang.String contentSclass)
Returns a copy ofthis
immutable component with the specifiedcontentSclass
.IWindow<I>
withContentStyle(java.lang.String contentStyle)
Returns a copy ofthis
immutable component with the specifiedcontentStyle
.IWindow<I>
withMaximizable(boolean maximizable)
Returns a copy ofthis
immutable component with the specifiedmaximizable
.IWindow<I>
withMaximized(boolean maximized)
Returns a copy ofthis
immutable component with the specifiedmaximized
.IWindow<I>
withMinheight(int minheight)
Returns a copy ofthis
immutable component with the specifiedminheight
.IWindow<I>
withMinimizable(boolean minimizable)
Returns a copy ofthis
immutable component with the specifiedminimizable
.IWindow<I>
withMinimized(boolean minimized)
Returns a copy ofthis
immutable component with the specifiedminimized
.IWindow<I>
withMinwidth(int minwidth)
Returns a copy ofthis
immutable component with the specifiedminwidth
.IWindow<I>
withMode(java.lang.String mode)
Returns a copy ofthis
immutable component with the specifiedmode
.default IWindow<I>
withMode(IWindow.Mode mode)
Returns a copy ofthis
immutable component with the specifiedmode
.IWindow<I>
withNativeScrollbar(boolean nativeScrollbar)
Returns a copy ofthis
immutable component with the specifiednativeScrollbar
.IWindow<I>
withPosition(java.lang.String position)
Returns a copy ofthis
immutable component with the specifiedposition
.IWindow<I>
withShadow(boolean shadow)
Returns a copy ofthis
immutable component with the specifiedshadow
.IWindow<I>
withSizable(boolean sizable)
Returns a copy ofthis
immutable component with the specifiedsizable
.IWindow<I>
withTitle(java.lang.String title)
Returns a copy ofthis
immutable 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:
getWidgetClass
in interfaceIComponent<I extends IAnyGroup>
-
getCaption
@Nullable ICaption getCaption()
Returns the caption of this window.
-
withCaption
IWindow<I> withCaption(@Nullable ICaption caption)
Returns a copy ofthis
immutable 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
this
object
-
getTitle
default java.lang.String getTitle()
Returns the title. Besides this attribute, you could useICaption
to 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 ofthis
immutable 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
this
object
-
getMode
default java.lang.String getMode()
Returns the current mode.Default:
"embedded"
-
withMode
IWindow<I> withMode(java.lang.String mode)
Returns a copy ofthis
immutable 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
this
object
-
withMode
default IWindow<I> withMode(IWindow.Mode mode)
- Parameters:
mode
- The mode of this component.Default:
"embedded"
.- Returns:
- A modified copy of the
this
object
-
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:
null
which 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 ofthis
immutable 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
this
object
-
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 ofthis
immutable 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
this
object
-
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 ofthis
immutable 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
this
object
-
isClosable
default boolean isClosable()
Returns whether to show a close button on the title bar.
-
withClosable
IWindow<I> withClosable(boolean closable)
Returns a copy ofthis
immutable component with the specifiedclosable
.Sets whether to show a close button on the title bar. If closable, a button is displayed and the
onClose
action 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
this
object
-
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 ofthis
immutable 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
this
object
-
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 ofthis
immutable 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
this
object
-
isMaximized
default boolean isMaximized()
Returns whether the window is maximized.Default:
false
-
withMaximized
IWindow<I> withMaximized(boolean maximized)
Returns a copy ofthis
immutable 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
this
object
-
isMinimized
default boolean isMinimized()
Returns whether the window is minimized.Default:
false
.
-
withMinimized
IWindow<I> withMinimized(boolean minimized)
Returns a copy ofthis
immutable 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
this
object
-
isSizable
default boolean isSizable()
Returns whether the window is sizable.Default:
false
-
withSizable
IWindow<I> withSizable(boolean sizable)
Returns a copy ofthis
immutable 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
this
object
-
getMinheight
default int getMinheight()
Returns the minimum height.Default:
100
.
-
withMinheight
IWindow<I> withMinheight(int minheight)
Returns a copy ofthis
immutable component with the specifiedminheight
.Sets the minimum height in pixels allowed for this panel. If negative,
100
is assumed.- Parameters:
minheight
- Whether the panel is sizable.Default:
100
.- Returns:
- A modified copy of the
this
object
-
getMinwidth
default int getMinwidth()
Returns the minimum width.Default:
200
.
-
withMinwidth
IWindow<I> withMinwidth(int minwidth)
Returns a copy ofthis
immutable component with the specifiedminwidth
.Sets the minimum width in pixels allowed for this panel. If negative,
200
is assumed.- Parameters:
minwidth
- Whether the panel is sizable.Default:
200
.- Returns:
- A modified copy of the
this
object
-
getBorder
default java.lang.String getBorder()
Returns the border.Default:
"none"
.
-
withBorder
IWindow<I> withBorder(java.lang.String border)
Returns a copy ofthis
immutable component with the specifiedborder
.Sets the border. Allowed values include
none
(default), andnormal
For 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
this
object
-
withBorder
default IWindow<I> withBorder(IWindow.Border border)
Returns a copy ofthis
immutable component with the specifiedborder
.Sets the border with the given
border
.- Parameters:
border
- The border- Returns:
- A modified copy of the
this
object
-
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 ofthis
immutable 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
this
object
-
isNativeScrollbar
default boolean isNativeScrollbar()
Returns whether to use Browser's scrollbar or a floating scrollbar (if withfalse
).Default:
true
to 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 ofthis
immutable component with the specifiednativeScrollbar
.Sets to use Browser's scrollbar or a floating scrollbar
- Parameters:
nativeScrollbar
-true
to use Browser's scrollbar, orfalse
to use a floating scrollbar.Default:
true
.- Returns:
- A modified copy of the
this
object
-
withAllComponents
default IWindow<I> withAllComponents(java.lang.Iterable<? extends IAnyGroup> elements)
Description copied from interface:IComposite
Copy 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:
withAllComponents
in interfaceIComposite<IWindow<I extends IAnyGroup>,IAnyGroup>
- Parameters:
elements
- An iterable of children elements to set- Returns:
- A modified copy of
this
object
-
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.Border
border.- 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
-
-