< prev index next >
src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java
Print this page
@@ -44,19 +44,19 @@
* to be able to track row changes you may wish to become a listener
* for expansion events on the tree and test for changes from there.
* <p>resetRowSelection is called from any of the methods that update
* the selected paths. If you subclass any of these methods to
* filter what is allowed to be selected, be sure and message
- * <code>resetRowSelection</code> if you do not message super.
+ * {@code resetRowSelection} if you do not message super.
*
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see javax.swing.JTree
*
* @author Scott Violet
@@ -95,11 +95,11 @@
protected int leadIndex;
/** Lead row. */
protected int leadRow;
/** Used to make sure the paths are unique, will contain all the paths
- * in <code>selection</code>.
+ * in {@code selection}.
*/
private Hashtable<TreePath, Boolean> uniquePaths;
private Hashtable<TreePath, Boolean> lastPaths;
private TreePath[] tempPaths;
@@ -136,19 +136,19 @@
/**
* Sets the selection model, which must be one of SINGLE_TREE_SELECTION,
* CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. If mode
* is not one of the defined value,
- * <code>DISCONTIGUOUS_TREE_SELECTION</code> is assumed.
+ * {@code DISCONTIGUOUS_TREE_SELECTION} is assumed.
* <p>This may change the selection if the current selection is not valid
* for the new mode. For example, if three TreePaths are
- * selected when the mode is changed to <code>SINGLE_TREE_SELECTION</code>,
+ * selected when the mode is changed to {@code SINGLE_TREE_SELECTION},
* only one TreePath will remain selected. It is up to the particular
* implementation to decide what TreePath remains selected.
* <p>
* Setting the mode to something other than the defined types will
- * result in the mode becoming <code>DISCONTIGUOUS_TREE_SELECTION</code>.
+ * result in the mode becoming {@code DISCONTIGUOUS_TREE_SELECTION}.
*/
public void setSelectionMode(int mode) {
int oldMode = selectionMode;
selectionMode = validateSelectionMode(mode);
@@ -164,22 +164,22 @@
&& mode != TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
? TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION : mode;
}
/**
- * Returns the selection mode, one of <code>SINGLE_TREE_SELECTION</code>,
- * <code>DISCONTIGUOUS_TREE_SELECTION</code> or
- * <code>CONTIGUOUS_TREE_SELECTION</code>.
+ * Returns the selection mode, one of {@code SINGLE_TREE_SELECTION},
+ * {@code DISCONTIGUOUS_TREE_SELECTION} or
+ * {@code CONTIGUOUS_TREE_SELECTION}.
*/
public int getSelectionMode() {
return selectionMode;
}
/**
* Sets the selection to path. If this represents a change, then
- * the TreeSelectionListeners are notified. If <code>path</code> is
- * null, this has the same effect as invoking <code>clearSelection</code>.
+ * the TreeSelectionListeners are notified. If {@code path} is
+ * null, this has the same effect as invoking {@code clearSelection}.
*
* @param path new path to select
*/
public void setSelectionPath(TreePath path) {
if(path == null)
@@ -299,11 +299,11 @@
}
/**
* Adds path to the current selection. If path is not currently
* in the selection the TreeSelectionListeners are notified. This has
- * no effect if <code>path</code> is null.
+ * no effect if {@code path} is null.
*
* @param path the new path to add to the current selection
*/
public void addSelectionPath(TreePath path) {
if(path != null) {
@@ -316,18 +316,18 @@
/**
* Adds paths to the current selection. If any of the paths in
* paths are not currently in the selection the TreeSelectionListeners
* are notified. This has
- * no effect if <code>paths</code> is null.
- * <p>The lead path is set to the last element in <code>paths</code>.
- * <p>If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>,
+ * no effect if {@code paths} is null.
+ * <p>The lead path is set to the last element in {@code paths}.
+ * <p>If the selection mode is {@code CONTIGUOUS_TREE_SELECTION},
* and adding the new paths would make the selection discontiguous.
- * Then two things can result: if the TreePaths in <code>paths</code>
+ * Then two things can result: if the TreePaths in {@code paths}
* are contiguous, then the selection becomes these TreePaths,
* otherwise the TreePaths aren't contiguous and the selection becomes
- * the first TreePath in <code>paths</code>.
+ * the first TreePath in {@code paths}.
*
* @param paths the new path to add to the current selection
*/
public void addSelectionPaths(TreePath[] paths) {
int newPathLength = ((paths == null) ? 0 : paths.length);
@@ -422,11 +422,11 @@
}
/**
* Removes path from the selection. If path is in the selection
* The TreeSelectionListeners are notified. This has no effect if
- * <code>path</code> is null.
+ * {@code path} is null.
*
* @param path the path to remove from the selection
*/
public void removeSelectionPath(TreePath path) {
if(path != null) {
@@ -438,11 +438,11 @@
}
/**
* Removes paths from the selection. If any of the paths in paths
* are in the selection the TreeSelectionListeners are notified.
- * This has no effect if <code>paths</code> is null.
+ * This has no effect if {@code paths} is null.
*
* @param paths the paths to remove from the selection
*/
public void removeSelectionPaths(TreePath[] paths) {
if (paths != null && selection != null && paths.length > 0) {
@@ -541,11 +541,11 @@
public int getSelectionCount() {
return (selection == null) ? 0 : selection.length;
}
/**
- * Returns true if the path, <code>path</code>,
+ * Returns true if the path, {@code path},
* is in the current selection.
*/
public boolean isPathSelected(TreePath path) {
return (path != null) ? (uniquePaths.get(path) != null) : false;
}
@@ -603,11 +603,11 @@
/**
* Returns an array of all the tree selection listeners
* registered on this model.
*
- * @return all of this model's <code>TreeSelectionListener</code>s
+ * @return all of this model's {@code TreeSelectionListener}s
* or an empty
* array if no tree selection listeners are currently registered
*
* @see #addTreeSelectionListener
* @see #removeTreeSelectionListener
@@ -650,16 +650,16 @@
* <code><em>Foo</em>Listener</code>s are registered using the
* <code>add<em>Foo</em>Listener</code> method.
*
* <p>
*
- * You can specify the <code>listenerType</code> argument
+ * You can specify the {@code listenerType} argument
* with a class literal,
* such as
* <code><em>Foo</em>Listener.class</code>.
* For example, you can query a
- * <code>DefaultTreeSelectionModel</code> <code>m</code>
+ * {@code DefaultTreeSelectionModel m}
* for its tree selection listeners with the following code:
*
* <pre>TreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));</pre>
*
* If no such listeners exist, this method returns an empty array.
@@ -668,13 +668,13 @@
* @param listenerType the type of listeners requested
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s on this component,
* or an empty array if no such
* listeners have been added
- * @exception ClassCastException if <code>listenerType</code>
+ * @exception ClassCastException if {@code listenerType}
* doesn't specify a class or interface that implements
- * <code>java.util.EventListener</code>
+ * {@code java.util.EventListener}
*
* @see #getTreeSelectionListeners
* @see #getPropertyChangeListeners
*
* @since 1.3
@@ -750,11 +750,11 @@
public int getMaxSelectionRow() {
return listSelectionModel.getMaxSelectionIndex();
}
/**
- * Returns true if the row identified by <code>row</code> is selected.
+ * Returns true if the row identified by {@code row} is selected.
*/
public boolean isRowSelected(int row) {
return listSelectionModel.isSelectedIndex(row);
}
@@ -763,11 +763,11 @@
* be invoked when the mapping from TreePaths to integers has changed
* (for example, a node has been expanded).
* <p>You do not normally have to call this, JTree and its associated
* Listeners will invoke this for you. If you are implementing your own
* View class, then you will have to invoke this.
- * <p>This will invoke <code>insureRowContinuity</code> to make sure
+ * <p>This will invoke {@code insureRowContinuity} to make sure
* the currently selected TreePaths are still valid based on the
* selection mode.
*/
public void resetRowSelection() {
listSelectionModel.clearSelection();
@@ -851,13 +851,13 @@
changeSupport.removePropertyChangeListener(listener);
}
/**
* Returns an array of all the property change listeners
- * registered on this <code>DefaultTreeSelectionModel</code>.
+ * registered on this {@code DefaultTreeSelectionModel}.
*
- * @return all of this model's <code>PropertyChangeListener</code>s
+ * @return all of this model's {@code PropertyChangeListener}s
* or an empty
* array if no property change listeners are currently registered
*
* @see #addPropertyChangeListener
* @see #removePropertyChangeListener
@@ -870,20 +870,20 @@
}
return changeSupport.getPropertyChangeListeners();
}
/**
- * Makes sure the currently selected <code>TreePath</code>s are valid
+ * Makes sure the currently selected {@code TreePath}s are valid
* for the current selection mode.
- * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
- * and a <code>RowMapper</code> exists, this will make sure all
+ * If the selection mode is {@code CONTIGUOUS_TREE_SELECTION}
+ * and a {@code RowMapper} exists, this will make sure all
* the rows are contiguous, that is, when sorted all the rows are
* in order with no gaps.
* If the selection isn't contiguous, the selection is
* reset to contain the first set, when sorted, of contiguous rows.
* <p>
- * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
+ * If the selection mode is {@code SINGLE_TREE_SELECTION} and
* more than one TreePath is selected, the selection is reset to
* contain the first path currently selected.
*/
protected void insureRowContinuity() {
if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
@@ -968,16 +968,16 @@
}
return true;
}
/**
- * Used to test if a particular set of <code>TreePath</code>s can
- * be added. This will return true if <code>paths</code> is null (or
+ * Used to test if a particular set of {@code TreePath}s can
+ * be added. This will return true if {@code paths} is null (or
* empty), or this object has no RowMapper, or nothing is currently selected,
- * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
+ * or the selection mode is {@code DISCONTIGUOUS_TREE_SELECTION}, or
* adding the paths to the current selection still results in a
- * contiguous set of <code>TreePath</code>s.
+ * contiguous set of {@code TreePath}s.
*
* @param paths array of {@code TreePaths} to check
* @return whether the particular set of {@code TreePaths} can be added
*/
protected boolean canPathsBeAdded(TreePath[] paths) {
< prev index next >