Class UITools

java.lang.Object
de.hybris.platform.cockpit.util.UITools

public final class UITools extends Object
  • Field Details

  • Method Details

    • setTooltipText

      public static boolean setTooltipText(org.zkoss.zk.ui.Component component, String text)
    • applyLazyload

      public static void applyLazyload(org.zkoss.zk.ui.HtmlBasedComponent component)
      Converts a component with appended children into a lazyload component, i.e. the children will be added successively later.
      Parameters:
      component - the component
    • getCurrentZKRoot

      public static org.zkoss.zk.ui.Component getCurrentZKRoot()
    • addDragHoverClickEventListener

      public static void addDragHoverClickEventListener(org.zkoss.zul.impl.XulElement component, org.zkoss.zk.ui.event.EventListener eventListener, int timeout, String dragID)
      Add "drag hover click" feature to a component, i.e. the component will receive an event with name ON_DRAG_HOVER_CLICKED if the mouse cursor stays over component for a specified time while dragging a component with the specified dragID.
      Parameters:
      component - the component
      eventListener - you can specify an EventListener which reacts on the ON_DRAG_HOVER_CLICKED event or leave it null, if you want to add it later.
      timeout - the time the cursor has to stay over component, in milliseconds
      dragID - the drag id of the component, which triggers the event
    • getZKPreference

      public static String getZKPreference(String key)
      Get a preference value set in zk.xml. Can be overwritten by entries in project.properties/local.properties.
      Parameters:
      key - the preference key
      Returns:
      the preference value
    • cleanupFCKEditorIframeGhosts

      public static void cleanupFCKEditorIframeGhosts()
    • clearBrowserTextSelection

      public static void clearBrowserTextSelection()
    • applyTestID

      public static void applyTestID(org.zkoss.zk.ui.Component component, String id)
    • applyTestID

      public static void applyTestID(org.zkoss.zk.ui.Component component, TestIdContext ctx)
      Applies a test id to a Component according to the specified TestIdContext if test id mechanism is enabled.
      Parameters:
      component - The ZK component on which the id should be applied.
      ctx - A context which usually specifies the environment of the component
    • resizeBorderLayout

      public static void resizeBorderLayout(org.zkoss.zk.ui.Component comp, boolean allParents)
    • invalidateNextLayoutregion

      public static void invalidateNextLayoutregion(org.zkoss.zk.ui.Component comp)
    • maximize

      public static void maximize(org.zkoss.zk.ui.HtmlBasedComponent component)
    • detachChildren

      public static void detachChildren(org.zkoss.zk.ui.Component parent)
    • getNextParentOfType

      public static <T extends org.zkoss.zk.ui.Component> T getNextParentOfType(Class clazz, org.zkoss.zk.ui.Component child, int maxDepth)
    • invalidateGroupbox

      public static void invalidateGroupbox(org.zkoss.zk.ui.Component child)
    • different

      public static boolean different(Object object1, Object object2)
    • createGridSkeleton

      public static org.zkoss.zul.Grid createGridSkeleton(int columnsnumber)
    • modifySClass

      public static void modifySClass(org.zkoss.zk.ui.HtmlBasedComponent component, String className, boolean add)
      Adds or removes a style class to the components style classes.
      Parameters:
      component - the component to change style classes
      className - the class name
      add - adding or removing the class
    • modifySClass

      public static void modifySClass(org.zkoss.zhtml.impl.AbstractTag component, String className, boolean add)
    • modifyStyle

      public static void modifyStyle(org.zkoss.zk.ui.HtmlBasedComponent component, String key, String value)
    • modifyStyle

      public static void modifyStyle(org.zkoss.zhtml.impl.AbstractTag component, String key, String value)
    • isFromOtherDesktop

      public static boolean isFromOtherDesktop(org.zkoss.zk.ui.Component comp)
    • toColl

      public static Collection<Object> toColl(Object object)
    • isParent

      public static boolean isParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component child)
    • getAdjustedUrl

      public static String getAdjustedUrl(String url)
    • isUrlAbsolute

      public static boolean isUrlAbsolute(String url)
    • showNoPermissionMessage

      public static void showNoPermissionMessage()
    • searchForLabel

      public static List<String> searchForLabel(Object obj, Method method, Collection<LanguageModel> firstPrioLanguages) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException
      Throws:
      InvocationTargetException
      IllegalArgumentException
      IllegalAccessException
    • forceRenderCombobox

      public static void forceRenderCombobox(org.zkoss.zul.Combobox comboBox, org.zkoss.zul.ComboitemRenderer renderer, Collection<? extends Object> model)
      Comboboxes usually aren't rendered until ZK's event processing phase. However, it might be necessary to be able to access the children in an earlier stage of the life cycle. This method forces the addition and rendering of a Combobox' children.
      Parameters:
      comboBox - the combobox which children are to be rendered
      renderer - the renderer to use for rendering the children
      model - the the data to be rendered
    • getLocalDate

      public static String getLocalDate(Date date)
    • getLocalDateTime

      public static String getLocalDateTime(Date date)
    • addBusyListener

      public static void addBusyListener(org.zkoss.zk.ui.Component component, String evtnm, org.zkoss.zk.ui.event.EventListener listener, String data, String i3BusyMessage)
      Adds a event listener to a component. A busy user message is shown while the event callback is processed.
      Parameters:
      component - the zk component to which the event listener should be added
      evtnm - the event name
      listener - the event listener
      data - additional data
      i3BusyMessage - the i3 label code or null for default busy message
    • performDoubleClickDelay

      public static void performDoubleClickDelay(org.zkoss.zk.ui.WebApp webApp)
    • getWebAppName

      public static String getWebAppName(org.zkoss.zk.ui.Execution execution)
    • getWebAppName

      public static String getWebAppName(org.zkoss.zk.ui.Desktop desktop)
    • getCockpitParameter

      public static String getCockpitParameter(String key, org.zkoss.zk.ui.Desktop desktop)
      Returns a config parameter for the current cockpit. If it doesn't exist, this method tries to get the default cockpit parameter. Example: For wysiwyg editors toolbar configuration you can specify the key "default.fckToolbarConfig". If you are in cmscockpit, this method looks for the key "cmscockpit.default.fckToolbarConfig". If it doesn't find it, it returns the value for "cockpit.default.fckToolbarConfig".
      Parameters:
      key - the key without cockpit prefix
      desktop - the current desktop
      Returns:
      the value, can be null
    • getCockpitParameter

      public static String getCockpitParameter(String key, org.zkoss.zk.ui.Execution execution)
      Returns a config parameter for the current cockpit. If it doesn't exist, this method tries to get the default cockpit parameter. Example: For wysiwyg editors toolbar configuration you can specify the key "default.fckToolbarConfig". If you are in cmscockpit, this method looks for the key "cmscockpit.default.fckToolbarConfig". If it doesn't find it, it returns the value for "cockpit.default.fckToolbarConfig".
      Parameters:
      key - the key without cockpit prefix
      execution - the current execution
      Returns:
      the value, can be null
    • addMacCommandClickListener

      public static void addMacCommandClickListener(org.zkoss.zul.impl.XulElement component)
    • setComponentWidths

      public static void setComponentWidths(String[] widths, org.zkoss.zk.ui.HtmlBasedComponent... comps)
    • invalidateAllPortallayouts

      public static void invalidateAllPortallayouts()
    • removeHtml

      public static String removeHtml(String html)
    • removeEventListenersForComponent

      public static void removeEventListenersForComponent(String eventType, org.zkoss.zk.ui.Component component)
    • scrollIntoViewIfNeeded

      public static void scrollIntoViewIfNeeded(org.zkoss.zk.ui.Component component, org.zkoss.zk.ui.Component scrollContainer)
      Same as scrollIntoViewIfNeeded(Component, Component, int) with '0' as last argument.
    • scrollIntoViewIfNeeded

      public static void scrollIntoViewIfNeeded(org.zkoss.zk.ui.Component component, org.zkoss.zk.ui.Component scrollContainer, int childDepth)
      Checks if the component is outside the scrollcontainers parent (i.e. not visible) and if so calls scrollIntoView.
      Parameters:
      component - the component that should be made visible.
      scrollContainer - the component that possesses the scrollbar
      childDepth - if the scrollContainer doesn't have scrollbars itself but one of its html child components that are not accessible in java, you can specify a number how often "firstChild" will be appended to fetch the real scrollcontainer.
    • updateMediaModel

      public static void updateMediaModel(MediaModel currentMediaModel, org.zkoss.util.media.Media mediaContent, MediaService mediaService)
    • searchRestrictionsDisabledInCockpit

      public static boolean searchRestrictionsDisabledInCockpit()
    • setManagedEventListener

      public static boolean setManagedEventListener(org.zkoss.zk.ui.Component component, String evtnm, org.zkoss.zk.ui.event.EventListener listener)
      Adds and replaces an EventListener at a Component. The method Component.addEventListener(String, EventListener) doesn't allow to replace an EventListener, if you call it twice, the second call will be ignored. You have to remove the EventListener instance manually by invoking Component.removeEventListener(String, EventListener) but you have to know the EventListener instance.
      This method allows you to replace the previous added EventListener without knowing it, as long as it was also added by this method.
      Parameters:
      component - the component the listener should be added to.
      evtnm - the event name.
      listener - the event listener.
      Returns:
      true, if the listener could be added successfully or false, if another listener was already registered for the component and couldn't be removed.