JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.higrid
Class CellFormat

java.lang.Object
  |
  +--com.klg.jclass.higrid.CellStyle
        |
        +--com.klg.jclass.higrid.CellFormat
All Implemented Interfaces:
CellStyleModel, Cloneable, JCCellInfo, Serializable
Direct Known Subclasses:
IndicatorCellFormat

public class CellFormat
extends CellStyle
implements JCCellInfo, Serializable

The CellFormat class completely describes a given cell displayed within HiGrid. From the CellStyle class, it inherits basic formatting information. It implements the JCCellInfo interface, so that it can render cells in a standard way. It also adds other properties useful for display. Vectors of CellFormat objects are found within the RowFormat class, which themselves are aggregated within the FormatNode class. The sum of all of these classes serve as a design-time template for the run-time rendering of HiGrid.

See Also:
Serialized Form

Field Summary
protected  Rectangle drawingArea
           
protected  boolean drawingAreaValid
           
protected  boolean editable
           
protected  Class editor
           
protected  String editorName
           
protected  int height
           
protected static int MINIMUM_INITIAL_HEADER_WIDTH
           
protected  String name
           
protected  com.klg.jclass.higrid.RowFormat parent
           
protected  Rectangle preferredTotalArea
           
protected  boolean preferredTotalAreaValid
           
protected  Class renderer
           
protected  String rendererName
           
protected  boolean rowHeightIsValid
           
protected  boolean showing
           
protected  Comparator sortable
           
protected  String text
           
protected  Rectangle totalArea
           
protected  boolean totalAreaValid
           
protected  Point translationOffset
           
protected  boolean translationOffsetValid
           
protected  int type
           
protected  int width
           
 
Fields inherited from class com.klg.jclass.higrid.CellStyle
allowWidthSizing, backgroundColor, borderInsets, borderStyle, clipHints, editHeightPolicy, editWidthPolicy, font, foregroundColor, horizontalAlignment, marginInsets, selectAll, selectedBackgroundColor, selectedForegroundColor, verticalAlignment
 
Fields inherited from interface com.klg.jclass.cell.JCCellInfo
BOTTOM, CENTER, LEFT, RIGHT, SHOW_ALL, SHOW_HORIZONTAL, SHOW_NONE, SHOW_VERTICAL, TOP
 
Constructor Summary
CellFormat()
          Default Constructor.
CellFormat(com.klg.jclass.higrid.CellStyleModel cellStyle)
          Constructor.
 
Method Summary
protected  void calculateDrawingArea()
           
protected  void calculatePreferredTotalArea()
           
protected  void calculateTotalArea()
           
protected  void calculateTranslationOffset()
           
 Class getCellEditor()
          Retrieves the Cell Editor for this object.
 String getCellEditorName()
          Retrieves the Cell Editor name for this object.
 Class getCellRenderer()
          Retrieves the Cell Renderer for this object.
 String getCellRendererName()
          Retrieves the Cell Renderer name for this object.
 Class getDataType()
          Retrieves the cell's associated data type.
 Rectangle getDrawingArea()
          Returns the drawing area for the cell being displayed or edited.
protected  int getFontHeight(Component comp, Font font)
           
protected  int getFontHeight(FontMetrics fm, Font font)
           
 int getHeight()
          Retrieves the height of this object.
 String getName()
          Retrieves the name of this object.
 com.klg.jclass.higrid.CellFormat getOtherCellFormat()
          Retrieves the cell format of the other header/record pair.
 com.klg.jclass.higrid.RowFormat getParent()
          Retrieves the parent of this object.
 Rectangle getPreferredTotalArea()
          Returns the preferred area for the cell being displayed or edited.
 Comparator getSortable()
          Retrieves the sortable.
protected  int getStringWidth(FontMetrics fm, Font font, String s)
          Accounts for bug in AWT which does not account for italic fonts.
 String getText()
          Retrieves the text label of this object.
 Rectangle getTotalArea()
          Returns the total area for the cell being displayed or edited.
protected  Point getTranslationOffset()
           
 int getType()
          Retrieves the type of this object.
 int getWidth()
          Retrieves the width of this object.
 boolean isEditable()
          Retrieves whether input is allowed for this object.
 boolean isEnabled()
          Retrieves whether the cell is enabled.
 boolean isShowing()
          Retrieves whether this object is showing.
protected  void rowHeightChanged()
          Called by parent RowFormat when its height changes.
 void setAllowWidthSizing(boolean allow)
          Sets whether width sizing is currently allowed.
 void setBorderInsets(Insets insets)
          Sets the border insets for this object.
 void setCellEditor(Class editor)
          Sets the Cell Editor for this object.
 void setCellEditorName(String editorName)
          Sets the Cell Editor for this object.
 void setCellRenderer(Class renderer)
          Sets the Cell Renderer for this object.
 void setCellRendererName(String rendererName)
          Sets the Cell Renderer for this object.
 void setDefaultSize(Component comp, boolean addSortLabel)
          Sets the height and width of this cell based on its font and text.
 void setEditable(boolean editable)
          Sets whether input is currently allowed.
 void setFont(FontMetrics fm, Font font)
          Sets the font for this object.
 void setHeight(int height)
          Sets the height of this object.
 void setMarginInsets(Insets insets)
          Sets the margin insets for this object.
 void setName(String name)
          Sets the name of this object.
 void setOtherShowing(boolean showing)
          Sets whether this object is showing for the other header/record pair.
protected  void setOtherWidth(int width)
          Sets the width of the other header/record pair.
 void setParent(com.klg.jclass.higrid.RowFormat parent)
          Sets the parent of this object.
 void setShowing(boolean showing)
          Sets whether this object is showing.
 void setSortable(Comparator sortable)
          Sets the sortable.
 void setText(String text)
          Sets the text label of this object.
 void setType(int type)
          Sets the type of this object.
 void setWidth(int width)
          Sets the width of this object.
 void setWidth(int width, boolean checkAllow)
          Sets the width of this object.
protected  void widthChanged()
          Called by parent RowFormat when its width changes.
 
Methods inherited from class com.klg.jclass.higrid.CellStyle
copyFromCellStyle, copyPlafFromCellStyle, getAllowWidthSizing, getBackground, getBorderInsets, getBorderStyle, getClipHints, getEditHeightPolicy, getEditWidthPolicy, getFont, getForeground, getHorizontalAlignment, getMarginInsets, getSelectAll, getSelectedBackground, getSelectedForeground, getVerticalAlignment, setBackground, setBorderStyle, setClipHints, setEditHeightPolicy, setEditWidthPolicy, setFont, setForeground, setHorizontalAlignment, setOtherAllowWidthSizing, setSelectAll, setSelectedBackground, setSelectedForeground, setVerticalAlignment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.klg.jclass.cell.JCCellInfo
getBackground, getBorderInsets, getBorderStyle, getClipHints, getFont, getForeground, getHorizontalAlignment, getMarginInsets, getSelectAll, getSelectedBackground, getSelectedForeground, getVerticalAlignment
 

Field Detail

MINIMUM_INITIAL_HEADER_WIDTH

protected static final int MINIMUM_INITIAL_HEADER_WIDTH
See Also:
Constant Field Values

height

protected int height

width

protected int width

editable

protected boolean editable

editorName

protected String editorName

rendererName

protected String rendererName

editor

protected transient Class editor

renderer

protected transient Class renderer

parent

protected com.klg.jclass.higrid.RowFormat parent

text

protected String text

name

protected String name

type

protected int type

drawingArea

protected Rectangle drawingArea

totalArea

protected Rectangle totalArea

preferredTotalArea

protected Rectangle preferredTotalArea

translationOffset

protected Point translationOffset

drawingAreaValid

protected boolean drawingAreaValid

totalAreaValid

protected boolean totalAreaValid

preferredTotalAreaValid

protected boolean preferredTotalAreaValid

translationOffsetValid

protected boolean translationOffsetValid

rowHeightIsValid

protected boolean rowHeightIsValid

showing

protected boolean showing

sortable

protected Comparator sortable
Constructor Detail

CellFormat

public CellFormat()
Default Constructor.


CellFormat

public CellFormat(com.klg.jclass.higrid.CellStyleModel cellStyle)
Constructor.

Parameters:
cellStyle - the CellStyle to initialize the CellFormat with.
Method Detail

isShowing

public boolean isShowing()
Retrieves whether this object is showing.

Returns:
Whether object is currently showing.

setShowing

public void setShowing(boolean showing)
Sets whether this object is showing.

Parameters:
showing - Whether object is to be shown.

setOtherShowing

public void setOtherShowing(boolean showing)
Sets whether this object is showing for the other header/record pair.

Parameters:
showing - Whether object is to be shown.

setBorderInsets

public void setBorderInsets(Insets insets)
Sets the border insets for this object.

Specified by:
setBorderInsets in interface CellStyleModel
Overrides:
setBorderInsets in class CellStyle

getHeight

public int getHeight()
Retrieves the height of this object.

Returns:
The current height.

setHeight

public void setHeight(int height)
Sets the height of this object.

Parameters:
height - The new height.

getWidth

public int getWidth()
Retrieves the width of this object.

Returns:
The current width.

setWidth

public void setWidth(int width)
Sets the width of this object.

Parameters:
width - The new width.

setOtherWidth

protected void setOtherWidth(int width)
Sets the width of the other header/record pair.

Parameters:
width - The new width.

setWidth

public void setWidth(int width,
                     boolean checkAllow)
Sets the width of this object.

Parameters:
width - The new width.
checkAllow - True if allowWidthSizing is to be checked.

setMarginInsets

public void setMarginInsets(Insets insets)
Sets the margin insets for this object.

Specified by:
setMarginInsets in interface CellStyleModel
Overrides:
setMarginInsets in class CellStyle
Parameters:
insets - The new margin insets.

setFont

public void setFont(FontMetrics fm,
                    Font font)
Sets the font for this object.

Parameters:
font - The new font.
Throws:
IllegalArgumentException - If parameter is null.

setAllowWidthSizing

public void setAllowWidthSizing(boolean allow)
Sets whether width sizing is currently allowed.

Specified by:
setAllowWidthSizing in interface CellStyleModel
Overrides:
setAllowWidthSizing in class CellStyle
Parameters:
allow - Whether to allow width sizing.

getOtherCellFormat

public com.klg.jclass.higrid.CellFormat getOtherCellFormat()
Retrieves the cell format of the other header/record pair.

Returns:
The cell format.

getDataType

public Class getDataType()
Retrieves the cell's associated data type.

Specified by:
getDataType in interface JCCellInfo
Returns:
cell's associated data type

isEnabled

public boolean isEnabled()
Retrieves whether the cell is enabled.

Specified by:
isEnabled in interface JCCellInfo
Returns:
Whether the cell is enabled.

isEditable

public boolean isEditable()
Retrieves whether input is allowed for this object.

Specified by:
isEditable in interface JCCellInfo
Returns:
Whether input is currently allowed.

setEditable

public void setEditable(boolean editable)
Sets whether input is currently allowed.


getCellEditor

public Class getCellEditor()
Retrieves the Cell Editor for this object.

Returns:
The current Cell Editor.

setCellEditor

public void setCellEditor(Class editor)
Sets the Cell Editor for this object.

Parameters:
editor - The new Cell Editor.

getCellEditorName

public String getCellEditorName()
Retrieves the Cell Editor name for this object.

Returns:
The current Cell Editor name.

setCellEditorName

public void setCellEditorName(String editorName)
Sets the Cell Editor for this object.


getCellRenderer

public Class getCellRenderer()
Retrieves the Cell Renderer for this object.

Returns:
The current Cell Renderer.

setCellRenderer

public void setCellRenderer(Class renderer)
Sets the Cell Renderer for this object.

Parameters:
renderer - The new Cell Renderer.

getCellRendererName

public String getCellRendererName()
Retrieves the Cell Renderer name for this object.

Returns:
The current Cell Renderer name.

setCellRendererName

public void setCellRendererName(String rendererName)
Sets the Cell Renderer for this object.


getParent

public com.klg.jclass.higrid.RowFormat getParent()
Retrieves the parent of this object.

Returns:
The current parent.

setParent

public void setParent(com.klg.jclass.higrid.RowFormat parent)
Sets the parent of this object.

Parameters:
parent - The new parent.

getText

public String getText()
Retrieves the text label of this object.

Returns:
The current text.

setText

public void setText(String text)
Sets the text label of this object.

Parameters:
text - The new text.

getName

public String getName()
Retrieves the name of this object.

Returns:
The current name.

setName

public void setName(String name)
Sets the name of this object.

Parameters:
name - The new name.

getType

public int getType()
Retrieves the type of this object.

Returns:
The current type.

setType

public void setType(int type)
Sets the type of this object.

Parameters:
type - The new type.

getSortable

public Comparator getSortable()
Retrieves the sortable.

Returns:
The current sortable.
Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, this field's or method's return type is based on the corresponding com.sun.java.util class.

setSortable

public void setSortable(Comparator sortable)
Sets the sortable.

Parameters:
sortable - The new sortable.
Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, this method's parameter must be a com.sun.java.util.collections.Comparator.

getDrawingArea

public Rectangle getDrawingArea()
Returns the drawing area for the cell being displayed or edited. This drawing area is already adjusted for BorderSize and MarginSize

Specified by:
getDrawingArea in interface JCCellInfo
Returns:
size of the drawing area.

getTotalArea

public Rectangle getTotalArea()
Returns the total area for the cell being displayed or edited.


getPreferredTotalArea

public Rectangle getPreferredTotalArea()
Returns the preferred area for the cell being displayed or edited. This is the area as determined by the design time information.


getTranslationOffset

protected Point getTranslationOffset()

getStringWidth

protected int getStringWidth(FontMetrics fm,
                             Font font,
                             String s)
Accounts for bug in AWT which does not account for italic fonts.


getFontHeight

protected int getFontHeight(FontMetrics fm,
                            Font font)

getFontHeight

protected int getFontHeight(Component comp,
                            Font font)

setDefaultSize

public void setDefaultSize(Component comp,
                           boolean addSortLabel)
Sets the height and width of this cell based on its font and text. Used mainly to initialize headers.

Parameters:
comp - Component to get FontMetrics from.
addSortLabel - true if space is to be reserved for the sort icon.

rowHeightChanged

protected void rowHeightChanged()
Called by parent RowFormat when its height changes.


widthChanged

protected void widthChanged()
Called by parent RowFormat when its width changes.


calculateDrawingArea

protected void calculateDrawingArea()

calculateTotalArea

protected void calculateTotalArea()

calculatePreferredTotalArea

protected void calculatePreferredTotalArea()

calculateTranslationOffset

protected void calculateTranslationOffset()

Copyright © 2004 Quest Software Inc..
All rights reserved.