org.tentackle.ui
Class FormTextArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextArea
                      extended by org.tentackle.ui.FormTextArea
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, FormComponent, FormFieldComponent
Direct Known Subclasses:
FormTextAreaTableCellRenderer

public class FormTextArea
extends JTextArea
implements FormFieldComponent

Extended JTextArea as a FormFieldComponent.

Author:
harald
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextArea
JTextArea.AccessibleJTextArea
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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
FormTextArea()
          Creates an empty FormTextArea with the default document model.
FormTextArea(Document doc, String text, int rows, int columns)
          Creates a FormTextArea.
FormTextArea(int rows, int columns)
          Creates an empty FormTextArea with the default document model.
FormTextArea(String text)
          Creates a FormTextArea with the default document model.
FormTextArea(String text, int rows, int columns)
          Creates a FormTextArea with the default document model.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds the specified action listener to receive action events from this textfield.
 void addValueListener(ValueListener l)
          Adds a value listener that implements the binding between this component and the data.
 void clearText()
          Clears the contents of this component.
protected  Document createDefaultModel()
          Creates the default implementation of the model to be used at construction if one isn't explicitly given.
 void doActionPerformed()
          Invokes the action performed handler.
 String doFormat(Object object)
          The format will be ignored in FormTextArea.
 void doSmartEnter()
          Transfers the focus to the next field if it is the first key pressed in this JTextArea (and the cursor hasn't been moved by the mouse).
 void downRight()
          Move the caret to the right side of field and if already there move to next field.
protected  void fireActionPerformed()
          Notifies all listeners that have registered interest for notification on this event type.
 void fireValueChanged()
          Fires all value listeners registered on this component invoking their valueChanged-handler.
This method is invoked whenever the data has been changed and that change should be reflected in the view.
 void fireValueEntered()
          Fires all listeners registered on this component invoking their valueEntered-handler.
This method is invoked whenever the user edited the view and that change should be reflected in the data.
 char getAdjust()
          Gets the current adjustment.
 char getConvert()
          Gets the current convesion
 StringConverter getConverter()
          Gets the current converter.
 int getErrorOffset()
          TextArea's don't provide formatting and thus no possibilities for errors.
 char getFiller()
          Gets the current fill char.
 String getFormat()
          The format will be ignored in FormTextArea.
 String getFormValue()
          Retrieves the value from this component.
The method is used to update the data if the view has changed because the user edited it.
 String getHelpURL()
          Gets the online-help URL.
 int getHorizontalAlignment()
          Not implemented in FormTextArea.
 String getInvalidChars()
          Gets invalid characters.
 int getMaxColumns()
          Gets the maximum number of columns.
 Dimension getOptimalSize()
          Calculates the dimensions for displaying the text according to the number of lines and max.
 Window getParentWindow()
          Gets the parent window of this component.
 String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText.
 String getValidChars()
          Gets allowed characters.
 int getVerticalAlignment()
          Gets the vertical alignment.
 void invalidateParentInfo()
          Invalidates all container-relevant (cached) information for the hierarchy of this component's parents.
For optimization purposes.
 boolean isAutoNext()
          Returns whether the auto-next feature is enabled.
 boolean isAutoSelect()
          Returns whether the auto-select feature is enabled.
 boolean isAutoUpdate()
          Returns whether the auto-update feature is enabled.
 boolean isCaretLeft()
          Returns whether carat is at leftmost position.
 boolean isCaretRight()
          Returns whether caret is at rightmost position.
 boolean isCellEditorUsage()
          Returns whether this component is used as a cell editor.
 boolean isChangeable()
          Returns if this component is changeable.
 boolean isEmpty()
          Determines whether this component is empty.
 boolean isEraseFirst()
          Returns whether to erase the field after first setText().
 boolean isFireRunning()
          Checks whether a fire-method is running.
 boolean isFormTraversable()
          Returns whether this component is form traversable or not.
 boolean isHonourChangeable()
          Returns whether this component should honour the changeable-attribute or not.
 boolean isInhibitAutoSelect()
          Returns whether auto-select is inhibited (once).
 boolean isOverwrite()
          Gets the current override mode.
 boolean isSmartEnter()
          Returns whether smart enter is enabled.
 boolean isStartEditLeftmost()
          Returns whether to start edit leftmost in this component (once).
 boolean isValueChanged()
          Checks whether the contents have been changed since the last savepoint.
 void prepareFocusLost()
          Prepares for FOCUS_LOST.
Gives this component the opportunity to invoke fireValueEntered() earlier than FOCUS_LOST is really received.
protected  void processFocusEvent(FocusEvent e)
          Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
protected  void processKeyEvent(KeyEvent e)
          Overrides processKeyEvent to process events.
protected  void processMouseEvent(MouseEvent e)
          Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects, refer to Component.processMouseEvent(MouseEvent) for a complete description of this method.
 void removeActionListener(ActionListener l)
          Removes the specified action listener so that it no longer receives action events from this textfield.
 void removeValueListener(ValueListener l)
          Remove a value listener.
 void requestFocusLater()
          Requests the keyboard focus for this component by appending an event to the end of the event queue.
Applications should not use requestFocus() or requestFocusInWindow() unless the order in which the events are processed is unimportant.
 void saveValue()
          Sets a savepoint for the data of this component.
Allows to decide whether the user has changed the data associated with this component or not.
 void setAdjust(char adjust)
          Sets character adjustment.
By default the text input data is trimmed, i.e.
 void setAutoNext(boolean autonext)
          Sets the auto-next feature.
If autonext is enabled the next component will automatically receive the focus if the maximum number of characters is reached.
 void setAutoSelect(boolean autoselect)
          Sets the auto-select feature.
A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus.
 void setAutoUpdate(boolean autoupdate)
          Sets the auto-update feature.
By default, all components update the data model if the view changes (due to certain events, for example focus lost).
 void setCaretLeft()
          Sets the caret to leftmost position.
 void setCaretRight()
          Sets the caret to rightmost position.
 void setCellEditorUsage(boolean flag)
          Sets a hint that this component is used as a cell editor.
Some components behave differently in tables than in forms, for example.
 void setChangeable(boolean changeable)
          Set the component to be changeable.
This is a unified abstraction and will be translated to setEditable or setEnabled, whatever is appropriate to this component.
 void setConvert(char convert)
          Sets character upper/lowercase conversion.
Notice that changing the character conversion will immediately convert.
 void setConverter(StringConverter converter)
          Sets the string converter.
Besides the lower/uppercase conversion an optional StringConverter may be set to translate characters.
 void setEditable(boolean b)
          Sets the specified boolean to indicate whether or not this TextComponent should be editable.
 void setEraseFirst(boolean erasefirst)
          Sets whether to erase the field after first setText().
 void setFiller(char filler)
          Sets the fill char.
The fill char determines the adjustment of the text data.
 void setFireRunning(boolean fireRunning)
          Sets a component's flag that a fire-method is currently running.
Used by the framework to minimize valueChanged/valueEntered processing.
 void setFormat(String pattern)
          The format will be ignored in FormTextArea.
 void setFormTraversable(boolean formTraversable)
          Sets whether this component is form traversable or not, i.e.
 void setFormValue(Object object)
          Sets a value in this component.
The method is used to update the view if the data has changed.
 void setFormWrapWindow(FormWindow parent)
          Sets the window that will fire a FormWrapEvent when this components loses the keyboard focus.
 void setHelpURL(String helpURL)
          Sets the online-help URL.
If a help url is set for this component, a browser will be launched to show that url.
 void setHonourChangeable(boolean honourChangeable)
          Sets whether this component should honour the changeable-attribute or not.
The default is true.
 void setHorizontalAlignment(int alignment)
          Not implemented in FormTextArea.
 void setInhibitAutoSelect(boolean inhibitAutoSelect)
          Sets auto-select to be inhibited inhibited (once).
 void setInvalidChars(String str)
          Sets invalid characters.
 void setMaxColumns(int maxColumns)
          Sets the maximum number of columns.
 void setOverwrite(boolean override)
          Sets the insert/override mode.
 void setSmartEnter(boolean smartEnter)
          Enable smart enter.
 void setStartEditLeftmost(boolean startEditLeftmost)
          Sets whether to start edit leftmost in this component (once).
 void setText(String str)
          Sets the text of this TextComponent to the specified text.
 void setValidChars(String str)
          Sets allowed characters.
 void setVerticalAlignment(int alignment)
          Sets the vertical alignment.
Can only be used in Tentackle-LookAndFeels!
 void showHelp()
          Displays online help for this component.
Usually triggered by KeyEvent.VK_F1 or VK_HELP or a button.
 void transferFocus()
          Transfers the focus to the next component, as though this Component were the focus owner.
 void transferFocusBackward()
          Transfers the focus to the previous component, as though this Component were the focus owner.
 void triggerValueChanged()
          Promotes the fact that value changed to all FormContainers this component is a child of.
 void upLeft()
          Move caret to the left side of field and if already there move to previous field.
 boolean wasFocusGainedFromTransfer()
          Returns whether the keyboard focus was gained due to FormComponent.transferFocus() in the opposite component.
 boolean wasFocusGainedFromTransferBackward()
          Returns whether the keyboard focus was gained due to FormComponent.transferFocusBackward() in the opposite component.
 boolean wasTransferFocus()
          Returns whether this component lost the keyboard focus due to FormComponent.transferFocus().
 boolean wasTransferFocusBackward()
          Returns whether this component lost the keyboard focus due to FormComponent.transferFocusBackward().
 boolean wasTransferFocusByEnter()
          Returns whether this component lost the keyboard focus due to KeyEvent.VK_ENTER.
 
Methods inherited from class javax.swing.JTextArea
append, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, replaceRange, setColumns, setFont, setLineWrap, setRows, setTabSize, setWrapStyleWord
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.tentackle.ui.FormFieldComponent
getBaseline, getCaretPosition, getColumns, getText, setCaretPosition, setColumns, setToolTipText
 
Methods inherited from interface org.tentackle.ui.FormComponent
hasFocus
 

Constructor Detail

FormTextArea

public FormTextArea(Document doc,
                    String text,
                    int rows,
                    int columns)
Creates a FormTextArea.

Parameters:
doc - the document model, null if default FormFieldDocument.
text - the text to be displayed, null if none
rows - the number of rows >= 0
columns - the number of columns >= 0

FormTextArea

public FormTextArea(String text,
                    int rows,
                    int columns)
Creates a FormTextArea with the default document model.

Parameters:
text - the text to be displayed, null if none
rows - the number of rows >= 0
columns - the number of columns >= 0

FormTextArea

public FormTextArea(String text)
Creates a FormTextArea with the default document model.

Parameters:
text - the text to be displayed, null if none

FormTextArea

public FormTextArea(int rows,
                    int columns)
Creates an empty FormTextArea with the default document model.

Parameters:
rows - the number of rows >= 0
columns - the number of columns >= 0

FormTextArea

public FormTextArea()
Creates an empty FormTextArea with the default document model.

Method Detail

isSmartEnter

public boolean isSmartEnter()
Returns whether smart enter is enabled.

Returns:
true if smart enter is enabled (default)

setSmartEnter

public void setSmartEnter(boolean smartEnter)
Enable smart enter. When enabled pressing the Enter-key at the start of the text area (as long as there are no other keys typed or mouse clicks) will move to the next field and will _not_ insert a newline. Inserting a newline can be achieved with Ctrl+Enter.

Parameters:
smartEnter - true to enable smart enter (default)

doSmartEnter

public void doSmartEnter()
Transfers the focus to the next field if it is the first key pressed in this JTextArea (and the cursor hasn't been moved by the mouse). This allows the user to ENTER through all fields in a mask without worrying about textareas. In all other cases ENTER inserts a newline and moves the cursor after the newline (as expected).


addActionListener

public void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this textfield.

Parameters:
l - the action listener to be added

removeActionListener

public void removeActionListener(ActionListener l)
Removes the specified action listener so that it no longer receives action events from this textfield.

Parameters:
l - the action listener to be removed

fireActionPerformed

protected void fireActionPerformed()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created. The listener list is processed in last to first order.


setEditable

public void setEditable(boolean b)
Sets the specified boolean to indicate whether or not this TextComponent should be editable. A PropertyChange event ("editable") is fired when the state is changed.

Overridden for consistent colors. A non-editable text area should have the same color as a non-editable text field (in panals).

Overrides:
setEditable in class JTextComponent
Parameters:
b - the boolean to be set
See Also:
JTextComponent.isEditable()

processFocusEvent

protected void processFocusEvent(FocusEvent e)
Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.

This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:

If focus events are enabled for a Component, the current KeyboardFocusManager determines whether or not a focus event should be dispatched to registered FocusListener objects. If the events are to be dispatched, the KeyboardFocusManager calls the Component's dispatchEvent method, which results in a call to the Component's processFocusEvent method.

If focus events are enabled for a Component, calling the Component's dispatchEvent method with a FocusEvent as the argument will result in a call to the Component's processFocusEvent method regardless of the current KeyboardFocusManager.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Overridden for enhanced focus handling

Overrides:
processFocusEvent in class Component
Parameters:
e - the focus event
See Also:
FocusEvent, FocusListener, KeyboardFocusManager, Component.addFocusListener(java.awt.event.FocusListener), Component.enableEvents(long), Component.dispatchEvent(java.awt.AWTEvent)

processKeyEvent

protected void processKeyEvent(KeyEvent e)
Overrides processKeyEvent to process events.

Overridden due to smart enter.

Overrides:
processKeyEvent in class JComponent
Parameters:
e - the key event
See Also:
KeyEvent, KeyListener, KeyboardFocusManager, DefaultKeyboardFocusManager, Component.processEvent(java.awt.AWTEvent), Component.dispatchEvent(java.awt.AWTEvent), Component.addKeyListener(java.awt.event.KeyListener), Component.enableEvents(long), Component.isShowing()

processMouseEvent

protected void processMouseEvent(MouseEvent e)
Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects, refer to Component.processMouseEvent(MouseEvent) for a complete description of this method.

Overridden due to smart enter.

Overrides:
processMouseEvent in class JComponent
Parameters:
e - the mouse event
See Also:
Component.processMouseEvent(java.awt.event.MouseEvent)

createDefaultModel

protected Document createDefaultModel()
Creates the default implementation of the model to be used at construction if one isn't explicitly given. A new instance of PlainDocument is returned.

Overridden to create a FormFieldDocument.

Overrides:
createDefaultModel in class JTextArea
Returns:
the default document model

getOptimalSize

public Dimension getOptimalSize()
Calculates the dimensions for displaying the text according to the number of lines and max. chars in lines. If the text area is empty the preferred size is returned.

Returns:
the optimal size

getToolTipText

public String getToolTipText()
Description copied from class: javax.swing.JComponent
Returns the tooltip string that has been set with setToolTipText.

Specified by:
getToolTipText in interface FormFieldComponent
Overrides:
getToolTipText in class JComponent
Returns:
the text of the tool tip
See Also:
JComponent.TOOL_TIP_TEXT_KEY

transferFocus

public void transferFocus()
Transfers the focus to the next component, as though this Component were the focus owner.

Overridden to implement wasTransferFocus

Specified by:
transferFocus in interface FormComponent
Overrides:
transferFocus in class Component
See Also:
Component.requestFocus()

transferFocusBackward

public void transferFocusBackward()
Transfers the focus to the previous component, as though this Component were the focus owner.

Overridden to implement wasTransferFocusBackward

Specified by:
transferFocusBackward in interface FormComponent
Overrides:
transferFocusBackward in class Container
See Also:
Component.requestFocus()

setFormTraversable

public void setFormTraversable(boolean formTraversable)
Description copied from interface: FormComponent
Sets whether this component is form traversable or not, i.e. gets the focus or is skipped.

Specified by:
setFormTraversable in interface FormComponent
Parameters:
formTraversable - true if traversable, false if not

isFormTraversable

public boolean isFormTraversable()
Description copied from interface: FormComponent
Returns whether this component is form traversable or not.

Specified by:
isFormTraversable in interface FormComponent
Returns:
the focus traversable flag

setFormValue

public void setFormValue(Object object)
Description copied from interface: FormComponent
Sets a value in this component.
The method is used to update the view if the data has changed.

Specified by:
setFormValue in interface FormComponent
Parameters:
object - is the object to set

getFormValue

public String getFormValue()
Description copied from interface: FormComponent
Retrieves the value from this component.
The method is used to update the data if the view has changed because the user edited it.

Specified by:
getFormValue in interface FormComponent
Returns:
the object from the form

getHelpURL

public String getHelpURL()
Description copied from interface: FormComponent
Gets the online-help URL.

Specified by:
getHelpURL in interface FormComponent
Returns:
the help url, default is null

setHelpURL

public void setHelpURL(String helpURL)
Description copied from interface: FormComponent
Sets the online-help URL.
If a help url is set for this component, a browser will be launched to show that url. If there is no url the next higher level container will determine the url, and so forth.

Specified by:
setHelpURL in interface FormComponent
Parameters:
helpURL - the help url
See Also:
FormHelper.openHelpURL(Component)

showHelp

public void showHelp()
Description copied from interface: FormComponent
Displays online help for this component.
Usually triggered by KeyEvent.VK_F1 or VK_HELP or a button. If help is not configured for this component, the parent's help is used.

Specified by:
showHelp in interface FormComponent

requestFocusLater

public void requestFocusLater()
Description copied from interface: FormComponent
Requests the keyboard focus for this component by appending an event to the end of the event queue.
Applications should not use requestFocus() or requestFocusInWindow() unless the order in which the events are processed is unimportant. This method guarantees that this component gets the focus when all events queued so far have been processed.

Specified by:
requestFocusLater in interface FormComponent

addValueListener

public void addValueListener(ValueListener l)
Description copied from interface: FormComponent
Adds a value listener that implements the binding between this component and the data.

Specified by:
addValueListener in interface FormComponent
Parameters:
l - the value listener to add

removeValueListener

public void removeValueListener(ValueListener l)
Description copied from interface: FormComponent
Remove a value listener.

Specified by:
removeValueListener in interface FormComponent
Parameters:
l - the value listener to remove

fireValueChanged

public void fireValueChanged()
Description copied from interface: FormComponent
Fires all value listeners registered on this component invoking their valueChanged-handler.
This method is invoked whenever the data has been changed and that change should be reflected in the view.

Specified by:
fireValueChanged in interface FormComponent

fireValueEntered

public void fireValueEntered()
Description copied from interface: FormComponent
Fires all listeners registered on this component invoking their valueEntered-handler.
This method is invoked whenever the user edited the view and that change should be reflected in the data.

Specified by:
fireValueEntered in interface FormComponent

saveValue

public void saveValue()
Description copied from interface: FormComponent
Sets a savepoint for the data of this component.
Allows to decide whether the user has changed the data associated with this component or not.

Specified by:
saveValue in interface FormComponent
See Also:
FormComponent.isValueChanged()

isValueChanged

public boolean isValueChanged()
Description copied from interface: FormComponent
Checks whether the contents have been changed since the last savepoint.

Specified by:
isValueChanged in interface FormComponent
Returns:
true if changed
See Also:
FormComponent.saveValue()

triggerValueChanged

public void triggerValueChanged()
Description copied from interface: FormComponent
Promotes the fact that value changed to all FormContainers this component is a child of.

Specified by:
triggerValueChanged in interface FormComponent

setCellEditorUsage

public void setCellEditorUsage(boolean flag)
Description copied from interface: FormComponent
Sets a hint that this component is used as a cell editor.
Some components behave differently in tables than in forms, for example.

Specified by:
setCellEditorUsage in interface FormComponent
Parameters:
flag - true if component is a cell editor, false if not.

isCellEditorUsage

public boolean isCellEditorUsage()
Description copied from interface: FormComponent
Returns whether this component is used as a cell editor.

Specified by:
isCellEditorUsage in interface FormComponent
Returns:
true true if component is a cell editor, false if not.

setChangeable

public void setChangeable(boolean changeable)
Description copied from interface: FormComponent
Set the component to be changeable.
This is a unified abstraction and will be translated to setEditable or setEnabled, whatever is appropriate to this component.

Specified by:
setChangeable in interface FormComponent
Parameters:
changeable - true the user can edit the data, false if show only

isChangeable

public boolean isChangeable()
Description copied from interface: FormComponent
Returns if this component is changeable.

Specified by:
isChangeable in interface FormComponent
Returns:
true the user can edit the data, false if show only

setHonourChangeable

public void setHonourChangeable(boolean honourChangeable)
Description copied from interface: FormComponent
Sets whether this component should honour the changeable-attribute or not.
The default is true. Notice: if this component does not honour the changeable flag, isValueChanged() always returns false and it will not perform any saveValue().

Specified by:
setHonourChangeable in interface FormComponent
Parameters:
honourChangeable - true if honour the changeable attribute, false if not

isHonourChangeable

public boolean isHonourChangeable()
Description copied from interface: FormComponent
Returns whether this component should honour the changeable-attribute or not.

Specified by:
isHonourChangeable in interface FormComponent
Returns:
true if honour the changeable attribute, false if not

prepareFocusLost

public void prepareFocusLost()
Description copied from interface: FormComponent
Prepares for FOCUS_LOST.
Gives this component the opportunity to invoke fireValueEntered() earlier than FOCUS_LOST is really received. Useful because the next focused component is determined before FOCUS_LOST is sent to this component. Thus, if this component changes the focusability of the next component, the focus policy would probably pick the wrong component otherwise.

Specified by:
prepareFocusLost in interface FormComponent

getParentWindow

public Window getParentWindow()
Description copied from interface: FormComponent
Gets the parent window of this component.

Specified by:
getParentWindow in interface FormComponent
Returns:
the parent window, null if none

invalidateParentInfo

public void invalidateParentInfo()
Description copied from interface: FormComponent
Invalidates all container-relevant (cached) information for the hierarchy of this component's parents.
For optimization purposes.

Specified by:
invalidateParentInfo in interface FormComponent

wasTransferFocus

public boolean wasTransferFocus()
Description copied from interface: FormComponent
Returns whether this component lost the keyboard focus due to FormComponent.transferFocus().

Specified by:
wasTransferFocus in interface FormComponent
Returns:
true if focus lost due to transferFocus

wasTransferFocusBackward

public boolean wasTransferFocusBackward()
Description copied from interface: FormComponent
Returns whether this component lost the keyboard focus due to FormComponent.transferFocusBackward().

Specified by:
wasTransferFocusBackward in interface FormComponent
Returns:
true if focus lost due to transferFocusBackward

wasFocusGainedFromTransfer

public boolean wasFocusGainedFromTransfer()
Description copied from interface: FormComponent
Returns whether the keyboard focus was gained due to FormComponent.transferFocus() in the opposite component.

Specified by:
wasFocusGainedFromTransfer in interface FormComponent
Returns:
true if this component gained the focus from the logically previous component
See Also:
FormFocusTraversalPolicy

wasFocusGainedFromTransferBackward

public boolean wasFocusGainedFromTransferBackward()
Description copied from interface: FormComponent
Returns whether the keyboard focus was gained due to FormComponent.transferFocusBackward() in the opposite component.

Specified by:
wasFocusGainedFromTransferBackward in interface FormComponent
Returns:
true if this component gained the focus from the logically next component
See Also:
FormFocusTraversalPolicy

wasTransferFocusByEnter

public boolean wasTransferFocusByEnter()
Description copied from interface: FormComponent
Returns whether this component lost the keyboard focus due to KeyEvent.VK_ENTER.

Specified by:
wasTransferFocusByEnter in interface FormComponent
Returns:
true if pressing the Enter/Return key caused a focus lost

doActionPerformed

public void doActionPerformed()
Description copied from interface: FormFieldComponent
Invokes the action performed handler.

Specified by:
doActionPerformed in interface FormFieldComponent

setText

public void setText(String str)
Description copied from class: javax.swing.text.JTextComponent
Sets the text of this TextComponent to the specified text. If the text is null or empty, has the effect of simply deleting the old text. When text has been inserted, the resulting caret location is determined by the implementation of the caret class.

This method is thread safe, although most Swing methods are not. Please see How to Use Threads for more information. Note that text is not a bound property, so no PropertyChangeEvent is fired when it changes. To listen for changes to the text, use DocumentListener.

Specified by:
setText in interface FormFieldComponent
Overrides:
setText in class JTextComponent
Parameters:
str - the new text to be set
See Also:
JTextComponent.getText(int, int), DefaultCaret

clearText

public void clearText()
Description copied from interface: FormFieldComponent
Clears the contents of this component.

Specified by:
clearText in interface FormFieldComponent

isCaretLeft

public boolean isCaretLeft()
Description copied from interface: FormFieldComponent
Returns whether carat is at leftmost position.

Specified by:
isCaretLeft in interface FormFieldComponent
Returns:
true if caret is at leftmost position

isCaretRight

public boolean isCaretRight()
Description copied from interface: FormFieldComponent
Returns whether caret is at rightmost position.

Specified by:
isCaretRight in interface FormFieldComponent
Returns:
true if caret is at rightmost position

setCaretLeft

public void setCaretLeft()
Description copied from interface: FormFieldComponent
Sets the caret to leftmost position.

Specified by:
setCaretLeft in interface FormFieldComponent

setCaretRight

public void setCaretRight()
Description copied from interface: FormFieldComponent
Sets the caret to rightmost position.

Specified by:
setCaretRight in interface FormFieldComponent

upLeft

public void upLeft()
Description copied from interface: FormFieldComponent
Move caret to the left side of field and if already there move to previous field.

Specified by:
upLeft in interface FormFieldComponent

downRight

public void downRight()
Description copied from interface: FormFieldComponent
Move the caret to the right side of field and if already there move to next field.

Specified by:
downRight in interface FormFieldComponent

setConvert

public void setConvert(char convert)
Description copied from interface: FormFieldComponent
Sets character upper/lowercase conversion.
Notice that changing the character conversion will immediately convert.

Specified by:
setConvert in interface FormFieldComponent
Parameters:
convert - one of FormField.CONVERT_...

getConvert

public char getConvert()
Description copied from interface: FormFieldComponent
Gets the current convesion

Specified by:
getConvert in interface FormFieldComponent
Returns:
the conversion, default is CONVERT_NONE

setAutoSelect

public void setAutoSelect(boolean autoselect)
Description copied from interface: FormFieldComponent
Sets the auto-select feature.
A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus. Useful for numerical fields, for example.

Specified by:
setAutoSelect in interface FormFieldComponent
Parameters:
autoselect - true if autoselect enabled, false if disabled (default)

isAutoSelect

public boolean isAutoSelect()
Description copied from interface: FormFieldComponent
Returns whether the auto-select feature is enabled.

Specified by:
isAutoSelect in interface FormFieldComponent
Returns:
true if autoselect enabled, false if disabled (default)

setAutoUpdate

public void setAutoUpdate(boolean autoupdate)
Description copied from interface: FormFieldComponent
Sets the auto-update feature.
By default, all components update the data model if the view changes (due to certain events, for example focus lost).

Specified by:
setAutoUpdate in interface FormFieldComponent
Parameters:
autoupdate - true if auto update the data (default), false if not

isAutoUpdate

public boolean isAutoUpdate()
Description copied from interface: FormFieldComponent
Returns whether the auto-update feature is enabled.

Specified by:
isAutoUpdate in interface FormFieldComponent
Returns:
true if auto update the data (default), false if not

setValidChars

public void setValidChars(String str)
Description copied from interface: FormFieldComponent
Sets allowed characters.

Specified by:
setValidChars in interface FormFieldComponent
Parameters:
str - the valid characters, null = all (default)

getValidChars

public String getValidChars()
Description copied from interface: FormFieldComponent
Gets allowed characters.

Specified by:
getValidChars in interface FormFieldComponent
Returns:
the valid characters, null = all (default)

setInvalidChars

public void setInvalidChars(String str)
Description copied from interface: FormFieldComponent
Sets invalid characters.

Specified by:
setInvalidChars in interface FormFieldComponent
Parameters:
str - the invalid characters, null = none (default)

getInvalidChars

public String getInvalidChars()
Description copied from interface: FormFieldComponent
Gets invalid characters.

Specified by:
getInvalidChars in interface FormFieldComponent
Returns:
the invalid characters, null = none (default)

setFiller

public void setFiller(char filler)
Description copied from interface: FormFieldComponent
Sets the fill char.
The fill char determines the adjustment of the text data.

Specified by:
setFiller in interface FormFieldComponent
Parameters:
filler - the fill character
See Also:
FormFieldComponent.setAdjust(char)

getFiller

public char getFiller()
Description copied from interface: FormFieldComponent
Gets the current fill char.

Specified by:
getFiller in interface FormFieldComponent
Returns:
the filler, default is blank (space)

setOverwrite

public void setOverwrite(boolean override)
Description copied from interface: FormFieldComponent
Sets the insert/override mode.

Specified by:
setOverwrite in interface FormFieldComponent
Parameters:
override - true if override, false if insert (default)

isOverwrite

public boolean isOverwrite()
Description copied from interface: FormFieldComponent
Gets the current override mode.

Specified by:
isOverwrite in interface FormFieldComponent
Returns:
true if override, false if insert (default)

setEraseFirst

public void setEraseFirst(boolean erasefirst)
Description copied from interface: FormFieldComponent
Sets whether to erase the field after first setText().

Specified by:
setEraseFirst in interface FormFieldComponent
Parameters:
erasefirst - true to clear after first setText

isEraseFirst

public boolean isEraseFirst()
Description copied from interface: FormFieldComponent
Returns whether to erase the field after first setText().

Specified by:
isEraseFirst in interface FormFieldComponent
Returns:
true to clear after first setText

setFormat

public void setFormat(String pattern)
The format will be ignored in FormTextArea.

Specified by:
setFormat in interface FormFieldComponent
Parameters:
pattern - the format string

getFormat

public String getFormat()
The format will be ignored in FormTextArea.

Specified by:
getFormat in interface FormFieldComponent
Returns:
the empty string

doFormat

public String doFormat(Object object)
The format will be ignored in FormTextArea.

Specified by:
doFormat in interface FormFieldComponent
Parameters:
object - the object
Returns:
just returns the given string

setAutoNext

public void setAutoNext(boolean autonext)
Description copied from interface: FormFieldComponent
Sets the auto-next feature.
If autonext is enabled the next component will automatically receive the focus if the maximum number of characters is reached. Only meaningful if maxColumns > 0

Specified by:
setAutoNext in interface FormFieldComponent
Parameters:
autonext - true if autonext enabled, false if disabled (default)

isAutoNext

public boolean isAutoNext()
Description copied from interface: FormFieldComponent
Returns whether the auto-next feature is enabled.

Specified by:
isAutoNext in interface FormFieldComponent
Returns:
true if autonext enabled, false if disabled (default)

setAdjust

public void setAdjust(char adjust)
Description copied from interface: FormFieldComponent
Sets character adjustment.
By default the text input data is trimmed, i.e. fill characters (space by default) to the left and right are removed. This is not be mixed up with the horizontal orientation!

Specified by:
setAdjust in interface FormFieldComponent
Parameters:
adjust - one of FormField.ADJUST_...
See Also:
FormFieldComponent.setFiller(char)

getAdjust

public char getAdjust()
Description copied from interface: FormFieldComponent
Gets the current adjustment.

Specified by:
getAdjust in interface FormFieldComponent
Returns:
the adjustment, default ADJUST_TRIM

setMaxColumns

public void setMaxColumns(int maxColumns)
Description copied from interface: FormFieldComponent
Sets the maximum number of columns.

Specified by:
setMaxColumns in interface FormFieldComponent
Parameters:
maxColumns - the maximum number of columns, 0 if unlimited (default)

getMaxColumns

public int getMaxColumns()
Description copied from interface: FormFieldComponent
Gets the maximum number of columns.

Specified by:
getMaxColumns in interface FormFieldComponent
Returns:
the maximum number of columns, 0 if unlimited (default)

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Not implemented in FormTextArea.

Sets the horizontal alignment.

Specified by:
setHorizontalAlignment in interface FormFieldComponent
Parameters:
alignment - the alignment
See Also:
Component

getHorizontalAlignment

public int getHorizontalAlignment()
Not implemented in FormTextArea.

Gets the horizontal alignment.

Specified by:
getHorizontalAlignment in interface FormFieldComponent
Returns:
the horizontal alignment
See Also:
Component

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Description copied from interface: FormFieldComponent
Sets the vertical alignment.
Can only be used in Tentackle-LookAndFeels!

Specified by:
setVerticalAlignment in interface FormFieldComponent
Parameters:
alignment - the vertical alignment

getVerticalAlignment

public int getVerticalAlignment()
Description copied from interface: FormFieldComponent
Gets the vertical alignment.

Specified by:
getVerticalAlignment in interface FormFieldComponent
Returns:
the vertical alignment

isInhibitAutoSelect

public boolean isInhibitAutoSelect()
Description copied from interface: FormFieldComponent
Returns whether auto-select is inhibited (once).

Specified by:
isInhibitAutoSelect in interface FormFieldComponent
Returns:
true if inhibited

setInhibitAutoSelect

public void setInhibitAutoSelect(boolean inhibitAutoSelect)
Description copied from interface: FormFieldComponent
Sets auto-select to be inhibited inhibited (once).

Specified by:
setInhibitAutoSelect in interface FormFieldComponent
Parameters:
inhibitAutoSelect - true if inhibited

setFireRunning

public void setFireRunning(boolean fireRunning)
Description copied from interface: FormComponent
Sets a component's flag that a fire-method is currently running.
Used by the framework to minimize valueChanged/valueEntered processing.

Specified by:
setFireRunning in interface FormComponent
Parameters:
fireRunning - true if some fire-method is running

isFireRunning

public boolean isFireRunning()
Description copied from interface: FormComponent
Checks whether a fire-method is running.

Specified by:
isFireRunning in interface FormComponent
Returns:
true if some fire-method is running

setFormWrapWindow

public void setFormWrapWindow(FormWindow parent)
Description copied from interface: FormComponent
Sets the window that will fire a FormWrapEvent when this components loses the keyboard focus. When fired the reference to the window is cleared.

Specified by:
setFormWrapWindow in interface FormComponent
Parameters:
parent - the window (usually the parent window of this component).

getConverter

public StringConverter getConverter()
Description copied from interface: FormFieldComponent
Gets the current converter. Default is null.

Specified by:
getConverter in interface FormFieldComponent
Returns:
the converter.

setConverter

public void setConverter(StringConverter converter)
Description copied from interface: FormFieldComponent
Sets the string converter.
Besides the lower/uppercase conversion an optional StringConverter may be set to translate characters.

Specified by:
setConverter in interface FormFieldComponent
Parameters:
converter - the converter, null if none (default)

getErrorOffset

public int getErrorOffset()
TextArea's don't provide formatting and thus no possibilities for errors.

Specified by:
getErrorOffset in interface FormFieldComponent
Returns:
always -1 (no error)

isEmpty

public boolean isEmpty()
Description copied from interface: FormFieldComponent
Determines whether this component is empty.

Specified by:
isEmpty in interface FormFieldComponent
Returns:
true if empty

setStartEditLeftmost

public void setStartEditLeftmost(boolean startEditLeftmost)
Description copied from interface: FormFieldComponent
Sets whether to start edit leftmost in this component (once).

Specified by:
setStartEditLeftmost in interface FormFieldComponent
Parameters:
startEditLeftmost - true if start edit leftmost

isStartEditLeftmost

public boolean isStartEditLeftmost()
Description copied from interface: FormFieldComponent
Returns whether to start edit leftmost in this component (once).

Specified by:
isStartEditLeftmost in interface FormFieldComponent
Returns:
true if start edit leftmost


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de