Class Main
java.lang.Object
org.apache.batik.apps.svgbrowser.Main
- All Implemented Interfaces:
Application
This class contains the main method of an SVG viewer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classTo handle the '-font-size' option.protected static interfaceThis interface represents an option handler. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]The arguments.static final StringBatik configuration sub-directoryprotected static ResourceBundleThe resource bundlestatic final StringDefault font-family value.protected static ImageIconThe frame's icon.protected MapThe option handlers.protected VectorThe array of last visited URIsstatic final intMaximum number of recently visited URIsprotected intThe actual allowed maximum number of last visited URIsprotected booleanControls whether the application can override the system security policy property.static final StringEntry for granting file system access to scriptsstatic final StringEntry for granting network access to scriptsstatic final StringEntry for the list of recently visited URIstatic final StringEntry for the maximum number of last visited URIsprotected PreferenceDialogThe preference dialog.protected XMLPreferenceManagerThe preference manager.static final StringSystem property for specifying an additional policy file.static final StringUser home propertyprotected static ResourceManagerThe resource managerstatic final StringThe gui resources file nameprotected ApplicationSecurityEnforcerScript security enforcement is delegated to the security utilitystatic final StringName of the Squiggle configuration filestatic final StringName of the Squiggle policy filestatic final StringURL for Squiggle's security policy filestatic final StringSVG initialization file, used to trigger loading of most of the Batik classesprotected StringStores the initialization file URIprotected StringThe UI specialization to use in the JSVGViewerFrames.static final StringExtension used in addition to the scriptType value to read from the PreferenceManager whether or not the scriptType can be loaded.static final StringList of separators between URI values in the preference fileprotected ListThe viewer frames. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVisitedURI(String uri) Notifies Application of recently visited URIbooleancanLoadScriptType(String scriptType) Returns true if the input scriptType can be loaded in this application.voidCloses the given viewer frame.Creates and shows a new viewer frame.Creates a new application exit action.intReturns the allowed origins for external resources.intReturns the allowed origins for scripts.Returns the default value for the CSS "font-family" propertyReturns the user languages.getMedia()Returns the CSS media to use.Returns the UI resource specialization to use.Returns the user stylesheet uri.String[]Asks Application for a list of recently visited URI.Returns the XML parser class name.protected voidInitializes the lastVisited arrayvoidInstalls a custom policy file in the '.batik' directory.booleanReturns true if the selection overlay is painted in XOR mode, false otherwise.booleanReturns true if the XML parser must be in validation mode, false otherwise.static voidCreates a viewer frame and shows it..voidOpens the given link in a new window.protected voidPrints the command line usage.voidrun()Runs the application.voidShows the preference dialog.
-
Field Details
-
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.- See Also:
-
PROPERTY_USER_HOME
-
PROPERTY_JAVA_SECURITY_POLICY
System property for specifying an additional policy file.- See Also:
-
BATIK_CONFIGURATION_SUBDIRECTORY
Batik configuration sub-directory- See Also:
-
SQUIGGLE_CONFIGURATION_FILE
Name of the Squiggle configuration file- See Also:
-
SQUIGGLE_POLICY_FILE
-
POLICY_GRANT_SCRIPT_NETWORK_ACCESS
Entry for granting network access to scripts- See Also:
-
POLICY_GRANT_SCRIPT_FILE_ACCESS
Entry for granting file system access to scripts- See Also:
-
PREFERENCE_KEY_VISITED_URI_LIST
Entry for the list of recently visited URI- See Also:
-
PREFERENCE_KEY_VISITED_URI_LIST_LENGTH
Entry for the maximum number of last visited URIs- See Also:
-
URI_SEPARATOR
List of separators between URI values in the preference file- See Also:
-
DEFAULT_DEFAULT_FONT_FAMILY
-
SVG_INITIALIZATION
SVG initialization file, used to trigger loading of most of the Batik classes- See Also:
-
svgInitializationURI
Stores the initialization file URI -
RESOURCES
-
SQUIGGLE_SECURITY_POLICY
URL for Squiggle's security policy file- See Also:
-
bundle
The resource bundle -
resources
The resource manager -
frameIcon
The frame's icon. -
preferenceManager
The preference manager. -
MAX_VISITED_URIS
public static final int MAX_VISITED_URISMaximum number of recently visited URIs- See Also:
-
lastVisited
The array of last visited URIs -
maxVisitedURIs
protected int maxVisitedURIsThe actual allowed maximum number of last visited URIs -
arguments
The arguments. -
overrideSecurityPolicy
protected boolean overrideSecurityPolicyControls 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. -
securityEnforcer
Script security enforcement is delegated to the security utility -
handlers
The option handlers. -
viewerFrames
The viewer frames. -
preferenceDialog
The preference dialog. -
uiSpecialization
The UI specialization to use in the JSVGViewerFrames.
-
-
Constructor Details
-
Main
Creates a new application.- Parameters:
args- The command-line arguments.
-
-
Method Details
-
main
Creates a viewer frame and shows it..- Parameters:
args- The command-line arguments.
-
installCustomPolicyFile
Installs a custom policy file in the '.batik' directory. This is initialized with the content of the policy file coming with the distribution- Throws:
IOException
-
run
public void run()Runs the application. -
printUsage
protected void printUsage()Prints the command line usage. -
createAndShowJSVGViewerFrame
Creates and shows a new viewer frame.- Specified by:
createAndShowJSVGViewerFramein interfaceApplication
-
closeJSVGViewerFrame
Closes the given viewer frame.- Specified by:
closeJSVGViewerFramein interfaceApplication
-
createExitAction
Creates a new application exit action.- Specified by:
createExitActionin interfaceApplication
-
openLink
Opens the given link in a new window.- Specified by:
openLinkin interfaceApplication
-
getXMLParserClassName
Returns the XML parser class name.- Specified by:
getXMLParserClassNamein interfaceApplication
-
isXMLParserValidating
public boolean isXMLParserValidating()Returns true if the XML parser must be in validation mode, false otherwise.- Specified by:
isXMLParserValidatingin interfaceApplication
-
showPreferenceDialog
Shows the preference dialog.- Specified by:
showPreferenceDialogin interfaceApplication
-
getLanguages
Returns the user languages.- Specified by:
getLanguagesin interfaceApplication
-
getUserStyleSheetURI
Returns the user stylesheet uri.- Specified by:
getUserStyleSheetURIin interfaceApplication- Returns:
- null if no user style sheet was specified.
-
getDefaultFontFamily
Returns the default value for the CSS "font-family" property- Specified by:
getDefaultFontFamilyin interfaceApplication
-
getMedia
Returns the CSS media to use.- Specified by:
getMediain interfaceApplication- Returns:
- empty string if no CSS media was specified.
-
isSelectionOverlayXORMode
public boolean isSelectionOverlayXORMode()Returns true if the selection overlay is painted in XOR mode, false otherwise.- Specified by:
isSelectionOverlayXORModein interfaceApplication
-
canLoadScriptType
Returns true if the input scriptType can be loaded in this application.- Specified by:
canLoadScriptTypein interfaceApplication
-
getAllowedScriptOrigin
public int getAllowedScriptOrigin()Returns the allowed origins for scripts.- Specified by:
getAllowedScriptOriginin interfaceApplication- See Also:
-
getAllowedExternalResourceOrigin
public int getAllowedExternalResourceOrigin()Returns the allowed origins for external resources.- Specified by:
getAllowedExternalResourceOriginin interfaceApplication- See Also:
-
addVisitedURI
Notifies Application of recently visited URI- Specified by:
addVisitedURIin interfaceApplication
-
getVisitedURIs
Asks Application for a list of recently visited URI.- Specified by:
getVisitedURIsin interfaceApplication
-
getUISpecialization
Returns the UI resource specialization to use.- Specified by:
getUISpecializationin interfaceApplication
-
initializeLastVisited
protected void initializeLastVisited()Initializes the lastVisited array
-