Class LayoutUtils


  • public final class LayoutUtils
    extends Object
    Author:
    Low Heng Sin
    • Constructor Summary

      Constructors 
      Constructor Description
      LayoutUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void addSclass​(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)  
      static void addSlideSclass​(org.zkoss.zul.LayoutRegion region)
      enable slide sclass ( when slide out ) for collapsible region
      static void autoDetachOnClose​(org.zkoss.zul.Popup popup)
      call popup.detach when it is close
      static void compactTo​(org.zkoss.zul.Grid grid, int limit)
      Compact grid to limit (for e.g, to max of 2 column) Note: doesn't handle row span
      static void expandTo​(org.zkoss.zul.Grid grid, int min)  
      static void expandTo​(org.zkoss.zul.Grid grid, int min, boolean fillWithSpace)
      Expand grid to min (for e.g, to min of 2 column) Note: doesn't handle row span
      static ISupportMask findMaskParent​(org.zkoss.zk.ui.Component child, Class<?> parentClass)
      find parent control of child control, parent must implement ISupportMask if parentClass !
      static org.zkoss.zul.Popup findPopup​(org.zkoss.zk.ui.Component comp)
      find popup ancestor of comp
      static boolean hasSclass​(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)  
      static boolean isReallyVisible​(org.zkoss.zk.ui.Component component)  
      static org.zkoss.zk.ui.Component makeRightAlign​(Label label)  
      static void openEmbeddedWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open embedded window relative to the ref component
      static void openHighlightedWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open highlighted window relative to the ref component
      static void openOverlappedWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open popup window relative to the ref component
      static void openPopupWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window)  
      static void openPopupWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, int delayMs)
      open popup window overlapping the ref component
      static void openPopupWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)  
      static void openPopupWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position, int delayMs)
      open popup window relative to the ref component
      static void positionWindow​(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      position opened window relative to the ref component
      static void redraw​(org.zkoss.zk.ui.AbstractComponent component)  
      static void removeSclass​(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)  
      static void sameWidth​(org.zkoss.zk.ui.HtmlBasedComponent target, org.zkoss.zk.ui.HtmlBasedComponent ref)
      set target same width as ref using client side script
      static void sendDeferLayoutEvent​(org.zkoss.zul.Borderlayout layout, int timeout)
      Deprecated.
      protected static void showWindowWithMask​(org.zkoss.zul.Window window, ISupportMask mask)
      Show window in center of component
      static ISupportMask showWindowWithMask​(org.zkoss.zul.Window window, org.zkoss.zk.ui.Component childOfOwn, int ownModel)
      show window with a mask below. mask over tabPanel, all window or only over a control, dependency ownModel flag.
      static Mask showWindowWithMask​(org.zkoss.zul.Window window, org.zkoss.zk.ui.Component ownWindow, Mask mask)
      Show window over ownWindow with a mask, use when ownWindow isn't implement ISupportMask
    • Constructor Detail

      • LayoutUtils

        public LayoutUtils()
    • Method Detail

      • sendDeferLayoutEvent

        @Deprecated
        public static void sendDeferLayoutEvent​(org.zkoss.zul.Borderlayout layout,
                                                int timeout)
        Deprecated.
        Parameters:
        layout -
      • addSclass

        public static void addSclass​(String cls,
                                     org.zkoss.zk.ui.HtmlBasedComponent target)
        Parameters:
        cls -
        target -
      • hasSclass

        public static boolean hasSclass​(String cls,
                                        org.zkoss.zk.ui.HtmlBasedComponent target)
        Parameters:
        cls -
        target -
        Returns:
        boolean
      • makeRightAlign

        public static org.zkoss.zk.ui.Component makeRightAlign​(Label label)
        Parameters:
        label -
        Returns:
        wrapped label
      • openPopupWindow

        public static void openPopupWindow​(org.zkoss.zk.ui.Component ref,
                                           org.zkoss.zul.Window window)
      • openPopupWindow

        public static void openPopupWindow​(org.zkoss.zk.ui.Component ref,
                                           org.zkoss.zul.Window window,
                                           int delayMs)
        open popup window overlapping the ref component
        Parameters:
        ref -
        window -
      • openPopupWindow

        public static void openPopupWindow​(org.zkoss.zk.ui.Component ref,
                                           org.zkoss.zul.Window window,
                                           String position)
      • openPopupWindow

        public static void openPopupWindow​(org.zkoss.zk.ui.Component ref,
                                           org.zkoss.zul.Window window,
                                           String position,
                                           int delayMs)
        open popup window relative to the ref component
        Parameters:
        ref -
        window -
        position -
      • openOverlappedWindow

        public static void openOverlappedWindow​(org.zkoss.zk.ui.Component ref,
                                                org.zkoss.zul.Window window,
                                                String position)
        open popup window relative to the ref component
        Parameters:
        ref -
        window -
        position -
      • positionWindow

        public static void positionWindow​(org.zkoss.zk.ui.Component ref,
                                          org.zkoss.zul.Window window,
                                          String position)
        position opened window relative to the ref component
        Parameters:
        ref -
        window -
        position -
      • openEmbeddedWindow

        public static void openEmbeddedWindow​(org.zkoss.zk.ui.Component ref,
                                              org.zkoss.zul.Window window,
                                              String position)
        open embedded window relative to the ref component
        Parameters:
        ref -
        window -
        position -
      • openHighlightedWindow

        public static void openHighlightedWindow​(org.zkoss.zk.ui.Component ref,
                                                 org.zkoss.zul.Window window,
                                                 String position)
        open highlighted window relative to the ref component
        Parameters:
        ref -
        window -
        position -
      • redraw

        public static void redraw​(org.zkoss.zk.ui.AbstractComponent component)
        Parameters:
        component -
      • isReallyVisible

        public static boolean isReallyVisible​(org.zkoss.zk.ui.Component component)
        Parameters:
        component -
        Returns:
        true if the component and all its parent are visible
      • removeSclass

        public static void removeSclass​(String cls,
                                        org.zkoss.zk.ui.HtmlBasedComponent target)
      • showWindowWithMask

        public static ISupportMask showWindowWithMask​(org.zkoss.zul.Window window,
                                                      org.zkoss.zk.ui.Component childOfOwn,
                                                      int ownModel)
        show window with a mask below. mask over tabPanel, all window or only over a control, dependency ownModel flag. when ownModel == OVERLAP_SELF, window show overlap childOfOwn, when childOfOwn isn't implement ISupportMask make new Mask object to make mask layout ownModel == OVERLAP_ALL_PAGE, window show overlap all page ownModel == OVERLAP_TAB_PANEL, window show overlap tabPanel ownModel == OVERLAP_PARENT, search near parent of childOfOwn implement ISupportMask if not exist user as OVERLAP_ALL_PAGE
        Parameters:
        window -
        childOfOwn -
        ownModel -
        Returns:
        when show success return IMask object, it is own window, use ISupportMask.hideMask() to hidden mask. other return null.
      • showWindowWithMask

        protected static void showWindowWithMask​(org.zkoss.zul.Window window,
                                                 ISupportMask mask)
        Show window in center of component
        Parameters:
        window -
        mask -
      • showWindowWithMask

        public static Mask showWindowWithMask​(org.zkoss.zul.Window window,
                                              org.zkoss.zk.ui.Component ownWindow,
                                              Mask mask)
        Show window over ownWindow with a mask, use when ownWindow isn't implement ISupportMask
        Parameters:
        window -
        ownWindow -
        mask - if mask = null, make new and return it
        Returns:
        Mask objec for hiden mask when close window.
      • findMaskParent

        public static ISupportMask findMaskParent​(org.zkoss.zk.ui.Component child,
                                                  Class<?> parentClass)
        find parent control of child control, parent must implement ISupportMask if parentClass != null, parent class must extends parentClass
        Parameters:
        child -
        parentClass -
        Returns:
      • compactTo

        public static void compactTo​(org.zkoss.zul.Grid grid,
                                     int limit)
        Compact grid to limit (for e.g, to max of 2 column) Note: doesn't handle row span
        Parameters:
        grid -
        limit -
      • expandTo

        public static void expandTo​(org.zkoss.zul.Grid grid,
                                    int min)
      • expandTo

        public static void expandTo​(org.zkoss.zul.Grid grid,
                                    int min,
                                    boolean fillWithSpace)
        Expand grid to min (for e.g, to min of 2 column) Note: doesn't handle row span
        Parameters:
        grid -
        min -
        fillWithSpace - if true, fill up row with space instead of moving element from next row
      • addSlideSclass

        public static void addSlideSclass​(org.zkoss.zul.LayoutRegion region)
        enable slide sclass ( when slide out ) for collapsible region
        Parameters:
        region -
      • findPopup

        public static org.zkoss.zul.Popup findPopup​(org.zkoss.zk.ui.Component comp)
        find popup ancestor of comp
        Parameters:
        comp -
        Returns:
        Popup if comp or one of its ancestor is Popup
      • autoDetachOnClose

        public static void autoDetachOnClose​(org.zkoss.zul.Popup popup)
        call popup.detach when it is close
        Parameters:
        popup -
      • sameWidth

        public static void sameWidth​(org.zkoss.zk.ui.HtmlBasedComponent target,
                                     org.zkoss.zk.ui.HtmlBasedComponent ref)
        set target same width as ref using client side script
        Parameters:
        target -
        ref -