diva.graph.schematic
Class GraphEditor

java.lang.Object
  extended by diva.gui.AbstractApplication
      extended by diva.gui.MDIApplication
          extended by diva.graph.schematic.GraphEditor
All Implemented Interfaces:
Application

public class GraphEditor
extends MDIApplication

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:

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.

Version:
$Revision: 1.5 $
Author:
John Reekie (johnr@eecs.berkeley.edu)

Constructor Summary
GraphEditor(DesktopContext context)
          Construct a new graph editing application.
 
Method Summary
 View createView(Document d)
          Create a view on the given document.
 String getTitle()
          Get the title of this application
 void initializeMenuBar(JMenuBar mb)
          Initialize the given menubar.
 void initializePalette()
          Initialize the palette in the.
 void initializeToolBar(JToolBar tb)
          Initialize the given toolbar.
static void main(String[] argv)
          Create and run a new graph application
 
Methods inherited from class diva.gui.MDIApplication
addView, getMDIContext, getView, removeView, setCurrentView
 
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, 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

GraphEditor

public GraphEditor(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.

Specified by:
createView in interface Application
Specified by:
createView in class MDIApplication

getTitle

public String getTitle()
Get the title of this application

Specified by:
getTitle in interface Application
Specified by:
getTitle in class AbstractApplication

initializePalette

public void initializePalette()
Initialize the palette in the.


initializeMenuBar

public void initializeMenuBar(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(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(String[] argv)
Create and run a new graph application



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.