com.retek.commons.gui.widget
Class RTextArea

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.text.JTextComponent
                  extended byjavax.swing.JTextArea
                      extended bycom.retek.commons.gui.widget.RTextArea
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable, WidgetInterface

public class RTextArea
extends javax.swing.JTextArea
implements java.awt.event.KeyListener, WidgetInterface

This class subclasses the standard JTextArea class in the Swing package to provide custom functionality for the RCOM client application. It can also limit the number of characters entered in the text area.

Retek Inc. Copyright (c) 2002

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTextArea
javax.swing.JTextArea.AccessibleJTextArea
 
Nested classes inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.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
RTextArea()
          Returns new RTextArea object.
 
Method Summary
 void append(java.lang.String text)
          Appends text to the text area.
 void clear()
          Clears the text area of input.
 java.lang.String getClusterName()
          Retrieves the cluster name of the widget.
 int getLength()
          Returns the allowable text length.
 java.lang.String getText()
          Retrieves the text string from the text field.
 boolean isEmpty()
          Retrieves whether or not the text area is empty.
 boolean isErrorState()
          Retrieves whether or not the text area is in an error state.
 void keyPressed(java.awt.event.KeyEvent event)
          Implements the key listener interface "key pressed" method.
 void keyReleased(java.awt.event.KeyEvent event)
          Implements the key listener interface "key released" method.
 void keyTyped(java.awt.event.KeyEvent event)
          Implements the key listener interface "key typed" method.
 void paste()
          Overrides paste() to make sure they do not paste more text than the area is allowed.
 void refresh()
          Refreshes the text area (this will trigger the formatting and line length logic).
 void removeMask()
          Removes the mask assigned to this text area.
 void setBackground(java.awt.Color color)
           
 void setClusterName(java.lang.String clusterName)
          Sets the cluster name of the widget.
 void setEnabled(boolean enabled)
          Overrides JTextArea method to automatically update the color state of the widget.
 void setErrorState(boolean errorState)
          Sets the colors of the text area to an error state.
 void setFocusedState()
          Sets the text area into focused state mode.
 void setForeground(java.awt.Color color)
           
 void setLength(int length)
          Sets the allowable text length.
 void setMask(Mask formatMask)
          Assigns a format mask to the text area.
 void setQuickEntries(java.util.Map map)
          Sets the quick entry keystroke to replacement string mapping for the text area.
 void setText(java.lang.String text)
          Assigns the text in the area.
 void setText(java.lang.String[] textArray)
          Assigns the text in the text field, formatted from a string array through a mask.
 void setUseInactiveColor(boolean useColor)
          Sets whether or not to use the inactive color state of the text field.
 
Methods inherited from class javax.swing.JTextArea
createDefaultModel, 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, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, 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, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, 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, 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, processMouseEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.retek.commons.gui.core.WidgetInterface
getName, setName
 

Constructor Detail

RTextArea

public RTextArea()
Returns new RTextArea object.

Method Detail

setLength

public void setLength(int length)
Sets the allowable text length. This activates the field.

Parameters:
length - The length in characters that the text field should allow.

getLength

public int getLength()
Returns the allowable text length.

Returns:
The length in characters that the text field should allow.

setMask

public void setMask(Mask formatMask)
Assigns a format mask to the text area. The specific mask is cast to the interface for generic operability.

Parameters:
formatMask - A format mask to assign to this text area.

removeMask

public void removeMask()
Removes the mask assigned to this text area.


setUseInactiveColor

public void setUseInactiveColor(boolean useColor)
Sets whether or not to use the inactive color state of the text field. If true, a special color will be assigned to the text field. If false, it will not.

Parameters:
useColor - True if inactive colors should be used, false if not.

paste

public void paste()
Overrides paste() to make sure they do not paste more text than the area is allowed.


refresh

public void refresh()
Refreshes the text area (this will trigger the formatting and line length logic).


setText

public void setText(java.lang.String text)
Assigns the text in the area. The text will be formatted if a mask exists. Text longer than the allowed length is, interestingly, not allowed.

Parameters:
text - The text to place in the text area.

setText

public void setText(java.lang.String[] textArray)
Assigns the text in the text field, formatted from a string array through a mask.

Parameters:
textArray - An array of strings to format through a mask.

append

public void append(java.lang.String text)
Appends text to the text area.


getText

public java.lang.String getText()
Retrieves the text string from the text field. Overrides superclass to handle unformatting and trimming.

Returns:
The unformatted and trimmed text.

isEmpty

public boolean isEmpty()
Retrieves whether or not the text area is empty.

Returns:
True if the text area is empty, false if not.

clear

public void clear()
Clears the text area of input.


keyReleased

public void keyReleased(java.awt.event.KeyEvent event)
Implements the key listener interface "key released" method. If quick entries has been activated for the text area, then the current built word must be reinitialized if a key was released and the SHIFT and ALT is not pressed.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

keyPressed

public void keyPressed(java.awt.event.KeyEvent event)
Implements the key listener interface "key pressed" method. The method tracks whether or not the key pressed was the backspace or delete key. In addition, if the ENTER key is pressed, it transfers the focus to the next focusable field.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

keyTyped

public void keyTyped(java.awt.event.KeyEvent event)
Implements the key listener interface "key typed" method. It captures the key typed action, checks to see if the allowable length is reached and if the key is not a backspace/delete/left arrow key, then the key is ignored.

If the text in the field is selected, a new keystroke would replace the selected text and by default that means we cannot allow the event to continue.

If quick entry has been activated, the system must look for SHIFT/ALT and then find if the sequence of characters in the built up word exists in the quickmap. If it does the information should be appended to the text area.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

setQuickEntries

public void setQuickEntries(java.util.Map map)
Sets the quick entry keystroke to replacement string mapping for the text area.


setClusterName

public void setClusterName(java.lang.String clusterName)
Sets the cluster name of the widget. A cluster name associates a group of widgets.

Specified by:
setClusterName in interface WidgetInterface
Parameters:
clusterName - The cluster name to assign to the widget.

getClusterName

public java.lang.String getClusterName()
Retrieves the cluster name of the widget.

Specified by:
getClusterName in interface WidgetInterface

setBackground

public void setBackground(java.awt.Color color)
See Also:
in JTextArea.

setForeground

public void setForeground(java.awt.Color color)
See Also:
in JTextArea.

setEnabled

public void setEnabled(boolean enabled)
Overrides JTextArea method to automatically update the color state of the widget.


setErrorState

public void setErrorState(boolean errorState)
Sets the colors of the text area to an error state.

Specified by:
setErrorState in interface WidgetInterface
Parameters:
errorState - True if the widget is in error state, false if not.

isErrorState

public boolean isErrorState()
Retrieves whether or not the text area is in an error state.

Specified by:
isErrorState in interface WidgetInterface
Returns:
True if the text area is in an error state, false if not

setFocusedState

public void setFocusedState()
Sets the text area into focused state mode.

Specified by:
setFocusedState in interface WidgetInterface


Copyright © 2004 Retek Inc. All Rights Reserved. - Generated at Fri, 10/22/2004 07:28