Class CVetoClosingEvent

java.lang.Object
bibliothek.gui.dock.common.event.CVetoClosingEvent
All Implemented Interfaces:
Iterable<CDockable>

public class CVetoClosingEvent extends Object implements Iterable<CDockable>
Event that is delivered to a CVetoClosingListener before and after a set of CDockables is closed.
Author:
Benjamin Sigg
  • Constructor Details

    • CVetoClosingEvent

      public CVetoClosingEvent(CControl control, VetoableDockFrontendEvent source, CDockable... dockables)
      Creates a new event.
      Parameters:
      control - the owner of this event
      source - the reason for this event
      dockables - the affected dockables (may be only a subset of all affected dockables)
  • Method Details

    • intern

      public VetoableDockFrontendEvent 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

      public CDockable getDockable(int index)
      Gets the index'th dockable that is associated with this event.
      Parameters:
      index - the index of a dockable
      Returns:
      the element
    • iterator

      public Iterator<CDockable> iterator()
      Specified by:
      iterator in interface Iterable<CDockable>
    • getControl

      public CControl 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:
      true if 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 if CVetoClosingListener.closing(CVetoClosingEvent) was called before CVetoClosingListener.closed(CVetoClosingEvent).
      Unexpected events can never be canceled. They may happen if a CDockable is closed in an unexpected way like not using CDockable.setVisible(boolean) but directly removing it from its parent DockStation, 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