Package bibliothek.gui.dock.common.event
Class CVetoClosingEvent
java.lang.Object
bibliothek.gui.dock.common.event.CVetoClosingEvent
Event that is delivered to a
CVetoClosingListener before and after a set
of CDockables is closed.- Author:
- Benjamin Sigg
-
Constructor Summary
ConstructorsConstructorDescriptionCVetoClosingEvent(CControl control, VetoableDockFrontendEvent source, CDockable... dockables) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Stops this event from happeningGets the control in whose realm this event was issued.getDockable(int index) Gets theindex'th dockable that is associated with this event.intGets the number of elements that are associated with this event.intern()Gets the source of this event.booleanTells whether this event can still be canceled or is already bound to happen.booleanTells whether this event has already been canceled.booleanTells whether this event was expected.iterator()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CVetoClosingEvent
public CVetoClosingEvent(CControl control, VetoableDockFrontendEvent source, CDockable... dockables) Creates a new event.- Parameters:
control- the owner of this eventsource- the reason for this eventdockables- the affected dockables (may be only a subset of all affected dockables)
-
-
Method Details
-
intern
Gets the source of this event. Clients may use the source to obtain additional information about this event.- Returns:
- the source of this event
-
getDockableCount
public int getDockableCount()Gets the number of elements that are associated with this event.- Returns:
- the number of elements
-
getDockable
Gets theindex'th dockable that is associated with this event.- Parameters:
index- the index of a dockable- Returns:
- the element
-
iterator
-
getControl
Gets the control in whose realm this event was issued.- Returns:
- the control, never
null
-
isCancelable
public boolean isCancelable()Tells whether this event can still be canceled or is already bound to happen.- Returns:
trueif a veto will have an effect
-
cancel
public void cancel()Stops this event from happening -
isCanceled
public boolean isCanceled()Tells whether this event has already been canceled.- Returns:
- whether
cancel()has already been called
-
isExpected
public boolean isExpected()Tells whether this event was expected. An event is expected ifCVetoClosingListener.closing(CVetoClosingEvent)was called beforeCVetoClosingListener.closed(CVetoClosingEvent).
Unexpected events can never be canceled. They may happen if aCDockableis closed in an unexpected way like not usingCDockable.setVisible(boolean)but directly removing it from its parentDockStation, or if a new layout (CControl.load(String)) is applied and the framework could not guess correctly which elements are going to be replaced.- Returns:
- whether this event was expected to happen or not
-