de.uni_paderborn.fujaba.fsa.swing
Class GrabManager

java.lang.Object
  extended byjava.awt.event.ComponentAdapter
      extended byde.uni_paderborn.fujaba.fsa.swing.GrabManager
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener, java.awt.event.HierarchyBoundsListener, java.awt.event.HierarchyListener, java.beans.PropertyChangeListener

public class GrabManager
extends java.awt.event.ComponentAdapter
implements java.beans.PropertyChangeListener, java.awt.event.HierarchyListener, java.awt.event.HierarchyBoundsListener

The GrabManager associates a number of Grabs to a target JComponent, manages events of the target and calls the GrabLayouter to relayout the Grabs when necessary.

The association to the JComponent is implemented using the clientProperty-Methods of the JComponent. This means that the association to the JComponent is implemented with the traditional access methods, but the backward association is implemented as the client property with name

GrabManager.TARGET_PROPERTY
of the target component. It is accessible via:

    (GrabManager)targetComponent.getClientProperty(GrabManager.TARGET_PROPERTY)
 

Associations

              0..1                      N
 GrabManager ----------------------------- JGrab
              manager               grabs
              0..1                                 N
 GrabManager ---------------------------------------- JComponent
              getClientProperty               target
 

Version:
$Revision: 1.28 $
Author:
$Author: schneider $
See Also:
JComponent.getClientProperty(java.lang.Object), JComponent.putClientProperty(java.lang.Object, java.lang.Object), JGrab, GrabLayouter

Field Summary
static java.lang.String TARGET_PROPERTY
          No comment provided by developer, please add a comment to improve documentation.
 
Constructor Summary
GrabManager()
          Constructor for class GrabManager
GrabManager(javax.swing.JComponent target)
          Constructor for class GrabManager
 
Method Summary
 boolean addToGrabs(JGrab value)
          Add a Grab to the list of Grabs that are managed by this Object.
 void ancestorMoved(java.awt.event.HierarchyEvent e)
          Listen for changes to ancestors of the target.
 void ancestorResized(java.awt.event.HierarchyEvent e)
          No comment provided by developer, please add a comment to improve documentation.
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
static void doPostPonedGrabLayout()
          No comment provided by developer, please add a comment to improve documentation.
 javax.swing.JComponent getTarget()
           
 boolean hasInGrabs(JGrab value)
           
 void hierarchyChanged(java.awt.event.HierarchyEvent e)
           
 java.util.Iterator iteratorOfGrabs()
          No comment provided by developer, please add a comment to improve documentation.
static void postPoneGrabLayout()
          No comment provided by developer, please add a comment to improve documentation.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Listens for changes to Position or size of the target to revalidate the grabs and for changes to the parents of the Grabs to update the common ancestor
 void removeAllFromGrabs()
          No comment provided by developer, please add a comment to improve documentation.
 boolean removeFromGrabs(JGrab value)
          Removes the Grab value from the list of Grabs and updates the common ancestor of all grabs
 void revalidate()
          Checks the Target if a specific GrabLayouter is set as client property with name GrabLayouter.TARGET_PROPERTY.
 void revalidate(int depthIncrease)
          Checks the Target if a specific GrabLayouter is set as client property with name GrabLayouter.TARGET_PROPERTY.
 boolean setTarget(javax.swing.JComponent value)
          Set the target of this Manager (and all of its Grabs) to value.
 int sizeOfGrabs()
          No comment provided by developer, please add a comment to improve documentation.
 
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentShown
 
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

GrabManager

public GrabManager()
Constructor for class GrabManager


GrabManager

public GrabManager(javax.swing.JComponent target)
Constructor for class GrabManager

Parameters:
target - No description provided
Method Detail

postPoneGrabLayout

public static void postPoneGrabLayout()
No comment provided by developer, please add a comment to improve documentation.


doPostPonedGrabLayout

public static void doPostPonedGrabLayout()
No comment provided by developer, please add a comment to improve documentation.


setTarget

public boolean setTarget(javax.swing.JComponent value)
Set the target of this Manager (and all of its Grabs) to value.

Reverse Link is

    (GrabManager)value.getClientProperty(GrabManager.TARGET_PROPERTY)
 

Parameters:
value - The new target
Returns:
true if target was changed, false otherwise
See Also:
getTarget()

getTarget

public javax.swing.JComponent getTarget()
Returns:
the JComponent this GrabManager is connected to

addToGrabs

public boolean addToGrabs(JGrab value)
Add a Grab to the list of Grabs that are managed by this Object. Update the common ancestor of all Grabs accordingly

Parameters:
value - the Grab to add
Returns:
true if the Grab was added, false otherwise
See Also:
#updateCommonAncestorOfGrabs(java.awt.Container, boolean)

hasInGrabs

public boolean hasInGrabs(JGrab value)
Parameters:
value -
Returns:
No description provided

iteratorOfGrabs

public java.util.Iterator iteratorOfGrabs()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

sizeOfGrabs

public int sizeOfGrabs()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

removeFromGrabs

public boolean removeFromGrabs(JGrab value)
Removes the Grab value from the list of Grabs and updates the common ancestor of all grabs

Parameters:
value - the grab in question
Returns:
true if the list was changed
See Also:
#updateCommonAncestorOfGrabs(java.awt.Container, boolean)

removeAllFromGrabs

public void removeAllFromGrabs()
No comment provided by developer, please add a comment to improve documentation.


revalidate

public void revalidate()
Checks the Target if a specific GrabLayouter is set as client property with name GrabLayouter.TARGET_PROPERTY. If none is found the default Layouter is the result of GrabLayouter.get().

Then the layout-Method of the Layouter is called to reposition the grabs around the target JComponent

See Also:
GrabLayouter, GrabLayouter.getDefaultLayouter(), GrabLayouter.layout(de.uni_paderborn.fujaba.fsa.swing.GrabManager)

revalidate

public void revalidate(int depthIncrease)
Checks the Target if a specific GrabLayouter is set as client property with name GrabLayouter.TARGET_PROPERTY. If none is found the default Layouter is the result of GrabLayouter.get().

Then the layout-Method of the Layouter is called to reposition the grabs around the target JComponent

Parameters:
depthIncrease - recursion is limitted to 2.
depthIncrease 0 layouts with full recursion
depthIncrease 1 layouts this frame and its direct neighbors
depthIncrease 2 or greater layouts only this frame
See Also:
GrabLayouter, GrabLayouter.getDefaultLayouter(), GrabLayouter.layout(de.uni_paderborn.fujaba.fsa.swing.GrabManager)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Listens for changes to Position or size of the target to revalidate the grabs and for changes to the parents of the Grabs to update the common ancestor

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
e - the event
See Also:
revalidate(), #updateCommonAncestorOfGrabs(java.awt.Container, boolean)

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener
Parameters:
e - the event

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener
Parameters:
e - the event

hierarchyChanged

public void hierarchyChanged(java.awt.event.HierarchyEvent e)
Specified by:
hierarchyChanged in interface java.awt.event.HierarchyListener
Parameters:
e - the event

ancestorMoved

public void ancestorMoved(java.awt.event.HierarchyEvent e)
Listen for changes to ancestors of the target.

If a parent of the common ancestor of grabs is changed there is nothing to do, because the changes affect the grabs, too. Otherwise the grabs have to be relayouted

Specified by:
ancestorMoved in interface java.awt.event.HierarchyBoundsListener
Parameters:
e - The event
See Also:
revalidate(), #updateCommonAncestorOfGrabs(Container)

ancestorResized

public void ancestorResized(java.awt.event.HierarchyEvent e)
No comment provided by developer, please add a comment to improve documentation.

Specified by:
ancestorResized in interface java.awt.event.HierarchyBoundsListener
Parameters:
e - No description provided