ptolemy.actor.gui
Class TableauFactory

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.gui.TableauFactory
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Configurable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
ActorGraphTableau.Factory, BrowserTableau.Factory, CaseGraphTableau.Factory, CaseGraphTableau.Factory, DocBuilderTableau.Factory, DocTableau.Factory, EditIconTableau.Factory, ExecShellTableau.Factory, ExpressionShellTableau.Factory, FileEditorTableauFactory, FmvAutomatonGraphTableau.Factory, FmvAutomatonGraphTableau.Factory, FSMGraphTableau.Factory, FSMGraphTableau.Factory, GeneratorTableau.Factory, GTTableau.Factory, GTTableau.ModalTableauFactory, HTMLViewerTableau.Factory, ImageTableau.Factory, InterfaceAutomatonGraphTableau.Factory, InterfaceAutomatonGraphTableau.Factory, InterfaceTableau.Factory, JVMTableau.Factory, KielerLayoutTableauFactory, LevelSkippingTableauFactory, MatchResultTableau.Factory, MatrixTokenTableau.Factory, ModalTableauFactory, ModalTableauFactory, MoMLModelAttributeControllerFactory, NavigableActorGraphTableau.Factory, PlotTableau.Factory, PteraGraphTableau.Factory, PtolemyTableauFactory, PythonShellTableau.Factory, RunTableau.Factory, SingleWindowHTMLViewerTableau.Factory, TclShellTableau.Factory, TdlTableauFactory, TdlTaskTableauFactory, TextEditorTableau.Factory, TextEditorTableauFactory, TokenTableau.Factory, TreeTableau.Factory, VisualModelReference.LookInside

public class TableauFactory
extends Attribute
implements Configurable

This class is an attribute that creates a tableau to view a specified effigy. When a model is opened, if the top-level of that model contains this attribute or a subclass, then that attribute handles constructing a tableau. Otherwise, the configuration specifies which tableau is used. A configuration contains an instance of this class, and uses it to create a tableau for a model represented by an effigy. This base class assumes that it contains other tableau factories. Its createTableau() method defers to each contained factory, in the order in which they were added, until one is capable of creating a tableau for the specified effigy. Subclasses of this class will usually be inner classes of a Tableau, and will create the Tableau, or might themselves be aggregates of instances of TextEditorTableauFactory.

When there are multiple distinct TableauFactory classes that are capable of providing views on the same effigy, then instances of these factories should be aggregated into a single factory contained herein. Those instances can be presented as alternative views of the data when any single view is opened.

There is a significant subtlety with respect to how Ptolemy II classes are dealt with. Normally, when one looks inside an instance of a class, what is opened is the class definition, not the instance. However, if the instance contains an instance of TableauFactory, then what is opened is the instance, not the class definition. This is used, for example, when the look inside behavior is customized on a per instance basis.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  java.lang.String _configureSource
          The input source that was specified the last time the configure method was called.
private  java.lang.String _configureText
          The text string that represents the current configuration of this object.
 
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
TableauFactory(NamedObj container, java.lang.String name)
          Create a factory with the given name and container.
 
Method Summary
protected  void _configureTableau(Tableau tableau)
          Configure the given tableau with the configuration data attached to this tableau factory, if any.
 void configure(java.net.URL base, java.lang.String source, java.lang.String text)
          Configure the tableau factory with data from the specified input source (a URL) and/or textual data.
 Tableau createTableau(Effigy effigy)
          Create a tableau for the specified effigy.
 java.lang.String getConfigureSource()
          Return the input source that was specified the last time the configure method was called.
 java.lang.String getConfigureText()
          Return the text string that represents the current configuration of this object.
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_configureSource

private java.lang.String _configureSource
The input source that was specified the last time the configure method was called.


_configureText

private java.lang.String _configureText
The text string that represents the current configuration of this object.

Constructor Detail

TableauFactory

public TableauFactory(NamedObj container,
                      java.lang.String name)
               throws IllegalActionException,
                      NameDuplicationException
Create a factory with the given name and container.

Parameters:
container - The container.
name - The name.
Throws:
IllegalActionException - If the container is incompatible with this attribute.
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

createTableau

public Tableau createTableau(Effigy effigy)
                      throws java.lang.Exception
Create a tableau for the specified effigy. The tableau will be created with a new unique name with the specified effigy as its container. If this factory cannot create a tableau for the given effigy (perhaps because the effigy is not of the appropriate subclass), then return null. This base class assumes that it contains other tableau factories. This method defers to each contained factory in order until one is capable of creating a tableau for the specified effigy. As with all attributes, the order is simply the order of creation. Subclasses of this class will usually be inner classes of a Tableau, and will create the Tableau. A subclass that actually creates a tableau is responsible for setting the container of the tableau to the specified effigy, and for naming the tableau. Subclasses should not call show() in createTableau(), it is the responsibility of the caller to check the return value and call show() after doing things like adjusting the size.

Parameters:
effigy - The model effigy.
Returns:
A tableau for the effigy, or null if one cannot be created.
Throws:
java.lang.Exception - If the factory should be able to create a Tableau for the effigy, but something goes wrong.

configure

public void configure(java.net.URL base,
                      java.lang.String source,
                      java.lang.String text)
               throws java.lang.Exception
Configure the tableau factory with data from the specified input source (a URL) and/or textual data. The data is recorded locally without parsing.

Specified by:
configure in interface Configurable
Parameters:
base - The base relative to which references within the input are found, or null if this is not known, or there is none.
source - The input source, which specifies a URL, or null if none.
text - Configuration information given as text, or null if none.
Throws:
java.lang.Exception - If something goes wrong. No thrown in this class.

getConfigureSource

public java.lang.String getConfigureSource()
Return the input source that was specified the last time the configure method was called.

Specified by:
getConfigureSource in interface Configurable
Returns:
The string representation of the input URL, or null if the no source has been used to configure this object, or null if no external source need be used to configure this object.

getConfigureText

public java.lang.String getConfigureText()
Return the text string that represents the current configuration of this object. Note that any configuration that was previously specified using the source attribute need not be represented here as well.

Specified by:
getConfigureText in interface Configurable
Returns:
A configuration string, or null if no configuration has been used to configure this object, or null if no configuration string need be used to configure this object.

_configureTableau

protected void _configureTableau(Tableau tableau)
Configure the given tableau with the configuration data attached to this tableau factory, if any.

Parameters:
tableau - The tableau to be configured.