Package ptolemy.cg.kernel.generic.html
Class HTMLCodeGenerator
- java.lang.Object
 - 
- ptolemy.kernel.util.NamedObj
 - 
- ptolemy.kernel.util.Attribute
 - 
- ptolemy.cg.kernel.generic.GenericCodeGenerator
 - 
- ptolemy.cg.kernel.generic.html.HTMLCodeGenerator
 
 
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Cloneable,Changeable,Debuggable,DebugListener,Decorator,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
public class HTMLCodeGenerator extends GenericCodeGenerator
Generate a HTML description of a model.To generate an HTML version of a model, use:
java -classpath $PTII ptolemy.cg.kernel.generic.html.HTMLCodeGenerator -generatorPackage ptolemy.cg.kernel.generic.html -generatorPackageList generic.html adapter/generic/html/demo/HierarchicalModel/HierarchicalModel.xml
- Since:
 - Ptolemy II 10.0
 - Version:
 - $Id$
 - Author:
 - Man-Kit Leung, Bert Rodiers
 - Pt.AcceptedRating:
 - red (rodiers)
 - Pt.ProposedRating:
 - red (rodiers)
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator 
 - 
 
- 
Field Summary
- 
Fields inherited from class ptolemy.cg.kernel.generic.GenericCodeGenerator
_codeFileName, _eol, _executeCommands, _generateInSubdirectory, _model, _sanitizedModelName, codeDirectory, generateInSubdirectory, generatorPackage, generatorPackageList, INDENT1, INDENT2, INDENT3, overwriteFiles 
- 
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 HTMLCodeGenerator(NamedObj container, java.lang.String name)Create a new instance of the HTMLCodeGenerator. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int_generateCode(java.lang.StringBuffer code)Generate HTML and append it to the given string buffer.protected java.lang.Class<?>_getAdapterClassFilter()Return the filter class to find adapters.java.lang.Stringcomment(java.lang.String comment)Return a formatted comment containing the specified string.- 
Methods inherited from class ptolemy.cg.kernel.generic.GenericCodeGenerator
_copyCFilesTosrc, _copyCFileTosrc, _executeCommands, _getAdapter, _getAutoGeneratedAdapter, _getOutputFilename, _instantiateAdapter, _isTopLevel, _printTimeAndMemory, _reset, _resetAll, _writeCode, _writeCodeFileName, attributeChanged, clone, createDecoratorAttributes, decoratedObjects, generateCode, generateCode, generateCode, generateCopyright, getAdapter, getCodeFileName, getComponent, getExecuteCommands, getMethodExceptionString, getMethodVisibilityString, isGlobalDecorator, main, setCodeGenerator, setContainer, setExecuteCommands, updateCommandOptions 
- 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, 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, 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 
- 
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, getDisplayName, getFullName, getName, getName, setName 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
HTMLCodeGenerator
public HTMLCodeGenerator(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new instance of the HTMLCodeGenerator. The value of the generatorPackageList parameter of the base class is set togeneric.html- Parameters:
 container- The container.name- The name of the HTMLCodeGenerator.- Throws:
 IllegalActionException- If the super class throws the exception or error occurs when setting the file path.NameDuplicationException- If the super class throws the exception or an error occurs when setting the file path.
 
 - 
 
- 
Method Detail
- 
comment
public java.lang.String comment(java.lang.String comment)
Return a formatted comment containing the specified string. In this base class, the comments is a HTML-style comment, which begins with "" followed by the platform dependent end of line character(s): under Unix: "\n", under Windows: "\n\r". Subclasses may override this produce comments that match the code generation language.- Overrides:
 commentin classGenericCodeGenerator- Parameters:
 comment- The string to put in the comment.- Returns:
 - A formatted comment.
 
 
- 
_generateCode
protected int _generateCode(java.lang.StringBuffer code) throws KernelExceptionGenerate HTML and append it to the given string buffer. Write the code to the directory specified by the codeDirectory parameter. The file name is a sanitized version of the model name with a suffix that is based on last package name of the generatorPackage parameter. Thus if the codeDirectory is$HOME, the name of the model isFooand the generatorPackage isptolemy.cg.kernel.generic.html, then the file that is written will be$HOME/Foo.htmlThis method is the main entry point to generate html.- Overrides:
 _generateCodein classGenericCodeGenerator- Parameters:
 code- The given string buffer.- Returns:
 - The return value of the last subprocess that was executed. or -1 if no commands were executed.
 - Throws:
 KernelException- If the target file cannot be overwritten or write-to-file throw any exception.
 
- 
_getAdapterClassFilter
protected java.lang.Class<?> _getAdapterClassFilter()
Return the filter class to find adapters. All adapters have to extend this class.- Overrides:
 _getAdapterClassFilterin classGenericCodeGenerator- Returns:
 - The base class for the adapters.
 
 
 - 
 
 -