de.kupzog.ktable.renderers
Class BorderPainter

java.lang.Object
  extended by de.kupzog.ktable.renderers.BorderPainter

public abstract class BorderPainter
extends java.lang.Object

Helper class that draws several kind of borders.

Author:
Lorenz Maierhofer

Constructor Summary
BorderPainter()
           
 
Method Summary
static org.eclipse.swt.graphics.Rectangle drawDefaultSolidCellLine(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.graphics.Color vBorderColor, org.eclipse.swt.graphics.Color hBorderColor)
          Simply draws a border line with width 1 on the bottom (horizontal) and on the right side (vertical).
static org.eclipse.swt.graphics.Rectangle drawDoubleLineSeperatorBorder(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.graphics.Color vColor, org.eclipse.swt.graphics.Color hColor, org.eclipse.swt.graphics.Color seperatorBGColor, boolean vSeperator, boolean hSeperator)
           
static org.eclipse.swt.graphics.Rectangle drawSolidCellLines(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.graphics.Color topBorderColor, org.eclipse.swt.graphics.Color bottomBorderColor, org.eclipse.swt.graphics.Color leftBorderColor, org.eclipse.swt.graphics.Color rightBorderColor, int topWidth, int bottomWidth, int leftWidth, int rightWidth)
          Simply draws a solid border line.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BorderPainter

public BorderPainter()
Method Detail

drawDoubleLineSeperatorBorder

public static org.eclipse.swt.graphics.Rectangle drawDoubleLineSeperatorBorder(org.eclipse.swt.graphics.GC gc,
                                                                               org.eclipse.swt.graphics.Rectangle rect,
                                                                               org.eclipse.swt.graphics.Color vColor,
                                                                               org.eclipse.swt.graphics.Color hColor,
                                                                               org.eclipse.swt.graphics.Color seperatorBGColor,
                                                                               boolean vSeperator,
                                                                               boolean hSeperator)

drawDefaultSolidCellLine

public static final org.eclipse.swt.graphics.Rectangle drawDefaultSolidCellLine(org.eclipse.swt.graphics.GC gc,
                                                                                org.eclipse.swt.graphics.Rectangle rect,
                                                                                org.eclipse.swt.graphics.Color vBorderColor,
                                                                                org.eclipse.swt.graphics.Color hBorderColor)
Simply draws a border line with width 1 on the bottom (horizontal) and on the right side (vertical). The other two sides belong to the neightbor cells and are painted by them.

The result is a table where a 1px line is between every two cells. This should be considered default behavior.

Parameters:
gc - The GC to use when painting.
rect - The cell are to paint a border around.
vBorderColor - The vertical line color for the line on the right.
hBorderColor - The horizontal line color for the line on the bottom.

drawSolidCellLines

public static final org.eclipse.swt.graphics.Rectangle drawSolidCellLines(org.eclipse.swt.graphics.GC gc,
                                                                          org.eclipse.swt.graphics.Rectangle rect,
                                                                          org.eclipse.swt.graphics.Color topBorderColor,
                                                                          org.eclipse.swt.graphics.Color bottomBorderColor,
                                                                          org.eclipse.swt.graphics.Color leftBorderColor,
                                                                          org.eclipse.swt.graphics.Color rightBorderColor,
                                                                          int topWidth,
                                                                          int bottomWidth,
                                                                          int leftWidth,
                                                                          int rightWidth)
Simply draws a solid border line. (horizontal, vertical). If all 4 line widths are 0, the default 1px border is painted. otherwise on every side the given width is added. Note that this is only the half side of the line, the other half is added by the neightbor cell at the appropriate side.

Setting lineweigts > 0 makes the cell content area returned shrink!

Parameters:
gc - The GC that should be used when drawing.
rect - The cell area as given by KTable.
topBorderColor - The border color for horizontal top lines.
bottomBorderColor - The border color for horizontal bottom line.
leftBorderColor - The border color for the left vertical line.
rightBorderColor - The border color for vertical right line.
leftWidth - additional width of the line on the left
rightWidth - additional width of the line on the right
topWidth - additional width of the line on the top
bottomWidth - additional width of the line on the bottom.
Returns:
returns the remaining space in the cell that should be filled with content.