com.sas.swing.visuals.tableview
Class DefaultTableCellRenderer

com.sas.swing.visuals.tableview.DefaultTableCellRenderer
All Implemented Interfaces:
Constants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants, javax.swing.table.TableCellRenderer
Direct Known Subclasses:
DateRenderer, DefaultTableHeaderRenderer, IconRenderer, NumberRenderer

public class DefaultTableCellRenderer
implements javax.swing.table.TableCellRenderer, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  javax.swing.border.Border border
           
protected  java.awt.Font font
           
protected  boolean gettingRenderer
           
protected  boolean isSelected
           
protected  java.util.Locale locale
           
protected static javax.swing.border.Border noFocusBorder
           
protected  java.lang.Character splitCharacter
           
protected  com.sas.util.transforms.TransformInterface transform
           
protected  java.awt.Color unselectedBackground
           
protected  java.awt.Color unselectedForeground
           
 
Fields inherited from class com.sas.swing.visuals.LabelView
alignmentMode, BLOCK, clipped, INDIVIDUAL, leadingContentOffset, lineGap, lineWrap, orientation, preferredSpanSize, replaceNewline, replaceTab, SPAN_FILL, tabSize, topContentOffset, wordWrap
 
Fields inherited from interface com.sas.swing.Constants
CENTER_BOTTOM, CENTER_LEADING, CENTER_LEFT, CENTER_RIGHT, CENTER_TOP, CENTER_TRAILING
 
Constructor Summary
DefaultTableCellRenderer()
          Creates a default table cell renderer.
DefaultTableCellRenderer(java.lang.Character splitCharacter)
          Creates a default cell renderer and sets the split character to the given character.
 
Method Summary
 boolean equals(java.lang.Object o)
          Overrode the equals method to determine if this renderer equals the given renderer.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Overridden for performance reasons.
 java.util.Locale getLocale()
          Returns the Locale that is used on the transform for the renderer.
 java.lang.Character getSplitCharacter()
          Returns the split character which is the character the gets replace with a newline character anytime it is present in the cell value.
 java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the default table cell renderer.
 com.sas.util.transforms.TransformInterface getTransform()
          Returns the TransformInterface that is used to convert the value from the model into text to be displayed.
 boolean isOpaque()
          Overridden for performance reasons.
 void repaint(long tm, int x, int y, int width, int height)
          Overridden for performance reasons.
 void repaint(java.awt.Rectangle r)
          Overridden for performance reasons.
 void revalidate()
          Overridden for performance reasons.
 void setBackground(java.awt.Color c)
          Overrides JComponent.setBackground to assign the unselected-background color to the specified color.
 void setBorder(javax.swing.border.Border newBorder)
          Overrides JComponent.setBorder to assign the border to the specified border.
 void setFont(java.awt.Font newFont)
          Overrides JComponent.setFont to assign the font to the specified font.
 void setForeground(java.awt.Color c)
          Overrides JComponent.setForeground to assign the unselected-foreground color to the specified color.
 void setLocale(java.util.Locale newLocale)
          Sets the locale to use on the transform for the renderer.
protected  void setSelected(boolean b)
           
 void setSplitCharacter(java.lang.Character newValue)
          Set the split character to the given character, or null to clear the split character.
 void setTransform(com.sas.util.transforms.TransformInterface newTransform)
          Sets the new transform to use for converting values from the model into displayable text.
protected  void setValue(java.lang.Object value)
          Sets the string for the cell being rendered to value.
 void updateUI()
          Notification from the UIManager that the look and feel [L&F] has changed.
 void validate()
          Overridden for performance reasons.
 
Methods inherited from class com.sas.swing.visuals.LabelView
checkHorizontalKey, checkVerticalKey, getAlignmentMode, getExtendedBeanInfo, getGapBetweenLines, getHorizontalAlignment, getHorizontalTextPosition, getLeadingContentOffset, getLineWrap, getOrientation, getPreferredSpanSize, getTabSize, getTopContentOffset, getUIClassID, getVerticalAlignment, getVerticalTextPosition, getWrapStyleWord, initializeLocalVars, isClipped, setAlignmentMode, setClipped, setGapBetweenLines, setHorizontalAlignment, setHorizontalTextPosition, setLeadingContentOffset, setLineWrap, setOrientation, setPreferredSpanSize, setTabSize, setTopContentOffset, setVerticalAlignment, setVerticalTextPosition, setWrapStyleWord
 

Field Detail

noFocusBorder

protected static javax.swing.border.Border noFocusBorder

unselectedForeground

protected java.awt.Color unselectedForeground

unselectedBackground

protected java.awt.Color unselectedBackground

border

protected javax.swing.border.Border border

font

protected java.awt.Font font

isSelected

protected boolean isSelected

transform

protected com.sas.util.transforms.TransformInterface transform

splitCharacter

protected java.lang.Character splitCharacter

gettingRenderer

protected boolean gettingRenderer

locale

protected java.util.Locale locale
Constructor Detail

DefaultTableCellRenderer

public DefaultTableCellRenderer()
Creates a default table cell renderer.


DefaultTableCellRenderer

public DefaultTableCellRenderer(java.lang.Character splitCharacter)
Creates a default cell renderer and sets the split character to the given character.

Parameters:
splitCharacter -
Method Detail

setLocale

public void setLocale(java.util.Locale newLocale)
Sets the locale to use on the transform for the renderer. The locale will only be set on the transform if the default transform is being used, otherwise it is the users responsibility to make sure the transform is handling the locale correctly.

Overrides:
setLocale in class java.awt.Component
Parameters:
newLocale - the locale to use
See Also:
getLocale()

getLocale

public java.util.Locale getLocale()
Returns the Locale that is used on the transform for the renderer. The locale will only be used on the transform if the default transform is being used, otherwise it is the users responsibility to make sure the transform is handling the locale correctly.

Overrides:
getLocale in class java.awt.Component
Returns:
the locale to use on the transform for converting values into the correct locale
See Also:
setLocale(Locale)

setSplitCharacter

public void setSplitCharacter(java.lang.Character newValue)
Set the split character to the given character, or null to clear the split character. If a character is set, anytime that character is in the value for the cell, a newline will be inserted and the character will be removed.

Parameters:
newValue - the new split character or null to clear
See Also:
getSplitCharacter()

getSplitCharacter

public java.lang.Character getSplitCharacter()
Returns the split character which is the character the gets replace with a newline character anytime it is present in the cell value. By default, the split character is null.

Returns:
the split character for the renderer
See Also:
setSplitCharacter(Character)

setForeground

public void setForeground(java.awt.Color c)
Overrides JComponent.setForeground to assign the unselected-foreground color to the specified color.

Overrides:
setForeground in class javax.swing.JComponent
Parameters:
c - set the foreground color to this value

setBackground

public void setBackground(java.awt.Color c)
Overrides JComponent.setBackground to assign the unselected-background color to the specified color.

Overrides:
setBackground in class javax.swing.JComponent
Parameters:
c - set the background color to this value

setBorder

public void setBorder(javax.swing.border.Border newBorder)
Overrides JComponent.setBorder to assign the border to the specified border.

Overrides:
setBorder in class javax.swing.JComponent
Parameters:
newBorder - set the border to this value

setFont

public void setFont(java.awt.Font newFont)
Overrides JComponent.setFont to assign the font to the specified font.

Overrides:
setFont in class javax.swing.JComponent
Parameters:
c - set the font to this value

setTransform

public void setTransform(com.sas.util.transforms.TransformInterface newTransform)
Sets the new transform to use for converting values from the model into displayable text. By default, the renderer uses the com.sas.util.transforms.ObjectToStringTransform class.

Parameters:
newTransform - the new transform to use

getTransform

public com.sas.util.transforms.TransformInterface getTransform()
Returns the TransformInterface that is used to convert the value from the model into text to be displayed. By default, the renderer uses the com.sas.util.transforms.ObjectToStringTransform class.

Returns:
the transform to use for converting values into displayable text

updateUI

public void updateUI()
Notification from the UIManager that the look and feel [L&F] has changed. Replaces the current UI object with the latest version from the UIManager.

Overrides:
updateUI in class LabelView
See Also:
JComponent.updateUI()

setSelected

protected void setSelected(boolean b)

getTableCellRendererComponent

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                        java.lang.Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
                                                        int row,
                                                        int column)
Returns the default table cell renderer.

Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
Parameters:
table - the JTable
value - the value to assign to the cell at [row, column]
isSelected - true if cell is selected
isFocus - true if cell has focus
row - the row of the cell to render
column - the column of the cell to render
Returns:
the default table cell renderer

isOpaque

public boolean isOpaque()
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
isOpaque in class javax.swing.JComponent

validate

public void validate()
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
validate in class java.awt.Container

revalidate

public void revalidate()
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
revalidate in class javax.swing.JComponent

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
repaint in class javax.swing.JComponent

repaint

public void repaint(java.awt.Rectangle r)
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
repaint in class javax.swing.JComponent

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Overridden for performance reasons. See the Implementation Note for more information.

Overrides:
firePropertyChange in class java.awt.Component

setValue

protected void setValue(java.lang.Object value)
Sets the string for the cell being rendered to value.

Parameters:
value - the string value for this cell; if value is null it sets the text value to an empty string
See Also:
JLabel.setText(java.lang.String)

equals

public boolean equals(java.lang.Object o)
Overrode the equals method to determine if this renderer equals the given renderer.

Overrides:
equals in class java.lang.Object
Parameters:
o - the comparison Object
Returns:
true if equal, false otherwise



Copyright © 2009 SAS Institute Inc. All Rights Reserved.