1 /*******************************************************************************
2 * Copyright (c) 2003, 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.browser;
16 import java.util.function.*;
18 import org.eclipse.swt.internal.*;
21 * This listener interface may be implemented in order to receive
22 * a {@link ProgressEvent} notification when a {@link Browser}
23 * makes a progress in loading the current URL or when the
24 * current URL has been loaded.
26 * @see Browser#addProgressListener(ProgressListener)
27 * @see Browser#removeProgressListener(ProgressListener)
28 * @see Browser#getUrl()
32 public interface ProgressListener extends SWTEventListener {
35 * This method is called when a progress is made during the loading of the
39 * <p>The following fields in the <code>ProgressEvent</code> apply:</p>
41 * <li>(in) current the progress for the location currently being loaded
42 * <li>(in) total the maximum progress for the location currently being loaded
43 * <li>(in) widget the <code>Browser</code> whose current URL is being loaded
46 * @param event the <code>ProgressEvent</code> related to the loading of the
47 * current location of a <code>Browser</code>
51 public void changed(ProgressEvent event);
54 * This method is called when the current location has been completely loaded.
57 * <p>The following fields in the <code>ProgressEvent</code> apply:</p>
59 * <li>(in) widget the <code>Browser</code> whose current URL has been loaded
62 * @param event the <code>ProgressEvent</code> related to the <code>Browser</code>
63 * that has loaded its current URL.
67 public void completed(ProgressEvent event);
70 * Static helper method to create a <code>ProgressListener</code> for the
71 * {@link #changed(ProgressEvent e)}) method, given a lambda expression or a method reference.
73 * @param c the consumer of the event
74 * @return LocationListener
77 public static ProgressListener changedAdapter(Consumer<ProgressEvent> c) {
78 return new ProgressAdapter() {
80 public void changed(ProgressEvent e) {
87 * Static helper method to create a <code>ProgressListener</code> for the
88 * {@link #completed(ProgressEvent e)}) method, given a lambda expression or a method reference.
90 * @param c the consumer of the event
91 * @return LocationListener
94 public static ProgressListener completedAdapter(Consumer<ProgressEvent> c) {
95 return new ProgressAdapter() {
97 public void completed(ProgressEvent e) {