📄 compierecolor.java
字号:
*/
public boolean isGradient()
{
return TYPE_GRADIENT.equals(getType());
} // isGradient
/**
* Line Background Type
* @return true if Line background
*/
public boolean isLine()
{
return TYPE_LINES.equals(getType());
} // isLine
/**
* Texture Background Type
* @return true if Texture background
*/
public boolean isTexture()
{
return TYPE_TEXTURE.equals(getType());
} // isTexture
/**********/
/**
* Get Flat Color
* @return Primary Color
*/
public Color getFlatColor()
{
return m_primaryColor;
} // getFlatColor
/**
* Set Flat Color
* @param color flat color
*/
public void setFlatColor(Color color)
{
if (!isFlat() || color == null)
return;
m_primaryColor = color;
m_dirty = true;
} // getFlatColor
/**********/
/**
* Gradient Upper Color
* @return Color or null
*/
public Color getGradientUpperColor()
{
if (!isGradient())
return null;
return m_primaryColor;
} // getGradientUpperColor
/**
* Gradient Upper Color
* @param color upper color
*/
public void setGradientUpperColor(Color color)
{
if (!isGradient() || color == null)
return;
m_primaryColor = color;
m_dirty = true;
} // getGradientUpperColor
/**
* Gradient Lower Color
* @return Color or null
*/
public Color getGradientLowerColor()
{
if (!isGradient())
return null;
return m_secondaryColor;
} // getGradientLowerColor
/**
* Gradient Lower Color
* @param color lower color
*/
public void setGradientLowerColor(Color color)
{
if (!isGradient() || color == null)
return;
m_secondaryColor = color;
m_dirty = true;
} // setGradientLowerColor
/**
* Gradient Starting Point
* @return starting point - e.g. NORTH - or 0
* @see SwingConstants
*/
public int getGradientStartPoint ()
{
if (!isGradient())
return 0;
return m_startPoint;
} // getGradientStartPoint
/**
* Gradient Starting Point
* @param startPoint starting point - e.g. NORTH
* @see SwingConstants
*/
public void setGradientStartPoint (int startPoint)
{
if (!isGradient())
return;
m_startPoint = startPoint;
m_dirty = true;
} // setGradientStartPoint
/**
* Gradient Repeat Distance in point
* @return Repeat Distance - or 0
*/
public int getGradientRepeatDistance ()
{
if (!isGradient())
return 0;
return m_repeatDistance;
} // getGradientRepeatDistance
/**
* Gradient Repeat Distance.
* Zero stands for no repeats
* @param repeatDistance repeat gradient after point x+repeat / y+repeat (depending on direction)
*/
public void setGradientRepeatDistance (int repeatDistance)
{
if (!isGradient())
return;
m_repeatDistance = repeatDistance;
m_dirty = true;
} // setGradientRepeatDistance
/**
* Gradient Repeat Distance.
* Zero stands for no repeats
* @param repeatDistanceString repeat gradient after point x+repeat / y+repeat (depending on direction)
*/
public void setGradientRepeatDistance (String repeatDistanceString)
{
if (!isGradient())
return;
try
{
setGradientRepeatDistance(Integer.parseInt(repeatDistanceString));
}
catch (Exception e)
{
System.err.println("CompiereColor.setGradientRepeatDistance - Parsing="
+ repeatDistanceString + " - " + e.getMessage());
}
} // setGradientRepeatDistance
/**********/
/**
* Texture Url
* @return URL (if not found, org.compiere.plaf.background.jpg is used)
*/
public URL getTextureURL()
{
if (!isTexture())
return null;
if (m_textureURL == null)
m_textureURL = CompiereColor.class.getResource("Compiere200x100.gif");
return m_textureURL;
} // getTextureURL
/**
* Get Texture Image based on Texture URL
* @return Image
*/
public BufferedImage getTextureImage()
{
if (m_image == null)
{
URL url = getTextureURL();
m_image = CompiereUtils.loadBufferedImage(url, BufferedImage.TYPE_INT_ARGB_PRE);
}
return m_image;
} // getTextureImage
/**
* Texture Url
* @param url URL to graphic file (jpg)
*/
public void setTextureURL(URL url)
{
if (!isTexture() || url == null)
return;
m_textureURL = url;
m_image = null;
m_dirty = true;
} // setTextureURL
/**
* Texture Url
* @param urlString URL to graphic file (jpg)
*/
public void setTextureURL(String urlString)
{
if (!isTexture() || urlString == null)
return;
try
{
setTextureURL (new URL(urlString));
}
catch (Exception e)
{
System.err.println("CompiereColor.setTextureURL - Parsing URL="
+ urlString + " - " + e.getMessage());
}
} // setTextureURL
/**
* Texture Taint Color
* @return Color or null
*/
public Color getTextureTaintColor()
{
if (!isTexture())
return null;
return m_primaryColor;
} // getTextureTaintColor
/**
* Texture Taint Color
* @param color taint color
*/
public void setTextureTaintColor(Color color)
{
if (!isTexture() || color == null)
return;
m_primaryColor = color;
m_dirty = true;
} // setTextureTaintColor
/**
* Texture Composite Alpha
* @return Composite Ampha or 0f
*/
public float getTextureCompositeAlpha()
{
if (!isTexture())
return 0f;
return m_compositeAlpha;
} // getTextureCompositeAlpha
/**
* Texture Composite Alpha
* @param alpha alpha value
*/
public void setTextureCompositeAlpha(float alpha)
{
if (!isTexture())
return;
m_compositeAlpha = alpha;
m_dirty = true;
} // setTextureCompositeAlpha
/**
* Texture Composite Alpha
* @param alphaString String to be parsed
*/
public void setTextureCompositeAlpha(String alphaString)
{
if (!isTexture() || alphaString == null)
return;
try
{
setTextureCompositeAlpha(Float.parseFloat(alphaString));
}
catch (Exception e)
{
System.err.println("CompiereColor.setTextureCompositeAlpha - Parsing="
+ alphaString + " - " + e.getMessage());
}
} // setTextureCompositeAlpha
/**********/
/**
* Line Color
* @return Color or null
*/
public Color getLineColor()
{
if (!isLine())
return null;
return m_secondaryColor;
} // getLineColor
/**
* Line Color
* @param color line color
*/
public void setLineColor(Color color)
{
if (!isLine() || color == null)
return;
m_secondaryColor = color;
m_dirty = true;
} // setLineColor
/**
* Line Background Color
* @return Color or null
*/
public Color getLineBackColor()
{
if (!isLine())
return null;
return m_primaryColor;
} // getLineBackColor
/**
* Line Background Color
* @param color background color
*/
public void setLineBackColor(Color color)
{
if (!isLine() || color == null)
return;
m_primaryColor = color;
m_dirty = true;
} // setLineBackColor
/**
* Background Line Width
* @return width or 0f
*/
public float getLineWidth()
{
if (!isLine())
return 0f;
return m_lineWidth;
} // getLineWidth
/**
* Background Line Width
* @param width line width
*/
public void setLineWidth(float width)
{
if (!isLine())
return;
m_lineWidth = width;
m_dirty = true;
} // setLineWidth
/**
* Background Line Width
* @param widthString line width
*/
public void setLineWidth(String widthString)
{
if (!isLine() || widthString == null)
return;
try
{
setLineWidth(Float.parseFloat(widthString));
}
catch (Exception e)
{
System.err.println("CompiereColor.setLineWidth - Parsing="
+ widthString + " - " + e.getMessage());
}
} // setLineWidth
/**
* Background Line distance in pt
* @return distance or 0
*/
public int getLineDistance()
{
if (!isLine())
return 0;
return m_lineDistance;
} // getLineDistance
/**
* Background Line distance in pt
* @param distance line distance
*/
public void setLineDistance(int distance)
{
if (!isLine())
return;
m_lineDistance = distance;
m_dirty = true;
} // setLineDistance
/**
* Background Line distance in pt
* @param distanceString line distance
*/
public void setLineDistance(String distanceString)
{
if (!isLine())
return;
try
{
setLineDistance(Integer.parseInt(distanceString));
}
catch (Exception e)
{
System.err.println("CompiereColor.setLineDistance - Parsing="
+ distanceString + " - " + e.getMessage());
}
} // setLineDistance
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -