JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.cell.renderers
Class JCStringCellRenderer

java.lang.Object
  |
  +--com.klg.jclass.cell.renderers.JCStringCellRenderer
All Implemented Interfaces:
JCCellRenderer, JCLightCellRenderer, Serializable
Direct Known Subclasses:
JCExpressionCellRenderer, SortLabelCellRenderer

public class JCStringCellRenderer
extends Object
implements JCLightCellRenderer

A classic String cell renderer based on the lightweight rendering model. This renderer handles all text rendering. Special features include multi-line detection and clip arrows.

This is the default String cell renderer in JClass.

This renderer does not handle HTML rendering. If you want HTML rendering for String data, use JCLabelCellRenderer. JCLabelCellRenderer is based on a JLabel, which handles HTML rendering.

See Also:
JCLabelCellRenderer, Serialized Form

Field Summary
protected  boolean drawClipArrowOutline
           
protected  com.klg.jclass.cell.Utilities utilities
           
 
Constructor Summary
JCStringCellRenderer()
           
 
Method Summary
 void draw(Graphics gc, com.klg.jclass.cell.JCCellInfo cellInfo, Object o, boolean selected)
          Used to draw the cell.
 int getAlignedX(int x, int width, int textWidth, int align)
          Returns an adjusted X position based on the String width and the horizontal alignment.
 int getAlignedY(int y, int height, int textHeight, int align)
          Returns an adjusted Y position based on the String height and the vertical alignment.
 int getHeight(FontMetrics fm, String text)
          Returns the height required to paint the String.
 Dimension getPreferredSize(Graphics gc, com.klg.jclass.cell.JCCellInfo cellInfo, Object o)
          Used to determine the preferred size of the cell.
 int getWidth(FontMetrics fm, String text)
          Returns the width required to paint a multi-line String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

utilities

protected com.klg.jclass.cell.Utilities utilities

drawClipArrowOutline

protected boolean drawClipArrowOutline
Constructor Detail

JCStringCellRenderer

public JCStringCellRenderer()
Method Detail

draw

public void draw(Graphics gc,
                 com.klg.jclass.cell.JCCellInfo cellInfo,
                 Object o,
                 boolean selected)
Used to draw the cell.
Note: The size of the cell comes from cellInfo.getDrawingArea().

Specified by:
draw in interface JCLightCellRenderer
Parameters:
gc - graphics context to use for drawing
cellInfo - cell property information
o - object to be rendered
selected -

getAlignedX

public int getAlignedX(int x,
                       int width,
                       int textWidth,
                       int align)
Returns an adjusted X position based on the String width and the horizontal alignment.

Parameters:
align -
textWidth -
width -
x -
Returns:
adjusted X position based on the String width and the horizontal alignment

getAlignedY

public int getAlignedY(int y,
                       int height,
                       int textHeight,
                       int align)
Returns an adjusted Y position based on the String height and the vertical alignment.

Parameters:
align -
height -
textHeight -
y -
Returns:
an adjusted Y position based on the String height and the vertical alignment

getHeight

public int getHeight(FontMetrics fm,
                     String text)
Returns the height required to paint the String.

Parameters:
fm -
text -
Returns:
height required to paing the String

getWidth

public int getWidth(FontMetrics fm,
                    String text)
Returns the width required to paint a multi-line String.

Parameters:
fm -
text -
Returns:
width required to paint a multi-line String

getPreferredSize

public Dimension getPreferredSize(Graphics gc,
                                  com.klg.jclass.cell.JCCellInfo cellInfo,
                                  Object o)
Used to determine the preferred size of the cell.

Specified by:
getPreferredSize in interface JCLightCellRenderer
Parameters:
cellInfo - cell property information
gc -
o -
Returns:
java.awt.Dimension instance containing preferred height and width.

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