bibliothek.gui.dock.util
Class BackgroundAlgorithm

java.lang.Object
  extended by bibliothek.gui.dock.util.BackgroundAlgorithm
All Implemented Interfaces:
BackgroundComponent, UIValue<BackgroundPaint>
Direct Known Subclasses:
DisplayerScreenDockWindow.Background

public abstract class BackgroundAlgorithm
extends java.lang.Object
implements BackgroundComponent

A utility class for managing BackgroundPaint, BackgroundComponent and PaintableComponent at the same time.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from interface bibliothek.gui.dock.util.BackgroundComponent
KIND
 
Constructor Summary
BackgroundAlgorithm(Path kind, java.lang.String id)
          Creates a new algorithm.
 
Method Summary
 BackgroundPaint getPaint()
          Gets the BackgroundPaint of this UIValue.
 void paint(PaintableComponent component, java.awt.Graphics g)
          Paints component using the graphics context g.
 void repaint()
          Informs this component that it should be repainted.
 void set(BackgroundPaint value)
          Called when the underlying resource of this UIValue changes.
 void setController(DockController controller)
          Sets the source of the BackgroundPaint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.util.BackgroundComponent
getComponent
 

Constructor Detail

BackgroundAlgorithm

public BackgroundAlgorithm(Path kind,
                           java.lang.String id)
Creates a new algorithm.

Parameters:
kind - the kind of UIValue this is
id - the identifier of this UIValue
Method Detail

setController

public void setController(DockController controller)
Sets the source of the BackgroundPaint.

Parameters:
controller - the new controller, can be null

repaint

public void repaint()
Description copied from interface: BackgroundComponent
Informs this component that it should be repainted.

Specified by:
repaint in interface BackgroundComponent

set

public void set(BackgroundPaint value)
Description copied from interface: UIValue
Called when the underlying resource of this UIValue changes.

Specified by:
set in interface UIValue<BackgroundPaint>
Parameters:
value - the new value

getPaint

public BackgroundPaint getPaint()
Gets the BackgroundPaint of this UIValue.

Returns:
the value, can be null

paint

public void paint(PaintableComponent component,
                  java.awt.Graphics g)
Paints component using the graphics context g. This method ensures that PaintableComponent.paintBackground(Graphics) and PaintableComponent.paintForeground(Graphics) are not called with a null argument. component does not need to track how often its paint-methods are called, that is done by this method.

Parameters:
component - the component to paint
g - the graphics context to use