bibliothek.gui.dock.frontend
Class VetoManager

java.lang.Object
  extended by bibliothek.gui.dock.frontend.VetoManager

public class VetoManager
extends Object

Used by a DockFrontend to correctly handle all VetoableDockFrontendEvents.

Author:
Benjamin Sigg

Constructor Summary
VetoManager(DockFrontend frontend)
           
 
Method Summary
 void addVetoableListener(VetoableDockFrontendListener listener)
          Adds listener to this frontend.
 boolean expectToHide(Collection<Dockable> dockables, boolean cancelable)
          Marks all elements of dockables to be expected to hide soon.
 boolean expectToHide(Dockable dockable, boolean cancelable)
          Marks all elements of the tree with root dockable to be expected to hide soon.
 boolean expectToShow(Collection<Dockable> dockables, boolean cancelable)
          Marks all elements of dockables to be expected to show soon.
 boolean expectToShow(Dockable dockable, boolean cancelable)
          Marks all elements of the tree with root dockable to be expected to show soon.
protected  void fireAllHidden(Collection<Dockable> dockables, boolean expected)
          Invokes the method VetoableDockFrontendListener.hidden(VetoableDockFrontendEvent) for all listeners for all elements in dockables.
protected  void fireAllHidden(Dockable dockable, boolean expected)
          Invokes the method VetoableDockFrontendListener.hidden(VetoableDockFrontendEvent) for all listeners for all elements of the tree with root dockable.
protected  boolean fireAllHiding(Collection<Dockable> dockables, boolean cancelable)
          Calls the method VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) for all elements in dockables
protected  boolean fireAllHiding(Dockable dockable, boolean cancelable)
          Calls the method VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) for all elements in the tree beginning with dockable.
protected  boolean fireAllShowing(Collection<Dockable> dockables, boolean cancelable)
          Calls VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) for all elements in dockables.
protected  boolean fireAllShowing(Dockable dockable, boolean cancelable)
          Calls VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) for all elements in the tree with root dockable.
protected  void fireAllShown(Collection<Dockable> dockables, boolean expected)
          Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) for all elements in dockables.
protected  void fireAllShown(Dockable dockable, boolean expected)
          Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) for all elements in the tree with root dockable.
protected  void fireHidden(Dockable dockable, boolean expected)
          Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) on all listeners.
protected  void fireShown(Dockable dockable, boolean expected)
          Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) on all listeners.
 DockFrontend getFrontend()
          Gets the owner of this manager.
 void removeVetoableListener(VetoableDockFrontendListener listener)
          Removes listener from this frontend.
protected  VetoableDockFrontendListener[] vetoableListeners()
          Gets an independent array containing all currently registered VetoableDockFrontendListeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VetoManager

public VetoManager(DockFrontend frontend)
Method Detail

getFrontend

public DockFrontend getFrontend()
Gets the owner of this manager.

Returns:
the owner

expectToHide

public boolean expectToHide(Dockable dockable,
                            boolean cancelable)
Marks all elements of the tree with root dockable to be expected to hide soon.

Parameters:
dockable - the root of the elements which will be hidden
cancelable - whether the operation can be aborted
Returns:
true if the operation completed successful, false if the operation was aborted

expectToHide

public boolean expectToHide(Collection<Dockable> dockables,
                            boolean cancelable)
Marks all elements of dockables to be expected to hide soon.

Parameters:
dockables - the elements which will be hidden
cancelable - whether the operation can be aborted
Returns:
true if the operation completed successful, false if the operation was aborted

expectToShow

public boolean expectToShow(Dockable dockable,
                            boolean cancelable)
Marks all elements of the tree with root dockable to be expected to show soon.

Parameters:
dockable - the root of the elements
cancelable - whether the operation can be aborted
Returns:
true if the operation completed successful, false if the operation was aborted

expectToShow

public boolean expectToShow(Collection<Dockable> dockables,
                            boolean cancelable)
Marks all elements of dockables to be expected to show soon.

Parameters:
dockables - the elements which will be shown
cancelable - whether the operation can be aborted
Returns:
true if the operation completed successful, false if the operation was aborted

addVetoableListener

public void addVetoableListener(VetoableDockFrontendListener listener)
Adds listener to this frontend. The listener will be notified when a Dockable will be or is closed.

Parameters:
listener - the new listener

removeVetoableListener

public void removeVetoableListener(VetoableDockFrontendListener listener)
Removes listener from this frontend.

Parameters:
listener - the listener to remove

vetoableListeners

protected VetoableDockFrontendListener[] vetoableListeners()
Gets an independent array containing all currently registered VetoableDockFrontendListeners.

Returns:
the array of listeners

fireAllHiding

protected boolean fireAllHiding(Dockable dockable,
                                boolean cancelable)
Calls the method VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) for all elements in the tree beginning with dockable.

Parameters:
dockable - the root of the tree of elements to remove
cancelable - whether the operation can be aborted
Returns:
true if the operation was aborted, false if not.

fireAllHiding

protected boolean fireAllHiding(Collection<Dockable> dockables,
                                boolean cancelable)
Calls the method VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) for all elements in dockables

Parameters:
dockables - a list of element which will be closed
cancelable - whether the operation can be aborted
Returns:
true if the operation was aborted, false if not.

fireAllHidden

protected void fireAllHidden(Collection<Dockable> dockables,
                             boolean expected)
Invokes the method VetoableDockFrontendListener.hidden(VetoableDockFrontendEvent) for all listeners for all elements in dockables.

Parameters:
dockables - the elements that were hidden
expected - whether this event was expected or unexpected

fireHidden

protected void fireHidden(Dockable dockable,
                          boolean expected)
Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) on all listeners.

Parameters:
dockable - the element that was shown
expected - whether the event was expected or not

fireAllHidden

protected void fireAllHidden(Dockable dockable,
                             boolean expected)
Invokes the method VetoableDockFrontendListener.hidden(VetoableDockFrontendEvent) for all listeners for all elements of the tree with root dockable.

Parameters:
dockable - the element that was hidden
expected - whether this event was expected or unexpected

fireAllShowing

protected boolean fireAllShowing(Dockable dockable,
                                 boolean cancelable)
Calls VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) for all elements in the tree with root dockable.

Parameters:
dockable - the root of the tree that will become visible
cancelable - whether the operation can be canceled
Returns:
true if the operation was aborted, false if the operation can continue

fireAllShowing

protected boolean fireAllShowing(Collection<Dockable> dockables,
                                 boolean cancelable)
Calls VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) for all elements in dockables.

Parameters:
dockables - the element to show
cancelable - whether the operation can be canceled
Returns:
true if the operation was aborted, false if the operation can continue

fireAllShown

protected void fireAllShown(Dockable dockable,
                            boolean expected)
Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) for all elements in the tree with root dockable.

Parameters:
dockable - the root of the tree that is shown
expected - whether the event is expected or not

fireAllShown

protected void fireAllShown(Collection<Dockable> dockables,
                            boolean expected)
Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) for all elements in dockables.

Parameters:
dockables - the set of newly shown elements
expected - whether the event is expected or not

fireShown

protected void fireShown(Dockable dockable,
                         boolean expected)
Invokes the method VetoableDockFrontendListener.shown(VetoableDockFrontendEvent) on all listeners.

Parameters:
dockable - the element that was shown
expected - whether the event was expected or not