org.apache.batik.apps.svgbrowser

Class Main

public class Main extends Object implements Application

This class contains the main method of an SVG viewer.
Nested Class Summary
protected classMain.FontSizeHandler
To handle the '-font-size' option.
protected interfaceMain.OptionHandler
This interface represents an option handler.
Field Summary
protected String[]arguments
The arguments.
protected static ResourceBundlebundle
The resource bundle
static StringBATIK_CONFIGURATION_SUBDIRECTORY
Batik configuration sub-directory
static StringDEFAULT_DEFAULT_FONT_FAMILY
Default font-family value.
protected static ImageIconframeIcon
The frame's icon.
protected Maphandlers
The option handlers.
protected VectorlastVisited
The array of last visited URIs
protected intmaxVisitedURIs
The actual allowed maximum number of last visited URIs
static intMAX_VISITED_URIS
Maximum number of recently visited URIs
protected booleanoverrideSecurityPolicy
Controls whether the application can override the system security policy property.
protected PreferenceDialogpreferenceDialog
The preference dialog.
protected XMLPreferenceManagerpreferenceManager
The preference manager.
static StringPOLICY_GRANT_SCRIPT_FILE_ACCESS
Entry for granting file system access to scripts
static StringPOLICY_GRANT_SCRIPT_NETWORK_ACCESS
Entry for granting network access to scripts
static StringPREFERENCE_KEY_VISITED_URI_LIST
Entry for the list of recently visited URI
static StringPREFERENCE_KEY_VISITED_URI_LIST_LENGTH
Entry for the maximum number of last visited URIs
static StringPROPERTY_JAVA_SECURITY_POLICY
System property for specifying an additional policy file.
static StringPROPERTY_USER_HOME
User home property
protected static ResourceManagerresources
The resource manager
static StringRESOURCES
The gui resources file name
protected ApplicationSecurityEnforcersecurityEnforcer
Script security enforcement is delegated to the security utility
protected StringsvgInitializationURI
Stores the initialization file URI
static StringSQUIGGLE_CONFIGURATION_FILE
Name of the Squiggle configuration file
static StringSQUIGGLE_POLICY_FILE
Name of the Squiggle policy file
static StringSQUIGGLE_SECURITY_POLICY
URL for Squiggle's security policy file
static StringSVG_INITIALIZATION
SVG initialization file, used to trigger loading of most of the Batik classes
protected StringuiSpecialization
The UI specialization to use in the JSVGViewerFrames.
static StringUNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION
Extension used in addition to the scriptType value to read from the PreferenceManager whether or not the scriptType can be loaded.
static StringURI_SEPARATOR
List of separators between URI values in the preference file
protected ListviewerFrames
The viewer frames.
Constructor Summary
Main(String[] args)
Creates a new application.
Method Summary
voidaddVisitedURI(String uri)
Notifies Application of recently visited URI
booleancanLoadScriptType(String scriptType)
Returns true if the input scriptType can be loaded in this application.
voidcloseJSVGViewerFrame(JSVGViewerFrame f)
Closes the given viewer frame.
JSVGViewerFramecreateAndShowJSVGViewerFrame()
Creates and shows a new viewer frame.
ActioncreateExitAction(JSVGViewerFrame vf)
Creates a new application exit action.
intgetAllowedExternalResourceOrigin()
Returns the allowed origins for external resources.
intgetAllowedScriptOrigin()
Returns the allowed origins for scripts.
StringgetDefaultFontFamily()
Returns the default value for the CSS "font-family" property
StringgetLanguages()
Returns the user languages.
StringgetMedia()
Returns the CSS media to use.
StringgetUISpecialization()
Returns the UI resource specialization to use.
StringgetUserStyleSheetURI()
Returns the user stylesheet uri.
String[]getVisitedURIs()
Asks Application for a list of recently visited URI.
StringgetXMLParserClassName()
Returns the XML parser class name.
protected voidinitializeLastVisited()
Initializes the lastVisited array
voidinstallCustomPolicyFile()
Installs a custom policy file in the '.batik' directory.
booleanisSelectionOverlayXORMode()
Returns true if the selection overlay is painted in XOR mode, false otherwise.
booleanisXMLParserValidating()
Returns true if the XML parser must be in validation mode, false otherwise.
static voidmain(String[] args)
Creates a viewer frame and shows it..
voidopenLink(String url)
Opens the given link in a new window.
protected voidprintUsage()
Prints the command line usage.
voidrun()
Runs the application.
voidshowPreferenceDialog(JSVGViewerFrame f)
Shows the preference dialog.

Field Detail

arguments

protected String[] arguments
The arguments.

bundle

protected static ResourceBundle bundle
The resource bundle

BATIK_CONFIGURATION_SUBDIRECTORY

public static final String BATIK_CONFIGURATION_SUBDIRECTORY
Batik configuration sub-directory

DEFAULT_DEFAULT_FONT_FAMILY

public static final String DEFAULT_DEFAULT_FONT_FAMILY
Default font-family value.

frameIcon

protected static ImageIcon frameIcon
The frame's icon.

handlers

protected Map handlers
The option handlers.

lastVisited

protected Vector lastVisited
The array of last visited URIs

maxVisitedURIs

protected int maxVisitedURIs
The actual allowed maximum number of last visited URIs

MAX_VISITED_URIS

public static final int MAX_VISITED_URIS
Maximum number of recently visited URIs

overrideSecurityPolicy

protected boolean overrideSecurityPolicy
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 started, in which case Batik will use that property.

preferenceDialog

protected PreferenceDialog preferenceDialog
The preference dialog.

preferenceManager

protected XMLPreferenceManager preferenceManager
The preference manager.

POLICY_GRANT_SCRIPT_FILE_ACCESS

public static final String POLICY_GRANT_SCRIPT_FILE_ACCESS
Entry for granting file system access to scripts

POLICY_GRANT_SCRIPT_NETWORK_ACCESS

public static final String POLICY_GRANT_SCRIPT_NETWORK_ACCESS
Entry for granting network access to scripts

PREFERENCE_KEY_VISITED_URI_LIST

public static final String PREFERENCE_KEY_VISITED_URI_LIST
Entry for the list of recently visited URI

PREFERENCE_KEY_VISITED_URI_LIST_LENGTH

public static final String PREFERENCE_KEY_VISITED_URI_LIST_LENGTH
Entry for the maximum number of last visited URIs

PROPERTY_JAVA_SECURITY_POLICY

public static final String PROPERTY_JAVA_SECURITY_POLICY
System property for specifying an additional policy file.

PROPERTY_USER_HOME

public static final String PROPERTY_USER_HOME
User home property

resources

protected static ResourceManager resources
The resource manager

RESOURCES

public static final String RESOURCES
The gui resources file name

securityEnforcer

protected ApplicationSecurityEnforcer securityEnforcer
Script security enforcement is delegated to the security utility

svgInitializationURI

protected String svgInitializationURI
Stores the initialization file URI

SQUIGGLE_CONFIGURATION_FILE

public static final String SQUIGGLE_CONFIGURATION_FILE
Name of the Squiggle configuration file

SQUIGGLE_POLICY_FILE

public static final String SQUIGGLE_POLICY_FILE
Name of the Squiggle policy file

SQUIGGLE_SECURITY_POLICY

public static final String SQUIGGLE_SECURITY_POLICY
URL for Squiggle's security policy file

SVG_INITIALIZATION

public static final String SVG_INITIALIZATION
SVG initialization file, used to trigger loading of most of the Batik classes

uiSpecialization

protected String uiSpecialization
The UI specialization to use in the JSVGViewerFrames.

UNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION

public static final String UNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION
Extension used in addition to the scriptType value to read from the PreferenceManager whether or not the scriptType can be loaded.

URI_SEPARATOR

public static final String URI_SEPARATOR
List of separators between URI values in the preference file

viewerFrames

protected List viewerFrames
The viewer frames.

Constructor Detail

Main

public Main(String[] args)
Creates a new application.

Parameters: args The command-line arguments.

Method Detail

addVisitedURI

public void addVisitedURI(String uri)
Notifies Application of recently visited URI

canLoadScriptType

public boolean canLoadScriptType(String scriptType)
Returns true if the input scriptType can be loaded in this application.

closeJSVGViewerFrame

public void closeJSVGViewerFrame(JSVGViewerFrame f)
Closes the given viewer frame.

createAndShowJSVGViewerFrame

public JSVGViewerFrame createAndShowJSVGViewerFrame()
Creates and shows a new viewer frame.

createExitAction

public Action createExitAction(JSVGViewerFrame vf)
Creates a new application exit action.

getAllowedExternalResourceOrigin

public int getAllowedExternalResourceOrigin()
Returns the allowed origins for external resources.

See Also: ResourceOrigin

getAllowedScriptOrigin

public int getAllowedScriptOrigin()
Returns the allowed origins for scripts.

See Also: ResourceOrigin

getDefaultFontFamily

public String getDefaultFontFamily()
Returns the default value for the CSS "font-family" property

getLanguages

public String getLanguages()
Returns the user languages.

getMedia

public String getMedia()
Returns the CSS media to use.

Returns: empty string if no CSS media was specified.

getUISpecialization

public String getUISpecialization()
Returns the UI resource specialization to use.

getUserStyleSheetURI

public String getUserStyleSheetURI()
Returns the user stylesheet uri.

Returns: null if no user style sheet was specified.

getVisitedURIs

public String[] getVisitedURIs()
Asks Application for a list of recently visited URI.

getXMLParserClassName

public String getXMLParserClassName()
Returns the XML parser class name.

initializeLastVisited

protected void initializeLastVisited()
Initializes the lastVisited array

installCustomPolicyFile

public void installCustomPolicyFile()
Installs a custom policy file in the '.batik' directory. This is initialized with the content of the policy file coming with the distribution

isSelectionOverlayXORMode

public boolean isSelectionOverlayXORMode()
Returns true if the selection overlay is painted in XOR mode, false otherwise.

isXMLParserValidating

public boolean isXMLParserValidating()
Returns true if the XML parser must be in validation mode, false otherwise.

main

public static void main(String[] args)
Creates a viewer frame and shows it..

Parameters: args The command-line arguments.

openLink

public void openLink(String url)
Opens the given link in a new window.

printUsage

protected void printUsage()
Prints the command line usage.

run

public void run()
Runs the application.

showPreferenceDialog

public void showPreferenceDialog(JSVGViewerFrame f)
Shows the preference dialog.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.