Package org.compiere.plaf
Class CompiereColor
- java.lang.Object
-
- org.compiere.plaf.CompiereColor
-
- All Implemented Interfaces:
Serializable
public class CompiereColor extends Object implements Serializable
Adempiere Background Color- Version:
- $Id: AdempiereColor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CompiereColor.ColorBackground
Background contains a Buffered Image with the background.
-
Field Summary
Fields Modifier and Type Field Description static KeyNamePair[]
GRADIENT_SP
Gradient Starting Pointstatic String[]
GRADIENT_SP_NAMES
Gradient Starting Namesstatic int[]
GRADIENT_SP_VALUES
Gradient Starting Valuesstatic String
TYPE_FLAT
Background type Flatstatic String
TYPE_GRADIENT
Background type Gradientstatic String
TYPE_LINES
Background type Linesstatic String[]
TYPE_NAMES
Type Namesstatic String
TYPE_TEXTURE
Background type Texturestatic String[]
TYPE_VALUES
Type Valuesstatic ValueNamePair[]
TYPES
Types
-
Constructor Summary
Constructors Constructor Description CompiereColor()
Create Gradient Background Color (Window System Color - White)CompiereColor(Color bg)
Create Flat Background ColorCompiereColor(Color bg, boolean flat)
Create Background ColorCompiereColor(Color upperColor, Color lowerColor)
Set Background to Gradient colors.CompiereColor(Color lineColor, Color backColor, float lineWidth, int lineDistance)
Set Background to LinesCompiereColor(Color upperColor, Color lowerColor, int startPoint, int repeatDistance)
Set Background to Gradient colorsCompiereColor(String type)
Create Default Background Colors of TypeCompiereColor(String textureURL, Color taint, float compositeAlpha)
Set Background to TextureCompiereColor(URL textureURL, Color taint, float compositeAlpha)
Set Background to TextureCompiereColor(CompiereColor cc)
Copy Color
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CompiereColor
getBackground(JComponent c)
Get Background Color of componentstatic CompiereColor
getCompiereColor(MColor color)
Get CompiereColor.static CompiereColor
getDefaultBackground()
Get Default BackgroundColor
getFlatColor()
Get Flat ColorColor
getGradientLowerColor()
Gradient Lower Colorint
getGradientRepeatDistance()
Gradient Repeat Distance in pointint
getGradientStartPoint()
Gradient Starting PointColor
getGradientUpperColor()
Gradient Upper ColorColor
getLineBackColor()
Line Background ColorColor
getLineColor()
Line Colorint
getLineDistance()
Background Line distance in ptfloat
getLineWidth()
Background Line Widthfloat
getTextureCompositeAlpha()
Texture Composite AlphaBufferedImage
getTextureImage()
Get Texture Image based on Texture URLColor
getTextureTaintColor()
Texture Taint ColorURL
getTextureURL()
Texture UrlString
getType()
Get BackgroundType (Flat, Gradient, Lines, Texture)boolean
isFlat()
Flat Background Type (default)boolean
isGradient()
Gradient Background Typeboolean
isLine()
Line Background Typeboolean
isTexture()
Texture Background Typevoid
paint(Graphics g, JComponent c)
Fill with AdempiereColor Backgroundvoid
paintRect(Graphics g, JComponent c, int x, int y, int w, int h)
Fill with Adempiere Backgroundstatic CompiereColor
parse(String attributes)
Parse attributes and return AdempiereColorstatic void
setBackground(Window win)
Set Background of Window Content Pane to default colorstatic void
setBackground(Window win, CompiereColor cc)
Set Background of Window Content Panestatic void
setBackground(JComponent c)
Set Background of Component to default colorstatic void
setBackground(JComponent c, CompiereColor cc)
Set Background of Componentvoid
setColor(CompiereColor cc)
Set AdempiereColor from AdempiereColorvoid
setFlatColor(Color color)
Set Flat Colorvoid
setGradientLowerColor(Color color)
Gradient Lower Colorvoid
setGradientRepeatDistance(int repeatDistance)
Gradient Repeat Distance.void
setGradientRepeatDistance(String repeatDistanceString)
Gradient Repeat Distance.void
setGradientStartPoint(int startPoint)
Gradient Starting Pointvoid
setGradientUpperColor(Color color)
Gradient Upper Colorvoid
setLineBackColor(Color color)
Line Background Colorvoid
setLineColor(Color color)
Line Colorvoid
setLineDistance(int distance)
Background Line distance in ptvoid
setLineDistance(String distanceString)
Background Line distance in ptvoid
setLineWidth(float width)
Background Line Widthvoid
setLineWidth(String widthString)
Background Line Widthprotected void
setPrimaryColor(Color color)
Set Prinary Colorvoid
setTextureCompositeAlpha(float alpha)
Texture Composite Alphavoid
setTextureCompositeAlpha(String alphaString)
Texture Composite Alphavoid
setTextureTaintColor(Color color)
Texture Taint Colorvoid
setTextureURL(String urlString)
Texture Urlvoid
setTextureURL(URL url)
Texture UrlString
toString()
String representation
-
-
-
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
- Colorflat
- 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 ColorlowerColor
- lower ColorstartPoint
- Starting point - e.g. SOUTH_WEST see SwingConstants, default NORTH_WESTrepeatDistance
- 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 colorlowerColor
- lower color
-
CompiereColor
public CompiereColor(URL textureURL, Color taint, float compositeAlpha)
Set Background to Texture- Parameters:
textureURL
- URL to a *.gif or *.jpg graphic filetaint
- Color to taint the texture (use white for not tainting it)compositeAlpha
- Value from 0(no) to 1(full) tainting
-
CompiereColor
public CompiereColor(String textureURL, Color taint, float compositeAlpha)
Set Background to Texture- Parameters:
textureURL
- URL to a *.gif or *.jpg graphic filetaint
- 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 colorbackColor
- background colorlineWidth
- Stroke width in pointlineDistance
- 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
- Componentcc
- 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
- windowcc
- adempiere color
-
getDefaultBackground
public static CompiereColor getDefaultBackground()
Get Default Background- Returns:
- Background
- See Also:
CompierePanelUI#getDefaultBackground
-
parse
public static CompiereColor parse(String attributes)
Parse attributes and return AdempiereColor- Parameters:
attributes
- attributes- Returns:
- AdempiereColor
-
getCompiereColor
public static CompiereColor getCompiereColor(MColor color)
Get CompiereColor.- 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 AdempiereColor from AdempiereColor- Parameters:
cc
- AdempiereColor
-
paint
public void paint(Graphics g, JComponent c)
Fill with AdempiereColor Background- Parameters:
g
- theGraphics
context in which to paintc
- the component being painted
-
paintRect
public void paintRect(Graphics g, JComponent c, int x, int y, int w, int h)
Fill with Adempiere Background- Parameters:
g
- graphicsc
- componentx
- x posy
- y posw
- withh
- height
-
-