org.knime.core.data.property
Class ColorAttr

java.lang.Object
  extended by org.knime.core.data.property.ColorAttr

public final class ColorAttr
extends Object

This class holds a Color value as property for view objects and supports colors for selection, hilite, selection-hilite, border, and background. A ColorAttr is only created once for each color.

Author:
Thomas Gabriel, University of Konstanz, Fabian Dill, University of Konstanz
See Also:
Color

Field Summary
static Color BACKGROUND
          The color for background as Color.WHITE.
static Color BORDER
          The color for border as Color.DARK_GRAY.
static ColorAttr DEFAULT
          The default color attribute value, used when no color attribute set.
static Color HILITE
          The color for hilite as new Color(255, 181, 0).
static Color INACTIVE
          The color for inactive points, "grayed out", as Color.LIGHT_GRAY.
static Color INACTIVE_SELECTED
          The color for inactive points, "grayed out", but selected as Color.GRAY.
static Color SELECTED
          The color for selection as new Color(179, 168, 143).
static Color SELECTED_HILITE
          The color for selection as new Color(255, 240, 204).
 
Method Summary
 boolean equals(ColorAttr ca)
          Compares this ColorAttr with the given one and returns true if both have the same color value.
 boolean equals(Object obj)
          Compares this ColorAttr with the given Object and returns true if the other is an instance of ColorAttr and both have the same color value.
static Color getBackground()
          Returns the preferred background color.
 Color getBorderColor(boolean selected, boolean hilite)
          Returns the border color for this object under certain constrains.
 Color getColor()
          Returns this attribute's color value.
 Color getColor(boolean selected, boolean hilite)
          Returns the color value for this object under certain constrains.
static Color getInactiveColor()
          Returns the preferred color for inactive points.
static ColorAttr getInstance(Color color)
          Creates a new color attribute with the given color.
 int hashCode()
          Hash code of the underlying color value.
 String toString()
          A String representation for this color attribute including the simple class name, attribute color, hilite, selected, selected-hilite, border, and background color.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final ColorAttr DEFAULT
The default color attribute value, used when no color attribute set.


SELECTED

public static final Color SELECTED
The color for selection as new Color(179, 168, 143).


HILITE

public static final Color HILITE
The color for hilite as new Color(255, 181, 0).


SELECTED_HILITE

public static final Color SELECTED_HILITE
The color for selection as new Color(255, 240, 204).


INACTIVE

public static final Color INACTIVE
The color for inactive points, "grayed out", as Color.LIGHT_GRAY.


INACTIVE_SELECTED

public static final Color INACTIVE_SELECTED
The color for inactive points, "grayed out", but selected as Color.GRAY.


BORDER

public static final Color BORDER
The color for border as Color.DARK_GRAY.


BACKGROUND

public static final Color BACKGROUND
The color for background as Color.WHITE.

Method Detail

getInstance

public static ColorAttr getInstance(Color color)
Creates a new color attribute with the given color.

Parameters:
color - the color for this object
Returns:
the ColorAttr object for the given Color
Throws:
IllegalArgumentException - if the Color is null

getColor

public Color getColor()
Returns this attribute's color value.

Returns:
color of this attribute
See Also:
getColor(boolean, boolean)

getColor

public Color getColor(boolean selected,
                      boolean hilite)
Returns the color value for this object under certain constrains.

Parameters:
selected - if selected property is set
hilite - if hilite property is set
Returns:
the color for this object under the given constrains
See Also:
getColor()

getBorderColor

public Color getBorderColor(boolean selected,
                            boolean hilite)
Returns the border color for this object under certain constrains.

Parameters:
selected - if the border is selected
hilite - if the border is hilite
Returns:
the color for this objects's border under the given constrains

getBackground

public static Color getBackground()
Returns the preferred background color.

Returns:
preferred background color

getInactiveColor

public static Color getInactiveColor()
Returns the preferred color for inactive points.

Returns:
preferred inactive color

equals

public boolean equals(ColorAttr ca)
Compares this ColorAttr with the given one and returns true if both have the same color value.

Parameters:
ca - the other ColorAttr to compare this one with
Returns:
true if the color values are equal otherwise false
See Also:
Color.equals(java.lang.Object)

equals

public boolean equals(Object obj)
Compares this ColorAttr with the given Object and returns true if the other is an instance of ColorAttr and both have the same color value.

Overrides:
equals in class Object
Parameters:
obj - the other ColorAttr to compare this one with
Returns:
true if the color values are equal otherwise false
See Also:
equals(ColorAttr)

hashCode

public int hashCode()
Hash code of the underlying color value.

Overrides:
hashCode in class Object
Returns:
the color value's hash code
See Also:
Color.hashCode()

toString

public String toString()
A String representation for this color attribute including the simple class name, attribute color, hilite, selected, selected-hilite, border, and background color.

Overrides:
toString in class Object
Returns:
a String representation for this color attribute
See Also:
Color.toString()


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.