Package ptolemy.vergil.basic.export.web
Class Title
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable,HasTypeConstraints,Typeable,Changeable,Debuggable,DebugListener,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable,Settable,ValueListener,WebExportable
public class Title extends StringParameter implements WebExportable
Attribute specifying a title for a model or a component in a model. This attribute provides a visual title in the model, rendered more suitably for a title than a normal annotation. Moreover, if you export to web, this is used as the title for the containing component and for any exported web page. By default, the title is not shown on the web page except as part of the image of the model. If you wish for the title to also be shown in the HTML text before the image, then set the showTitleInHTML parameter to true.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable
Variable.CircularDependencyError, Variable.VariableScope
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
-
-
Field Summary
Fields Modifier and Type Field Description protected TextIcon_iconThe text icon.ParameterboldA boolean indicating whether the font should be bold.ParametercenterA boolean parameter that controls whether the origin of the text is center (if true) or north-west.StringParameterfontFamilyThe font family.ParameteritalicA boolean indicating whether the font should be italic.ParametershowTitleInHTMLIf set to true, then the title given by this parameter will be shown in the HTML prior to the image of the model (as well as in the image of the model, if it is visible when the export to web occurs).ColorAttributetextColorThe text color.ParametertextSizeThe text size.-
Fields inherited from class ptolemy.data.expr.Variable
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _valueListeners
-
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
-
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_provideAttributes(WebExporter exporter)Provide a title for this object to the specified web exporter.voidattributeChanged(Attribute attribute)React to a changes in the attributes by changing the icon.java.lang.Objectclone(Workspace workspace)Clone the object into the specified workspace.java.lang.StringgetMimeType()A title is of type text/html.booleanisOverwriteable()Return true, since new title content should overwrite old title content.intmoveToFirst()Move this object to the first position in the list of attributes of the container.intmoveToLast()Move this object to the last position in the list of attributes of the container.voidprovideContent(WebExporter exporter)Return a title for the model.java.util.Collectionvalidate()Override the base class to set the text to be displayed in the icon.-
Methods inherited from class ptolemy.data.expr.StringParameter
stringValue
-
Methods inherited from class ptolemy.data.expr.Parameter
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
-
Methods inherited from class ptolemy.data.expr.Variable
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, valueChanged
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToIndex, moveUp, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, 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, uniqueName, 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.Nameable
description, getContainer, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
Field Detail
-
bold
public Parameter bold
A boolean indicating whether the font should be bold. This defaults to false.
-
center
public Parameter center
A boolean parameter that controls whether the origin of the text is center (if true) or north-west.
-
fontFamily
public StringParameter fontFamily
The font family. This is a string that defaults to "SansSerif".
-
italic
public Parameter italic
A boolean indicating whether the font should be italic. This defaults to false.
-
showTitleInHTML
public Parameter showTitleInHTML
If set to true, then the title given by this parameter will be shown in the HTML prior to the image of the model (as well as in the image of the model, if it is visible when the export to web occurs). This is a boolean that defaults to false.
-
textColor
public ColorAttribute textColor
The text color. This is a string representing an array with four elements, red, green, blue, and alpha, where alpha is transparency. The default is "{0.0, 0.0, 0.0, 1.0}", which represents an opaque black.
-
textSize
public Parameter textSize
The text size. This is an int that defaults to 14.
-
_icon
protected TextIcon _icon
The text icon.
-
-
Constructor Detail
-
Title
public Title(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create an instance of this parameter.- Parameters:
container- The container.name- The name.- Throws:
IllegalActionException- If the superclass throws it.NameDuplicationException- If the superclass throws it.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
React to a changes in the attributes by changing the icon.- Overrides:
attributeChangedin classVariable- Parameters:
attribute- The attribute that changed.- Throws:
IllegalActionException- If the change is not acceptable to this container (should not be thrown).
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace.
-
getMimeType
public java.lang.String getMimeType()
A title is of type text/html.- Specified by:
getMimeTypein interfaceWebExportable- Returns:
- The string text/html
-
isOverwriteable
public boolean isOverwriteable()
Return true, since new title content should overwrite old title content.- Specified by:
isOverwriteablein interfaceWebExportable- Returns:
- True, since new title content should overwrite old title content.
-
moveToFirst
public int moveToFirst() throws IllegalActionExceptionMove this object to the first position in the list of attributes of the container. This overrides the base class to create an attribute named "_renderFirst" and to remove an attribute named "_renderLast", if it is present. This attribute is recognized by vergil, which then renders this attribute before entities, connections, and other attributes. This method gets write access on workspace and increments the version.- Specified by:
moveToFirstin interfaceMoveable- Overrides:
moveToFirstin classAttribute- Returns:
- The index of the specified object prior to moving it, or -1 if it is not moved.
- Throws:
IllegalActionException- If this object has no container.
-
moveToLast
public int moveToLast() throws IllegalActionExceptionMove this object to the last position in the list of attributes of the container. This overrides the base class to create an attribute named "_renderLast" and to remove an attribute named "_renderFirst" if it is present. This attribute is recognized by vergil, which then renders this attribute after entities, connections, and other attributes. This method gets write access on workspace and increments the version.- Specified by:
moveToLastin interfaceMoveable- Overrides:
moveToLastin classAttribute- Returns:
- The index of the specified object prior to moving it, or -1 if it is not moved.
- Throws:
IllegalActionException- If this object has no container.
-
provideContent
public void provideContent(WebExporter exporter) throws IllegalActionException
Return a title for the model. The title can be returned as an attribute or an element, but not a document.- Specified by:
provideContentin interfaceWebExportable- Parameters:
exporter- The web exporter to which to write content.- Throws:
IllegalActionException- If there is a problem creating the content or setting the attribute.
-
_provideAttributes
protected void _provideAttributes(WebExporter exporter) throws IllegalActionException
Provide a title for this object to the specified web exporter.- Parameters:
exporter- The WebExporter to add content to- Throws:
IllegalActionException- If something is wrong with the specification of the content.
-
validate
public java.util.Collection validate() throws IllegalActionExceptionOverride the base class to set the text to be displayed in the icon.- Specified by:
validatein interfaceSettable- Overrides:
validatein classVariable- Returns:
- The current list of value listeners, which are evaluated as a consequence of this call to validate().
- Throws:
IllegalActionException- If this variable or a variable dependent on this variable cannot be evaluated (and is not lazy) and the model error handler throws an exception. Also thrown if the change is not acceptable to the container.
-
-