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>
    Immutable 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 (,).

    Constant
    Description
    center
    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 left and top 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
    • Field Detail

      • DEFAULT

        static final IWindow<IAnyGroup> DEFAULT
        Constant for default attributes of this immutable component.
    • Method Detail

      • getWidgetClass

        default java.lang.String getWidgetClass()
        Returns the client widget class.

        Default: "zul.wnd.Window"

        Specified by:
        getWidgetClass in interface IComponent<I extends IAnyGroup>
      • getCaption

        @Nullable
        ICaption getCaption()
        Returns the caption of this window.
      • withCaption

        IWindow<I> withCaption​(@Nullable
                               ICaption caption)
        Returns a copy of this immutable component with the specified caption.

        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 use ICaption 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 of this immutable component with the specified title.

        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 of this immutable component with the specified mode.

        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)
        Returns a copy of this immutable component with the specified mode.

        Sets the mode to IWindow.Mode.

        Parameters:
        mode - The mode of this component.

        Default: "embedded".

        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 of this immutable component with the specified contentStyle.

        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 of this immutable component with the specified contentSclass.

        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 of this immutable component with the specified closable.

        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 of this immutable component with the specified maximizable.

        Sets whether to display the maximizing button and allow the user to maximize the window.

        Parameters:
        maximizable - Whether to display the maximizing button

        Default: 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 of this immutable component with the specified minimizable.

        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 of this immutable component with the specified maximized.

        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 of this immutable component with the specified minimized.

        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 of this immutable component with the specified sizable.

        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 of this immutable component with the specified minheight.

        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 of this immutable component with the specified minwidth.

        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 of this immutable component with the specified border.

        Sets the border. Allowed values include none (default), and normal 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 of this immutable component with the specified border.

        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 of this immutable component with the specified shadow.

        Sets whether to show the shadow of an overlapped/popup/modal window.

        Parameters:
        shadow - Whether to show the shadow of an overlapped/popup/modal window

        Default: 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 with false).

        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 of this immutable component with the specified nativeScrollbar.

        Sets to use Browser's scrollbar or a floating scrollbar

        Parameters:
        nativeScrollbar - true to use Browser's scrollbar, or false 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 of children. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Specified by:
        withAllComponents in interface IComposite<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 IAnyGroupIWindow<I> ofVflex​(java.lang.String vflex)
        Returns the instance with the given vflex.
        Parameters:
        vflex - The vertical flex hint.
      • ofTitle

        static <I extends IAnyGroupIWindow<I> ofTitle​(java.lang.String title)
        Returns the instance with the given title.
        Parameters:
        title - The title of the component.
      • ofCaption

        static <I extends IAnyGroupIWindow<I> ofCaption​(ICaption caption)
        Returns the instance with the given caption.
        Parameters:
        caption - The caption child
      • of

        static <I extends IAnyGroupIWindow<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 IAnyGroupIWindow<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 IAnyGroupIWindow<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 component
        height - The height of the component
      • ofId

        static <I extends IAnyGroupIWindow<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 IAnyGroupIWindow<I> ofMode​(IWindow.Mode mode)
        Returns the instance with the given mode.
        Parameters:
        mode - The mode to overlapped, popup, modal, embedded or highlighted