Package ptolemy.vergil.toolbox
Class TextEditorTableauFactory
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.gui.TableauFactory
-
- ptolemy.vergil.toolbox.TextEditorTableauFactory
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Configurable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,TextEditorFactory
public class TextEditorTableauFactory extends TableauFactory implements TextEditorFactory
This class is an attribute that creates a text editor to edit a specified string attribute in the container of this attribute. It is similar to TextEditorConfigureFactory, but instead of opening when the actor is configured, it is opened when the user looks inside the actor.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- See Also:
TextEditorConfigureFactory
- Pt.AcceptedRating:
- Red (ptolemy)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description StringAttribute
attributeName
The name of the string attribute that is to be edited.Parameter
columnsDisplayed
The horizontal size of the display, in columns.Parameter
rowsDisplayed
The vertical size of the display, in rows.StringAttribute
syntaxStyle
The style of the text to be edited.-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description TextEditorTableauFactory(NamedObj container, java.lang.String name)
Create a factory with the given name and container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TextEffigy
_newTextEffigy(Effigy effigy, java.lang.String text)
Create a text effigy to be contained by the specified host effigy for the specified text.void
clear()
Remove any editor that may have been associated with this object by a previous call to createEditor().Tableau
createTableau(Effigy effigy)
Create a tableau for the specified effigy.java.lang.String
getText()
Return the current text of the text editor.static java.lang.String
getTextToEdit(Attribute attributeToEdit)
Return the text value of the specified attribute.-
Methods inherited from class ptolemy.actor.gui.TableauFactory
_configureTableau, configure, getConfigureSource, getConfigureText
-
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, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Field Detail
-
attributeName
public StringAttribute attributeName
The name of the string attribute that is to be edited.
-
columnsDisplayed
public Parameter columnsDisplayed
The horizontal size of the display, in columns. This contains an integer, and defaults to 80.
-
rowsDisplayed
public Parameter rowsDisplayed
The vertical size of the display, in rows. This contains an integer, and defaults to 40.
-
syntaxStyle
public StringAttribute syntaxStyle
The style of the text to be edited. This may or may not be supported. If the package "org.fife.ui.rsyntaxtextarea" is found in the classpath, then the supported styles include "text/plain", "text/c", "text/clojure", "text/cpp", "text/cs", "text/css", "text/dtd", "text/fortran", "text/groovy", "text/html", "text/java", "text/javascript", "text/json", "text/jsp", "text/latex", "text/makefile", "text/perl", "text/php", "text/properties", "text/python", "text/ruby", "text/sas", "text/scala", "text/sql", "text/tcl", "text/unix", "text/vb", "text/bat", and "text/xml".
-
-
Constructor Detail
-
TextEditorTableauFactory
public TextEditorTableauFactory(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
-
clear
public void clear()
Remove any editor that may have been associated with this object by a previous call to createEditor().- Specified by:
clear
in interfaceTextEditorFactory
-
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 (it is not an instance of PtolemyEffigy), then return null.- Overrides:
createTableau
in classTableauFactory
- Parameters:
effigy
- The component 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.
-
getText
public java.lang.String getText()
Return the current text of the text editor.- Specified by:
getText
in interfaceTextEditorFactory
- Returns:
- The current text of the text editor, or null if there is none.
-
getTextToEdit
public static java.lang.String getTextToEdit(Attribute attributeToEdit)
Return the text value of the specified attribute.- Parameters:
attributeToEdit
- The attribute.- Returns:
- The text contained by this attribute, or an error message if the attribute does not contain text.
-
_newTextEffigy
protected TextEffigy _newTextEffigy(Effigy effigy, java.lang.String text) throws java.lang.Exception
Create a text effigy to be contained by the specified host effigy for the specified text.- Parameters:
effigy
- The host effigy.text
- The text.- Returns:
- the TextEffigy.
- Throws:
java.lang.Exception
- If the text effigy cannot be contained by the specified container, or if the specified text cannot be inserted into the document.
-
-