public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static String |
arrayToString(Object[] ary)
Converts an array of objects to a string, by concatenating them
together and separated with comma.
|
static org.zkoss.zk.ui.Component |
getComponentById(org.zkoss.zk.ui.Component comp,
String id)
Returns the component of the specified ID or UUID.
|
static String |
getDynamicMediaURI(org.zkoss.zk.ui.AbstractComponent comp,
int version,
String name,
String format)
Returns the encoded URL for the dynamic generated content, or empty
the component doesn't belong to any desktop.
|
static int |
getIntAttribute(org.zkoss.zk.ui.Component comp,
String name,
int defValue,
boolean recurse)
Returns the number if the given attribute is defined in a component or in library property.
|
static String |
intsToString(int[] ary)
Converts an array of numbers to a string.
|
static String |
outFeature()
Generates the ZK feature information
|
static String |
outLocaleJavaScript()
Generates the locale-dependent JavaScript codes, such as messages
(msgzul).
|
static void |
renderCrawlableA(String href,
String label)
Render the crawlable HTML A tag.
|
static void |
renderCrawlableText(String text)
Render the crawlable text.
|
static String[] |
stringToArray(String src,
String defaultValue)
Parse a list of numbers.
|
static int[] |
stringToInts(String numbers,
int defaultValue)
Parse a list of numbers.
|
static boolean |
testAttribute(org.zkoss.zk.ui.Component comp,
String name,
boolean defValue,
boolean recurse)
Tests if the given attribute is defined in a component or in library property.
|
public static final int[] stringToInts(String numbers, int defaultValue) throws org.zkoss.zk.ui.WrongValueException
defaultValue
- the value if a number is omitted. For example, ",2"
means "1,2" if defafultValue is 1org.zkoss.zk.ui.WrongValueException
public static final String intsToString(int[] ary)
public static final String[] stringToArray(String src, String defaultValue)
defaultValue
- the value used if an empty string is fund.
For example, ",2" means "1,2" if defafultValue is "1"public static final String arrayToString(Object[] ary)
public static String getDynamicMediaURI(org.zkoss.zk.ui.AbstractComponent comp, int version, String name, String format)
public static final String outFeature()
public static final String outLocaleJavaScript()
It is called by zul/lang/zk.wpd.
public static void renderCrawlableA(String href, String label) throws IOException
href
- the hyper link. If null or empty, nothing is generated.label
- the label to show. Empty is assumed if null.IOException
public static void renderCrawlableText(String text) throws IOException
text
- the text that is crawlable.
If null or empty, nothing is generated.IOException
public static org.zkoss.zk.ui.Component getComponentById(org.zkoss.zk.ui.Component comp, String id)
uuid(comp_uuid)
.public static final boolean testAttribute(org.zkoss.zk.ui.Component comp, String name, boolean defValue, boolean recurse)
name
- the name of the attributedefValue
- the default value if neither component's attribute or library property is defined
for the given namerecurse
- whether to look up the ancestor's attributepublic static final int getIntAttribute(org.zkoss.zk.ui.Component comp, String name, int defValue, boolean recurse)
name
- the name of the attributedefValue
- the default value if neither component's attribute or library property is defined
for the given namerecurse
- whether to look up the ancestor's attributeCopyright © 2017. All rights reserved.