Sharkysoft home

lava.gui
Class ListenableLayoutManager

java.lang.Object
  |
  +--lava.gui.ListenableLayoutManager
All Implemented Interfaces:
java.awt.LayoutManager
Direct Known Subclasses:
ListenableLayoutManager2

public class ListenableLayoutManager
extends java.lang.Object
implements java.awt.LayoutManager

Adds LayoutListener support to any LayoutManager.

Details: ListenableLayoutManager is a LayoutManager that forwards most of its work to another LayoutManager. This class adds LayoutListener support to existing LayoutManager implementations.

Since:
1999.06.09

Field Summary
protected  java.awt.LayoutManager lm
          Represented LayoutManager.
 
Constructor Summary
ListenableLayoutManager(java.awt.LayoutManager lm)
          Specifies LayoutManager.
 
Method Summary
 void addLayoutComponent(java.lang.String s, java.awt.Component c)
          Forwards call to lm.
 void addLayoutListener(LayoutListener ll)
          Subscribes LayoutListener to laidOutContainer messages.
 void layoutContainer(java.awt.Container c)
          Forwards call to lm.
 java.awt.Dimension minimumLayoutSize(java.awt.Container c)
          Forwards call to lm.
protected  void notifyListeners(java.awt.Container c)
          Sends laidOutContainer messages to registered LayoutListeners.
 java.awt.Dimension preferredLayoutSize(java.awt.Container c)
          Forwards call to lm.
 void removeLayoutComponent(java.awt.Component c)
          Forwards call to lm.
 void removeLayoutListener(LayoutListener ll)
          Unsubscribes LayoutListener to laidOutContainer messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lm

protected final java.awt.LayoutManager lm
Represented LayoutManager.

Details: lm is the real LayoutManager for which I am acting as a proxy. I forward most of my layout work to lm. This value is defined at construction time.

Constructor Detail

ListenableLayoutManager

public ListenableLayoutManager(java.awt.LayoutManager lm)
Specifies LayoutManager.

Details: This constructor prepares me to act as a proxy for the given LayoutManager.

Parameters:
lm - the LayoutManager
Method Detail

addLayoutListener

public void addLayoutListener(LayoutListener ll)
Subscribes LayoutListener to laidOutContainer messages.

Details: addLayoutListener adds ll, a LayoutListener, to my list of registered LayoutListeners. If ll is already registered, this does nothing.

Parameters:
ll - the interested LayoutListener

removeLayoutListener

public void removeLayoutListener(LayoutListener ll)
Unsubscribes LayoutListener to laidOutContainer messages.

Details: removeLayoutListener removes ll, a LayoutListener, from my list of registered LayoutListeners. No action is taken if ll is not registered.

Parameters:
ll - the uninterested LayoutListener

notifyListeners

protected void notifyListeners(java.awt.Container c)
Sends laidOutContainer messages to registered LayoutListeners.

Details: notifyListeners calls laidOutContainer(c) for all registered LayoutListeners.

Parameters:
c - passed to laidOutContainer

layoutContainer

public void layoutContainer(java.awt.Container c)
Forwards call to lm.

Details: I forward layoutContainer calls to lm, and then call notifyListeners(c) on each of the registered LayoutListeners to let them know that I just laid out a Container.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
c - the Container

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component c)
Forwards call to lm.

Details: I forward removeLayoutComponent calls to lm.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
c - a forwarded parameter

addLayoutComponent

public void addLayoutComponent(java.lang.String s,
                               java.awt.Component c)
Forwards call to lm.

Details: I forward addLayoutComponent calls to lm.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
s - a forwarded parameter
c - a forwarded parameter

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container c)
Forwards call to lm.

Details: I forward preferredLayoutSize calls to lm and return the result.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
c - a forwarded parameter
Returns:
the result

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container c)
Forwards call to lm.

Details: I forward minimumLayoutSize calls to lm and return the result.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
c - a forwarded parameter
Returns:
the result

Sharkysoft home