1 /*******************************************************************************
2 * Copyright (c) 2000, 2017 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.events;
17 import java.util.function.*;
19 import org.eclipse.swt.internal.*;
22 * Classes which implement this interface provide methods
23 * that deal with the expanding and collapsing of tree
26 * After creating an instance of a class that implements
27 * this interface it can be added to a tree control using the
28 * <code>addTreeListener</code> method and removed using
29 * the <code>removeTreeListener</code> method. When a branch
30 * of the tree is expanded or collapsed, the appropriate method
37 public interface TreeListener extends SWTEventListener {
40 * Sent when a tree branch is collapsed.
42 * @param e an event containing information about the tree operation
44 void treeCollapsed(TreeEvent e);
47 * Sent when a tree branch is expanded.
49 * @param e an event containing information about the tree operation
51 void treeExpanded(TreeEvent e);
54 * Static helper method to create a <code>TreeListener</code> for the
55 * {@link #treeCollapsed(TreeEvent e)}) method, given a lambda expression or a method reference.
57 * @param c the consumer of the event
58 * @return TreeListener
61 static TreeListener treeCollapsedAdapter(Consumer<TreeEvent> c) {
62 return new TreeAdapter() {
64 public void treeCollapsed(TreeEvent e) {
71 * Static helper method to create a <code>TreeListener</code> for the
72 * {@link #treeExpanded(TreeEvent e)}) method, given a lambda expression or a method reference.
74 * @param c the consumer of the event
75 * @return TreeListener
78 static TreeListener treeExpandedAdapter(Consumer<TreeEvent> c) {
79 return new TreeAdapter() {
81 public void treeExpanded(TreeEvent e) {