bibliothek.gui.dock.util.color
Class MultiColorProvider<D extends DockColor>

java.lang.Object
  extended by bibliothek.gui.dock.util.color.MultiColorProvider<D>
Type Parameters:
D - the kind of DockColors this provider handles.
All Implemented Interfaces:
ColorProvider<D>

public class MultiColorProvider<D extends DockColor>
extends Object
implements ColorProvider<D>

A ColorProvider which uses other providers to handle some colors.

Author:
Benjamin Sigg

Constructor Summary
MultiColorProvider(ColorManager manager)
          Creates a new ColorProvider.
 
Method Summary
 void add(String id, D color)
          Adds a listener for some type of color to this provider.
 ColorProvider<? super D> getProvider(String id)
          Searches the provider that handles colors with the key id.
 void put(String id, ColorProvider<? super D> provider)
          Specifies a provider that handles all calls regarding id.
 void remove(String id, D color)
          Removes a listener for some type of color from this provider.
 void set(String id, Color color, D observer)
          Called by a ColorManager when one color has been exchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiColorProvider

public MultiColorProvider(ColorManager manager)
Creates a new ColorProvider.

Parameters:
manager - the manager from whom this provider will get default colors when necessary
Method Detail

put

public void put(String id,
                ColorProvider<? super D> provider)
Specifies a provider that handles all calls regarding id.

Parameters:
id - the key of the color provider should handle
provider - the new provider or null

getProvider

public ColorProvider<? super D> getProvider(String id)
Searches the provider that handles colors with the key id.

Parameters:
id - the key of the colors
Returns:
the responsible provider or null

add

public void add(String id,
                D color)
Description copied from interface: ColorProvider
Adds a listener for some type of color to this provider.

Specified by:
add in interface ColorProvider<D extends DockColor>
Parameters:
id - the id of the color the observer needs
color - the new listener

remove

public void remove(String id,
                   D color)
Description copied from interface: ColorProvider
Removes a listener for some type of color from this provider.

Specified by:
remove in interface ColorProvider<D extends DockColor>
Parameters:
id - the id of the color which the observer was observing
color - the listener to remove

set

public void set(String id,
                Color color,
                D observer)
Description copied from interface: ColorProvider
Called by a ColorManager when one color has been exchanged. Normally a provider would call DockColor.set(Color) on observer with color as argument.

Specified by:
set in interface ColorProvider<D extends DockColor>
Parameters:
id - the identifier of the color
color - the new color, can be null
observer - the observer which is affected