jfig.gui
Class JModularEditor

java.lang.Object
  extended byjfig.gui.JModularEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, FigBasicEditor, FigCanvasListener, FigDrawableEnumerator, java.awt.event.ItemListener, java.awt.event.KeyListener
Direct Known Subclasses:
JUserEditor

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

the core editor for jfig.

JModularEditor - the main editor class of jfig, the Java 1.1 and Java 2.x based xfig compatible graphics and diagram editor.


Nested Class Summary
(package private)  class JModularEditor.UrlDialogListener
           
 
Field Summary
protected static java.util.Hashtable _callbackTable
           
(package private)  JAboutDialog aboutDialog
           
(package private)  java.util.Hashtable activeFrames
           
(package private)  FigAttribs attribs
           
(package private)  JAttribsButtonPanel attribsButtonPanel
           
(package private)  javax.swing.JColorChooser colorChooser
           
(package private)  Command command
           
(package private)  JConsole console
           
(package private) static java.lang.String demoURL
           
(package private)  boolean displayTriggerFlag
           
(package private)  JEditorMenuBar editorMenuBar
           
(package private)  JExportOptionsDialog exportOptionsDialog
           
 int FIG_31
           
 int FIG_32
           
(package private)  javax.swing.JFileChooser fileChooser
           
(package private)  java.lang.String filename
           
(package private)  java.lang.String filetype
           
(package private)  javax.swing.JFrame frame
           
(package private)  JStringDialog getUrlDialog
           
(package private)  JEditGlobalAttributesDialog globalAttributesDialog
           
(package private)  KeyHandler keyHandler
           
(package private)  JLayerManager layerManager
           
(package private)  java.awt.Font menuFont
           
(package private)  JModeButtonPanel modeButtonPanel
           
(package private)  java.lang.Object mouseWheelZoomPanHandler
           
(package private)  FigCanvas objectCanvas
           
(package private)  FigObjectList objectList
           
(package private)  JConfirmDialog okToQuit
           
(package private)  FigParser parser
           
(package private)  JPdfExportOptionsDialog pdfExportOptionsDialog
           
(package private)  JRecentFileManager recentFileManager
           
(package private)  boolean saveFileEnable
           
(package private)  StatusMessage statusField
           
(package private)  JEditorStatusPanel statusPanel
           
(package private)  java.lang.String tmpfilename
           
(package private)  java.lang.String tmpfiletype
           
(package private)  FigObject tmpObject
           
(package private)  FigObjectList tmpObjectList
           
 java.lang.String TypeFILE
           
 java.lang.String TypeRESOURCE
           
 java.lang.String TypeURL
           
(package private)  UndoStack undoStack
           
(package private)  java.lang.String versionString
           
(package private)  FigWriter writer
           
 
Constructor Summary
JModularEditor()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          actionPerformed: process an action event using the global callback table.
 void addCallback(java.lang.String key, java.lang.String methodname)
          add an entry to our callback table.
 void addTmpObject(FigObject obj)
           
 void call(java.lang.String s, java.lang.Object arg)
           
 boolean checkCanCancel()
          check whether the current command can be canceled.
 void checkCreateAttributeCache()
           
 void checkCreateMouseWheelZoomPanHandler()
           
 boolean checkIsIdle()
           
 int checkUnsavedChanges()
           
 void checkUpdateLayerManager()
          check whether the layer manager is enabled and visible.
 void clearEditorState()
           
 void dbg(java.lang.String msg)
           
 void deleteFromObjectList(FigObject obj)
           
 void deleteTmpObject(FigObject obj)
           
 void doAddToAttributeCache(java.lang.Object arg)
           
 void doAddUserColor(java.lang.Object arg)
           
 void doAlignObjects(java.lang.Object arg)
           
 void doBreakCompound(java.lang.Object arg)
           
 void doBrowseOpenNextFile()
           
 void doBrowseOpenPreviousFile()
           
 void doCancel(java.lang.Object arg)
           
 void doCancelUpdate(java.lang.Object arg)
           
 void doClearAttributeCache(java.lang.Object arg)
           
 void doClearUserColors(java.lang.Object arg)
           
 void doConvertObject(java.lang.Object arg)
           
 void doCopyObject(java.lang.Object arg)
           
 void doCopyToClipboard(java.lang.Object arg)
           
 void doCreateArc(java.lang.Object arg)
           
 void doCreateBezier(java.lang.Object arg)
           
 void doCreateBullet(java.lang.Object arg)
           
 void doCreateCircle(java.lang.Object arg)
           
 void doCreateClosedBezier(java.lang.Object arg)
           
 void doCreateClosedSpline(java.lang.Object arg)
           
 void doCreateCompound(java.lang.Object arg)
           
 void doCreateDimensioning(java.lang.Object arg)
           
 void doCreateEllipse(java.lang.Object arg)
           
 void doCreateImage(java.lang.Object arg)
           
 void doCreateLink(java.lang.Object arg)
           
 void doCreatePolygon(java.lang.Object arg)
           
 void doCreatePolyline(java.lang.Object arg)
           
 void doCreateRectangle(java.lang.Object arg)
           
 void doCreateRoundRectangle(java.lang.Object arg)
           
 void doCreateSpline(java.lang.Object arg)
           
 void doCreateText(java.lang.Object arg)
           
 void doCutPoint(java.lang.Object arg)
           
 void doCutToClipboard(java.lang.Object arg)
           
 void doDeleteAll(java.lang.Object arg)
           
 void doDeleteObject(java.lang.Object arg)
           
 void doEditGlobalAttributes(java.lang.Object arg)
           
 void doEditObject(java.lang.Object arg)
           
 void doEditObjectComments(java.lang.Object arg)
           
 void doExportEPS(java.lang.Object arg)
           
 void doExportNativeGIF(java.lang.Object arg)
           
 void doExportNativePNG(java.lang.Object arg)
           
 void doExportNativePPM(java.lang.Object arg)
           
 void doExportPDF(java.lang.Object arg)
           
 void doExportPrintPS(java.lang.Object arg)
           
 void doExportPS(java.lang.Object arg)
           
 void doExportSettings(java.lang.Object arg)
           
 void doFlushUndoStack(java.lang.Object arg)
           
 void doInsertPoint(java.lang.Object arg)
           
 void doJoinSplitLines(java.lang.Object arg)
           
 void doMergeFile(java.lang.Object arg)
           
 void doMergeURL(java.lang.Object arg)
           
 void doMirrorXObject(java.lang.Object arg)
           
 void doMirrorYObject(java.lang.Object arg)
           
 void doMoveObject(java.lang.Object arg)
           
 void doMovePoint(java.lang.Object arg)
           
 void doNextAttributeCache(java.lang.Object arg)
           
 void doOpenCompound(java.lang.Object arg)
           
 void doOpenRecentFile(java.lang.Object arg)
           
 void doPanDown(java.lang.Object arg)
           
 void doPanHome(java.lang.Object arg)
           
 void doPanLeft(java.lang.Object arg)
           
 void doPanRight(java.lang.Object arg)
           
 void doPanUp(java.lang.Object arg)
           
 void doParseFile(java.lang.String fname, boolean merge)
           
 void doParseResource(java.lang.String s)
           
 void doParseURL(java.lang.String s, boolean merge)
           
 void doPasteFromClipboard(java.lang.Object arg)
           
 void doPrintClipboard(java.lang.Object arg)
           
 void doPrintObjects(java.lang.Object arg)
           
 void doPrintUndoStack(java.lang.Object arg)
           
 void doPrintViaAWT(java.lang.Object arg)
           
 void doQuit(java.lang.Object dummy)
           
 void doRedo(java.lang.Object arg)
          redo the topmost command from the undo stack.
 void doRedraw()
          perform a full redraw of the editor canvas.
 void doRedraw(java.lang.Object arg)
          this method stub is provided to allow for a (hopefully) fast redraw of the given object argument.
 void doResizeText(java.lang.Object arg)
           
 void doRotateCCWObject(java.lang.Object arg)
           
 void doRotateCWObject(java.lang.Object arg)
           
 void doSaveFile(java.lang.Object arg)
           
 void doSaveFileAs(java.lang.Object arg)
           
 void doSaveToConsole(java.lang.Object arg)
           
 void doScaleObject(java.lang.Object arg)
           
 void doSelectFile(java.lang.Object arg)
           
 void doSelectLibraryObject(java.lang.Object arg)
           
 void doSelectOutputFile()
           
 void doSelectURL(java.lang.Object arg)
           
 void doSetGridCoarse(java.lang.Object arg)
           
 void doSetGridFine(java.lang.Object arg)
           
 void doSetGridMedium(java.lang.Object arg)
           
 void doSetGridNone(java.lang.Object arg)
           
 void doSetGridTen(java.lang.Object arg)
           
 void doSetNoSnap(java.lang.Object arg)
           
 void doSetSnap110(java.lang.Object arg)
           
 void doSetSnap12(java.lang.Object arg)
           
 void doSetSnap14(java.lang.Object arg)
           
 void doSetSnap18(java.lang.Object arg)
           
 void doSetUnitsInches(java.lang.Object arg)
           
 void doSetUnitsMillimeter(java.lang.Object arg)
           
 void doSetUnitsXfigMillimeter(java.lang.Object arg)
           
 void doShowAboutDialog(java.lang.Object arg)
           
 void doShowChangesDialog(java.lang.Object arg)
           
 void doShowDemo(java.lang.String resourcename)
           
 void doShowDemoBiohazard(java.lang.Object arg)
           
 void doShowDemoCircuit(java.lang.Object arg)
           
 void doShowDemoFonts(java.lang.Object arg)
           
 void doShowDemoGold(java.lang.Object arg)
           
 void doShowDemoHouse(java.lang.Object arg)
           
 void doShowDemoLayout(java.lang.Object arg)
           
 void doShowDemoPictures(java.lang.Object arg)
           
 void doShowDemoRotated(java.lang.Object arg)
           
 void doShowDemoTeX(java.lang.Object arg)
           
 void doShowDemoUnicode(java.lang.Object arg)
           
 void doShowDemoWatch(java.lang.Object arg)
           
 void doShowDemoWelcome(java.lang.Object arg)
           
 void doShowEmbeddingJfigDialog(java.lang.Object arg)
           
 void doShowExportFaqDialog(java.lang.Object arg)
           
 void doShowFaqDialog(java.lang.Object arg)
           
 void doShowFontConfigurationDialog(java.lang.Object arg)
           
 void doShowHelpDialog(java.lang.Object arg)
           
 void doShowJvmDialog(java.lang.Object arg)
           
 void doShowLicenseDialog(java.lang.Object arg)
           
 void doShowMessages(java.lang.Object arg)
           
 void doShowMouseButtonDialog(java.lang.Object arg)
           
 void doShowParticipateDialog(java.lang.Object arg)
           
 void doShowPolylineHelpDialog(java.lang.Object arg)
           
 void doShowProperties(java.lang.Object dummy)
           
 void doShowReadmeDialog(java.lang.Object arg)
           
 void doShowRegistrationDialog(java.lang.Object arg)
           
 void doShowReminderDialog(java.lang.Object arg)
           
 void doShowShortcutKeysDialog(java.lang.Object arg)
           
 void doShowTexSupportDialog(java.lang.Object arg)
           
 void doSnapAllObjectsToGrid(java.lang.Object arg)
           
 void doSnapObjectToGrid(java.lang.Object arg)
           
 void doStartNewDrawing(java.lang.Object arg)
          prepare to start a new drawing, deleting all current objects.
 void doToggleShowTeXStringsMode(java.lang.Object arg)
           
 void doUndo(java.lang.Object arg)
          undo the topmost command from the undo stack.
 void doUpdateObject(java.lang.Object arg)
           
 void doWriteHadesResource(java.lang.Object argt)
           
 void doZoom11(java.lang.Object arg)
           
 void doZoomFactor(double factor)
           
 void doZoomFit(java.lang.Object arg)
           
 void doZoomIn(java.lang.Object arg)
           
 void doZoomOut(java.lang.Object arg)
           
 void doZoomRegion(int xl, int yt, int xr, int yb)
          the 'callback' method from the ZoomRegionCommand object.
 void doZoomRegion(java.lang.Object arg)
           
 void enableMouseWheelZoomPanHandler(boolean b)
           
 void enableUpdateAll(java.lang.Object arg)
           
 void enableUpdateInvert(java.lang.Object arg)
           
 void enableUpdateNone(java.lang.Object arg)
           
 FigObject[] findAllObjectsAt(java.awt.Point P)
           
 FigObject findNextObjectAt(java.awt.Point P, FigObject obj)
           
 FigObject findObjectAt(java.awt.Point P)
          findObjectAt: search the object list for an object near point P.
 FigObject findObjectAtNew(java.awt.Point p)
          find and reference a FigObject nearest to the given point p.
 FigObject findObjectAtOld(java.awt.Point P)
           
protected  FigObject findObjectNearOrOver(java.awt.Point P)
           
 java.util.Enumeration getActiveFrames()
          return an Enumeration of all java.awt.Frame instances we have created.
 java.lang.String getBaseFileName()
           
 java.util.Hashtable getCallbackTable()
           
 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
 ModularEditorState getEditorState()
           
 java.lang.String getFilename()
          allow to query the current filename (if any)
 java.awt.Frame getFrame()
           
 int getGeometryMode()
           
 JLayerManager getLayerManager()
           
 javax.swing.JMenuBar getMenuBar()
           
 int getObjectAlignmentModeX()
           
 int getObjectAlignmentModeY()
           
 FigCanvas getObjectCanvas()
          getObjectCanvas: return a reference to the FigCanvas responsible for displaying the grahics objects.
 java.util.Enumeration getObjects()
           
 int getSmartLinksMode()
           
 StatusMessage getStatusMessage()
          utility method to allow other classes full access to our status line with push'ing and pop'ping messages instead of just set'ting them.
 FigDrawable getTmpObject()
          return a reference to the current 'active' (temporary) object
 FigObject[] getTmpObjects()
           
 UndoStack getUndoStack()
           
 void getUserPreferences()
          getUserPreferences: check for the user preferences for units, paper size, paper orientation and set these values in our global FigAttribs object.
 void handleCommandCallback(java.lang.Object arg)
          handleCommandCallback: this method is called by all Command objects once they are finished.
 void handleParserCallback(java.lang.Object arg)
           
 void handleParserMergeCallback(java.lang.Object arg)
           
 void hideAllObjectCorners()
           
 void hideAllTriggers()
           
static void initializeSetupManagerProperties()
           
 void insertIntoObjectList(FigObject obj)
           
 boolean isIdle()
           
 boolean isInObjectList(FigObject obj)
           
 boolean isSaveFileEnabled()
           
 void itemStateChanged(java.awt.event.ItemEvent evt)
          currently, this method is only used to set the default output FIG version
 void keyPressed(java.awt.event.KeyEvent evt)
          keyPressed: react to key-presses on the jfig editor frame and object canvas.
 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 msg(java.lang.String s)
           
 void parse(java.io.InputStream IS, boolean merge)
          the central method to parse FIG objects from an input stream, called by doParseFile(), doParseURL(), doParseResource().
 void setCurrentAttribs(FigAttribs newAttribs)
           
 void setCurrentFigDirectory(javax.swing.JFileChooser fileChooser)
          check whether the "jfig.gui.CurrentFigFileDirectory" property from SetupManager and set the JFileChooser directory to the current value if the property is set.
 void setEditorState(ModularEditorState state)
           
 void setFigVersion(int v)
           
 void setInitialWindowSize()
           
 void setSaveFileEnable(boolean b)
           
 void setZoomMessage()
           
 void showAllObjectCorners()
           
 void showAllTriggers()
           
 void showObjectCorners(FigObject obj)
           
 void statusMessage(java.lang.String msg)
           
 void updateCurrentFigDirectory(java.lang.String pathname)
          set the "jfig.gui.CurrentFigFileDirectory" property in SetupManager to the given "pathname", which should be a valid directory name.
static void usage()
           
 void writeFigObjects(java.io.OutputStream os)
          write the current set of FIG objects to the specified output stream without modifying the editor state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionString

java.lang.String versionString

attribs

FigAttribs attribs

objectList

FigObjectList objectList

tmpObjectList

FigObjectList tmpObjectList

tmpObject

FigObject tmpObject

parser

FigParser parser

writer

FigWriter writer

exportOptionsDialog

JExportOptionsDialog exportOptionsDialog

pdfExportOptionsDialog

JPdfExportOptionsDialog pdfExportOptionsDialog

frame

javax.swing.JFrame frame

objectCanvas

FigCanvas objectCanvas

modeButtonPanel

JModeButtonPanel modeButtonPanel

attribsButtonPanel

JAttribsButtonPanel attribsButtonPanel

editorMenuBar

JEditorMenuBar editorMenuBar

statusPanel

JEditorStatusPanel statusPanel

console

JConsole console

layerManager

JLayerManager layerManager

aboutDialog

JAboutDialog aboutDialog

statusField

StatusMessage statusField

okToQuit

JConfirmDialog okToQuit

colorChooser

javax.swing.JColorChooser colorChooser

fileChooser

javax.swing.JFileChooser fileChooser

globalAttributesDialog

JEditGlobalAttributesDialog globalAttributesDialog

filename

java.lang.String filename

tmpfilename

java.lang.String tmpfilename

filetype

java.lang.String filetype

tmpfiletype

java.lang.String tmpfiletype

getUrlDialog

JStringDialog getUrlDialog

keyHandler

KeyHandler keyHandler

recentFileManager

JRecentFileManager recentFileManager

activeFrames

java.util.Hashtable activeFrames

mouseWheelZoomPanHandler

java.lang.Object mouseWheelZoomPanHandler

menuFont

java.awt.Font menuFont

command

Command command

undoStack

UndoStack undoStack

displayTriggerFlag

boolean displayTriggerFlag

saveFileEnable

boolean saveFileEnable

FIG_31

public final int FIG_31
See Also:
Constant Field Values

FIG_32

public final int FIG_32
See Also:
Constant Field Values

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

_callbackTable

protected static java.util.Hashtable _callbackTable

demoURL

static java.lang.String demoURL
Constructor Detail

JModularEditor

public JModularEditor()
Method Detail

setFigVersion

public void setFigVersion(int v)

getUserPreferences

public void getUserPreferences()
getUserPreferences: check for the user preferences for units, paper size, paper orientation and set these values in our global FigAttribs object.


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

insertIntoObjectList

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

deleteFromObjectList

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

isInObjectList

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

findObjectAt

public FigObject findObjectAt(java.awt.Point P)
findObjectAt: search the object list for an object near point P.

Currently, this method works in two passes as follows. In the first pass, the method will search for an object with one corner nearer than the cursor snap-distance from position P. The first such object will be returned.
If no object is found during the first pass, the search is repeated with less accuracy and will include all objects which are nearer than two (2) snap-distances to one corner and all objects which cover the position p.

Specified by:
findObjectAt in interface FigBasicEditor

findObjectAtNew

public FigObject findObjectAtNew(java.awt.Point p)
find and reference a FigObject nearest to the given point p.

This method traverses the current object list and searches for objects near to the given target position p. Here, the definition of "near" depends on the current status of the magnetic grid. If the magnetic grid is off, that is, the current value of canvas.getTrafo().getSnap() is zero, we allow for a mouse position mismatch of 8 pixels (this magic value is hardcoded in FigTrafo2D). Otherwise, we allow a position mismatch of up to two times the value of canvas.getTrafo().getSnapRelative(), where the factor of two handles the Manhattan geometry situation of a mouse position off-by-one in both horizontal and vertical orientation.

If no objects match the above definition of near, this method returns null. However, if multiple objects are near, this method simply returns the object found first, which is the topmost object with the smallest depth (layer) number.


findObjectAtOld

public FigObject findObjectAtOld(java.awt.Point P)

findObjectNearOrOver

protected FigObject findObjectNearOrOver(java.awt.Point P)

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

getStatusMessage

public StatusMessage getStatusMessage()
utility method to allow other classes full access to our status line with push'ing and pop'ping messages instead of just set'ting them.


getSmartLinksMode

public int getSmartLinksMode()

getGeometryMode

public int getGeometryMode()

getFrame

public java.awt.Frame getFrame()

getActiveFrames

public java.util.Enumeration getActiveFrames()
return an Enumeration of all java.awt.Frame instances we have created. This might be used for automatic testing or scripting of the editor.


getCallbackTable

public java.util.Hashtable getCallbackTable()

addCallback

public void addCallback(java.lang.String key,
                        java.lang.String methodname)
add an entry to our callback table. Use this method to call a method with name methodname as result of an ActionEvent evt with action command key.

For example, use something like the following: Button mandala = new Button( "create mandala" ); mandala.addActionListener( editor ); editor.addCallback( "create mandala", "doCreateMandala" ); Naturally, instead of adding callbacks via reflection, you can also create your own JModularEditor subclasses and override actionPerformed.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed: process an action event using the global callback table.

Except for special handling of the 'undo' and 'redo' commands, this method works as follows. First, we collect the action event's evt String argument (getActionCommand()) in our internal variable s. The resulting string is then searched for in the global callback table. If found, we retrieve the callback method name from the callback table and use Java 1.1 reflection to call that method, i.e. call( s, evt ). If no callback method is found, an error message is printed.

Specified by:
actionPerformed in interface FigBasicEditor

call

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

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent evt)
currently, this method is only used to set the default output FIG version

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

isIdle

public boolean isIdle()

checkIsIdle

public boolean checkIsIdle()

checkCanCancel

public boolean checkCanCancel()
check whether the current command can be canceled. Currently this is true for all commands.


doCancel

public void doCancel(java.lang.Object arg)

doUndo

public void doUndo(java.lang.Object arg)
undo the topmost command from the undo stack. Note that the undo() method of that command object will automatically update/redraw the objects as needed. However, we have to ensure that any ongoing command is finished first, in order to get consistent data structures. We do this by canceling the current command first. Note that this may also modify the undo stack.


doRedo

public void doRedo(java.lang.Object arg)
redo the topmost command from the undo stack. #see doUndo


doFlushUndoStack

public void doFlushUndoStack(java.lang.Object arg)

doDeleteAll

public void doDeleteAll(java.lang.Object arg)

doCopyToClipboard

public void doCopyToClipboard(java.lang.Object arg)

doCutToClipboard

public void doCutToClipboard(java.lang.Object arg)

doPasteFromClipboard

public void doPasteFromClipboard(java.lang.Object arg)

doExportSettings

public void doExportSettings(java.lang.Object arg)

doExportPS

public void doExportPS(java.lang.Object arg)

doExportEPS

public void doExportEPS(java.lang.Object arg)

doExportPrintPS

public void doExportPrintPS(java.lang.Object arg)

doExportNativeGIF

public void doExportNativeGIF(java.lang.Object arg)

doExportNativePNG

public void doExportNativePNG(java.lang.Object arg)

doExportNativePPM

public void doExportNativePPM(java.lang.Object arg)

doExportPDF

public void doExportPDF(java.lang.Object arg)

doCreateCircle

public void doCreateCircle(java.lang.Object arg)

doCreateEllipse

public void doCreateEllipse(java.lang.Object arg)

doCreateBullet

public void doCreateBullet(java.lang.Object arg)

doCreateDimensioning

public void doCreateDimensioning(java.lang.Object arg)

doCreateRectangle

public void doCreateRectangle(java.lang.Object arg)

doCreateRoundRectangle

public void doCreateRoundRectangle(java.lang.Object arg)

doCreatePolyline

public void doCreatePolyline(java.lang.Object arg)

doCreatePolygon

public void doCreatePolygon(java.lang.Object arg)

doCreateSpline

public void doCreateSpline(java.lang.Object arg)

doCreateClosedSpline

public void doCreateClosedSpline(java.lang.Object arg)

doCreateBezier

public void doCreateBezier(java.lang.Object arg)

doCreateClosedBezier

public void doCreateClosedBezier(java.lang.Object arg)

doCreateArc

public void doCreateArc(java.lang.Object arg)

doCreateImage

public void doCreateImage(java.lang.Object arg)

doCreateText

public void doCreateText(java.lang.Object arg)

doCreateLink

public void doCreateLink(java.lang.Object arg)

doSelectLibraryObject

public void doSelectLibraryObject(java.lang.Object arg)

doOpenCompound

public void doOpenCompound(java.lang.Object arg)

doCreateCompound

public void doCreateCompound(java.lang.Object arg)

doBreakCompound

public void doBreakCompound(java.lang.Object arg)

doMoveObject

public void doMoveObject(java.lang.Object arg)

doCopyObject

public void doCopyObject(java.lang.Object arg)

doDeleteObject

public void doDeleteObject(java.lang.Object arg)

doMovePoint

public void doMovePoint(java.lang.Object arg)

doInsertPoint

public void doInsertPoint(java.lang.Object arg)

doCutPoint

public void doCutPoint(java.lang.Object arg)

doMirrorXObject

public void doMirrorXObject(java.lang.Object arg)

doMirrorYObject

public void doMirrorYObject(java.lang.Object arg)

doRotateCWObject

public void doRotateCWObject(java.lang.Object arg)

doRotateCCWObject

public void doRotateCCWObject(java.lang.Object arg)

doScaleObject

public void doScaleObject(java.lang.Object arg)

doAlignObjects

public void doAlignObjects(java.lang.Object arg)

getObjectAlignmentModeX

public int getObjectAlignmentModeX()

getObjectAlignmentModeY

public int getObjectAlignmentModeY()

doSnapObjectToGrid

public void doSnapObjectToGrid(java.lang.Object arg)

doConvertObject

public void doConvertObject(java.lang.Object arg)

doJoinSplitLines

public void doJoinSplitLines(java.lang.Object arg)

doResizeText

public void doResizeText(java.lang.Object arg)

doUpdateObject

public void doUpdateObject(java.lang.Object arg)

doCancelUpdate

public void doCancelUpdate(java.lang.Object arg)

enableUpdateAll

public void enableUpdateAll(java.lang.Object arg)

enableUpdateNone

public void enableUpdateNone(java.lang.Object arg)

enableUpdateInvert

public void enableUpdateInvert(java.lang.Object arg)

doEditObject

public void doEditObject(java.lang.Object arg)

doEditObjectComments

public void doEditObjectComments(java.lang.Object arg)

doEditGlobalAttributes

public void doEditGlobalAttributes(java.lang.Object arg)

doShowFontConfigurationDialog

public void doShowFontConfigurationDialog(java.lang.Object arg)

doZoomRegion

public void doZoomRegion(java.lang.Object arg)

doZoomRegion

public void doZoomRegion(int xl,
                         int yt,
                         int xr,
                         int yb)
the 'callback' method from the ZoomRegionCommand object.


doZoomFactor

public void doZoomFactor(double factor)

doZoomFit

public void doZoomFit(java.lang.Object arg)

doZoomIn

public void doZoomIn(java.lang.Object arg)

doZoomOut

public void doZoomOut(java.lang.Object arg)

doZoom11

public void doZoom11(java.lang.Object arg)

setZoomMessage

public void setZoomMessage()

doPanHome

public void doPanHome(java.lang.Object arg)

doPanLeft

public void doPanLeft(java.lang.Object arg)

doPanRight

public void doPanRight(java.lang.Object arg)

doPanUp

public void doPanUp(java.lang.Object arg)

doPanDown

public void doPanDown(java.lang.Object arg)

doSetGridNone

public void doSetGridNone(java.lang.Object arg)

doSetGridCoarse

public void doSetGridCoarse(java.lang.Object arg)

doSetGridMedium

public void doSetGridMedium(java.lang.Object arg)

doSetGridFine

public void doSetGridFine(java.lang.Object arg)

doSetGridTen

public void doSetGridTen(java.lang.Object arg)

doSetNoSnap

public void doSetNoSnap(java.lang.Object arg)

doSetSnap12

public void doSetSnap12(java.lang.Object arg)

doSetSnap14

public void doSetSnap14(java.lang.Object arg)

doSetSnap18

public void doSetSnap18(java.lang.Object arg)

doSetSnap110

public void doSetSnap110(java.lang.Object arg)

doSetUnitsInches

public void doSetUnitsInches(java.lang.Object arg)

doSetUnitsMillimeter

public void doSetUnitsMillimeter(java.lang.Object arg)

doSetUnitsXfigMillimeter

public void doSetUnitsXfigMillimeter(java.lang.Object arg)

doToggleShowTeXStringsMode

public void doToggleShowTeXStringsMode(java.lang.Object arg)

doSnapAllObjectsToGrid

public void doSnapAllObjectsToGrid(java.lang.Object arg)

doClearUserColors

public void doClearUserColors(java.lang.Object arg)

doAddUserColor

public void doAddUserColor(java.lang.Object arg)

doWriteHadesResource

public void doWriteHadesResource(java.lang.Object argt)

checkCreateAttributeCache

public void checkCreateAttributeCache()

doAddToAttributeCache

public void doAddToAttributeCache(java.lang.Object arg)

doClearAttributeCache

public void doClearAttributeCache(java.lang.Object arg)

doNextAttributeCache

public void doNextAttributeCache(java.lang.Object arg)

doRedraw

public void doRedraw()
perform a full redraw of the editor canvas. This method currently directly dispatches to objectCanvas.doFullRedraw().

Specified by:
doRedraw in interface FigBasicEditor

doRedraw

public void doRedraw(java.lang.Object arg)
this method stub is provided to allow for a (hopefully) fast redraw of the given object argument. The current implementation, however, just dispatches to doRedraw() without any further processing or documentation.


checkUpdateLayerManager

public void checkUpdateLayerManager()
check whether the layer manager is enabled and visible. If so, rebuild the layer manager GUI from the current object list.


getLayerManager

public JLayerManager getLayerManager()

doStartNewDrawing

public void doStartNewDrawing(java.lang.Object arg)
prepare to start a new drawing, deleting all current objects. Usually, this method will check for unsaved changes, display the corresponding dialog window, and handle the answer. However, when called with the String argument "IGNORE_UNSAVED_CHANGES", this method will not perform any checks or display the dialog, which allows to call and use this method from scripts.


setCurrentFigDirectory

public void setCurrentFigDirectory(javax.swing.JFileChooser fileChooser)
check whether the "jfig.gui.CurrentFigFileDirectory" property from SetupManager and set the JFileChooser directory to the current value if the property is set.


updateCurrentFigDirectory

public void updateCurrentFigDirectory(java.lang.String pathname)
set the "jfig.gui.CurrentFigFileDirectory" property in SetupManager to the given "pathname", which should be a valid directory name.


doSelectFile

public void doSelectFile(java.lang.Object arg)

doOpenRecentFile

public void doOpenRecentFile(java.lang.Object arg)

doMergeFile

public void doMergeFile(java.lang.Object arg)

doBrowseOpenNextFile

public void doBrowseOpenNextFile()

doBrowseOpenPreviousFile

public void doBrowseOpenPreviousFile()

doSelectURL

public void doSelectURL(java.lang.Object arg)

doMergeURL

public void doMergeURL(java.lang.Object arg)

doParseURL

public void doParseURL(java.lang.String s,
                       boolean merge)

doParseResource

public void doParseResource(java.lang.String s)

doParseFile

public void doParseFile(java.lang.String fname,
                        boolean merge)

parse

public void parse(java.io.InputStream IS,
                  boolean merge)
the central method to parse FIG objects from an input stream, called by doParseFile(), doParseURL(), doParseResource().


handleParserCallback

public void handleParserCallback(java.lang.Object arg)

handleParserMergeCallback

public void handleParserMergeCallback(java.lang.Object arg)

handleCommandCallback

public void handleCommandCallback(java.lang.Object arg)
handleCommandCallback: this method is called by all Command objects once they are finished. To implement the standard xfig user interface metaphor with its editing modes, we just create a new Command object of the same class.

Note that some special handling is required for text and image objects.


checkUnsavedChanges

public int checkUnsavedChanges()

doQuit

public void doQuit(java.lang.Object dummy)

doSaveFile

public void doSaveFile(java.lang.Object arg)

doSaveFileAs

public void doSaveFileAs(java.lang.Object arg)

doSelectOutputFile

public void doSelectOutputFile()

isSaveFileEnabled

public boolean isSaveFileEnabled()

setSaveFileEnable

public void setSaveFileEnable(boolean b)

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

doSaveToConsole

public void doSaveToConsole(java.lang.Object arg)

writeFigObjects

public void writeFigObjects(java.io.OutputStream os)
                     throws java.io.IOException
write the current set of FIG objects to the specified output stream without modifying the editor state. For example, the undo stack is not modified by this operation. You also have to close the output stream yourself.

Throws:
java.io.IOException

doPrintViaAWT

public void doPrintViaAWT(java.lang.Object arg)

getBaseFileName

public java.lang.String getBaseFileName()

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

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
keyPressed: react to key-presses on the jfig editor frame and object canvas.

Currently, the following algorithm is used. We first check whether the user pressed the ESCAPE key. If so, the current command is canceled and replaced with the idle command.

Next, we check if the current command object is an instance of the CreateTextCommand. If so, the keypress is delivered to the 'keyPressed()' method of the CreateTextCommand. Please check the class documentation for details about this command class and possible subclasses.

Next, we check the keypress for Cursor-key events, which are used for object canvas panning operations. Note that panning via the keys is disabled during CreateTextCommands, because theses commands will intercept the corresponding cursor keys for their own purpose.

Finally, all other keypresses are silently ignored.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

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

statusMessage

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

setInitialWindowSize

public void setInitialWindowSize()

getMenuBar

public javax.swing.JMenuBar getMenuBar()

checkCreateMouseWheelZoomPanHandler

public void checkCreateMouseWheelZoomPanHandler()

enableMouseWheelZoomPanHandler

public void enableMouseWheelZoomPanHandler(boolean b)

hideAllTriggers

public void hideAllTriggers()

showAllTriggers

public void showAllTriggers()

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

message

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

msg

public void msg(java.lang.String s)

dbg

public void dbg(java.lang.String msg)

getEditorState

public ModularEditorState getEditorState()

setEditorState

public void setEditorState(ModularEditorState state)

clearEditorState

public void clearEditorState()

doPrintUndoStack

public void doPrintUndoStack(java.lang.Object arg)

doPrintClipboard

public void doPrintClipboard(java.lang.Object arg)

doPrintObjects

public void doPrintObjects(java.lang.Object arg)

doShowMessages

public void doShowMessages(java.lang.Object arg)

doShowProperties

public void doShowProperties(java.lang.Object dummy)

doShowAboutDialog

public void doShowAboutDialog(java.lang.Object arg)

doShowLicenseDialog

public void doShowLicenseDialog(java.lang.Object arg)

doShowReminderDialog

public void doShowReminderDialog(java.lang.Object arg)

doShowRegistrationDialog

public void doShowRegistrationDialog(java.lang.Object arg)

doShowParticipateDialog

public void doShowParticipateDialog(java.lang.Object arg)

doShowJvmDialog

public void doShowJvmDialog(java.lang.Object arg)

doShowChangesDialog

public void doShowChangesDialog(java.lang.Object arg)

doShowMouseButtonDialog

public void doShowMouseButtonDialog(java.lang.Object arg)

doShowShortcutKeysDialog

public void doShowShortcutKeysDialog(java.lang.Object arg)

doShowEmbeddingJfigDialog

public void doShowEmbeddingJfigDialog(java.lang.Object arg)

doShowTexSupportDialog

public void doShowTexSupportDialog(java.lang.Object arg)

doShowFaqDialog

public void doShowFaqDialog(java.lang.Object arg)

doShowReadmeDialog

public void doShowReadmeDialog(java.lang.Object arg)

doShowPolylineHelpDialog

public void doShowPolylineHelpDialog(java.lang.Object arg)

doShowExportFaqDialog

public void doShowExportFaqDialog(java.lang.Object arg)

doShowHelpDialog

public void doShowHelpDialog(java.lang.Object arg)

doShowDemo

public void doShowDemo(java.lang.String resourcename)

doShowDemoGold

public void doShowDemoGold(java.lang.Object arg)

doShowDemoHouse

public void doShowDemoHouse(java.lang.Object arg)

doShowDemoWatch

public void doShowDemoWatch(java.lang.Object arg)

doShowDemoCircuit

public void doShowDemoCircuit(java.lang.Object arg)

doShowDemoBiohazard

public void doShowDemoBiohazard(java.lang.Object arg)

doShowDemoLayout

public void doShowDemoLayout(java.lang.Object arg)

doShowDemoPictures

public void doShowDemoPictures(java.lang.Object arg)

doShowDemoRotated

public void doShowDemoRotated(java.lang.Object arg)

doShowDemoFonts

public void doShowDemoFonts(java.lang.Object arg)

doShowDemoTeX

public void doShowDemoTeX(java.lang.Object arg)

doShowDemoUnicode

public void doShowDemoUnicode(java.lang.Object arg)

doShowDemoWelcome

public void doShowDemoWelcome(java.lang.Object arg)

initializeSetupManagerProperties

public static void initializeSetupManagerProperties()

usage

public static void usage()

main

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