JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.higrid
Class SortLabelCellRenderer

java.lang.Object
  |
  +--com.klg.jclass.cell.renderers.JCStringCellRenderer
        |
        +--com.klg.jclass.higrid.SortLabelCellRenderer
All Implemented Interfaces:
HiGridHeaderRenderer, JCCellRenderer, JCLightCellRenderer, Serializable

public class SortLabelCellRenderer
extends JCStringCellRenderer
implements HiGridHeaderRenderer

A cell renderer to draw a label with the ascending/descending icon indication.

See Also:
Serialized Form

Field Summary
protected static String[] arrowAscendingPixels
           
protected static String[] arrowDescendingPixels
           
protected static Image ascendingImage
           
protected static int CLIP_ARROW_SPACING
           
protected static com.klg.jclass.util.swing.JCIconCreator creator
           
protected static Color darkColor
           
protected static Color DEFAULT_SORT_COLOR
           
protected static Image descendingImage
           
static int ICON_ARROW
           
static int ICON_NONE
           
static int ICON_TRIANGLE
           
protected static Color lightColor
           
protected static String[] noneAscendingPixels
           
protected static String[] noneDescendingPixels
           
protected static Color sortColor
           
protected static String[] triangleAscendingPixels
           
protected static String[] triangleDescendingPixels
           
 
Fields inherited from class com.klg.jclass.cell.renderers.JCStringCellRenderer
drawClipArrowOutline, utilities
 
Fields inherited from interface com.klg.jclass.higrid.HiGridHeaderRenderer
serialVersionUID
 
Constructor Summary
SortLabelCellRenderer()
           
 
Method Summary
protected static Color brighter(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
protected static Color darker(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
 void draw(Graphics gc, com.klg.jclass.cell.JCCellInfo cellInfo, Object o, boolean selected)
          Used to draw the cell.
static Image getAscendingImage()
          Retrieves the sort label ascending image.
static Image getDescendingImage()
          Retrieves the sort label descending image.
 Dimension getPreferredSize(Graphics gc, com.klg.jclass.cell.JCCellInfo cellInfo, Object o)
          Returns the preferred size of the cell's drawing area.
protected static void makeImage(int type)
          Sets the ascending and descending sorting images to one of the predefined ICON_* types.
protected static void makeImages(String[] ascending, String[] descending)
          Creates the actual images from the passed String arrays.
static void setAscendingImage(Image image)
          Sets the sort label ascending image.
static void setDescendingImage(Image image)
          Sets the sort label descending image.
static void setImages(int type)
          Sets the ascending and descending sorting images to one of the predefined ICON_* types.
static void setImages(int type, Color color)
          Sets the ascending and descending sorting images to one of the predefined ICON_* types.
protected static void setSortColor(Color color)
          Sets up the various sorting colors used in the icons
static void swapImages()
          Swaps the ascending and descending images.
 
Methods inherited from class com.klg.jclass.cell.renderers.JCStringCellRenderer
getAlignedX, getAlignedY, getHeight, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_ARROW

public static final int ICON_ARROW
See Also:
Constant Field Values

ICON_TRIANGLE

public static final int ICON_TRIANGLE
See Also:
Constant Field Values

ICON_NONE

public static final int ICON_NONE
See Also:
Constant Field Values

arrowDescendingPixels

protected static final String[] arrowDescendingPixels

arrowAscendingPixels

protected static final String[] arrowAscendingPixels

triangleAscendingPixels

protected static final String[] triangleAscendingPixels

triangleDescendingPixels

protected static final String[] triangleDescendingPixels

noneAscendingPixels

protected static final String[] noneAscendingPixels

noneDescendingPixels

protected static final String[] noneDescendingPixels

creator

protected static transient com.klg.jclass.util.swing.JCIconCreator creator

ascendingImage

protected static transient Image ascendingImage

descendingImage

protected static transient Image descendingImage

CLIP_ARROW_SPACING

protected static int CLIP_ARROW_SPACING

DEFAULT_SORT_COLOR

protected static Color DEFAULT_SORT_COLOR

sortColor

protected static Color sortColor

lightColor

protected static Color lightColor

darkColor

protected static Color darkColor
Constructor Detail

SortLabelCellRenderer

public SortLabelCellRenderer()
Method Detail

setImages

public static void setImages(int type)
Sets the ascending and descending sorting images to one of the predefined ICON_* types.

Parameters:
type - the image type to use (one of the ICON_* types)

setImages

public static void setImages(int type,
                             Color color)
Sets the ascending and descending sorting images to one of the predefined ICON_* types.

Parameters:
type - the image type to use (one of the ICON_* types)
color - the color to use within the image

getAscendingImage

public static Image getAscendingImage()
Retrieves the sort label ascending image.


setAscendingImage

public static void setAscendingImage(Image image)
Sets the sort label ascending image.

Parameters:
image - the image to use

getDescendingImage

public static Image getDescendingImage()
Retrieves the sort label descending image.


setDescendingImage

public static void setDescendingImage(Image image)
Sets the sort label descending image.

Parameters:
image - the image to use

swapImages

public static void swapImages()
Swaps the ascending and descending images.


setSortColor

protected static void setSortColor(Color color)
Sets up the various sorting colors used in the icons

Parameters:
color - the basic color of the image

makeImages

protected static void makeImages(String[] ascending,
                                 String[] descending)
Creates the actual images from the passed String arrays.

Parameters:
ascending - the String representation of the ascending sort icon
descending - the String representation of the descending sort icon

makeImage

protected static void makeImage(int type)
Sets the ascending and descending sorting images to one of the predefined ICON_* types.

Parameters:
type - the image type to use (one of the ICON_* types)

draw

public void draw(Graphics gc,
                 com.klg.jclass.cell.JCCellInfo cellInfo,
                 Object o,
                 boolean selected)
Used to draw the cell. Note that the size of the cell comes from JCCellInfo.getDrawingArea(). When the renderer's draw method is called, the gc is translated to the upper-left corner of the drawing area for the cell. The "drawing area" of the cell is the region inside the borders and the margins.

Specified by:
draw in interface JCLightCellRenderer
Overrides:
draw in class JCStringCellRenderer
Parameters:
gc - Graphics context to use for drawing.
cellInfo - Cell property information
o - Object to be rendered
selected - Boolean value indicating whether the cell is selected

getPreferredSize

public Dimension getPreferredSize(Graphics gc,
                                  com.klg.jclass.cell.JCCellInfo cellInfo,
                                  Object o)
Returns the preferred size of the cell's drawing area. The "drawing area" of the cell is the region inside the borders and the margins.

Specified by:
getPreferredSize in interface JCLightCellRenderer
Overrides:
getPreferredSize in class JCStringCellRenderer
Parameters:
gc - Graphics context for calculating size
cellInfo - Cell property information
o - Object to be rendered
Returns:
java.awt.Dimension instance containing preferrred height and width.

brighter

protected static Color brighter(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.


darker

protected static Color darker(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.


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