bibliothek.gui.dock.event
Class VetoableDockFrontendEvent

java.lang.Object
  extended by bibliothek.gui.dock.event.VetoableDockFrontendEvent
All Implemented Interfaces:
Iterable<Dockable>

public class VetoableDockFrontendEvent
extends Object
implements Iterable<Dockable>

Event that is received by a VetoableDockFrontendListener.

Author:
Benjamin Sigg

Constructor Summary
VetoableDockFrontendEvent(DockFrontend frontend, boolean cancelable, boolean expected, Dockable... dockables)
          Creates a new event
 
Method Summary
 void cancel()
          Aborts the operation.
 Dockable getDockable(int index)
          Gets an element which will be or is hidden.
 int getDockableCount()
          Gets the number of Dockables which are in this event.
 Dockable[] getDockables()
          Gets all the elements that are used in this event.
 DockFrontend getFrontend()
          Gets the source of the event.
 boolean isCancelable()
          Tells whether the operation can be canceled or not.
 boolean isCanceled()
          Whether the operation is aborted or not.
 boolean isExpected()
          Tells whether VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) or VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) was called for this event or not.
 Iterator<Dockable> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VetoableDockFrontendEvent

public VetoableDockFrontendEvent(DockFrontend frontend,
                                 boolean cancelable,
                                 boolean expected,
                                 Dockable... dockables)
Creates a new event

Parameters:
frontend - the source of the event
cancelable - whether the operation can be aborted
expected - whether the event is expected or unexpected
dockables - the elements which will be or is hidden, at least one entry is required
Method Detail

getFrontend

public DockFrontend getFrontend()
Gets the source of the event.

Returns:
the source, never null

getDockableCount

public int getDockableCount()
Gets the number of Dockables which are in this event.

Returns:
the number of elements

getDockable

public Dockable getDockable(int index)
Gets an element which will be or is hidden.

Parameters:
index - the index of the element, the index 0 is always valid.
Returns:
the element, never null

getDockables

public Dockable[] getDockables()
Gets all the elements that are used in this event.

Returns:
all the elements, modifications of this array will not affect this event

iterator

public Iterator<Dockable> iterator()
Specified by:
iterator in interface Iterable<Dockable>

isCancelable

public boolean isCancelable()
Tells whether the operation can be canceled or not. If not, then the result of VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) will be ignored.

Returns:
true if the operation can be stopped

cancel

public void cancel()
Aborts the operation. Has no effect if isCancelable() returns false or the operation is already executed.


isCanceled

public boolean isCanceled()
Whether the operation is aborted or not.

Returns:
true if the operation is aborted

isExpected

public boolean isExpected()
Tells whether VetoableDockFrontendListener.hiding(VetoableDockFrontendEvent) or VetoableDockFrontendListener.showing(VetoableDockFrontendEvent) was called for this event or not.
If true then this is a standard expected event that either happens when the user clicks onto the close-action delivered by DockFrontend, or if the client calls DockFrontend.hide(Dockable, boolean) or DockFrontend.show(Dockable, boolean).
If false then this is an unexpected event that can have any cause, e.g. loading a new layout.

Returns:
whether the event is expected or unexpected