public final class UITools extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DOTS |
static String |
EVENT_ON_LOOPBACK |
static Pattern |
URL_EXTENSION_PATTERN |
| Modifier and Type | Method and Description |
|---|---|
static void |
addSClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className)
Adds a style class to the components style classes.
|
static void |
addStyle(org.zkoss.zk.ui.HtmlBasedComponent component,
String property,
String value)
Adds a style to the components style properties.
|
static String |
adjustURL(String url)
Deprecated.
since 1808, the method was used to provide paths to medias that were directly served. Currently each web
application should be able to serve medias through appropriate servlet. This allows for secure access.
|
static <CMP extends org.zkoss.zk.ui.Component> |
appendChildIfNeeded(org.zkoss.zk.ui.Component parent,
int childIndex,
Predicate<org.zkoss.zk.ui.Component> childRequirement,
Supplier<CMP> newChildSupplier)
Method checks if component on specified index in available in children list and meets provided requirement.
|
static String |
extractExtension(String url) |
static boolean |
isUrlAbsolute(String url) |
static void |
modifySClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className,
boolean add)
Adds or removes a style class to the components style classes.
|
static void |
postponeExecution(org.zkoss.zk.ui.Component parent,
Executable executable)
Executes specified
Executable in next UI processing iteration. |
static void |
removeAllEventListeners(org.zkoss.zk.ui.AbstractComponent component,
String eventName)
Removes all event listener of the given type from the given component.
|
static void |
removeSClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className)
Removes a style class from the components style classes.
|
static void |
removeStyle(org.zkoss.zk.ui.HtmlBasedComponent component,
String property)
Removes a style from the components style properties.
|
static String |
truncateText(String text,
int maxLength)
Truncates the text with default append of "...".
|
static String |
truncateText(String text,
int maxLength,
String append)
Truncates the input text to be no longer than the specified maximal length.
|
public static final String EVENT_ON_LOOPBACK
public static final Pattern URL_EXTENSION_PATTERN
public static final String DOTS
public static void addSClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className)
component - the component to change style classesclassName - the class namepublic static void removeSClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className)
component - the component to change style classesclassName - the class namepublic static void modifySClass(org.zkoss.zk.ui.HtmlBasedComponent component,
String className,
boolean add)
component - the component to change style classesclassName - the class nameadd - adding or removing the classpublic static void addStyle(org.zkoss.zk.ui.HtmlBasedComponent component,
String property,
String value)
component - the component to change style propretiesproperty - style propertyvalue - value of style propertypublic static void removeStyle(org.zkoss.zk.ui.HtmlBasedComponent component,
String property)
component - the component to change style propertiesproperty - style property@Deprecated public static String adjustURL(String url)
url - the URL to be adjustedpublic static boolean isUrlAbsolute(String url)
url - url to be checkedpublic static String truncateText(String text, int maxLength)
text - Text to be optionally truncated.maxLength - Maximal length of the output text.truncateText(java.lang.String, int, java.lang.String)public static String truncateText(String text, int maxLength, String append)
text - Text to be optionally truncated.maxLength - Maximal length of the output text.append - Text to be appended to the result in case when the input text needs to be shortened. The length of the
appended text is calculated to its total length i.e. length of trimmed text plus length of appended text is
less or equal to the maxLength.public static void postponeExecution(org.zkoss.zk.ui.Component parent,
Executable executable)
Executable in next UI processing iteration.
Method may be used to assure that particular logic is executed after all UI updates related to request are already performed and finished.
parent - any DOM element that belongs to a Desktop which UI processing iteration should be
usedexecutable - operation to be scheduledpublic static void removeAllEventListeners(org.zkoss.zk.ui.AbstractComponent component,
String eventName)
component - Component from which the listeners should be removedeventName - Event type for which the listeners should be removedpublic static <CMP extends org.zkoss.zk.ui.Component> CMP appendChildIfNeeded(org.zkoss.zk.ui.Component parent,
int childIndex,
Predicate<org.zkoss.zk.ui.Component> childRequirement,
Supplier<CMP> newChildSupplier)
CMP - type of child expectedparent - component which child is requestedchildIndex - index on which a child should be availablechildRequirement - if a any child is available at provided index, it is checked against this requirement and replace with new,
if not meetnewChildSupplier - if a child does not exist on specified index or does not meet a requirement, then new child is obtained
from this supplierIllegalArgumentException - if provided index is lower then actual number of children - new child cannot be added on specified indexCopyright © 2018. All rights reserved.