Package ptolemy.vergil.basic.export.web
Class JSPlotterAttribute
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable,HasTypeConstraints,Typeable,Changeable,Debuggable,DebugListener,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable,Settable,ValueListener,WebExportable
- Direct Known Subclasses:
DygraphsJSPlotterAttribute
public abstract class JSPlotterAttribute extends WebContent implements WebExportable
Base class for attributes generating the HTML file with JavaScript to plot simulation results for "Export to Web". This class provides parameters that control how the figure should be plot. The generated HTML page consists of three parts: the head, the body and the JavaScript in the head. Methods are provided to modify the contents of these parts.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Baobing (Brian) Wang
- 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 ParameterautoResizeParameter specifying if the figure should be auto-resized based on the window size.StringParametercustomContentParameter specifying text to be inserted into dygraph constructor call.ParameterdataConnectWidthParameter specifying the width of the stroke connecting data points This is an int that defaults to 2.StringParameterdataJSONParameter giving the data traces in JSON format to be plot.ParameterdataMarkerRadiusParameter specifying the radius of markers for data points.ParameterdrawHorizontalGridLineParameter specifying if the horizontal grid line should be drawn.ParameterdrawVerticalGridLineParameter specifying if the vertical grid line should be drawn.ParameterenableDataMarkerParameter specifying if markers should be drawn for data points.ParameterenableEventsMarkerParameter specifying if markers should be drawn for event points.ParameterenableLegendParameter specifying if the legend should be shown on the figure.ParametereventsConnectWidthParameter specifying the width of the stroke connecting event points This is an int that defaults to 0.StringParametereventsJSONParameter giving the event traces in JSON format to be plot.ParametereventsMarkerRadiusParameter specifying the radius of markers for event points.ParametergraphHeightParameter specifying the height of the figure.ParametergraphWidthParameter specifying the width of the figure.StringParameterhorizontalAlignParameter specifying the horizontal position of the legend on the figure.LinkTargetlinkTargetParameter specifying the target for the link.StringParameteroutputDataFileParameter specifying the name of the file to store the data and event traces.StringParameteroutputHTMLFileParameter specifying the name of the generated HTML file.ParametersaveDataToFileParameter specifying if the data and event traces should be saved in a separated file.StringParameterverticalAlignParameter specifying the vertical position of the legend on the figure.StringParameterxAxisModeParameter specifying how to parse the X axis value.StringParameterxAxisTitleParameter specifying the title of the X axis.StringParameteryAxisModeParameter specifying how to parse the Y axis value.StringParameteryAxisTitleParameter specifying the title of the Y axis.-
Fields inherited from class ptolemy.vergil.basic.export.web.WebContent
_icon, displayText, height, width
-
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
-
-
Constructor Summary
Constructors Constructor Description JSPlotterAttribute(NamedObj container, java.lang.String name)Create an instance for each parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_provideAttributes(WebExporter exporter)Provide content to the specified web exporter to be included in a web page for the container of this object.java.util.HashMap<java.lang.String,java.lang.String>getBasicConfig()Get the parameter values from the GUI input.java.lang.StringgetBodyContent()Get the body content.java.lang.StringgetHeaderContent()Get the head content.java.lang.StringgetHTMLPageContent()Get the content of the whole HTML page.java.lang.StringgetMimeType()BasicJSPlotter is of type text/html.voidinsertBodyContent(java.lang.String content)Insert a string to the body with auto-indent.voidinsertHeaderContent(boolean isJavaScript, boolean autoIndent, java.lang.String content)Insert a string to the header with auto-indent.booleanisOverwriteable()Return true, since new content should overwrite old.-
Methods inherited from class ptolemy.vergil.basic.export.web.WebContent
_provideElements, attributeChanged, clone, provideContent
-
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, validate, valueChanged
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, 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
-
Methods inherited from interface ptolemy.vergil.basic.export.web.WebExportable
provideContent
-
-
-
-
Field Detail
-
autoResize
public Parameter autoResize
Parameter specifying if the figure should be auto-resized based on the window size. This is a boolean that defaults to true.
-
customContent
public StringParameter customContent
Parameter specifying text to be inserted into dygraph constructor call. Workaround for specifying complicated options not covered by other parameters, for example, series-specific parameters.
-
dataConnectWidth
public Parameter dataConnectWidth
Parameter specifying the width of the stroke connecting data points This is an int that defaults to 2.
-
dataJSON
public StringParameter dataJSON
Parameter giving the data traces in JSON format to be plot. This defaults to ""
-
drawHorizontalGridLine
public Parameter drawHorizontalGridLine
Parameter specifying if the horizontal grid line should be drawn. This is a boolean that defaults to true.
-
dataMarkerRadius
public Parameter dataMarkerRadius
Parameter specifying the radius of markers for data points. This is an int that defaults to 3.
-
drawVerticalGridLine
public Parameter drawVerticalGridLine
Parameter specifying if the vertical grid line should be drawn. This is a boolean that defaults to false.
-
enableDataMarker
public Parameter enableDataMarker
Parameter specifying if markers should be drawn for data points. This is a boolean that defaults to false.
-
enableEventsMarker
public Parameter enableEventsMarker
Parameter specifying if markers should be drawn for event points. This is a boolean that defaults to true.
-
enableLegend
public Parameter enableLegend
Parameter specifying if the legend should be shown on the figure. This a boolean that defaults to true.
-
eventsConnectWidth
public Parameter eventsConnectWidth
Parameter specifying the width of the stroke connecting event points This is an int that defaults to 0.
-
eventsMarkerRadius
public Parameter eventsMarkerRadius
Parameter specifying the radius of markers for event points. This is an int that defaults to 3.
-
eventsJSON
public StringParameter eventsJSON
Parameter giving the event traces in JSON format to be plot. This defaults to ""
-
graphWidth
public Parameter graphWidth
Parameter specifying the width of the figure. This is an int that defaults to 400px.
-
graphHeight
public Parameter graphHeight
Parameter specifying the height of the figure. This is an int that defaults to 500px.
-
horizontalAlign
public StringParameter horizontalAlign
Parameter specifying the horizontal position of the legend on the figure. This defaults to "center".
-
linkTarget
public LinkTarget linkTarget
Parameter specifying the target for the link. The possibilities are:- _lightbox: Open in a lightbox-style popup frame.
- _blank: Open in a new window or tab.
- _self: Open in the same frame as it was clicked.
- _parent: Open in the parent frameset.
- _top: Open in the full body of the window.
- framename: Open in a named frame.
-
outputDataFile
public StringParameter outputDataFile
Parameter specifying the name of the file to store the data and event traces. This defaults to "simulationResult.txt".
-
outputHTMLFile
public StringParameter outputHTMLFile
Parameter specifying the name of the generated HTML file. This defaults to "JSPlotter.html".
-
saveDataToFile
public Parameter saveDataToFile
Parameter specifying if the data and event traces should be saved in a separated file. This is a boolean that defaults to false.
-
verticalAlign
public StringParameter verticalAlign
Parameter specifying the vertical position of the legend on the figure. This defaults to "bottom".
-
xAxisMode
public StringParameter xAxisMode
Parameter specifying how to parse the X axis value. This defaults to "linear".
-
xAxisTitle
public StringParameter xAxisTitle
Parameter specifying the title of the X axis. This defaults to "X Axis".
-
yAxisMode
public StringParameter yAxisMode
Parameter specifying how to parse the Y axis value. This defaults to "linear".
-
yAxisTitle
public StringParameter yAxisTitle
Parameter specifying the title of the Y axis. This defaults to "Y Axis".
-
-
Constructor Detail
-
JSPlotterAttribute
public JSPlotterAttribute(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create an instance for each parameter.- Parameters:
container- The container.name- The name.- Throws:
IllegalActionException- If the superclass throws it.NameDuplicationException- If the superclass throws it.
-
-
Method Detail
-
getMimeType
public java.lang.String getMimeType()
BasicJSPlotter is of type text/html.- Specified by:
getMimeTypein interfaceWebExportable- Returns:
- The string "text/html"
-
isOverwriteable
public boolean isOverwriteable()
Return true, since new content should overwrite old.- Specified by:
isOverwriteablein interfaceWebExportable- Returns:
- true, since new content should overwrite old
-
getBasicConfig
public java.util.HashMap<java.lang.String,java.lang.String> getBasicConfig() throws IllegalActionExceptionGet the parameter values from the GUI input.- Returns:
- The hash map containing the values of all parameters
- Throws:
IllegalActionException
-
getBodyContent
public java.lang.String getBodyContent()
Get the body content.- Returns:
- The string containing the body content
-
getHeaderContent
public java.lang.String getHeaderContent()
Get the head content.- Returns:
- The string containing the head content
-
getHTMLPageContent
public java.lang.String getHTMLPageContent()
Get the content of the whole HTML page.- Returns:
- The string containing the content of the whole HTML page
-
insertBodyContent
public void insertBodyContent(java.lang.String content)
Insert a string to the body with auto-indent.- Parameters:
content- The content to be inserted
-
insertHeaderContent
public void insertHeaderContent(boolean isJavaScript, boolean autoIndent, java.lang.String content)Insert a string to the header with auto-indent.- Parameters:
isJavaScript- Whether the inserted content is JavaScript codeautoIndent- Whether the content should be auto-indentedcontent- the content to be inserted
-
_provideAttributes
protected void _provideAttributes(WebExporter exporter) throws IllegalActionException
Provide content to the specified web exporter to be included in a web page for the container of this object. This class defines an href attribute to associate with the area of the image map corresponding to its container.- Overrides:
_provideAttributesin classWebContent- Parameters:
exporter- The web exporter to write content to- Throws:
IllegalActionException- If evaluating the value of this parameter fails, or creating a web attribute fails.
-
-