Package ptolemy.vergil.basic.export.web
Class WebElement
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.kernel.util.AbstractSettableAttribute
-
- ptolemy.kernel.util.StringAttribute
-
- ptolemy.vergil.basic.export.web.WebElement
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,Settable
public class WebElement extends StringAttribute
Attribute containing information and methods for web elements, for example, HTML tags and content, as in <div> This is some HTML content </div> The full name including the _elementName is used as WebElement's web id. In an HTML page, elements that have ids are required to have globally unique ids. The _webName field is used for the WebElement's web name. Elements can have non-unique web names - this is done for example for radio buttons on web forms. http://solidlystated.com/scripting/html-difference-between-id-and-name/ http://stackoverflow.com/questions/1363693/do-input-field-names-have-to-be-unique-across-forms- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Elizabeth Latronico
- Pt.AcceptedRating:
- Red (ltrnc)
- Pt.ProposedRating:
- Red (ltrnc)
-
-
Nested Class Summary
-
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 static java.lang.String
BODY
A special constant indicating that the <body/> element should be the parent.static java.lang.String
END
Special constant indicating to put content in a div with the name "end" which occurs at the end of the HTML body.static java.lang.String
HEAD
A special constant indicating that the <head/> element should be the parent.static java.lang.String
START
Special constant indicating to put content in a div with the name "start" which occurs at the beginning of the HTML body.-
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 WebElement(NamedObj container, java.lang.String name)
Create an instance of this parameter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WebElement
createWebElement(NamedObj container, java.lang.String id, java.lang.String webName)
Factory method for creating WebElements.java.lang.String
getParent()
Return the name of the desired parent element, or the empty string if none.java.lang.String
getWebName()
Return the web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.void
setParent(java.lang.String parent)
Set the name of the desired parent element.void
setWebName(java.lang.String webName)
Set the web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.-
Methods inherited from class ptolemy.kernel.util.StringAttribute
_propagateValue, addValueListener, clone, exportMoML, getExpression, getVisibility, removeValueListener, setExpression, setVisibility, validate
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression, getValueAsString
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, 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, _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, 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, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
Field Detail
-
BODY
public static final java.lang.String BODY
A special constant indicating that the <body/> element should be the parent. The <head/> and <body/> tags of an HTML document do not typically have names. For example, almost no one writes <head name="head">, it's only <head/>. Therefore, the WebExporter will not be able to use the name to find the parent element.- See Also:
- Constant Field Values
-
HEAD
public static final java.lang.String HEAD
A special constant indicating that the <head/> element should be the parent. The <head/> and <body/> tags of an HTML document do not typically have names. For example, almost no one writes <head name="head">, it's only <head/>. Therefore, the WebExporter will not be able to use the name to find the parent element.- See Also:
- Constant Field Values
-
START
public static final java.lang.String START
Special constant indicating to put content in a div with the name "start" which occurs at the beginning of the HTML body.- See Also:
- Constant Field Values
-
END
public static final java.lang.String END
Special constant indicating to put content in a div with the name "end" which occurs at the end of the HTML body.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WebElement
public WebElement(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
-
createWebElement
public static WebElement createWebElement(NamedObj container, java.lang.String id, java.lang.String webName) throws IllegalActionException
Factory method for creating WebElements. Checks if there is an existing WebElement with the same id (Ptolemy name). If so, return it; if not create a new one. Sets persistent to false. Static so that any WebExportable may call it.- Parameters:
container
- The container object for the WebElementid
- The Ptolemy name for the WebElement (WebElement uses this as a unique id)webName
- The web name of this WebElement- Returns:
- The WebElement that was created (or that previously existed) with persistent set to false
- Throws:
IllegalActionException
- if the WebAttribute cannot be created (perhaps another Attribute exists with the requested name)
-
getParent
public java.lang.String getParent()
Return the name of the desired parent element, or the empty string if none.- Returns:
- The name of the desired parent element, or the empty string if none.
- See Also:
setParent(String)
-
getWebName
public java.lang.String getWebName()
Return the web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.- Returns:
- The web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.
- See Also:
setWebName(String)
-
setParent
public void setParent(java.lang.String parent)
Set the name of the desired parent element. Can also be a special constant for tags that do not typically have names, like <head/> and <body/>.- Parameters:
parent
- The name or special constant of the parent element.- See Also:
getParent()
-
setWebName
public void setWebName(java.lang.String webName)
Set the web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.- Parameters:
webName
- The web name of this element; for example, "myElement" in <div name="myElement"/> in HTML.- See Also:
getWebName()
-
-