Package com.jidesoft.swing
Class JideSplitPaneDivider
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- com.jidesoft.swing.JideSplitPaneDivider
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible
public class JideSplitPaneDivider extends javax.swing.JPanel implements java.beans.PropertyChangeListenerDivider used by JideSplitPane.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJideSplitPaneDivider.DragControllerHandles the events during a dragging session for a HORIZONTAL_SPLIT oriented split pane.protected classJideSplitPaneDivider.MouseHandlerMouseHandler is responsible for converting mouse events (released, dragged...) into the appropriate DragController methods.protected classJideSplitPaneDivider.OneTouchActionHandlerThe actionListener that will listen for button presses on either the leftButton or the rightButton.protected classJideSplitPaneDivider.VerticalDragControllerHandles the events during a dragging session for a VERTICAL_SPLIT oriented split pane.-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected int_dividerSizeSize of the divider.protected JideSplitPaneDivider.DragController_draggerHandles mouse dragging message to do the actual dragging.protected JideSplitPane_jideSplitPaneJideSplitPane the receiver is contained in.protected javax.swing.JButton_leftButtonButton for quickly toggling the left component.protected JideSplitPaneDivider.MouseHandler_mouseHandlerHandles mouse events from both this class, and the split pane.protected int_orientationOrientation of the JideSplitPane.protected javax.swing.JButton_rightButtonButton for quickly toggling the right component.static intCOLLAPSED_STATEIndicates that the pane of the left of this component has been collapse by the one-touch button.static intDEFAULT_STATEIndicates that this divider has not been expanded or collapsed.static intEXPANDED_STATEIndicates that the pane of the right of this component has been collapse by the one-touch button.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description JideSplitPaneDivider(JideSplitPane splitPane)Creates an instance of BasicJideSplitPaneDivider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollapse()Collapses the divider to the left side (or to the top if vertically).protected javax.swing.JButtoncreateLeftOneTouchButton()Builds the Button that can be used to collapse the component to the left/above this divider.protected JideSplitPaneDivider.MouseHandlercreateMouseHandler()protected javax.swing.JButtoncreateRightOneTouchButton()Builds the rightButton that can be used to expand/collapse a split panes divider to the right.protected voiddragDividerTo(int location)voidexpand()Expands the divider to the right side (or to the bottom if vertically).protected voidfinishDraggingTo(int location)intgetCurrentState()Gets the current collapse/expand state.protected java.awt.ColorgetDarkShadowColor()Returns a dark shadow color.intgetDividerSize()Returns the size of the divider, that is the width if the split pane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.java.awt.ComponentgetFirstComponent(boolean ignoreVisibility)Gets the first component.JideSplitPanegetJideSplitPane()Gets theJideSplitPane.java.awt.DimensiongetMinimumSize()Returns dividerSize x dividerSizeprotected intgetNextDividerLocation(boolean ignoreVisibility, boolean reversed)java.awt.DimensiongetPreferredSize()Returns dividerSize x dividerSizeprotected intgetPreviousDividerLocation(boolean ignoreVisibility, boolean reversed)java.awt.ComponentgetSecondComponent(boolean ignoreVisibility)Gets the second component.protected voidoneTouchExpandableChanged()Invoked when the oneTouchExpandable value of the JideSplitPane changes.voidpaintComponent(java.awt.Graphics g)Paints the divider.protected voidprepareForDragging()Message to prepare for dragging.voidpropertyChange(java.beans.PropertyChangeEvent e)Property change event, presumably from the JideSplitPane, will message updateOrientation if necessary.voidsetDefaultResizeCursor()voidsetDividerSize(int newSize)Sets the size of the divider tonewSize.voidsetJideSplitPane(JideSplitPane splitPane)Sets the JideSplitPane that is using this divider.voidupdateUI()Resets the UI property to a value from the current look and feel.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
_dragger
protected JideSplitPaneDivider.DragController _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:
- Constant Field Values
-
DEFAULT_STATE
public static final int DEFAULT_STATE
Indicates that this divider has not been expanded or collapsed.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
_leftButton
protected javax.swing.JButton _leftButton
Button for quickly toggling the left component.
-
_rightButton
protected javax.swing.JButton _rightButton
Button for quickly toggling the right component.
-
-
Constructor Detail
-
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 Detail
-
setDefaultResizeCursor
public void setDefaultResizeCursor()
-
getJideSplitPane
public JideSplitPane getJideSplitPane()
Gets theJideSplitPane.- 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 tonewSize. That is the width if the split pane isHORIZONTAL_SPLIT, or the height ofVERTICAL_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 java.awt.Dimension getPreferredSize()
Returns dividerSize x dividerSize- Overrides:
getPreferredSizein classjavax.swing.JComponent
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns dividerSize x dividerSize- Overrides:
getMinimumSizein classjavax.swing.JComponent
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Property change event, presumably from the JideSplitPane, will message updateOrientation if necessary.- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
updateUI
public void updateUI()
Resets the UI property to a value from the current look and feel.JComponentsubclasses must override this method like this:public void updateUI() { setUI((SliderUI)UIManager.getUI(this); }- Overrides:
updateUIin classjavax.swing.JPanel- See Also:
JPanel.setUI(javax.swing.plaf.PanelUI),UIManager.getLookAndFeel(),UIManager.getUI(javax.swing.JComponent)
-
paintComponent
public void paintComponent(java.awt.Graphics g)
Paints the divider.- Overrides:
paintComponentin classjavax.swing.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 java.awt.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 java.awt.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 javax.swing.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 whenJideSplitPane.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 javax.swing.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 java.awt.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).
-
-