Class MaximizedMode<M extends MaximizedModeArea>

java.lang.Object
bibliothek.gui.dock.facile.mode.AbstractLocationMode<M>
bibliothek.gui.dock.facile.mode.MaximizedMode<M>
Type Parameters:
M - the kind of areas this mode handles
All Implemented Interfaces:
LocationMode, Mode<Location>, Iterable<M>
Direct Known Subclasses:
CMaximizedMode

public class MaximizedMode<M extends MaximizedModeArea> extends AbstractLocationMode<M>
Dockables are maximized if they take up the whole space a frame or a screen offers.
Author:
Benjamin Sigg
  • Field Details

    • IDENTIFIER

      public static final Path IDENTIFIER
      unique identifier for this mode
    • ICON_IDENTIFIER

      public static final String ICON_IDENTIFIER
      the key used for the IconManager to read the Icon for the "maximize"-action
      See Also:
  • Constructor Details

    • MaximizedMode

      protected MaximizedMode()
      Empty default constructor. Subclasses should call AbstractLocationMode.setActionProvider(LocationModeActionProvider) to complete initialization of this mode.
    • MaximizedMode

      public MaximizedMode(CControl control)
      Creates a new mode
      Parameters:
      control - the control in whose realm this mode will work
    • MaximizedMode

      public MaximizedMode(DockController controller)
      Creates a new mode.
      Parameters:
      controller - the owner of this mode
  • Method Details

    • setManager

      public void setManager(LocationModeManager<?> manager)
      Description copied from interface: LocationMode
      Sets the manager which is using this mode.
      Specified by:
      setManager in interface LocationMode
      Overrides:
      setManager in class AbstractLocationMode<M extends MaximizedModeArea>
      Parameters:
      manager - the manager or null
    • getUniqueIdentifier

      public Path getUniqueIdentifier()
      Description copied from interface: Mode
      Gets a unique identifier, only this Mode must have this identifier. Identifiers with the first segment being "dock" are reserved for this framework, clients may choose any other identifiers.
      Returns:
      the identifier, not null, should contain at least one segment.
    • getExtendedMode

      public ExtendedMode getExtendedMode()
      Description copied from interface: LocationMode
      Gets the unique identifier of this mode.
      Returns:
      the unique identifier
    • runApply

      public boolean runApply(Dockable dockable, Location history, AffectedSet set)
      Description copied from class: AbstractLocationMode
      Called by AbstractLocationMode.apply(Dockable, Location, AffectedSet) after the LocationModeListeners are informed. Applies this mode to dockable.
      Specified by:
      runApply in class AbstractLocationMode<M extends MaximizedModeArea>
      Parameters:
      dockable - the element whose mode becomes this
      history - history information that was returned by this mode when calling Mode.current(Dockable) the last time.
      set - this method has to store all Dockables which might have changed their mode in the set.
      Returns:
      true if dockable was moved, false if the method failed to set the location of dockable for any reason
    • current

      public Location current(Dockable dockable)
      Description copied from interface: Mode
      Provides history information about the current state of dockable in respect to this mode.
      Parameters:
      dockable - the element
      Returns:
      history information that is needed when calling Mode.apply(Dockable, Object, AffectedSet)
    • isCurrentMode

      public boolean isCurrentMode(Dockable dockable)
      Description copied from interface: LocationMode
      If this method is not able to clearly find out whether dockable has this mode, it returns false. The LocationModeManager will ask again with the parent station of dockable.
      Parameters:
      dockable - some dockable, not null
      Returns:
      whether dockable is in this mode
    • isDefaultMode

      public boolean isDefaultMode(Dockable dockable)
      Description copied from interface: Mode
      Checks whether this mode is a default mode of dockable. A default mode is a mode that is chosen per default, if no other mode is selected. There should be only one default-mode per Dockable.
      Parameters:
      dockable - some dockable, not null
      Returns:
      whether this is a default mode
    • isRepresenting

      public boolean isRepresenting(DockStation station)
      Description copied from interface: LocationMode
      Tells whether this mode knows station and represents the mode children of station are in.
      Specified by:
      isRepresenting in interface LocationMode
      Overrides:
      isRepresenting in class AbstractLocationMode<M extends MaximizedModeArea>
      Parameters:
      station - the station which is to be tested
      Returns:
      whether this mode is represented by station
    • getUnmaximizedMode

      public LocationMode getUnmaximizedMode(Dockable dockable)
      Assuming dockable is a maximized element, tells which mode would be the preferred mode for unmaximization.
      Parameters:
      dockable - some child
      Returns:
      the preferred unmaximized mode, can be null
    • maximize

      public void maximize(MaximizedModeArea area, Dockable dockable, AffectedSet set)
      Ensures that dockable is maximized.
      Parameters:
      area - the future parent of dockable, can be null
      dockable - the element that should be made maximized
      set - a set of Dockables which will be filled by the elements that change their mode because of this method
    • maximize

      public boolean maximize(MaximizedModeArea area, Dockable dockable, Location history, AffectedSet set)
      Ensures that dockable is maximized.
      Parameters:
      area - the future parent of dockable, can be null
      dockable - the element that should be made maximized
      history - the expected location of dockable after this method has finished, can be null. No guarantees are given that the final location matches history.
      set - a set of Dockables which will be filled by the elements that change their mode because of this method
      Returns:
      whether the operation was a success
    • unmaximize

      public void unmaximize(Dockable dockable, AffectedSet set)
      Ensures that dockable is not maximized. Does nothing if the parent MaximizedModeArea of dockable has not maximized dockable or if the LocationModeManager does not know dockable.
      Parameters:
      dockable - the element that might be maximized currently
      set - a set of Dockables which will be filled by the elements that change their mode because of this method
    • getNextMaximizeArea

      public MaximizedModeArea getNextMaximizeArea(DockStation station)
      Searches the MaximizedModeArea which either represents station or its nearest parent.
      Parameters:
      station - some station
      Returns:
      the nearest area or null
    • unmaximize

      public void unmaximize(DockStation station, AffectedSet affected)
      Ensures that either the MaximizedModeArea station or its nearest parent does not show a maximized element.
      Parameters:
      station - an area or a child of an area
      affected - elements whose mode changes will be added to this set
    • unmaximize

      public void unmaximize(MaximizedModeArea area, AffectedSet affected)
      Ensures that area has no maximized child.
      Parameters:
      area - some area
      affected - the element whose mode might change
    • ensureNotHidden

      public void ensureNotHidden(Dockable dockable)
      Description copied from interface: LocationMode
      Ensures that no Dockable that has this mode hides dockable. Note that dockable may or may not be in this mode.
      Parameters:
      dockable - the element which must not be hidden
    • getMaximizeArea

      public MaximizedModeArea getMaximizeArea(Dockable dockable, Location history)
      Gets the area to which dockable should be maximized. This can be getMaximizeArea(Dockable), or some other station.
      Parameters:
      dockable - the element that is maximized
      history - the history of the last place where dockable was maximized, might be null
      Returns:
      the preferred area to maximize dockable
    • getMaximizeArea

      public MaximizedModeArea getMaximizeArea(Dockable dockable)
      Searches the first MaximizedModeArea which is a parent of dockable. This method will never return dockable itself.
      Parameters:
      dockable - the element whose maximize area is searched
      Returns:
      the area or null
    • getMaximizeArea

      public MaximizedModeArea getMaximizeArea(DockStation station)
      Searches the one MaximizedModeArea whose station is station.
      Parameters:
      station - the station whose area is searched
      Returns:
      the area or null if not found
    • getMaximizingElement

      public Dockable getMaximizingElement(Dockable dockable)
      Gets the element which must be maximized when the user requests that dockable is maximized.
      Parameters:
      dockable - some element, not null
      Returns:
      the element that must be maximized, might be dockable itself, not null
    • getMaximizingElement

      public Dockable getMaximizingElement(Dockable old, Dockable dockable)
      Gets the element which would be maximized if old is currently maximized, and dockable is or will not be maximized.
      Parameters:
      old - some element
      dockable - some element, might be old
      Returns:
      the element which would be maximized if dockable is no longer maximized, can be null
    • applyStarting

      protected void applyStarting(LocationModeEvent event)
    • applyDone

      protected void applyDone(LocationModeEvent event)
    • getSettingFactory

      public ModeSettingFactory<Location> getSettingFactory()
      Description copied from interface: Mode
      Gets a factory for creating new ModeSettings.
      Returns:
      the factory, can be null
    • writeSetting

      public void writeSetting(ModeSetting<Location> setting)
      Description copied from interface: Mode
      Gets the current properties of this mode in an independent way.
      Parameters:
      setting - a ModeSetting with the same id as this Mode. This setting was created by a ModeSettingFactory with the same id as this Mode.
    • readSetting

      public void readSetting(ModeSetting<Location> setting)
      Description copied from interface: Mode
      Sets the properties of this mode. This method will only be called with a ModeSetting that has been created by the current ModeSettingFactory
      Parameters:
      setting - the new set of properties, not null
    • process

      protected boolean process(Dockable dockable, KeyEvent event)
      Invoked whenever a key is pressed, released or typed.
      Parameters:
      dockable - the element to which the event belongs
      event - the event
      Returns:
      true if the event has been processed, false if the event was not used up.
    • switchMode

      public boolean switchMode(Dockable dockable)
      Tries to switch the current mode of dockable to or from the maximized mode.
      Parameters:
      dockable - the element whose mode is to be changed
      Returns:
      whether the operation was successful