src/share/classes/javax/swing/event/TreeSelectionEvent.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  32  * An event that characterizes a change in the current
  33  * selection.  The change is based on any number of paths.
  34  * TreeSelectionListeners will generally query the source of
  35  * the event for the new selected status of each potentially
  36  * changed row.
  37  * <p>
  38  * <strong>Warning:</strong>
  39  * Serialized objects of this class will not be compatible with
  40  * future Swing releases. The current serialization support is
  41  * appropriate for short term storage or RMI between applications running
  42  * the same version of Swing.  As of 1.4, support for long term storage
  43  * of all JavaBeans&trade;
  44  * has been added to the <code>java.beans</code> package.
  45  * Please see {@link java.beans.XMLEncoder}.
  46  *
  47  * @see TreeSelectionListener
  48  * @see javax.swing.tree.TreeSelectionModel
  49  *
  50  * @author Scott Violet
  51  */

  52 public class TreeSelectionEvent extends EventObject
  53 {
  54     /** Paths this event represents. */
  55     protected TreePath[]     paths;
  56     /** For each path identifies if that path is in fact new. */
  57     protected boolean[]       areNew;
  58     /** leadSelectionPath before the paths changed, may be null. */
  59     protected TreePath        oldLeadSelectionPath;
  60     /** leadSelectionPath after the paths changed, may be null. */
  61     protected TreePath        newLeadSelectionPath;
  62 
  63     /**
  64       * Represents a change in the selection of a TreeSelectionModel.
  65       * paths identifies the paths that have been either added or
  66       * removed from the selection.
  67       *
  68       * @param source source of event
  69       * @param paths the paths that have changed in the selection
  70       */
  71     public TreeSelectionEvent(Object source, TreePath[] paths,


   1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  32  * An event that characterizes a change in the current
  33  * selection.  The change is based on any number of paths.
  34  * TreeSelectionListeners will generally query the source of
  35  * the event for the new selected status of each potentially
  36  * changed row.
  37  * <p>
  38  * <strong>Warning:</strong>
  39  * Serialized objects of this class will not be compatible with
  40  * future Swing releases. The current serialization support is
  41  * appropriate for short term storage or RMI between applications running
  42  * the same version of Swing.  As of 1.4, support for long term storage
  43  * of all JavaBeans&trade;
  44  * has been added to the <code>java.beans</code> package.
  45  * Please see {@link java.beans.XMLEncoder}.
  46  *
  47  * @see TreeSelectionListener
  48  * @see javax.swing.tree.TreeSelectionModel
  49  *
  50  * @author Scott Violet
  51  */
  52 @SuppressWarnings("serial") // Same-version serialization only
  53 public class TreeSelectionEvent extends EventObject
  54 {
  55     /** Paths this event represents. */
  56     protected TreePath[]     paths;
  57     /** For each path identifies if that path is in fact new. */
  58     protected boolean[]       areNew;
  59     /** leadSelectionPath before the paths changed, may be null. */
  60     protected TreePath        oldLeadSelectionPath;
  61     /** leadSelectionPath after the paths changed, may be null. */
  62     protected TreePath        newLeadSelectionPath;
  63 
  64     /**
  65       * Represents a change in the selection of a TreeSelectionModel.
  66       * paths identifies the paths that have been either added or
  67       * removed from the selection.
  68       *
  69       * @param source source of event
  70       * @param paths the paths that have changed in the selection
  71       */
  72     public TreeSelectionEvent(Object source, TreePath[] paths,