Class BasicGraphFrame
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- ptolemy.gui.Top
-
- ptolemy.actor.gui.TableauFrame
-
- ptolemy.actor.gui.PtolemyFrame
-
- ptolemy.vergil.basic.BasicGraphFrame
-
- All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.awt.event.WindowFocusListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.awt.print.Printable
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,ImageExportable
,ChangeListener
,StatusHandler
,HTMLExportable
- Direct Known Subclasses:
EditIconFrame
,ExtendedGraphFrame
public abstract class BasicGraphFrame extends PtolemyFrame implements java.awt.print.Printable, java.awt.datatransfer.ClipboardOwner, ChangeListener, java.awt.event.MouseWheelListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, ImageExportable, HTMLExportable
A simple graph view for ptolemy models. This represents a level of the hierarchy of a ptolemy model as a diva graph. Cut, copy and paste operations are supported using MoML.- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Steve Neuendorffer, Edward A. Lee, Contributors: Chad Berkeley (Kepler), Ian Brown (HSBC), Bert Rodiers, Christian Motika, Daniel Crawl
- See Also:
- Serialized Form
- Pt.AcceptedRating:
- Red (johnr)
- Pt.ProposedRating:
- Red (neuendor)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
BasicGraphFrame.CopyAction
Action to copy the current selection.protected class
BasicGraphFrame.CutAction
Action to copy and delete the current selection.protected class
BasicGraphFrame.EditPreferencesAction
Action to edit the preferences.class
BasicGraphFrame.ExportImageAction
Export an image of the model.protected class
BasicGraphFrame.FindAction
Action to search for text in a model.static class
BasicGraphFrame.FolderFileFilter
Accept only folders in a file browser.protected static class
BasicGraphFrame.MousePressedLayerAdapter
A Layer Adapter to handle the mousePressed layer event.protected class
BasicGraphFrame.MoveToBackAction
Action to move the current selection to the back (which corresponds to first in the ordered list).protected class
BasicGraphFrame.MoveToFrontAction
Action to move the current selection to the back (which corresponds to first in the ordered list).protected class
BasicGraphFrame.PasteAction
Paste the current contents of the clipboard into the current model.-
Nested classes/interfaces inherited from class ptolemy.actor.gui.TableauFrame
TableauFrame.MenuItemListener
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.Action
_copyAction
The copy action.protected javax.swing.Action
_cutAction
The cut action.protected LibraryAttribute
_defaultLibrary
The default Library.protected EditorDropTarget
_dropTarget
The instance of EditorDropTarget associated with the JGraph.protected javax.swing.JMenu
_editMenu
The edit menu.protected BasicGraphFrame.EditPreferencesAction
_editPreferencesAction
The action to edit preferences.protected javax.swing.Action
_exportGIFAction
The export to GIF action.protected javax.swing.Action
_exportHTMLAction
The export HTML action.protected javax.swing.Action
_exportPDFAction
The export to PDF action.protected javax.swing.Action
_exportPNGAction
The export to PNG action.protected javax.swing.Action
_findAction
The find action.protected javax.swing.JMenu
_graphMenu
The graph menu.protected JCanvasPanner
_graphPanner
The panner.protected JGraph
_jgraph
The instance of JGraph for this editor.protected javax.swing.Action
_layoutAction
The action for automatically laying out the graph.protected javax.swing.Action
_layoutConfigDialogAction
The action for opening the layout configuration dialog.protected javax.swing.JTree
_library
The library display widget.protected PTreeMenuCreator
_libraryContextMenuCreator
The library context menu creator.protected EntityTreeModel
_libraryModel
The library model.protected javax.swing.JScrollPane
_libraryScrollPane
The library scroll pane.protected BasicGraphFrame.MoveToBackAction
_moveToBackAction
Action to move to the back.protected BasicGraphFrame.MoveToFrontAction
_moveToFrontAction
Action to move to the front.protected static java.util.LinkedList<BasicGraphFrame>
_openGraphFrames
List of references to graph frames that are open.protected javax.swing.JPanel
_palettePane
The library display panel.protected javax.swing.Action
_pasteAction
The paste action.protected javax.swing.Action
_reloadAccessorsAction
The action for reloading accessors.protected javax.swing.JComponent
_rightComponent
The right component for this editor.protected javax.swing.JSplitPane
_splitPane
The split pane for library and editor.protected javax.swing.JToolBar
_toolbar
The toolbar.protected CompositeEntity
_topLibrary
The library.protected PTree
_treeView
The tree view of the model, used for browsing large models.protected ClassAndEntityTreeModel
_treeViewModel
The tree view model.protected javax.swing.JScrollPane
_treeViewScrollPane
The tree view scroll pane.protected javax.swing.Action
_zoomFitAction
Action for zoom fitting.protected boolean
_zoomFlag
True if we are inside zoom().protected javax.swing.Action
_zoomInAction
Action for zooming in.protected javax.swing.Action
_zoomOutAction
Action for zooming out.protected javax.swing.Action
_zoomResetAction
Action for zoom reset.static java.awt.Color
BACKGROUND_COLOR
Default background color is a light grey.static java.lang.String
VERGIL_USER_LIBRARY_NAME
Deprecated.-
Fields inherited from class ptolemy.actor.gui.PtolemyFrame
_query
-
Fields inherited from class ptolemy.actor.gui.TableauFrame
_initialSaveAsFileName, _topPack, _viewMenu, aboutFile, helpFile
-
Fields inherited from class ptolemy.gui.Top
_CANCELED, _debugClosing, _directory, _DISCARDED, _exitResult, _EXPORT_MENU_INDEX, _FAILED, _fileFilter, _fileMenu, _fileMenuItems, _filenameFilter, _helpMenu, _helpMenuItems, _IMPORT_MENU_INDEX, _menubar, _NEW_MENU_INDEX, _SAVED, _statusBar, MAXIMUM_STATUS_MESSAGE_TIME
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, 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, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description BasicGraphFrame(NamedObj entity, Tableau tableau)
Construct a frame associated with the specified Ptolemy II model or object.BasicGraphFrame(NamedObj entity, Tableau tableau, LibraryAttribute defaultLibrary)
Construct a frame associated with the specified Ptolemy II model.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
_addLayoutMenu(javax.swing.JMenu graphMenu)
Add a layout menu.protected void
_addMenus()
Create the menus that are used by this frame.protected void
_addReloadAccessorsMenu(javax.swing.JMenu graphMenu)
Add a Reload Accessors menu choice.protected boolean
_checkForImplied(java.util.List<NamedObj> elements)
Return true if any element of the specified list is implied.protected boolean
_close()
Override the base class to remove the listeners we have created when the frame closes.protected CompositeEntity
_createDefaultLibrary(Workspace workspace)
Create the default library to use if an entity has no LibraryAttribute.protected javax.swing.JMenuItem[]
_createFileMenuItems()
Create the items in the File menu's Export section This method adds a menu items to export images of the plot in GIF, PNG, and possibly PDF.protected abstract GraphPane
_createGraphPane(NamedObj entity)
Create a new graph pane.protected javax.swing.JComponent
_createRightComponent(NamedObj entity)
Create the component that goes to the right of the library.protected SizeAttribute
_createSizeAttribute()
Create a SizeAttribute for the current model when it is being saved to a file.protected SizeAttribute
_createSizeAttribute(NamedObj model)
Create a SizeAttribute for a specific model when it is being saved to a file.protected java.lang.StringBuffer
_deleteMoML(AbstractBasicGraphModel graphModel, java.lang.Object[] selection, SelectionModel model)
Return the MoML to delete the specified selection objects.protected void
_exportDesignPattern(java.io.Writer writer, NamedObj model, java.lang.String name)
Export the model into the writer with the given name.protected void
_finishExportDesignPattern()
Finish exporting a design pattern.protected java.awt.geom.Point2D
_getCenter(JGraph graph)
Return the center location of the visible part of the pane for a JGraph.protected java.io.File
_getDirectory()
Deprecated.UsegetLastDirectory()
insteadprotected GraphController
_getGraphController()
Return the graph controller associated with this frame.protected AbstractBasicGraphModel
_getGraphModel()
Return the graph model associated with this frame.protected javax.swing.JComponent
_getRightComponent()
Return the right component on which graph editing occurs.protected java.util.HashSet<NamedObj>
_getSelectionSet()
Return a set of instances of NamedObj representing the objects that are currently selected.protected java.awt.geom.Rectangle2D
_getVisibleCanvasRectangle(JGraph graph)
Return the rectangle representing the visible part of the pane for a JGraph, transformed into canvas coordinates.protected java.awt.geom.Rectangle2D
_getVisibleRectangle(JGraph graph)
Return the rectangle representing the visible part of the pane for a JGraph, in pixel coordinates on the screen.protected void
_initBasicGraphFrame()
Initialize this BasicGraphFrame.protected void
_initBasicGraphFrameActions()
Add the cut, copy, paste, move to front, mode to back actions.protected void
_initBasicGraphFrameInitialization()
Common initialization for a BasicGraphFrame.protected void
_initBasicGraphFrameRightComponent()
Set up the right component.protected void
_initBasicGraphFrameRightComponentMouseListeners()
Add listeners to the right component.protected void
_initBasicGraphFrameSetZoomAndPan()
Set the zoom factor and the pan.protected void
_initBasicGraphFrameSetZoomAndPane(NamedObj model, JGraph jgraph)
Set the zoom factor and the pan for a specific model and JGraph.protected void
_initBasicGraphFrameToolBarZoomButtons()
Add tool bar buttons.protected void
_initLayoutGuiAction()
Initialize the layout gui.protected void
_initReloadAccessorsAction()
Initialize the reload accessors menu choice.protected boolean
_isDesignPattern()
Return true if this is a design pattern.protected void
_prepareExportDesignPattern()
Prepare to export a design pattern.protected java.awt.FileDialog
_saveAsFileDialogComponent()
Create and return a file dialog for the "Save As" command.protected javax.swing.JFileChooser
_saveAsJFileChooserComponent()
Create and return a file dialog for the "Save As" command.protected void
_setBackgroundColor(java.awt.Component component)
Set the background color of the specified component to the default, or if it is given, to the background color given in the preferences.protected void
_setCenter(JGraph jgraph, java.awt.geom.Point2D center)
Set the center location of the visible part of a specific pane.protected void
_setDirectory(java.io.File directory)
Deprecated.UseTop.setDirectory(File)
insteadprotected void
_setDropIntoEnabled(boolean enable)
Enable or disable drop into.protected void
_updateWindowAttributes(java.awt.Frame parent, NamedObj model, JGraph graph)
Update the size, zoom and position of the window for a specific model and JGraph.protected void
_writeFile(java.io.File file)
Write the model to the specified file.protected void
_zoom(JGraph jgraph, double factor)
Zoom in or out to magnify by the specified factor, from the current magnification for a specific JGraph.void
changeExecuted(ChangeRequest change)
React to the fact that a change has been successfully executed by marking the data associated with this window modified.void
changeFailed(ChangeRequest change, java.lang.Exception exception)
React to the fact that a change has triggered an error by doing nothing (the effigy is also listening and will report the error).void
clearSelection()
Clear the selected objects in this frame.void
copy()
Get the currently selected objects from this document, if any, and place them on the clipboard in MoML format.void
createHierarchy()
Create a typed composite actor that contains the selected actors and connections.void
cut()
Remove the currently selected objects from this document, if any, and place them on the clipboard.void
delete()
Delete the currently selected objects from this document.void
dispose()
Dispose of this frame.void
disposeSuper()
Invoke the dispose() method of the superclass,PtolemyFrame
.void
expandAllLibraryRows()
Expand all the rows of the library.void
exportDesignPattern()
Export the current submodel as a design pattern using a method similar to Save As.static BasicGraphFrame
getBasicGraphFrame(Effigy effigy)
Given an Effigy, return the corresponding BasicGraphFrame, if any.static BasicGraphFrame
getBasicGraphFrame(NamedObj model)
Given a NamedObj, return the corresponding BasicGraphFrame.java.awt.geom.Point2D
getCenter()
Return the center location of the visible part of the pane.java.awt.Dimension
getContentSize()
Return the size of the contents of this window.static Figure
getFigureUnder(GraphPane pane, java.awt.geom.Point2D point, java.lang.Object[] filteredFigures)
Return the figure that is an icon of a NamedObj and is under the specified point, or null if there is none.PtolemyFrame
getFrame()
The frame (window) being exported to HTML.JCanvasPanner
getGraphPanner()
Return the JCanvasPanner instance.JGraph
getJGraph()
Return the JGraph instance that this view uses to represent the ptolemy model.java.io.File
getLastDirectory()
Get the directory that was last accessed.java.util.HashSet<NamedObj>
getSelectionSet()
Return a set of instances of NamedObj representing the objects that are currently selected.java.awt.geom.Rectangle2D
getVisibleCanvasRectangle()
Return the rectangle representing the visible part of the pane, transformed into canvas coordinates.java.awt.geom.Rectangle2D
getVisibleRectangle()
Return the rectangle representing the visible part of the pane, in pixel coordinates on the screen.void
importDesignPattern()
Import a design pattern into the current design.void
lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable transferable)
Do nothing.void
mouseClicked(java.awt.event.MouseEvent event)
Called when the mouse is clicked.void
mouseDragged(java.awt.event.MouseEvent event)
Transform the graph by the amount the mouse is dragged while the middle mouse button is held down.void
mouseEntered(java.awt.event.MouseEvent event)
Called when the mouse enters this component.void
mouseExited(java.awt.event.MouseEvent event)
Called when the mouse leaves this component.void
mouseMoved(java.awt.event.MouseEvent event)
Called when the mouse is moved.void
mousePressed(java.awt.event.MouseEvent event)
Store the location of the middle mouse event.void
mouseReleased(java.awt.event.MouseEvent event)
Called when the mouse is released.void
mouseWheelMoved(java.awt.event.MouseWheelEvent event)
Scroll in when the mouse wheel is moved.static void
openComposite(java.awt.Frame owner, NamedObj target)
Opens the nearest composite actor above the target in the hierarchy and possibly change the zoom and centering to show the target.void
openContainer()
Open the container, if any, of the entity.void
paste()
Assuming the contents of the clipboard is MoML code, paste it into the current model by issuing a change request.int
print(java.awt.Graphics graphics, java.awt.print.PageFormat format, int index)
Print the visible portion of the graph to a printer, which is represented by the specified graphics object.void
redo()
Redo the last undone change on the model.static void
report(java.awt.Frame owner, java.lang.String message)
Report a message to either the status bar or message handler.static void
saveComponentInLibrary(Configuration configuration, Entity entity)
Deprecated.void
setCenter(java.awt.geom.Point2D center)
Set the center location of the visible part of the pane.void
setJGraph(JGraph jgraph)
Set the JGraph instance that this view uses to represent the ptolemy model.void
setLastDirectory(java.io.File directory)
Set the directory that was last accessed by this window.void
undo()
Undo the last undoable change on the model.void
updateWindowAttributes()
Update the size, zoom and position of the window.void
writeHTML(ExportParameters parameters, java.io.Writer writer)
Write an HTML page based on the current view of the model to the specified destination directory.void
writeImage(java.io.OutputStream stream, java.lang.String format)
Write an image to the specified output stream in the specified format.void
writeImage(java.io.OutputStream stream, java.lang.String format, java.awt.Color background)
Write an image to the specified output stream in the specified format with the specified background color.void
zoom(double factor)
Zoom in or out to magnify by the specified factor, from the current magnification.void
zoomFit()
Zoom to fit the current figures.void
zoomFit(GraphPane pane, java.awt.geom.Rectangle2D bounds)
Zoom to fit the bounds.void
zoomReset()
Set zoom to the nominal.-
Methods inherited from class ptolemy.actor.gui.PtolemyFrame
_clear, _help, _print, _saveAs, getEffigy, getModel, setModel
-
Methods inherited from class ptolemy.actor.gui.TableauFrame
_about, _confirmFile, _exit, _getDefaultIconImage, _getName, _read, _save, _saveAs, _saveAsHelper, getAlternateTopPack, getConfiguration, getDirectory, getEffigy, getTableau, isModified, pack, printPDF, setModified, setTableau
-
Methods inherited from class ptolemy.gui.Top
_getCurrentDirectory, _open, _openURL, _populateHistory, _printCrossPlatform, _printNative, _printPDF, _queryForSave, _saveAsFileDialog, _updateHistory, about, centerOnScreen, close, deferIfNecessary, exit, getCentering, hideMenuBar, isDisposed, isMenuPopulated, report, report, report, setBackground, setCentering, setDirectory, show, status, windowGainedFocus, windowLostFocus
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
BACKGROUND_COLOR
public static final java.awt.Color BACKGROUND_COLOR
Default background color is a light grey.
-
VERGIL_USER_LIBRARY_NAME
@Deprecated public static java.lang.String VERGIL_USER_LIBRARY_NAME
Deprecated.The name of the user library. The default value is "UserLibrary". The value of this variable is what appears in the Vergil left hand tree menu.
-
_copyAction
protected javax.swing.Action _copyAction
The copy action.
-
_cutAction
protected javax.swing.Action _cutAction
The cut action.
-
_defaultLibrary
protected LibraryAttribute _defaultLibrary
The default Library.
-
_dropTarget
protected EditorDropTarget _dropTarget
The instance of EditorDropTarget associated with the JGraph.
-
_editMenu
protected javax.swing.JMenu _editMenu
The edit menu.
-
_editPreferencesAction
protected BasicGraphFrame.EditPreferencesAction _editPreferencesAction
The action to edit preferences.
-
_exportGIFAction
protected javax.swing.Action _exportGIFAction
The export to GIF action.
-
_exportHTMLAction
protected javax.swing.Action _exportHTMLAction
The export HTML action.
-
_exportPDFAction
protected javax.swing.Action _exportPDFAction
The export to PDF action.
-
_exportPNGAction
protected javax.swing.Action _exportPNGAction
The export to PNG action.
-
_findAction
protected javax.swing.Action _findAction
The find action.
-
_graphMenu
protected javax.swing.JMenu _graphMenu
The graph menu.
-
_graphPanner
protected JCanvasPanner _graphPanner
The panner. Note that this variable can be null if the configuration does not have an entity named "actor library". For example, see $PTII/bin/vergil -ptinyViewer.
-
_jgraph
protected JGraph _jgraph
The instance of JGraph for this editor.
-
_layoutAction
protected javax.swing.Action _layoutAction
The action for automatically laying out the graph. This can be either an advanced layout or the simple Ptolemy layout, depending on whether the better one is available.
-
_layoutConfigDialogAction
protected javax.swing.Action _layoutConfigDialogAction
The action for opening the layout configuration dialog. This reference can benull
, since the dialog is only supported if advanced layout is available. In this case the action should not be shown in menus.
-
_library
protected javax.swing.JTree _library
The library display widget.
-
_libraryContextMenuCreator
protected PTreeMenuCreator _libraryContextMenuCreator
The library context menu creator.
-
_libraryModel
protected EntityTreeModel _libraryModel
The library model.
-
_libraryScrollPane
protected javax.swing.JScrollPane _libraryScrollPane
The library scroll pane.
-
_moveToBackAction
protected BasicGraphFrame.MoveToBackAction _moveToBackAction
Action to move to the back.
-
_moveToFrontAction
protected BasicGraphFrame.MoveToFrontAction _moveToFrontAction
Action to move to the front.
-
_openGraphFrames
protected static java.util.LinkedList<BasicGraphFrame> _openGraphFrames
List of references to graph frames that are open.
-
_palettePane
protected javax.swing.JPanel _palettePane
The library display panel.
-
_pasteAction
protected javax.swing.Action _pasteAction
The paste action.
-
_reloadAccessorsAction
protected javax.swing.Action _reloadAccessorsAction
The action for reloading accessors.
-
_rightComponent
protected javax.swing.JComponent _rightComponent
The right component for this editor.
-
_splitPane
protected javax.swing.JSplitPane _splitPane
The split pane for library and editor. Note that this variable can be null if the configuration does not have an entity named "actor library". For example, see $PTII/bin/vergil -ptinyViewer.
-
_toolbar
protected javax.swing.JToolBar _toolbar
The toolbar.
-
_topLibrary
protected CompositeEntity _topLibrary
The library.
-
_treeView
protected PTree _treeView
The tree view of the model, used for browsing large models.
-
_treeViewScrollPane
protected javax.swing.JScrollPane _treeViewScrollPane
The tree view scroll pane.
-
_treeViewModel
protected ClassAndEntityTreeModel _treeViewModel
The tree view model.
-
_zoomFitAction
protected javax.swing.Action _zoomFitAction
Action for zoom fitting.
-
_zoomInAction
protected javax.swing.Action _zoomInAction
Action for zooming in.
-
_zoomOutAction
protected javax.swing.Action _zoomOutAction
Action for zooming out.
-
_zoomResetAction
protected javax.swing.Action _zoomResetAction
Action for zoom reset.
-
_zoomFlag
protected boolean _zoomFlag
True if we are inside zoom(). Used by derived classes with scrollbars.
-
-
Constructor Detail
-
BasicGraphFrame
public BasicGraphFrame(NamedObj entity, Tableau tableau)
Construct a frame associated with the specified Ptolemy II model or object. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically done by calling show() on the controlling tableau. This constructor results in a graph frame that obtains its library either from the model (if it has one) or the default library defined in the configuration.- Parameters:
entity
- The model or object to put in this frame.tableau
- The tableau responsible for this frame.- See Also:
Tableau.show()
-
BasicGraphFrame
public BasicGraphFrame(NamedObj entity, Tableau tableau, LibraryAttribute defaultLibrary)
Construct a frame associated with the specified Ptolemy II model. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically done by calling show() on the controlling tableau. This constructor results in a graph frame that obtains its library either from the model (if it has one), or the defaultLibrary argument (if it is non-null), or the default library defined in the configuration.- Parameters:
entity
- The model or object to put in this frame.tableau
- The tableau responsible for this frame.defaultLibrary
- An attribute specifying the default library to use if the model does not have a library. The defaultLibrary attribute is only read if the model does not have aLibraryAttribute
with the name "_library
", or if the LibraryAttribute cannot be read.- See Also:
Tableau.show()
-
-
Method Detail
-
changeExecuted
public void changeExecuted(ChangeRequest change)
React to the fact that a change has been successfully executed by marking the data associated with this window modified. This will trigger a dialog when the window is closed, prompting the user to save the data.- Specified by:
changeExecuted
in interfaceChangeListener
- Parameters:
change
- The change that has been executed.
-
changeFailed
public void changeFailed(ChangeRequest change, java.lang.Exception exception)
React to the fact that a change has triggered an error by doing nothing (the effigy is also listening and will report the error).- Specified by:
changeFailed
in interfaceChangeListener
- Parameters:
change
- The change that was attempted.exception
- The exception that resulted.
-
clearSelection
public void clearSelection()
Clear the selected objects in this frame.
-
copy
public void copy()
Get the currently selected objects from this document, if any, and place them on the clipboard in MoML format.
-
createHierarchy
public void createHierarchy()
Create a typed composite actor that contains the selected actors and connections. The created typed composite actor is transparent. The resulting topology is the same in the sense of deep connections.
-
cut
public void cut()
Remove the currently selected objects from this document, if any, and place them on the clipboard.
-
delete
public void delete()
Delete the currently selected objects from this document.
-
dispose
public void dispose()
Dispose of this frame. Override this dispose() method to unattach any listeners that may keep this model from getting garbage collected. This method callsdisposeSuper()
.- Overrides:
dispose
in classPtolemyFrame
-
disposeSuper
public void disposeSuper()
Invoke the dispose() method of the superclass,PtolemyFrame
.
-
expandAllLibraryRows
public void expandAllLibraryRows()
Expand all the rows of the library. Expanding all the rows is useful for testing.- Overrides:
expandAllLibraryRows
in classPtolemyFrame
-
exportDesignPattern
public void exportDesignPattern()
Export the current submodel as a design pattern using a method similar to Save As.
-
getBasicGraphFrame
public static BasicGraphFrame getBasicGraphFrame(NamedObj model)
Given a NamedObj, return the corresponding BasicGraphFrame.- Parameters:
model
- The NamedObj for the model. SeeConfigurationApplication.openModel(String)
for a static method that returns the model- Returns:
- The BasicGraphFrame that corresponds with the model or null if the model argument was null, the effigy for the model cannot be found or if the Effigy does not contain a Tableau.
-
getBasicGraphFrame
public static BasicGraphFrame getBasicGraphFrame(Effigy effigy)
Given an Effigy, return the corresponding BasicGraphFrame, if any.- Parameters:
effigy
- The Effigy. To determine the Effigy of a NamedObj, useConfiguration.findEffigy(NamedObj)
.- Returns:
- The BasicGraphFrame that corresponds with the Effigy or null if the Effigy does not contain a Tableau.
-
getCenter
public java.awt.geom.Point2D getCenter()
Return the center location of the visible part of the pane.- Returns:
- The center of the visible part.
- See Also:
setCenter(Point2D)
-
getContentSize
public java.awt.Dimension getContentSize()
Return the size of the contents of this window.- Overrides:
getContentSize
in classTop
- Returns:
- The size of the contents.
-
getFigureUnder
public static Figure getFigureUnder(GraphPane pane, java.awt.geom.Point2D point, java.lang.Object[] filteredFigures)
Return the figure that is an icon of a NamedObj and is under the specified point, or null if there is none. The point argument may need to be transformed, seeEditorDropTargetListener._getFigureUnder(Point2D)
.- Parameters:
pane
- The pane in which to searchpoint
- The point in the graph pane.filteredFigures
- figures that are filtered from the object search- Returns:
- The object under the specified point, or null if there is none or it is not a NamedObj.
-
getFrame
public PtolemyFrame getFrame()
The frame (window) being exported to HTML.- Returns:
- This frame.
-
getJGraph
public JGraph getJGraph()
Return the JGraph instance that this view uses to represent the ptolemy model.- Returns:
- the JGraph.
- See Also:
setJGraph(JGraph)
-
getGraphPanner
public JCanvasPanner getGraphPanner()
Return the JCanvasPanner instance.- Returns:
- the JCanvasPanner
-
getLastDirectory
public java.io.File getLastDirectory()
Get the directory that was last accessed.- Returns:
- The last directory
- See Also:
setLastDirectory(File)
-
setLastDirectory
public void setLastDirectory(java.io.File directory)
Set the directory that was last accessed by this window.- Parameters:
directory
- The directory last accessed.- See Also:
getLastDirectory()
-
getSelectionSet
public java.util.HashSet<NamedObj> getSelectionSet()
Return a set of instances of NamedObj representing the objects that are currently selected. This set has no particular order to it. If you need the selection objects in proper order, as defined by the container, then call sortContainedObjects() on the container to sort the result.- Returns:
- The set of selected objects.
-
getVisibleCanvasRectangle
public java.awt.geom.Rectangle2D getVisibleCanvasRectangle()
Return the rectangle representing the visible part of the pane, transformed into canvas coordinates. This is the range of locations that are visible, given the current pan and zoom.- Returns:
- The rectangle representing the visible part.
-
getVisibleRectangle
public java.awt.geom.Rectangle2D getVisibleRectangle()
Return the rectangle representing the visible part of the pane, in pixel coordinates on the screen.- Returns:
- A rectangle whose upper left corner is at (0, 0) and whose size is the size of the canvas component.
-
importDesignPattern
public void importDesignPattern()
Import a design pattern into the current design.
-
lostOwnership
public void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable transferable)
Do nothing.- Specified by:
lostOwnership
in interfacejava.awt.datatransfer.ClipboardOwner
-
openContainer
public void openContainer()
Open the container, if any, of the entity. If this entity has no container, then do nothing.
-
openComposite
public static void openComposite(java.awt.Frame owner, NamedObj target)
Opens the nearest composite actor above the target in the hierarchy and possibly change the zoom and centering to show the target. This method is useful for displaying search results and actors that cause errors.- Parameters:
target
- The target.owner
- The frame that, per the user, is generating the dialog.
-
paste
public void paste()
Assuming the contents of the clipboard is MoML code, paste it into the current model by issuing a change request.
-
print
public int print(java.awt.Graphics graphics, java.awt.print.PageFormat format, int index) throws java.awt.print.PrinterException
Print the visible portion of the graph to a printer, which is represented by the specified graphics object.- Specified by:
print
in interfacejava.awt.print.Printable
- Parameters:
graphics
- The context into which the page is drawn.format
- The size and orientation of the page being drawn.index
- The zero based index of the page to be drawn.- Returns:
- PAGE_EXISTS if the page is rendered successfully, or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
- Throws:
java.awt.print.PrinterException
- If the print job is terminated.
-
redo
public void redo()
Redo the last undone change on the model.- See Also:
undo()
-
report
public static void report(java.awt.Frame owner, java.lang.String message)
Report a message to either the status bar or message handler.- Parameters:
owner
- The frame that, per the user, is generating the dialog.message
- The message.
-
saveComponentInLibrary
@Deprecated public static void saveComponentInLibrary(Configuration configuration, Entity entity)
Deprecated.Save the given entity in the user library in the given configuration.- Parameters:
configuration
- The configuration.entity
- The entity to save.- Since:
- Ptolemy 2.1
-
setCenter
public void setCenter(java.awt.geom.Point2D center)
Set the center location of the visible part of the pane. This will cause the panner to center on the specified location with the current zoom factor.- Parameters:
center
- The center of the visible part.- See Also:
getCenter()
-
setJGraph
public void setJGraph(JGraph jgraph)
Set the JGraph instance that this view uses to represent the ptolemy model.- Parameters:
jgraph
- The JGraph.- See Also:
getJGraph()
-
undo
public void undo()
Undo the last undoable change on the model.- See Also:
redo()
-
updateWindowAttributes
public void updateWindowAttributes() throws IllegalActionException, NameDuplicationException
Update the size, zoom and position of the window. This method is typically called when closing the window or writing the moml file out.- Throws:
IllegalActionException
- If there is a problem getting a parameter.NameDuplicationException
- If there is a problem creating a parameter.
-
writeHTML
public void writeHTML(ExportParameters parameters, java.io.Writer writer) throws java.awt.print.PrinterException, java.io.IOException, IllegalActionException
Write an HTML page based on the current view of the model to the specified destination directory. The file will be named "index.html," and supporting files, including at least a gif image showing the contents currently visible in the graph frame, will be created. If there are any plot windows open or any composite actors open, then gif and/or HTML will be generated for those as well and linked to the gif image created for this frame.The generated page has a header with the name of the model, a reference to a GIF image file with name equal to the name of the model with a ".gif" extension appended, and a script that reacts when the mouse is moved over an actor by displaying a table with the parameter values of the actor. The gif image is assumed to have been generated with the current view using the
writeImage(OutputStream, String)
method.- Specified by:
writeHTML
in interfaceHTMLExportable
- Parameters:
parameters
- The parameters that control the export.writer
- The writer to use the write the HTML. If this is null, then create an index.html file in the directory given by the directoryToExportTo field of the parameters.- Throws:
java.io.IOException
- If unable to write associated files, or if the current configuration does not support it.java.awt.print.PrinterException
- If unable to write associated files.IllegalActionException
- If something goes wrong accessing the model.
-
writeImage
public void writeImage(java.io.OutputStream stream, java.lang.String format) throws java.awt.print.PrinterException, java.io.IOException
Write an image to the specified output stream in the specified format. Supported formats include at least "gif" and "png", standard image file formats. The image is a rendition of the current view of the model.ExportModel
is a standalone class that exports an image of a model.- Specified by:
writeImage
in interfaceImageExportable
- Parameters:
stream
- The output stream to write to.format
- The image format to generate.- Throws:
java.io.IOException
- If writing to the stream fails.java.awt.print.PrinterException
- If the specified format is not supported.- See Also:
writeHTML(ExportParameters, Writer)
-
writeImage
public void writeImage(java.io.OutputStream stream, java.lang.String format, java.awt.Color background) throws java.awt.print.PrinterException, java.io.IOException
Write an image to the specified output stream in the specified format with the specified background color. Supported formats include at least "gif" and "png", standard image file formats. The image is a rendition of the current view of the model.ExportModel
is a standalone class that exports an image of a model.- Parameters:
stream
- The output stream to write to.format
- The image format to generate.background
- The background color, or null to use the current color.- Throws:
java.io.IOException
- If writing to the stream fails.java.awt.print.PrinterException
- If the specified format is not supported.- See Also:
writeHTML(ExportParameters, Writer)
-
zoom
public void zoom(double factor)
Zoom in or out to magnify by the specified factor, from the current magnification.- Parameters:
factor
- The magnification factor (relative to 1.0).
-
zoomFit
public void zoomFit()
Zoom to fit the current figures.
-
zoomFit
public void zoomFit(GraphPane pane, java.awt.geom.Rectangle2D bounds)
Zoom to fit the bounds.- Parameters:
pane
- The pane.bounds
- The bound to zoom to.
-
zoomReset
public void zoomReset()
Set zoom to the nominal.
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
Called when the mouse is clicked. This base class does nothing when the mouse is clicked. However, events _are_ handled by the components within this component.- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
- Parameters:
event
- The mouse event.
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent event)
Transform the graph by the amount the mouse is dragged while the middle mouse button is held down.- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Parameters:
event
- The drag event.
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent event)
Called when the mouse enters this component. This base class does nothing when the enters this component. However, events _are_ handled by the components within this component.- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
- Parameters:
event
- The mouse event.
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent event)
Called when the mouse leaves this component. This base class does nothing when the exits this component. However, events _are_ handled by the components within this component.- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
- Parameters:
event
- The mouse event.
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent event)
Called when the mouse is moved. This base class does nothing when the mouse is moved.- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Parameters:
event
- Contains details of the movement event. However, events _are_ handled by the components within this component.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent event)
Store the location of the middle mouse event.- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
event
- The mouse event.
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent event)
Called when the mouse is released. This base class does nothing when the mouse is moved. However, events _are_ handled by the components within this component.- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
- Parameters:
event
- The mouse event.
-
mouseWheelMoved
public void mouseWheelMoved(java.awt.event.MouseWheelEvent event)
Scroll in when the mouse wheel is moved.- Specified by:
mouseWheelMoved
in interfacejava.awt.event.MouseWheelListener
- Parameters:
event
- The mouse wheel event.
-
_addLayoutMenu
protected void _addLayoutMenu(javax.swing.JMenu graphMenu)
Add a layout menu.- Parameters:
graphMenu
- The menu to which to add the layout menu.
-
_addMenus
protected void _addMenus()
Create the menus that are used by this frame.- Overrides:
_addMenus
in classTableauFrame
-
_addReloadAccessorsMenu
protected void _addReloadAccessorsMenu(javax.swing.JMenu graphMenu)
Add a Reload Accessors menu choice.- Parameters:
graphMenu
- The menu to which to add the Reload Accessors menu choice.
-
_checkForImplied
protected boolean _checkForImplied(java.util.List<NamedObj> elements)
Return true if any element of the specified list is implied. An element is implied if its getDerivedLevel() method returns anything smaller than Integer.MAX_VALUE.- Parameters:
elements
- A list of instances of NamedObj.- Returns:
- True if any element in the list is implied.
- See Also:
NamedObj.getDerivedLevel()
-
_close
protected boolean _close()
Override the base class to remove the listeners we have created when the frame closes. Specifically, remove our panner-updating listener from the entity. Also remove the listeners our graph model has created.- Overrides:
_close
in classPtolemyFrame
- Returns:
- True if the close completes, and false otherwise.
-
_createDefaultLibrary
protected CompositeEntity _createDefaultLibrary(Workspace workspace)
Create the default library to use if an entity has no LibraryAttribute. Note that this is called in the constructor and therefore overrides in subclasses should not refer to any members that may not have been initialized. If no library is found in the configuration, then an empty one is created in the specified workspace.- Parameters:
workspace
- The workspace in which to create the library, if one needs to be created.- Returns:
- The new library, or null if there is no configuration.
-
_createFileMenuItems
protected javax.swing.JMenuItem[] _createFileMenuItems()
Create the items in the File menu's Export section This method adds a menu items to export images of the plot in GIF, PNG, and possibly PDF.- Overrides:
_createFileMenuItems
in classTop
- Returns:
- The items in the File menu.
-
_createGraphPane
protected abstract GraphPane _createGraphPane(NamedObj entity)
Create a new graph pane. Subclasses will override this to change the pane that is created. Note that this method is called in constructor, so derived classes must be careful to not reference local variables that may not have yet been created.- Parameters:
entity
- The object to be displayed in the pane.- Returns:
- The pane that is created.
-
_createRightComponent
protected javax.swing.JComponent _createRightComponent(NamedObj entity)
Create the component that goes to the right of the library.- Parameters:
entity
- The entity to display in the component.- Returns:
- The component that goes to the right of the library.
-
_createSizeAttribute
protected SizeAttribute _createSizeAttribute() throws IllegalActionException, NameDuplicationException
Create a SizeAttribute for the current model when it is being saved to a file. The size recorded in the SizeAttribute is the size of the current canvas.- Returns:
- The SizeAttribute.
- Throws:
IllegalActionException
- If "_vergilSize" is found but is not an instance of SizeAttribute, or if a SizeAttribute is not accepted by the current model.NameDuplicationException
- If the name "_vergilSize" is already used when trying to create the SizeAttribute.
-
_createSizeAttribute
protected SizeAttribute _createSizeAttribute(NamedObj model) throws IllegalActionException, NameDuplicationException
Create a SizeAttribute for a specific model when it is being saved to a file. The size recorded in the SizeAttribute is the size of the current canvas.- Parameters:
model
- The model.- Returns:
- The SizeAttribute.
- Throws:
IllegalActionException
- If "_vergilSize" is found but is not an instance of SizeAttribute, or if a SizeAttribute is not accepted by the current model.NameDuplicationException
- If the name "_vergilSize" is already used when trying to create the SizeAttribute.
-
_exportDesignPattern
protected void _exportDesignPattern(java.io.Writer writer, NamedObj model, java.lang.String name) throws java.io.IOException
Export the model into the writer with the given name. If the _query has a selected entry and it is true, then only the selected named objects are exported; otherwise, the whole model is exported with its exportMoML() method.- Parameters:
writer
- The writer.model
- The model to export.name
- The name of the exported model.- Throws:
java.io.IOException
- If an I/O error occurs.
-
_finishExportDesignPattern
protected void _finishExportDesignPattern()
Finish exporting a design pattern.
-
_getCenter
protected java.awt.geom.Point2D _getCenter(JGraph graph)
Return the center location of the visible part of the pane for a JGraph.- Parameters:
graph
- The JGraph.- Returns:
- The center of the visible part.
- See Also:
setCenter(Point2D)
-
_getVisibleCanvasRectangle
protected java.awt.geom.Rectangle2D _getVisibleCanvasRectangle(JGraph graph)
Return the rectangle representing the visible part of the pane for a JGraph, transformed into canvas coordinates. This is the range of locations that are visible, given the current pan and zoom.- Parameters:
graph
- The JGraph.- Returns:
- The rectangle representing the visible part.
-
_getVisibleRectangle
protected java.awt.geom.Rectangle2D _getVisibleRectangle(JGraph graph)
Return the rectangle representing the visible part of the pane for a JGraph, in pixel coordinates on the screen.- Parameters:
graph
- The JGraph.- Returns:
- A rectangle whose upper left corner is at (0, 0) and whose size is the size of the canvas component.
-
_getDirectory
@Deprecated protected java.io.File _getDirectory()
Deprecated.UsegetLastDirectory()
insteadGet the directory that was last accessed by this window.- Returns:
- The directory last accessed.
- See Also:
_setDirectory(java.io.File)
-
_getGraphController
protected GraphController _getGraphController()
Return the graph controller associated with this frame.- Returns:
- The graph controller associated with this frame.
-
_getGraphModel
protected AbstractBasicGraphModel _getGraphModel()
Return the graph model associated with this frame.- Returns:
- The graph model associated with this frame.
-
_getRightComponent
protected javax.swing.JComponent _getRightComponent()
Return the right component on which graph editing occurs.- Returns:
- The JGraph on which graph editing occurs.
-
_getSelectionSet
protected java.util.HashSet<NamedObj> _getSelectionSet()
Return a set of instances of NamedObj representing the objects that are currently selected. This set has no particular order to it. If you need the selection objects in proper order, as defined by the container, then call sortContainedObjects() on the container to sort the result.- Returns:
- The set of selected objects.
-
_initBasicGraphFrame
protected void _initBasicGraphFrame()
Initialize this BasicGraphFrame. Derived classes may call this method in their constructors. Derived classes should call the various _initBasicGraphFrame*() methods so as to avoid code duplication
-
_initBasicGraphFrameActions
protected void _initBasicGraphFrameActions()
Add the cut, copy, paste, move to front, mode to back actions. Also add the EditPreferencesAction and initialize the layout gui. Derived classes usually call this at the end of _initBasicGraphFrame().
-
_initBasicGraphFrameRightComponent
protected void _initBasicGraphFrameRightComponent()
Set up the right component.
-
_initBasicGraphFrameRightComponentMouseListeners
protected void _initBasicGraphFrameRightComponentMouseListeners()
Add listeners to the right component.
-
_initBasicGraphFrameInitialization
protected void _initBasicGraphFrameInitialization()
Common initialization for a BasicGraphFrame. Derived classes should call this method early in _initBasicGraphFrame().
-
_initBasicGraphFrameToolBarZoomButtons
protected void _initBasicGraphFrameToolBarZoomButtons()
Add tool bar buttons. Derived classes should set _toolbar before calling this method.
-
_initBasicGraphFrameSetZoomAndPan
protected void _initBasicGraphFrameSetZoomAndPan() throws IllegalActionException
Set the zoom factor and the pan.- Throws:
IllegalActionException
- If the zoom or pan parameters cannot be read.
-
_initBasicGraphFrameSetZoomAndPane
protected void _initBasicGraphFrameSetZoomAndPane(NamedObj model, JGraph jgraph) throws IllegalActionException
Set the zoom factor and the pan for a specific model and JGraph.- Parameters:
model
- The model.jgraph
- The JGraph.- Throws:
IllegalActionException
- If the zoom or pan parameters cannot be read.
-
_initLayoutGuiAction
protected void _initLayoutGuiAction()
Initialize the layout gui.
-
_initReloadAccessorsAction
protected void _initReloadAccessorsAction()
Initialize the reload accessors menu choice.
-
_isDesignPattern
protected boolean _isDesignPattern()
Return true if this is a design pattern.- Returns:
- true if the model corresponding to this object has a DesignPatternIcon attribute.
-
_prepareExportDesignPattern
protected void _prepareExportDesignPattern()
Prepare to export a design pattern. In this base class, do nothing.
-
_saveAsFileDialogComponent
protected java.awt.FileDialog _saveAsFileDialogComponent()
Create and return a file dialog for the "Save As" command. This overrides the base class so that if this is a design pattern and items are selected, then the user is asked if they want to save only the selected objects.If
PtGUIUtilities.useFileDialog()
returns true thenTop._saveAs()
uses this method. Otherwise,_saveAsJFileChooserComponent()
is used.- Overrides:
_saveAsFileDialogComponent
in classPtolemyFrame
- Returns:
- A file dialog for save as.
-
_saveAsJFileChooserComponent
protected javax.swing.JFileChooser _saveAsJFileChooserComponent()
Create and return a file dialog for the "Save As" command. This overrides the base class so that if this is a design pattern and items are selected, then the user is asked if they want to save only the selected objects.If
PtGUIUtilities.useFileDialog()
returns false thenTop._saveAs()
uses this method. Otherwise,_saveAsFileDialogComponent()
is used.- Overrides:
_saveAsJFileChooserComponent
in classPtolemyFrame
- Returns:
- A file dialog for save as.
-
_setBackgroundColor
protected void _setBackgroundColor(java.awt.Component component)
Set the background color of the specified component to the default, or if it is given, to the background color given in the preferences.- Parameters:
component
- The component to set the color of.
-
_setCenter
protected void _setCenter(JGraph jgraph, java.awt.geom.Point2D center)
Set the center location of the visible part of a specific pane. This will cause the panner to center on the specified location with the current zoom factor.- Parameters:
jgraph
- The JGraph.center
- The center of the visible part.- See Also:
getCenter()
-
_setDirectory
@Deprecated protected void _setDirectory(java.io.File directory)
Deprecated.UseTop.setDirectory(File)
insteadSet the directory that was last accessed by this window.- Parameters:
directory
- The directory last accessed.- See Also:
getLastDirectory()
-
_setDropIntoEnabled
protected void _setDropIntoEnabled(boolean enable)
Enable or disable drop into.- Parameters:
enable
- False to disable.
-
_updateWindowAttributes
protected void _updateWindowAttributes(java.awt.Frame parent, NamedObj model, JGraph graph) throws IllegalActionException, NameDuplicationException
Update the size, zoom and position of the window for a specific model and JGraph. This method is typically called when closing the window or writing the moml file out.- Parameters:
parent
- The parent frame.model
- The model.graph
- The JGraph.- Throws:
IllegalActionException
- If there is a problem getting a parameter.NameDuplicationException
- If there is a problem creating a parameter.
-
_writeFile
protected void _writeFile(java.io.File file) throws java.io.IOException
Write the model to the specified file. This overrides the base class to record the current size and position of the window in the model.- Overrides:
_writeFile
in classPtolemyFrame
- Parameters:
file
- The file to write to.- Throws:
java.io.IOException
- If the write fails.
-
_deleteMoML
protected java.lang.StringBuffer _deleteMoML(AbstractBasicGraphModel graphModel, java.lang.Object[] selection, SelectionModel model)
Return the MoML to delete the specified selection objects. This has the side effect of unselecting the objects. It also deletes edges that are not fully connected (these deletions cannot be done through MoML, and cannot be undone).- Parameters:
graphModel
- The graph model.selection
- The selection.model
- The selection model.- Returns:
- The MoML to delete the selected objects.
-
_zoom
protected void _zoom(JGraph jgraph, double factor)
Zoom in or out to magnify by the specified factor, from the current magnification for a specific JGraph.- Parameters:
jgraph
- The JGraph.factor
- The magnification factor (relative to 1.0).
-
-