1 /*******************************************************************************
2 * Copyright (c) 2003, 2012 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 org.eclipse.swt.events.*;
17 import org.eclipse.swt.widgets.*;
20 * A <code>LocationEvent</code> is sent by a {@link Browser} to
21 * {@link LocationListener}'s when the <code>Browser</code>
22 * navigates to a different URL. This notification typically
23 * occurs when the application navigates to a new location with
24 * {@link Browser#setUrl(String)} or when the user activates a
27 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
31 public class LocationEvent extends TypedEvent {
33 * The URL of this event, escaped and encoded for consumption by
34 * {@link java.net.URI#URI(String)}.
36 public String location;
39 * A flag indicating whether the location opens in the top frame
45 * A flag indicating whether the location loading should be allowed.
46 * Setting this field to <code>false</code> will cancel the operation.
50 static final long serialVersionUID = 3906644198244299574L;
53 * Constructs a new instance of this class.
55 * @param widget the widget that fired the event
59 public LocationEvent(Widget widget) {
64 * Returns a string containing a concise, human-readable
65 * description of the receiver.
67 * @return a string representation of the event
70 public String toString() {
71 String string = super.toString ();
72 return string.substring (0, string.length() - 1) // remove trailing '}'
73 + " location=" + location