< prev index next >

src/java.desktop/share/classes/javax/swing/tree/TreeSelectionModel.java

Print this page

        

*** 38,69 **** * <p> * The state of the tree selection is characterized by * a set of TreePaths, and optionally a set of integers. The mapping * from TreePath to integer is done by way of an instance of RowMapper. * It is not necessary for a TreeSelectionModel to have a RowMapper to ! * correctly operate, but without a RowMapper <code>getSelectionRows</code> * will return null. * * <p> * * A TreeSelectionModel can be configured to allow only one ! * path (<code>SINGLE_TREE_SELECTION</code>) a number of ! * contiguous paths (<code>CONTIGUOUS_TREE_SELECTION</code>) or a number of ! * discontiguous paths (<code>DISCONTIGUOUS_TREE_SELECTION</code>). ! * A <code>RowMapper</code> is used to determine if TreePaths are * contiguous. ! * In the absence of a RowMapper <code>CONTIGUOUS_TREE_SELECTION</code> and ! * <code>DISCONTIGUOUS_TREE_SELECTION</code> behave the same, that is they * allow any number of paths to be contained in the TreeSelectionModel. * * <p> * ! * For a selection model of <code>CONTIGUOUS_TREE_SELECTION</code> any ! * time the paths are changed (<code>setSelectionPath</code>, ! * <code>addSelectionPath</code> ...) the TreePaths are again checked to * make they are contiguous. A check of the TreePaths can also be forced ! * by invoking <code>resetRowSelection</code>. How a set of discontiguous * TreePaths is mapped to a contiguous set is left to implementors of * this interface to enforce a particular policy. * * <p> * --- 38,69 ---- * <p> * The state of the tree selection is characterized by * a set of TreePaths, and optionally a set of integers. The mapping * from TreePath to integer is done by way of an instance of RowMapper. * It is not necessary for a TreeSelectionModel to have a RowMapper to ! * correctly operate, but without a RowMapper {@code getSelectionRows} * will return null. * * <p> * * A TreeSelectionModel can be configured to allow only one ! * path ({@code SINGLE_TREE_SELECTION}) a number of ! * contiguous paths ({@code CONTIGUOUS_TREE_SELECTION}) or a number of ! * discontiguous paths ({@code DISCONTIGUOUS_TREE_SELECTION}). ! * A {@code RowMapper} is used to determine if TreePaths are * contiguous. ! * In the absence of a RowMapper {@code CONTIGUOUS_TREE_SELECTION} and ! * {@code DISCONTIGUOUS_TREE_SELECTION} behave the same, that is they * allow any number of paths to be contained in the TreeSelectionModel. * * <p> * ! * For a selection model of {@code CONTIGUOUS_TREE_SELECTION} any ! * time the paths are changed ({@code setSelectionPath}, ! * {@code addSelectionPath} ...) the TreePaths are again checked to * make they are contiguous. A check of the TreePaths can also be forced ! * by invoking {@code resetRowSelection}. How a set of discontiguous * TreePaths is mapped to a contiguous set is left to implementors of * this interface to enforce a particular policy. * * <p> *
*** 72,83 **** * <pre> * TreePath[] paths = new TreePath[] { treePath, treePath }; * treeSelectionModel.setSelectionPaths(paths); * </pre> * should result in only one path being selected: ! * <code>treePath</code>, and ! * not two copies of <code>treePath</code>. * * <p> * * The lead TreePath is the last path that was added (or set). The lead * row is then the row that corresponds to the TreePath as determined --- 72,83 ---- * <pre> * TreePath[] paths = new TreePath[] { treePath, treePath }; * treeSelectionModel.setSelectionPaths(paths); * </pre> * should result in only one path being selected: ! * {@code treePath}, and ! * not two copies of {@code treePath}. * * <p> * * The lead TreePath is the last path that was added (or set). The lead * row is then the row that corresponds to the TreePath as determined
*** 104,192 **** * Sets the selection model, which must be one of SINGLE_TREE_SELECTION, * CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. * <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>, * only one TreePath will remain selected. It is up to the particular * implementation to decide what TreePath remains selected. * * @param mode selection mode to be set */ void setSelectionMode(int mode); /** * Returns the current selection mode, one of ! * <code>SINGLE_TREE_SELECTION</code>, ! * <code>CONTIGUOUS_TREE_SELECTION</code> or ! * <code>DISCONTIGUOUS_TREE_SELECTION</code>. * * @return the current selection mode */ int getSelectionMode(); /** * 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>. * * @param path new path to select */ void setSelectionPath(TreePath path); /** * Sets the selection to path. If this represents a change, then ! * the TreeSelectionListeners are notified. If <code>paths</code> is ! * null, this has the same effect as invoking <code>clearSelection</code>. * * @param paths new selection */ void setSelectionPaths(TreePath[] paths); /** * 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. * * @param path the new path to add to the current selection */ void addSelectionPath(TreePath path); /** * 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. * * @param paths the new paths to add to the current selection */ void addSelectionPaths(TreePath[] paths); /** * 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. * * @param path the path to remove from the selection */ void removeSelectionPath(TreePath path); /** * Removes paths from the selection. If any of the paths in ! * <code>paths</code> * are in the selection, the TreeSelectionListeners are notified. ! * This method has no effect if <code>paths</code> is null. * * @param paths the path to remove from the selection */ void removeSelectionPaths(TreePath[] paths); /** * Returns the first path in the selection. How first is defined is * up to implementors, and may not necessarily be the TreePath with * the smallest integer value as determined from the ! * <code>RowMapper</code>. * * @return the first path in the selection */ TreePath getSelectionPath(); --- 104,192 ---- * Sets the selection model, which must be one of SINGLE_TREE_SELECTION, * CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. * <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}, * only one TreePath will remain selected. It is up to the particular * implementation to decide what TreePath remains selected. * * @param mode selection mode to be set */ void setSelectionMode(int mode); /** * Returns the current selection mode, one of ! * {@code SINGLE_TREE_SELECTION}, ! * {@code CONTIGUOUS_TREE_SELECTION} or ! * {@code DISCONTIGUOUS_TREE_SELECTION}. * * @return the current selection mode */ int getSelectionMode(); /** * Sets the selection to path. If this represents a change, then ! * the TreeSelectionListeners are notified. If {@code path} is ! * null, this has the same effect as invoking {@code clearSelection}. * * @param path new path to select */ void setSelectionPath(TreePath path); /** * Sets the selection to path. If this represents a change, then ! * the TreeSelectionListeners are notified. If {@code paths} is ! * null, this has the same effect as invoking {@code clearSelection}. * * @param paths new selection */ void setSelectionPaths(TreePath[] paths); /** * 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} is null. * * @param path the new path to add to the current selection */ void addSelectionPath(TreePath path); /** * 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} is null. * * @param paths the new paths to add to the current selection */ void addSelectionPaths(TreePath[] paths); /** * Removes path from the selection. If path is in the selection * The TreeSelectionListeners are notified. This has no effect if ! * {@code path} is null. * * @param path the path to remove from the selection */ void removeSelectionPath(TreePath path); /** * Removes paths from the selection. If any of the paths in ! * {@code paths} * are in the selection, the TreeSelectionListeners are notified. ! * This method has no effect if {@code paths} is null. * * @param paths the path to remove from the selection */ void removeSelectionPaths(TreePath[] paths); /** * Returns the first path in the selection. How first is defined is * up to implementors, and may not necessarily be the TreePath with * the smallest integer value as determined from the ! * {@code RowMapper}. * * @return the first path in the selection */ TreePath getSelectionPath();
*** 204,214 **** * @return the number of paths that are selected */ int getSelectionCount(); /** ! * Returns true if the path, <code>path</code>, is in the current * selection. * * @param path the path to be loked for * @return whether the {@code path} is in the current selection */ --- 204,214 ---- * @return the number of paths that are selected */ int getSelectionCount(); /** ! * Returns true if the path, {@code path}, is in the current * selection. * * @param path the path to be loked for * @return whether the {@code path} is in the current selection */
*** 272,282 **** * for the current set of selected TreePaths */ int getMaxSelectionRow(); /** ! * Returns true if the row identified by <code>row</code> is selected. * * @param row row to check * @return whether the row is selected */ boolean isRowSelected(int row); --- 272,282 ---- * for the current set of selected TreePaths */ int getMaxSelectionRow(); /** ! * Returns true if the row identified by {@code row} is selected. * * @param row row to check * @return whether the row is selected */ boolean isRowSelected(int row);
< prev index next >