Class CStationContainerHistoryRewriter

java.lang.Object
bibliothek.gui.dock.common.mode.CStationContainerHistoryRewriter
All Implemented Interfaces:
HistoryRewriter<Location,CLocationMode>

public class CStationContainerHistoryRewriter extends Object implements HistoryRewriter<Location,CLocationMode>
The CStationContainerHistoryRewriter tries to ensure that a CDockable stays on the same CStationContainer when changing the ExtendedMode.
Author:
Benjamin Sigg
  • Constructor Details

    • CStationContainerHistoryRewriter

      public CStationContainerHistoryRewriter(CControl control)
      Creates a new rewriter
      Parameters:
      control - provides the list of CStationContainers to check
  • Method Details

    • getControl

      public CControl getControl()
      Gets the CControl that is using this rewriter.
      Returns:
      the control
    • getMatchingStation

      protected CStation<?> getMatchingStation(Dockable dockable, String root)
      Given the current location of dockable and the root station it is going to use, this method decides which CStation is actually going to be the new parent root station.
      Parameters:
      dockable - the element that is going to be moved around
      root - the new root station
      Returns:
      a replacement for root, a value of null means that root should be used.
    • getMatchingStation

      protected CStation<?> getMatchingStation(Dockable dockable, ExtendedMode mode)
      Searches a CStation which could be the new parent of dockable if it should be in mode mode.
      Parameters:
      dockable - the element for which a new parent is searched
      mode - the mode element should be in
      Returns:
      the new parent or null
    • getWorkingArea

      protected CStation<?> getWorkingArea(Dockable dockable)
      Gets the CStation which is set as CDockable.getWorkingArea() for dockable.
      Parameters:
      dockable - the element whose working area is searched
      Returns:
      the working area or null
    • getParent

      protected CStation<?> getParent(Dockable dockable)
      Gets the first parent CStation of dockable.
      Parameters:
      dockable - some dockable whose parent station is searched
      Returns:
      the parent station or null if not found
    • getContainer

      protected CStationContainer getContainer(CStation<?> child)
      Searches the CStationContainer which is the parent of child.
      Parameters:
      child - some CStation whose parent is searched
      Returns:
      the parent of child or null
    • rewrite

      public Location rewrite(Dockable dockable, CLocationMode mode, Location history)
      Description copied from interface: HistoryRewriter
      Checks whether the history object history is still valid.
      Specified by:
      rewrite in interface HistoryRewriter<Location,CLocationMode>
      Parameters:
      dockable - the element which is about to change its mode
      mode - the mode that is going to be applied
      history - the history object that will be forwarded to mode, may be null
      Returns:
      the history object to use, may be null