]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/browser/LocationListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / browser / LocationListener.java
1 /*******************************************************************************
2  * Copyright (c) 2003, 2017 IBM Corporation and others.
3  *
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/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.browser;
15
16 import java.util.function.*;
17
18 import org.eclipse.swt.internal.*;
19
20 /**
21  * This listener interface may be implemented in order to receive
22  * a {@link LocationEvent} notification when a {@link Browser}
23  * navigates to a different URL.
24  *
25  * @see Browser#addLocationListener(LocationListener)
26  * @see Browser#removeLocationListener(LocationListener)
27  * @see LocationAdapter
28  *
29  * @since 3.0
30  */
31 public interface LocationListener extends SWTEventListener {
32
33 /**
34  * This method is called when the current location is about to be changed.
35  *
36  * <p>The following fields in the <code>LocationEvent</code> apply:</p>
37  * <ul>
38  * <li>(in) location the location to be loaded
39  * <li>(in) widget the <code>Browser</code> whose location is changing
40  * <li>(in/out) doit can be set to <code>false</code> to prevent the location
41  * from being loaded
42  * </ul>
43  *
44  * @param event the <code>LocationEvent</code> that specifies the location
45  * to be loaded by a <code>Browser</code>
46  *
47  * @since 3.0
48  */
49 public void changing(LocationEvent event);
50
51 /**
52  * This method is called when the current location is changed.
53  *
54  * <p>The following fields in the <code>LocationEvent</code> apply:</p>
55  * <ul>
56  * <li>(in) location the current location
57  * <li>(in) top <code>true</code> if the location opens in the top frame or
58  * <code>false</code> otherwise
59  * <li>(in) widget the <code>Browser</code> whose location has changed
60  * </ul>
61  *
62  * @param event the <code>LocationEvent</code> that specifies  the new
63  * location of a <code>Browser</code>
64  *
65  * @since 3.0
66  */
67 public void changed(LocationEvent event);
68
69 /**
70  * Static helper method to create a <code>LocationListener</code> for the
71  * {@link #changing(LocationEvent e)}) method, given a lambda expression or a method reference.
72  *
73  * @param c the consumer of the event
74  * @return LocationListener
75  * @since 3.107
76  */
77 public static LocationListener changingAdapter(Consumer<LocationEvent> c) {
78         return new LocationAdapter() {
79                 @Override
80                 public void changing(LocationEvent e) {
81                         c.accept(e);
82                 }
83         };
84 }
85
86 /**
87  * Static helper method to create a <code>LocationListener</code> for the
88  * {@link #changed(LocationEvent e)}) method, given a lambda expression or a method reference.
89  *
90  * @param c the consumer of the event
91  * @return LocationListener
92  * @since 3.107
93  */
94 public static LocationListener changedAdapter(Consumer<LocationEvent> c) {
95         return new LocationAdapter() {
96                 @Override
97                 public void changed(LocationEvent e) {
98                         c.accept(e);
99                 }
100         };
101 }
102
103 }