|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.iface.ui.util.UIUtil
public class UIUtil
Class for useful static methods.
Nested Class Summary | |
---|---|
static class |
UIUtil.ToStringComparator
|
Field Summary | |
---|---|
static java.lang.String |
lineSeparator
|
Constructor Summary | |
---|---|
UIUtil()
|
Method Summary | |
---|---|
static boolean |
addActionListener(javax.swing.JComponent c,
java.awt.event.ActionListener al)
|
static void |
addListener(javax.swing.JComponent component,
java.util.EventListener el)
|
static java.lang.String |
booleanToProperty(boolean value)
|
static java.lang.String[] |
breakStringAtFirst(java.lang.String s,
java.lang.String separator)
breakStringAtFirst takes a string containing fields separated by a (string) delimiter and returns a two-element string array containing the substring before the first occurrence of the char, and the substring after. |
static java.lang.String |
ensureParenthesized(java.lang.String text)
Makes sure that the given string is enclosed in parentheses. |
static java.util.List |
enumerationToList(java.util.Enumeration e)
|
static java.lang.String |
fieldsToNames(java.lang.reflect.Field[] fields)
|
static int |
findNameField(java.util.ArrayList fieldNames)
Looks for a field that sounds like a good name field and returns its index in the given list. |
static javax.swing.AbstractButton |
getEventButton(java.awt.event.ActionEvent ae)
|
static IXEditorPanel |
getEventPanel(java.awt.event.ActionEvent ae)
|
static java.util.List |
getFlatValues(java.util.Map map)
|
static java.lang.Object |
getObjectFieldValue(java.lang.Object object,
java.lang.String field)
|
static java.lang.String |
intToProperty(int value)
|
static boolean |
isEmptyThing(java.lang.Object thing)
Returns true if the given thing is null, empty string, or empty collection, or map with no values |
static boolean |
isEmptyValue(java.lang.Object value)
Checks whether the given thing is empty. |
static void |
listenToCB(javax.swing.JComboBox jcb,
javax.swing.event.PopupMenuListener listener)
|
static java.lang.String |
listToDisplay(java.util.Collection l)
|
static java.lang.String |
listToText(java.util.Collection l)
|
static java.lang.String[] |
listToTextArray(java.util.Collection l)
|
static javax.swing.JMenuItem |
makeMenuItem(java.awt.event.ActionListener al,
javax.swing.JComponent menu,
java.lang.String command,
java.lang.String label)
Makes a menu item with the given label and command and adds it to the given (menu) parent. |
static TypedList |
newTypedList(java.lang.Class listClass,
java.util.Collection data)
|
static TypedList |
newTypedList(java.lang.Class listClass,
java.lang.Object data)
|
static TypedList |
newTypedList(java.lang.Class listClass,
java.lang.Object[] data)
|
static void |
notImplemented(java.awt.Component parent,
java.lang.String item)
Brings up a message that the given string item is not yet supported. |
static void |
populateMenu(java.awt.event.ActionListener al,
javax.swing.JMenu menu,
java.lang.String command,
java.util.List objects)
Fills the given menu with the names of the given objects, attaching the given command. |
static void |
populateMenu(java.awt.event.ActionListener al,
javax.swing.JMenu menu,
java.lang.String label,
java.lang.String command,
java.util.List objects)
Fills the given menu with the names of the given objects, attaching the given command. |
static void |
populateMenu(java.awt.event.ActionListener al,
JObjectMenu menu,
java.lang.Object obj,
java.lang.String command,
java.util.List objects)
Fills the given menu with the names of the given objects, attaching the given command. |
static boolean |
propertyToBoolean(java.lang.String sValue)
|
static int |
propertyToInt(java.lang.String sValue)
|
static Symbol |
propertyToSymbol(java.lang.String sValue)
|
static LList |
remove(java.lang.Object o,
LList list)
|
static LList |
removeDuplicates(LList list)
|
static java.net.URL |
resourceURL(java.lang.String filename)
|
static void |
setObjectFieldValue(java.lang.Object object,
java.lang.String field,
java.lang.Class fieldClass,
java.lang.Object value)
Sets the object's field to the given value |
static java.lang.String |
show(java.util.Collection l)
|
static java.lang.String |
show(java.util.Enumeration e)
|
static java.lang.String |
showClass(java.util.Collection l)
|
static java.lang.reflect.Field |
stringToField(java.lang.Class oClass,
java.lang.String field)
|
static java.lang.String |
symbolToProperty(Symbol value)
|
static java.lang.String |
toCapitalised(java.lang.String inString)
public static void clearMouseListeners(Component c) { MouseListener[] mls = c.getMouseListeners(); for (int i = 0; i < mls.length; i++) c.removeMouseListener(mls[i]); } |
static java.lang.String |
toUncapitalised(java.lang.String inString)
|
static void |
warning(java.awt.Component parent,
java.lang.String item)
Brings up a message that the given string item is not yet supported. |
static java.util.Collection |
without(java.util.Collection things,
java.util.Collection notThings)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String lineSeparator
Constructor Detail |
---|
public UIUtil()
Method Detail |
---|
public static void notImplemented(java.awt.Component parent, java.lang.String item)
public static void warning(java.awt.Component parent, java.lang.String item)
public static void addListener(javax.swing.JComponent component, java.util.EventListener el)
public static boolean addActionListener(javax.swing.JComponent c, java.awt.event.ActionListener al)
public static IXEditorPanel getEventPanel(java.awt.event.ActionEvent ae)
public static javax.swing.AbstractButton getEventButton(java.awt.event.ActionEvent ae)
public static void populateMenu(java.awt.event.ActionListener al, javax.swing.JMenu menu, java.lang.String command, java.util.List objects)
al
- the ActionListener that will process menu selectionsmenu
- the menu to be filledcommand
- attached to each new menu itemobjects
- an ArrayList of named objects to be put in the menupublic static void populateMenu(java.awt.event.ActionListener al, javax.swing.JMenu menu, java.lang.String label, java.lang.String command, java.util.List objects)
menu
- the menu to be filledcommand
- attached to each new menu itemlabel
- sets the label of the menu unless it is null
(leaves label alone if it is null)objects
- an ArrayList of named objects to be put in the menupublic static void populateMenu(java.awt.event.ActionListener al, JObjectMenu menu, java.lang.Object obj, java.lang.String command, java.util.List objects)
menu
- the menu to be filledcommand
- attached to each new menu itemobjects
- an ArrayList of named objects to be put in the menupublic static javax.swing.JMenuItem makeMenuItem(java.awt.event.ActionListener al, javax.swing.JComponent menu, java.lang.String command, java.lang.String label)
al
- the action listener that is interested in the item's selectionmenu
- the menu that the item should be added tocommand
- attached to the item for recognising actionslabel
- displayed in the menupublic static java.lang.String toCapitalised(java.lang.String inString)
public static java.lang.String toUncapitalised(java.lang.String inString)
public static java.lang.String ensureParenthesized(java.lang.String text)
public static java.lang.String[] breakStringAtFirst(java.lang.String s, java.lang.String separator)
public static Symbol propertyToSymbol(java.lang.String sValue)
public static int propertyToInt(java.lang.String sValue)
public static boolean propertyToBoolean(java.lang.String sValue)
public static java.lang.String booleanToProperty(boolean value)
public static java.lang.String symbolToProperty(Symbol value)
public static java.lang.String intToProperty(int value)
public static boolean isEmptyThing(java.lang.Object thing)
public static java.lang.reflect.Field stringToField(java.lang.Class oClass, java.lang.String field) throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException
java.lang.NoSuchFieldException
java.lang.IllegalAccessException
public static int findNameField(java.util.ArrayList fieldNames)
public static java.lang.Object getObjectFieldValue(java.lang.Object object, java.lang.String field)
public static void setObjectFieldValue(java.lang.Object object, java.lang.String field, java.lang.Class fieldClass, java.lang.Object value)
public static boolean isEmptyValue(java.lang.Object value)
public static java.lang.String show(java.util.Collection l)
public static java.lang.String showClass(java.util.Collection l)
public static java.lang.String show(java.util.Enumeration e)
public static java.lang.String listToDisplay(java.util.Collection l)
public static java.lang.String listToText(java.util.Collection l)
public static java.lang.String[] listToTextArray(java.util.Collection l)
public static java.lang.String fieldsToNames(java.lang.reflect.Field[] fields)
public static LList removeDuplicates(LList list)
public static java.util.Collection without(java.util.Collection things, java.util.Collection notThings)
public static LList remove(java.lang.Object o, LList list)
public static java.util.List getFlatValues(java.util.Map map)
public static java.util.List enumerationToList(java.util.Enumeration e)
public static TypedList newTypedList(java.lang.Class listClass, java.util.Collection data)
public static TypedList newTypedList(java.lang.Class listClass, java.lang.Object[] data)
public static TypedList newTypedList(java.lang.Class listClass, java.lang.Object data)
public static java.net.URL resourceURL(java.lang.String filename)
public static void listenToCB(javax.swing.JComboBox jcb, javax.swing.event.PopupMenuListener listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |