/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The basic L&F for a hierarchical data structure.
* <p>
*
* @author Scott Violet
* @author Shannon Hickey (drag and drop)
*/
{
new StringBuilder("Tree.baselineComponent");
// Old actions forward to an instance of this.
/**
* Color used to draw hash marks. If <code>null</code> no hash marks
* will be drawn.
*/
/** Distance between left margin and where vertical dashes will be
* drawn. */
protected int leftChildIndent;
/** Distance to add to leftChildIndent to determine where cell
* contents will be drawn. */
protected int rightChildIndent;
/** Total distance that will be indented. The sum of leftChildIndent
* and rightChildIndent. */
protected int totalChildIndent;
/** Minimum preferred size. */
/** Index of the row that was last selected. */
protected int lastSelectedRow;
/** Component that we're going to be drawing into. */
/** Renderer that is being used to do the actual cell drawing. */
/** Set to true if the renderer that is currently in the tree was
* created by this instance. */
protected boolean createdRenderer;
/** Editor for the tree. */
/** Set to true if editor that is currently in the tree was
* created by this instance. */
protected boolean createdCellEditor;
/** Set to false when editing and shouldSelectCell() returns true meaning
* the node should be selected before editing, used in completeEditing. */
protected boolean stopEditingInCompleteEditing;
/** Used to paint the TreeCellRenderer. */
/** Size needed to completely display all the nodes. */
/** Is the preferredSize valid? */
protected boolean validCachedPreferredSize;
/** Object responsible for handling sizing and expanded issues. */
// WARNING: Be careful with the bounds held by treeState. They are
// always in terms of left-to-right. They get mapped to right-to-left
// by the various methods of this class.
/** Used for minimizing the drawing of vertical lines. */
/** True if doing optimizations for a largeModel. Subclasses that
* don't support this may wish to override createLayoutCache to not
* return a FixedHeightLayoutCache instance. */
protected boolean largeModel;
/** Reponsible for telling the TreeState the size needed for a node. */
/** Used to determine what to display. */
/** Model maintaing the selection. */
/** How much the depth should be offset to properly calculate
* x locations. This is based on whether or not the root is visible,
* and if the root handles are visible. */
protected int depthOffset;
// Following 4 ivars are only valid when editing.
/** When editing, this will be the Component that is doing the actual
* editing. */
/** Path that is being edited. */
/** Row that is being edited. Should only be referenced if
* editingComponent is not null. */
protected int editingRow;
/** Set to true if the editor has a different size than the renderer. */
protected boolean editorHasDifferentSize;
/** Row correspondin to lead path. */
private int leadRow;
/** If true, the property change event for LEAD_SELECTION_PATH_PROPERTY,
* or ANCHOR_SELECTION_PATH_PROPERTY will not generate a repaint. */
private boolean ignoreLAChange;
/** Indicates the orientation. */
private boolean leftToRight;
// Cached listeners
* updates the validCachedPreferredSize bit accordingly. */
/** Listens for CellEditor events. */
/** Updates the display when the selection changes. */
/** Is responsible for updating the display based on model events. */
/** Updates the treestate as the nodes expand. */
/** UI property indicating whether to paint lines */
private boolean paintLines = true;
/** UI property for painting dashed lines */
private boolean lineTypeDashed;
/**
* The time factor to treate the series of typed alphanumeric key
* as prefix for first letter navigation.
*/
/**
* A temporary variable for communication between startEditingOnRelease
* and startEditing.
*/
return new BasicTreeUI();
}
}
public BasicTreeUI() {
super();
}
return hashColor;
}
}
updateSize();
}
public int getLeftChildIndent() {
return leftChildIndent;
}
updateSize();
}
public int getRightChildIndent() {
return rightChildIndent;
}
expandedIcon = newG;
}
return expandedIcon;
}
}
return collapsedIcon;
}
//
// Methods for configuring the behavior of the tree. None of them
// push the value to the JTree instance. You should really only
// call these methods on the JTree.
//
/**
* Updates the componentListener, if necessary.
*/
if(getRowHeight() < 1)
largeModel = false;
if(this.largeModel != largeModel) {
this.largeModel = largeModel;
updateSize();
}
}
protected boolean isLargeModel() {
return largeModel;
}
/**
* Sets the row height, this is forwarded to the treeState.
*/
updateSize();
}
}
protected int getRowHeight() {
}
/**
* Sets the TreeCellRenderer to <code>tcr</code>. This invokes
* <code>updateRenderer</code>.
*/
updateSize();
}
}
/**
* Return currentCellRenderer, which will either be the trees
* renderer, or defaultCellRenderer, which ever wasn't null.
*/
return currentCellRenderer;
}
/**
* Sets the TreeModel.
*/
if(treeModelListener != null)
}
updateSize();
}
}
return treeModel;
}
/**
* Sets the root to being visible.
*/
updateSize();
}
}
protected boolean isRootVisible() {
}
/**
* Determines whether the node handles are to be displayed.
*/
updateSize();
}
}
protected boolean getShowsRootHandles() {
}
/**
* Sets the cell editor.
*/
}
}
/**
* Configures the receiver to allow, or not allow, editing.
*/
}
protected boolean isEditable() {
}
/**
* Resets the selection model. The appropriate listener are installed
* on the model.
*/
if(selectionModelPropertyChangeListener != null &&
if(treeSelectionModel != null) {
if(treeSelectionListener != null)
}
}
return treeSelectionModel;
}
//
// TreeUI methods
//
/**
* Returns the Rectangle enclosing the label portion that the
* last item in path will be drawn into. Will return null if
* any component in path is currently valid.
*/
}
return null;
}
if (leftToRight) {
} else {
}
}
return bounds;
}
/**
* Returns the path for passed in row. If row is not visible
* null is returned.
*/
}
/**
* Returns the row that the last item identified in path is visible
* at. Will return -1 if any of the elements in path are not
* currently visible.
*/
}
/**
* Returns the number of rows that are being displayed.
*/
}
/**
* Returns the path to the node that is closest to x,y. If
* there is nothing currently visible this will return null, otherwise
* it'll always return a valid path. If you need to test if the
* returned object is exactly at x, y you should get the bounds for
* the returned path and test x, y against that.
*/
// TreeState doesn't care about the x location, hence it isn't
// adjusted
return treeState.getPathClosestTo(x, y);
}
return null;
}
/**
* Returns true if the tree is being edited. The item that is being
* edited can be returned by getEditingPath().
*/
return (editingComponent != null);
}
/**
* Stops the current editing session. This has no effect if the
* tree isn't being edited. Returns true if the editor allows the
* editing session to stop.
*/
completeEditing(false, false, true);
return true;
}
return false;
}
/**
* Cancels the current editing session.
*/
if(editingComponent != null) {
completeEditing(false, true, false);
}
}
/**
* Selects the last item in path and tries to edit it. Editing will
* fail if the CellEditor won't allow it for the selected item.
*/
}
/**
* Returns the path to the element that is being edited.
*/
return editingPath;
}
//
// Install methods
//
if ( c == null ) {
throw new NullPointerException( "null component passed to BasicTreeUI.installUI()" );
}
// Boilerplate install block
}
/**
* Invoked after the <code>tree</code> instance variable has been
*/
protected void prepareForUIInstall() {
// Data member initializations
stopEditingInCompleteEditing = true;
lastSelectedRow = -1;
leadRow = -1;
preferredSize = new Dimension();
if(getRowHeight() <= 0)
largeModel = false;
}
/**
* installed.
*/
protected void completeUIInstall() {
// Custom install code
// Create, if necessary, the TreeState instance.
updateSize();
}
protected void installDefaults() {
}
}
// JTree's original row height is 16. To correctly display the
// contents on Linux we should have set it to 18, Windows 19 and
// Solaris 20. As these values vary so much it's too hard to
// be backward compatable and try to update the row height, we're
// therefor NOT going to adjust the row height based on font. If the
// developer changes the font, it's there responsibility to update
// the row height.
intValue());
intValue());
if (scrollsOnExpand != null) {
}
if (showsRootHandles != null) {
}
}
protected void installListeners() {
!= null ) {
}
if (mouseListener instanceof MouseMotionListener) {
}
}
}
}
}
}
treeSelectionModel != null) {
}
treeSelectionModel != null) {
}
// default TransferHandler doesn't support drop
// so we don't want drop handling
}
}
}
protected void installKeyboardActions() {
km);
"Tree.actionMap");
}
"Tree.ancestorInputMap");
}
"Tree.focusInputMap");
"Tree.focusInputMap.RightToLeft")) == null)) {
return keyMap;
} else {
return rtlKeyMap;
}
}
return null;
}
/**
* Intalls the subcomponents of the tree, which is the renderer pane.
*/
protected void installComponents() {
}
}
//
// Create methods.
//
/**
* Creates an instance of NodeDimensions that is able to determine
* the size of a given node in the tree.
*/
return new NodeDimensionsHandler();
}
/**
* Creates a listener that is responsible that updates the UI based on
* how the tree changes.
*/
return getHandler();
}
}
return handler;
}
/**
* Creates the listener responsible for updating the selection based on
* mouse events.
*/
return getHandler();
}
/**
* Creates a listener that is responsible for updating the display
*/
return getHandler();
}
/**
* Creates the listener reponsible for getting key events from
* the tree.
*/
return getHandler();
}
/**
* Creates the listener responsible for getting property change
* events from the selection model.
*/
return getHandler();
}
/**
* Creates the listener that updates the display based on selection change
* methods.
*/
return getHandler();
}
/**
* Creates a listener to handle events from the current editor.
*/
return getHandler();
}
/**
* Creates and returns a new ComponentHandler. This is used for
* the large model to mark the validCachedPreferredSize as invalid
* when the component moves.
*/
return new ComponentHandler();
}
/**
* Creates and returns the object responsible for updating the treestate
* when nodes expanded state changes.
*/
return getHandler();
}
/**
* Creates the object responsible for managing what is expanded, as
* well as the size of nodes.
*/
return new FixedHeightLayoutCache();
}
return new VariableHeightLayoutCache();
}
/**
* Returns the renderer pane that renderer components are placed in.
*/
return new CellRendererPane();
}
/**
* Creates a default cell editor.
*/
if(currentCellRenderer != null &&
(currentCellRenderer instanceof DefaultTreeCellRenderer)) {
return editor;
}
}
/**
* Returns the default cell renderer that is used to do the
* stamping of each node.
*/
return new DefaultTreeCellRenderer();
}
/**
* Returns a listener that can update the tree when the model changes.
*/
return getHandler();
}
//
// Uninstall methods
//
}
protected void prepareForUIUninstall() {
}
protected void completeUIUninstall() {
if(createdRenderer) {
}
if(createdCellEditor) {
}
cellEditor = null;
rendererPane = null;
keyListener = null;
drawingCache = null;
}
protected void uninstallDefaults() {
}
}
protected void uninstallListeners() {
if(componentListener != null) {
}
if (propertyChangeListener != null) {
}
if (mouseListener != null) {
if (mouseListener instanceof MouseMotionListener) {
}
}
if (focusListener != null) {
}
if (keyListener != null) {
}
if(treeExpansionListener != null) {
}
}
if(selectionModelPropertyChangeListener != null &&
treeSelectionModel != null) {
}
}
}
protected void uninstallKeyboardActions() {
null);
}
/**
* Uninstalls the renderer pane.
*/
protected void uninstallComponents() {
if(rendererPane != null) {
}
}
/**
* Recomputes the right margin, and invalidates any tree states
*/
private void redoTheLayout() {
}
}
/**
* Returns the baseline.
*
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
}
int baseline;
if (rowHeight > 0) {
}
else {
}
}
/**
* Returns an enum indicating how the baseline of the component
* changes as the size changes.
*
* @throws NullPointerException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
JComponent c) {
super.getBaselineResizeBehavior(c);
}
//
// Painting routines.
//
if (tree != c) {
throw new InternalError("incorrect component");
}
// Should never happen if installed for a UI
return;
}
(initialPath);
// Draw the lines, knobs, and rows
// Find each parent and have them draw a line to their last child
while(parentPath != null) {
}
boolean done = false;
// Information for the node being rendered.
boolean isExpanded;
boolean hasBeenExpanded;
boolean isLeaf;
boolean rootVisible = isRootVisible();
if(isLeaf)
isExpanded = hasBeenExpanded = false;
else {
}
// This will only happen if the model changes out
// from under us (usually in another thread).
// Swing isn't multithreaded, but I'll put this
// check in anyway.
return;
// See if the vertical line to the parent has been drawn.
if(parentPath != null) {
insets, parentPath);
}
}
}
hasBeenExpanded, isLeaf)) {
}
done = true;
}
else {
done = true;
}
row++;
}
}
paintDropLine(g);
// Empty out the renderer pane, allowing renderers to be gc'ed.
}
/**
* Tells if a {@code DropLocation} should be indicated by a line between
* nodes. This is meant for {@code javax.swing.DropMode.INSERT} and
* {@code javax.swing.DropMode.ON_OR_INSERT} drop modes.
*
* @param loc a {@code DropLocation}
* @return {@code true} if the drop location should be shown as a line
* @since 1.7
*/
}
/**
* Paints the drop line.
*
* @param g {@code Graphics} object to draw on
* @since 1.7
*/
if (!isDropLine(loc)) {
return;
}
if (c != null) {
g.setColor(c);
}
}
/**
* Returns a ubounding box for the drop line.
*
* @param loc a {@code DropLocation}
* @return bounding box for the drop line
* @since 1.7
*/
boolean ltr = leftToRight;
0);
} else {
if (!tree.isRootVisible()) {
xRect.x += totalChildIndent;
} else {
}
} else {
}
}
if (rect.y != 0) {
rect.y--;
}
if (!ltr) {
}
return rect;
}
/**
* Paints the horizontal part of the leg. The receiver should
* NOT modify <code>clipBounds</code>, or <code>insets</code>.<p>
* NOTE: <code>parentRow</code> can be -1 if the root is not visible.
*/
boolean isExpanded,
boolean hasBeenExpanded, boolean
isLeaf) {
if (!paintLines) {
return;
}
// Don't paint the legs for the root'ish node if the
!getShowsRootHandles()) {
return;
}
int clipLeft = clipBounds.x;
int clipTop = clipBounds.y;
if (leftToRight) {
&& lineY < clipBottom
g.setColor(getHashColor());
}
} else {
&& lineY < clipBottom
g.setColor(getHashColor());
}
}
}
/**
* Paints the vertical part of the leg. The receiver should
* NOT modify <code>clipBounds</code>, <code>insets</code>.<p>
*/
if (!paintLines) {
return;
}
return;
}
if (leftToRight) {
}
else {
getRightChildIndent() - 1;
}
int clipLeft = clipBounds.x;
int clipTop = clipBounds.y;
if(lastChildBounds == null)
// This shouldn't happen, but if the model is modified
// in another thread it is possible for this to happen.
// Swing isn't multithreaded, but I'll add this check in
// anyway.
return;
int top;
if(parentBounds == null) {
clipTop);
}
else
if(parentBounds != null)
parentBounds.y +
}
}
}
g.setColor(getHashColor());
}
}
}
/**
* Paints the expand (toggle) part of a row. The receiver should
* NOT modify <code>clipBounds</code>, or <code>insets</code>.
*/
int row, boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf) {
// Draw icons if not a leaf and either hasn't been loaded,
// or the model child count is > 0.
if (!isLeaf && (!hasBeenExpanded ||
int middleXOfKnob;
if (leftToRight) {
} else {
}
if (isExpanded) {
if(expandedIcon != null)
}
else {
if(collapsedIcon != null)
}
}
}
/**
* Paints the renderer part of a row. The receiver should
* NOT modify <code>clipBounds</code>, or <code>insets</code>.
*/
int row, boolean isExpanded,
boolean hasBeenExpanded, boolean isLeaf) {
// Don't paint the renderer if editing this row.
return;
int leadIndex;
}
else
leadIndex = -1;
}
/**
* Returns true if the expand (toggle) control should be drawn for
* the specified row.
*/
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf) {
if(isLeaf)
return false;
return false;
return true;
}
/**
* Paints a vertical line.
*/
int bottom) {
if (lineTypeDashed) {
} else {
}
}
/**
* Paints a horizontal line.
*/
if (lineTypeDashed) {
} else {
}
}
/**
* The vertical element of legs between nodes starts at the bottom of the
* parent node by default. This method makes the leg start below that.
*/
protected int getVerticalLegBuffer() {
return 0;
}
/**
* The horizontal element of legs between nodes starts at the
* right of the left-hand side of the child node by default. This
* method makes the leg end before that.
*/
protected int getHorizontalLegBuffer() {
return 0;
}
return leftToRight
}
//
// Generic painting methods
//
// Draws the icon centered at (x,y)
int x, int y) {
}
// This method is slow -- revisit when Java2D is ready.
// assumes x1 <= x2
// Drawing only even coordinates helps join line segments so they
// appear as one line. This can be defeated by translating the
// Graphics by an odd amount.
g.drawLine(x, y, x, y);
}
}
// This method is slow -- revisit when Java2D is ready.
// assumes y1 <= y2
// Drawing only even coordinates helps join line segments so they
// appear as one line. This can be defeated by translating the
// Graphics by an odd amount.
g.drawLine(x, y, x, y);
}
}
//
// Various local methods
//
/**
* Returns the location, along the x-axis, to render a particular row
* at. The return value does not include any Insets specified on the JTree.
* This does not check for the validity of the row or depth, it is assumed
* to be correct and will not throw an Exception if the row or depth
* doesn't match that of the tree.
*
* @param row Row to return x location for
* @param depth Depth of the row
* @return amount to indent the given row.
* @since 1.5
*/
}
/**
* Makes all the nodes that are expanded in JTree expanded in LayoutCache.
* This invokes updateExpandedDescendants with the root path.
*/
protected void updateLayoutCacheExpandedNodes() {
}
private void updateLayoutCacheExpandedNodesIfNecessary() {
} else {
}
}
}
/**
* Updates the expanded state of all the descendants of <code>path</code>
* by getting the expanded descendants from the tree and forwarding
* to the tree state.
*/
if(descendants != null) {
while(descendants.hasMoreElements()) {
}
}
updateSize();
}
}
/**
* Returns a path to the last child of <code>parent</code>.
*/
if(childCount > 0)
}
return null;
}
/**
* Updates how much each depth should be offset by.
*/
protected void updateDepthOffset() {
if(isRootVisible()) {
if(getShowsRootHandles())
depthOffset = 1;
else
depthOffset = 0;
}
else if(!getShowsRootHandles())
depthOffset = -1;
else
depthOffset = 0;
}
/**
* Updates the cellEditor based on the editability of the JTree that
* we're contained in. If the tree is editable but doesn't have a
* cellEditor, a basic one will be used.
*/
protected void updateCellEditor() {
else {
if(tree.isEditable()) {
createdCellEditor = true;
}
}
}
else
}
if(newEditor != cellEditor) {
if(cellEditorListener == null)
createdCellEditor = false;
}
}
/**
* Messaged from the tree we're in when the renderer has changed.
*/
protected void updateRenderer() {
if(newCellRenderer == null) {
createdRenderer = true;
}
else {
createdRenderer = false;
if(createdCellEditor) {
}
}
}
else {
createdRenderer = false;
}
}
/**
* Resets the TreeState instance based on the tree we're providing the
* look and feel for.
*/
protected void configureLayoutCache() {
if(nodeDimensions == null)
// Only do this if necessary, may loss state if call with
// same model as it currently has.
// Create a listener to update preferred size when bounds
// changes, if necessary.
if(isLargeModel()) {
if(componentListener == null) {
if(componentListener != null)
}
}
else if(componentListener != null) {
}
}
else if(componentListener != null) {
}
}
/**
* Marks the cached size as being invalid, and messages the
* tree with <code>treeDidChange</code>.
*/
protected void updateSize() {
validCachedPreferredSize = false;
}
private void updateSize0() {
validCachedPreferredSize = false;
tree.revalidate();
}
/**
* Updates the <code>preferredSize</code> instance variable,
* which is returned from <code>getPreferredSize()</code>.<p>
* For left to right orientations, the size is determined from the
* current AbstractLayoutCache. For RTL orientations, the preferred size
* becomes the width minus the minimum x position.
*/
protected void updateCachedPreferredSize() {
if(isLargeModel()) {
// The tree doesn't have a valid bounds yet. Calculate
// based on visible row count.
} else {
}
// we should consider a non-visible area above
if (component instanceof JScrollPane) {
}
}
}
}
else {
}
}
validCachedPreferredSize = true;
}
/**
* Messaged from the VisibleTreeNode after it has been expanded.
*/
}
}
/**
* Messaged from the VisibleTreeNode after it has collapsed.
*/
}
}
/**
* Ensures that the rows identified by beginRow through endRow are
* visible.
*/
"Tree.scrollsHorizontallyAndVertically", false);
if(scrollBounds != null) {
if (!scrollVert) {
}
}
}
else {
return;
}
}
beginY));
}
}
}
}
/** Sets the preferred minimum size.
*/
}
/** Returns the minimum preferred size.
*/
if(preferredMinSize == null)
return null;
return new Dimension(preferredMinSize);
}
/** Returns the preferred size to properly display the tree,
* this is a cover method for getPreferredSize(c, true).
*/
return getPreferredSize(c, true);
}
/** Returns the preferred size to represent the tree in
* <I>c</I>. If <I>checkConsistency</I> is true
* <b>checkConsistency</b> is messaged first.
*/
boolean checkConsistency) {
}
return pSize;
else
}
/**
* Returns the minimum size for this component. Which will be
* the min preferred size or 0, 0.
*/
if(this.getPreferredMinSize() != null)
return this.getPreferredMinSize();
}
/**
* Returns the maximum size for this component, which will be the
* preferred size if the instance is currently in a JTree, or 0, 0.
*/
return getPreferredSize(tree);
if(this.getPreferredMinSize() != null)
return this.getPreferredMinSize();
}
/**
* Messages to stop the editing session. If the UI the receiver
* is providing the look and feel for returns true from
* <code>getInvokesStopCellEditing</code>, stopCellEditing will
* invoked on the current editor. Then completeEditing will
* be messaged with false, true, false to cancel any lingering
* editing.
*/
protected void completeEditing() {
/* If should invoke stopCellEditing, try that */
if(tree.getInvokesStopCellEditing() &&
}
/* Invoke cancelCellEditing, this will do nothing if stopCellEditing
was successful. */
completeEditing(false, true, false);
}
/**
* Stops the editing session. If messageStop is true the editor
* is messaged with stopEditing, if messageCancel is true the
* editor is messaged with cancelEditing. If messageTree is true
* the treeModel is messaged with valueForPathChanged.
*/
boolean messageCancel,
boolean messageTree) {
editingPath = null;
if(messageStop)
else if(messageCancel)
if(editorHasDifferentSize) {
updateSize();
}
else if (editingBounds != null) {
editingBounds.x = 0;
}
if(requestFocus)
tree.requestFocus();
if(messageTree)
}
}
// cover method for startEditing that allows us to pass extra
// information into that method via a class variable
this.releaseEvent = releaseEvent;
try {
} finally {
this.releaseEvent = null;
}
}
/**
* Will start editing for node if there is a cellEditor and
* shouldSelectCell returns true.<p>
* This assumes that path is valid and visible.
*/
!stopEditing(tree)) {
return false;
}
if (nodeBounds == null) {
return false;
}
editingRow = row;
// Only allow odd heights if explicitly set.
getRowHeight() > 0)
// Editor wants different width or height, invalidate
// treeState and relayout.
editorHasDifferentSize = true;
updateSize();
// To make sure x/y are updated correctly, fetch
// the bounds again.
if (nodeBounds == null) {
return false;
}
}
else
editorHasDifferentSize = false;
editingPath = path;
if (editingComponent instanceof JComponent) {
} else {
}
stopEditingInCompleteEditing = false;
stopEditingInCompleteEditing = true;
}
boolean selectAll = true;
/* Find the component that will get forwarded all the
mouse events until mouseReleased. */
/* Create an instance of BasicTreeMouseListener to handle
component. */
// We really want similar behavior to getMouseEventTarget,
// but it is package private.
componentPoint.x, componentPoint.y);
if (activeComponent != null) {
if (releaseEvent != null) {
}
selectAll = false;
}
}
}
return true;
}
else
}
return false;
}
//
// Following are primarily for handling mouse events.
//
/**
* If the <code>mouseX</code> and <code>mouseY</code> are in the
* the row.
*/
}
}
/**
* Returns true if <code>mouseX</code> and <code>mouseY</code> fall
* the node at <code>row</code> does not represent a leaf.
*/
int boxWidth;
if(getExpandedIcon() != null)
else
boxWidth = 8;
if (leftToRight) {
} else {
}
}
return false;
}
/**
* Messaged when the user clicks the particular row, this invokes
* toggleExpandState.
*/
int mouseY) {
}
/**
* Expands path if it is not expanded, or collapses row if it is expanded.
* If expanding a path and JTree scrolls on expand, ensureRowsAreVisible
* is invoked to scroll as many of the children to visible as possible
* (tries to scroll to last visible descendant of path).
*/
updateSize();
if(row != -1) {
if(tree.getScrollsOnExpand())
else
}
}
else {
updateSize();
}
}
/**
* Returning true signifies a mouse event on the node should toggle
* the selection of only the row under mouse.
*/
}
/**
* Returning true signifies a mouse event on the node should select
* from the anchor point.
*/
event.isShiftDown());
}
/**
* Returning true indicates the row under the mouse should be toggled
* based on the event. This is invoked after checkForClickInExpandControl,
* implying the location is not in the expand (toggle) control
*/
return false;
}
if(clickCount <= 0) {
return false;
}
}
/**
* Messaged to update the selection based on a MouseEvent over a
* particular row. If the event is a toggle selection event, the
* row is either selected, or deselected. If the event identifies
* a multi selection event, the selection is updated from the
* anchor point. Otherwise the row is selected, and if the event
*/
/* Adjust from the anchor point. */
if(isMultiSelectEvent(event)) {
}
else {
if (isToggleSelectionEvent(event)) {
} else {
}
} else {
}
}
}
// Should this event toggle the selection of this row?
/* Control toggles just this node. */
else if(isToggleSelectionEvent(event)) {
else
}
/* Otherwise set the selection to just this interval. */
if(isToggleEvent(event)) {
}
}
}
/**
* @return true if the node at <code>row</code> is a leaf.
*/
// Have to return something here...
return true;
}
//
// methods in JTree.
//
ignoreLAChange = true;
try {
} finally{
ignoreLAChange = false;
}
}
return tree.getAnchorSelectionPath();
}
setLeadSelectionPath(newPath, false);
}
ignoreLAChange = true;
try {
} finally {
ignoreLAChange = false;
}
if (repaint) {
}
}
}
}
bounds.x = 0;
}
return bounds;
}
return tree.getLeadSelectionPath();
}
/**
* Updates the lead row of the selection.
* @since 1.7
*/
protected void updateLeadSelectionRow() {
}
/**
* Returns the lead row of the selection.
*
* @return selection lead row
* @since 1.7
*/
protected int getLeadSelectionRow() {
return leadRow;
}
/**
* Extends the selection from the anchor to make <code>newLead</code>
* the lead of the selection. This does not scroll.
*/
if(aRow == -1) {
}
else {
}
else {
}
}
}
/**
* Invokes <code>repaint</code> on the JTree for the passed in TreePath,
* <code>path</code>.
*/
}
}
}
/**
* Updates the TreeState in response to nodes expanding/collapsing.
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
/**
* Called whenever an item in the tree has been expanded.
*/
}
/**
* Called whenever an item in the tree has been collapsed.
*/
}
} // BasicTreeUI.TreeExpansionHandler
/**
* Updates the preferred size when scrolling (if necessary).
*/
/** Timer used when inside a scrollpane and the scrollbar is
* adjusting. */
/** ScrollBar that is being adjusted. */
if(scrollPane == null)
updateSize();
else {
!scrollBar.getValueIsAdjusting()) {
// Try the horizontal scrollbar.
startTimer();
else
updateSize();
}
else
startTimer();
}
}
}
/**
* Creates, if necessary, and starts a Timer to check if need to
* resize the bounds.
*/
protected void startTimer() {
timer.setRepeats(true);
}
}
/**
* Returns the JScrollPane housing the JTree, or null if one isn't
* found.
*/
while(c != null && !(c instanceof JScrollPane))
c = c.getParent();
if(c instanceof JScrollPane)
return (JScrollPane)c;
return null;
}
/**
* Public as a result of Timer. If the scrollBar is null, or
* not adjusting, this stops the timer and updates the sizing.
*/
updateSize();
}
}
} // End of BasicTreeUI.ComponentHandler
/**
* Forwards all TreeModel events to the TreeState.
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
getHandler().treeNodesChanged(e);
}
getHandler().treeNodesInserted(e);
}
getHandler().treeNodesRemoved(e);
}
}
} // End of BasicTreeUI.TreeModelHandler
/**
* Listens for changes in the selection model and updates the display
* accordingly.
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
/**
* Messaged when the selection changes in the tree we're displaying
* for. Stops editing, messages super and displays the changed paths.
*/
}
}// End of BasicTreeUI.TreeSelectionHandler
/**
* Listener responsible for getting cell editing events and updating
* the tree accordingly.
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
/** Messaged when editing has stopped in the tree. */
getHandler().editingStopped(e);
}
/** Messaged when editing has been canceled in the tree. */
getHandler().editingCanceled(e);
}
} // BasicTreeUI.CellEditorHandler
/**
* This is used to get mutliple key down events to appropriately generate
* events.
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
// Also note these fields aren't use anymore, nor does Handler have
// the old functionality. This behavior worked around an old bug
// in JComponent that has long since been fixed.
/** Key code that is being generated for. */
/** Set to true while keyPressed is active. */
protected boolean isKeyDown;
/**
* Invoked when a key has been typed.
*
* Moves the keyboard focus to the first element
* whose first letter matches the alphanumeric key
* pressed by the user. Subsequent same key presses
* move the keyboard focus to the next object that
* starts with the same letter.
*/
getHandler().keyTyped(e);
}
getHandler().keyPressed(e);
}
getHandler().keyReleased(e);
}
} // End of BasicTreeUI.KeyHandler
/**
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
/**
* Invoked when focus is activated on the tree we're in, redraws the
* lead row.
*/
getHandler().focusGained(e);
}
/**
* Invoked when focus is activated on the tree we're in, redraws the
* lead row.
*/
getHandler().focusLost(e);
}
} // End of class BasicTreeUI.FocusHandler
/**
* Class responsible for getting size of node, method is forwarded
* to BasicTreeUI method. X location does not include insets, that is
* handled in getPathBounds.
*/
// This returns locations that don't include any Insets.
public class NodeDimensionsHandler extends
/**
* Responsible for getting the size of a particular node.
*/
// Return size of editing component, if editing and asking
// for editing row.
int rh = getRowHeight();
}
else {
}
return size;
}
// Not editing, use renderer.
if(currentCellRenderer != null) {
false);
// Only ever removed when UI changes, this is OK!
}
}
else {
}
return size;
}
return null;
}
/**
* @return amount to indent the given row.
*/
}
} // End of class BasicTreeUI.NodeDimensionsHandler
/**
* TreeMouseListener is responsible for updating the selection
* based on mouse events.
*/
{
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
/**
* Invoked when a mouse button has been pressed on a component.
*/
getHandler().mousePressed(e);
}
getHandler().mouseDragged(e);
}
/**
* Invoked when the mouse button has been moved on a component
* (with no buttons no down).
* @since 1.4
*/
getHandler().mouseMoved(e);
}
getHandler().mouseReleased(e);
}
} // End of BasicTreeUI.MouseHandler
/**
* PropertyChangeListener for the tree. Updates the appropriate
* varaible, or TreeState, based on what changes.
*/
public class PropertyChangeHandler implements
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
}
} // End of BasicTreeUI.PropertyChangeHandler
/**
* Listener on the TreeSelectionModel, resets the row selection if
* any of the properties of the model change.
*/
public class SelectionModelPropertyChangeHandler implements
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
}
} // End of BasicTreeUI.SelectionModelPropertyChangeHandler
/**
* Will toggle the expandedness of a node, as well as potentially
* incrementing the selection.
*/
/** Determines direction to traverse, 1 means expand, -1 means
* collapse. */
protected int direction;
/** True if the selection is reset, false means only the lead path
* changes. */
private boolean changeSelection;
}
boolean changeSelection) {
this.changeSelection = changeSelection;
}
}
}
} // BasicTreeUI.TreeTraverseAction
/** TreePageAction handles page up and page down events.
*/
/** Specifies the direction to adjust the selection by. */
protected int direction;
/** True indicates should set selection from anchor path. */
private boolean addToSelection;
private boolean changeSelection;
}
boolean addToSelection,
boolean changeSelection) {
this.addToSelection = addToSelection;
this.changeSelection = changeSelection;
}
}
}
} // BasicTreeUI.TreePageAction
* is moved up or down based on direction.
*/
/** Specifies the direction to adjust the selection by. */
protected int direction;
/** If true the new item is added to the selection, if false the
* selection is reset. */
private boolean addToSelection;
private boolean changeSelection;
}
boolean addToSelection,
boolean changeSelection) {
this.addToSelection = addToSelection;
this.changeSelection = changeSelection;
}
}
}
} // End of class BasicTreeUI.TreeIncrementAction
/**
* Scrolls either the first or last cell to be visible based on
* direction.
*/
protected int direction;
/** Set to true if append to selection. */
private boolean addToSelection;
private boolean changeSelection;
}
boolean addToSelection,
boolean changeSelection) {
this.changeSelection = changeSelection;
this.addToSelection = addToSelection;
}
}
}
} // End of class BasicTreeUI.TreeHomeAction
/**
* For the first selected row expandedness will be toggled.
*/
}
}
}
} // End of class BasicTreeUI.TreeToggleAction
/**
* ActionListener that invokes cancelEditing when action performed.
*/
}
}
}
} // End of class BasicTreeUI.TreeCancelEditingAction
/**
* MouseInputHandler handles passing all mouse events,
* including mouse motion events, until the mouse is released to
* the destination it is constructed with. It is assumed all the
* events are currently target at source.
*/
{
/** Source that events are coming from. */
/** Destination that receives all events. */
private boolean dispatchedEvent;
}
this.destination = destination;
this.source.addMouseListener(this);
this.source.addMouseMotionListener(this);
/* Dispatch the editing event! */
this.focusComponent = focusComponent;
}
if(destination != null) {
dispatchedEvent = true;
(source, e, destination));
}
}
}
if(destination != null)
(source, e, destination));
}
if (!SwingUtilities.isLeftMouseButton(e)) {
}
}
if (!SwingUtilities.isLeftMouseButton(e)) {
}
}
if(destination != null) {
dispatchedEvent = true;
(source, e, destination));
}
}
}
protected void removeFromSource() {
source.removeMouseListener(this);
source.removeMouseMotionListener(this);
if (focusComponent != null &&
(focusComponent instanceof JTextField)) {
}
}
}
} // End of class BasicTreeUI.MouseInputHandler
static class TreeTransferHandler extends TransferHandler implements UIResource, Comparator<TreePath> {
/**
* Create a Transferable to use as the source for a data transfer.
*
* @param c The component holding the data to be transfered. This
* argument is provided to enable sharing of TransferHandlers by
* multiple components.
* @return The representation of the data to be transfered.
*
*/
if (c instanceof JTree) {
return null;
}
}
// remove the last newline
}
return null;
}
}
}
/**
* Selection paths are in selection order. The conversion to
* HTML requires display order. This method resorts the paths
* to be in the display order.
*/
// sort the paths to display order rather than selection order
}
for (int i = 0; i < n; i++) {
}
return displayPaths;
}
return COPY;
}
}
//
// KeyListener
//
/**
* Invoked when a key has been typed.
*
* Moves the keyboard focus to the first element whose prefix matches the
* sequence of alphanumeric keys pressed by the user with delay less
* than value of <code>timeFactor</code> property (or 1000 milliseconds
* if it is not defined). Subsequent same key presses move the keyboard
* focus to the next object that starts with the same letter until another
* key is pressed, then it is treated as the prefix with appropriate number
* of the same letters followed by first typed another letter.
*/
// handle first letter navigation
isNavigationKey(e)) {
return;
}
boolean startingFromSelection = true;
char c = e.getKeyChar();
typedString += c;
// Subsequent same key presses move the keyboard focus to the next
// object that starts with the same letter.
startingRow++;
} else {
}
} else {
startingRow++;
typedString = "" + c;
}
startingFromSelection = false;
startingRow = 0;
}
} else if (startingFromSelection) {
}
}
}
}
/**
* Invoked when a key has been pressed.
*
* Checks to see if the key event is a navigation key to prevent
* dispatching these keys for the first letter navigation.
*/
prefix = "";
typedString = "";
lastTime = 0L;
}
}
}
/**
* Returns whether or not the supplied key event maps to a key that is used for
* navigation. This is used for optimizing key input by only passing non-
* navigation keys to the first letter navigation mechanism.
*/
}
//
// PropertyChangeListener
//
}
if (!ignoreLAChange) {
}
}
if (!ignoreLAChange) {
}
}
}
}
booleanValue());
}
booleanValue());
}
intValue());
}
}
}
}
}
else if(changeName == "font") {
updateSize();
}
else if (changeName == "componentOrientation") {
}
} else if ("dropLocation" == changeName) {
}
}
}
return;
}
Rectangle r;
if (isDropLine(loc)) {
r = getDropLineRect(loc);
} else {
}
if (r != null) {
}
}
//
// MouseListener
//
// Whether or not the mouse press (which is being considered as part
// of a drag sequence) also caused the selection change to be fully
// processed.
private boolean dragPressDidSelection;
// Set to true when a drag gesture has been fully recognized and DnD
// begins. Use this to ignore further mouse events which could be
// delivered if DnD is cancelled (via ESCAPE for example)
private boolean dragStarted;
// The path over which the press occurred and the press event itself
// Used to detect whether the press event causes a selection change.
// If it does, we won't try to start editing on the release.
private boolean valueChangedOnPress;
return false;
}
return false;
}
}
}
}
}
/**
* Invoked when a mouse button has been pressed on a component.
*/
return;
}
// if we can't stop any ongoing editing, do nothing
&& !stopEditing(tree)) {
return;
}
if (tree.getDragEnabled()) {
mousePressedDND(e);
} else {
handleSelection(e);
}
}
pressedEvent = e;
boolean grabFocus = true;
dragStarted = false;
valueChangedOnPress = false;
// if we have a valid path and this is a drag initiating event
dragPressDidSelection = false;
if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
// do nothing for control - will be handled on release
// or when drag starts
return;
// clicking on something that's already selected
// and need to make it the lead now
setLeadSelectionPath(pressedPath, true);
return;
}
dragPressDidSelection = true;
// could be a drag initiating event - don't grab focus
grabFocus = false;
}
if (grabFocus) {
}
handleSelection(e);
}
if(pressedPath != null) {
return;
}
// Preferably checkForClickInExpandControl could take
// the Event to do this it self!
if(SwingUtilities.isLeftMouseButton(e)) {
}
int x = e.getX();
// Perhaps they clicked the cell itself. If so,
// select it.
}
}
}
}
dragStarted = true;
setLeadSelectionPath(pressedPath, true);
}
pressedEvent = null;
pressedPath = null;
}
return;
}
if (tree.getDragEnabled()) {
DragRecognitionSupport.mouseDragged(e, this);
}
}
/**
* Invoked when the mouse button has been moved on a component
* (with no buttons no down).
*/
}
return;
}
if (tree.getDragEnabled()) {
mouseReleasedDND(e);
}
pressedEvent = null;
pressedPath = null;
}
if (!dragPressDidSelection) {
}
}
if (!dragStarted) {
// Note: We don't give the tree a chance to start editing if the
// mouse press caused a selection change. Otherwise the default
// tree cell editor will start editing on EVERY press and
// release. If it turns out that this affects some editors, we
// can always parameterize this with a client property. ex:
//
// if (pressedPath != null &&
// (Boolean.TRUE == tree.getClientProperty("Tree.DnD.canEditOnValueChange") ||
// !valueChangedOnPress) && ...
}
}
}
//
// FocusListener
//
}
}
focusGained(e);
}
//
// CellEditorListener
//
completeEditing(false, false, true);
}
/** Messaged when editing has been canceled in the tree. */
completeEditing(false, false, false);
}
//
// TreeSelectionListener
//
valueChangedOnPress = true;
// Stop editing
// Make sure all the paths are visible, if necessary.
// PENDING: This should be tweaked when isAdjusting is added
counter--) {
boolean expand = true;
// Indicates this path isn't valid anymore,
// we shouldn't attempt to expand it then.
expand = false;
}
else {
}
}
if (expand) {
}
}
}
}
boolean paintPaths = true;
if(changedPaths != null) {
if(maxCounter > 4) {
paintPaths = false;
}
else {
if(nodeBounds != null &&
}
}
}
if(paintPaths) {
}
}
//
// TreeExpansionListener
//
}
}
updateSize();
}
}
}
//
// TreeModelListener
//
int[] indices = e.getChildIndices();
// The root has changed
updateSize();
}
// Changed nodes are visible
// Find the minimum index, we only need paint from there
// down.
}
// Forward to the treestate
// Mark preferred size as bogus.
updateSize0();
// And repaint
return;
}
}
else {
}
}
else {
// Nodes that changed aren't visible. No need to paint
}
}
}
updateSize();
}
else {
// PENDING(sky): Need a method in TreeModelEvent
// that can return the count, getChildIndices allocs
// a new array!
int[] indices = e.getChildIndices();
(path.getLastPathComponent());
updateSize();
}
}
}
updateSize();
}
}
}
updateSize();
}
}
}
"selectPreviousChangeLead";
"selectPreviousExtendSelection";
"selectNextChangeLead";
"selectNextExtendSelection";
"selectChildChangeLead";
"selectParentChangeLead";
"scrollUpChangeSelection";
"scrollUpChangeLead";
"scrollUpExtendSelection";
"scrollDownChangeSelection";
"scrollDownExtendSelection";
"scrollDownChangeLead";
"selectFirstChangeLead";
"selectFirstExtendSelection";
"selectLastChangeLead";
"selectLastExtendSelection";
"scrollLeftExtendSelection";
"scrollRightExtendSelection";
"scrollRightChangeLead";
"scrollLeftChangeLead";
"moveSelectionToParent";
// add the lead item to the selection without changing lead or anchor
// toggle the selected state of the lead item and move the anchor to it
// extend the selection to the lead item
// move the anchor to the lead and ensure only that item is selected
Actions() {
super(null);
}
super(key);
}
if (o instanceof JTree) {
if (getName() == CANCEL_EDITING) {
}
}
return true;
}
return;
}
if (key == SELECT_PREVIOUS) {
}
else if (key == SELECT_PREVIOUS_CHANGE_LEAD) {
}
else if (key == SELECT_PREVIOUS_EXTEND_SELECTION) {
}
else if (key == SELECT_NEXT) {
}
else if (key == SELECT_NEXT_CHANGE_LEAD) {
}
else if (key == SELECT_NEXT_EXTEND_SELECTION) {
}
else if (key == SELECT_CHILD) {
}
else if (key == SELECT_CHILD_CHANGE_LEAD) {
}
else if (key == SELECT_PARENT) {
}
else if (key == SELECT_PARENT_CHANGE_LEAD) {
}
else if (key == SCROLL_UP_CHANGE_SELECTION) {
}
else if (key == SCROLL_UP_CHANGE_LEAD) {
}
else if (key == SCROLL_UP_EXTEND_SELECTION) {
}
else if (key == SCROLL_DOWN_CHANGE_SELECTION) {
}
else if (key == SCROLL_DOWN_EXTEND_SELECTION) {
}
else if (key == SCROLL_DOWN_CHANGE_LEAD) {
}
else if (key == SELECT_FIRST) {
}
else if (key == SELECT_FIRST_CHANGE_LEAD) {
}
else if (key == SELECT_FIRST_EXTEND_SELECTION) {
}
else if (key == SELECT_LAST) {
}
else if (key == SELECT_LAST_CHANGE_LEAD) {
}
else if (key == SELECT_LAST_EXTEND_SELECTION) {
}
}
else if (key == CANCEL_EDITING) {
}
else if (key == START_EDITING) {
}
else if (key == SELECT_ALL) {
}
else if (key == CLEAR_SELECTION) {
}
else if (key == ADD_TO_SELECTION) {
}
}
}
else if (key == TOGGLE_AND_ANCHOR) {
} else {
}
}
}
}
else if (key == MOVE_SELECTION_TO) {
}
}
else if (key == SCROLL_LEFT) {
}
else if (key == SCROLL_RIGHT) {
}
else if (key == SCROLL_LEFT_EXTEND_SELECTION) {
}
else if (key == SCROLL_RIGHT_EXTEND_SELECTION) {
}
else if (key == SCROLL_RIGHT_CHANGE_LEAD) {
}
else if (key == SCROLL_LEFT_CHANGE_LEAD) {
}
}
}
else if (key == MOVE_SELECTION_TO_PARENT) {
}
}
int direction, boolean addToSelection,
boolean changeSelection) {
int rowCount;
if (direction == -1) {
visRect.y);
}
else {
}
// Scroll
// select
if (addToSelection) {
}
else if(changeSelection) {
}
else {
}
}
}
int amount) {
visRect.x);
}
else {
visRect.y);
}
}
if (lead != -1) {
if(aRow == -1)
aRow = 0;
}
}
}
if(rowCount > 0) {
if(selectAll) {
if (lead != -1) {
}
return;
}
}
}
}
}
else {
}
}
}
if(editRow != -1) {
}
}
}
}
}
}
}
boolean addToSelection,
boolean changeSelection) {
// disable moving of lead unless in discontiguous mode
if (!addToSelection && !changeSelection &&
changeSelection = true;
}
int rowCount;
int newIndex;
if(selIndex == -1) {
if(direction == 1)
newIndex = 0;
else
}
else
/* Aparently people don't like wrapping;( */
}
else if(changeSelection) {
}
else {
}
}
}
boolean changeSelection) {
// disable moving of lead unless in discontiguous mode
if (!changeSelection &&
changeSelection = true;
}
int rowCount;
int newIndex;
if(minSelIndex == -1)
newIndex = 0;
else {
/* Try and expand the node, otherwise go to next
node. */
if(direction == 1) {
newIndex = -1;
}
else if (childCount > 0) {
}
}
}
/* Try to collapse node. */
else {
(tree, minSelIndex));
newIndex = -1;
}
else {
getParentPath());
}
else
newIndex = -1;
}
}
}
if(newIndex != -1) {
if(changeSelection) {
}
else {
}
}
}
}
if (newIndex != -1) {
}
}
}
boolean addToSelection, boolean changeSelection) {
// disable moving of lead unless in discontiguous mode
if (!addToSelection && !changeSelection &&
changeSelection = true;
}
int rowCount;
if(direction == -1) {
// up.
visRect.y);
visRect.y);
}
}
else {
// down
visRect.y);
visRect.y);
}
}
if(direction == -1) {
}
else {
}
if(addToSelection) {
}
else if(changeSelection) {
}
else {
}
}
}
}
boolean addToSelection, boolean changeSelection) {
// disable moving of lead unless in discontiguous mode
if (!addToSelection && !changeSelection &&
changeSelection = true;
}
if (rowCount > 0) {
if(direction == -1) {
if (addToSelection) {
if (aRow == -1) {
}
else {
}
}
else if(changeSelection) {
}
else {
true);
}
}
else {
if (addToSelection) {
if (aRow == -1) {
rowCount -1);
}
else {
rowCount -1));
}
}
else if(changeSelection) {
}
else {
rowCount - 1), true);
}
if (ui.isLargeModel()){
public void run() {
}
});
}
}
}
}
}
} // End of class BasicTreeUI