Class JideSplitPaneDivider

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible

public class JideSplitPaneDivider extends JPanel implements PropertyChangeListener
Divider used by JideSplitPane.
See Also:
  • Field Details

    • _dragger

      Handles mouse dragging message to do the actual dragging.
    • _dividerSize

      protected int _dividerSize
      Size of the divider.
    • _jideSplitPane

      protected JideSplitPane _jideSplitPane
      JideSplitPane the receiver is contained in.
    • _mouseHandler

      protected JideSplitPaneDivider.MouseHandler _mouseHandler
      Handles mouse events from both this class, and the split pane. Mouse events are handled for the JideSplitPane since you want to be able to drag when clicking on the border of the divider, which is not drawn by the divider.
    • _orientation

      protected int _orientation
      Orientation of the JideSplitPane.
    • COLLAPSED_STATE

      public static final int COLLAPSED_STATE
      Indicates that the pane of the left of this component has been collapse by the one-touch button.
      See Also:
    • DEFAULT_STATE

      public static final int DEFAULT_STATE
      Indicates that this divider has not been expanded or collapsed.
      See Also:
    • EXPANDED_STATE

      public static final int EXPANDED_STATE
      Indicates that the pane of the right of this component has been collapse by the one-touch button. Hence, the pane on the left has been "expanded".
      See Also:
    • _leftButton

      protected JButton _leftButton
      Button for quickly toggling the left component.
    • _rightButton

      protected JButton _rightButton
      Button for quickly toggling the right component.
  • Constructor Details

    • JideSplitPaneDivider

      public JideSplitPaneDivider(JideSplitPane splitPane)
      Creates an instance of BasicJideSplitPaneDivider. Registers this instance for mouse events and mouse dragged events.
      Parameters:
      splitPane - the JideSplitPane.
  • Method Details

    • setDefaultResizeCursor

      public void setDefaultResizeCursor()
    • getJideSplitPane

      public JideSplitPane getJideSplitPane()
      Gets the JideSplitPane.
      Returns:
      the JideSplitPane
    • setJideSplitPane

      public void setJideSplitPane(JideSplitPane splitPane)
      Sets the JideSplitPane that is using this divider.
      Parameters:
      splitPane - the JideSplitPane.
    • createMouseHandler

      protected JideSplitPaneDivider.MouseHandler createMouseHandler()
    • setDividerSize

      public void setDividerSize(int newSize)
      Sets the size of the divider to newSize. That is the width if the split pane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.
      Parameters:
      newSize - the new divider size.
    • getDividerSize

      public int getDividerSize()
      Returns the size of the divider, that is the width if the split pane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.
      Returns:
      the divider size.
    • getPreferredSize

      public Dimension getPreferredSize()
      Returns dividerSize x dividerSize
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Returns dividerSize x dividerSize
      Overrides:
      getMinimumSize in class JComponent
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Property change event, presumably from the JideSplitPane, will message updateOrientation if necessary.
      Specified by:
      propertyChange in interface PropertyChangeListener
    • updateUI

      public void updateUI()
      Resets the UI property to a value from the current look and feel. JComponent subclasses must override this method like this:
         public void updateUI() {
            setUI((SliderUI)UIManager.getUI(this);
         }
        
      Overrides:
      updateUI in class JPanel
      See Also:
    • paintComponent

      public void paintComponent(Graphics g)
      Paints the divider.
      Overrides:
      paintComponent in class JComponent
    • prepareForDragging

      protected void prepareForDragging()
      Message to prepare for dragging. This messages the BasicJideSplitPaneUI with startDragging.
    • dragDividerTo

      protected void dragDividerTo(int location)
    • finishDraggingTo

      protected void finishDraggingTo(int location)
    • getPreviousDividerLocation

      protected int getPreviousDividerLocation(boolean ignoreVisibility, boolean reversed)
    • getNextDividerLocation

      protected int getNextDividerLocation(boolean ignoreVisibility, boolean reversed)
    • getFirstComponent

      public Component getFirstComponent(boolean ignoreVisibility)
      Gets the first component. This divider is installed between two components. The first component is usually the one on the left or on the top.
      Parameters:
      ignoreVisibility - true to not check if the component is visible.
      Returns:
      the first component
    • getSecondComponent

      public Component getSecondComponent(boolean ignoreVisibility)
      Gets the second component. This divider is installed between two components. The second component is usually the one on the right or on the bottom.
      Parameters:
      ignoreVisibility - true to not check if the component is visible.
      Returns:
      the first component
    • oneTouchExpandableChanged

      protected void oneTouchExpandableChanged()
      Invoked when the oneTouchExpandable value of the JideSplitPane changes.

      Responsible for creating the one-touch buttons and revalidating the UI.

      #see JideSplitePane#setOneTouchExpandable(boolean)

    • createLeftOneTouchButton

      protected JButton createLeftOneTouchButton()
      Builds the Button that can be used to collapse the component to the left/above this divider.
      Returns:
      a JButton instance used to collapse the component to the left/above this divider.
    • getCurrentState

      public int getCurrentState()
      Gets the current collapse/expand state.

      The default value is DEFAULT_STATE when JideSplitPane.isOneTouchExpandable() returns false. It could be EXPANDED_STATE or COLLAPSED_STATE when one touch expandable is activated.

      Returns:
      the current state
      Since:
      3.3.8
    • createRightOneTouchButton

      protected JButton createRightOneTouchButton()
      Builds the rightButton that can be used to expand/collapse a split panes divider to the right.
      Returns:
      a JButton instance used to expand/collapse a split panes divider to the right.
    • getDarkShadowColor

      protected Color getDarkShadowColor()
      Returns a dark shadow color. This color is used to paint the left and right buttons graphics. It is based on the current Look and Feel. (And thus fits all look and Feels.)
      Returns:
      UIManager.getColor("controlDkShadow")
    • collapse

      public void collapse()
      Collapses the divider to the left side (or to the top if vertically).
    • expand

      public void expand()
      Expands the divider to the right side (or to the bottom if vertically).