planetj.gui
Class CMTextFieldJ

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JTextField
                                |
                                +--planetj.gui.CMTextFieldJ
All Implemented Interfaces:
Accessible, EventListener, FocusListener, ImageObserver, MenuContainer, Scrollable, Serializable, SwingConstants
Direct Known Subclasses:
CMAs400Field, CMLimitedField, CMNumberField

public class CMTextFieldJ
extends JTextField
implements FocusListener

Supports I18N and provides some focus handling events and other common functionality

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CMTextFieldJ()
          Constructor
CMTextFieldJ(Document doc, String text, int columns)
          CMTextFieldJ constructor comment.
CMTextFieldJ(int columns)
          CMTextFieldJ constructor comment.
CMTextFieldJ(String text)
          CMTextFieldJ constructor comment.
CMTextFieldJ(String text, int columns)
          CMTextFieldJ constructor comment.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          The addPropertyChangeListener method was generated to support the propertyChange field.
 void clearText()
          clears out the text field *NOTE* this will make DAX bomb becasue DAX cannot handle an "" empty string
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          The firePropertyChange method was generated to support the propertyChange field.
 void focusGained(FocusEvent e)
          Method to handle events for the FocusListener interface.
 void focusLost(FocusEvent e)
          Method to handle events for the FocusListener interface.
 boolean getApplicable()
          adds a bit more functionality than enabled alone
 boolean getEditable()
          adds a bit more functionality than enabled alone
 boolean getEnabled()
          adds a bit more functionality than enabled alone
 String getText()
          Overrides the getText method and trims the text if the automaticallyTrimContents property is true.
 String getTranslation()
          Gets the translated String.
 String getTranslationId()
          Gets the key of the translated String.
 void grabFocusGained()
          grabFocusedGained method traps the focusGained event and takes a snapshot of the current text to be evaluated for equality upon focusLost.
 void grabFocusLost()
          grabFocusedLost method traps the focusLost event and checks to see if the value for the object has changed.
 boolean isAutomaticallyTrimContents()
          Tells whether or not to trim the contents and also make sure an empty string is changed to " ".
 boolean isBlank()
          Returns true if this TextField is blank or contains no text.
 boolean isSelectAllTextOnFocusGained()
          return true if you want the entire text field's text to be selected on focus gained.
static void main(String[] args)
          main entrypoint - starts the part when it is run as an application
 void removePropertyChangeListener(PropertyChangeListener listener)
          The removePropertyChangeListener method was generated to support the propertyChange field.
 void setApplicable(boolean e)
          adds a bit more functionality than enabled alone
 void setAutomaticallyTrimContents(boolean value)
          sets whether or not to trim the text on get and set
 void setEditable(boolean e)
          override the super method to do a bit more
 void setEnabled(boolean e)
          override the super method to do a bit more
 void setSelectAllTextOnFocusGained(boolean value)
          sets if you want all the text to be selected on focus gained.
 void setText(String key)
          Overrides the superclass to set the key for the translated String.
 void setToolTipText(String toolTip)
          Sets the toolTipText property (java.lang.String) value.
 void setTranslation(String newTranslation)
          Sets the String without translating it.
 
Methods inherited from class javax.swing.JTextField
addActionListener, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMTextFieldJ

public CMTextFieldJ()
Constructor


CMTextFieldJ

public CMTextFieldJ(int columns)
CMTextFieldJ constructor comment.

Parameters:
columns - int

CMTextFieldJ

public CMTextFieldJ(String text)
CMTextFieldJ constructor comment.

Parameters:
text - java.lang.String

CMTextFieldJ

public CMTextFieldJ(String text,
                    int columns)
CMTextFieldJ constructor comment.

Parameters:
text - java.lang.String
columns - int

CMTextFieldJ

public CMTextFieldJ(Document doc,
                    String text,
                    int columns)
CMTextFieldJ constructor comment.

Parameters:
doc - javax.swing.text.Document
text - java.lang.String
columns - int
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
The addPropertyChangeListener method was generated to support the propertyChange field.

Overrides:
addPropertyChangeListener in class JComponent

clearText

public void clearText()
clears out the text field *NOTE* this will make DAX bomb becasue DAX cannot handle an "" empty string


firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
The firePropertyChange method was generated to support the propertyChange field.

Overrides:
firePropertyChange in class JComponent

focusGained

public void focusGained(FocusEvent e)
Method to handle events for the FocusListener interface.

Specified by:
focusGained in interface FocusListener
Parameters:
e - java.awt.event.FocusEvent

focusLost

public void focusLost(FocusEvent e)
Method to handle events for the FocusListener interface.

Specified by:
focusLost in interface FocusListener
Parameters:
e - java.awt.event.FocusEvent

getApplicable

public boolean getApplicable()
adds a bit more functionality than enabled alone


getEditable

public boolean getEditable()
adds a bit more functionality than enabled alone


getEnabled

public boolean getEnabled()
adds a bit more functionality than enabled alone


getText

public String getText()
Overrides the getText method and trims the text if the automaticallyTrimContents property is true. If the trim results in the string becoming an empty string, " " is returned.

Overrides:
getText in class JTextComponent
Returns:
java.lang.String

getTranslation

public String getTranslation()
Gets the translated String.


getTranslationId

public String getTranslationId()
Gets the key of the translated String.


grabFocusGained

public void grabFocusGained()
grabFocusedGained method traps the focusGained event and takes a snapshot of the current text to be evaluated for equality upon focusLost.


grabFocusLost

public void grabFocusLost()
grabFocusedLost method traps the focusLost event and checks to see if the value for the object has changed. If so, a propertyChangeEvent is fired.


isAutomaticallyTrimContents

public boolean isAutomaticallyTrimContents()
Tells whether or not to trim the contents and also make sure an empty string is changed to " ".

Returns:
boolean

isSelectAllTextOnFocusGained

public boolean isSelectAllTextOnFocusGained()
return true if you want the entire text field's text to be selected on focus gained.


main

public static void main(String[] args)
main entrypoint - starts the part when it is run as an application

Parameters:
args - java.lang.String[]

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
The removePropertyChangeListener method was generated to support the propertyChange field.

Overrides:
removePropertyChangeListener in class JComponent

setApplicable

public void setApplicable(boolean e)
adds a bit more functionality than enabled alone


setAutomaticallyTrimContents

public void setAutomaticallyTrimContents(boolean value)
sets whether or not to trim the text on get and set

Parameters:
value - boolean

setEditable

public void setEditable(boolean e)
override the super method to do a bit more

Overrides:
setEditable in class JTextComponent

setEnabled

public void setEnabled(boolean e)
override the super method to do a bit more

Overrides:
setEnabled in class JComponent

setSelectAllTextOnFocusGained

public void setSelectAllTextOnFocusGained(boolean value)
sets if you want all the text to be selected on focus gained.


setText

public void setText(String key)
Overrides the superclass to set the key for the translated String.

Overrides:
setText in class JTextComponent

setToolTipText

public void setToolTipText(String toolTip)
Sets the toolTipText property (java.lang.String) value.

Overrides:
setToolTipText in class JComponent
Parameters:
toolTip - The new value for the property.
See Also:
JTextComponent.getToolTipText(java.awt.event.MouseEvent)

setTranslation

public void setTranslation(String newTranslation)
Sets the String without translating it.


isBlank

public boolean isBlank()
Returns true if this TextField is blank or contains no text. This will return true if this TextField only contains spaces Creation date: (7/8/2003 2:37:18 PM)