de.kupzog.ktable
Class SWTX

java.lang.Object
  extended by de.kupzog.ktable.SWTX

public class SWTX
extends java.lang.Object

Provides some extensions for the KTable SWT custom table.

Author:
Friedrich Ku..

Field Summary
static int ALIGN_HORIZONTAL_CENTER
           
static int ALIGN_HORIZONTAL_LEFT
           
static int ALIGN_HORIZONTAL_LEFT_CENTER
           
static int ALIGN_HORIZONTAL_LEFT_LEFT
           
static int ALIGN_HORIZONTAL_LEFT_RIGHT
           
static int ALIGN_HORIZONTAL_MASK
           
static int ALIGN_HORIZONTAL_NONE
           
static int ALIGN_HORIZONTAL_RIGHT
           
static int ALIGN_HORIZONTAL_RIGHT_CENTER
           
static int ALIGN_HORIZONTAL_RIGHT_LEFT
           
static int ALIGN_HORIZONTAL_RIGHT_RIGHT
           
static int ALIGN_VERTICAL_BOTTOM
           
static int ALIGN_VERTICAL_CENTER
           
static int ALIGN_VERTICAL_MASK
           
static int ALIGN_VERTICAL_TOP
           
static int AUTO_SCROLL
           
static java.lang.String COLOR_BGFOCUS
           
static java.lang.String COLOR_FIXEDHIGHLIGHT
           
static int EDIT_ON_KEY
          Style bit that makes KTable activate the celleditor whenever a key is pressed.
static int EVENT_SWTX_BASE
           
static int EVENT_TABLE_HEADER
           
static int EVENT_TABLE_HEADER_CLICK
           
static int EVENT_TABLE_HEADER_RESIZE
           
static int FILL_WITH_DUMMYCOL
          Style bit for KTable that ensures the table always covers the whole space.
static int FILL_WITH_LASTCOL
          Style bit for KTable that ensures the table always covers the whole space.
static int MARK_FOCUS_HEADERS
          Style bit that makes KTable draw left and top header cells in a different style when the focused cell is in their row/column.
static int WRAP
           
static int WRAP_MASK
           
 
Constructor Summary
SWTX()
           
 
Method Summary
static java.lang.String cropWrappedTextForHeight(org.eclipse.swt.graphics.GC gc, java.lang.String text, int height)
           
static void drawButtonDeepDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h)
           
static void drawButtonDeepDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, org.eclipse.swt.graphics.Rectangle r)
           
static void drawButtonDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h)
           
static void drawButtonDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h, org.eclipse.swt.graphics.Color face)
           
static void drawButtonDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h, org.eclipse.swt.graphics.Color face, org.eclipse.swt.graphics.Color shadowNormal, int leftMargin, int topMargin)
           
static void drawButtonDown(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, org.eclipse.swt.graphics.Rectangle r)
           
static void drawButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h)
           
static void drawButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h, org.eclipse.swt.graphics.Color face)
           
static void drawButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h, org.eclipse.swt.graphics.Color face, org.eclipse.swt.graphics.Color shadowHigh, org.eclipse.swt.graphics.Color shadowNormal, org.eclipse.swt.graphics.Color shadowDark, int leftMargin, int topMargin)
           
static void drawButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, org.eclipse.swt.graphics.Rectangle r)
           
static void drawButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, org.eclipse.swt.graphics.Rectangle r, int leftMargin, int topMargin)
           
static void drawFlatButtonUp(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h, org.eclipse.swt.graphics.Color face, org.eclipse.swt.graphics.Color shadowLight, org.eclipse.swt.graphics.Color shadowNormal, int leftMargin, int topMargin)
           
static void drawImageVerticalAlign(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int h)
           
static void drawShadowImage(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, int x, int y, int alpha)
           
static void drawTextImage(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, int x, int y, int w, int h)
           
static void drawTextImage(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, org.eclipse.swt.graphics.Image image, int imageAlign, org.eclipse.swt.graphics.Rectangle r)
           
static int drawTextVerticalAlign(org.eclipse.swt.graphics.GC gc, java.lang.String text, int textAlign, int x, int y, int w, int h)
           
static void drawTransparentImage(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, int x, int y)
           
static org.eclipse.swt.graphics.Point getCachedStringExtent(org.eclipse.swt.graphics.GC gc, java.lang.String text)
           
static org.eclipse.swt.graphics.Color getColor(java.lang.String colorKey)
          Returns a custom color.
static org.eclipse.swt.graphics.Image loadImageResource(org.eclipse.swt.widgets.Display d, java.lang.String name)
          Loads an image from the root of this package.
static java.lang.String wrapText(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTO_SCROLL

public static final int AUTO_SCROLL
See Also:
Constant Field Values

FILL_WITH_LASTCOL

public static final int FILL_WITH_LASTCOL
Style bit for KTable that ensures the table always covers the whole space.
Uses the policy of widening the last column.

See Also:
Constant Field Values

FILL_WITH_DUMMYCOL

public static final int FILL_WITH_DUMMYCOL
Style bit for KTable that ensures the table always covers the whole space.
Uses the policy to add a dummy column at the end that occupies unused space.

See Also:
Constant Field Values

EDIT_ON_KEY

public static final int EDIT_ON_KEY
Style bit that makes KTable activate the celleditor whenever a key is pressed. (in contrast to the default behavior that only opens the editor on ENTER).

See Also:
Constant Field Values

MARK_FOCUS_HEADERS

public static final int MARK_FOCUS_HEADERS
Style bit that makes KTable draw left and top header cells in a different style when the focused cell is in their row/column. This mimics the MS Excel behavior that helps find the currently selected cell(s).

See Also:
Constant Field Values

COLOR_BGFOCUS

public static final java.lang.String COLOR_BGFOCUS
See Also:
Constant Field Values

COLOR_FIXEDHIGHLIGHT

public static final java.lang.String COLOR_FIXEDHIGHLIGHT
See Also:
Constant Field Values

EVENT_SWTX_BASE

public static final int EVENT_SWTX_BASE
See Also:
Constant Field Values

EVENT_TABLE_HEADER

public static final int EVENT_TABLE_HEADER
See Also:
Constant Field Values

EVENT_TABLE_HEADER_CLICK

public static final int EVENT_TABLE_HEADER_CLICK
See Also:
Constant Field Values

EVENT_TABLE_HEADER_RESIZE

public static final int EVENT_TABLE_HEADER_RESIZE
See Also:
Constant Field Values

ALIGN_HORIZONTAL_MASK

public static final int ALIGN_HORIZONTAL_MASK
See Also:
Constant Field Values

ALIGN_HORIZONTAL_NONE

public static final int ALIGN_HORIZONTAL_NONE
See Also:
Constant Field Values

ALIGN_HORIZONTAL_LEFT

public static final int ALIGN_HORIZONTAL_LEFT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_LEFT_LEFT

public static final int ALIGN_HORIZONTAL_LEFT_LEFT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_LEFT_RIGHT

public static final int ALIGN_HORIZONTAL_LEFT_RIGHT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_LEFT_CENTER

public static final int ALIGN_HORIZONTAL_LEFT_CENTER
See Also:
Constant Field Values

ALIGN_HORIZONTAL_RIGHT

public static final int ALIGN_HORIZONTAL_RIGHT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_RIGHT_RIGHT

public static final int ALIGN_HORIZONTAL_RIGHT_RIGHT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_RIGHT_LEFT

public static final int ALIGN_HORIZONTAL_RIGHT_LEFT
See Also:
Constant Field Values

ALIGN_HORIZONTAL_RIGHT_CENTER

public static final int ALIGN_HORIZONTAL_RIGHT_CENTER
See Also:
Constant Field Values

ALIGN_HORIZONTAL_CENTER

public static final int ALIGN_HORIZONTAL_CENTER
See Also:
Constant Field Values

ALIGN_VERTICAL_MASK

public static final int ALIGN_VERTICAL_MASK
See Also:
Constant Field Values

ALIGN_VERTICAL_TOP

public static final int ALIGN_VERTICAL_TOP
See Also:
Constant Field Values

ALIGN_VERTICAL_BOTTOM

public static final int ALIGN_VERTICAL_BOTTOM
See Also:
Constant Field Values

ALIGN_VERTICAL_CENTER

public static final int ALIGN_VERTICAL_CENTER
See Also:
Constant Field Values

WRAP_MASK

public static final int WRAP_MASK
See Also:
Constant Field Values

WRAP

public static final int WRAP
See Also:
Constant Field Values
Constructor Detail

SWTX

public SWTX()
Method Detail

getColor

public static org.eclipse.swt.graphics.Color getColor(java.lang.String colorKey)
Returns a custom color.

Parameters:
colorKey - The key defined in SWTX.
Returns:
Returns the appropriate color.

getCachedStringExtent

public static org.eclipse.swt.graphics.Point getCachedStringExtent(org.eclipse.swt.graphics.GC gc,
                                                                   java.lang.String text)

drawTextVerticalAlign

public static int drawTextVerticalAlign(org.eclipse.swt.graphics.GC gc,
                                        java.lang.String text,
                                        int textAlign,
                                        int x,
                                        int y,
                                        int w,
                                        int h)

drawTransparentImage

public static void drawTransparentImage(org.eclipse.swt.graphics.GC gc,
                                        org.eclipse.swt.graphics.Image image,
                                        int x,
                                        int y)

drawImageVerticalAlign

public static void drawImageVerticalAlign(org.eclipse.swt.graphics.GC gc,
                                          org.eclipse.swt.graphics.Image image,
                                          int imageAlign,
                                          int x,
                                          int y,
                                          int h)

drawTextImage

public static void drawTextImage(org.eclipse.swt.graphics.GC gc,
                                 java.lang.String text,
                                 int textAlign,
                                 org.eclipse.swt.graphics.Image image,
                                 int imageAlign,
                                 int x,
                                 int y,
                                 int w,
                                 int h)

drawTextImage

public static void drawTextImage(org.eclipse.swt.graphics.GC gc,
                                 java.lang.String text,
                                 int textAlign,
                                 org.eclipse.swt.graphics.Image image,
                                 int imageAlign,
                                 org.eclipse.swt.graphics.Rectangle r)

cropWrappedTextForHeight

public static java.lang.String cropWrappedTextForHeight(org.eclipse.swt.graphics.GC gc,
                                                        java.lang.String text,
                                                        int height)

wrapText

public static java.lang.String wrapText(org.eclipse.swt.graphics.GC gc,
                                        java.lang.String text,
                                        int width)

drawButtonUp

public static void drawButtonUp(org.eclipse.swt.graphics.GC gc,
                                java.lang.String text,
                                int textAlign,
                                org.eclipse.swt.graphics.Image image,
                                int imageAlign,
                                int x,
                                int y,
                                int w,
                                int h,
                                org.eclipse.swt.graphics.Color face,
                                org.eclipse.swt.graphics.Color shadowHigh,
                                org.eclipse.swt.graphics.Color shadowNormal,
                                org.eclipse.swt.graphics.Color shadowDark,
                                int leftMargin,
                                int topMargin)

drawButtonUp

public static void drawButtonUp(org.eclipse.swt.graphics.GC gc,
                                java.lang.String text,
                                int textAlign,
                                org.eclipse.swt.graphics.Image image,
                                int imageAlign,
                                int x,
                                int y,
                                int w,
                                int h,
                                org.eclipse.swt.graphics.Color face)

drawButtonUp

public static void drawButtonUp(org.eclipse.swt.graphics.GC gc,
                                java.lang.String text,
                                int textAlign,
                                org.eclipse.swt.graphics.Image image,
                                int imageAlign,
                                org.eclipse.swt.graphics.Rectangle r,
                                int leftMargin,
                                int topMargin)

drawButtonUp

public static void drawButtonUp(org.eclipse.swt.graphics.GC gc,
                                java.lang.String text,
                                int textAlign,
                                org.eclipse.swt.graphics.Image image,
                                int imageAlign,
                                int x,
                                int y,
                                int w,
                                int h)

drawButtonUp

public static void drawButtonUp(org.eclipse.swt.graphics.GC gc,
                                java.lang.String text,
                                int textAlign,
                                org.eclipse.swt.graphics.Image image,
                                int imageAlign,
                                org.eclipse.swt.graphics.Rectangle r)

drawButtonDown

public static void drawButtonDown(org.eclipse.swt.graphics.GC gc,
                                  java.lang.String text,
                                  int textAlign,
                                  org.eclipse.swt.graphics.Image image,
                                  int imageAlign,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  org.eclipse.swt.graphics.Color face,
                                  org.eclipse.swt.graphics.Color shadowNormal,
                                  int leftMargin,
                                  int topMargin)

drawButtonDown

public static void drawButtonDown(org.eclipse.swt.graphics.GC gc,
                                  java.lang.String text,
                                  int textAlign,
                                  org.eclipse.swt.graphics.Image image,
                                  int imageAlign,
                                  int x,
                                  int y,
                                  int w,
                                  int h)

drawButtonDown

public static void drawButtonDown(org.eclipse.swt.graphics.GC gc,
                                  java.lang.String text,
                                  int textAlign,
                                  org.eclipse.swt.graphics.Image image,
                                  int imageAlign,
                                  org.eclipse.swt.graphics.Rectangle r)

drawButtonDown

public static void drawButtonDown(org.eclipse.swt.graphics.GC gc,
                                  java.lang.String text,
                                  int textAlign,
                                  org.eclipse.swt.graphics.Image image,
                                  int imageAlign,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  org.eclipse.swt.graphics.Color face)

drawButtonDeepDown

public static void drawButtonDeepDown(org.eclipse.swt.graphics.GC gc,
                                      java.lang.String text,
                                      int textAlign,
                                      org.eclipse.swt.graphics.Image image,
                                      int imageAlign,
                                      int x,
                                      int y,
                                      int w,
                                      int h)

drawButtonDeepDown

public static void drawButtonDeepDown(org.eclipse.swt.graphics.GC gc,
                                      java.lang.String text,
                                      int textAlign,
                                      org.eclipse.swt.graphics.Image image,
                                      int imageAlign,
                                      org.eclipse.swt.graphics.Rectangle r)

drawFlatButtonUp

public static void drawFlatButtonUp(org.eclipse.swt.graphics.GC gc,
                                    java.lang.String text,
                                    int textAlign,
                                    org.eclipse.swt.graphics.Image image,
                                    int imageAlign,
                                    int x,
                                    int y,
                                    int w,
                                    int h,
                                    org.eclipse.swt.graphics.Color face,
                                    org.eclipse.swt.graphics.Color shadowLight,
                                    org.eclipse.swt.graphics.Color shadowNormal,
                                    int leftMargin,
                                    int topMargin)

drawShadowImage

public static void drawShadowImage(org.eclipse.swt.graphics.GC gc,
                                   org.eclipse.swt.graphics.Image image,
                                   int x,
                                   int y,
                                   int alpha)
Parameters:
gc -
image -
x -
y -
alpha -

loadImageResource

public static org.eclipse.swt.graphics.Image loadImageResource(org.eclipse.swt.widgets.Display d,
                                                               java.lang.String name)
Loads an image from the root of this package.

Parameters:
d - The display to use when creating the image.
name - The string name inclusive path to the image.
Returns:
returns the image or null.