jfig.gui
Class Viewer

java.lang.Object
  extended byjfig.gui.Viewer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, FigBasicEditor, FigCanvasListener, FigDrawableEnumerator, java.awt.event.KeyListener

public class Viewer
extends java.lang.Object
implements FigBasicEditor, FigDrawableEnumerator, FigCanvasListener, java.awt.event.KeyListener, java.awt.event.ActionListener

the standalone jfig viewer.

A viewer for FIG 3.1 and (planned) FIG 3.2 files built on top of the jfig class library. The user interface consists of the main 'object canvas' and some buttons (open file, open http, zooming, etc.). This class is intended to display a single FIG file. Use the presentation viewer to view and browse jfig presentations.

To integrate the viewer with your own applications, use the following example code:

   ...
   jfig.gui.Viewer viewer = new jfig.gui.Viewer();
   viewer.doParseFile( "myfile.fig" );
   ... 
   viewer.doParseURL( "http://myserver/mypath/myfile.fig" );
   ...
 

See Also:
Editor, PresentationViewer

Nested Class Summary
(package private)  class Viewer.UrlDialogListener
           
 
Field Summary
(package private)  FigAttribs attribs
           
(package private)  Command command
           
(package private)  java.awt.FileDialog fileDialog
           
(package private)  java.lang.String filename
           
(package private)  java.util.Vector filenameStack
           
(package private)  java.lang.String filetype
           
(package private)  java.util.Vector filetypeStack
           
(package private)  java.awt.Frame frame
           
(package private)  StringDialog getUrlDialog
           
(package private)  java.lang.String helpfilename
           
(package private)  ViewerCanvas objectCanvas
           
(package private)  FigObjectList objectList
           
(package private)  java.util.Vector objectListStack
           
(package private)  FigParser parser
           
(package private)  ConsoleMessage printer
           
(package private)  StatusMessage statusField
           
(package private)  java.lang.String tmpfilename
           
(package private)  java.lang.String tmpfiletype
           
(package private)  FigObject tmpObject
           
(package private)  FigObjectList tmpObjectList
           
(package private)  FigObjectList triggerList
           
 java.lang.String TypeFILE
           
 java.lang.String TypeRESOURCE
           
 java.lang.String TypeURL
           
(package private)  UndoStack undoStack
           
(package private) static java.lang.String versionString
           
(package private)  ViewerButtonPanel viewerButtonPanel
           
(package private)  ViewerStatusPanel viewerStatusPanel
           
 
Constructor Summary
Viewer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
 void addTmpObject(FigObject obj)
           
 void call(java.lang.String methodName, java.lang.Object arg)
           
 boolean checkIsIdle()
           
 void deleteFromObjectList(FigObject obj)
           
 void deleteTmpObject(FigObject obj)
           
 void doPanHome()
           
 void doParseFile(java.lang.String fname)
           
 void doParseResource(java.lang.String s)
           
 void doParseURL(java.lang.String s)
           
 void doPrint()
           
 void doRedraw()
           
 void doSelectFile()
           
 void doSelectURL()
           
 void doShowHelp()
           
 void doShowNext()
           
 void doShowPrevious()
           
 void doToggleDisplayLinks()
           
 void doZoom11()
           
 void doZoomIn()
           
 void doZoomOut()
           
 void doZoomRegion()
           
 void doZoomRegion(int xl, int yt, int xr, int yb)
           
 FigObject[] findAllObjectsAt(java.awt.Point P)
           
 FigObject findNextObjectAt(java.awt.Point P, FigObject obj)
           
 FigObject findObjectAt(java.awt.Point P)
           
 FigAttribs getCurrentAttribs()
          getCurrentAttribs: return a reference to the current editor global object attributes.
 Command getCurrentCommand()
           
 java.util.Enumeration getDrawableObjects()
          return an Enumeration of all drawable objects
 java.lang.String getFilename()
          allow to query the current filename (if any)
 java.awt.Frame getFrame()
           
 FigCanvas getObjectCanvas()
          getObjectCanvas: return a reference to the FigCanvas responsible for displaying the grahics objects.
 java.util.Enumeration getObjects()
           
 FigDrawable getTmpObject()
          return a reference to the current 'active' (temporary) object
 FigObject[] getTmpObjects()
           
 UndoStack getUndoStack()
           
 void handleCommandCallback()
           
 void handleParserCallback()
           
 void hideAllObjectCorners()
           
 void insertIntoObjectList(FigObject obj)
           
 boolean isIdle()
           
 boolean isInObjectList(FigObject obj)
           
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
static void main(java.lang.String[] argv)
           
 void message(java.lang.String msg)
           
 void mousePressed(FigCanvasEvent evt)
          process a mouse event ME at world coordinates WP and screen coords SP
 void parse(java.io.InputStream IS)
           
 void printStacks()
           
 void setConsole(ConsoleMessage printer)
           
 void setCurrentAttribs(FigAttribs newAttribs)
           
 void setInitialWindowSize()
           
 void setZoomMessage()
           
 void showAllObjectCorners()
           
 void showObjectCorners(FigObject obj)
           
 void statusMessage(java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionString

static java.lang.String versionString

attribs

FigAttribs attribs

objectList

FigObjectList objectList

tmpObjectList

FigObjectList tmpObjectList

triggerList

FigObjectList triggerList

tmpObject

FigObject tmpObject

parser

FigParser parser

helpfilename

java.lang.String helpfilename

filename

java.lang.String filename

tmpfilename

java.lang.String tmpfilename

filetype

java.lang.String filetype

tmpfiletype

java.lang.String tmpfiletype

TypeFILE

public final java.lang.String TypeFILE
See Also:
Constant Field Values

TypeURL

public final java.lang.String TypeURL
See Also:
Constant Field Values

TypeRESOURCE

public final java.lang.String TypeRESOURCE
See Also:
Constant Field Values

printer

ConsoleMessage printer

statusField

StatusMessage statusField

frame

java.awt.Frame frame

objectCanvas

ViewerCanvas objectCanvas

viewerStatusPanel

ViewerStatusPanel viewerStatusPanel

viewerButtonPanel

ViewerButtonPanel viewerButtonPanel

fileDialog

java.awt.FileDialog fileDialog

getUrlDialog

StringDialog getUrlDialog

command

Command command

undoStack

UndoStack undoStack

filenameStack

java.util.Vector filenameStack

filetypeStack

java.util.Vector filetypeStack

objectListStack

java.util.Vector objectListStack
Constructor Detail

Viewer

public Viewer()
Method Detail

getUndoStack

public UndoStack getUndoStack()
Specified by:
getUndoStack in interface FigBasicEditor

getCurrentCommand

public Command getCurrentCommand()
Specified by:
getCurrentCommand in interface FigBasicEditor

getObjectCanvas

public FigCanvas getObjectCanvas()
Description copied from interface: FigBasicEditor
getObjectCanvas: return a reference to the FigCanvas responsible for displaying the grahics objects.

Specified by:
getObjectCanvas in interface FigBasicEditor

getCurrentAttribs

public FigAttribs getCurrentAttribs()
Description copied from interface: FigBasicEditor
getCurrentAttribs: return a reference to the current editor global object attributes. Like many graphical editors, jfig maintains a single global attribute object to use for all new objects.

Specified by:
getCurrentAttribs in interface FigBasicEditor

setCurrentAttribs

public void setCurrentAttribs(FigAttribs newAttribs)
Specified by:
setCurrentAttribs in interface FigBasicEditor

isInObjectList

public boolean isInObjectList(FigObject obj)
Specified by:
isInObjectList in interface FigBasicEditor

insertIntoObjectList

public void insertIntoObjectList(FigObject obj)
Specified by:
insertIntoObjectList in interface FigBasicEditor

deleteFromObjectList

public void deleteFromObjectList(FigObject obj)
Specified by:
deleteFromObjectList in interface FigBasicEditor

findObjectAt

public FigObject findObjectAt(java.awt.Point P)
Specified by:
findObjectAt in interface FigBasicEditor

findNextObjectAt

public FigObject findNextObjectAt(java.awt.Point P,
                                  FigObject obj)
Specified by:
findNextObjectAt in interface FigBasicEditor

findAllObjectsAt

public FigObject[] findAllObjectsAt(java.awt.Point P)
Specified by:
findAllObjectsAt in interface FigBasicEditor

getObjects

public java.util.Enumeration getObjects()
Specified by:
getObjects in interface FigBasicEditor

showAllObjectCorners

public void showAllObjectCorners()
Specified by:
showAllObjectCorners in interface FigBasicEditor

hideAllObjectCorners

public void hideAllObjectCorners()
Specified by:
hideAllObjectCorners in interface FigBasicEditor

showObjectCorners

public void showObjectCorners(FigObject obj)
Specified by:
showObjectCorners in interface FigBasicEditor

addTmpObject

public void addTmpObject(FigObject obj)
Specified by:
addTmpObject in interface FigBasicEditor

deleteTmpObject

public void deleteTmpObject(FigObject obj)
Specified by:
deleteTmpObject in interface FigBasicEditor

getTmpObjects

public FigObject[] getTmpObjects()
Specified by:
getTmpObjects in interface FigBasicEditor

call

public void call(java.lang.String methodName,
                 java.lang.Object arg)
Specified by:
call in interface FigBasicEditor

getFrame

public java.awt.Frame getFrame()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Specified by:
actionPerformed in interface FigBasicEditor

isIdle

public boolean isIdle()

checkIsIdle

public boolean checkIsIdle()

doSelectFile

public void doSelectFile()

doSelectURL

public void doSelectURL()

doParseURL

public void doParseURL(java.lang.String s)

doParseResource

public void doParseResource(java.lang.String s)

doParseFile

public void doParseFile(java.lang.String fname)

parse

public void parse(java.io.InputStream IS)

handleParserCallback

public void handleParserCallback()

handleCommandCallback

public void handleCommandCallback()

printStacks

public void printStacks()

doShowHelp

public void doShowHelp()

doShowPrevious

public void doShowPrevious()

doShowNext

public void doShowNext()

doPrint

public void doPrint()

doToggleDisplayLinks

public void doToggleDisplayLinks()

doZoomRegion

public void doZoomRegion()

doZoomRegion

public void doZoomRegion(int xl,
                         int yt,
                         int xr,
                         int yb)

doZoomIn

public void doZoomIn()

doZoomOut

public void doZoomOut()

doZoom11

public void doZoom11()

doPanHome

public void doPanHome()

doRedraw

public void doRedraw()
Specified by:
doRedraw in interface FigBasicEditor

setZoomMessage

public void setZoomMessage()

mousePressed

public void mousePressed(FigCanvasEvent evt)
Description copied from interface: FigCanvasListener
process a mouse event ME at world coordinates WP and screen coords SP

Specified by:
mousePressed in interface FigCanvasListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

statusMessage

public void statusMessage(java.lang.String msg)
Specified by:
statusMessage in interface FigBasicEditor

setInitialWindowSize

public void setInitialWindowSize()

getDrawableObjects

public java.util.Enumeration getDrawableObjects()
Description copied from interface: FigDrawableEnumerator
return an Enumeration of all drawable objects

Specified by:
getDrawableObjects in interface FigDrawableEnumerator

getTmpObject

public FigDrawable getTmpObject()
Description copied from interface: FigDrawableEnumerator
return a reference to the current 'active' (temporary) object

Specified by:
getTmpObject in interface FigDrawableEnumerator

getFilename

public java.lang.String getFilename()
Description copied from interface: FigBasicEditor
allow to query the current filename (if any)

Specified by:
getFilename in interface FigBasicEditor

setConsole

public void setConsole(ConsoleMessage printer)

message

public void message(java.lang.String msg)
Specified by:
message in interface FigBasicEditor

main

public static void main(java.lang.String[] argv)