2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Divider used by BasicSplitPaneUI. Subclassers may wish to override 0N/A * paint to do something more interesting. 0N/A * The border effect is drawn in BasicSplitPaneUI, so if you don't like 0N/A * that border, reset it there. 0N/A * To conditionally drag from certain areas subclass mousePressed and 0N/A * call super when you wish the dragging to begin. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @author Scott Violet 0N/A * Width or height of the divider based on orientation 0N/A * BasicSplitPaneUI adds two to this. 0N/A * Handles mouse dragging message to do the actual dragging. 0N/A * UI this instance was created from. 0N/A * Size of the divider. 0N/A * Divider that is used for noncontinuous layout mode. 0N/A * JSplitPane the receiver is contained in. 0N/A * Handles mouse events from both this class, and the split pane. 0N/A * Mouse events are handled for the splitpane since you want to be able 0N/A * to drag when clicking on the border of the divider, which is not 0N/A * drawn by the divider. 0N/A * Orientation of the JSplitPane. 0N/A * Button for quickly toggling the left component. 0N/A * Button for quickly toggling the right component. 0N/A * Is the mouse over the divider? 0N/A * If true the one touch buttons are centered on the divider. 0N/A * Creates an instance of BasicSplitPaneDivider. Registers this 0N/A * instance for mouse events and mouse dragged events. 0N/A ui,
"SplitPane.centerOneTouchButtons",
true);
0N/A * Sets the SplitPaneUI that is using the receiver. 0N/A * Returns the <code>SplitPaneUI</code> the receiver is currently 0N/A * Sets the size of the divider to <code>newSize</code>. That is 0N/A * the width if the splitpane is <code>HORIZONTAL_SPLIT</code>, or 0N/A * the height of <code>VERTICAL_SPLIT</code>. 0N/A * Returns the size of the divider, that is the width if the splitpane 0N/A * is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT. 0N/A * Sets the border of this component. 0N/A * Returns the border of this component or null if no border is 0N/A * @return the border object for this component 0N/A * If a border has been set on this component, returns the 0N/A * border's insets, else calls super.getInsets. 0N/A * @return the value of the insets property. 0N/A * Sets whether or not the mouse is currently over the divider. 0N/A * @param mouseOver whether or not the mouse is currently over the divider 0N/A * Returns whether or not the mouse is currently over the divider 0N/A * @return whether or not the mouse is currently over the divider 0N/A * Returns dividerSize x dividerSize 0N/A // Ideally this would return the size from the layout manager, 0N/A // but that could result in the layed out size being different from 0N/A // the dividerSize, which may break developers as well as 0N/A // BasicSplitPaneUI. 0N/A * Returns dividerSize x dividerSize 0N/A * Property change event, presumably from the JSplitPane, will message 0N/A * updateOrientation if necessary. 0N/A * Paints the divider. 0N/A // Paint the border. 0N/A * Messaged when the oneTouchExpandable value of the JSplitPane the 0N/A * receiver is contained in changes. Will create the 0N/A * <code>leftButton</code> and <code>rightButton</code> if they 0N/A * are null. invalidates the receiver as well. 0N/A "SplitPane.supportsOneTouchButtons",
true)) {
0N/A // Look and feel doesn't want to support one touch buttons, bail. 0N/A /* Create the left button and add an action listener to 0N/A /* Create the right button and add an action listener to 0N/A * Creates and return an instance of JButton that can be used to 0N/A * collapse the left component in the split pane. 0N/A // Fill the background first ... 0N/A // ... then draw the arrow. 0N/A // arrows of equal size 0N/A // Don't want the button to participate in focus traversable. 0N/A * Creates and return an instance of JButton that can be used to 0N/A * collapse the right component in the split pane. 0N/A // Fill the background first ... 0N/A // ... then draw the arrow. 0N/A // Don't want the button to participate in focus traversable. 0N/A * Message to prepare for dragging. This messages the BasicSplitPaneUI 0N/A * with startDragging. 0N/A * Messages the BasicSplitPaneUI with dragDividerTo that this instance 0N/A * Messages the BasicSplitPaneUI with finishDraggingTo that this instance 0N/A * MouseHandler is responsible for converting mouse events 0N/A * (released, dragged...) into the appropriate DragController 0N/A * Starts the dragging session by creating the appropriate instance 0N/A * of DragController. 0N/A * If dragger is not null it is messaged with completeDrag. 0N/A // MouseMotionListener 0N/A * If dragger is not null it is messaged with continueDrag. 0N/A * Resets the cursor based on the orientation. 0N/A * Invoked when the mouse enters a component. 0N/A * @param e MouseEvent describing the details of the enter event. 0N/A * Invoked when the mouse exits a component. 0N/A * @param e MouseEvent describing the details of the exit event. 0N/A * Handles the events during a dragging session for a 0N/A * HORIZONTAL_SPLIT oriented split pane. This continually 0N/A * messages <code>dragDividerTo</code> and then when done messages 0N/A * <code>finishDraggingTo</code>. When an instance is created it should be 0N/A * messaged with <code>isValid</code> to insure that dragging can happen 0N/A * (dragging won't be allowed if the two views can not be resized). 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * Initial location of the divider. 0N/A * Maximum and minimum positions to drag to. 0N/A * Initial location the mouse down happened at. 0N/A // Don't allow dragging. 0N/A * Returns true if the dragging session is valid. 0N/A * Returns the new position to put the divider at based on 0N/A * the passed in MouseEvent. 0N/A * Returns the x argument, since this is used for horizontal 0N/A * Messages dragDividerTo with the new location for the mouse 0N/A * Messages finishDraggingTo with the new location for the mouse 0N/A }
// End of BasicSplitPaneDivider.DragController 0N/A * Handles the events during a dragging session for a 0N/A * VERTICAL_SPLIT oriented split pane. This continually 0N/A * messages <code>dragDividerTo</code> and then when done messages 0N/A * <code>finishDraggingTo</code>. When an instance is created it should be 0N/A * messaged with <code>isValid</code> to insure that dragging can happen 0N/A * (dragging won't be allowed if the two views can not be resized). 0N/A /* DragControllers ivars are now in terms of y, not x. */ 0N/A // Don't allow dragging. 0N/A * Returns the y argument, since this is used for vertical 0N/A * Returns the new position to put the divider at based on 0N/A * the passed in MouseEvent. 0N/A }
// End of BasicSplitPaneDividier.VerticalDragController 0N/A * Used to layout a <code>BasicSplitPaneDivider</code>. 0N/A * Layout for the divider 0N/A * involves appropriately moving the left/right buttons around. 0N/A // NOTE: This isn't really used, refer to 0N/A // BasicSplitPaneDivider.getPreferredSize for the reason. 0N/A // I leave it in hopes of having this used at some point. 0N/A }
// End of class BasicSplitPaneDivider.DividerLayout 0N/A * Listeners installed on the one touch expandable buttons. 0N/A /** True indicates the resize should go the minimum (top or left) 0N/A * vs false which indicates the resize should go to the maximum. 0N/A // We use the location from the UI directly, as the location the 0N/A // JSplitPane itself maintains is not necessarly correct. 0N/A // We do this in case the dividers notion of the location 0N/A // differs from the real location. 0N/A }
// End of class BasicSplitPaneDivider.LeftActionListener