Diamond Control Suite 3.0

diamondedge.swing
Class DsTableCell

java.lang.Object
  extended by diamondedge.swing.DsTableCell
All Implemented Interfaces:
DsCell, DsCellProperties, DsConstants, Serializable, Cloneable, SwingConstants
Direct Known Subclasses:
DsListCell

public class DsTableCell
extends Object
implements DsCell, Cloneable, Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface diamondedge.swing.DsCellProperties
ALIGN_DEFAULT, ROTATE_0, ROTATE_270, ROTATE_90, ROTATE_DEFAULT
 
Fields inherited from interface diamondedge.swing.DsConstants
ACCOUNTING, ALL, ASCENDING, ASCENDING_CASE, BORDER_BOTTOM, BORDER_LEFT, BORDER_NONE, BORDER_OUTLINE, BORDER_RIGHT, BORDER_TOP, CROSS_LINES, DASH, DASH_DOT, DASH_DOT_DOT, DEFAULT, DESCENDING, DESCENDING_CASE, DIAGONAL_CROSS_LINES, DOT, DOUBLE, DOUBLE_LINE, DOWNWARD_DIAGONAL_LINES, ETCHED, ETCHED_RAISED, FALSE, FIND_ALL, FIND_EQUALS, FIND_GT, FIND_GTE, FIND_LT, FIND_LTE, FIND_NE, FIND_PREFIX, FIND_REGEX, FIND_STRING, FIRST, FLAT, GRID_DASH, GRID_DASH_DOT, GRID_DASH_DOT_DOT, GRID_DOT, GRID_LINE, HIGHLIGHT_SELECTION_ALWAYS, HIGHLIGHT_SELECTION_NEVER, HIGHLIGHT_SELECTION_WITH_FOCUS, HORIZONTAL_LINES, LOWERED, LOWERED_LIGHT, NONE, RAISED, RAISED_LIGHT, SELECT_CELL, SELECT_NONE, SELECT_ROW, SINGLE, SINGLE_LINE, SOLID, STRETCH, TILE, TRANSPARENT, TRUE, UPWARD_DIAGONAL_LINES, VERTICAL_LINES
 
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
 
Constructor Summary
protected DsTableCell()
           
protected DsTableCell(Object val)
           
 
Method Summary
 Object clone()
           
static String formatValue(DsCellProperties cell, Object value)
          Hides or unhides this cell.
 Paint getBackground()
          Returns a value which determines the background color behind the text.
 Border getBorder()
          Returns the border that will be painted on the outside.
 Paint getBorderLineColor()
          Returns a value which determines the color that line borders are drawn in.
 int getBorderLines()
          Returns a value that determines which border lines that are drawn around the cell.
 int getBorderLineWidth()
          Returns a value that determines the width of the lines that are drawn around the cell.
 int getBorderStyle()
          Returns a value that determines how the border for the cell is drawn.
 int getColumnSpan()
          Returns the number of columns this cell spans.
 Object getData()
          Returns a user defined object associated with the cell.
 int getEditableVal()
          Returns a value that determines whether the value for the cell can be edited by the user at run-time.
 Font getFont()
          Returns the Font used to display the text of the cell.
 int getFontBoldVal()
          Returns a value that determines whether the text for the cell is displayed with a bold font.
 String getFontName()
          Returns the name of the font used to display the text for the cell.
 int getFontSize()
          Returns the size of the font used to display the text for the cell.
 int getFontUnderline()
          Returns a value that determines how the text for the cell is underlined.
 Paint getForeground()
          Returns a value which determines the color of the text.
 Object getFormat()
          Returns a Format/Formatter object that determines how the text for the cell is formatted.
 int getHorizontalAlignment()
          Returns a value that determines how the text for the cell is aligned horizontally.
 int getHorizontalTextPosition()
          Returns the horizontal position of the text in relation to the icon
 Icon getIcon()
          Returns the graphic image (glyph, icon) that the label displays.
 int getRotation()
          Returns a value that determines the rotation of the text and icon.
 int getRowSpan()
          Returns the number of rows this cell spans.
 String getText()
          Returns the formatted text to display in a cell of a table.
 int getTextStyle()
          Returns a value that determines how the text for the cell is drawn.
 String getToolTipText()
          Returns the text to display when the cursor is over the cell of a table.
 Object getValue()
          Returns the value being display in a cell of a table.
 int getVerticalAlignment()
          Returns a value that determines how the text for the cell is aligned horizontally.
 int getVerticalTextPosition()
          Returns the vertical position of the text in relation to the icon
 boolean isEditable()
          Returns a value that determines whether the value for the cell can be edited by the user at run-time.
 boolean isFontBold()
          Returns a value that determines whether the text for the cell is displayed with a bold font.
 boolean isFontItalic()
          Returns a value that determines whether the text for the cell is displayed with an italic style.
 boolean isFontStrikeThrough()
          Returns a value that determines whether the text for the cell is displayed with a line through the text.
 boolean isNegativeNumberRed()
          Returns a value that determines whether negative numbers are displayed in a red color.
 boolean isOpaque()
          Returns a value that determines whether the background for the cell is painted.
 boolean isVisible()
          Returns true if this cell is not hidden.
 boolean isWordWrap()
          Returns a value that determines whether the text for the cell is wrapped onto the line below if it doesn't fit.
 void reset()
          Resets all style information back to the default values.
 void setBackground(Paint c)
          Sets a value which determines the background color behind the text.
 void setBorder(Border b)
          Sets a border that will be painted on the outside.
 void setBorder(int borderLineWidth, int borderStyle, Paint borderLineColor)
          Creates a border around the cell.
 void setBorder(int borderLineWidth, int borderStyle, Paint borderLineColor, int borderLines)
          Creates a border around the cell.
 void setBorderLineColor(Paint c)
          Sets a value which determines the color that line borders are drawn in.
 void setBorderLines(int val)
          Sets a value that determines which border lines that are drawn around the cell.
 void setBorderLineWidth(int val)
          Sets a value that determines the width of the lines that are drawn around the cell.
 void setBorderStyle(int val)
          Sets a value that determines how the border for the cell is drawn.
 void setColumnSpan(int colSpan)
          Sets the number of columns this cell spans.
 void setData(Object userData)
          Sets a user defined object to be stored with the cell.
 void setEditable(boolean val)
          Determines whether the value for the cell can be edited by the user at run-time.
 void setEditableVal(int val)
          Determines whether the value for the cell can be edited by the user at run-time.
 void setFont(Font f)
          Sets the Font used to display the text of the cell.
 void setFontBold(boolean val)
          Sets a value that determines whether the text for the cell is displayed with a bold font.
 void setFontBoldVal(int val)
          Sets a value that determines whether the text for the cell is displayed with a bold font.
 void setFontItalic(boolean italic)
          Sets a value that determines whether the text for the cell is displayed with an italic style.
 void setFontName(String name)
          Sets the name of the font used to display the text for the cell.
 void setFontSize(int size)
          Sets the size of the font used to display the text for the cell.
 void setFontStrikeThrough(boolean val)
          Sets a value that determines whether the text for the cell is displayed with a line through the text.
 void setFontUnderline(int val)
          Sets a value that determines how the text for the cell is underlined.
 void setForeground(Paint c)
          Sets a value which determines the color of the text.
 void setFormat(Object val)
          Sets a value that determines how the text for the cell is formatted.
 void setHorizontalAlignment(int val)
          Sets the horizontal alignment of the text.
 void setHorizontalTextPosition(int textPosition)
          Sets the horizontal position of the text in relation to the icon.
 void setIcon(Icon icon)
          Defines the icon this component will display.
 void setIcon(Image image)
          Defines the icon this component will display.
 void setNegativeNumberRed(boolean val)
          Sets a value that determines whether negative numbers are displayed in a red color.
 void setOpaque(boolean val)
          Sets a value that determines whether the background for the cell is painted.
 void setRotation(int val)
          Sets a value that determines the rotation of the text and icon.
protected  void setRowSpan(int rowSpan)
          Sets the number of rows this cell spans.
 void setText(String text)
          Sets the text to display in a cell of a table.
 void setTextStyle(int val)
          Sets a value that determines how the text for the cell is drawn.
 void setToolTipText(String text)
          Sets the text to display when the cursor is over the cell of a table.
 void setValue(Object val)
          Sets the value for a cell of a table.
 void setVerticalAlignment(int val)
          Sets the vertical alignment of the text.
 void setVerticalTextPosition(int textPosition)
          Sets the vertical position of the text in relation to the icon.
 void setWordWrap(boolean val)
          Sets a value that determines whether the text for the cell is wrapped onto the line below if it doesn't fit.
 String toString()
          Returns the formatted text to display in a cell of a table.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DsTableCell

protected DsTableCell()

DsTableCell

protected DsTableCell(Object val)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

reset

public final void reset()
Resets all style information back to the default values. This does not affect the value of the cell.

Specified by:
reset in interface DsCellProperties

getValue

public final Object getValue()
Returns the value being display in a cell of a table.

Specified by:
getValue in interface DsCell

setValue

public void setValue(Object val)
Sets the value for a cell of a table. The return value from toString() method will be displayed in the table. Note: this will not fire a tableChanged event. Set the value of the cell using the API of the component if an event is needed or if it is sorted.

Specified by:
setValue in interface DsCell

getText

public final String getText()
Returns the formatted text to display in a cell of a table. This will use the format object to format the value of the cell.

Specified by:
getText in interface DsCell
See Also:
getFormat()

setText

public final void setText(String text)
Sets the text to display in a cell of a table. This is a convenience method that calls setValue(text).

Specified by:
setText in interface DsCell

getForeground

public final Paint getForeground()
Returns a value which determines the color of the text.

Specified by:
getForeground in interface DsCellProperties

setForeground

public final void setForeground(Paint c)
Sets a value which determines the color of the text.

Specified by:
setForeground in interface DsCellProperties

getBackground

public final Paint getBackground()
Returns a value which determines the background color behind the text.

Specified by:
getBackground in interface DsCellProperties

setBackground

public final void setBackground(Paint c)
Sets a value which determines the background color behind the text.

Specified by:
setBackground in interface DsCellProperties

getFont

public final Font getFont()
Returns the Font used to display the text of the cell.

Specified by:
getFont in interface DsCellProperties

setFont

public final void setFont(Font f)
Sets the Font used to display the text of the cell.

Specified by:
setFont in interface DsCellProperties

getFontName

public final String getFontName()
Returns the name of the font used to display the text for the cell.

Specified by:
getFontName in interface DsCellProperties

setFontName

public final void setFontName(String name)
Sets the name of the font used to display the text for the cell. If the name is the same as the name for GraphicUtil.defaultFont then the default value for the column is used.

Specified by:
setFontName in interface DsCellProperties

getFontSize

public final int getFontSize()
Returns the size of the font used to display the text for the cell.

Specified by:
getFontSize in interface DsCellProperties

setFontSize

public final void setFontSize(int size)
Sets the size of the font used to display the text for the cell. If the size is the same as the size for GraphicUtil.defaultFont then the default value for the column is used.

Specified by:
setFontSize in interface DsCellProperties

isFontBold

public final boolean isFontBold()
Returns a value that determines whether the text for the cell is displayed with a bold font.

Specified by:
isFontBold in interface DsCellProperties

setFontBold

public final void setFontBold(boolean val)
Sets a value that determines whether the text for the cell is displayed with a bold font.

Specified by:
setFontBold in interface DsCellProperties

getFontBoldVal

public final int getFontBoldVal()
Returns a value that determines whether the text for the cell is displayed with a bold font.


setFontBoldVal

public final void setFontBoldVal(int val)
Sets a value that determines whether the text for the cell is displayed with a bold font. One of: DEFAULT, TRUE, FALSE.


isFontItalic

public final boolean isFontItalic()
Returns a value that determines whether the text for the cell is displayed with an italic style.

Specified by:
isFontItalic in interface DsCellProperties

setFontItalic

public final void setFontItalic(boolean italic)
Sets a value that determines whether the text for the cell is displayed with an italic style. If set to false then the default value for the column is used which is typically false.

Specified by:
setFontItalic in interface DsCellProperties

isFontStrikeThrough

public final boolean isFontStrikeThrough()
Returns a value that determines whether the text for the cell is displayed with a line through the text.

Specified by:
isFontStrikeThrough in interface DsCellProperties

setFontStrikeThrough

public final void setFontStrikeThrough(boolean val)
Sets a value that determines whether the text for the cell is displayed with a line through the text.

Specified by:
setFontStrikeThrough in interface DsCellProperties

getFontUnderline

public final int getFontUnderline()
Returns a value that determines how the text for the cell is underlined.

Specified by:
getFontUnderline in interface DsCellProperties

setFontUnderline

public final void setFontUnderline(int val)
Sets a value that determines how the text for the cell is underlined. Valid values are:

Specified by:
setFontUnderline in interface DsCellProperties

isNegativeNumberRed

public final boolean isNegativeNumberRed()
Returns a value that determines whether negative numbers are displayed in a red color. The value in the cell must be an instance of the Number class.

Specified by:
isNegativeNumberRed in interface DsCellProperties

setNegativeNumberRed

public final void setNegativeNumberRed(boolean val)
Sets a value that determines whether negative numbers are displayed in a red color. The value in the cell must be an instance of the Number class.

Specified by:
setNegativeNumberRed in interface DsCellProperties

isOpaque

public final boolean isOpaque()
Returns a value that determines whether the background for the cell is painted.

Specified by:
isOpaque in interface DsCellProperties

setOpaque

public final void setOpaque(boolean val)
Sets a value that determines whether the background for the cell is painted.

Specified by:
setOpaque in interface DsCellProperties

isWordWrap

public final boolean isWordWrap()
Returns a value that determines whether the text for the cell is wrapped onto the line below if it doesn't fit.

Specified by:
isWordWrap in interface DsCellProperties

setWordWrap

public final void setWordWrap(boolean val)
Sets a value that determines whether the text for the cell is wrapped onto the line below if it doesn't fit.

Specified by:
setWordWrap in interface DsCellProperties

isEditable

public final boolean isEditable()
Returns a value that determines whether the value for the cell can be edited by the user at run-time.

Specified by:
isEditable in interface DsCellProperties

setEditable

public final void setEditable(boolean val)
Determines whether the value for the cell can be edited by the user at run-time.

Specified by:
setEditable in interface DsCellProperties

getEditableVal

public final int getEditableVal()
Returns a value that determines whether the value for the cell can be edited by the user at run-time.


setEditableVal

public final void setEditableVal(int val)
Determines whether the value for the cell can be edited by the user at run-time. One of: DEFAULT, TRUE, FALSE.


getHorizontalAlignment

public final int getHorizontalAlignment()
Returns a value that determines how the text for the cell is aligned horizontally.

Specified by:
getHorizontalAlignment in interface DsCellProperties

setHorizontalAlignment

public final void setHorizontalAlignment(int val)
Sets the horizontal alignment of the text. Valid values are:

Specified by:
setHorizontalAlignment in interface DsCellProperties

getVerticalAlignment

public final int getVerticalAlignment()
Returns a value that determines how the text for the cell is aligned horizontally.

Specified by:
getVerticalAlignment in interface DsCellProperties

setVerticalAlignment

public final void setVerticalAlignment(int val)
Sets the vertical alignment of the text. Valid values are:

Specified by:
setVerticalAlignment in interface DsCellProperties

getTextStyle

public final int getTextStyle()
Returns a value that determines how the text for the cell is drawn.

Specified by:
getTextStyle in interface DsCellProperties

setTextStyle

public final void setTextStyle(int val)
Sets a value that determines how the text for the cell is drawn. Valid values are:

RAISED and LOWERED look good with larger or bold fonts. For smaller fonts use RAISED_LIGHT and LOWERED_LIGHT

Specified by:
setTextStyle in interface DsCellProperties

getRotation

public final int getRotation()
Returns a value that determines the rotation of the text and icon.

Specified by:
getRotation in interface DsCellProperties

setRotation

public final void setRotation(int val)
Sets a value that determines the rotation of the text and icon. Valid values are:

Specified by:
setRotation in interface DsCellProperties

setBorder

public void setBorder(int borderLineWidth,
                      int borderStyle,
                      Paint borderLineColor)
Creates a border around the cell. This is a convenience method which sets all the properties necessary to display a border in one method call. The borderLines is defaulted to BORDER_OUTLINE.

Specified by:
setBorder in interface DsCellProperties
See Also:
setBorderLineWidth(int), setBorderStyle(int), setBorderLineColor(java.awt.Paint), setBorderLines(int)

setBorder

public void setBorder(int borderLineWidth,
                      int borderStyle,
                      Paint borderLineColor,
                      int borderLines)
Creates a border around the cell. This is a convenience method which sets all the properties necessary to display a border in one method call.

Specified by:
setBorder in interface DsCellProperties
See Also:
setBorderLineWidth(int), setBorderStyle(int), setBorderLineColor(java.awt.Paint), setBorderLines(int)

getBorderStyle

public final int getBorderStyle()
Returns a value that determines how the border for the cell is drawn.

Specified by:
getBorderStyle in interface DsCellProperties

setBorderStyle

public final void setBorderStyle(int val)
Sets a value that determines how the border for the cell is drawn.

Specified by:
setBorderStyle in interface DsCellProperties

getBorderLines

public final int getBorderLines()
Returns a value that determines which border lines that are drawn around the cell.

Specified by:
getBorderLines in interface DsCellProperties

setBorderLines

public final void setBorderLines(int val)
Sets a value that determines which border lines that are drawn around the cell.

Specified by:
setBorderLines in interface DsCellProperties

getBorderLineWidth

public final int getBorderLineWidth()
Returns a value that determines the width of the lines that are drawn around the cell.

Specified by:
getBorderLineWidth in interface DsCellProperties

setBorderLineWidth

public final void setBorderLineWidth(int val)
Sets a value that determines the width of the lines that are drawn around the cell. Maximum line width is 7.

Specified by:
setBorderLineWidth in interface DsCellProperties

getBorderLineColor

public final Paint getBorderLineColor()
Returns a value which determines the color that line borders are drawn in.

Specified by:
getBorderLineColor in interface DsCellProperties

setBorderLineColor

public final void setBorderLineColor(Paint c)
Sets a value which determines the color that line borders are drawn in. If null, then black will be used.

Specified by:
setBorderLineColor in interface DsCellProperties

getBorder

public final Border getBorder()
Returns the border that will be painted on the outside.

Specified by:
getBorder in interface DsCellProperties

setBorder

public final void setBorder(Border b)
Sets a border that will be painted on the outside. Any border specified in BorderStyle will be drawn on the outside of this border.

Specified by:
setBorder in interface DsCellProperties

getIcon

public final Icon getIcon()
Returns the graphic image (glyph, icon) that the label displays.

Specified by:
getIcon in interface DsCellProperties

setIcon

public final void setIcon(Icon icon)
Defines the icon this component will display. If the value of icon is null, nothing is displayed.

The default value of this property is null.

Specified by:
setIcon in interface DsCellProperties
See Also:
setVerticalTextPosition(int), setHorizontalTextPosition(int)

setIcon

public final void setIcon(Image image)
Defines the icon this component will display. An ImageIcon is created for the image.

Specified by:
setIcon in interface DsCellProperties
See Also:
setIcon(Icon)

getHorizontalTextPosition

public final int getHorizontalTextPosition()
Returns the horizontal position of the text in relation to the icon

Specified by:
getHorizontalTextPosition in interface DsCellProperties

setHorizontalTextPosition

public final void setHorizontalTextPosition(int textPosition)
Sets the horizontal position of the text in relation to the icon. One of:
 LEFT    - text is on the left side of the icon.
 CENTER  - text and icon are centered horizontally.
 RIGHT   - text is on the right side of the icon. (Default)

Specified by:
setHorizontalTextPosition in interface DsCellProperties

getVerticalTextPosition

public final int getVerticalTextPosition()
Returns the vertical position of the text in relation to the icon

Specified by:
getVerticalTextPosition in interface DsCellProperties

setVerticalTextPosition

public final void setVerticalTextPosition(int textPosition)
Sets the vertical position of the text in relation to the icon. One of:
 TOP     - text is on the top of the icon.
 CENTER  - text and icon are centered vertically. (Default)
 BOTTOM  - text is on the bottom of the icon.

Specified by:
setVerticalTextPosition in interface DsCellProperties

getFormat

public final Object getFormat()
Returns a Format/Formatter object that determines how the text for the cell is formatted.

Specified by:
getFormat in interface DsCellProperties

setFormat

public final void setFormat(Object val)
Sets a value that determines how the text for the cell is formatted. Should be an instance of Format or DefaultFormatter

Specified by:
setFormat in interface DsCellProperties

getToolTipText

public final String getToolTipText()
Returns the text to display when the cursor is over the cell of a table.

Specified by:
getToolTipText in interface DsCell

setToolTipText

public final void setToolTipText(String text)
Sets the text to display when the cursor is over the cell of a table.

Specified by:
setToolTipText in interface DsCell

getData

public final Object getData()
Returns a user defined object associated with the cell.

Specified by:
getData in interface DsCell

setData

public final void setData(Object userData)
Sets a user defined object to be stored with the cell. This can be any type of object. The value is never used internally.

Specified by:
setData in interface DsCell

getRowSpan

public final int getRowSpan()
Returns the number of rows this cell spans. A number < 1 means the cell is that many rows away from the cell that is spanning multiple rows.

Specified by:
getRowSpan in interface DsCell

setRowSpan

protected final void setRowSpan(int rowSpan)
Sets the number of rows this cell spans.


getColumnSpan

public final int getColumnSpan()
Returns the number of columns this cell spans. A number < 1 means the cell is that many columns away from the cell that is spanning multiple columns.

Specified by:
getColumnSpan in interface DsCell

setColumnSpan

public final void setColumnSpan(int colSpan)
Sets the number of columns this cell spans.


isVisible

public final boolean isVisible()
Returns true if this cell is not hidden. If this cell is hidden by another cell which has been spanned over the top then it also returns false.

Specified by:
isVisible in interface DsCell

formatValue

public static String formatValue(DsCellProperties cell,
                                 Object value)
Hides or unhides this cell. This cell can also be hidden by being covered by another cell that has spanned over the top of this cell. public final void setVisible( boolean val ) { setBoolean( IS_HIDDEN, !val ); }


toString

public String toString()
Returns the formatted text to display in a cell of a table. This will use the format object to format the value of the cell.

Overrides:
toString in class Object
See Also:
getText(), getFormat()

Diamond Control Suite 3.0

Diamond Edge and Diamond Control Suite are trademarks or registered trademarks of Diamond Edge, Inc. Copyright 1999-2005 Diamond Edge, Inc. All Rights Reserved.