com.sencha.gxt.core.client.util
Class Util

java.lang.Object
  extended by com.sencha.gxt.core.client.util.Util

public class Util
extends java.lang.Object

Various utility functions.


Constructor Summary
Util()
           
 
Method Summary
static int constrain(int value, int min, int max)
          Constrains the value by a minimum and max value.
static
<T> java.util.List<T>
createList(T... element)
          Creates a new list and adds the element(s).
static boolean equalWithNull(java.lang.Object obj1, java.lang.Object obj2)
          Does an equals check by first checking identity, then equality.
static
<T> void
fill(java.util.List<T> list, T[] elements)
          Populates a list with an array of elements.
static Element getImage(ImageResource ir)
          Returns an element for the given image.
static boolean isEmptyString(java.lang.String string)
          Returns true if the string is null or equals to the empty string.
static boolean isInteger(java.lang.String value)
          Tests if the value is an integer.
static int parseInt(java.lang.String value, int defaultValue)
          Parses a string value and returns an integer.
static Style.Overflow parseOverflow(java.lang.String value)
          Parses a string value and returns the applicable Style.Overflow object.
static Element[] toElementArray(java.util.List<Element> nodes)
          Converts a node list to an element array.
static Element[] toElementArray(NodeList<Element> nodes)
          Converts a node list to an element array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

constrain

public static int constrain(int value,
                            int min,
                            int max)
Constrains the value by a minimum and max value.

Parameters:
value - the value
min - the minimum
max - the maximum
Returns:
the adjusted value

createList

public static <T> java.util.List<T> createList(T... element)
Creates a new list and adds the element(s).

Parameters:
element - the item to add to the list
Returns:
the new list

equalWithNull

public static boolean equalWithNull(java.lang.Object obj1,
                                    java.lang.Object obj2)
Does an equals check by first checking identity, then equality.

Parameters:
obj1 - object 1
obj2 - object 2
Returns:
boolean if equal

fill

public static <T> void fill(java.util.List<T> list,
                            T[] elements)
Populates a list with an array of elements.

Parameters:
list - the list
elements - the elements to be added to the list

getImage

public static Element getImage(ImageResource ir)
Returns an element for the given image.

Parameters:
ir - the image resource
Returns:
the element

isEmptyString

public static boolean isEmptyString(java.lang.String string)
Returns true if the string is null or equals to the empty string.

Parameters:
string - the string to test
Returns:
true if the string is empty

isInteger

public static boolean isInteger(java.lang.String value)
Tests if the value is an integer.

Parameters:
value - the value to test
Returns:
the integer state

parseInt

public static int parseInt(java.lang.String value,
                           int defaultValue)
Parses a string value and returns an integer.

Parameters:
value - the string value
defaultValue - the default value
Returns:
the integer value

parseOverflow

public static Style.Overflow parseOverflow(java.lang.String value)
Parses a string value and returns the applicable Style.Overflow object.

Parameters:
value - the string value
Returns:
the Style.Overflow object

toElementArray

public static Element[] toElementArray(java.util.List<Element> nodes)
Converts a node list to an element array.

Parameters:
nodes - the nodes
Returns:
the element array

toElementArray

public static Element[] toElementArray(NodeList<Element> nodes)
Converts a node list to an element array.

Parameters:
nodes - the nodes
Returns:
the element array


Copyright © 2012. All Rights Reserved.