Line 0
Link Here
|
|
|
1 |
/* |
2 |
|
3 |
Licensed to the Apache Software Foundation (ASF) under one or more |
4 |
contributor license agreements. See the NOTICE file distributed with |
5 |
this work for additional information regarding copyright ownership. |
6 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
7 |
(the "License"); you may not use this file except in compliance with |
8 |
the License. You may obtain a copy of the License at |
9 |
|
10 |
http://www.apache.org/licenses/LICENSE-2.0 |
11 |
|
12 |
Unless required by applicable law or agreed to in writing, software |
13 |
distributed under the License is distributed on an "AS IS" BASIS, |
14 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 |
See the License for the specific language governing permissions and |
16 |
limitations under the License. |
17 |
|
18 |
*/ |
19 |
package org.apache.batik.bridge; |
20 |
|
21 |
import java.net.URL; |
22 |
import org.apache.batik.bridge.BridgeContext; |
23 |
import org.apache.batik.dom.svg.SVGOMDocument; |
24 |
|
25 |
/** |
26 |
* This class implements the org.w3c.dom.Location interface for Batik |
27 |
* |
28 |
* @author <a href="mailto:gwadej@anomaly.org">G. Wade Johnson</a> |
29 |
* @version $Id: Loaction.java$ |
30 |
*/ |
31 |
public class Location implements org.w3c.dom.Location { |
32 |
private BridgeContext bridgeContext; |
33 |
|
34 |
/** |
35 |
* Creates a new Location. |
36 |
* @param ctx the bridge context |
37 |
*/ |
38 |
public Location(BridgeContext ctx) { |
39 |
bridgeContext = ctx; |
40 |
} |
41 |
|
42 |
|
43 |
/** |
44 |
* Invocation of this method causes the user agent to navigate to the |
45 |
* supplied location. |
46 |
* |
47 |
* @param url A string containing the URL where the user agent should |
48 |
* navigate. |
49 |
*/ |
50 |
public void assign(String url) { |
51 |
((UserAgent)bridgeContext.getUserAgent()).loadDocument( url ); |
52 |
} |
53 |
|
54 |
/** |
55 |
* The user agent reloads the current document. |
56 |
*/ |
57 |
public void reload() { |
58 |
URL url = ((SVGOMDocument) bridgeContext.getDocument()) |
59 |
.getURLObject(); |
60 |
((UserAgent)bridgeContext.getUserAgent()).loadDocument( url.toString() ); |
61 |
} |
62 |
} |
63 |
|