diva.graph.schematic
Class MultiWindowGraphEditor

java.lang.Object
  |
  +--diva.gui.AbstractApplication
        |
        +--diva.gui.MultiWindowApplication
              |
              +--diva.graph.schematic.MultiWindowGraphEditor
All Implemented Interfaces:
Application

public class MultiWindowGraphEditor
extends MultiWindowApplication

A graph editor for non-hierarchical graphs. This is a complete graph-editing application that includes automatic layout, load from and save to XML, editable properties, and so on. It is intended as an example application that you can use to understand the functionality of the diva.gui application framework, as well as a basis for building a customized graph editor for your own application.

This class subclasses diva.gui.MDIApplication. As such, it implements a straight-forward one-to-one mapping from documents to views. (If you need more complex document-view mappings, you will need to subclass AbstractApplication and implement the mappings yourself.) Subclasses of MDIApplication need to call setAppContext() with an instance of MDIFrame (in this case, we use DesktopContext). They also need to implement at least these methods:

  • public JComponent createView(Document d)

    Given an implementation of diva.gui.Document, create a suitable widget and return it. The MDIApplication superclass will take care adding it to the MDIFrame.

  • public String getTitle ()

    Return the title of the application -- this is shown in the title bar of the AppContext and other places.

  • public void redisplay (Document d, JComponent c);

    Redisplay the document after it is mapped to the screen. This only needs to be implemented by applications that need to know the size of the component to draw properly (for example, graph layout).

In addition to implementing diva.gui.Application, the only other interface that must be implemented to produce a complete function application is diva.gui.Document. See the CanvasDocument class.

Please also read the method documentation for this class, as well as the source code. Apart from providing implementation of the methods described above, it also initializes menubars, toolbars, and creates the Action objects that are executed in response to toolbar and menu commands.


Constructor Summary
MultiWindowGraphEditor(DesktopContext context)
          Construct a new graph editing application.
 
Method Summary
 View createView(Document d)
          Create a view on the given document.
 java.lang.String getTitle()
          Get the title of this application
 void initializeMenuBar(javax.swing.JMenuBar mb)
          Initialize the given menubar.
 void initializePalette()
          Initialize the palette in the.
 void initializeToolBar(javax.swing.JToolBar tb)
          Initialize the given toolbar.
static void main(java.lang.String[] argv)
          Create and run a new graph application
 
Methods inherited from class diva.gui.MultiWindowApplication
addView, getView, removeView
 
Methods inherited from class diva.gui.AbstractApplication
actions, addAction, addDocument, addDocumentListener, addMenuItem, addMenuItem, addPropertyChangeListener, addToolBarButton, addToolBarButton, addViewListener, closeDocument, closeView, documentList, getAction, getAppContext, getClipboard, getCurrentView, getDocumentFactory, getResources, getStoragePolicy, isVisible, removeDocument, removeDocumentListener, removePropertyChangeListener, removeViewListener, setAppContext, setClipboard, setCurrentView, setDocumentFactory, setStoragePolicy, setVisible, showError, viewList, viewList
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiWindowGraphEditor

public MultiWindowGraphEditor(DesktopContext context)
Construct a new graph editing application. The application will not have any open graph documents, until they are opened by getting the "Open" action an invoking its actionPerformed() method.
Method Detail

createView

public View createView(Document d)
Create a view on the given document.
Overrides:
createView in class MultiWindowApplication

getTitle

public java.lang.String getTitle()
Get the title of this application
Overrides:
getTitle in class AbstractApplication

initializePalette

public void initializePalette()
Initialize the palette in the.

initializeMenuBar

public void initializeMenuBar(javax.swing.JMenuBar mb)
Initialize the given menubar. Currently, all strings are hard-wired, but maybe we should be getting them out of the ApplicationResources.

initializeToolBar

public void initializeToolBar(javax.swing.JToolBar tb)
Initialize the given toolbar. Image icons will be obtained from the ApplicationResources object and added to the actions. Note that the image icons are not added to the actions -- if we did that, the icons would appear in the menus, which I suppose is a neat trick but completely useless.

main

public static void main(java.lang.String[] argv)
Create and run a new graph application


Contact 
©2002-2018 U.C. Regents