Class LayoutUtils

java.lang.Object
org.adempiere.webui.LayoutUtils

public final class LayoutUtils extends Object
Some static UI helper methods
Author:
Low Heng Sin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addSclass(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)
    append cls to target's sclass property
    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)
    Auto call popup.detach when popup 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)
    Expand number of grid column to min (for e.g, to min of 2 column)
    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
    findMaskParent(org.zkoss.zk.ui.Component child, Class<?> parentClass)
    find nearest parent of child component that implement ISupportMask.
    if parentClass !
    static org.zkoss.zul.Popup
    findPopup(org.zkoss.zk.ui.Component comp)
    find first 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
    create right align label (wrapped in div)
    static void
    openEmbeddedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    open embedded window relative to ref component
    static void
    openHighlightedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    open highlighted window relative to ref component
    static void
    openModalWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    open popup window relative to the ref component
    static void
    openOverlappedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    open overlapped window (mode overlapped) relative to ref component
    static void
    openPopupWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window)
    open popup window overlapping ref component
    static void
    openPopupWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, int delayMs)
    open popup window overlapping ref component
    static void
    openPopupWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    open popup window relative to ref component
    static void
    openPopupWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position, int delayMs)
    open popup window relative to ref component
    static void
    positionComponent(org.zkoss.zk.ui.Component ref, org.zkoss.zk.ui.Component component, String position)
    position component relative to ref component
    static void
    positionWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
    position opened window relative to ref component
    static void
    redraw(org.zkoss.zk.ui.AbstractComponent component)
    Force redraw of component
    static void
    removeSclass(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)
    Remove cls from target's sclass property
    static void
    sameWidth(org.zkoss.zk.ui.HtmlBasedComponent target, org.zkoss.zk.ui.HtmlBasedComponent ref)
    Make target same width as ref using client side script
    static void
    sendDeferLayoutEvent(org.zkoss.zul.Borderlayout layout, int timeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    protected static void
    showWindowWithMask(org.zkoss.zul.Window window, ISupportMask mask)
    Show window in center of mask
    showWindowWithMask(org.zkoss.zul.Window window, org.zkoss.zk.ui.Component childOfOwn, int ownModel)
    show window with a mask below.
    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 doesn't implement ISupportMask

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • LayoutUtils

      public LayoutUtils()
  • Method Details

    • sendDeferLayoutEvent

      @Deprecated(forRemoval=true, since="11") public static void sendDeferLayoutEvent(org.zkoss.zul.Borderlayout layout, int timeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      layout -
    • addSclass

      public static void addSclass(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)
      append cls to target's sclass property
      Parameters:
      cls -
      target -
    • hasSclass

      public static boolean hasSclass(String cls, org.zkoss.zk.ui.HtmlBasedComponent target)
      Parameters:
      cls -
      target -
      Returns:
      true if target's sclass property contain cls
    • makeRightAlign

      public static org.zkoss.zk.ui.Component makeRightAlign(Label label)
      create right align label (wrapped in div)
      Parameters:
      label -
      Returns:
      right align label (wrapped in div)
    • openPopupWindow

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

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

      public static void openPopupWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open popup window relative to ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • 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 ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
      delayMs -
    • openOverlappedWindow

      public static void openOverlappedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open overlapped window (mode overlapped) relative to ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • openModalWindow

      public static void openModalWindow(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 ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • positionComponent

      public static void positionComponent(org.zkoss.zk.ui.Component ref, org.zkoss.zk.ui.Component component, String position)
      position component relative to ref component
      Parameters:
      ref -
      component -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • openEmbeddedWindow

      public static void openEmbeddedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open embedded window relative to ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • openHighlightedWindow

      public static void openHighlightedWindow(org.zkoss.zk.ui.Component ref, org.zkoss.zul.Window window, String position)
      open highlighted window relative to ref component
      Parameters:
      ref -
      window -
      position - Refer to https://www.zkoss.org/javadoc/latest/jsdoc/_global_/jqzk.html#position-_global_.Dimension-_global_.String-_global_.Map-
    • redraw

      public static void redraw(org.zkoss.zk.ui.AbstractComponent component)
      Force redraw of 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)
      Remove cls from target's sclass property
      Parameters:
      cls -
      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. Depends on ownModel flag, mask is shown over tabPanel, all window or over a component.
       when ownModel is
       - OVERLAP_SELF, mask childOfOwn. if childOfOwn doesn't implement ISupportMask, make new Mask object to mask it
       - OVERLAP_ALL_PAGE, window show overlap all page
       - OVERLAP_TAB_PANEL, window show overlap tabPanel
       - OVERLAP_PARENT, search nearest parent of childOfOwn that implement ISupportMask, if not found use as OVERLAP_ALL_PAGE
       
      Parameters:
      window -
      childOfOwn - Component below window
      ownModel - OVERLAP_TAB_PANEL, OVERLAP_ALL_PAGE, OVERLAP_PARENT or OVERLAP_SELF
      Returns:
      when show success return ISupportMask object, use ISupportMask.hideMask() to hide mask.
    • showWindowWithMask

      protected static void showWindowWithMask(org.zkoss.zul.Window window, ISupportMask mask)
      Show window in center of mask
      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 doesn't implement ISupportMask
      Parameters:
      window -
      ownWindow -
      mask - if mask = null, make new and return it
      Returns:
      Mask object for hidden mask when close window.
    • findMaskParent

      public static ISupportMask findMaskParent(org.zkoss.zk.ui.Component child, Class<?> parentClass)
      find nearest parent of child component that implement ISupportMask.
      if parentClass != null, parent class must extends parentClass
      Parameters:
      child -
      parentClass -
      Returns:
      ISupportMask
    • 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)
      Expand number of grid column to min (for e.g, to min of 2 column)
      Parameters:
      grid -
      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 first 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)
      Auto call popup.detach when popup is close
      Parameters:
      popup -
    • sameWidth

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