KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > TreeExpansionEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 import java.util.EventObject JavaDoc;
14
15 /**
16  * Event object describing a tree node being expanded
17  * or collapsed. The source of these events is the tree viewer.
18  *
19  * @see ITreeViewerListener
20  */

21 public class TreeExpansionEvent extends EventObject JavaDoc {
22
23     /**
24      * Generated serial version UID for this class.
25      * @since 3.1
26      */

27     private static final long serialVersionUID = 3618414930227835185L;
28     
29     /**
30      * The element that was expanded or collapsed.
31      */

32     private Object JavaDoc element;
33
34     /**
35      * Creates a new event for the given source and element.
36      *
37      * @param source the tree viewer
38      * @param element the element
39      */

40     public TreeExpansionEvent(AbstractTreeViewer source, Object JavaDoc element) {
41         super(source);
42         this.element = element;
43     }
44
45     /**
46      * Returns the element that got expanded or collapsed.
47      *
48      * @return the element
49      */

50     public Object JavaDoc getElement() {
51         return element;
52     }
53
54     /**
55      * Returns the originator of the event.
56      *
57      * @return the originating tree viewer
58      */

59     public AbstractTreeViewer getTreeViewer() {
60         return (AbstractTreeViewer) source;
61     }
62 }
63
Popular Tags