org.globus.cog.gridface.impl.util
Class InputField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.globus.cog.gridface.impl.util.InputField
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class InputField
extends JPanel

For a listing of all Locale's go to: http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String FIELD_COMBOFIELD
           
static String FIELD_DATE_TEXTFIELD
           
static String FIELD_FORMATTED_TEXTFIELD
           
static String FIELD_TEXTAREA
           
static String FIELD_TEXTFIELD
           
static String FIELD_TIME_TEXTFIELD
           
static String MASK_DOUBLE
           
static String MASK_INT
           
static String MASK_POS_INT
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
InputField(String type)
           
InputField(String type, Format formatter)
           
InputField(String type, Format formatter, Locale locale)
           
InputField(String type, int rows, int cols)
           
InputField(String type, int rows, int cols, Format formatter, Locale myLocale)
          Main constructor
InputField(String type, Locale locale)
           
 
Method Summary
 Object[] getComboChoices()
          returns all of the choices of a COMBOBOX as Object[] if COMBOBOX else throws an exception
 JComponent getField()
          returns the field as JComponent
 JComboBox getFieldAsComboField()
          returns field as JComboBox if not correct type throw exception
 JFormattedTextField getFieldAsFormattedTextField()
          returns field as JTextArea if not correct type throw exception
 JTextArea getFieldAsTextArea()
          returns field as JTextArea if not correct type throw exception
 JTextField getFieldAsTextField()
          returns the field as a JTextField if it is that type else exception thrown
 String getString()
          this is the function that allows you to get the value in any of the input types (what makes it useful) NOTE: Swing is not thread-safe and you should use SwingUtilities.invokeLater for this function
 String getType()
          returns the type Note DateField and TimeField return are types simply predefined formatted fields so they return as JFormattedField
 void setMask(String match)
          This sets a listener to prevent the input from looking like match as a regular expression A hint at producing a mask is to ensure that the expression is valid at every increment ie: you want it to be a valid double use: "-?\\d\*\.?\\d*" It is recommended for you to use the formatter option rather than setting a mask if there is a formatter available.
 void setString(String value)
          This will set the value of a TEXTFIELD or TEXTAREA to value it will addItem value to a COMBOFIELD
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_TEXTFIELD

public static final String FIELD_TEXTFIELD
See Also:
Constant Field Values

FIELD_COMBOFIELD

public static final String FIELD_COMBOFIELD
See Also:
Constant Field Values

FIELD_TEXTAREA

public static final String FIELD_TEXTAREA
See Also:
Constant Field Values

FIELD_FORMATTED_TEXTFIELD

public static final String FIELD_FORMATTED_TEXTFIELD
See Also:
Constant Field Values

FIELD_DATE_TEXTFIELD

public static final String FIELD_DATE_TEXTFIELD
See Also:
Constant Field Values

FIELD_TIME_TEXTFIELD

public static final String FIELD_TIME_TEXTFIELD
See Also:
Constant Field Values

MASK_DOUBLE

public static final String MASK_DOUBLE
See Also:
Constant Field Values

MASK_INT

public static final String MASK_INT
See Also:
Constant Field Values

MASK_POS_INT

public static final String MASK_POS_INT
See Also:
Constant Field Values
Constructor Detail

InputField

public InputField(String type)
           throws FormInputPanelException

InputField

public InputField(String type,
                  Locale locale)
           throws FormInputPanelException

InputField

public InputField(String type,
                  Format formatter)
           throws FormInputPanelException

InputField

public InputField(String type,
                  Format formatter,
                  Locale locale)
           throws FormInputPanelException

InputField

public InputField(String type,
                  int rows,
                  int cols)
           throws FormInputPanelException

InputField

public InputField(String type,
                  int rows,
                  int cols,
                  Format formatter,
                  Locale myLocale)
           throws FormInputPanelException
Main constructor

Parameters:
type - the type of InputField (Defaults to InputField)
rows - the number of rows (Defaults to 100)
cols - the number of cols (Defaults to 10)
formatter - the formatter for a FORMATTED_TEXTFIELD (Defaults to none)
myLocale - the locale used for Date and Time Fields (Defaults to the default locale w/in Java)
Throws:
FormInputPanelException
Method Detail

getField

public JComponent getField()
returns the field as JComponent

Returns:
JComponent

getFieldAsTextField

public JTextField getFieldAsTextField()
                               throws FormInputPanelException
returns the field as a JTextField if it is that type else exception thrown

Returns:
JTextField
Throws:
FormInputPanelException

getFieldAsComboField

public JComboBox getFieldAsComboField()
                               throws FormInputPanelException
returns field as JComboBox if not correct type throw exception

Returns:
JComboBox
Throws:
FormInputPanelException

getFieldAsFormattedTextField

public JFormattedTextField getFieldAsFormattedTextField()
                                                 throws FormInputPanelException
returns field as JTextArea if not correct type throw exception

Returns:
JTextArea
Throws:
FormInputPanelException

getFieldAsTextArea

public JTextArea getFieldAsTextArea()
                             throws FormInputPanelException
returns field as JTextArea if not correct type throw exception

Returns:
JTextArea
Throws:
FormInputPanelException

getComboChoices

public Object[] getComboChoices()
                         throws FormInputPanelException
returns all of the choices of a COMBOBOX as Object[] if COMBOBOX else throws an exception

Returns:
Object[]
Throws:
FormInputPanelException

getString

public String getString()
this is the function that allows you to get the value in any of the input types (what makes it useful) NOTE: Swing is not thread-safe and you should use SwingUtilities.invokeLater for this function

Returns:
String

setString

public void setString(String value)
This will set the value of a TEXTFIELD or TEXTAREA to value it will addItem value to a COMBOFIELD

Parameters:
value - String

setMask

public void setMask(String match)
             throws FormInputPanelException
This sets a listener to prevent the input from looking like match as a regular expression A hint at producing a mask is to ensure that the expression is valid at every increment ie: you want it to be a valid double use: "-?\\d\*\.?\\d*" It is recommended for you to use the formatter option rather than setting a mask if there is a formatter available. it will be valid at any point in the entry: # nothing must be valid too! (unless you set the inital value) - -1 -12 -12. -12.3 It must be valid at any time, that means if we take out anything such as the decimal or the - it must still match. See Links below for using RegExp: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.htm http://java.sun.com/docs/books/tutorial/extra/regex/

Parameters:
match - String
Throws:
FormInputPanelException

getType

public String getType()
returns the type Note DateField and TimeField return are types simply predefined formatted fields so they return as JFormattedField

Returns:
String