You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/10/08 16:03:37 UTC

[22/62] [abbrv] [partial] Merged Apache Flex 4.9.0 release branch

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/LocalHistory.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/LocalHistory.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/LocalHistory.java
deleted file mode 100644
index 92b6033..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/LocalHistory.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
-
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JRadioButtonMenuItem;
-
-/**
- * This class represents an history of the files visited by a single
- * browser frame.
- *
- * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: LocalHistory.java,v 1.12 2004/08/18 07:12:27 vhardy Exp $
- */
-public class LocalHistory {
-    /**
-     * The frame to manage.
-     */
-    protected JSVGViewerFrame svgFrame;    
-
-    /**
-     * The menu which contains the history.
-     */
-    protected JMenu menu;
-
-    /**
-     * The index of the first history item in this menu.
-     */
-    protected int index;
-
-    /**
-     * The visited URIs.
-     */
-    protected List visitedURIs = new ArrayList();
-
-    /**
-     * The index of the current URI.
-     */
-    protected int currentURI = -1;
-
-    /**
-     * The button group for the menu items.
-     */
-    protected ButtonGroup group = new ButtonGroup();
-
-    /**
-     * The action listener.
-     */
-    protected ActionListener actionListener = new RadioListener();
-
-    /**
-     * The current state.
-     */
-    protected int state;
-
-    // States
-    protected final static int STABLE_STATE = 0;
-    protected final static int BACK_PENDING_STATE = 1;
-    protected final static int FORWARD_PENDING_STATE = 2;
-    protected final static int RELOAD_PENDING_STATE = 3;
-
-    /**
-     * Creates a new local history.
-     * @param mb The menubar used to display the history. It must
-     *        contains one '@@@' item used as marker to place the
-     *        history items.
-     * @param svgFrame The frame to manage.
-     */
-    public LocalHistory(JMenuBar mb, JSVGViewerFrame svgFrame) {
-        this.svgFrame = svgFrame;
-
-        // Find the marker.
-        int mc = mb.getMenuCount();
-        for (int i = 0; i < mc; i++) {
-            JMenu m = mb.getMenu(i);
-            int ic = m.getItemCount();
-            for (int j = 0; j < ic; j++) {
-                JMenuItem mi = m.getItem(j);
-                if (mi != null) {
-                    String s = mi.getText();
-                    if ("@@@".equals(s)) {
-                        menu = m;
-                        index = j;
-                        m.remove(j);
-                        return;
-                    }
-                }
-            }
-        }
-        throw new IllegalArgumentException("No '@@@' marker found");
-    }
-
-    /**
-     * Goes back of one position in the history.
-     * Assumes that <tt>canGoBack()</tt> is true.
-     */
-    public void back() {
-        update();
-        state = BACK_PENDING_STATE;
-        currentURI -= 2;
-        svgFrame.showSVGDocument((String)visitedURIs.get(currentURI + 1));
-    }
-
-    /**
-     * Whether it is possible to go back.
-     */
-    public boolean canGoBack() {
-        return currentURI > 0;
-    }
-
-    /**
-     * Goes forward of one position in the history.
-     * Assumes that <tt>canGoForward()</tt> is true.
-     */
-    public void forward() {
-        update();
-        state = FORWARD_PENDING_STATE;
-        svgFrame.showSVGDocument((String)visitedURIs.get(currentURI + 1));
-    }
-
-    /**
-     * Whether it is possible to go forward.
-     */
-    public boolean canGoForward() {
-        return currentURI < visitedURIs.size() - 1;
-    }
-
-    /**
-     * Reloads the current document.
-     */
-    public void reload() {
-        update();
-        state = RELOAD_PENDING_STATE;
-        currentURI--;
-        svgFrame.showSVGDocument((String)visitedURIs.get(currentURI + 1));
-    }
-
-    /**
-     * Updates the history.
-     * @param uri The URI of the document just loaded.
-     */
-    public void update(String uri) {
-        if (currentURI < -1) {
-            throw new InternalError();
-        }
-        state = STABLE_STATE;
-        if (++currentURI < visitedURIs.size()) {
-            if (!visitedURIs.get(currentURI).equals(uri)) {
-                int len = menu.getItemCount();
-                for (int i = len - 1; i >= index + currentURI + 1; i--) {
-                    JMenuItem mi = menu.getItem(i);
-                    group.remove(mi);
-                    menu.remove(i);
-                }
-                visitedURIs = visitedURIs.subList(0, currentURI + 1);
-            }
-            JMenuItem mi = menu.getItem(index + currentURI);
-            group.remove(mi);
-            menu.remove(index + currentURI);
-            visitedURIs.set(currentURI, uri);
-        } else {
-            if (visitedURIs.size() >= 15) {
-                visitedURIs.remove(0);
-                JMenuItem mi = menu.getItem(index);
-                group.remove(mi);
-                menu.remove(index);
-                currentURI--;
-            }
-            visitedURIs.add(uri);
-        }
-
-        // Computes the button text.
-        String text = uri;
-        int i = uri.lastIndexOf("/");
-        if (i == -1) {
-            i = uri.lastIndexOf("\\");
-            if (i != -1) {
-                text = uri.substring(i + 1);
-            }
-        } else {
-            text = uri.substring(i + 1);
-        }
-
-        JMenuItem mi = new JRadioButtonMenuItem(text);
-        mi.setActionCommand(uri);
-        mi.addActionListener(actionListener);
-        group.add(mi);
-        mi.setSelected(true);
-        menu.insert(mi, index + currentURI);
-    }
-
-    /**
-     * Updates the state of this history.
-     */
-    protected void update() {
-        switch (state) {
-        case BACK_PENDING_STATE:
-            currentURI += 2;
-            break;
-        case RELOAD_PENDING_STATE:
-            currentURI++;
-        case FORWARD_PENDING_STATE:
-        case STABLE_STATE:
-        }
-    }
-
-    /**
-     * To listen to the radio buttons.
-     */
-    protected class RadioListener implements ActionListener {
-        public RadioListener() {}
-	public void actionPerformed(ActionEvent e) {
-	    String uri = e.getActionCommand();
-            currentURI = getItemIndex((JMenuItem)e.getSource()) - 1;
-	    svgFrame.showSVGDocument(uri);
-	}
-        public int getItemIndex(JMenuItem item) {
-            int ic = menu.getItemCount();
-            for (int i = index; i < ic; i++) {
-                if (menu.getItem(i) == item) {
-                    return i - index;
-                }
-            }
-            throw new InternalError();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/Main.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/Main.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/Main.java
deleted file mode 100644
index eecc1ab..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/Main.java
+++ /dev/null
@@ -1,872 +0,0 @@
-/*
-
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.Font;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.Authenticator;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ImageIcon;
-import javax.swing.JOptionPane;
-import javax.swing.JProgressBar;
-import javax.swing.UIManager;
-import javax.swing.plaf.FontUIResource;
-
-import org.apache.flex.forks.batik.swing.JSVGCanvas;
-import org.apache.flex.forks.batik.swing.gvt.GVTTreeRendererAdapter;
-import org.apache.flex.forks.batik.swing.gvt.GVTTreeRendererEvent;
-import org.apache.flex.forks.batik.swing.svg.GVTTreeBuilderAdapter;
-import org.apache.flex.forks.batik.swing.svg.GVTTreeBuilderEvent;
-import org.apache.flex.forks.batik.swing.svg.SVGDocumentLoaderAdapter;
-import org.apache.flex.forks.batik.swing.svg.SVGDocumentLoaderEvent;
-import org.apache.flex.forks.batik.util.ApplicationSecurityEnforcer;
-import org.apache.flex.forks.batik.util.ParsedURL;
-import org.apache.flex.forks.batik.util.SVGConstants;
-import org.apache.flex.forks.batik.util.XMLResourceDescriptor;
-import org.apache.flex.forks.batik.util.gui.resource.ResourceManager;
-
-/**
- * This class contains the main method of an SVG viewer.
- *
- * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: Main.java,v 1.53 2005/03/29 10:48:02 deweese Exp $
- */
-public class Main implements Application {
-    /**
-     * Extension used in addition to the scriptType value
-     * to read from the PreferenceManager whether or not the
-     * scriptType can be loaded.
-     */
-    public static final String UNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION 
-        = ".load";
-
-    /**
-     * User home property
-     */
-    public static final String PROPERTY_USER_HOME = "user.home";
-
-    /**
-     * System property for specifying an additional policy file.
-     */
-    public static final String PROPERTY_JAVA_SECURITY_POLICY 
-        = "java.security.policy";
-
-    /**
-     * Batik configuration sub-directory
-     */
-    public static final String BATIK_CONFIGURATION_SUBDIRECTORY = ".batik";
-
-    /**
-     * Name of the Squiggle configuration file
-     */
-    public static final String SQUIGGLE_CONFIGURATION_FILE = "preferences.xml";
-
-    /**
-     * Name of the Squiggle policy file
-     */
-    public static final String SQUIGGLE_POLICY_FILE = "__svgbrowser.policy";
-
-    /**
-     * Entry for granting network access to scripts
-     */
-    public static final String POLICY_GRANT_SCRIPT_NETWORK_ACCESS
-        = "grant {\n  permission java.net.SocketPermission \"*\", \"listen, connect, resolve, accept\";\n};\n\n";
-
-    /**
-     * Entry for granting file system access to scripts
-     */
-    public static final String POLICY_GRANT_SCRIPT_FILE_ACCESS
-        = "grant {\n  permission java.io.FilePermission \"<<ALL FILES>>\", \"read\";\n};\n\n";
-
-    /**
-     * Entry for the list of recently visited URI
-     */
-    public static final String PREFERENCE_KEY_VISITED_URI_LIST
-        = "preference.key.visited.uri.list";
-
-    /**
-     * Entry for the maximum number of last visited URIs
-     */
-    public static final String PREFERENCE_KEY_VISITED_URI_LIST_LENGTH
-        = "preference.key.visited.uri.list.length";
-
-    /**
-     * List of separators between URI values in the preference
-     * file
-     */
-    public static final String URI_SEPARATOR = " ";
-
-    /**
-     * Default font-family value. 
-     */
-    public static final String DEFAULT_DEFAULT_FONT_FAMILY 
-        = "Arial, Helvetica, sans-serif";
-
-    /**
-     * SVG initialization file, used to trigger loading of most of
-     * the Batik classes
-     */
-    public static final String SVG_INITIALIZATION = "resources/init.svg";
-
-    /**
-     * Stores the initialization file URI
-     */
-    protected String svgInitializationURI;
-
-    /**
-     * Creates a viewer frame and shows it..
-     * @param args The command-line arguments.
-     */
-    public static void main(String[] args) {
-        new Main(args);
-    }
-
-    /**
-     * The gui resources file name
-     */
-    public final static String RESOURCES =
-        "org.apache.flex.forks.batik.apps.svgbrowser.resources.Main";
-
-    /**
-     * URL for Squiggle's security policy file
-     */
-    public static final String SQUIGGLE_SECURITY_POLICY
-        = "org/apache/batik/apps/svgbrowser/resources/svgbrowser.policy"; 
-
-    /**
-     * The resource bundle
-     */
-    protected static ResourceBundle bundle;
-
-    /**
-     * The resource manager
-     */
-    protected static ResourceManager resources;
-    static {
-        bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault());
-        resources = new ResourceManager(bundle);
-    }
-
-    /**
-     * The frame's icon.
-     */
-    protected static ImageIcon frameIcon = new ImageIcon
-        (Main.class.getResource(resources.getString("Frame.icon")));
-
-    /**
-     * The preference manager.
-     */
-    protected XMLPreferenceManager preferenceManager;
-
-    /**
-     * Maximum number of recently visited URIs
-     */
-    public static final int MAX_VISITED_URIS = 10;
-
-    /**
-     * The array of last visited URIs
-     */
-    protected Vector lastVisited = new Vector();
-
-    /**
-     * The actual allowed maximum number of last visited URIs
-     */
-    protected int maxVisitedURIs = MAX_VISITED_URIS;
-
-    /**
-     * The arguments.
-     */
-    protected String[] arguments;
-
-    /**
-     * Controls whether the application can override the 
-     * system security policy property. This is done when there
-     * was no initial security policy specified when the application
-     * stated, in which case Batik will use that property.
-     */
-    protected boolean overrideSecurityPolicy = false;
-
-    /**
-     * Script security enforcement is delegated to the 
-     * security utility 
-     */
-    protected ApplicationSecurityEnforcer securityEnforcer;
-
-    /**
-     * The option handlers.
-     */
-    protected Map handlers = new HashMap();
-    {
-        handlers.put("-font-size", new FontSizeHandler());
-    }
-
-    /**
-     * The viewer frames.
-     */
-    protected List viewerFrames = new LinkedList();
-
-    /**
-     * The preference dialog.
-     */
-    protected PreferenceDialog preferenceDialog;
-
-    /**
-     * Creates a new application.
-     * @param args The command-line arguments.
-     */
-    public Main(String[] args) {
-        arguments = args;
-
-        //
-        // Preferences
-        //
-        Map defaults = new HashMap(11);
-
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_LANGUAGES,
-                     Locale.getDefault().getLanguage());
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_SHOW_RENDERING,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_AUTO_ADJUST_WINDOW,
-                     Boolean.TRUE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_SELECTION_XOR_MODE,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING,
-                     Boolean.TRUE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_SHOW_DEBUG_TRACE,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_PROXY_HOST,
-                     "");
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_PROXY_PORT,
-                     "");
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_CSS_MEDIA,
-                     "screen");
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_DEFAULT_FONT_FAMILY,
-                     DEFAULT_DEFAULT_FONT_FAMILY);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_IS_XML_PARSER_VALIDATING,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING,
-                     Boolean.TRUE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS,
-                     Boolean.FALSE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_LOAD_JAVA,
-                     Boolean.TRUE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT,
-                     Boolean.TRUE);
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN,
-                     new Integer(ResourceOrigin.DOCUMENT));
-        defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN,
-                     new Integer(ResourceOrigin.ANY));
-        defaults.put(PREFERENCE_KEY_VISITED_URI_LIST,
-                     "");
-        defaults.put(PREFERENCE_KEY_VISITED_URI_LIST_LENGTH,
-                     new Integer(MAX_VISITED_URIS));
-	
-        securityEnforcer 
-            = new ApplicationSecurityEnforcer(this.getClass(),
-                                              SQUIGGLE_SECURITY_POLICY);
-
-        try {
-            preferenceManager = new XMLPreferenceManager(SQUIGGLE_CONFIGURATION_FILE,
-                                                         defaults);
-            String dir = System.getProperty(PROPERTY_USER_HOME);
-            File f = new File(dir, BATIK_CONFIGURATION_SUBDIRECTORY);
-            f.mkdir();
-            XMLPreferenceManager.setPreferenceDirectory(f.getCanonicalPath());
-            preferenceManager.load();
-            setPreferences();
-            initializeLastVisited();
-            Authenticator.setDefault(new JAuthenticator());
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        //
-        // Initialization
-        //
-        final AboutDialog initDialog = new AboutDialog();
-        final JProgressBar pb = new JProgressBar(0, 3);
-        initDialog.getContentPane().add("South", pb);
-
-        // Work around pack() bug on some platforms
-        Dimension ss = initDialog.getToolkit().getScreenSize();
-        Dimension ds = initDialog.getPreferredSize();
-
-        initDialog.setLocation((ss.width  - ds.width) / 2,
-                               (ss.height - ds.height) / 2);
-
-        initDialog.setSize(ds);
-        initDialog.setVisible(true);
-
-        final JSVGViewerFrame v = new JSVGViewerFrame(this);
-        JSVGCanvas c = v.getJSVGCanvas();
-        c.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() {
-            public void documentLoadingStarted(SVGDocumentLoaderEvent e) {
-                pb.setValue(1);
-            }
-            public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
-                pb.setValue(2);
-            }
-        });
-        c.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() {
-            public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
-                pb.setValue(3);
-            }
-        });
-        c.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
-            public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
-                initDialog.dispose();
-                v.dispose();
-                System.gc();
-                run();
-            }
-        });
-
-        c.setSize(100, 100);
-        svgInitializationURI = Main.class.getResource(SVG_INITIALIZATION).toString();
-        c.loadSVGDocument(svgInitializationURI);
-    }
-
-    /**
-     * Installs a custom policy file in the '.batik' directory. This is initialized 
-     * with the content of the policy file coming with the distribution
-     */
-    public void installCustomPolicyFile() throws IOException {
-        String securityPolicyProperty 
-            = System.getProperty(PROPERTY_JAVA_SECURITY_POLICY);
-
-        if (overrideSecurityPolicy
-            ||
-            securityPolicyProperty == null
-            ||
-            "".equals(securityPolicyProperty)) {
-            // Access default policy file
-            ParsedURL policyURL = new ParsedURL(securityEnforcer.getPolicyURL());
-            
-            // Override the user policy 
-            String dir = System.getProperty(PROPERTY_USER_HOME);
-            File batikConfigDir = new File(dir, BATIK_CONFIGURATION_SUBDIRECTORY);
-            File policyFile = new File(batikConfigDir, SQUIGGLE_POLICY_FILE);
-            
-            // Copy original policy file into local policy file
-            Reader r = new BufferedReader(new InputStreamReader(policyURL.openStream()));
-            Writer w = new FileWriter(policyFile);
-            
-            char[] buf = new char[1024];
-            int n = 0;
-            while ( (n=r.read(buf, 0, buf.length)) != -1 ) {
-                w.write(buf, 0, n);
-            }
-            
-            r.close();
-            
-            // Now, append additional grants depending on the security
-            // settings
-            boolean grantScriptNetworkAccess 
-                = preferenceManager.getBoolean
-                (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS);
-            boolean grantScriptFileAccess
-                = preferenceManager.getBoolean
-                (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS);
-            
-            if (grantScriptNetworkAccess) {
-                w.write(POLICY_GRANT_SCRIPT_NETWORK_ACCESS);
-            }
-            
-            if (grantScriptFileAccess) {
-                w.write(POLICY_GRANT_SCRIPT_FILE_ACCESS);
-            }
-            
-            w.close();
-            
-            // We now use the JAVA_SECURITY_POLICY property, so 
-            // we allow override on subsequent calls.
-            overrideSecurityPolicy = true;
-            
-            System.setProperty(PROPERTY_JAVA_SECURITY_POLICY,
-                               policyFile.toURL().toString());
-            
-        }
-    }
-
-    /**
-     * Runs the application.
-     */
-    public void run() {
-        try {
-            int i = 0;
-
-            for (; i < arguments.length; i++) {
-                OptionHandler oh = (OptionHandler)handlers.get(arguments[i]);
-                if (oh == null) {
-                    break;
-                }
-                i = oh.handleOption(i);
-            }
-
-            JSVGViewerFrame frame = createAndShowJSVGViewerFrame();
-            while (i < arguments.length) {
-                if (arguments[i].length() == 0) {
-                    i++;
-                    continue;
-                }
-
-                File file = new File(arguments[i]);
-                String uri = null;
-
-                try{
-                    if (file.canRead()) {
-                        uri = file.toURL().toString();
-                    }
-                }catch(SecurityException se){
-                    // Cannot access files. 
-                }
-                
-                if(uri == null){
-                    uri = arguments[i];
-                    ParsedURL purl = null;
-                    purl = new ParsedURL(arguments[i]);
-
-                    if (!purl.complete())
-                        // This is not a valid uri
-                        uri = null;
-                }
-
-                if (uri != null) {
-                    if (frame == null)
-                        frame = createAndShowJSVGViewerFrame();
-
-                    frame.showSVGDocument(uri);
-                    frame = null;
-                } else {
-                    // Let the user know that we are
-                    // skipping this file...
-
-                    // Note that frame may be null, which is
-                    // a valid argument for showMessageDialog
-
-                    // NOTE: Need to revisit Resources/Messages usage to
-                    //       have a single entry point. Should have a
-                    //       formated message here instead of a + ...
-                    JOptionPane.showMessageDialog
-                        (frame,
-                         resources.getString("Error.skipping.file")
-                         + arguments[i]);
-                }
-                i++;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            printUsage();
-        }
-    }
-
-    /**
-     * Prints the command line usage.
-     */
-    protected void printUsage() {
-        System.out.println();
-
-        System.out.println(resources.getString("Command.header"));
-        System.out.println(resources.getString("Command.syntax"));
-        System.out.println();
-        System.out.println(resources.getString("Command.options"));
-        Iterator it = handlers.keySet().iterator();
-        while (it.hasNext()) {
-            String s = (String)it.next();
-            System.out.println(((OptionHandler)handlers.get(s)).getDescription());
-        }
-    }
-
-    /**
-     * This interface represents an option handler.
-     */
-    protected interface OptionHandler {
-        /**
-         * Handles the current option.
-         * @return the index of argument just before the next one to handle.
-         */
-        int handleOption(int i);
-
-        /**
-         * Returns the option description.
-         */
-        String getDescription();
-    }
-
-    /**
-     * To handle the '-font-size' option.
-     */
-    protected class FontSizeHandler implements OptionHandler {
-        public int handleOption(int i) {
-            int size = Integer.parseInt(arguments[++i]);
-
-            Font font = new Font("Dialog", Font.PLAIN, size);
-            FontUIResource fontRes = new FontUIResource(font);
-            UIManager.put("CheckBox.font", fontRes);
-            UIManager.put("PopupMenu.font", fontRes);
-            UIManager.put("TextPane.font", fontRes);
-            UIManager.put("MenuItem.font", fontRes);
-            UIManager.put("ComboBox.font", fontRes);
-            UIManager.put("Button.font", fontRes);
-            UIManager.put("Tree.font", fontRes);
-            UIManager.put("ScrollPane.font", fontRes);
-            UIManager.put("TabbedPane.font", fontRes);
-            UIManager.put("EditorPane.font", fontRes);
-            UIManager.put("TitledBorder.font", fontRes);
-            UIManager.put("Menu.font", fontRes);
-            UIManager.put("TextArea.font", fontRes);
-            UIManager.put("OptionPane.font", fontRes);
-            UIManager.put("DesktopIcon.font", fontRes);
-            UIManager.put("MenuBar.font", fontRes);
-            UIManager.put("ToolBar.font", fontRes);
-            UIManager.put("RadioButton.font", fontRes);
-            UIManager.put("RadioButtonMenuItem.font", fontRes);
-            UIManager.put("ToggleButton.font", fontRes);
-            UIManager.put("ToolTip.font", fontRes);
-            UIManager.put("ProgressBar.font", fontRes);
-            UIManager.put("TableHeader.font", fontRes);
-            UIManager.put("Panel.font", fontRes);
-            UIManager.put("List.font", fontRes);
-            UIManager.put("ColorChooser.font", fontRes);
-            UIManager.put("PasswordField.font", fontRes);
-            UIManager.put("TextField.font", fontRes);
-            UIManager.put("Table.font", fontRes);
-            UIManager.put("Label.font", fontRes);
-            UIManager.put("InternalFrameTitlePane.font", fontRes);
-            UIManager.put("CheckBoxMenuItem.font", fontRes);
-
-            return i;
-        }
-        public String getDescription() {
-            return resources.getString("Command.font-size");
-        }
-    }
-
-    // Application ///////////////////////////////////////////////
-
-    /**
-     * Creates and shows a new viewer frame.
-     */
-    public JSVGViewerFrame createAndShowJSVGViewerFrame() {
-        JSVGViewerFrame mainFrame = new JSVGViewerFrame(this);
-        mainFrame.setSize(resources.getInteger("Frame.width"),
-                          resources.getInteger("Frame.height"));
-        mainFrame.setIconImage(frameIcon.getImage());
-        mainFrame.setTitle(resources.getString("Frame.title"));
-        mainFrame.setVisible(true);
-        viewerFrames.add(mainFrame);
-        setPreferences(mainFrame);
-        return mainFrame;
-    }
-
-    /**
-     * Closes the given viewer frame.
-     */
-    public void closeJSVGViewerFrame(JSVGViewerFrame f) {
-        f.getJSVGCanvas().stopProcessing();
-        viewerFrames.remove(f);
-        if (viewerFrames.size() == 0) {
-            System.exit(0);
-        }
-        f.dispose();
-    }
-
-    /**
-     * Creates a new application exit action.
-     */
-    public Action createExitAction(JSVGViewerFrame vf) {
-        return new AbstractAction() {
-                public void actionPerformed(ActionEvent e) {
-                    System.exit(0);
-                }
-            };
-    }
-
-    /**
-     * Opens the given link in a new window.
-     */
-    public void openLink(String url) {
-        JSVGViewerFrame f = createAndShowJSVGViewerFrame();
-        f.getJSVGCanvas().loadSVGDocument(url);
-    }
-
-    /**
-     * Returns the XML parser class name.
-     */
-    public String getXMLParserClassName() {
-        return XMLResourceDescriptor.getXMLParserClassName();
-    }
-
-    /**
-     * Returns true if the XML parser must be in validation mode, false
-     * otherwise.
-     */
-    public boolean isXMLParserValidating() {
-        return preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_IS_XML_PARSER_VALIDATING);
-    }
-
-    /**
-     * Shows the preference dialog.
-     */
-    public void showPreferenceDialog(JSVGViewerFrame f) {
-        if (preferenceDialog == null) {
-            preferenceDialog = new PreferenceDialog(preferenceManager);
-        }
-        if (preferenceDialog.showDialog() == PreferenceDialog.OK_OPTION) {
-            try {
-                preferenceManager.save();
-                setPreferences();
-            } catch (Exception e) {
-            }
-        }
-    }
-
-    private void setPreferences() throws IOException {
-        Iterator it = viewerFrames.iterator();
-        while (it.hasNext()) {
-            setPreferences((JSVGViewerFrame)it.next());
-        }
-
-        System.setProperty("proxyHost", preferenceManager.getString
-                           (PreferenceDialog.PREFERENCE_KEY_PROXY_HOST));
-        System.setProperty("proxyPort", preferenceManager.getString
-                           (PreferenceDialog.PREFERENCE_KEY_PROXY_PORT));
-
-        installCustomPolicyFile();
-
-        securityEnforcer.enforceSecurity
-            (preferenceManager.getBoolean
-             (PreferenceDialog.PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING)
-             );
-
-    }
-
-    private void setPreferences(JSVGViewerFrame vf) {
-        boolean db = preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING);
-        vf.getJSVGCanvas().setDoubleBufferedRendering(db);
-        boolean sr = preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_SHOW_RENDERING);
-        vf.getJSVGCanvas().setProgressivePaint(sr);
-        boolean d = preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_SHOW_DEBUG_TRACE);
-        vf.setDebug(d);
-        boolean aa = preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_AUTO_ADJUST_WINDOW);
-        vf.setAutoAdjust(aa);
-        boolean dd = preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_SELECTION_XOR_MODE);
-	vf.getJSVGCanvas().setSelectionOverlayXORMode(dd);
-    }
-
-    /**
-     * Returns the user languages.
-     */
-    public String getLanguages() {
-        String s = preferenceManager.getString
-            (PreferenceDialog.PREFERENCE_KEY_LANGUAGES);
-        return (s == null)
-            ? Locale.getDefault().getLanguage()
-            : s;
-    }
-
-    /**
-     * Returns the user stylesheet uri.
-     * @return null if no user style sheet was specified.
-     */
-    public String getUserStyleSheetURI() {
-        return preferenceManager.getString
-            (PreferenceDialog.PREFERENCE_KEY_USER_STYLESHEET);
-    }
-
-    /**
-     * Returns the default value for the CSS
-     * "font-family" property
-     */
-    public String getDefaultFontFamily() {
-        return preferenceManager.getString
-            (PreferenceDialog.PREFERENCE_KEY_DEFAULT_FONT_FAMILY);
-    }
-
-    /**
-     * Returns the CSS media to use.
-     * @return empty string if no CSS media was specified.
-     */
-    public String getMedia() {
-        String s = preferenceManager.getString
-            (PreferenceDialog.PREFERENCE_KEY_CSS_MEDIA);
-        return (s == null) ? "screen" : s;
-    }
-
-    /**
-     * Returns true if the selection overlay is painted in XOR mode, false
-     * otherwise.
-     */
-    public boolean isSelectionOverlayXORMode() {
-        return preferenceManager.getBoolean
-            (PreferenceDialog.PREFERENCE_KEY_SELECTION_XOR_MODE);
-    }
-
-    /**
-     * Returns true if the input scriptType can be loaded in
-     * this application.
-     */
-    public boolean canLoadScriptType(String scriptType){
-        if (SVGConstants.SVG_SCRIPT_TYPE_ECMASCRIPT.equals(scriptType)){
-            return preferenceManager.getBoolean
-                (PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT);
-        } else if (SVGConstants.SVG_SCRIPT_TYPE_JAVA.equals(scriptType)){
-            return preferenceManager.getBoolean
-                (PreferenceDialog.PREFERENCE_KEY_LOAD_JAVA);
-        } else {
-            return preferenceManager.getBoolean
-                (scriptType + UNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION);
-        }
-    }
-
-    /**
-     * Returns the allowed origins for scripts.
-     * @see ResourceOrigin
-     */
-    public int getAllowedScriptOrigin() {
-        int ret = preferenceManager.getInteger
-            (PreferenceDialog.PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN);
-
-        return ret;
-    }
-
-    /**
-     * Returns the allowed origins for external
-     * resources. 
-     * @see ResourceOrigin
-     */
-    public int getAllowedExternalResourceOrigin() {
-        int ret = preferenceManager.getInteger
-            (PreferenceDialog.PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN);
-
-        return ret;
-    }
-
-    /**
-     * Notifies Application of recently visited URI
-     */ 
-    public void addVisitedURI(String uri) {
-        if(svgInitializationURI.equals(uri)) {
-            return;
-        }
-        
-        int maxVisitedURIs = 
-            preferenceManager.getInteger
-            (PREFERENCE_KEY_VISITED_URI_LIST_LENGTH);
-        
-        if (maxVisitedURIs < 0) {
-            maxVisitedURIs = 0;
-        }
-
-        if (lastVisited.contains(uri)) {
-            lastVisited.removeElement(uri);
-        }
-
-        while (lastVisited.size() > 0 && lastVisited.size() > (maxVisitedURIs-1)) {
-            lastVisited.removeElementAt(0);
-        } 
-
-        if (maxVisitedURIs > 0) {
-            lastVisited.addElement(uri);
-        }
-
-        // Now, save the list of visited URL into the preferences
-        StringBuffer lastVisitedBuffer = new StringBuffer();
-
-        for (int i=0; i<lastVisited.size(); i++) {
-            lastVisitedBuffer.append
-                (URLEncoder.encode(lastVisited.elementAt(i).toString()));
-            lastVisitedBuffer.append(URI_SEPARATOR);
-        }
-        
-        preferenceManager.setString
-            (PREFERENCE_KEY_VISITED_URI_LIST,
-             lastVisitedBuffer.toString());
-
-        try {
-            preferenceManager.save();
-        } catch (Exception e) {
-            // As in other places. But this is ugly...
-        }
-    }
-
-    /**
-     * Asks Application for a list of recently visited URI.
-     */
-    public String[] getVisitedURIs() {
-        String[] visitedURIs = new String[lastVisited.size()];
-        lastVisited.copyInto(visitedURIs);
-        return visitedURIs;
-    }
-
-    /**
-     * Initializes the lastVisited array
-     */
-    protected void initializeLastVisited(){
-        String lastVisitedStr 
-            = preferenceManager.getString(PREFERENCE_KEY_VISITED_URI_LIST);
-
-        StringTokenizer st 
-            = new StringTokenizer(lastVisitedStr,
-                                  URI_SEPARATOR);
-
-        int n = st.countTokens();
-
-        int maxVisitedURIs 
-            = preferenceManager.getInteger
-            (PREFERENCE_KEY_VISITED_URI_LIST_LENGTH);
-
-        if (n > maxVisitedURIs) {
-            n = maxVisitedURIs;
-        }
-
-        for (int i=0; i<n; i++) {
-                lastVisited.addElement(URLDecoder.decode(st.nextToken()));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/OptionPanel.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/OptionPanel.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/OptionPanel.java
deleted file mode 100644
index 8cb580e..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/OptionPanel.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-
-   Copyright 2002-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.LayoutManager;
-import java.awt.event.ActionEvent;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import org.apache.flex.forks.batik.util.gui.resource.ResourceManager;
-
-/**
- * This class represents a panel to present users with options.
- *
- * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
- * @version $Id: OptionPanel.java,v 1.4 2004/08/18 07:12:27 vhardy Exp $
- */
-public class OptionPanel extends JPanel {
-
-    /**
-     * The gui resources file name
-     */
-    public final static String RESOURCES =
-        "org.apache.flex.forks.batik.apps.svgbrowser.resources.GUI";
-
-    /**
-     * The resource bundle
-     */
-    protected static ResourceBundle bundle;
-
-    /**
-     * The resource manager
-     */
-    protected static ResourceManager resources;
-
-    static {
-        bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault());
-        resources = new ResourceManager(bundle);
-    }
-
-    /**
-     * Creates a new panel.
-     */
-    public OptionPanel(LayoutManager layout) {
-	super(layout);
-    }
-
-    /**
-     * This class is modal dialog to choose the jpeg encoding quality.
-     */
-    public static class Dialog extends JDialog {
-
-	/**
-	 * The 'ok' button.
-	 */
-	protected JButton ok;
-
-	/**
-	 * The 'ok' button.
-	 */
-	protected JPanel panel;
-
-	public Dialog(Component parent, String title, JPanel panel) {
-	    super(JOptionPane.getFrameForComponent(parent), title);
-	    setModal(true);
-	    this.panel = panel;
-	    getContentPane().add(panel, BorderLayout.CENTER);
-	    getContentPane().add(createButtonPanel(), BorderLayout.SOUTH);
-	}
-
-	/**
-	 * Creates the button panel.
-	 */
-	protected JPanel createButtonPanel() {
-	    JPanel panel = new JPanel(new FlowLayout());
-	    ok = new JButton(resources.getString("OKButton.text"));
-	    ok.addActionListener(new OKButtonAction());
-	    panel.add(ok);
-	    return panel;
-	}
-
-	/**
-	 * The action associated to the 'ok' button.
-	 */
-	protected class OKButtonAction extends AbstractAction {
-
-	    public void actionPerformed(ActionEvent evt) {
-		dispose();
-	    }
-	}
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PNGOptionPanel.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PNGOptionPanel.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PNGOptionPanel.java
deleted file mode 100644
index 90b89c9..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PNGOptionPanel.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-
-   Copyright 2002-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-
-import org.apache.flex.forks.batik.util.gui.ExtendedGridBagConstraints;
-
-/**
- * This class represents a panel to choose the color model
- * of the PNG, i.e. RGB or INDEXED.
- *
- * @author <a href="mailto:jun@oop-reserch.com">Jun Inamori</a>
- *
- */
-public class PNGOptionPanel extends OptionPanel {
-
-    /**
-     * The check box for outputing an indexed PNG.
-     */
-    protected JCheckBox check;
-
-    /**
-     * Creates a new panel.
-     */
-    public PNGOptionPanel() {
-	super(new GridBagLayout());
-
-	ExtendedGridBagConstraints constraints = 
-	    new ExtendedGridBagConstraints();
-
-	
-	constraints.insets = new Insets(5, 5, 5, 5);
-
-	constraints.weightx = 0;
-	constraints.weighty = 0;
-	constraints.fill = GridBagConstraints.NONE;
-	constraints.setGridBounds(0, 0, 1, 1);
-	add(new JLabel(resources.getString("PNGOptionPanel.label")), 
-	    constraints);
-
-	check=new JCheckBox();
-
-	constraints.weightx = 1.0;
-	constraints.fill = GridBagConstraints.HORIZONTAL;
-	constraints.setGridBounds(1, 0, 1, 1);
-	add(check, constraints);
-    }
-
-    /**
-     * Returns if indexed or not
-     */
-    public boolean isIndexed() {
-	return check.isSelected();
-    }
-
-    /**
-     * Shows a dialog to choose the indexed PNG.
-     */
-    public static boolean showDialog(Component parent) {
-        String title = resources.getString("PNGOptionPanel.dialog.title");
-        PNGOptionPanel panel = new PNGOptionPanel();
-	Dialog dialog = new Dialog(parent, title, panel);
-	dialog.pack();
-	dialog.show();
-	return panel.isIndexed();
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PreferenceDialog.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PreferenceDialog.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PreferenceDialog.java
deleted file mode 100644
index dc48d4f..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/PreferenceDialog.java
+++ /dev/null
@@ -1,1049 +0,0 @@
-/*
-
-   Copyright 2001-2003  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.swing.AbstractButton;
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextField;
-import javax.swing.ListCellRenderer;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.apache.flex.forks.batik.ext.swing.GridBagConstants;
-import org.apache.flex.forks.batik.ext.swing.JGridBagPanel;
-import org.apache.flex.forks.batik.util.PreferenceManager;
-import org.apache.flex.forks.batik.util.gui.CSSMediaPanel;
-import org.apache.flex.forks.batik.util.gui.LanguageDialog;
-import org.apache.flex.forks.batik.util.gui.UserStyleDialog;
-
-/**
- * Dialog that displays user preferences.
- *
- * @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: PreferenceDialog.java,v 1.21 2004/08/18 07:12:27 vhardy Exp $
- */
-public class PreferenceDialog extends JDialog
-    implements GridBagConstants {
-
-    /**
-     * The return value if 'OK' is chosen.
-     */
-    public final static int OK_OPTION = 0;
-
-    /**
-     * The return value if 'Cancel' is chosen.
-     */
-    public final static int CANCEL_OPTION = 1;
-
-    //////////////////////////////////////////////////////////////
-    // GUI Resources Keys
-    //////////////////////////////////////////////////////////////
-
-    public static final String ICON_USER_LANGUAGE
-        = "PreferenceDialog.icon.userLanguagePref";
-
-    public static final String ICON_USER_STYLESHEET
-        = "PreferenceDialog.icon.userStylesheetPref";
-
-    public static final String ICON_BEHAVIOR
-        = "PreferenceDialog.icon.behaviorsPref";
-
-    public static final String ICON_NETWORK
-        = "PreferenceDialog.icon.networkPref";
-
-    public static final String LABEL_USER_OPTIONS
-        = "PreferenceDialog.label.user.options";
-
-    public static final String LABEL_BEHAVIOR
-        = "PreferenceDialog.label.behavior";
-
-    public static final String LABEL_NETWORK
-        = "PreferenceDialog.label.network";
-
-    public static final String LABEL_USER_LANGUAGE
-        = "PreferenceDialog.label.user.language";
-
-    public static final String LABEL_USER_STYLESHEET
-        = "PreferenceDialog.label.user.stylesheet";
-
-    public static final String LABEL_USER_FONT
-        = "PreferenceDialog.label.user.font";
-
-    public static final String LABEL_APPLICATIONS
-        = "PreferenceDialog.label.applications";
-
-    public static final String LABEL_SHOW_RENDERING
-        = "PreferenceDialog.label.show.rendering";
-
-    public static final String LABEL_AUTO_ADJUST_WINDOW
-        = "PreferenceDialog.label.auto.adjust.window";
-
-    public static final String LABEL_ENABLE_DOUBLE_BUFFERING
-        = "PreferenceDialog.label.enable.double.buffering";
-
-    public static final String LABEL_SHOW_DEBUG_TRACE
-        = "PreferenceDialog.label.show.debug.trace";
-
-    public static final String LABEL_SELECTION_XOR_MODE
-        = "PreferenceDialog.label.selection.xor.mode";
-
-    public static final String LABEL_IS_XML_PARSER_VALIDATING
-        = "PreferenceDialog.label.is.xml.parser.validating";
-
-    public static final String LABEL_ENFORCE_SECURE_SCRIPTING
-        = "PreferenceDialog.label.enforce.secure.scripting";
-
-    public static final String LABEL_SECURE_SCRIPTING_TOGGLE
-        = "PreferenceDialog.label.secure.scripting.toggle";
-
-    public static final String LABEL_GRANT_SCRIPT_FILE_ACCESS
-        = "PreferenceDialog.label.grant.script.file.access";
-
-    public static final String LABEL_GRANT_SCRIPT_NETWORK_ACCESS
-        = "PreferenceDialog.label.grant.script.network.access";
-
-    public static final String LABEL_LOAD_JAVA
-        = "PreferenceDialog.label.load.java";
-
-    public static final String LABEL_LOAD_ECMASCRIPT
-        = "PreferenceDialog.label.load.ecmascript";
-
-    public static final String LABEL_HOST
-        = "PreferenceDialog.label.host";
-
-    public static final String LABEL_PORT
-        = "PreferenceDialog.label.port";
-
-    public static final String LABEL_OK
-        = "PreferenceDialog.label.ok";
-
-    public static final String LABEL_LOAD_SCRIPTS
-        = "PreferenceDialog.label.load.scripts";
-
-    public static final String LABEL_ORIGIN_ANY
-        = "PreferenceDialog.label.origin.any";
-
-    public static final String LABEL_ORIGIN_DOCUMENT
-        = "PreferenceDialog.label.origin.document";
-
-    public static final String LABEL_ORIGIN_EMBED
-        = "PreferenceDialog.label.origin.embed";
-
-    public static final String LABEL_ORIGIN_NONE
-        = "PreferenceDialog.label.origin.none";
-
-    public static final String LABEL_SCRIPT_ORIGIN
-        = "PreferenceDialog.label.script.origin";
-
-    public static final String LABEL_RESOURCE_ORIGIN
-        = "PreferenceDialog.label.resource.origin";
-
-    public static final String LABEL_CANCEL
-        = "PreferenceDialog.label.cancel";
-
-    public static final String TITLE_BROWSER_OPTIONS
-        = "PreferenceDialog.title.browser.options";
-
-    public static final String TITLE_BEHAVIOR
-        = "PreferenceDialog.title.behavior";
-
-    public static final String TITLE_SECURITY
-        = "PreferenceDialog.title.security";
-
-    public static final String TITLE_NETWORK
-        = "PreferenceDialog.title.network";
-
-    public static final String TITLE_DIALOG
-        = "PreferenceDialog.title.dialog";
-
-    public static final String CONFIG_HOST_TEXT_FIELD_LENGTH
-        = "PreferenceDialog.config.host.text.field.length";
-
-    public static final String CONFIG_PORT_TEXT_FIELD_LENGTH
-        = "PreferenceDialog.config.port.text.field.length";
-
-    public static final String CONFIG_OK_MNEMONIC
-        = "PreferenceDialog.config.ok.mnemonic";
-
-    public static final String CONFIG_CANCEL_MNEMONIC
-        = "PreferenceDialog.config.cancel.mnemonic";
-
-    //////////////////////////////////////////////////////////////
-    // Following are the preference keys used in the
-    // PreferenceManager model.
-    //////////////////////////////////////////////////////////////
-
-    public static final String PREFERENCE_KEY_LANGUAGES
-        = "preference.key.languages";
-
-    public static final String PREFERENCE_KEY_IS_XML_PARSER_VALIDATING
-        = "preference.key.is.xml.parser.validating";
-
-    public static final String PREFERENCE_KEY_USER_STYLESHEET
-        = "preference.key.user.stylesheet";
-
-    public static final String PREFERENCE_KEY_SHOW_RENDERING
-        = "preference.key.show.rendering";
-
-    public static final String PREFERENCE_KEY_AUTO_ADJUST_WINDOW
-        = "preference.key.auto.adjust.window";
-
-    public static final String PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING
-        = "preference.key.enable.double.buffering";
-
-    public static final String PREFERENCE_KEY_SHOW_DEBUG_TRACE
-        = "preference.key.show.debug.trace";
-
-    public static final String PREFERENCE_KEY_SELECTION_XOR_MODE
-        = "preference.key.selection.xor.mode";
-
-    public static final String PREFERENCE_KEY_PROXY_HOST
-        = "preference.key.proxy.host";
-
-    public static final String PREFERENCE_KEY_CSS_MEDIA
-        = "preference.key.cssmedia";
-
-    public static final String PREFERENCE_KEY_DEFAULT_FONT_FAMILY
-        = "preference.key.default.font.family";
-
-    public static final String PREFERENCE_KEY_PROXY_PORT
-        = "preference.key.proxy.port";
-
-    public static final String PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING
-        = "preference.key.enforce.secure.scripting";
-
-    public static final String PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS
-        = "preference.key.grant.script.file.access";
-
-    public static final String PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS
-        = "preferenced.key.grant.script.network.access";
-
-    public static final String PREFERENCE_KEY_LOAD_ECMASCRIPT
-        = "preference.key.load.ecmascript";
-
-    public static final String PREFERENCE_KEY_LOAD_JAVA
-        = "preference.key.load.java.script";
-
-    public static final String PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN
-        = "preference.key.allowed.script.origin";
-
-    public static final String PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN
-        = "preference.key.allowed.external.resource.origin";
-
-    /**
-     * <tt>PreferenceManager</tt> used to store and retrieve
-     * preferences
-     */
-    protected PreferenceManager model;
-
-    /**
-     * Allows selection of the desired configuration panel
-     */
-    protected ConfigurationPanelSelector configPanelSelector;
-
-    /**
-     * Allows selection of the user languages
-     */
-    protected LanguageDialog.Panel languagePanel;
-
-    /**
-     * Allows selection of a user stylesheet
-     */
-    protected UserStyleDialog.Panel userStylesheetPanel;
-
-    protected JCheckBox showRendering;
-
-    protected JCheckBox autoAdjustWindow;
-
-    protected JCheckBox showDebugTrace;
-
-    protected JCheckBox enableDoubleBuffering;
-
-    protected JCheckBox selectionXorMode;
-
-    protected JCheckBox isXMLParserValidating;
-
-    protected JCheckBox enforceSecureScripting;
-
-    protected JCheckBox grantScriptFileAccess;
-
-    protected JCheckBox grantScriptNetworkAccess;
-
-    protected JCheckBox loadJava;
-
-    protected JCheckBox loadEcmascript;
-
-    protected ButtonGroup scriptOriginGroup;
-
-    protected ButtonGroup resourceOriginGroup;
-
-    protected JTextField host, port;
-
-    protected CSSMediaPanel cssMediaPanel;
-
-    /**
-     * Code indicating whether the dialog was OKayed
-     * or cancelled
-     */
-    protected int returnCode;
-
-    /**
-     * Default constructor
-     */
-    public PreferenceDialog(PreferenceManager model){
-        super((Frame)null, true);
-
-        if(model == null){
-            throw new IllegalArgumentException();
-        }
-
-        this.model = model;
-        buildGUI();
-        initializeGUI();
-        pack();
-    }
-
-    /**
-     * Returns the preference manager used by this dialog.
-     */
-    public PreferenceManager getPreferenceManager() {
-        return model;
-    }
-
-    /**
-     * Initializes the GUI components with the values
-     * from the model.
-     */
-    protected void initializeGUI(){
-        //
-        // Initialize language. The set of languages is
-        // defined by a String.
-        //
-        String languages = model.getString(PREFERENCE_KEY_LANGUAGES);
-        languagePanel.setLanguages(languages);
-
-        //
-        // Initializes the User Stylesheet
-        //
-        String userStylesheetPath = model.getString(PREFERENCE_KEY_USER_STYLESHEET);
-        userStylesheetPanel.setPath(userStylesheetPath);
-
-        //
-        // Initializes the browser options
-        //
-        showRendering.setSelected(model.getBoolean(PREFERENCE_KEY_SHOW_RENDERING));
-        autoAdjustWindow.setSelected(model.getBoolean(PREFERENCE_KEY_AUTO_ADJUST_WINDOW));
-        enableDoubleBuffering.setSelected(model.getBoolean(PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING));
-        showDebugTrace.setSelected(model.getBoolean(PREFERENCE_KEY_SHOW_DEBUG_TRACE));
-        selectionXorMode.setSelected(model.getBoolean(PREFERENCE_KEY_SELECTION_XOR_MODE));
-
-        isXMLParserValidating.setSelected(model.getBoolean(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING));
-        enforceSecureScripting.setSelected(model.getBoolean(PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING));
-        grantScriptFileAccess.setSelected(model.getBoolean(PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS));
-        grantScriptNetworkAccess.setSelected(model.getBoolean(PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS));
-        loadJava.setSelected(model.getBoolean(PREFERENCE_KEY_LOAD_JAVA));
-        loadEcmascript.setSelected(model.getBoolean(PREFERENCE_KEY_LOAD_ECMASCRIPT));
-
-        String allowedScriptOrigin = "" + model.getInteger(PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN);
-        if (allowedScriptOrigin == null || "".equals(allowedScriptOrigin)) {
-            allowedScriptOrigin = "" + ResourceOrigin.NONE;
-        }
-
-        Enumeration e = scriptOriginGroup.getElements();
-        while (e.hasMoreElements()) {
-            AbstractButton ab = (AbstractButton)e.nextElement();
-            String ac = ab.getActionCommand();
-            if (allowedScriptOrigin.equals(ac)) {
-                ab.setSelected(true);
-            }
-        }
-
-        String allowedResourceOrigin = "" + model.getInteger(PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN);
-        if (allowedResourceOrigin == null || "".equals(allowedResourceOrigin)) {
-            allowedResourceOrigin = "" + ResourceOrigin.NONE;
-        }
-
-        e = resourceOriginGroup.getElements();
-        while (e.hasMoreElements()) {
-            AbstractButton ab = (AbstractButton)e.nextElement();
-            String ac = ab.getActionCommand();
-            if (allowedResourceOrigin.equals(ac)) {
-                ab.setSelected(true);
-            }
-        }
-
-        showRendering.setEnabled
-            (!model.getBoolean(PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING));
-        grantScriptFileAccess.setEnabled
-            (model.getBoolean(PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING));
-        grantScriptNetworkAccess.setEnabled
-            (model.getBoolean(PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING));
-
-        //
-        // Initialize the proxy options
-        //
-        host.setText(model.getString(PREFERENCE_KEY_PROXY_HOST));
-        port.setText(model.getString(PREFERENCE_KEY_PROXY_PORT));
-
-        //
-        // Initialize the CSS media
-        //
-        cssMediaPanel.setMedia(model.getString(PREFERENCE_KEY_CSS_MEDIA));
-        //
-        // Sets the dialog's title
-        //
-        setTitle(Resources.getString(TITLE_DIALOG));
-    }
-
-    /**
-     * Stores current setting in PreferenceManager model
-     */
-    protected void savePreferences(){
-        model.setString(PREFERENCE_KEY_LANGUAGES,
-                        languagePanel.getLanguages());
-        model.setString(PREFERENCE_KEY_USER_STYLESHEET,
-                        userStylesheetPanel.getPath());
-        model.setBoolean(PREFERENCE_KEY_SHOW_RENDERING,
-                         showRendering.isSelected());
-        model.setBoolean(PREFERENCE_KEY_AUTO_ADJUST_WINDOW,
-                         autoAdjustWindow.isSelected());
-        model.setBoolean(PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING,
-                         enableDoubleBuffering.isSelected());
-        model.setBoolean(PREFERENCE_KEY_SHOW_DEBUG_TRACE,
-                         showDebugTrace.isSelected());
-        model.setBoolean(PREFERENCE_KEY_SELECTION_XOR_MODE,
-                         selectionXorMode.isSelected());
-        model.setBoolean(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING,
-                         isXMLParserValidating.isSelected());
-        model.setBoolean(PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING,
-                         enforceSecureScripting.isSelected());
-        model.setBoolean(PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS,
-                         grantScriptFileAccess.isSelected());
-        model.setBoolean(PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS,
-                         grantScriptNetworkAccess.isSelected());
-        model.setBoolean(PREFERENCE_KEY_LOAD_JAVA,
-                         loadJava.isSelected());
-        model.setBoolean(PREFERENCE_KEY_LOAD_ECMASCRIPT,
-                         loadEcmascript.isSelected());
-        model.setInteger(PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN,
-                         (new Integer(scriptOriginGroup.getSelection().getActionCommand())).intValue());
-        model.setInteger(PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN,
-                         (new Integer(resourceOriginGroup.getSelection().getActionCommand())).intValue());
-        model.setString(PREFERENCE_KEY_PROXY_HOST,
-                        host.getText());
-        model.setString(PREFERENCE_KEY_PROXY_PORT,
-                        port.getText());
-        model.setString(PREFERENCE_KEY_CSS_MEDIA,
-                        cssMediaPanel.getMediaAsString());
-    }
-
-    /**
-     * Builds the UI for this dialog
-     */
-    protected void buildGUI(){
-        JPanel panel = new JPanel(new BorderLayout());
-
-        Component config = buildConfigPanel();
-        Component list = buildConfigPanelList();
-
-        panel.add(list, BorderLayout.WEST);
-        panel.add(config, BorderLayout.CENTER);
-        panel.add(buildButtonsPanel(), BorderLayout.SOUTH);
-        panel.setBorder(BorderFactory.createEmptyBorder(2, 2, 0, 0));
-
-        getContentPane().add(panel);
-    }
-
-    /**
-     * Creates the OK/Cancel buttons panel
-     */
-    protected JPanel buildButtonsPanel() {
-        JPanel  p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-        JButton okButton = new JButton(Resources.getString(LABEL_OK));
-        okButton.setMnemonic(Resources.getCharacter(CONFIG_OK_MNEMONIC));
-        JButton cancelButton = new JButton(Resources.getString(LABEL_CANCEL));
-        cancelButton.setMnemonic(Resources.getCharacter(CONFIG_CANCEL_MNEMONIC));
-        p.add(okButton);
-        p.add(cancelButton);
-
-        okButton.addActionListener(new ActionListener(){
-                public void actionPerformed(ActionEvent e){
-                    setVisible(false);
-                    returnCode = OK_OPTION;
-                    savePreferences();
-                    dispose();
-                }
-            });
-
-        cancelButton.addActionListener(new ActionListener(){
-                public void actionPerformed(ActionEvent e){
-                    setVisible(false);
-                    returnCode = CANCEL_OPTION;
-                    dispose();
-                }
-            });
-
-        addKeyListener(new KeyAdapter(){
-                public void keyPressed(KeyEvent e){
-                    if(e.getKeyCode() == KeyEvent.VK_ESCAPE){
-                        setVisible(false);
-                        returnCode = CANCEL_OPTION;
-                        dispose();
-                    }
-                }
-            });
-
-        return p;
-    }
-
-    protected Component buildConfigPanelList(){
-        String[] configList
-            = { Resources.getString(LABEL_NETWORK),
-                Resources.getString(LABEL_USER_LANGUAGE),
-                Resources.getString(LABEL_BEHAVIOR),
-                Resources.getString(LABEL_USER_STYLESHEET),
-                };
-
-        final JList list = new JList(configList);
-        list.addListSelectionListener(new ListSelectionListener(){
-                public void valueChanged(ListSelectionEvent evt){
-                    if(!evt.getValueIsAdjusting()){
-                        configPanelSelector.select(list.getSelectedValue().toString());
-                    }
-                }
-            });
-        list.setVisibleRowCount(4);
-
-        // Set Cell Renderer
-        ClassLoader cl = this.getClass().getClassLoader();
-        Map map= new Hashtable();
-        map.put(Resources.getString(LABEL_USER_LANGUAGE), new ImageIcon(cl.getResource(Resources.getString(ICON_USER_LANGUAGE))));
-        map.put(Resources.getString(LABEL_USER_STYLESHEET), new ImageIcon(cl.getResource(Resources.getString(ICON_USER_STYLESHEET))));
-        map.put(Resources.getString(LABEL_BEHAVIOR), new ImageIcon(cl.getResource(Resources.getString(ICON_BEHAVIOR))));
-        map.put(Resources.getString(LABEL_NETWORK), new ImageIcon(cl.getResource(Resources.getString(ICON_NETWORK))));
-
-        list.setCellRenderer(new IconCellRenderer(map));
-
-        list.setSelectedIndex(0);
-
-        return new JScrollPane(list);
-    }
-
-    protected Component buildConfigPanel(){
-        JPanel configPanel = new JPanel();
-        CardLayout cardLayout = new CardLayout();
-        configPanel.setLayout(cardLayout);
-        configPanel.add(buildUserLanguage(),
-                        Resources.getString(LABEL_USER_LANGUAGE));
-
-        configPanel.add(buildUserStyleSheet(),
-                        Resources.getString(LABEL_USER_STYLESHEET));
-
-        configPanel.add(buildBehavior(),
-                        Resources.getString(LABEL_BEHAVIOR));
-
-        configPanel.add(buildNetwork(),
-                        Resources.getString(LABEL_NETWORK));
-
-        configPanel.add(buildApplications(),
-                        Resources.getString(LABEL_APPLICATIONS));
-
-        configPanelSelector = new ConfigurationPanelSelector(configPanel,
-                                                             cardLayout);
-
-        return configPanel;
-    }
-
-    protected Component buildUserOptions(){
-        JTabbedPane p = new JTabbedPane();
-        p.add(buildUserLanguage(),
-              Resources.getString(LABEL_USER_LANGUAGE));
-        p.add(buildUserStyleSheet(),
-              Resources.getString(LABEL_USER_STYLESHEET));
-        p.add(buildUserFont(),
-              Resources.getString(LABEL_USER_FONT));
-        return p;
-    }
-
-    protected Component buildUserLanguage(){
-        languagePanel = new LanguageDialog.Panel();
-        return languagePanel;
-    }
-
-    protected Component buildUserStyleSheet(){
-        JPanel panel = new JPanel(new BorderLayout());
-        panel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
-
-        userStylesheetPanel = new UserStyleDialog.Panel();
-        panel.add(userStylesheetPanel, BorderLayout.NORTH);
-
-        cssMediaPanel = new CSSMediaPanel();
-        panel.add(cssMediaPanel, BorderLayout.SOUTH);
-
-        return panel;
-    }
-
-    protected Component buildUserFont(){
-        return new JButton("User Font");
-    }
-
-    protected Component buildBehavior(){
-        JGridBagPanel p = new JGridBagPanel();
-        showRendering
-            = new JCheckBox(Resources.getString(LABEL_SHOW_RENDERING));
-        autoAdjustWindow
-            = new JCheckBox(Resources.getString(LABEL_AUTO_ADJUST_WINDOW));
-        enableDoubleBuffering
-            = new JCheckBox(Resources.getString(LABEL_ENABLE_DOUBLE_BUFFERING));
-        enableDoubleBuffering.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent evt) {
-                showRendering.setEnabled(!enableDoubleBuffering.isSelected());
-            }
-        });
-        showDebugTrace
-            = new JCheckBox(Resources.getString(LABEL_SHOW_DEBUG_TRACE));
-
-        selectionXorMode
-            = new JCheckBox(Resources.getString(LABEL_SELECTION_XOR_MODE));
-
-        isXMLParserValidating
-            = new JCheckBox(Resources.getString(LABEL_IS_XML_PARSER_VALIDATING));
-
-        enforceSecureScripting
-            = new JCheckBox(Resources.getString(LABEL_SECURE_SCRIPTING_TOGGLE));
-
-        grantScriptFileAccess
-            = new JCheckBox(Resources.getString(LABEL_GRANT_SCRIPT_FILE_ACCESS));
-        
-        grantScriptNetworkAccess
-            = new JCheckBox(Resources.getString(LABEL_GRANT_SCRIPT_NETWORK_ACCESS));
-
-        JGridBagPanel scriptSecurityPanel = new JGridBagPanel();
-        scriptSecurityPanel.add(enforceSecureScripting,    0, 0, 1, 1, WEST, HORIZONTAL, 1, 0);
-        scriptSecurityPanel.add(grantScriptFileAccess,    1, 0, 1, 1, WEST, HORIZONTAL, 1, 0);
-        scriptSecurityPanel.add(grantScriptNetworkAccess, 1, 1, 1, 1, WEST, HORIZONTAL, 1, 0);
-        
-        enforceSecureScripting.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    grantScriptFileAccess.setEnabled(enforceSecureScripting.isSelected());
-                    grantScriptNetworkAccess.setEnabled(enforceSecureScripting.isSelected());
-                }
-            });
-
-        loadJava
-            = new JCheckBox(Resources.getString(LABEL_LOAD_JAVA));
-
-        loadEcmascript
-            = new JCheckBox(Resources.getString(LABEL_LOAD_ECMASCRIPT));
-
-        JGridBagPanel loadScriptPanel = new JGridBagPanel();
-        loadScriptPanel.add(loadJava, 0, 0, 1, 1, WEST, NONE, 1, 0);
-        loadScriptPanel.add(loadEcmascript, 1, 0, 1, 1, WEST, NONE, 1, 0);
-
-        JPanel scriptOriginPanel = new JPanel();
-
-        scriptOriginGroup = new ButtonGroup();
-        JRadioButton rb = null;
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_ANY));
-        rb.setActionCommand("" + ResourceOrigin.ANY);
-        scriptOriginGroup.add(rb);
-        scriptOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_DOCUMENT));
-        rb.setActionCommand("" + ResourceOrigin.DOCUMENT);
-        scriptOriginGroup.add(rb);
-        scriptOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_EMBED));
-        rb.setActionCommand("" + ResourceOrigin.EMBEDED);
-        scriptOriginGroup.add(rb);
-        scriptOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_NONE));
-        rb.setActionCommand("" + ResourceOrigin.NONE);
-        scriptOriginGroup.add(rb);
-        scriptOriginPanel.add(rb);
-
-        JPanel resourceOriginPanel = new JPanel();
-        resourceOriginGroup = new ButtonGroup();
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_ANY));
-        rb.setActionCommand("" + ResourceOrigin.ANY);
-        resourceOriginGroup.add(rb);
-        resourceOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_DOCUMENT));
-        rb.setActionCommand("" + ResourceOrigin.DOCUMENT);
-        resourceOriginGroup.add(rb);
-        resourceOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_EMBED));
-        rb.setActionCommand("" + ResourceOrigin.EMBEDED);
-        resourceOriginGroup.add(rb);
-        resourceOriginPanel.add(rb);
-
-        rb = new JRadioButton(Resources.getString(LABEL_ORIGIN_NONE));
-        rb.setActionCommand("" + ResourceOrigin.NONE);
-        resourceOriginGroup.add(rb);
-        resourceOriginPanel.add(rb);
-
-        JTabbedPane browserOptions = new JTabbedPane();
-        // browserOptions.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-
-        p.add(showRendering,    0, 0, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(autoAdjustWindow, 0, 1, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(enableDoubleBuffering, 0, 2, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(showDebugTrace,   0, 3, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(selectionXorMode,   0, 4, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(isXMLParserValidating,   0, 5, 2, 1, WEST, HORIZONTAL, 1, 0);
-        p.add(new JLabel(), 0, 11, 2, 1, WEST, BOTH, 1, 1); 
-
-        browserOptions.addTab(Resources.getString(TITLE_BEHAVIOR), p);
-        p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
-        p = new JGridBagPanel();
-        p.add(new JLabel(Resources.getString(LABEL_ENFORCE_SECURE_SCRIPTING)), 0, 6, 1, 1, NORTHWEST, NONE, 0, 0);
-        p.add(scriptSecurityPanel, 1, 6, 1, 1, WEST, NONE, 0, 0);
-        p.add(new JLabel(Resources.getString(LABEL_LOAD_SCRIPTS)), 0, 8, 1, 1, WEST, NONE, 0, 0);
-        p.add(loadScriptPanel, 1, 8, 1, 1, WEST, NONE, 1, 0);
-        p.add(new JLabel(Resources.getString(LABEL_SCRIPT_ORIGIN)), 0, 9, 1, 1, WEST, NONE, 0, 0);
-        p.add(scriptOriginPanel, 1, 9, 1, 1, WEST, NONE, 1, 0);
-        p.add(new JLabel(Resources.getString(LABEL_RESOURCE_ORIGIN)), 0, 10, 1, 1, WEST, NONE, 0, 0);
-        p.add(resourceOriginPanel, 1, 10, 1, 1, WEST, NONE, 1, 0); 
-        p.add(new JLabel(), 0, 11, 2, 1, WEST, BOTH, 1, 1); 
-
-        browserOptions.addTab(Resources.getString(TITLE_SECURITY), p);
-        p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
-        JGridBagPanel borderedPanel = new JGridBagPanel();
-        borderedPanel.add(browserOptions, 0, 0, 1, 1, WEST, BOTH, 1, 1);
-        borderedPanel.setBorder(BorderFactory.createCompoundBorder
-                                (BorderFactory.createTitledBorder
-                                 (BorderFactory.createEtchedBorder(),
-                                  Resources.getString(TITLE_BROWSER_OPTIONS)),
-                                 BorderFactory.createEmptyBorder(10, 10, 10, 10)));
-        
-        return borderedPanel;
-    }
-
-    protected Component buildNetwork(){
-        JGridBagPanel p = new JGridBagPanel();
-        host = new JTextField(Resources.getInteger(CONFIG_HOST_TEXT_FIELD_LENGTH));
-        JLabel hostLabel = new JLabel(Resources.getString(LABEL_HOST));
-        port = new JTextField(Resources.getInteger(CONFIG_PORT_TEXT_FIELD_LENGTH));
-        JLabel portLabel = new JLabel(Resources.getString(LABEL_PORT));
-        p.add(hostLabel, 0, 0, 1, 1, WEST, HORIZONTAL, 0, 0);
-        p.add(host, 0, 1, 1, 1, CENTER, HORIZONTAL, 1, 0);
-        p.add(portLabel, 1, 0, 1, 1, WEST, HORIZONTAL, 0, 0);
-        p.add(port, 1, 1, 1, 1, CENTER, HORIZONTAL, 0, 0);
-        p.add(new JLabel(""), 2, 1, 1, 1, CENTER, HORIZONTAL, 0, 0);
-
-        p.setBorder(BorderFactory.createCompoundBorder
-                    (BorderFactory.createTitledBorder
-                     (BorderFactory.createEtchedBorder(),
-                     Resources.getString(TITLE_NETWORK)),
-                     BorderFactory.createEmptyBorder(10, 10, 10, 10)));
-
-        return p;
-    }
-
-    protected Component buildApplications(){
-        return new JButton("Applications");
-    }
-
-    /**
-     * Shows the dialog
-     * @return OK_OPTION or CANCEL_OPTION
-     */
-    public int showDialog(){
-        pack();
-        show();
-        return returnCode;
-    }
-
-    public static void main(String[] args){
-        Map defaults = new Hashtable();
-        defaults.put(PREFERENCE_KEY_LANGUAGES, "fr");
-        defaults.put(PREFERENCE_KEY_SHOW_RENDERING, Boolean.TRUE);
-        defaults.put(PREFERENCE_KEY_SELECTION_XOR_MODE, Boolean.FALSE);
-        defaults.put(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING, Boolean.FALSE);
-        defaults.put(PREFERENCE_KEY_AUTO_ADJUST_WINDOW, Boolean.TRUE);
-        defaults.put(PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING, Boolean.TRUE);
-        defaults.put(PREFERENCE_KEY_SHOW_DEBUG_TRACE, Boolean.TRUE);
-        defaults.put(PREFERENCE_KEY_PROXY_HOST, "webcache.eng.sun.com");
-        defaults.put(PREFERENCE_KEY_PROXY_PORT, "8080");
-
-        XMLPreferenceManager manager
-            = new XMLPreferenceManager(args[0], defaults);
-        PreferenceDialog dlg = new PreferenceDialog(manager);
-        int c = dlg.showDialog();
-        if(c == OK_OPTION){
-            try{
-                manager.save();
-                System.out.println("Done Saving options");
-                System.exit(0);
-            }catch(Exception e){
-                System.err.println("Could not save options");
-                e.printStackTrace();
-            }
-        }
-    }
-}
-
-
-class ConfigurationPanelSelector {
-    private CardLayout layout;
-    private Container container;
-
-    public ConfigurationPanelSelector(Container container,
-                                      CardLayout layout){
-        this.layout = layout;
-        this.container = container;
-    }
-
-    public void select(String panelName){
-        layout.show(container, panelName);
-    }
-}
-
-class IconCellRendererOld extends JLabel implements ListCellRenderer {
-    Map iconMap;
-
-    public IconCellRendererOld(Map iconMap){
-        this.iconMap = iconMap;
-
-        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-    }
-    public Component getListCellRendererComponent
-        (
-         JList list,
-         Object value,            // value to display
-         int index,               // cell index
-         boolean isSelected,      // is the cell selected
-         boolean cellHasFocus)    // the list and the cell have the focus
-    {
-        String s = value.toString();
-        setText(s);
-        ImageIcon icon = (ImageIcon)iconMap.get(s);
-        if(icon != null){
-            setIcon(icon);
-            setHorizontalAlignment(CENTER);
-            setHorizontalTextPosition(CENTER);
-            setVerticalTextPosition(BOTTOM);
-        }
-        // if (isSelected) {
-        setBackground(java.awt.Color.red); // list.getSelectionBackground());
-            setForeground(list.getSelectionForeground());
-            /*}
-        else {
-            setBackground(list.getBackground());
-            setForeground(list.getForeground());
-            }*/
-            // setEnabled(list.isEnabled());
-            // setFont(list.getFont());
-        return this;
-    }
-}
-
-class IconCellRenderer extends JLabel
-    implements ListCellRenderer
-{
-    protected Map map;
-    protected static Border noFocusBorder;
-
-    /**
-     * Constructs a default renderer object for an item
-     * in a list.
-     */
-    public IconCellRenderer(Map map) {
-        super();
-    this.map = map;
-        noFocusBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
-        setOpaque(true);
-        setBorder(noFocusBorder);
-    }
-
-
-    public Component getListCellRendererComponent(
-        JList list,
-        Object value,
-        int index,
-        boolean isSelected,
-        boolean cellHasFocus)
-    {
-
-        setComponentOrientation(list.getComponentOrientation());
-
-        if (isSelected) {
-            setBackground(list.getSelectionBackground());
-            setForeground(list.getSelectionForeground());
-        }
-        else {
-            setBackground(list.getBackground());
-            setForeground(list.getForeground());
-        }
-
-        setBorder((cellHasFocus) ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
-
-        /*if (value instanceof Icon) {
-            setIcon((Icon)value);
-            setText("");
-        }
-        else {
-            setIcon(null);
-            setText((value == null) ? "" : value.toString());
-        }*/
-
-    setText(value.toString());
-        ImageIcon icon = (ImageIcon)map.get(value.toString());
-        if(icon != null){
-            setIcon(icon);
-            setHorizontalAlignment(CENTER);
-            setHorizontalTextPosition(CENTER);
-            setVerticalTextPosition(BOTTOM);
-        }
-        setEnabled(list.isEnabled());
-        setFont(list.getFont());
-
-        return this;
-    }
-
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void validate() {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void revalidate() {}
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void repaint(long tm, int x, int y, int width, int height) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void repaint(Rectangle r) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
-        // Strings get interned...
-        if (propertyName=="text")
-            super.firePropertyChange(propertyName, oldValue, newValue);
-    }
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
-
-   /**
-    * Overridden for performance reasons.
-    * See the <a href="#override">Implementation Note</a>
-    * for more information.
-    */
-    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
-}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/ResourceOrigin.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/ResourceOrigin.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/ResourceOrigin.java
deleted file mode 100644
index 1b245f8..0000000
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/apps/svgbrowser/ResourceOrigin.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-
-   Copyright 2002  The Apache Software Foundation 
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
- */
-package org.apache.flex.forks.batik.apps.svgbrowser;
-
-/**
- * This interface defines constants for the possible resource
- * origins.
- *
- * @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: ResourceOrigin.java,v 1.4 2004/08/18 07:12:27 vhardy Exp $
- */
-public interface ResourceOrigin {
-    /**
-     * Any origin
-     */
-    static final int ANY = 1;
-
-    /**
-     * Same as document
-     */
-    static final int DOCUMENT = 2;
-
-    /**
-     * Embeded into the document 
-     */
-    static final int EMBEDED = 4;
-
-    /**
-     * No origin is ok
-     */
-    static final int NONE = 8;
-}