ptolemy.actor.gui
Class Tableau

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.kernel.CompositeEntity
                      extended by ptolemy.actor.gui.Tableau
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
ActorGraphTableau, BrowserTableau, CaseGraphTableau, CaseGraphTableau, DebugListenerTableau, DialogTableau, Display.DisplayWindowTableau, DocBuilderTableau, DocTableau, EditIconTableau, ExecShellTableau, ExpressionShellTableau, FSMGraphTableau, FSMGraphTableau, GeneratorTableau, GTTableau, HTMLViewerTableau, InterfaceTableau, JVMTableau, KielerLayoutTableau, LayoutTableau, MatchResultTableau, NavigableActorGraphTableau, PlotTableau, PythonShellTableau, RunTableau, SingleWindowHTMLViewerTableau, TclShellTableau, TextEditorTableau, TokenTableau, TreeTableau

public class Tableau
extends CompositeEntity

A tableau is a visual representation of a Ptolemy II model in a top-level window. This class represents such a top level window. The top-level is always a frame, which is a window with a border and title bar. The window itself is specified by the setFrame() method, and accessed by the getFrame() method. An instance of this class will be contained by the instance of Effigy that represents the model that is depicted in the top-level window.

By convention, the constructor for a tableau does not (necessarily) make the associated frame visible. To do that, call show().

Since:
Ptolemy II 1.0
Version:
$Id: Tableau.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Steve Neuendorffer and Edward A. Lee
See Also:
Effigy, Serialized Form
Accepted Rating:
Red (neuendor)
Proposed Rating:
Yellow (neuendor)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
private  boolean _editable
          Flag indicating whether the tableau is editable.
private  javax.swing.JFrame _frame
          The frame that the tableau is shown in.
private  boolean _master
          True if this tableau is a master tableau.
private  java.lang.String _title
          The title set by setTitle().
 SizeAttribute size
          A specification for the size of the frame.
 
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
Tableau(CompositeEntity container, java.lang.String name)
          Construct a tableau with the given name and container.
Tableau(Workspace workspace)
          Construct a tableau in the specified workspace.
 
Method Summary
 void attributeChanged(Attribute attribute)
          If the argument is the size parameter, and a frame has been specified with setFrame(), then set the size of the frame.
 java.lang.Object clone(Workspace workspace)
          Clone the object into the specified workspace.
 boolean close()
          Close this tableau by calling dispose() on the associated frame, or if the associated frame is an instance of TableauFrame, by calling _close() on it.
 javax.swing.JFrame getFrame()
          Return the top-level window that implements the display of this tableau.
 java.lang.String getTitle()
          Return the title of this tableau.
 boolean isEditable()
          Return true if the tableau is editable.
 boolean isMaster()
          Return true if this tableau is a master, which means that if that if its window is closed, then all other windows associated with the model are also closed.
 void setContainer(CompositeEntity container)
          Override the base class so that if the argument is null and the window is a master, then all other windows associated with the container are closed and the model is removed from the ModelDirectory.
 void setEditable(boolean flag)
          Make the tableau editable or uneditable.
 void setFrame(javax.swing.JFrame frame)
          Set the top-level window associated with this tableau.
 void setMaster(boolean flag)
          Specify whether the window associated with this tableau is a master, which means that if that window is closed, then all windows associated with the model are closed.
 void setTitle(java.lang.String title)
          Set the title of this tableau, changing the title of the associated top-level window.
 void show()
          Make this tableau visible by calling setVisible(true), and raising or deiconifying its window.
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_addEntity, _addRelation, _adjustDeferrals, _deepOpaqueEntityList, _description, _exportMoMLContents, _finishedAddEntity, _recordDecoratedAttributes, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, isOpaque, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, newRelation, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_addPort, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getDisplayName, getFullName, getName, getName
 

Field Detail

size

public SizeAttribute size
A specification for the size of the frame.


_editable

private boolean _editable
Flag indicating whether the tableau is editable.


_frame

private javax.swing.JFrame _frame
The frame that the tableau is shown in.


_master

private boolean _master
True if this tableau is a master tableau. Default value is false.


_title

private java.lang.String _title
The title set by setTitle().

Constructor Detail

Tableau

public Tableau(Workspace workspace)
        throws IllegalActionException,
               NameDuplicationException
Construct a tableau in the specified workspace.

Parameters:
workspace - The workspace.
Throws:
IllegalActionException - If an error occurs creating the size attribute (should not occur).
NameDuplicationException - If the base class has already created an attribute with name "size" (should not occur).

Tableau

public Tableau(CompositeEntity container,
               java.lang.String name)
        throws IllegalActionException,
               NameDuplicationException
Construct a tableau with the given name and container.

Parameters:
container - The container.
name - The name of the tableau.
Throws:
IllegalActionException - If the tableau cannot be contained by the proposed container.
NameDuplicationException - If the name coincides with an entity already in the container.
Method Detail

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
If the argument is the size parameter, and a frame has been specified with setFrame(), then set the size of the frame.

Overrides:
attributeChanged in class NamedObj
Parameters:
attribute - The attribute that changed.
Throws:
IllegalActionException - If the size specification is not correctly formatted, or if the base class throws it.

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace. This calls the base class and then sets the associated frame to null. Thus, the resulting tableau has no frame associated with it.

Overrides:
clone in class CompositeEntity
Parameters:
workspace - The workspace for the new object.
Returns:
A new object.
Throws:
java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
See Also:
NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)

close

public boolean close()
Close this tableau by calling dispose() on the associated frame, or if the associated frame is an instance of TableauFrame, by calling _close() on it.

Returns:
False if the user cancels on a save query.

getFrame

public javax.swing.JFrame getFrame()
Return the top-level window that implements the display of this tableau.

Returns:
A top-level window.
See Also:
setFrame(JFrame)

getTitle

public java.lang.String getTitle()
Return the title of this tableau. Subclasses can override this to provide a better description of themselves for use in the title. This base class returns the value set by a call to setTitle(), if it has been called. If not, then it returns an identifier of the effigy containing this tableau, or the string "Unnamed" if there is no such identifier. The title is used as the title of the top-level window in the setFrame() method.

Returns:
The title to put on the window.
See Also:
setTitle(String)

isEditable

public boolean isEditable()
Return true if the tableau is editable. This base class returns whatever value has been set by setEditable(), or true if none has been specified.

Returns:
True if the tableau is editable.
See Also:
setEditable(boolean)

isMaster

public boolean isMaster()
Return true if this tableau is a master, which means that if that if its window is closed, then all other windows associated with the model are also closed. A tableau is a master if its container effigy is a master (its masterEffigy() method returns itself).

Returns:
True if the tableau is a master.

setContainer

public void setContainer(CompositeEntity container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class so that if the argument is null and the window is a master, then all other windows associated with the container are closed and the model is removed from the ModelDirectory. If this window is not a master, but after removing it there are no more windows associated with the model, then also remove it from the ModelDirectory.

Overrides:
setContainer in class CompositeEntity
Parameters:
container - The container to attach this attribute to.
Throws:
IllegalActionException - If the proposed container is not an instance of Effigy, or if this attribute is not of the expected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment.
NameDuplicationException - If the container already has an attribute with the name of this attribute.
See Also:
ComponentEntity.getContainer()

setEditable

public void setEditable(boolean flag)
Make the tableau editable or uneditable. Notice that this does not change whether the effigy is modifiable, so other tableaux on the same effigy may still modify the associated file. Derived class will usually need to override this method to set whether their associated interfaces are editable or not. They should call this superclass method so that isEditable() returns the value specified here.

Parameters:
flag - False to make the tableau uneditable.
See Also:
isEditable()

setFrame

public void setFrame(javax.swing.JFrame frame)
              throws IllegalActionException
Set the top-level window associated with this tableau.

Parameters:
frame - The top-level window associated with the tableau.
Throws:
IllegalActionException - If the frame is not acceptable (not thrown in this base class).
See Also:
getFrame()

setMaster

public void setMaster(boolean flag)
Specify whether the window associated with this tableau is a master, which means that if that window is closed, then all windows associated with the model are closed.

Parameters:
flag - If true, makes the window a master.

setTitle

public void setTitle(java.lang.String title)
Set the title of this tableau, changing the title of the associated top-level window. Call this with a null argument to use the identifier of the containing effigy as a title.

Parameters:
title - The title to put on the window.
See Also:
getTitle()

show

public void show()
Make this tableau visible by calling setVisible(true), and raising or deiconifying its window. If no frame has been set, then do nothing.