ix.iface.ui.util
Class UIUtil

java.lang.Object
  |
  +--ix.iface.ui.util.UIUtil

public class UIUtil
extends java.lang.Object

Class for useful static methods.


Inner Class Summary
static class UIUtil.ToStringComparator
           
 
Constructor Summary
UIUtil()
           
 
Method Summary
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 fieldsToNames(java.lang.reflect.Field[] fields)
           
static java.lang.Object getObjectFieldValue(java.lang.Object object, java.lang.String field)
           
static java.lang.String listToDisplay(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 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 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)
           
static java.lang.String show(java.util.Collection l)
           
static java.lang.reflect.Field stringToField(java.lang.Class c, java.lang.String s)
           
static java.lang.String toCapitalised(java.lang.String inString)
           
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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIUtil

public UIUtil()
Method Detail

notImplemented

public static void notImplemented(java.awt.Component parent,
                                  java.lang.String item)
Brings up a message that the given string item is not yet supported. e.g. "Editing AROs is not yet supported"

warning

public static void warning(java.awt.Component parent,
                           java.lang.String item)
Brings up a message that the given string item is not yet supported. e.g. "Editing AROs is not yet supported"

populateMenu

public 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. Always clears the menu first and disables it. Only enables it if there are items in it.
Parameters:
menu - the menu to be filled
command - attached to each new menu item
objects - an ArrayList of named objects to be put in the menu

makeMenuItem

public 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.
Parameters:
al - the action listener that is interested in the item's selection
menu - the menu that the item should be added to
command - attached to the item for recognising actions
label - displayed in the menu

toCapitalised

public static java.lang.String toCapitalised(java.lang.String inString)

toUncapitalised

public static java.lang.String toUncapitalised(java.lang.String inString)

breakStringAtFirst

public 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. Neither substring contains the delimiter. If the delimiter does not appear in the string at all, the values are the string and "".

stringToField

public static java.lang.reflect.Field stringToField(java.lang.Class c,
                                                    java.lang.String s)

getObjectFieldValue

public static java.lang.Object getObjectFieldValue(java.lang.Object object,
                                                   java.lang.String field)

setObjectFieldValue

public static void setObjectFieldValue(java.lang.Object object,
                                       java.lang.String field,
                                       java.lang.Class fieldClass,
                                       java.lang.Object value)

show

public static java.lang.String show(java.util.Collection l)

listToDisplay

public static java.lang.String listToDisplay(java.util.Collection l)

fieldsToNames

public static java.lang.String fieldsToNames(java.lang.reflect.Field[] fields)

removeDuplicates

public static LList removeDuplicates(LList list)

remove

public static LList remove(java.lang.Object o,
                           LList list)

resourceURL

public static java.net.URL resourceURL(java.lang.String filename)