org.tentackle.ui
Class FormTextAreaTableCellRenderer

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
                          extended by org.tentackle.ui.FormTextAreaTableCellRenderer
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, TableCellRenderer, FormComponent, FormFieldComponent

public class FormTextAreaTableCellRenderer
extends FormTextArea
implements TableCellRenderer, Serializable

A multi line text area table cell renderer.

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
FormTextAreaTableCellRenderer()
          Creates a text area table cell renderer.
 
Method Summary
 Color getFocusedBackground()
          Gets the color for the focused background.
 Color getFocusedForeground()
          Gets the color for the focused foreground.
 Font getRenderingFont()
          Gets the rendering default font.
 Color getSelectedBackground()
          Gets the color for the selected background.
 Color getSelectedForeground()
          Gets the color for the selected foreground.
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the component used for drawing the cell.
 Color getUnselectedBackground()
          Gets the color for the unselected background.
 Color getUnselectedForeground()
          Gets the color for the unselected foreground.
 boolean isAutoRowHeight()
          Returns whether automatic adjustment of the row height is enabled.
 void repaint(long tm, int x, int y, int width, int height)
          Overridden for performance reasons.
 void repaint(Rectangle r)
          Overridden for performance reasons.
 void revalidate()
          Overridden for performance reasons.
 void setAutoRowHeight(boolean autoRowHeight)
          Enables or disables automatic adjustment of the row height.
 void setBackground(Color c)
          Sets the background color of this component.
 void setFocusedBackground(Color c)
          Sets the color for the focused background.
 void setFocusedForeground(Color c)
          Sets the color for the focused foreground.
 void setForeground(Color c)
          Sets the foreground color of this component.
 void setRenderingFont(Font font)
          Sets the rendering default font.
 void setSelectedBackground(Color c)
          Sets the color for the selected background.
 void setSelectedForeground(Color c)
          Sets the color for the selected foreground.
 void setUnselectedBackground(Color c)
          Sets the color for the unselected background.
 void setUnselectedForeground(Color c)
          Sets the color for the unselected foreground.
 void updateUI()
          Reloads the pluggable UI.
 void validate()
          Overridden for performance reasons.
 
Methods inherited from class org.tentackle.ui.FormTextArea
addActionListener, addValueListener, clearText, createDefaultModel, doActionPerformed, doFormat, doSmartEnter, downRight, fireActionPerformed, fireValueChanged, fireValueEntered, getAdjust, getConvert, getConverter, getErrorOffset, getFiller, getFormat, getFormValue, getHelpURL, getHorizontalAlignment, getInvalidChars, getMaxColumns, getOptimalSize, getParentWindow, getToolTipText, getValidChars, getVerticalAlignment, invalidateParentInfo, isAutoNext, isAutoSelect, isAutoUpdate, isCaretLeft, isCaretRight, isCellEditorUsage, isChangeable, isEmpty, isEraseFirst, isFireRunning, isFormTraversable, isHonourChangeable, isInhibitAutoSelect, isOverwrite, isSmartEnter, isStartEditLeftmost, isValueChanged, prepareFocusLost, processFocusEvent, processKeyEvent, processMouseEvent, removeActionListener, removeValueListener, requestFocusLater, saveValue, setAdjust, setAutoNext, setAutoSelect, setAutoUpdate, setCaretLeft, setCaretRight, setCellEditorUsage, setChangeable, setConvert, setConverter, setEditable, setEraseFirst, setFiller, setFireRunning, setFormat, setFormTraversable, setFormValue, setFormWrapWindow, setHelpURL, setHonourChangeable, setHorizontalAlignment, setInhibitAutoSelect, setInvalidChars, setMaxColumns, setOverwrite, setSmartEnter, setStartEditLeftmost, setText, setValidChars, setVerticalAlignment, showHelp, transferFocus, transferFocusBackward, triggerValueChanged, upLeft, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnter
 
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, 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, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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

FormTextAreaTableCellRenderer

public FormTextAreaTableCellRenderer()
Creates a text area table cell renderer.

Method Detail

setSelectedForeground

public void setSelectedForeground(Color c)
Sets the color for the selected foreground.

Parameters:
c - the foreground color

getSelectedForeground

public Color getSelectedForeground()
Gets the color for the selected foreground.

Returns:
the foreground color

setSelectedBackground

public void setSelectedBackground(Color c)
Sets the color for the selected background.

Parameters:
c - the background color

getSelectedBackground

public Color getSelectedBackground()
Gets the color for the selected background.

Returns:
the background color

setUnselectedForeground

public void setUnselectedForeground(Color c)
Sets the color for the unselected foreground.

Parameters:
c - the unselected foreground color

getUnselectedForeground

public Color getUnselectedForeground()
Gets the color for the unselected foreground.

Returns:
the unselected foreground color

setUnselectedBackground

public void setUnselectedBackground(Color c)
Sets the color for the unselected background.

Parameters:
c - the unselected background color

getUnselectedBackground

public Color getUnselectedBackground()
Gets the color for the unselected background.

Returns:
the unselected background color

setFocusedForeground

public void setFocusedForeground(Color c)
Sets the color for the focused foreground.

Parameters:
c - the focused foreground color

getFocusedForeground

public Color getFocusedForeground()
Gets the color for the focused foreground.

Returns:
the focused foreground color

setFocusedBackground

public void setFocusedBackground(Color c)
Sets the color for the focused background.

Parameters:
c - the focused background color

getFocusedBackground

public Color getFocusedBackground()
Gets the color for the focused background.

Returns:
the focused background color

setRenderingFont

public void setRenderingFont(Font font)
Sets the rendering default font.

Parameters:
font - the font

getRenderingFont

public Font getRenderingFont()
Gets the rendering default font.

Returns:
the font

setAutoRowHeight

public void setAutoRowHeight(boolean autoRowHeight)
Enables or disables automatic adjustment of the row height.

Parameters:
autoRowHeight - true if enabled

isAutoRowHeight

public boolean isAutoRowHeight()
Returns whether automatic adjustment of the row height is enabled.

Returns:
true if enabled

setForeground

public void setForeground(Color c)
Sets the foreground color of this component. It is up to the look and feel to honor this property, some may choose to ignore it.

Overridden to assign the unselected-foreground color to the specified color.

Overrides:
setForeground in class JComponent
Parameters:
c - the desired foreground Color
See Also:
Component.getForeground()

setBackground

public void setBackground(Color c)
Sets the background color of this component. The background color is used only if the component is opaque, and only by subclasses of JComponent or ComponentUI implementations. Direct subclasses of JComponent must override paintComponent to honor this property.

It is up to the look and feel to honor this property, some may choose to ignore it.

Overridden to assign the unselected-background color to the specified color.

Overrides:
setBackground in class JComponent
Parameters:
c - the desired background Color
See Also:
Component.getBackground(), JComponent.setOpaque(boolean)

updateUI

public void updateUI()
Reloads the pluggable UI. The key used to fetch the new interface is getUIClassID(). The type of the UI is TextUI. invalidate is called after setting the UI.

Overridden to clear the background anf foreground colors.

Overrides:
updateUI in class JTextComponent
See Also:
JComponent.setUI(javax.swing.plaf.ComponentUI), UIManager.getLookAndFeel(), UIManager.getUI(javax.swing.JComponent)

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Description copied from interface: javax.swing.table.TableCellRenderer
Returns the component used for drawing the cell. This method is used to configure the renderer appropriately before drawing.

The TableCellRenderer is also responsible for rendering the the cell representing the table's current DnD drop location if it has one. If this renderer cares about rendering the DnD drop location, it should query the table directly to see if the given row and column represent the drop location:

     JTable.DropLocation dropLocation = table.getDropLocation();
     if (dropLocation != null
             && !dropLocation.isInsertRow()
             && !dropLocation.isInsertColumn()
             && dropLocation.getRow() == row
             && dropLocation.getColumn() == column) {

         // this cell represents the current drop location
         // so render it specially, perhaps with a different color
     }
 

During a printing operation, this method will be called with isSelected and hasFocus values of false to prevent selection and focus from appearing in the printed output. To do other customization based on whether or not the table is being printed, check the return value from JComponent.isPaintingForPrint().

Specified by:
getTableCellRendererComponent in interface TableCellRenderer
Parameters:
table - the JTable that is asking the renderer to draw; can be null
value - the value of the cell to be rendered. It is up to the specific renderer to interpret and draw the value. For example, if value is the string "true", it could be rendered as a string or it could be rendered as a check box that is checked. null is a valid value
isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
hasFocus - if true, render cell appropriately. For example, put a special border on the cell, if the cell can be edited, render in the color used to indicate editing
row - the row index of the cell being drawn. When drawing the header, the value of row is -1
column - the column index of the cell being drawn
See Also:
JComponent.isPaintingForPrint()

validate

public void validate()
Overridden for performance reasons.

Overrides:
validate in class Container
See Also:
Container.add(java.awt.Component), Component.invalidate(), JComponent.revalidate(), Container.validateTree()

revalidate

public void revalidate()
Overridden for performance reasons.

Overrides:
revalidate in class JComponent
See Also:
Component.invalidate(), Container.validate(), JComponent.isValidateRoot(), RepaintManager.addInvalidComponent(javax.swing.JComponent)

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Overridden for performance reasons.

Overrides:
repaint in class JComponent
Parameters:
tm - this parameter is not used
x - the x value of the dirty region
y - the y value of the dirty region
width - the width of the dirty region
height - the height of the dirty region
See Also:
Component.isShowing(), RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)

repaint

public void repaint(Rectangle r)
Overridden for performance reasons.

Overrides:
repaint in class JComponent
Parameters:
r - a Rectangle containing the dirty region
See Also:
Component.isShowing(), RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)


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