ptolemy.actor.lib.gui
Class MatrixViewer
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Sink
ptolemy.actor.lib.gui.MatrixViewer
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, Placeable, java.io.Serializable, TypedActor
- public class MatrixViewer
- extends Sink
- implements Placeable
An actor that displays the contents of a matrix input. This
actor has a single input port, which only accepts MatrixTokens. One
token is consumed per firing (in postfire()). The data in the MatrixToken is
displayed in a table format with scrollbars, using the swing JTable
class.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: MatrixViewer.java,v 1.30 2004/04/13 05:12:32 cxh Exp $
- Author:
- Bart Kienhuis and Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.actor.lib.Sink |
input |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
MatrixViewer(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name. |
|
Method Summary |
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description of the contents of this object. |
void |
attributeChanged(Attribute attribute)
Notification that an attribute has changed. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
initialize()
Initialize this matrix viewer. |
void |
place(java.awt.Container container)
Specify the container in which the data should be displayed.
|
boolean |
postfire()
Consume a matrix token from the input port
and display the token in a table. |
void |
setContainer(CompositeEntity container)
Override the base class to remove the display from its graphical
container if the argument is null. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, connectionsChanged, fire, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, removeDependency, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
width
public Parameter width
- The width of the table in pixels. This must contain an
integer. If the table is larger than this specified width,
then scrollbars will appear, or the column width is adjusted.
The default value is 500.
height
public Parameter height
- The height of the table in pixels. This must contain an
integer. If the table is larger than this specified width,
then scrollbars will appear. The default value is 300.
_paneSize
protected SizeAttribute _paneSize
- A specification of the size of the pane if it's in its own window.
MatrixViewer
public MatrixViewer(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the given container and name.
- Parameters:
container - The container.name - The name of this actor.
- Throws:
IllegalActionException - If the actor cannot be contained
by the proposed container.
NameDuplicationException - If the container already has an
actor with this name.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- Notification that an attribute has changed. If the attribute is
width or height then read the value of the attribute.
- Overrides:
attributeChanged in class NamedObj
- Parameters:
attribute - The attribute that changed.
- Throws:
IllegalActionException - If the expression of the
attribute cannot be parsed or cannot be evaluated.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the actor into the specified workspace. This calls the
base class and then removes association with graphical objects
belonging to the original class.
- Overrides:
clone in class AtomicActor
- Parameters:
workspace - The workspace for the new object.
- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException - If a derived class contains
an attribute that cannot be cloned.
initialize
public void initialize()
throws IllegalActionException
- Initialize this matrix viewer. If place() has not been called
with a container into which to place the display, then create a
new frame into which to put it.
- Specified by:
initialize in interface Executable- Overrides:
initialize in class AtomicActor
- Throws:
IllegalActionException - If the parent class
throws it.
place
public void place(java.awt.Container container)
- Specify the container in which the data should be displayed.
An instance of JTable will be added to that container. The
table is configured such that a user cannot reorder the
columns of the table. Also, the table maintains a fixed
preferred size, and will employ scrollbars if the table is
larger than the preferred size. If this method is not called,
the JTable will be placed in its own frame. The table is also
placed in its own frame if this method is called with a null
argument. The background of the table is set equal to that of
the container (unless it is null).
- Specified by:
place in interface Placeable
- Parameters:
container - The container into which to place the table.
postfire
public boolean postfire()
throws IllegalActionException
- Consume a matrix token from the input port
and display the token in a table. If a token is not available,
do nothing.
- Specified by:
postfire in interface Executable- Overrides:
postfire in class AtomicActor
- Returns:
- True if execution can continue into the next iteration.
- Throws:
IllegalActionException - If there is no director, or
if the base class throws it.
setContainer
public void setContainer(CompositeEntity container)
throws IllegalActionException,
NameDuplicationException
- Override the base class to remove the display from its graphical
container if the argument is null.
- Overrides:
setContainer in class AtomicActor
- Parameters:
container - The proposed container.
- Throws:
IllegalActionException - If the base class throws it.
NameDuplicationException - If the base class throws it.
_exportMoMLContents
protected void _exportMoMLContents(java.io.Writer output,
int depth)
throws java.io.IOException
- Write a MoML description of the contents of this object. This
overrides the base class to make sure that the current frame
properties, if there is a frame, are recorded.
- Overrides:
_exportMoMLContents in class Entity
- Parameters:
output - The output stream to write to.depth - The depth in the hierarchy, to determine indenting.
- Throws:
java.io.IOException - If an I/O error occurs.