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 <code>ExpandItem</code>s.
26 * After creating an instance of a class that implements
27 * this interface it can be added to a <code>ExpandBar</code>
28 * control using the <code>addExpandListener</code> method and
29 * removed using the <code>removeExpandListener</code> method.
30 * When a item of the <code>ExpandBar</code> is expanded or
31 * collapsed, the appropriate method will be invoked.
39 public interface ExpandListener extends SWTEventListener {
42 * Sent when an item is collapsed.
44 * @param e an event containing information about the operation
46 void itemCollapsed(ExpandEvent e);
49 * Sent when an item is expanded.
51 * @param e an event containing information about the operation
53 void itemExpanded(ExpandEvent e);
56 * Static helper method to create a <code>ExpandListener</code> for the
57 * {@link #itemCollapsed(ExpandEvent e)}) method, given a lambda expression or a method reference.
59 * @param c the consumer of the event
60 * @return ExpandListener
63 static ExpandListener itemCollapsedAdapter(Consumer<ExpandEvent> c) {
64 return new ExpandAdapter() {
66 public void itemCollapsed(ExpandEvent e) {
73 * Static helper method to create a <code>ExpandListener</code> for the
74 * {@link #itemExpanded(ExpandEvent e)}) method, given a lambda expression or a method reference.
76 * @param c the consumer of the event
77 * @return ExpandListener
80 static ExpandListener itemExpandedAdapter(Consumer<ExpandEvent> c) {
81 return new ExpandAdapter() {
83 public void itemExpanded(ExpandEvent e) {