org.apache.batik.apps.svgbrowser

Class JSVGViewerFrame

public class JSVGViewerFrame extends JFrame implements ActionMap, SVGDocumentLoaderListener, GVTTreeBuilderListener, SVGLoadEventDispatcherListener, GVTTreeRendererListener, LinkActivationListener, UpdateManagerListener

This class represents a SVG viewer swing frame.
Nested Class Summary
classJSVGViewerFrame.AboutAction
To show the about dialog
classJSVGViewerFrame.BackAction
To go back to the previous document
protected static classJSVGViewerFrame.Canvas
An extension of JSVGCanvas that exposes the Rhino interpreter.
classJSVGViewerFrame.CloseAction
To close the last document.
protected static classJSVGViewerFrame.Debugger
Rhino debugger class.
classJSVGViewerFrame.DOMViewerAction
To display the DOM viewer of the document
classJSVGViewerFrame.ExportAsJPGAction
To save the current document as JPG.
classJSVGViewerFrame.ExportAsPNGAction
To save the current document as PNG.
classJSVGViewerFrame.ExportAsTIFFAction
To save the current document as TIFF.
classJSVGViewerFrame.FindDialogAction
To display the Find dialog
classJSVGViewerFrame.FlushAction
To flush image cache (purely for debugging purposes)
classJSVGViewerFrame.ForwardAction
To go forward to the next document
classJSVGViewerFrame.FullScreenAction
To display the document full screen
protected static classJSVGViewerFrame.ImageFileFilter
A FileFilter used when exporting the SVG document as an image.
classJSVGViewerFrame.MonitorAction
To display the memory monitor.
classJSVGViewerFrame.NewWindowAction
To open a new window.
classJSVGViewerFrame.NextTransformAction
To go forward to the next transform
classJSVGViewerFrame.OpenAction
To open a new file.
classJSVGViewerFrame.OpenLocationAction
To open a new document.
classJSVGViewerFrame.PauseAction
To pause a document.
classJSVGViewerFrame.PlayAction
To restart after a pause.
classJSVGViewerFrame.PreferencesAction
To show the preferences.
classJSVGViewerFrame.PreviousTransformAction
To go back to the previous transform
classJSVGViewerFrame.PrintAction
To print the current document.
classJSVGViewerFrame.ReloadAction
To reload the current document.
classJSVGViewerFrame.SaveAsAction
To save the current document as SVG.
classJSVGViewerFrame.SetTransformAction
To show the set transform dialog
classJSVGViewerFrame.StopAction
To stop the current processing.
classJSVGViewerFrame.ThumbnailDialogAction
To display the Thumbnail dialog
classJSVGViewerFrame.ToggleDebuggerAction
To toggle visiblity of JavaScript Debugger.
protected classJSVGViewerFrame.UserAgent
This class implements a SVG user agent.
classJSVGViewerFrame.UseStylesheetAction
To apply the selected author stylesheet
classJSVGViewerFrame.ViewSourceAction
To view the source of the current document.
Field Summary
static StringABOUT_ACTION
protected StringalternateStyleSheet
The alternate style-sheet title.
protected Applicationapplication
The current application.
protected booleanautoAdjust
The auto adjust flag.
protected JSVGViewerFrame.BackActionbackAction
The back action
protected static ResourceBundlebundle
The resource bundle
static StringBACK_ACTION
protected FilecurrentPath
The current path.
protected FilecurrentSavePath
The current export path.
static StringCLOSE_ACTION
protected booleandebug
The debug flag.
protected JSVGViewerFrame.Debuggerdebugger
The debugger object.
protected static SquiggleInputHandlerdefaultHandler
The default input handler
protected DOMViewerdomViewer
The DOM viewer.
static CursorDEFAULT_CURSOR
The default cursor.
static StringDOM_VIEWER_ACTION
static StringEXIT_ACTION
static StringEXPORT_AS_JPG_ACTION
static StringEXPORT_AS_PNG_ACTION
static StringEXPORT_AS_TIFF_ACTION
protected FindDialogfindDialog
The Find dialog.
protected JSVGViewerFrame.ForwardActionforwardAction
The forward action
static StringFIND_DIALOG_ACTION
static StringFLUSH_ACTION
static StringFORWARD_ACTION
static StringFULL_SCREEN_ACTION
protected static Vectorhandlers
The input handlers
protected static StringJDK_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.
protected Maplisteners
The map that contains the action listeners
protected LocalHistorylocalHistory
The local history.
protected LocationBarlocationBar
The location bar.
protected booleanmanagerStopped
Whether the update manager was stopped.
protected static JFramememoryMonitorFrame
The memory monitor frame.
static StringMONITOR_ACTION
protected JSVGViewerFrame.NextTransformActionnextTransformAction
The next transform action
static StringNEW_WINDOW_ACTION
static StringNEXT_TRANSFORM_ACTION
static StringOPEN_ACTION
static StringOPEN_LOCATION_ACTION
protected static StringOPEN_TITLE
Resource string name for the Open dialog.
protected JSVGViewerFrame.PauseActionpauseAction
The pause action
protected JSVGViewerFrame.PlayActionplayAction
The play action
protected JSVGViewerFrame.PreviousTransformActionpreviousTransformAction
The previous transform action
protected static booleanpriorJDK1_4
Kind of ugly, but we need to know if we are running before or after 1.4...
static StringPAUSE_ACTION
static StringPLAY_ACTION
static StringPREFERENCES_ACTION
static StringPREVIOUS_TRANSFORM_ACTION
static StringPRINT_ACTION
static StringPROPERTY_OS_NAME
Name for the os-name property
static StringPROPERTY_OS_NAME_DEFAULT
Name for the os.name default
static StringPROPERTY_OS_WINDOWS_PREFIX
Name for the os.name property prefix we are looking for in OpenAction to work around JFileChooser bug
protected static ResourceManagerresources
The resource manager
static StringRELOAD_ACTION
static StringRESET_TRANSFORM_ACTION
static StringRESOURCES
The gui resources file name
protected StatusBarstatusBar
The status bar.
protected JSVGViewerFrame.StopActionstopAction
The stop action
protected JSVGViewerFrame.CanvassvgCanvas
The JSVGCanvas.
protected JPanelsvgCanvasPanel
The panel where the svgCanvas is displayed
protected SVGDocumentsvgDocument
The current document.
static StringSAVE_AS_ACTION
static StringSET_TRANSFORM_ACTION
static StringSTOP_ACTION
protected ThumbnailDialogthumbnailDialog
The Find dialog.
protected Stringtitle
The initial frame title.
protected JAffineTransformChooser.DialogtransformDialog
The transform dialog
protected TransformHistorytransformHistory
The transform history.
static StringTHUMBNAIL_DIALOG_ACTION
static StringTOGGLE_DEBUGGER_ACTION
protected URIChooseruriChooser
The URI chooser.
protected SVGUserAgentuserAgent
The SVG user agent.
protected JSVGViewerFrame.UseStylesheetActionuseStylesheetAction
The use (author) stylesheet action
static StringUSE_STYLESHEET_ACTION
static StringVIEW_SOURCE_ACTION
protected JWindowwindow
A window used for full screen display
static CursorWAIT_CURSOR
The cursor indicating that an operation is pending.
static StringZOOM_IN_ACTION
static StringZOOM_OUT_ACTION
Constructor Summary
JSVGViewerFrame(Application app)
Creates a new SVG viewer frame.
Method Summary
voiddispose()
Call dispose on canvas as well.
voiddocumentLoadingCancelled(SVGDocumentLoaderEvent e)
Called when the loading of a document was cancelled.
voiddocumentLoadingCompleted(SVGDocumentLoaderEvent e)
Called when the loading of a document was completed.
voiddocumentLoadingFailed(SVGDocumentLoaderEvent e)
Called when the loading of a document has failed.
voiddocumentLoadingStarted(SVGDocumentLoaderEvent e)
Called when the loading of a document was started.
ActiongetAction(String key)
Returns the action associated with the given string or null on error
protected static VectorgetHandlers()
Returns the list of input file handler.
SquiggleInputHandlergetInputHandler(ParsedURL purl)
Returns the input handler for the given URI
JSVGCanvasgetJSVGCanvas()
Returns the main JSVGCanvas of this frame.
voidgvtBuildCancelled(GVTTreeBuilderEvent e)
Called when a build was cancelled.
voidgvtBuildCompleted(GVTTreeBuilderEvent e)
Called when a build was completed.
voidgvtBuildFailed(GVTTreeBuilderEvent e)
Called when a build failed.
voidgvtBuildStarted(GVTTreeBuilderEvent e)
Called when a build started.
voidgvtRenderingCancelled(GVTTreeRendererEvent e)
Called when a rendering was cancelled.
voidgvtRenderingCompleted(GVTTreeRendererEvent e)
Called when a rendering was completed.
voidgvtRenderingFailed(GVTTreeRendererEvent e)
Called when a rendering failed.
voidgvtRenderingPrepare(GVTTreeRendererEvent e)
Called when a rendering is in its preparing phase.
voidgvtRenderingStarted(GVTTreeRendererEvent e)
Called when a rendering started.
voidhideDebugger()
Hides and destroys the Rhino debugger.
voidlinkActivated(LinkActivationEvent e)
Called when a link was activated.
voidmanagerResumed(UpdateManagerEvent e)
Called when the manager was resumed.
voidmanagerStarted(UpdateManagerEvent e)
Called when the manager was started.
voidmanagerStopped(UpdateManagerEvent e)
Called when the manager was stopped.
voidmanagerSuspended(UpdateManagerEvent e)
Called when the manager was suspended.
static voidregisterHandler(SquiggleInputHandler handler)
Registers an input file handler by adding it to the handlers map.
voidsetAutoAdjust(boolean b)
Whether to auto adjust the canvas to the size of the document.
voidsetDebug(boolean b)
Whether to show the debug traces.
voidsetSVGDocument(SVGDocument svgDocument, String svgDocumentURL, String svgDocumentTitle)
Forces the viewer frame to show the input SVGDocument
voidshowDebugger()
Shows the Rhino debugger.
voidshowSVGDocument(String uri)
Shows the given document into the viewer frame
voidsvgLoadEventDispatchCancelled(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch was cancelled.
voidsvgLoadEventDispatchCompleted(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch was completed.
voidsvgLoadEventDispatchFailed(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch failed.
voidsvgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch started.
voidupdateCompleted(UpdateManagerEvent e)
Called when an update was completed.
voidupdateFailed(UpdateManagerEvent e)
Called when an update failed.
voidupdateStarted(UpdateManagerEvent e)
Called when an update started.

Field Detail

ABOUT_ACTION

public static final String ABOUT_ACTION

alternateStyleSheet

protected String alternateStyleSheet
The alternate style-sheet title.

application

protected Application application
The current application.

autoAdjust

protected boolean autoAdjust
The auto adjust flag.

backAction

protected JSVGViewerFrame.BackAction backAction
The back action

bundle

protected static ResourceBundle bundle
The resource bundle

BACK_ACTION

public static final String BACK_ACTION

currentPath

protected File currentPath
The current path.

currentSavePath

protected File currentSavePath
The current export path.

CLOSE_ACTION

public static final String CLOSE_ACTION

debug

protected boolean debug
The debug flag.

debugger

protected JSVGViewerFrame.Debugger debugger
The debugger object.

defaultHandler

protected static SquiggleInputHandler defaultHandler
The default input handler

domViewer

protected DOMViewer domViewer
The DOM viewer.

DEFAULT_CURSOR

public static final Cursor DEFAULT_CURSOR
The default cursor.

DOM_VIEWER_ACTION

public static final String DOM_VIEWER_ACTION

EXIT_ACTION

public static final String EXIT_ACTION

EXPORT_AS_JPG_ACTION

public static final String EXPORT_AS_JPG_ACTION

EXPORT_AS_PNG_ACTION

public static final String EXPORT_AS_PNG_ACTION

EXPORT_AS_TIFF_ACTION

public static final String EXPORT_AS_TIFF_ACTION

findDialog

protected FindDialog findDialog
The Find dialog.

forwardAction

protected JSVGViewerFrame.ForwardAction forwardAction
The forward action

FIND_DIALOG_ACTION

public static final String FIND_DIALOG_ACTION

FLUSH_ACTION

public static final String FLUSH_ACTION

FORWARD_ACTION

public static final String FORWARD_ACTION

FULL_SCREEN_ACTION

public static final String FULL_SCREEN_ACTION

handlers

protected static Vector handlers
The input handlers

JDK_1_4_PRESENCE_TEST_CLASS

protected static final String 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.

listeners

protected Map listeners
The map that contains the action listeners

localHistory

protected LocalHistory localHistory
The local history.

locationBar

protected LocationBar locationBar
The location bar.

managerStopped

protected boolean managerStopped
Whether the update manager was stopped.

memoryMonitorFrame

protected static JFrame memoryMonitorFrame
The memory monitor frame.

MONITOR_ACTION

public static final String MONITOR_ACTION

nextTransformAction

protected JSVGViewerFrame.NextTransformAction nextTransformAction
The next transform action

NEW_WINDOW_ACTION

public static final String NEW_WINDOW_ACTION

NEXT_TRANSFORM_ACTION

public static final String NEXT_TRANSFORM_ACTION

OPEN_ACTION

public static final String OPEN_ACTION

OPEN_LOCATION_ACTION

public static final String OPEN_LOCATION_ACTION

OPEN_TITLE

protected static final String OPEN_TITLE
Resource string name for the Open dialog.

pauseAction

protected JSVGViewerFrame.PauseAction pauseAction
The pause action

playAction

protected JSVGViewerFrame.PlayAction playAction
The play action

previousTransformAction

protected JSVGViewerFrame.PreviousTransformAction previousTransformAction
The previous transform action

priorJDK1_4

protected static boolean priorJDK1_4
Kind of ugly, but we need to know if we are running before or after 1.4...

PAUSE_ACTION

public static final String PAUSE_ACTION

PLAY_ACTION

public static final String PLAY_ACTION

PREFERENCES_ACTION

public static final String PREFERENCES_ACTION

PREVIOUS_TRANSFORM_ACTION

public static final String PREVIOUS_TRANSFORM_ACTION

PRINT_ACTION

public static final String PRINT_ACTION

PROPERTY_OS_NAME

public static final String PROPERTY_OS_NAME
Name for the os-name property

PROPERTY_OS_NAME_DEFAULT

public static final String PROPERTY_OS_NAME_DEFAULT
Name for the os.name default

PROPERTY_OS_WINDOWS_PREFIX

public static final String PROPERTY_OS_WINDOWS_PREFIX
Name for the os.name property prefix we are looking for in OpenAction to work around JFileChooser bug

resources

protected static ResourceManager resources
The resource manager

RELOAD_ACTION

public static final String RELOAD_ACTION

RESET_TRANSFORM_ACTION

public static final String RESET_TRANSFORM_ACTION

RESOURCES

public static final String RESOURCES
The gui resources file name

statusBar

protected StatusBar statusBar
The status bar.

stopAction

protected JSVGViewerFrame.StopAction stopAction
The stop action

svgCanvas

protected JSVGViewerFrame.Canvas svgCanvas
The JSVGCanvas.

svgCanvasPanel

protected JPanel svgCanvasPanel
The panel where the svgCanvas is displayed

svgDocument

protected SVGDocument svgDocument
The current document.

SAVE_AS_ACTION

public static final String SAVE_AS_ACTION

SET_TRANSFORM_ACTION

public static final String SET_TRANSFORM_ACTION

STOP_ACTION

public static final String STOP_ACTION

thumbnailDialog

protected ThumbnailDialog thumbnailDialog
The Find dialog.

title

protected String title
The initial frame title.

transformDialog

protected JAffineTransformChooser.Dialog transformDialog
The transform dialog

transformHistory

protected TransformHistory transformHistory
The transform history.

THUMBNAIL_DIALOG_ACTION

public static final String THUMBNAIL_DIALOG_ACTION

TOGGLE_DEBUGGER_ACTION

public static final String TOGGLE_DEBUGGER_ACTION

uriChooser

protected URIChooser uriChooser
The URI chooser.

userAgent

protected SVGUserAgent userAgent
The SVG user agent.

useStylesheetAction

protected JSVGViewerFrame.UseStylesheetAction useStylesheetAction
The use (author) stylesheet action

USE_STYLESHEET_ACTION

public static final String USE_STYLESHEET_ACTION

VIEW_SOURCE_ACTION

public static final String VIEW_SOURCE_ACTION

window

protected JWindow window
A window used for full screen display

WAIT_CURSOR

public static final Cursor WAIT_CURSOR
The cursor indicating that an operation is pending.

ZOOM_IN_ACTION

public static final String ZOOM_IN_ACTION

ZOOM_OUT_ACTION

public static final String ZOOM_OUT_ACTION

Constructor Detail

JSVGViewerFrame

public JSVGViewerFrame(Application app)
Creates a new SVG viewer frame.

Method Detail

dispose

public void dispose()
Call dispose on canvas as well.

documentLoadingCancelled

public void documentLoadingCancelled(SVGDocumentLoaderEvent e)
Called when the loading of a document was cancelled.

documentLoadingCompleted

public void documentLoadingCompleted(SVGDocumentLoaderEvent e)
Called when the loading of a document was completed.

documentLoadingFailed

public void documentLoadingFailed(SVGDocumentLoaderEvent e)
Called when the loading of a document has failed.

documentLoadingStarted

public void documentLoadingStarted(SVGDocumentLoaderEvent e)
Called when the loading of a document was started.

getAction

public Action getAction(String key)
Returns the action associated with the given string or null on error

Parameters: key the key mapped with the action to get

Throws: MissingListenerException if the action is not found

getHandlers

protected static Vector getHandlers()
Returns the list of input file handler.

getInputHandler

public SquiggleInputHandler getInputHandler(ParsedURL purl)
Returns the input handler for the given URI

getJSVGCanvas

public JSVGCanvas getJSVGCanvas()
Returns the main JSVGCanvas of this frame.

gvtBuildCancelled

public void gvtBuildCancelled(GVTTreeBuilderEvent e)
Called when a build was cancelled.

gvtBuildCompleted

public void gvtBuildCompleted(GVTTreeBuilderEvent e)
Called when a build was completed.

gvtBuildFailed

public void gvtBuildFailed(GVTTreeBuilderEvent e)
Called when a build failed.

gvtBuildStarted

public void gvtBuildStarted(GVTTreeBuilderEvent e)
Called when a build started. The data of the event is initialized to the old document.

gvtRenderingCancelled

public void gvtRenderingCancelled(GVTTreeRendererEvent e)
Called when a rendering was cancelled.

gvtRenderingCompleted

public void gvtRenderingCompleted(GVTTreeRendererEvent e)
Called when a rendering was completed.

gvtRenderingFailed

public void gvtRenderingFailed(GVTTreeRendererEvent e)
Called when a rendering failed.

gvtRenderingPrepare

public void gvtRenderingPrepare(GVTTreeRendererEvent e)
Called when a rendering is in its preparing phase.

gvtRenderingStarted

public void gvtRenderingStarted(GVTTreeRendererEvent e)
Called when a rendering started.

hideDebugger

public void hideDebugger()
Hides and destroys the Rhino debugger.

linkActivated

public void linkActivated(LinkActivationEvent e)
Called when a link was activated.

managerResumed

public void managerResumed(UpdateManagerEvent e)
Called when the manager was resumed.

managerStarted

public void managerStarted(UpdateManagerEvent e)
Called when the manager was started.

managerStopped

public void managerStopped(UpdateManagerEvent e)
Called when the manager was stopped.

managerSuspended

public void managerSuspended(UpdateManagerEvent e)
Called when the manager was suspended.

registerHandler

public static void registerHandler(SquiggleInputHandler handler)
Registers an input file handler by adding it to the handlers map.

Parameters: handler the new input handler to register.

setAutoAdjust

public void setAutoAdjust(boolean b)
Whether to auto adjust the canvas to the size of the document.

setDebug

public void setDebug(boolean b)
Whether to show the debug traces.

setSVGDocument

public void setSVGDocument(SVGDocument svgDocument, String svgDocumentURL, String svgDocumentTitle)
Forces the viewer frame to show the input SVGDocument

showDebugger

public void showDebugger()
Shows the Rhino debugger.

showSVGDocument

public void showSVGDocument(String uri)
Shows the given document into the viewer frame

svgLoadEventDispatchCancelled

public void svgLoadEventDispatchCancelled(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch was cancelled.

svgLoadEventDispatchCompleted

public void svgLoadEventDispatchCompleted(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch was completed.

svgLoadEventDispatchFailed

public void svgLoadEventDispatchFailed(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch failed.

svgLoadEventDispatchStarted

public void svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e)
Called when a onload event dispatch started.

updateCompleted

public void updateCompleted(UpdateManagerEvent e)
Called when an update was completed.

updateFailed

public void updateFailed(UpdateManagerEvent e)
Called when an update failed.

updateStarted

public void updateStarted(UpdateManagerEvent e)
Called when an update started.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.