Package de.hybris.platform.cockpit.util
Class UITools
java.lang.Object
de.hybris.platform.cockpit.util.UITools
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddBusyListener(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.static voidaddDragHoverClickEventListener(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.static voidaddMacCommandClickListener(org.zkoss.zul.impl.XulElement component) static voidapplyLazyload(org.zkoss.zk.ui.HtmlBasedComponent component) Converts a component with appended children into a lazyload component, i.e.static voidapplyTestID(org.zkoss.zk.ui.Component component, TestIdContext ctx) Applies a test id to aComponentaccording to the specifiedTestIdContextif test id mechanism is enabled.static voidapplyTestID(org.zkoss.zk.ui.Component component, String id) static voidstatic voidstatic org.zkoss.zul.GridcreateGridSkeleton(int columnsnumber) static voiddetachChildren(org.zkoss.zk.ui.Component parent) static booleanstatic voidforceRenderCombobox(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.static StringgetAdjustedUrl(String url) static StringgetCockpitParameter(String key, org.zkoss.zk.ui.Desktop desktop) Returns a config parameter for the current cockpit.static StringgetCockpitParameter(String key, org.zkoss.zk.ui.Execution execution) Returns a config parameter for the current cockpit.static org.zkoss.zk.ui.Componentstatic StringgetLocalDate(Date date) static StringgetLocalDateTime(Date date) static <T extends org.zkoss.zk.ui.Component>
TgetNextParentOfType(Class clazz, org.zkoss.zk.ui.Component child, int maxDepth) static StringgetWebAppName(org.zkoss.zk.ui.Desktop desktop) static StringgetWebAppName(org.zkoss.zk.ui.Execution execution) static StringgetZKPreference(String key) Get a preference value set in zk.xml.static voidstatic voidinvalidateGroupbox(org.zkoss.zk.ui.Component child) static voidinvalidateNextLayoutregion(org.zkoss.zk.ui.Component comp) static booleanisFromOtherDesktop(org.zkoss.zk.ui.Component comp) static booleanisParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component child) static booleanisUrlAbsolute(String url) static voidmaximize(org.zkoss.zk.ui.HtmlBasedComponent component) static voidmodifySClass(org.zkoss.zhtml.impl.AbstractTag component, String className, boolean add) static voidmodifySClass(org.zkoss.zk.ui.HtmlBasedComponent component, String className, boolean add) Adds or removes a style class to the components style classes.static voidmodifyStyle(org.zkoss.zhtml.impl.AbstractTag component, String key, String value) static voidmodifyStyle(org.zkoss.zk.ui.HtmlBasedComponent component, String key, String value) static voidperformDoubleClickDelay(org.zkoss.zk.ui.WebApp webApp) static voidremoveEventListenersForComponent(String eventType, org.zkoss.zk.ui.Component component) static StringremoveHtml(String html) static voidresizeBorderLayout(org.zkoss.zk.ui.Component comp, boolean allParents) static voidscrollIntoViewIfNeeded(org.zkoss.zk.ui.Component component, org.zkoss.zk.ui.Component scrollContainer) Same asscrollIntoViewIfNeeded(Component, Component, int)with '0' as last argument.static voidscrollIntoViewIfNeeded(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.searchForLabel(Object obj, Method method, Collection<LanguageModel> firstPrioLanguages) static booleanstatic voidsetComponentWidths(String[] widths, org.zkoss.zk.ui.HtmlBasedComponent... comps) static booleansetManagedEventListener(org.zkoss.zk.ui.Component component, String evtnm, org.zkoss.zk.ui.event.EventListener listener) Adds and replaces anEventListenerat aComponent.static booleansetTooltipText(org.zkoss.zk.ui.Component component, String text) static voidstatic Collection<Object>static voidupdateMediaModel(MediaModel currentMediaModel, org.zkoss.util.media.Media mediaContent, MediaService mediaService)
-
Field Details
-
TEST_ID_BUILDER_REGISTRY
- See Also:
-
ON_DRAG_HOVER_CLICKED
- See Also:
-
-
Method Details
-
setTooltipText
-
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 nameON_DRAG_HOVER_CLICKEDif the mouse cursor stays over component for a specified time while dragging a component with the specified dragID.- Parameters:
component- the componenteventListener- you can specify anEventListenerwhich reacts on theON_DRAG_HOVER_CLICKEDevent or leave it null, if you want to add it later.timeout- the time the cursor has to stay over component, in millisecondsdragID- the drag id of the component, which triggers the event
-
getZKPreference
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
-
applyTestID
Applies a test id to aComponentaccording to the specifiedTestIdContextif 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
-
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 classesclassName- the class nameadd- adding or removing the class
-
modifySClass
public static void modifySClass(org.zkoss.zhtml.impl.AbstractTag component, String className, boolean add) -
modifyStyle
-
modifyStyle
-
isFromOtherDesktop
public static boolean isFromOtherDesktop(org.zkoss.zk.ui.Component comp) -
toColl
-
isParent
public static boolean isParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component child) -
getAdjustedUrl
-
isUrlAbsolute
-
showNoPermissionMessage
public static void showNoPermissionMessage() -
searchForLabel
public static List<String> searchForLabel(Object obj, Method method, Collection<LanguageModel> firstPrioLanguages) 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 aCombobox' children.- Parameters:
comboBox- the combobox which children are to be renderedrenderer- the renderer to use for rendering the childrenmodel- the the data to be rendered
-
getLocalDate
-
getLocalDateTime
-
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 addedevtnm- the event namelistener- the event listenerdata- additional datai3BusyMessage- the i3 label code or null for default busy message
-
performDoubleClickDelay
public static void performDoubleClickDelay(org.zkoss.zk.ui.WebApp webApp) -
getWebAppName
-
getWebAppName
-
getCockpitParameter
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 prefixdesktop- the current desktop- Returns:
- the value, can be null
-
getCockpitParameter
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 prefixexecution- the current execution- Returns:
- the value, can be null
-
addMacCommandClickListener
public static void addMacCommandClickListener(org.zkoss.zul.impl.XulElement component) -
setComponentWidths
-
invalidateAllPortallayouts
public static void invalidateAllPortallayouts() -
removeHtml
-
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 asscrollIntoViewIfNeeded(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 scrollbarchildDepth- 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 anEventListenerat aComponent. The methodComponent.addEventListener(String, EventListener)doesn't allow to replace anEventListener, if you call it twice, the second call will be ignored. You have to remove theEventListenerinstance manually by invokingComponent.removeEventListener(String, EventListener)but you have to know theEventListenerinstance.
This method allows you to replace the previous addedEventListenerwithout 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.
-