Class DockingSplitPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, DockingConstants

public class DockingSplitPane extends JSplitPane implements DockingConstants
Author:
Christopher Butler
See Also:
  • Field Details

    • dockingPort

      protected DockingPort dockingPort
    • region

      protected String region
    • dividerLocDetermined

      protected boolean dividerLocDetermined
    • controllerInTopLeft

      protected boolean controllerInTopLeft
    • initialDividerRatio

      protected double initialDividerRatio
    • percent

      protected double percent
  • Constructor Details

    • DockingSplitPane

      public DockingSplitPane(DockingPort port, String region)
      Creates a new DockingSplitPane for the specified DockingPort with the understanding that the resulting DockingSplitPane will be used for docking a Dockable into the DockingPort's specified region. Neither port or region may be null. region must be a valid docking region as defined by isValidDockingRegion(String region).
      Parameters:
      port - the DockingPort for which this DockingSplitPane is to be created.
      region - the region within the specified DockingPort for which this DockingSplitPane is to be created.
      See Also:
  • Method Details

    • setBounds

      public void setBounds(int x, int y, int w, int h)
      Overrides:
      setBounds in class Component
    • setConstantPercent

      public void setConstantPercent(boolean cstPercent)
    • resetToPreferredSizes

      public void resetToPreferredSizes()
      Overrides:
      resetToPreferredSizes in class JSplitPane
    • setDividerLocation

      public void setDividerLocation(double percent)
      Overrides:
      setDividerLocation in class JSplitPane
    • getPercent

      public double getPercent()
    • isDividerSizeProperlyDetermined

      protected boolean isDividerSizeProperlyDetermined()
    • getElderComponent

      public Component getElderComponent()
      Returns the 'oldest' Component to have been added to this DockingSplitPane as a result of a docking operation. A DockingSplitPane is created based upon the need to share space within a DockingPort between two Dockables. This happens when a new Dockable is introduced into an outer region of a DockingPort that already contains a Dockable. The Dockable that was in the DockingPort prior to splitting the layout is the 'elder' Component and, in many circumstances, may be used to control initial divider location and resize weight.

      If this split pane contains DockingPorts as its child components, then this method will return the Component determined by calling getDockedComponent() for the DockingPort in this split pane's elder region.

      The elder region of this DockingSplitPane is determined using the value returned from getRegion(), where getRegion() indicates the docking region of the 'new' Dockable for this DockingSplitPane.

      Returns:
      the 'oldest' Component to have been added to this DockingSplitPane as a result of a docking operation.
      See Also:
    • getRegion

      public String getRegion()
      Returns the docking region for which this DockingSplitPane was created. A DockingSplitPane is created based upon the need to share space within a DockingPort between two Dockables. This happens when a new Dockable is introduced into an outer region of a DockingPort that already contains a Dockable. This method returns that outer region for which this DockingSplitPane was created and may be used to control the orientation of the split pane. The region returned by this method will be the same passed into the DockingSplitPane constructor on instantiation.
      Returns:
      the docking region for which this DockingSplitPane was created.
      See Also:
    • isElderTopLeft

      public boolean isElderTopLeft()
      Indicates whether the 'oldest' Component to have been added to this DockingSplitPane as a result of a docking operation is in the TOP or LEFT side of the split pane. A DockingSplitPane is created based upon the need to share space within a DockingPort between two Dockables. This happens when a new Dockable is introduced into an outer region of a DockingPort that already contains a Dockable. The Dockable that was in the DockingPort prior to splitting the layout is the 'elder' Component and is returned by getElderComponent(). This method indicates whether or not that Component is in the TOP or LEFT side of this DockingSplitPane.

      The elder region of this DockingSplitPane is determined using the value returned from getRegion(), where getRegion() indicates the docking region of the 'new' Dockable for this DockingSplitPane.

      Returns:
      true if the 'oldest' Component to have been added to this DockingSplitPane is in the TOP or LEFT side of the split pane; false otherwise.
      See Also:
    • doLayout

      public void doLayout()
      Overridden to ensure proper divider location on initial rendering. Sometimes, a split divider location is set as a proportion before the split pane itself has been fully realized in the container hierarchy. This results in a layout calculation based on a proportion of zero width or height, rather than the desired proportion of width or height after the split pane has been fully rendered. This method ensures that default JSplitPane layout behavior is deferred until after the initial dimensions of this split pane have been properly determined.
      Overrides:
      doLayout in class Container
      See Also:
    • cleanup

      public void cleanup()
      Releases any internal references to external objects to aid garbage collection. This method is public and may be invoked manually for proactive memory management. Otherwise, this method is invoked by this DockingSplitPane's finalize() method.
    • setInitialDividerRatio

      public void setInitialDividerRatio(double ratio)
      Sets the initial divider ration for creating split panes. The default value is 0.5.
      Parameters:
      ratio - a ratio for determining weighting between the two sides of a split pane.
      Throws:
      IllegalArgumentException - if ratio is less than 0.0 or greater than 1.0.
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable