View | Details | Raw Unified | Return to bug 46072
Collapse All | Expand All

(-)sources/org/apache/batik/swing/svg/JSVGComponent.java (-1 / +19 lines)
Lines 3082-3087 Link Here
3082
            } catch (Exception e) {
3082
            } catch (Exception e) {
3083
            }
3083
            }
3084
        }
3084
        }
3085
3086
        /**
3087
         * This method should load a new document described by the supplied URL.
3088
         *
3089
         * @param url The url to be loaded as a string.
3090
         */
3091
        public void loadDocument(String url) {
3092
            userAgent.loadDocument(url);
3093
        }
3085
    }
3094
    }
3086
3095
3087
    /**
3096
    /**
Lines 3126-3132 Link Here
3126
            if (svgUserAgent != null) {
3135
            if (svgUserAgent != null) {
3127
                svgUserAgent.displayError(ex);
3136
                svgUserAgent.displayError(ex);
3128
            }
3137
            }
3129
        }
3138
        } 
3130
3139
3131
        /**
3140
        /**
3132
         * Displays a message in the User Agent interface.
3141
         * Displays a message in the User Agent interface.
Lines 3677-3682 Link Here
3677
            }
3686
            }
3678
            return doc;
3687
            return doc;
3679
        }
3688
        }
3689
3690
        /**
3691
         * This method should load a new document described by the supplied URL.
3692
         *
3693
         * @param url The url to be loaded as a string.
3694
         */
3695
        public void loadDocument(String url) {
3696
            JSVGComponent.this.loadSVGDocument(url);
3697
        }
3680
    }
3698
    }
3681
3699
3682
    protected static final Set FEATURES = new HashSet();
3700
    protected static final Set FEATURES = new HashSet();
(-)sources/org/apache/batik/bridge/Location.java (+63 lines)
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
(-)sources/org/apache/batik/bridge/UserAgent.java (+7 lines)
Lines 299-302 Link Here
299
     *                loaded (not available, corrupt, unknown format, ...).
299
     *                loaded (not available, corrupt, unknown format, ...).
300
     */
300
     */
301
    SVGDocument getBrokenLinkDocument(Element e, String url, String message);
301
    SVGDocument getBrokenLinkDocument(Element e, String url, String message);
302
303
    /**
304
     * This method should load a new document described by the supplied URL.
305
     *
306
     * @param url The url to be loaded as a string.
307
     */
308
    void loadDocument(String url);
302
}
309
}
(-)sources/org/apache/batik/bridge/ScriptingEnvironment.java (+24 lines)
Lines 49-54 Link Here
49
import org.apache.batik.dom.util.DOMUtilities;
49
import org.apache.batik.dom.util.DOMUtilities;
50
import org.apache.batik.dom.util.SAXDocumentFactory;
50
import org.apache.batik.dom.util.SAXDocumentFactory;
51
import org.apache.batik.dom.util.XLinkSupport;
51
import org.apache.batik.dom.util.XLinkSupport;
52
import org.apache.batik.bridge.Location;
52
import org.apache.batik.script.Interpreter;
53
import org.apache.batik.script.Interpreter;
53
import org.apache.batik.script.InterpreterException;
54
import org.apache.batik.script.InterpreterException;
54
import org.apache.batik.script.ScriptEventWrapper;
55
import org.apache.batik.script.ScriptEventWrapper;
Lines 917-927 Link Here
917
        protected String language;
918
        protected String language;
918
919
919
        /**
920
        /**
921
         * The Location object
922
         */
923
        protected Location location;
924
925
        /**
920
         * Creates a new Window for the given language.
926
         * Creates a new Window for the given language.
921
         */
927
         */
922
        public Window(Interpreter interp, String lang) {
928
        public Window(Interpreter interp, String lang) {
923
            interpreter = interp;
929
            interpreter = interp;
924
            language = lang;
930
            language = lang;
931
            location = null;
925
        }
932
        }
926
933
927
        /**
934
        /**
Lines 1316-1321 Link Here
1316
        public Interpreter getInterpreter() {
1323
        public Interpreter getInterpreter() {
1317
            return interpreter;
1324
            return interpreter;
1318
        }
1325
        }
1326
1327
        /**
1328
         * Returns a Window object representing the parent of this Window.
1329
         */
1330
        public Window getParent() {
1331
            return null;
1332
        }
1333
1334
        /**
1335
         * Returns a Location object representing this Window.
1336
         */
1337
        public Location getLocation() {
1338
            if( null == location ) {
1339
                location = new Location( bridgeContext );
1340
            }
1341
            return location;
1342
        }
1319
    }
1343
    }
1320
1344
1321
    /**
1345
    /**
(-)sources/org/apache/batik/script/rhino/WindowWrapper.java (+18 lines)
Lines 33-38 Link Here
33
33
34
import org.w3c.dom.Document;
34
import org.w3c.dom.Document;
35
import org.w3c.dom.Node;
35
import org.w3c.dom.Node;
36
import org.w3c.dom.Location;
36
37
37
/**
38
/**
38
 * This class wraps a Window object to expose it to the interpreter.
39
 * This class wraps a Window object to expose it to the interpreter.
Lines 66-71 Link Here
66
                           "postURL", "alert", "confirm", "prompt" };
67
                           "postURL", "alert", "confirm", "prompt" };
67
        this.defineFunctionProperties(names, WindowWrapper.class,
68
        this.defineFunctionProperties(names, WindowWrapper.class,
68
                                      ScriptableObject.DONTENUM);
69
                                      ScriptableObject.DONTENUM);
70
        this.defineProperty("location", WindowWrapper.class,
71
                            ScriptableObject.PERMANENT );
69
    }
72
    }
70
73
71
    public String getClassName() {
74
    public String getClassName() {
Lines 406-411 Link Here
406
    }
409
    }
407
410
408
    /**
411
    /**
412
     * Return the Location for this Window.
413
     */
414
    public Location getLocation() {
415
        return window.getLocation();
416
    }
417
418
    /**
419
     * Return the Location for this Window.
420
     */
421
    public void setLocation(Object val) {
422
        String url = (String)Context.jsToJava(val, String.class);
423
        window.getLocation().assign(url);
424
    }
425
426
    /**
409
     * To wrap a function in an handler.
427
     * To wrap a function in an handler.
410
     */
428
     */
411
    protected static class FunctionWrapper implements Runnable {
429
    protected static class FunctionWrapper implements Runnable {
(-)sources/org/apache/batik/script/Window.java (-1 / +2 lines)
Lines 22-27 Link Here
22
import org.apache.batik.bridge.BridgeContext;
22
import org.apache.batik.bridge.BridgeContext;
23
import org.w3c.dom.Document;
23
import org.w3c.dom.Document;
24
import org.w3c.dom.Node;
24
import org.w3c.dom.Node;
25
import org.w3c.dom.Location;
25
26
26
/**
27
/**
27
 * This interface represents the 'window' object defined in the global
28
 * This interface represents the 'window' object defined in the global
Lines 30-36 Link Here
30
 * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
31
 * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
31
 * @version $Id$
32
 * @version $Id$
32
 */
33
 */
33
public interface Window {
34
public interface Window extends org.w3c.dom.Window {
34
    /**
35
    /**
35
     * Evaluates the given string repeatedly after the given amount of
36
     * Evaluates the given string repeatedly after the given amount of
36
     * time.  This method does not stall the script: the evaluation is
37
     * time.  This method does not stall the script: the evaluation is
(-)sources/org/w3c/dom/Window.java (+24 lines)
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.w3c.dom;
20
21
public interface Window {
22
    Window getParent();
23
    Location getLocation();
24
}
(-)sources/org/w3c/dom/Location.java (+35 lines)
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.w3c.dom;
20
21
public interface Location {
22
    /**
23
     * Invocation of this method causes the user agent to navigate to the
24
     * supplied location.
25
     *
26
     * @param url A string containing the URL where the user agent should
27
     *    navigate.
28
     */
29
    void assign(String url);
30
31
    /**
32
     * The user agent reloads the current document.
33
     */
34
    void reload();
35
}

Return to bug 46072