bibliothek.gui.dock.util.color
Class AbstractDockColor

java.lang.Object
  extended by bibliothek.gui.dock.util.color.AbstractDockColor
All Implemented Interfaces:
DockColor
Direct Known Subclasses:
ActionColor, DisplayerColor, StationPaintColor, TabColor, TitleColor

public abstract class AbstractDockColor
extends Object
implements DockColor

A DockColor that contains more than one Color:


This class also has methods to add or remove itself from a ColorManager.

Author:
Benjamin Sigg

Constructor Summary
AbstractDockColor(String id)
          Creates a new DockColor.
AbstractDockColor(String id, Class<? extends DockColor> kind)
          Creates a new DockColor.
AbstractDockColor(String id, Class<? extends DockColor> kind, Color backup)
          Creates a new DockColor.
AbstractDockColor(String id, Color backup)
          Creates a new DockColor.
 
Method Summary
protected abstract  void changed(Color oldColor, Color newColor)
          Called when the color of this AbstractDockColor has changed
 Color color()
          Gets the first non-null value of the list override, value, backup.
 void connect(DockController controller)
          This method just calls setManager(ColorManager) with the controllers ColorManager.
 Color getBackup()
          Gets the backup color.
 String getId()
          Gets the identifier of this color.
 Class<? extends DockColor> getKind()
          Gets the kind of this color.
 Color getValue()
          Gets the override value.
 void set(Color color)
          Called by the ColorProvider when the color changes.
 void setBackup(Color backup)
          Sets the backup color.
 void setId(String id)
          Changes the identifier of this color.
 void setKind(Class<? extends DockColor> kind)
          Changes the kind of this color.
 void setManager(ColorManager manager)
          Sets the manager which owns this DockColor, automatically add or removes this DockColor from the manager
 void setValue(Color value)
          Sets the override value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDockColor

public AbstractDockColor(String id)
Creates a new DockColor.

Parameters:
id - the id of the color for which this should listen

AbstractDockColor

public AbstractDockColor(String id,
                         Class<? extends DockColor> kind)
Creates a new DockColor.

Parameters:
id - the id of the color for which this should listen
kind - the kind of DockColor this is

AbstractDockColor

public AbstractDockColor(String id,
                         Color backup)
Creates a new DockColor.

Parameters:
id - the id of the color for which this should listen
backup - a backup color, can be null

AbstractDockColor

public AbstractDockColor(String id,
                         Class<? extends DockColor> kind,
                         Color backup)
Creates a new DockColor.

Parameters:
id - the id of the color for which this should listen
kind - the kind of DockColor this is, can be null
backup - a backup color, can be null
Method Detail

setId

public void setId(String id)
Changes the identifier of this color.

Parameters:
id - the new id, must not be null

getId

public String getId()
Gets the identifier of this color.

Returns:
the identifier, never null

setKind

public void setKind(Class<? extends DockColor> kind)
Changes the kind of this color. The kind is used by the ColorManager to find out, which ColorProvider should be used to interact with this DockColor.

Parameters:
kind - the new kind, not null. The kind should be a class or interfaces that is implemented by this DockColor.

getKind

public Class<? extends DockColor> getKind()
Gets the kind of this color. See setKind(Class).

Returns:
the kind, never null

setManager

public void setManager(ColorManager manager)
Sets the manager which owns this DockColor, automatically add or removes this DockColor from the manager

Parameters:
manager - the new manager, can be null

connect

public void connect(DockController controller)
This method just calls setManager(ColorManager) with the controllers ColorManager.

Parameters:
controller - the owner of this DockColor or null

set

public void set(Color color)
Description copied from interface: DockColor
Called by the ColorProvider when the color changes.

Specified by:
set in interface DockColor
Parameters:
color - the new color, can be null

color

public Color color()
Gets the first non-null value of the list override, value, backup.

Returns:
a color or null

changed

protected abstract void changed(Color oldColor,
                                Color newColor)
Called when the color of this AbstractDockColor has changed

Parameters:
oldColor - the old color, can be null
newColor - the new color, can be null

setValue

public void setValue(Color value)
Sets the override value.

Parameters:
value - the new override or null

getValue

public Color getValue()
Gets the override value.

Returns:
the override or null

setBackup

public void setBackup(Color backup)
Sets the backup color.

Parameters:
backup - the backup or null

getBackup

public Color getBackup()
Gets the backup color.

Returns:
the backup or null