JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.cell
Class Utilities

java.lang.Object
  |
  +--com.klg.jclass.cell.Utilities
All Implemented Interfaces:
Serializable

public class Utilities
extends Object
implements Serializable

Useful utilities for use with Cell Renderers and Editors

See Also:
Serialized Form

Field Summary
static int CONTROL_IN
          Border drawn with MS-Windows style control shadows
static int CONTROL_OUT
          Border drawn with MS-Windows style control shadows
static int DEFAULT_CLIP_ARROW_SIZE
          Default size of clip arrows used by cell renderers.
static int ETCHED_IN
          Border drawn with double line; border appears inset
static int ETCHED_OUT
          Border drawn with double line; border appears raised
static int FRAME_IN
          Border drawn with 1-pixel shadow-in at edge; border appears framed
static int FRAME_OUT
          Border drawn with 1-pixel shadow-out at edge; border appears framed
static int IN
          Border drawn appears inset
static int NONE
          No border
static int NUM_BORDER_STYLES
          Number of different border styles
static int OUT
          Border drawn appears raised
static int PLAIN
          Border drawn in foreground color
 
Constructor Summary
Utilities()
           
 
Method Summary
static com.klg.jclass.cell.JCKeyModifier[] addKey(com.klg.jclass.cell.JCKeyModifier[] keys, com.klg.jclass.cell.JCKeyModifier new_key)
           
static Color brighter(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
static Color darker(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
static void drawBorder(Graphics gc, int type, int size, int x, int y, int width, int height, Color bg, Color plain)
          Draws a border
static void drawBorder(Graphics gc, int type, int size, int x, int y, int width, int height, Color bright, Color dark, Color plain)
          Draws a border
static void drawBottomLines(Graphics g, int size, int x, int y, int w, int h, Color color)
          Draws the bottom and right lines.
static void drawClipArrows(Graphics gc, com.klg.jclass.cell.JCCellInfo info, Dimension preferredSize, int size, boolean drawOutline)
          Draws horizontal and vertical clip arrows if requested to do so by the JCCellInfo object.
static void drawNormal(Graphics g, int size, int x, int y, int w, int h, Color top, Color bottom)
           
static void drawTopLines(Graphics g, int size, int x, int y, int w, int h, Color color)
          Draws the top and left lines.
static Rectangle getWholeCell(com.klg.jclass.cell.JCCellInfo info, Rectangle drawing_area)
          Creates a Rectangle to allow drawing over the whole cell instead of being positioned inside the borders and margins.
static void restoreFromInsideBorders(Graphics gc, com.klg.jclass.cell.JCCellInfo info, Rectangle drawing_area)
          Reverses any changes made by the translateToInsideBorders() method call.
static void restoreFromWholeCell(Graphics gc, com.klg.jclass.cell.JCCellInfo info, Rectangle drawing_area)
          Reverses any changes made by the translateToWholeCell() method call.
static void translateToInsideBorders(Graphics gc, com.klg.jclass.cell.JCCellInfo info, Rectangle drawing_area)
          Translates the Graphics object to allow drawing inside the borders instead of being positioned inside the borders and margins.
static void translateToWholeCell(Graphics gc, com.klg.jclass.cell.JCCellInfo info, Rectangle drawing_area)
          Translates the Graphics object to allow drawing over the whole cell instead of being positioned inside the borders and margins.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No border

See Also:
Constant Field Values

ETCHED_IN

public static final int ETCHED_IN
Border drawn with double line; border appears inset

See Also:
Constant Field Values

ETCHED_OUT

public static final int ETCHED_OUT
Border drawn with double line; border appears raised

See Also:
Constant Field Values

IN

public static final int IN
Border drawn appears inset

See Also:
Constant Field Values

OUT

public static final int OUT
Border drawn appears raised

See Also:
Constant Field Values

PLAIN

public static final int PLAIN
Border drawn in foreground color

See Also:
Constant Field Values

FRAME_IN

public static final int FRAME_IN
Border drawn with 1-pixel shadow-in at edge; border appears framed

See Also:
Constant Field Values

FRAME_OUT

public static final int FRAME_OUT
Border drawn with 1-pixel shadow-out at edge; border appears framed

See Also:
Constant Field Values

CONTROL_IN

public static final int CONTROL_IN
Border drawn with MS-Windows style control shadows

See Also:
Constant Field Values

CONTROL_OUT

public static final int CONTROL_OUT
Border drawn with MS-Windows style control shadows

See Also:
Constant Field Values

NUM_BORDER_STYLES

public static final int NUM_BORDER_STYLES
Number of different border styles

See Also:
Constant Field Values

DEFAULT_CLIP_ARROW_SIZE

public static final int DEFAULT_CLIP_ARROW_SIZE
Default size of clip arrows used by cell renderers.

See Also:
Constant Field Values
Constructor Detail

Utilities

public Utilities()
Method Detail

getWholeCell

public static Rectangle getWholeCell(com.klg.jclass.cell.JCCellInfo info,
                                     Rectangle drawing_area)
Creates a Rectangle to allow drawing over the whole cell instead of being positioned inside the borders and margins.

See Also:
translateToWholeCell(java.awt.Graphics, com.klg.jclass.cell.JCCellInfo, java.awt.Rectangle)

translateToWholeCell

public static void translateToWholeCell(Graphics gc,
                                        com.klg.jclass.cell.JCCellInfo info,
                                        Rectangle drawing_area)
Translates the Graphics object to allow drawing over the whole cell instead of being positioned inside the borders and margins.

See Also:
restoreFromWholeCell(java.awt.Graphics, com.klg.jclass.cell.JCCellInfo, java.awt.Rectangle)

restoreFromWholeCell

public static void restoreFromWholeCell(Graphics gc,
                                        com.klg.jclass.cell.JCCellInfo info,
                                        Rectangle drawing_area)
Reverses any changes made by the translateToWholeCell() method call.

See Also:
translateToWholeCell(java.awt.Graphics, com.klg.jclass.cell.JCCellInfo, java.awt.Rectangle)

translateToInsideBorders

public static void translateToInsideBorders(Graphics gc,
                                            com.klg.jclass.cell.JCCellInfo info,
                                            Rectangle drawing_area)
Translates the Graphics object to allow drawing inside the borders instead of being positioned inside the borders and margins.

Parameters:
drawing_area - rectangle representing current drawing area. Will be modified to to the new extended drawing width and height, but the x and y will not be changed accordingly.
See Also:
restoreFromInsideBorders(java.awt.Graphics, com.klg.jclass.cell.JCCellInfo, java.awt.Rectangle)

restoreFromInsideBorders

public static void restoreFromInsideBorders(Graphics gc,
                                            com.klg.jclass.cell.JCCellInfo info,
                                            Rectangle drawing_area)
Reverses any changes made by the translateToInsideBorders() method call.

Parameters:
drawing_area - rectangle representing current drawing area. Will be modified to to the new reduced drawing width and height, but the x and y will not be changed accordingly.
See Also:
translateToInsideBorders(java.awt.Graphics, com.klg.jclass.cell.JCCellInfo, java.awt.Rectangle)

drawTopLines

public static void drawTopLines(Graphics g,
                                int size,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color color)
Draws the top and left lines.


drawBottomLines

public static void drawBottomLines(Graphics g,
                                   int size,
                                   int x,
                                   int y,
                                   int w,
                                   int h,
                                   Color color)
Draws the bottom and right lines.


drawNormal

public static void drawNormal(Graphics g,
                              int size,
                              int x,
                              int y,
                              int w,
                              int h,
                              Color top,
                              Color bottom)

brighter

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


darker

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


drawBorder

public static void drawBorder(Graphics gc,
                              int type,
                              int size,
                              int x,
                              int y,
                              int width,
                              int height,
                              Color bg,
                              Color plain)
Draws a border

Parameters:
type - (see next draw() definition for full disclosure)
size - the shadow thickness
bg - the background color
plain - the color used to draw the sides of PLAIN shadows

drawBorder

public static void drawBorder(Graphics gc,
                              int type,
                              int size,
                              int x,
                              int y,
                              int width,
                              int height,
                              Color bright,
                              Color dark,
                              Color plain)
Draws a border

Parameters:
type - one of the following members:
   ETCHED_IN   double line; border appears inset
   ETCHED_OUT  double line; border appears raised
   FRAME_IN    1-pixel shadow-in at edge; border appears framed
   FRAME_OUT   1-pixel shadow-out at edge; border appears framed
   IN          border appears inset
   OUT         border appears raised
   CONTROL_IN  MS-Windows control shadows
   CONTROL_OUT MS-Windows control shadows
   PLAIN       border drawn in foreground color
   NONE        no border drawn
 
size - the shadow thickness
bright - bright shadow color
dark - dark shadow color
plain - the color used to draw the sides of PLAIN shadows

drawClipArrows

public static void drawClipArrows(Graphics gc,
                                  com.klg.jclass.cell.JCCellInfo info,
                                  Dimension preferredSize,
                                  int size,
                                  boolean drawOutline)
Draws horizontal and vertical clip arrows if requested to do so by the JCCellInfo object.

Parameters:
gc - The graphics context
info - The JCCellInfo object for this cell
preferredSize - The size that determines whether arrows are needed
size - The number of pixels along a side of the arrow
drawOutline - Should an outline be drawn, as well as a plygon filled

addKey

public static com.klg.jclass.cell.JCKeyModifier[] addKey(com.klg.jclass.cell.JCKeyModifier[] keys,
                                                         com.klg.jclass.cell.JCKeyModifier new_key)

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