equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
2914 /** |
2914 /** |
2915 * <code>TreeTraverseAction</code> is the action used for left/right keys. |
2915 * <code>TreeTraverseAction</code> is the action used for left/right keys. |
2916 * Will toggle the expandedness of a node, as well as potentially |
2916 * Will toggle the expandedness of a node, as well as potentially |
2917 * incrementing the selection. |
2917 * incrementing the selection. |
2918 */ |
2918 */ |
|
2919 @SuppressWarnings("serial") // Superclass is not serializable across versions |
2919 public class TreeTraverseAction extends AbstractAction { |
2920 public class TreeTraverseAction extends AbstractAction { |
2920 /** Determines direction to traverse, 1 means expand, -1 means |
2921 /** Determines direction to traverse, 1 means expand, -1 means |
2921 * collapse. */ |
2922 * collapse. */ |
2922 protected int direction; |
2923 protected int direction; |
2923 /** True if the selection is reset, false means only the lead path |
2924 /** True if the selection is reset, false means only the lead path |
2946 } // BasicTreeUI.TreeTraverseAction |
2947 } // BasicTreeUI.TreeTraverseAction |
2947 |
2948 |
2948 |
2949 |
2949 /** TreePageAction handles page up and page down events. |
2950 /** TreePageAction handles page up and page down events. |
2950 */ |
2951 */ |
|
2952 @SuppressWarnings("serial") // Superclass is not serializable across versions |
2951 public class TreePageAction extends AbstractAction { |
2953 public class TreePageAction extends AbstractAction { |
2952 /** Specifies the direction to adjust the selection by. */ |
2954 /** Specifies the direction to adjust the selection by. */ |
2953 protected int direction; |
2955 protected int direction; |
2954 /** True indicates should set selection from anchor path. */ |
2956 /** True indicates should set selection from anchor path. */ |
2955 private boolean addToSelection; |
2957 private boolean addToSelection; |
2981 |
2983 |
2982 |
2984 |
2983 /** TreeIncrementAction is used to handle up/down actions. Selection |
2985 /** TreeIncrementAction is used to handle up/down actions. Selection |
2984 * is moved up or down based on direction. |
2986 * is moved up or down based on direction. |
2985 */ |
2987 */ |
|
2988 @SuppressWarnings("serial") // Superclass is not serializable across versions |
2986 public class TreeIncrementAction extends AbstractAction { |
2989 public class TreeIncrementAction extends AbstractAction { |
2987 /** Specifies the direction to adjust the selection by. */ |
2990 /** Specifies the direction to adjust the selection by. */ |
2988 protected int direction; |
2991 protected int direction; |
2989 /** If true the new item is added to the selection, if false the |
2992 /** If true the new item is added to the selection, if false the |
2990 * selection is reset. */ |
2993 * selection is reset. */ |
3018 /** |
3021 /** |
3019 * TreeHomeAction is used to handle end/home actions. |
3022 * TreeHomeAction is used to handle end/home actions. |
3020 * Scrolls either the first or last cell to be visible based on |
3023 * Scrolls either the first or last cell to be visible based on |
3021 * direction. |
3024 * direction. |
3022 */ |
3025 */ |
|
3026 @SuppressWarnings("serial") // Superclass is not serializable across versions |
3023 public class TreeHomeAction extends AbstractAction { |
3027 public class TreeHomeAction extends AbstractAction { |
3024 protected int direction; |
3028 protected int direction; |
3025 /** Set to true if append to selection. */ |
3029 /** Set to true if append to selection. */ |
3026 private boolean addToSelection; |
3030 private boolean addToSelection; |
3027 private boolean changeSelection; |
3031 private boolean changeSelection; |
3052 |
3056 |
3053 |
3057 |
3054 /** |
3058 /** |
3055 * For the first selected row expandedness will be toggled. |
3059 * For the first selected row expandedness will be toggled. |
3056 */ |
3060 */ |
|
3061 @SuppressWarnings("serial") // Superclass is not serializable across versions |
3057 public class TreeToggleAction extends AbstractAction { |
3062 public class TreeToggleAction extends AbstractAction { |
3058 public TreeToggleAction(String name) { |
3063 public TreeToggleAction(String name) { |
3059 } |
3064 } |
3060 |
3065 |
3061 public void actionPerformed(ActionEvent e) { |
3066 public void actionPerformed(ActionEvent e) { |
3071 |
3076 |
3072 |
3077 |
3073 /** |
3078 /** |
3074 * ActionListener that invokes cancelEditing when action performed. |
3079 * ActionListener that invokes cancelEditing when action performed. |
3075 */ |
3080 */ |
|
3081 @SuppressWarnings("serial") // Superclass is not serializable across versions |
3076 public class TreeCancelEditingAction extends AbstractAction { |
3082 public class TreeCancelEditingAction extends AbstractAction { |
3077 public TreeCancelEditingAction(String name) { |
3083 public TreeCancelEditingAction(String name) { |
3078 } |
3084 } |
3079 |
3085 |
3080 public void actionPerformed(ActionEvent e) { |
3086 public void actionPerformed(ActionEvent e) { |
3183 |
3189 |
3184 } // End of class BasicTreeUI.MouseInputHandler |
3190 } // End of class BasicTreeUI.MouseInputHandler |
3185 |
3191 |
3186 private static final TransferHandler defaultTransferHandler = new TreeTransferHandler(); |
3192 private static final TransferHandler defaultTransferHandler = new TreeTransferHandler(); |
3187 |
3193 |
|
3194 @SuppressWarnings("serial") // JDK-implementation class |
3188 static class TreeTransferHandler extends TransferHandler implements UIResource, Comparator<TreePath> { |
3195 static class TreeTransferHandler extends TransferHandler implements UIResource, Comparator<TreePath> { |
3189 |
3196 |
3190 private JTree tree; |
3197 private JTree tree; |
3191 |
3198 |
3192 /** |
3199 /** |