Compiere Looks 1.2.1

org.compiere.plaf
Class CompiereColor

java.lang.Object
  |
  +--org.compiere.plaf.CompiereColor
All Implemented Interfaces:
Serializable

public class CompiereColor
extends Object
implements Serializable

Compiere Background Color

Version:
$Id: CompiereColor.java,v 1.17 2003/01/15 05:34:03 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Nested Class Summary
 class CompiereColor.ColorBackground
          Background contains a Buffered Image with the background.
 
Field Summary
static KeyNamePair[] GRADIENT_SP
          Gradient Starting Point
static String[] GRADIENT_SP_NAMES
          Gradient Starting Names
static int[] GRADIENT_SP_VALUES
          Gradient Starting Values
static String TYPE_FLAT
          Background type Flat
static String TYPE_GRADIENT
          Background type Gradient
static String TYPE_LINES
          Background type Lines
static String[] TYPE_NAMES
          Type Names
static String TYPE_TEXTURE
          Background type Texture
static String[] TYPE_VALUES
          Type Values
static ValueNamePair[] TYPES
          Types
 
Constructor Summary
CompiereColor()
          Create Gradient Background Color (Window System Color - White)
CompiereColor(Color bg)
          Create Flat Background Color
CompiereColor(Color bg, boolean flat)
          Create Background Color
CompiereColor(Color upperColor, Color lowerColor)
          Set Background to Gradient colors.
CompiereColor(Color lineColor, Color backColor, float lineWidth, int lineDistance)
          Set Background to Lines
CompiereColor(Color upperColor, Color lowerColor, int startPoint, int repeatDistance)
          Set Background to Gradient colors
CompiereColor(CompiereColor cc)
          Copy Color
CompiereColor(String type)
          Create Default Background Colors of Type
CompiereColor(String textureURL, Color taint, float compositeAlpha)
          Set Background to Texture
CompiereColor(URL textureURL, Color taint, float compositeAlpha)
          Set Background to Texture
 
Method Summary
static CompiereColor getBackground(JComponent c)
          Get Background Color of component
static CompiereColor getDefaultBackground()
          Get Default Background
 Color getFlatColor()
          Get Flat Color
 Color getGradientLowerColor()
          Gradient Lower Color
 int getGradientRepeatDistance()
          Gradient Repeat Distance in point
 int getGradientStartPoint()
          Gradient Starting Point
 Color getGradientUpperColor()
          Gradient Upper Color
 Color getLineBackColor()
          Line Background Color
 Color getLineColor()
          Line Color
 int getLineDistance()
          Background Line distance in pt
 float getLineWidth()
          Background Line Width
 float getTextureCompositeAlpha()
          Texture Composite Alpha
 BufferedImage getTextureImage()
          Get Texture Image based on Texture URL
 Color getTextureTaintColor()
          Texture Taint Color
 URL getTextureURL()
          Texture Url
 String getType()
          Get BackgroundType (Flat, Gradient, Lines, Texture)
 boolean isFlat()
          Flat Background Type (default)
 boolean isGradient()
          Gradient Background Type
 boolean isLine()
          Line Background Type
static boolean isSetDefault()
          Is the Default Background set by default
 boolean isTexture()
          Texture Background Type
 void paint(Graphics g, JComponent c)
          Fill with CompiereColor Background
 void paintRect(Graphics g, JComponent c, int x, int y, int w, int h)
          Fill with Compiere Background
static CompiereColor parse(String attributes)
          Parse attributes and return CompiereColor
static void setBackground(JComponent c)
          Set Background of Component to default color
static void setBackground(JComponent c, CompiereColor cc)
          Set Background of Component
static void setBackground(Window win)
          Set Background of Window Content Pane to default color
static void setBackground(Window win, CompiereColor cc)
          Set Background of Window Content Pane
 void setColor(CompiereColor cc)
          Set CompiereColor from CompiereColor
static void setDefaultBackground(CompiereColor bg)
          Set Default Background
 void setFlatColor(Color color)
          Set Flat Color
 void setGradientLowerColor(Color color)
          Gradient Lower Color
 void setGradientRepeatDistance(int repeatDistance)
          Gradient Repeat Distance.
 void setGradientRepeatDistance(String repeatDistanceString)
          Gradient Repeat Distance.
 void setGradientStartPoint(int startPoint)
          Gradient Starting Point
 void setGradientUpperColor(Color color)
          Gradient Upper Color
 void setLineBackColor(Color color)
          Line Background Color
 void setLineColor(Color color)
          Line Color
 void setLineDistance(int distance)
          Background Line distance in pt
 void setLineDistance(String distanceString)
          Background Line distance in pt
 void setLineWidth(float width)
          Background Line Width
 void setLineWidth(String widthString)
          Background Line Width
protected  void setPrimaryColor(Color color)
          Set Prinary Color
static void setSetDefault(boolean setDefault)
          Set Default Background
 void setTextureCompositeAlpha(float alpha)
          Texture Composite Alpha
 void setTextureCompositeAlpha(String alphaString)
          Texture Composite Alpha
 void setTextureTaintColor(Color color)
          Texture Taint Color
 void setTextureURL(String urlString)
          Texture Url
 void setTextureURL(URL url)
          Texture Url
 String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_FLAT

public static final String TYPE_FLAT
Background type Flat

See Also:
Constant Field Values

TYPE_GRADIENT

public static final String TYPE_GRADIENT
Background type Gradient

See Also:
Constant Field Values

TYPE_LINES

public static final String TYPE_LINES
Background type Lines

See Also:
Constant Field Values

TYPE_TEXTURE

public static final String TYPE_TEXTURE
Background type Texture

See Also:
Constant Field Values

TYPE_VALUES

public static final String[] TYPE_VALUES
Type Values


TYPE_NAMES

public static final String[] TYPE_NAMES
Type Names


TYPES

public static final ValueNamePair[] TYPES
Types


GRADIENT_SP_VALUES

public static final int[] GRADIENT_SP_VALUES
Gradient Starting Values


GRADIENT_SP_NAMES

public static final String[] GRADIENT_SP_NAMES
Gradient Starting Names


GRADIENT_SP

public static final KeyNamePair[] GRADIENT_SP
Gradient Starting Point

Constructor Detail

CompiereColor

public CompiereColor()
Create Gradient Background Color (Window System Color - White)


CompiereColor

public CompiereColor(String type)
Create Default Background Colors of Type

Parameters:
type - Background type (see constants TYPE_*)

CompiereColor

public CompiereColor(Color bg)
Create Flat Background Color

Parameters:
bg - background

CompiereColor

public CompiereColor(Color bg,
                     boolean flat)
Create Background Color

Parameters:
bg - Color
flat - if true create Flat color otherwise Gradient color with white lower color

CompiereColor

public CompiereColor(Color upperColor,
                     Color lowerColor,
                     int startPoint,
                     int repeatDistance)
Set Background to Gradient colors

Parameters:
upperColor - upper Color
lowerColor - lower Color
startPoint - Starting point - e.g. SOUTH_WEST see SwingConstants, default NORTH_WEST
repeatDistance - X/Y Distance to repeat gradient in points - 0 no repeats

CompiereColor

public CompiereColor(Color upperColor,
                     Color lowerColor)
Set Background to Gradient colors. Starting in the north, repeat after 100 pt

Parameters:
upperColor - upper color
lowerColor - lower color

CompiereColor

public CompiereColor(URL textureURL,
                     Color taint,
                     float compositeAlpha)
Set Background to Texture

Parameters:
textureURL - URL to a *.gif or *.jpg graphic file
taint - Color to taint the texture (use white for not tainting it)
compositeAlpha - Value from 0(no) to 1(full) taining

CompiereColor

public CompiereColor(String textureURL,
                     Color taint,
                     float compositeAlpha)
Set Background to Texture

Parameters:
textureURL - URL to a *.gif or *.jpg graphic file
taint - Color to taint the texture (use white for not tainting it)
compositeAlpha - Tainting value from 0 (no - FullGraph) to 1 (full - NoGraph)

CompiereColor

public CompiereColor(Color lineColor,
                     Color backColor,
                     float lineWidth,
                     int lineDistance)
Set Background to Lines

Parameters:
lineColor - line color
backColor - background color
lineWidth - Stroke width in point
lineDistance - Distance between lines in points

CompiereColor

public CompiereColor(CompiereColor cc)
Copy Color

Parameters:
cc - color
Method Detail

setBackground

public static void setBackground(JComponent c)
Set Background of Component to default color

Parameters:
c - component

setBackground

public static void setBackground(JComponent c,
                                 CompiereColor cc)
Set Background of Component

Parameters:
c - Component
cc - Color

getBackground

public static CompiereColor getBackground(JComponent c)
Get Background Color of component

Parameters:
c - JComponent
Returns:
Color

setBackground

public static void setBackground(Window win)
Set Background of Window Content Pane to default color

Parameters:
win - window

setBackground

public static void setBackground(Window win,
                                 CompiereColor cc)
Set Background of Window Content Pane

Parameters:
win - window
cc - compiere color

setDefaultBackground

public static void setDefaultBackground(CompiereColor bg)
Set Default Background

Parameters:
bg - Background Color
See Also:
CompierePanelUI.setDefaultBackground(org.compiere.plaf.CompiereColor)

getDefaultBackground

public static CompiereColor getDefaultBackground()
Get Default Background

Returns:
Background
See Also:
CompierePanelUI.getDefaultBackground()

setSetDefault

public static void setSetDefault(boolean setDefault)
Set Default Background

Parameters:
setDefault - if true, the background will be set to the default color
See Also:
CompierePanelUI.setSetDefault(boolean)

isSetDefault

public static boolean isSetDefault()
Is the Default Background set by default

Returns:
true if default background is set
See Also:
CompierePanelUI.isSetDefault()

parse

public static CompiereColor parse(String attributes)
Parse attributes and return CompiereColor

Parameters:
attributes - attributes
Returns:
CompiereColor

getType

public String getType()
Get BackgroundType (Flat, Gradient, Lines, Texture)

Returns:
Background Type (see TYPE_* constants)

isFlat

public boolean isFlat()
Flat Background Type (default)

Returns:
true if Flat background

isGradient

public boolean isGradient()
Gradient Background Type

Returns:
true if Gradient background

isLine

public boolean isLine()
Line Background Type

Returns:
true if Line background

isTexture

public boolean isTexture()
Texture Background Type

Returns:
true if Texture background

getFlatColor

public Color getFlatColor()
Get Flat Color

Returns:
Primary Color

setFlatColor

public void setFlatColor(Color color)
Set Flat Color

Parameters:
color - flat color

getGradientUpperColor

public Color getGradientUpperColor()
Gradient Upper Color

Returns:
Color or null

setGradientUpperColor

public void setGradientUpperColor(Color color)
Gradient Upper Color

Parameters:
color - upper color

getGradientLowerColor

public Color getGradientLowerColor()
Gradient Lower Color

Returns:
Color or null

setGradientLowerColor

public void setGradientLowerColor(Color color)
Gradient Lower Color

Parameters:
color - lower color

getGradientStartPoint

public int getGradientStartPoint()
Gradient Starting Point

Returns:
starting point - e.g. NORTH - or 0
See Also:
SwingConstants

setGradientStartPoint

public void setGradientStartPoint(int startPoint)
Gradient Starting Point

Parameters:
startPoint - starting point - e.g. NORTH
See Also:
SwingConstants

getGradientRepeatDistance

public int getGradientRepeatDistance()
Gradient Repeat Distance in point

Returns:
Repeat Distance - or 0

setGradientRepeatDistance

public void setGradientRepeatDistance(int repeatDistance)
Gradient Repeat Distance. Zero stands for no repeats

Parameters:
repeatDistance - repeat gradient after point x+repeat / y+repeat (depending on direction)

setGradientRepeatDistance

public void setGradientRepeatDistance(String repeatDistanceString)
Gradient Repeat Distance. Zero stands for no repeats

Parameters:
repeatDistanceString - repeat gradient after point x+repeat / y+repeat (depending on direction)

getTextureURL

public URL getTextureURL()
Texture Url

Returns:
URL (if not found, org.compiere.plaf.background.jpg is used)

getTextureImage

public BufferedImage getTextureImage()
Get Texture Image based on Texture URL

Returns:
Image

setTextureURL

public void setTextureURL(URL url)
Texture Url

Parameters:
url - URL to graphic file (jpg)

setTextureURL

public void setTextureURL(String urlString)
Texture Url

Parameters:
urlString - URL to graphic file (jpg)

getTextureTaintColor

public Color getTextureTaintColor()
Texture Taint Color

Returns:
Color or null

setTextureTaintColor

public void setTextureTaintColor(Color color)
Texture Taint Color

Parameters:
color - taint color

getTextureCompositeAlpha

public float getTextureCompositeAlpha()
Texture Composite Alpha

Returns:
Composite Ampha or 0f

setTextureCompositeAlpha

public void setTextureCompositeAlpha(float alpha)
Texture Composite Alpha

Parameters:
alpha - alpha value

setTextureCompositeAlpha

public void setTextureCompositeAlpha(String alphaString)
Texture Composite Alpha

Parameters:
alphaString - String to be parsed

getLineColor

public Color getLineColor()
Line Color

Returns:
Color or null

setLineColor

public void setLineColor(Color color)
Line Color

Parameters:
color - line color

getLineBackColor

public Color getLineBackColor()
Line Background Color

Returns:
Color or null

setLineBackColor

public void setLineBackColor(Color color)
Line Background Color

Parameters:
color - background color

getLineWidth

public float getLineWidth()
Background Line Width

Returns:
width or 0f

setLineWidth

public void setLineWidth(float width)
Background Line Width

Parameters:
width - line width

setLineWidth

public void setLineWidth(String widthString)
Background Line Width

Parameters:
widthString - line width

getLineDistance

public int getLineDistance()
Background Line distance in pt

Returns:
distance or 0

setLineDistance

public void setLineDistance(int distance)
Background Line distance in pt

Parameters:
distance - line distance

setLineDistance

public void setLineDistance(String distanceString)
Background Line distance in pt

Parameters:
distanceString - line distance

setPrimaryColor

protected void setPrimaryColor(Color color)
Set Prinary Color

Parameters:
color - primary color

setColor

public void setColor(CompiereColor cc)
Set CompiereColor from CompiereColor

Parameters:
cc - CompiereColor

paint

public void paint(Graphics g,
                  JComponent c)
Fill with CompiereColor Background

Parameters:
g - the Graphics context in which to paint
c - the component being painted

paintRect

public void paintRect(Graphics g,
                      JComponent c,
                      int x,
                      int y,
                      int w,
                      int h)
Fill with Compiere Background

Parameters:
g - graphics
c - component
x - x pos
y - y pos
w - with
h - height

toString

public String toString()
String representation

Overrides:
toString in class Object
Returns:
string representation

Compiere Looks 1.2.1

Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke