Package org.apache.batik.apps.svgbrowser
Class JSVGViewerFrame
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.apache.batik.apps.svgbrowser.JSVGViewerFrame
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
,UpdateManagerListener
,GVTTreeRendererListener
,GVTTreeBuilderListener
,LinkActivationListener
,SVGDocumentLoaderListener
,SVGLoadEventDispatcherListener
,ActionMap
public class JSVGViewerFrame
extends JFrame
implements ActionMap, SVGDocumentLoaderListener, GVTTreeBuilderListener, SVGLoadEventDispatcherListener, GVTTreeRendererListener, LinkActivationListener, UpdateManagerListener
This class represents a SVG viewer swing frame.
- Version:
- $Id: JSVGViewerFrame.java 1851346 2019-01-15 13:41:00Z ssteiner $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
To show the about dialogclass
To go back to the previous documentprotected class
An extension of JSVGCanvas that exposes the Rhino interpreter.class
To close the last document.protected static class
Rhino debugger class.class
To display the DOM viewer of the documentclass
To save the current document as JPG.class
To save the current document as PNG.class
To save the current document as TIFF.class
To display the Find dialogclass
To flush image cache (purely for debugging purposes)class
To go forward to the next documentclass
To display the document full screenprotected static class
A FileFilter used when exporting the SVG document as an image.class
To display the memory monitor.class
To open a new window.class
To go forward to the next transformclass
To open a new file.class
To open a new document.class
To pause a document.class
To restart after a pause.class
To show the preferences.class
To go back to the previous transformclass
To print the current document.class
To reload the current document.class
To save the current document as SVG.class
To show the set transform dialogclass
To stop the current processing.class
To display the Thumbnail dialogclass
To toggle visiblity of JavaScript Debugger.protected class
This class implements a SVG user agent.class
To apply the selected author stylesheetclass
To view the source of the current document.Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected String
The alternate style-sheet title.protected Application
The current application.protected boolean
The auto adjust flag.static final String
protected JSVGViewerFrame.BackAction
The back actionprotected static ResourceBundle
The resource bundlestatic final String
protected File
The current path.protected File
The current export path.protected boolean
The debug flag.protected JSVGViewerFrame.Debugger
The debugger object.static final Cursor
The default cursor.protected static SquiggleInputHandler
The default input handlerstatic final String
protected DOMViewer
The DOM viewer.private static String
static final String
static final String
static final String
static final String
static final String
protected FindDialog
The Find dialog.static final String
static final String
protected JSVGViewerFrame.ForwardAction
The forward actionstatic final String
protected static Vector
The input handlersprotected static final String
If the following class can be found (it appeared in JDK 1.4), then we know we are post JDK 1.4.protected Map
The map that contains the action listenersprotected LocalHistory
The local history.protected LocationBar
The location bar.protected boolean
Whether the update manager was stopped.protected static JFrame
The memory monitor frame.static final String
static final String
static final String
protected JSVGViewerFrame.NextTransformAction
The next transform actionstatic final String
static final String
protected static final String
Resource string name for the Open dialog.static final String
protected JSVGViewerFrame.PauseAction
The pause actionstatic final String
protected JSVGViewerFrame.PlayAction
The play actionstatic final String
static final String
protected JSVGViewerFrame.PreviousTransformAction
The previous transform actionstatic final String
protected static boolean
Kind of ugly, but we need to know if we are running before or after 1.4...static final String
Name for the os-name propertystatic final String
Name for the os.name defaultstatic final String
Name for the os.name property prefix we are looking for in OpenAction to work around JFileChooser bugstatic final String
static final String
protected static ResourceManager
The resource managerstatic final String
The gui resources file namestatic final String
static final String
protected StatusBar
The status bar.static final String
protected JSVGViewerFrame.StopAction
The stop actionprotected JSVGViewerFrame.Canvas
The JSVGCanvas.protected JPanel
The panel where the svgCanvas is displayedprotected org.w3c.dom.svg.SVGDocument
The current document.static final String
protected ThumbnailDialog
The Find dialog.(package private) long
protected String
The initial frame title.static final String
protected JAffineTransformChooser.Dialog
The transform dialogprotected TransformHistory
The transform history.protected URIChooser
The URI chooser.static final String
protected SVGUserAgent
The SVG user agent.protected JSVGViewerFrame.UseStylesheetAction
The use (author) stylesheet actionstatic final String
static final Cursor
The cursor indicating that an operation is pending.protected JWindow
A window used for full screen displaystatic final String
static final String
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Call dispose on canvas as well.void
Called when the loading of a document was cancelled.void
Called when the loading of a document was completed.void
Called when the loading of a document has failed.void
Called when the loading of a document was started.Returns the action associated with the given string or null on errorprotected static Vector
Returns the list of input file handler.getInputHandler
(ParsedURL purl) Returns the input handler for the given URIReturns the main JSVGCanvas of this frame.void
Called when a build was cancelled.void
Called when a build was completed.void
Called when a build failed.void
Called when a build started.void
Called when a rendering was cancelled.void
Called when a rendering was completed.void
Called when a rendering failed.void
Called when a rendering is in its preparing phase.void
Called when a rendering started.void
Hides and destroys the Rhino debugger.void
Called when a link was activated.private static File
makeAbsolute
(File f) Needed to work-around JFileChooser bug with abstract Filesvoid
Called when the manager was resumed.void
Called when the manager was started.void
Called when the manager was stopped.void
Called when the manager was suspended.static void
registerHandler
(SquiggleInputHandler handler) Registers an input file handler by adding it to the handlers map.void
setAutoAdjust
(boolean b) Whether to auto adjust the canvas to the size of the document.void
setDebug
(boolean b) Whether to show the debug traces.void
setSVGDocument
(org.w3c.dom.svg.SVGDocument svgDocument, String svgDocumentURL, String svgDocumentTitle) Forces the viewer frame to show the input SVGDocumentvoid
Shows the Rhino debugger.void
showSVGDocument
(String uri) Shows the given document into the viewer framevoid
Called when a onload event dispatch was cancelled.void
Called when a onload event dispatch was completed.void
Called when a onload event dispatch failed.void
Called when a onload event dispatch started.void
Called when an update was completed.void
Called when an update failed.void
Called when an update started.Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
EOL
-
priorJDK1_4
protected static boolean priorJDK1_4Kind of ugly, but we need to know if we are running before or after 1.4... -
JDK_1_4_PRESENCE_TEST_CLASS
If the following class can be found (it appeared in JDK 1.4), then we know we are post JDK 1.4.- See Also:
-
RESOURCES
The gui resources file name- See Also:
-
ABOUT_ACTION
- See Also:
-
OPEN_ACTION
- See Also:
-
OPEN_LOCATION_ACTION
- See Also:
-
NEW_WINDOW_ACTION
- See Also:
-
RELOAD_ACTION
- See Also:
-
SAVE_AS_ACTION
- See Also:
-
BACK_ACTION
- See Also:
-
FORWARD_ACTION
- See Also:
-
FULL_SCREEN_ACTION
- See Also:
-
PRINT_ACTION
- See Also:
-
EXPORT_AS_JPG_ACTION
- See Also:
-
EXPORT_AS_PNG_ACTION
- See Also:
-
EXPORT_AS_TIFF_ACTION
- See Also:
-
PREFERENCES_ACTION
- See Also:
-
CLOSE_ACTION
- See Also:
-
VIEW_SOURCE_ACTION
- See Also:
-
EXIT_ACTION
- See Also:
-
RESET_TRANSFORM_ACTION
- See Also:
-
ZOOM_IN_ACTION
- See Also:
-
ZOOM_OUT_ACTION
- See Also:
-
PREVIOUS_TRANSFORM_ACTION
- See Also:
-
NEXT_TRANSFORM_ACTION
- See Also:
-
USE_STYLESHEET_ACTION
- See Also:
-
PLAY_ACTION
- See Also:
-
PAUSE_ACTION
- See Also:
-
STOP_ACTION
- See Also:
-
MONITOR_ACTION
- See Also:
-
DOM_VIEWER_ACTION
- See Also:
-
SET_TRANSFORM_ACTION
- See Also:
-
FIND_DIALOG_ACTION
- See Also:
-
THUMBNAIL_DIALOG_ACTION
- See Also:
-
FLUSH_ACTION
- See Also:
-
TOGGLE_DEBUGGER_ACTION
- See Also:
-
WAIT_CURSOR
The cursor indicating that an operation is pending. -
DEFAULT_CURSOR
The default cursor. -
PROPERTY_OS_NAME
Name for the os-name property -
PROPERTY_OS_NAME_DEFAULT
Name for the os.name default -
PROPERTY_OS_WINDOWS_PREFIX
Name for the os.name property prefix we are looking for in OpenAction to work around JFileChooser bug -
OPEN_TITLE
Resource string name for the Open dialog.- See Also:
-
handlers
The input handlers -
defaultHandler
The default input handler -
bundle
The resource bundle -
resources
The resource manager -
application
The current application. -
svgCanvas
The JSVGCanvas. -
svgCanvasPanel
The panel where the svgCanvas is displayed -
window
A window used for full screen display -
memoryMonitorFrame
The memory monitor frame. -
currentPath
The current path. -
currentSavePath
The current export path. -
backAction
The back action -
forwardAction
The forward action -
playAction
The play action -
pauseAction
The pause action -
stopAction
The stop action -
previousTransformAction
The previous transform action -
nextTransformAction
The next transform action -
useStylesheetAction
The use (author) stylesheet action -
debug
protected boolean debugThe debug flag. -
autoAdjust
protected boolean autoAdjustThe auto adjust flag. -
managerStopped
protected boolean managerStoppedWhether the update manager was stopped. -
userAgent
The SVG user agent. -
svgDocument
protected org.w3c.dom.svg.SVGDocument svgDocumentThe current document. -
uriChooser
The URI chooser. -
domViewer
The DOM viewer. -
findDialog
The Find dialog. -
thumbnailDialog
The Find dialog. -
transformDialog
The transform dialog -
locationBar
The location bar. -
statusBar
The status bar. -
title
The initial frame title. -
localHistory
The local history. -
transformHistory
The transform history. -
alternateStyleSheet
The alternate style-sheet title. -
debugger
The debugger object. -
listeners
The map that contains the action listeners -
time
long time
-
-
Constructor Details
-
JSVGViewerFrame
Creates a new SVG viewer frame.
-
-
Method Details
-
dispose
public void dispose()Call dispose on canvas as well. -
setDebug
public void setDebug(boolean b) Whether to show the debug traces. -
setAutoAdjust
public void setAutoAdjust(boolean b) Whether to auto adjust the canvas to the size of the document. -
getJSVGCanvas
Returns the main JSVGCanvas of this frame. -
makeAbsolute
Needed to work-around JFileChooser bug with abstract Files -
showDebugger
public void showDebugger()Shows the Rhino debugger. -
hideDebugger
public void hideDebugger()Hides and destroys the Rhino debugger. -
showSVGDocument
Shows the given document into the viewer frame -
getInputHandler
Returns the input handler for the given URI- Throws:
IOException
-
getHandlers
Returns the list of input file handler. -
registerHandler
Registers an input file handler by adding it to the handlers map.- Parameters:
handler
- the new input handler to register.
-
getAction
Returns the action associated with the given string or null on error- Specified by:
getAction
in interfaceActionMap
- Parameters:
key
- the key mapped with the action to get- Throws:
MissingListenerException
- if the action is not found
-
documentLoadingStarted
Called when the loading of a document was started.- Specified by:
documentLoadingStarted
in interfaceSVGDocumentLoaderListener
-
documentLoadingCompleted
Called when the loading of a document was completed.- Specified by:
documentLoadingCompleted
in interfaceSVGDocumentLoaderListener
-
setSVGDocument
public void setSVGDocument(org.w3c.dom.svg.SVGDocument svgDocument, String svgDocumentURL, String svgDocumentTitle) Forces the viewer frame to show the input SVGDocument -
documentLoadingCancelled
Called when the loading of a document was cancelled.- Specified by:
documentLoadingCancelled
in interfaceSVGDocumentLoaderListener
-
documentLoadingFailed
Called when the loading of a document has failed.- Specified by:
documentLoadingFailed
in interfaceSVGDocumentLoaderListener
-
gvtBuildStarted
Called when a build started. The data of the event is initialized to the old document.- Specified by:
gvtBuildStarted
in interfaceGVTTreeBuilderListener
-
gvtBuildCompleted
Called when a build was completed.- Specified by:
gvtBuildCompleted
in interfaceGVTTreeBuilderListener
-
gvtBuildCancelled
Called when a build was cancelled.- Specified by:
gvtBuildCancelled
in interfaceGVTTreeBuilderListener
-
gvtBuildFailed
Called when a build failed.- Specified by:
gvtBuildFailed
in interfaceGVTTreeBuilderListener
-
svgLoadEventDispatchStarted
Called when a onload event dispatch started.- Specified by:
svgLoadEventDispatchStarted
in interfaceSVGLoadEventDispatcherListener
-
svgLoadEventDispatchCompleted
Called when a onload event dispatch was completed.- Specified by:
svgLoadEventDispatchCompleted
in interfaceSVGLoadEventDispatcherListener
-
svgLoadEventDispatchCancelled
Called when a onload event dispatch was cancelled.- Specified by:
svgLoadEventDispatchCancelled
in interfaceSVGLoadEventDispatcherListener
-
svgLoadEventDispatchFailed
Called when a onload event dispatch failed.- Specified by:
svgLoadEventDispatchFailed
in interfaceSVGLoadEventDispatcherListener
-
gvtRenderingPrepare
Called when a rendering is in its preparing phase.- Specified by:
gvtRenderingPrepare
in interfaceGVTTreeRendererListener
-
gvtRenderingStarted
Called when a rendering started.- Specified by:
gvtRenderingStarted
in interfaceGVTTreeRendererListener
-
gvtRenderingCompleted
Called when a rendering was completed.- Specified by:
gvtRenderingCompleted
in interfaceGVTTreeRendererListener
-
gvtRenderingCancelled
Called when a rendering was cancelled.- Specified by:
gvtRenderingCancelled
in interfaceGVTTreeRendererListener
-
gvtRenderingFailed
Called when a rendering failed.- Specified by:
gvtRenderingFailed
in interfaceGVTTreeRendererListener
-
linkActivated
Called when a link was activated.- Specified by:
linkActivated
in interfaceLinkActivationListener
-
managerStarted
Called when the manager was started.- Specified by:
managerStarted
in interfaceUpdateManagerListener
-
managerSuspended
Called when the manager was suspended.- Specified by:
managerSuspended
in interfaceUpdateManagerListener
-
managerResumed
Called when the manager was resumed.- Specified by:
managerResumed
in interfaceUpdateManagerListener
-
managerStopped
Called when the manager was stopped.- Specified by:
managerStopped
in interfaceUpdateManagerListener
-
updateStarted
Called when an update started.- Specified by:
updateStarted
in interfaceUpdateManagerListener
-
updateCompleted
Called when an update was completed.- Specified by:
updateCompleted
in interfaceUpdateManagerListener
-
updateFailed
Called when an update failed.- Specified by:
updateFailed
in interfaceUpdateManagerListener
-