de.uni_paderborn.fujaba.fsa.swing
Class GrabLayouter

java.lang.Object
  extended byde.uni_paderborn.fujaba.fsa.swing.GrabLayouter
Direct Known Subclasses:
CircleGrabLayouter, DefaultGrabLayouter, JBendLineGrabLayouter, LifeLineGrabLayouter, OvalGrabLayouter, RhombGrabLayouter

public abstract class GrabLayouter
extends java.lang.Object

Called by a GrabManager to layout the Grabs of the Manager around the border of the Managers target.

The GrabLayouter used by the GrabManager is determined as follows:
If the target has a GrabLayouter defined as client property with name GrabLayouter.TARGET_PROPERTY (which is the same as the result of

GrabLayouter.getLayouter(target)
) that one is used. Otherwise GrabLayouter.get() is called to get the default Layouter.

Version:
$Revision: 1.13 $
Author:
$Author: schneider $

Field Summary
static java.lang.String TARGET_PROPERTY
          No comment provided by developer, please add a comment to improve documentation.
 
Constructor Summary
GrabLayouter()
           
 
Method Summary
static GrabLayouter getDefaultLayouter()
           
static java.lang.Class getDefaultLayouterClass()
          Get the defaultLayouterClass attribute of the GrabLayouter class
static GrabLayouter getLayouter(javax.swing.JComponent comp)
          The result of this method is either the layouter specified as client property of comp or if none is found the result of GrabLayouter.get()
protected  double[] getPreferredLayoutInformation(JGrab grab)
          Retrieves the preferred orientation and alignment of the Grab and sets these values in the Grab.
abstract  void layout(GrabManager manager)
          Assigns every Grab of manager a position on the border of the managers target
 void registerLayouterWithJComponent(javax.swing.JComponent comp)
          Set this Layouter as default for comp by adding it to comps client properties
static void setDefaultLayouterClass(java.lang.Class layouterClass)
          Sets the defaultLayouterClass attribute of the GrabLayouter class
static void unregisterLayouterFromJComponent(javax.swing.JComponent comp)
          clears the default for comp by the field from the client properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_PROPERTY

public static final java.lang.String TARGET_PROPERTY
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values
Constructor Detail

GrabLayouter

public GrabLayouter()
Method Detail

getDefaultLayouter

public static GrabLayouter getDefaultLayouter()
Returns:
the singleton instance

setDefaultLayouterClass

public static void setDefaultLayouterClass(java.lang.Class layouterClass)
Sets the defaultLayouterClass attribute of the GrabLayouter class

Parameters:
layouterClass - The new defaultLayouterClass value

getDefaultLayouterClass

public static java.lang.Class getDefaultLayouterClass()
Get the defaultLayouterClass attribute of the GrabLayouter class

Returns:
The defaultLayouterClass value

getLayouter

public static GrabLayouter getLayouter(javax.swing.JComponent comp)
The result of this method is either the layouter specified as client property of comp or if none is found the result of GrabLayouter.get()

Parameters:
comp - the target for which a layouter is needed
Returns:
the Layouter to use for the target comp
See Also:
registerLayouterWithJComponent(javax.swing.JComponent), unregisterLayouterFromJComponent(javax.swing.JComponent), getDefaultLayouter(), JComponent.getClientProperty(java.lang.Object)

registerLayouterWithJComponent

public void registerLayouterWithJComponent(javax.swing.JComponent comp)
Set this Layouter as default for comp by adding it to comps client properties

Parameters:
comp - No description provided
See Also:
TARGET_PROPERTY, unregisterLayouterFromJComponent(javax.swing.JComponent), getLayouter(javax.swing.JComponent)

unregisterLayouterFromJComponent

public static void unregisterLayouterFromJComponent(javax.swing.JComponent comp)
clears the default for comp by the field from the client properties

Parameters:
comp - No description provided
See Also:
TARGET_PROPERTY, registerLayouterWithJComponent(javax.swing.JComponent), getLayouter(javax.swing.JComponent)

layout

public abstract void layout(GrabManager manager)
Assigns every Grab of manager a position on the border of the managers target

Parameters:
manager - the GrabManager for which the work is to be done

getPreferredLayoutInformation

protected double[] getPreferredLayoutInformation(JGrab grab)
Retrieves the preferred orientation and alignment of the Grab and sets these values in the Grab.

This default implementation only inspects the first line of the Grab returned by grab.iteratorOfLines(). It gets the orientation and alignment that are closest to the other point of the line

Parameters:
grab - the Grab to inspect
Returns:
the preferred orientation and alignment of the grab
See Also:
JGrab.setLayoutOrientation(de.uni_paderborn.fujaba.fsa.swing.Direction), JGrab.setLayoutAlignment(double), JBend.iteratorOfLines()