org.apache.batik.apps.svgviewer
Class ViewerFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--org.apache.batik.apps.svgviewer.ViewerFrame
All Implemented Interfaces:
javax.accessibility.Accessible, ActionMap, DocumentListener, java.awt.image.ImageObserver, JSVGCanvas.ZoomHandler, LanguageChangeHandler, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, UserAgent, UserStyleDialog.ChangeHandler, javax.swing.WindowConstants

public class ViewerFrame
extends javax.swing.JFrame
implements ActionMap, UserAgent, LanguageChangeHandler, UserStyleDialog.ChangeHandler, JSVGCanvas.ZoomHandler, DocumentListener

This class represents a viewer frame.

See Also:
Serialized Form

Inner Class Summary
 class ViewerFrame.AboutAction
          To display the about dialog.
static interface ViewerFrame.Application
          To manage the actions associated with the application.
 class ViewerFrame.BackAction
          To go back to the previous document
 class ViewerFrame.DescriptionAction
          To display the description of the document
 class ViewerFrame.ExportJPGAction
          To save the current document as JPG.
 class ViewerFrame.ExportPNGAction
          To save the current document as PNG.
 class ViewerFrame.FixedSizeAction
          To make the frame fit the SVG viewport
 class ViewerFrame.ForwardAction
          To go forward to the previous document
 class ViewerFrame.LanguageAction
          To show the language dialog.
 class ViewerFrame.LocationBarAction
          To manage the location bar action
 class ViewerFrame.MonitorAction
          To display the memory monitor.
 class ViewerFrame.NewWindowAction
          To create a new frame
 class ViewerFrame.OpenAction
          To open a new document
 class ViewerFrame.OpenPageAction
          To open a new document
 class ViewerFrame.ProgressivePaintAction
          To turn progressive rendering of the offscreen buffer on and off.
 class ViewerFrame.ReloadAction
          To reload the current document
protected  class ViewerFrame.SourceAction
          To view the current document source.
 class ViewerFrame.StopAction
          To stop the current processing
 class ViewerFrame.ThumbnailAction
          To display the thumbnail view of the document
 class ViewerFrame.TreeAction
          To display the tree view of the document
 class ViewerFrame.URIChooserOKAction
          The action associated with the 'OK' button of the URI chooser.
 class ViewerFrame.UserStyleAction
          To display the user style options dialog.
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.lang.String ABOUT_ACTION
           
protected static javax.swing.JFrame aboutFrame
          The about frame.
protected  ViewerFrame.Application application
          The application.
static java.lang.String BACK_ACTION
           
protected  ViewerFrame.BackAction backAction
          The back action
protected static char[] buffer
          The input buffer
protected static java.util.ResourceBundle bundle
          The resource bundle
protected  JSVGCanvas canvas
          The SVG canvas.
static java.lang.String CLOSE_ACTION
           
protected  java.lang.String currentExportPath
          The current path where to export files.
protected  java.lang.String currentPath
          The current path.
protected static java.awt.Cursor DEFAULT_CURSOR
          The default cursor.
protected  java.lang.String description
          The document description.
static java.lang.String DESCRIPTION_ACTION
           
protected  DOMViewer domViewer
          The tree view panel.
static java.lang.String EXIT_ACTION
           
static java.lang.String EXPORT_JPG_ACTION
           
static java.lang.String EXPORT_PNG_ACTION
           
static java.lang.String FIXED_SIZE_ACTION
           
protected  boolean fixedSize
          Has the windows a fixed size?
static java.lang.String FORWARD_ACTION
           
protected  ViewerFrame.ForwardAction forwardAction
          The forward action
static java.lang.String LANGUAGE_ACTION
           
protected  LanguageDialog languageDialog
          The language dialog.
protected  java.util.Map listeners
          The map that contains the action listeners
protected  int loadedDocument
          The current document index.
protected  java.util.List loadedDocuments
          The documents loaded with this viewer.
protected  int loadedDocumentsCount
          The loaded documents count.
protected  LocationBar locationBar
          The location bar.
protected static javax.swing.JFrame memoryMonitor
          The memory monitor frame.
static java.lang.String MONITOR_ACTION
           
static java.lang.String NEW_WINDOW_ACTION
           
static java.lang.String OPEN_ACTION
           
static java.lang.String OPEN_PAGE_ACTION
           
protected  javax.swing.JPanel panel
          The view panel.
static java.lang.String PROG_PAINT_ACTION
           
protected  boolean progressivePaintEnabled
          Is incremental painting of the offscreen buffer enabled?
static java.lang.String RELOAD_ACTION
           
protected  ViewerFrame.ReloadAction reloadAction
          The reload action
protected static ResourceManager resources
          The resource manager
static java.lang.String RESOURCES
          The gui resources file name
static java.lang.String SOURCE_ACTION
           
protected  StatusBar statusBar
          The status bar.
static java.lang.String STOP_ACTION
           
protected  ViewerFrame.StopAction stopAction
          The stop action
protected  java.lang.Thread thread
          The current processing thread
static java.lang.String THUMBNAIL_ACTION
           
protected  javax.swing.JFrame thumbnailFrame
          The thumbnail frame.
static java.lang.String TREE_ACTION
           
protected  java.lang.String uri
          The URI of the current document.
protected  URIChooser uriChooser
          The uri chooser.
static java.lang.String USER_STYLE_ACTION
           
protected  java.lang.String userLanguages
          The user languages.
protected  UserStyleDialog userStyleDialog
          The user style dialog.
protected  java.lang.String userStyleSheetURI
          The user style sheet URI.
protected static java.awt.Cursor WAIT_CURSOR
          The wait cursor.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, 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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ViewerFrame(ViewerFrame.Application a)
          Creates a new ViewerFrame object.
 
Method Summary
 void close()
          Closes the frame.
 void displayError(java.lang.Exception ex)
          Displays an error resulting from the specified Exception.
 void displayError(java.lang.String msg)
          Displays an error message in the User Agent interface.
 void displayMessage(java.lang.String message)
          Displays a message in the User Agent interface.
 javax.swing.Action getAction(java.lang.String key)
          Returns the action associated with the given string or null on error
 java.awt.Point getClientAreaLocationOnScreen()
          Returns the location on the screen of the client area in the UserAgent.
 EventDispatcher getEventDispatcher()
          Returns the EventDispatcher used by the UserAgent to dispatch events on GVT.
 java.lang.String getLanguages()
          Returns the language settings.
 java.lang.Thread getLoadingThread()
          Returns the current loading thread if one.
 float getPixelToMM()
          Returns the pixel to mm factor.
 java.awt.geom.AffineTransform getTransform()
          Returns the AffineTransform currently applied to the drawing by the UserAgent.
 java.lang.String getUserStyleSheetURI()
          Returns the user stylesheet uri.
 java.awt.geom.Dimension2D getViewportSize()
          Returns the default size of the viewport of this user agent.
 java.lang.String getXMLParserClassName()
          Returns the class name of the XML parser.
 boolean isFixedSize()
          Returns the fixedSize field value.
 void languageChanged(java.lang.String lang)
          Called when the language settings change.
 void loadDocument(java.lang.String s)
          Loads the given document.
 void openLink(SVGAElement elt)
          Opens a link.
 void processDocumentEvent(DocumentEvent e)
          Take action on receipt of a document event.
 void processDocumentLoadingEvent(DocumentLoadingEvent e)
          Take action on receipt of a document loading event.
 void processDocumentPropertyEvent(DocumentPropertyEvent e)
          Take action on receipt of a document property change.
 void runThread(java.lang.Thread t)
          Runs the given thread.
 void setFixedSize(boolean b)
          Tells the viewer whether or not it must be set to the size of the loaded documents.
 void setSVGCursor(java.awt.Cursor cursor)
          Informs the user agent to change the cursor.
 void userStyleSheetURIChanged(java.lang.String s)
          Called when the user stylesheet has changed.
 void zoomChanged(float f)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, 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, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

OPEN_ACTION

public static final java.lang.String OPEN_ACTION

OPEN_PAGE_ACTION

public static final java.lang.String OPEN_PAGE_ACTION

NEW_WINDOW_ACTION

public static final java.lang.String NEW_WINDOW_ACTION

EXPORT_PNG_ACTION

public static final java.lang.String EXPORT_PNG_ACTION

EXPORT_JPG_ACTION

public static final java.lang.String EXPORT_JPG_ACTION

RELOAD_ACTION

public static final java.lang.String RELOAD_ACTION

BACK_ACTION

public static final java.lang.String BACK_ACTION

FORWARD_ACTION

public static final java.lang.String FORWARD_ACTION

CLOSE_ACTION

public static final java.lang.String CLOSE_ACTION

EXIT_ACTION

public static final java.lang.String EXIT_ACTION

SOURCE_ACTION

public static final java.lang.String SOURCE_ACTION

DESCRIPTION_ACTION

public static final java.lang.String DESCRIPTION_ACTION

TREE_ACTION

public static final java.lang.String TREE_ACTION

THUMBNAIL_ACTION

public static final java.lang.String THUMBNAIL_ACTION

STOP_ACTION

public static final java.lang.String STOP_ACTION

FIXED_SIZE_ACTION

public static final java.lang.String FIXED_SIZE_ACTION

PROG_PAINT_ACTION

public static final java.lang.String PROG_PAINT_ACTION

LANGUAGE_ACTION

public static final java.lang.String LANGUAGE_ACTION

USER_STYLE_ACTION

public static final java.lang.String USER_STYLE_ACTION

MONITOR_ACTION

public static final java.lang.String MONITOR_ACTION

ABOUT_ACTION

public static final java.lang.String ABOUT_ACTION

DEFAULT_CURSOR

protected static final java.awt.Cursor DEFAULT_CURSOR
The default cursor.

WAIT_CURSOR

protected static final java.awt.Cursor WAIT_CURSOR
The wait cursor.

RESOURCES

public static final java.lang.String RESOURCES
The gui resources file name

memoryMonitor

protected static javax.swing.JFrame memoryMonitor
The memory monitor frame.

aboutFrame

protected static javax.swing.JFrame aboutFrame
The about frame.

bundle

protected static java.util.ResourceBundle bundle
The resource bundle

resources

protected static ResourceManager resources
The resource manager

buffer

protected static char[] buffer
The input buffer

application

protected ViewerFrame.Application application
The application.

locationBar

protected LocationBar locationBar
The location bar.

uri

protected java.lang.String uri
The URI of the current document.

currentPath

protected java.lang.String currentPath
The current path.

currentExportPath

protected java.lang.String currentExportPath
The current path where to export files.

uriChooser

protected URIChooser uriChooser
The uri chooser.

panel

protected javax.swing.JPanel panel
The view panel.

statusBar

protected StatusBar statusBar
The status bar.

canvas

protected JSVGCanvas canvas
The SVG canvas.

thread

protected java.lang.Thread thread
The current processing thread

domViewer

protected DOMViewer domViewer
The tree view panel.

languageDialog

protected LanguageDialog languageDialog
The language dialog.

userStyleDialog

protected UserStyleDialog userStyleDialog
The user style dialog.

thumbnailFrame

protected javax.swing.JFrame thumbnailFrame
The thumbnail frame.

reloadAction

protected ViewerFrame.ReloadAction reloadAction
The reload action

backAction

protected ViewerFrame.BackAction backAction
The back action

forwardAction

protected ViewerFrame.ForwardAction forwardAction
The forward action

stopAction

protected ViewerFrame.StopAction stopAction
The stop action

description

protected java.lang.String description
The document description.

fixedSize

protected boolean fixedSize
Has the windows a fixed size?

progressivePaintEnabled

protected boolean progressivePaintEnabled
Is incremental painting of the offscreen buffer enabled?

userLanguages

protected java.lang.String userLanguages
The user languages.

userStyleSheetURI

protected java.lang.String userStyleSheetURI
The user style sheet URI.

loadedDocuments

protected java.util.List loadedDocuments
The documents loaded with this viewer.

loadedDocument

protected int loadedDocument
The current document index.

loadedDocumentsCount

protected int loadedDocumentsCount
The loaded documents count.

listeners

protected java.util.Map listeners
The map that contains the action listeners
Constructor Detail

ViewerFrame

public ViewerFrame(ViewerFrame.Application a)
Creates a new ViewerFrame object.
Parameters:
a - The current application.
Method Detail

setFixedSize

public void setFixedSize(boolean b)
Tells the viewer whether or not it must be set to the size of the loaded documents.

isFixedSize

public boolean isFixedSize()
Returns the fixedSize field value.

getLoadingThread

public java.lang.Thread getLoadingThread()
Returns the current loading thread if one.

languageChanged

public void languageChanged(java.lang.String lang)
Called when the language settings change.
Specified by:
languageChanged in interface LanguageChangeHandler

userStyleSheetURIChanged

public void userStyleSheetURIChanged(java.lang.String s)
Called when the user stylesheet has changed.
Specified by:
userStyleSheetURIChanged in interface UserStyleDialog.ChangeHandler

zoomChanged

public void zoomChanged(float f)
Specified by:
zoomChanged in interface JSVGCanvas.ZoomHandler

getViewportSize

public java.awt.geom.Dimension2D getViewportSize()
Returns the default size of the viewport of this user agent.
Specified by:
getViewportSize in interface UserAgent

getEventDispatcher

public EventDispatcher getEventDispatcher()
Returns the EventDispatcher used by the UserAgent to dispatch events on GVT.
Specified by:
getEventDispatcher in interface UserAgent

displayError

public void displayError(java.lang.String msg)
Displays an error message in the User Agent interface.
Specified by:
displayError in interface UserAgent

displayError

public void displayError(java.lang.Exception ex)
Displays an error resulting from the specified Exception.
Specified by:
displayError in interface UserAgent

displayMessage

public void displayMessage(java.lang.String message)
Displays a message in the User Agent interface.
Specified by:
displayMessage in interface UserAgent

getPixelToMM

public float getPixelToMM()
Returns the pixel to mm factor.
Specified by:
getPixelToMM in interface UserAgent

getLanguages

public java.lang.String getLanguages()
Returns the language settings.
Specified by:
getLanguages in interface UserAgent

getUserStyleSheetURI

public java.lang.String getUserStyleSheetURI()
Returns the user stylesheet uri.
Specified by:
getUserStyleSheetURI in interface UserAgent
Returns:
null if no user style sheet was specified.

openLink

public void openLink(SVGAElement elt)
Opens a link.
Specified by:
openLink in interface UserAgent
Parameters:
elt - The activated link element.

setSVGCursor

public void setSVGCursor(java.awt.Cursor cursor)
Informs the user agent to change the cursor.
Specified by:
setSVGCursor in interface UserAgent
Parameters:
cursor - the new cursor

runThread

public void runThread(java.lang.Thread t)
Runs the given thread.
Specified by:
runThread in interface UserAgent

getXMLParserClassName

public java.lang.String getXMLParserClassName()
Returns the class name of the XML parser.
Specified by:
getXMLParserClassName in interface UserAgent

getTransform

public java.awt.geom.AffineTransform getTransform()
Returns the AffineTransform currently applied to the drawing by the UserAgent.
Specified by:
getTransform in interface UserAgent

getClientAreaLocationOnScreen

public java.awt.Point getClientAreaLocationOnScreen()
Returns the location on the screen of the client area in the UserAgent.
Specified by:
getClientAreaLocationOnScreen in interface UserAgent

loadDocument

public void loadDocument(java.lang.String s)
Loads the given document.
Parameters:
s - The document name.

getAction

public javax.swing.Action getAction(java.lang.String key)
                             throws MissingListenerException
Returns the action associated with the given string or null on error
Specified by:
getAction in interface ActionMap
Parameters:
key - the key mapped with the action to get
Throws:
MissingListenerException - if the action is not found

close

public void close()
Closes the frame.

processDocumentEvent

public void processDocumentEvent(DocumentEvent e)
Take action on receipt of a document event.
Specified by:
processDocumentEvent in interface DocumentListener

processDocumentLoadingEvent

public void processDocumentLoadingEvent(DocumentLoadingEvent e)
Take action on receipt of a document loading event.

processDocumentPropertyEvent

public void processDocumentPropertyEvent(DocumentPropertyEvent e)
Take action on receipt of a document property change.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.