Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class JFormattedLabelCellRenderer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by com.ibm.etools.iseries.ui.JFormattedLabel
                      extended by com.ibm.etools.iseries.ui.JFormattedLabelCellRenderer
All Implemented Interfaces:
JFormattedComponent, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, TableCellRenderer

public class JFormattedLabelCellRenderer
extends JFormattedLabel
implements TableCellRenderer

A wrapper class of com.ibm.etools.iseries.ui.JFormattedLabel to implement the interface javax.swing.table.TableCellRenderer. It can be used as a table cell renderer for a JFormattedTableColumn, particular for AS/400 data.

See Also:
JFormattedLabel, TableCellRenderer, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JLabel
JLabel.AccessibleJLabel
 
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
static String Copyright
           
protected  Border noFocusBorder
           
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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 com.ibm.etools.iseries.ui.JFormattedComponent
copyright
 
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
JFormattedLabelCellRenderer()
          Creates a new JFormattedLabelCellRenderer
JFormattedLabelCellRenderer(Attributes dataAttributes, Formatter formatter, Validator validator, Font font)
          Creates a new JFormattedLabelCellRenderer with the specified dataAttributes, formatter, validator and font.
JFormattedLabelCellRenderer(FieldModel fm)
          Creates a new JFormattedLabelCellRenderer with the specified FieldModel
JFormattedLabelCellRenderer(Icon image)
          Creates a new JFormattedLabelCellRenderer with the specified image.
JFormattedLabelCellRenderer(Icon image, int horizontalAlignment)
          Creates a new JFormattedLabelCellRenderer with the specified image and horizontal alignment.
JFormattedLabelCellRenderer(String text)
          Creates a new JFormattedLabelCellRenderer with the specified text.
JFormattedLabelCellRenderer(String text, Icon image, int horizonalAlignment)
          Creates a new JFormattedLabelCellRenderer with the specified text, image and horizontal alignment.
JFormattedLabelCellRenderer(String text, Icon image, int horizonalAlignment, FieldModel fm)
          Creates a new JFormattedLabelCellRenderer with the specified text, image, horizontal alignment and FieldModel.
JFormattedLabelCellRenderer(String text, int horizonalAlignment)
          Creates a new JFormattedLabelCellRenderer with the specified text and horizontal alignment.
 
Method Summary
static String Copyright()
          Copyright notice.
 Border getNoFocusBorder()
          Gets the border of cells without focus.
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the component used for drawing the cell.
 void setBackground(Color background)
          Overrides JComponent.setBackground to specify the unselected-background color using the specified color.
 void setFieldModel(FieldModel fm)
          Sets the field model.
 void setForeground(Color foreground)
          Overrides JComponent.setForeground to specify the unselected-foreground color using the specified color.
 void setNoFocusBorder(Border aBorder)
          Sets the border of cells without focus.
 void setText(String text)
          Defines the single line of text this component will display.
 
Methods inherited from class com.ibm.etools.iseries.ui.JFormattedLabel
convertInternalToUnformatted, convertUnformattedToInternal, getFieldModel, getInternalValue, getUnformattedText, isValueValid, isValueValidForNumeric, setInternalValue, setUnformattedText
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

noFocusBorder

protected Border noFocusBorder
Constructor Detail

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer()
Creates a new JFormattedLabelCellRenderer


JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(Attributes dataAttributes,
                                   Formatter formatter,
                                   Validator validator,
                                   Font font)
Creates a new JFormattedLabelCellRenderer with the specified dataAttributes, formatter, validator and font. The first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise, ClassCastException will be thrown at run time.

Parameters:
dataAttributes - The data attributes such as data type, data length, decimal places, etc.
formatter - The formmatting used.
validator - The validation used.
font - The font in the label.

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(FieldModel fm)
Creates a new JFormattedLabelCellRenderer with the specified FieldModel

Parameters:
fm - The field model for formatting and validating.

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(String text)
Creates a new JFormattedLabelCellRenderer with the specified text.

Parameters:
text - The text to be displayed by the label.

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(String text,
                                   int horizonalAlignment)
Creates a new JFormattedLabelCellRenderer with the specified text and horizontal alignment.

Parameters:
text - The text to be displayed by the label.
horizonalAlignment - One of the following constants defined in Swing Constants: LEFT, CENTER, or RIGHT.

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(String text,
                                   Icon image,
                                   int horizonalAlignment)
Creates a new JFormattedLabelCellRenderer with the specified text, image and horizontal alignment.

Parameters:
text - The text to be displayed by the label.
image - The image to be displayed by the label.
horizonalAlignment - One of the following constants defined in Swing Constants: LEFT, CENTER, or RIGHT

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(String text,
                                   Icon image,
                                   int horizonalAlignment,
                                   FieldModel fm)
Creates a new JFormattedLabelCellRenderer with the specified text, image, horizontal alignment and FieldModel.

Parameters:
text - The text to be displayed by the label.
image - The image to be displayed by the label.
horizonalAlignment - One of the following constants defined in Swing Constants: LEFT, CENTER, or RIGHT
fm - The field model for formatting and validating

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(Icon image)
Creates a new JFormattedLabelCellRenderer with the specified image.

Parameters:
image - The image to be displayed by the label.

JFormattedLabelCellRenderer

public JFormattedLabelCellRenderer(Icon image,
                                   int horizontalAlignment)
Creates a new JFormattedLabelCellRenderer with the specified image and horizontal alignment.

Parameters:
image - The image to be displayed by the label.
horizontalAlignment - One of the following constants defined in Swing Constants: LEFT, CENTER, or RIGHT
Method Detail

Copyright

public static String Copyright()
Copyright notice.

Returns:
java.lang.String

getNoFocusBorder

public Border getNoFocusBorder()
Gets the border of cells without focus.

Returns:
javax.swing.border.Border

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Returns the component used for drawing the cell.

Specified by:
getTableCellRendererComponent in interface TableCellRenderer
See Also:
TableCellRenderer.getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)

setBackground

public void setBackground(Color background)
Overrides JComponent.setBackground to specify the unselected-background color using the specified color.

Overrides:
setBackground in class JComponent
Parameters:
background - The background color

setFieldModel

public void setFieldModel(FieldModel fm)
Sets the field model. If the Attribute is an instance of DataAttributes, then the error beep will be set to false.

Specified by:
setFieldModel in interface JFormattedComponent
Overrides:
setFieldModel in class JFormattedLabel
Parameters:
fm - The field model used for formatting.
See Also:
JFormattedLabel.getFieldModel()

setForeground

public void setForeground(Color foreground)
Overrides JComponent.setForeground to specify the unselected-foreground color using the specified color.

Overrides:
setForeground in class JComponent
Parameters:
foreground - The foreground color

setNoFocusBorder

public void setNoFocusBorder(Border aBorder)
Sets the border of cells without focus.

Parameters:
aBorder - The border of cells without focus.

setText

public void setText(String text)
Defines the single line of text this component will display. Whatever specified in the parameter string will be formatted only if data is valid. If data is invalid, the text background will be changed to the reverseImageColor defined in the field model's DataAttributes.

Overrides:
setText in class JFormattedLabel
Parameters:
text - The text to be drawn.

Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.