fi.hut.tml.xsmiles.mlfc.smil.basic
Class SMILRegionElementImpl

java.lang.Object
  extended byorg.apache.xerces.dom.NodeImpl
      extended byorg.apache.xerces.dom.ChildNode
          extended byorg.apache.xerces.dom.ParentNode
              extended byorg.apache.xerces.dom.ElementImpl
                  extended byorg.apache.xerces.dom.ElementNSImpl
                      extended byfi.hut.tml.xsmiles.dom.XSmilesElementImpl
                          extended byfi.hut.tml.xsmiles.dom.VisualElementImpl
                              extended byfi.hut.tml.xsmiles.mlfc.smil.basic.SMILElementImpl
                                  extended byfi.hut.tml.xsmiles.mlfc.smil.basic.SMILRegionElementImpl
All Implemented Interfaces:
AnimationService, java.lang.Cloneable, CSSStyleChangeListener, org.w3c.dom.Element, ElementLayout, org.w3c.dom.events.EventListener, org.w3c.dom.events.EventTarget, InitializableElement, LayoutCalc, org.w3c.dom.Node, org.w3c.dom.NodeList, PseudoClassController, ResourceFetcher, java.io.Serializable, SMILElement, SMILRegionElement, StylableElement, org.w3c.dom.TypeInfo, VisualElement, XSmilesLayoutReference

public class SMILRegionElementImpl
extends SMILElementImpl
implements SMILRegionElement, LayoutCalc, AnimationService

Controls the position, size and scaling of media object elements. See the region element definition . MediaElements should register themselves to their regions. Otherwise, media elements will not get refreshed if the region attributes change. This implements AnimationService, thus allows animation of some attributes.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class fi.hut.tml.xsmiles.dom.XSmilesElementImpl
XSmilesElementImpl.PseudoNodeList
 
Field Summary
static short SHOWBACKGROUND_ALWAYS
           
static short SHOWBACKGROUND_WHENACTIVE
           
 
Fields inherited from class fi.hut.tml.xsmiles.mlfc.smil.basic.SMILElementImpl
smilDoc
 
Fields inherited from class fi.hut.tml.xsmiles.dom.VisualElementImpl
views
 
Fields inherited from class fi.hut.tml.xsmiles.dom.XSmilesElementImpl
DESTROYED, elementStatus, INITIALIZED, INITIALIZING, setPseudoClasses, style, UNINITIALIZED, xblpropname
 
Fields inherited from class org.apache.xerces.dom.ElementNSImpl
localName, namespaceURI
 
Fields inherited from class org.apache.xerces.dom.ElementImpl
attributes, name
 
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, UNNORMALIZED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
SMILRegionElementImpl(org.apache.xerces.dom.DocumentImpl owner, SMILDocumentImpl smil, java.lang.String ns)
          Constructor with owner doc
 
Method Summary
 void addLink(LinkHandler link)
          Add media to this region.
 void addMedia(MediaHandler media)
          Add media to this region.
 void addRegion(SMILRegionElementImpl region)
          Add region to this region.
 int calcBottom()
          Calculate the bottom border, relative to the given root-layout/region (in case of %).
 int calcLeft()
          Calculate the left border, relative to the given root-layout/region (in case of %).
 int calcRight()
          Calculate the right border, relative to the given root-layout/region (in case of %).
 int calcTop()
          Calculate the top border, relative to the given root-layout/region (in case of %).
 float convertStringToUnitless(java.lang.String attr, java.lang.String value)
          Convert String attribute to an float value
 java.lang.String convertUnitlessToString(java.lang.String attr, float value)
           
 void destroy()
          Release resources.
 java.lang.String getAnimAttribute(java.lang.String attr)
          This method returns the animation value of the attribute, and if not available, returns the DOM value.
 java.lang.String getBackgroundColor()
           
 java.lang.String getBottom()
          bottom
 DrawingArea getDrawingArea()
          Return drawing area.
 java.lang.String getFit()
           
 java.lang.String getHeight()
           
 java.lang.String getLeft()
          left
 java.lang.String getRegionName()
          regionName
 java.lang.String getRight()
          right
 short getShowBackground()
          showBackground
 java.lang.String getSoundLevel()
          soundLevel
 java.lang.String getTop()
          top
 java.lang.String getWidth()
           
 int getZIndex()
           
 void initHead()
          Initializes this region and its associated DrawingArea.
 void initHeadAndAddTo(SMILRegionElementImpl parentReg, DrawingArea parentDrawingArea, boolean block, org.w3c.dom.Element origElem)
          CSS: Initializes this region and its associated DrawingArea.
 void refreshAnimation()
          Refresh element with all the animation values.
 void removeAnimAttribute(java.lang.String attr)
          The anim attribute value removed with this method allows the DOM attribute value be visible.
 void removeMedia(MediaHandler media)
          Remove media or link from this region.
 void removeRegion(SMILRegionElementImpl region)
          Remove region from this region.
 void setAnimAttribute(java.lang.String attr, java.lang.String value)
          The attribute value set with this method should take precedence over the DOM attribute value.
 void setAttribute(java.lang.String name, java.lang.String value)
           
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
           
 void setAttributeNS(java.lang.String ns, java.lang.String name, java.lang.String value)
           
 void setBackgroundColor(java.lang.String backgroundColor)
           
 void setBottom(java.lang.String bottom)
           
 void setFit(java.lang.String fit)
           
 void setHeight(int height)
           
 void setHeight(java.lang.String h)
          Prosentual height
 void setLeft(java.lang.String left)
           
 void setRegionName(java.lang.String regionName)
           
 void setRight(java.lang.String right)
           
 void setShowBackground(short showBackground)
           
 void setSoundLevel(java.lang.String soundLevel)
           
 void setTop(java.lang.String top)
           
 void setWidth(int width)
           
 void setWidth(java.lang.String w)
          Prosentual width
 void setZIndex(int zIndex)
           
 
Methods inherited from class fi.hut.tml.xsmiles.mlfc.smil.basic.SMILElementImpl
dispatch, getAlt, getClassName, getId, getLongdesc, getOwnerDoc, getSMILDoc, getTitle, setAlt, setClassName, setId, setLongdesc, setTitle
 
Methods inherited from class fi.hut.tml.xsmiles.dom.VisualElementImpl
addView, belongsToTree, getViews, handleEvent, init, insertBefore, isCurrentlyVisible, isFocusPoint, isPseudoClass, isVisibleByCSSProperties, notifyPseudoRemoved, removeAllViews, removeAttribute, removeChild, replaceChild, setStatus, styleChanged, updateViews
 
Methods inherited from class fi.hut.tml.xsmiles.dom.XSmilesElementImpl
addBinding, addUndistributedChild, clone, clonePseudoElements, cloneSubtree, debugNode, debugNode, dispatchEventInMainThread, get, getApplyBindingSheets, getAuthorSheets, getChildNodes, getElementStatus, getOriginalClone, getPseudoClass, getResourceReferencer, getRuleNode, getStyle, getStyleAttrValue, getText, getText, getUndistributedChildNodes, getXblImplementations, hasBinding, hasStyle, initFinalFlattenedTree, initStyle, isInitedForReset, removeBinding, removeUndistributedChild, replaceNode, resetFinalFlattenedTree, resolveURI, searchElementWithId, searchElementWithId, setApplyBindingSheets, setAuthorSheets, setPseudoClass, setRuleNode, setStyle, updateStyle
 
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getBaseURI, getLocalName, getNamespaceURI, getPrefix, getTypeName, getTypeNamespace, setPrefix, setType, setValues
 
Methods inherited from class org.apache.xerces.dom.ElementImpl
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, getSchemaTypeInfo, getTagName, getXercesAttribute, hasAttribute, hasAttributeNS, hasAttributes, isEqualNode, normalize, reconcileDefaultAttributes, removeAttributeNode, removeAttributeNS, setAttributeNodeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setReadOnly, setupDefaultAttributes, setXercesAttributeNode, synchronizeData
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, item, setTextContent, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getNodeNumber, getNodeValue, getReadOnly, getUserData, getUserData, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setUserData, setUserData, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.smil20.SMILElement
getAlt, getClassName, getId, getLongdesc, getTitle, init, setAlt, setClassName, setId, setLongdesc, setTitle
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNodeNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface fi.hut.tml.xsmiles.dom.VisualElement
getStyle
 
Methods inherited from interface fi.hut.tml.xsmiles.dom.PseudoClassController
getPseudoClass, setPseudoClass
 

Field Detail

SHOWBACKGROUND_ALWAYS

public static final short SHOWBACKGROUND_ALWAYS
See Also:
Constant Field Values

SHOWBACKGROUND_WHENACTIVE

public static final short SHOWBACKGROUND_WHENACTIVE
See Also:
Constant Field Values
Constructor Detail

SMILRegionElementImpl

public SMILRegionElementImpl(org.apache.xerces.dom.DocumentImpl owner,
                             SMILDocumentImpl smil,
                             java.lang.String ns)
Constructor with owner doc

Method Detail

setAnimAttribute

public void setAnimAttribute(java.lang.String attr,
                             java.lang.String value)
The attribute value set with this method should take precedence over the DOM attribute value.

Specified by:
setAnimAttribute in interface AnimationService
Parameters:
attr - Attribute to be animated
value - Animation value to be set

getAnimAttribute

public java.lang.String getAnimAttribute(java.lang.String attr)
This method returns the animation value of the attribute, and if not available, returns the DOM value.

Specified by:
getAnimAttribute in interface AnimationService

removeAnimAttribute

public void removeAnimAttribute(java.lang.String attr)
The anim attribute value removed with this method allows the DOM attribute value be visible.

Specified by:
removeAnimAttribute in interface AnimationService
Parameters:
attr - Attribute to be animated (animation removed)

refreshAnimation

public void refreshAnimation()
Refresh element with all the animation values. This is called after several calls to setAnimAttribute() and removeAttribute().

Specified by:
refreshAnimation in interface AnimationService

convertStringToUnitless

public float convertStringToUnitless(java.lang.String attr,
                                     java.lang.String value)
Description copied from interface: AnimationService
Convert String attribute to an float value

Specified by:
convertStringToUnitless in interface AnimationService

convertUnitlessToString

public java.lang.String convertUnitlessToString(java.lang.String attr,
                                                float value)
Specified by:
convertUnitlessToString in interface AnimationService

initHead

public void initHead()
Initializes this region and its associated DrawingArea. This is only called for regions under a valid layout element.


initHeadAndAddTo

public void initHeadAndAddTo(SMILRegionElementImpl parentReg,
                             DrawingArea parentDrawingArea,
                             boolean block,
                             org.w3c.dom.Element origElem)
CSS: Initializes this region and its associated DrawingArea. This is only called for regions created for CSS layout. This is the same as initHead(), but instead of adding the region to the rootlayout, this will add it to param parent.

Parameters:
parentReg - Parent Region (or null for root-layout)
block - Init the container to be block (=true) or inline (=false) container

destroy

public void destroy()
Release resources.

Specified by:
destroy in interface SMILElement
Overrides:
destroy in class XSmilesElementImpl

getDrawingArea

public DrawingArea getDrawingArea()
Return drawing area.

Specified by:
getDrawingArea in interface LayoutCalc

addRegion

public void addRegion(SMILRegionElementImpl region)
Add region to this region. This will cause the drawingarea to become visible.

Specified by:
addRegion in interface LayoutCalc

removeRegion

public void removeRegion(SMILRegionElementImpl region)
Remove region from this region. This may cause the drawingarea to become invisible, if this was the last region, and no medias either in the region.

Specified by:
removeRegion in interface LayoutCalc

addMedia

public void addMedia(MediaHandler media)
Add media to this region.


addLink

public void addLink(LinkHandler link)
Add media to this region.


removeMedia

public void removeMedia(MediaHandler media)
Remove media or link from this region.


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Specified by:
setAttribute in interface org.w3c.dom.Element
Overrides:
setAttribute in class VisualElementImpl

setAttributeNS

public void setAttributeNS(java.lang.String ns,
                           java.lang.String name,
                           java.lang.String value)
Specified by:
setAttributeNS in interface org.w3c.dom.Element

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
                                  throws org.w3c.dom.DOMException
Specified by:
setAttributeNode in interface org.w3c.dom.Element
Throws:
org.w3c.dom.DOMException

calcLeft

public int calcLeft()
Calculate the left border, relative to the given root-layout/region (in case of %).

Specified by:
calcLeft in interface LayoutCalc
Returns:
The coordinate for the left border

calcRight

public int calcRight()
Calculate the right border, relative to the given root-layout/region (in case of %).

Specified by:
calcRight in interface LayoutCalc
Returns:
The coordinate for the right border

calcTop

public int calcTop()
Calculate the top border, relative to the given root-layout/region (in case of %).

Specified by:
calcTop in interface LayoutCalc
Returns:
The coordinate for the top border

calcBottom

public int calcBottom()
Calculate the bottom border, relative to the given root-layout/region (in case of %).

Specified by:
calcBottom in interface LayoutCalc
Returns:
The coordinate for the bottom border

getFit

public java.lang.String getFit()
Specified by:
getFit in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setFit

public void setFit(java.lang.String fit)
            throws org.w3c.dom.DOMException
Specified by:
setFit in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getTop

public java.lang.String getTop()
top

Specified by:
getTop in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setTop

public void setTop(java.lang.String top)
            throws org.w3c.dom.DOMException
Specified by:
setTop in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getBottom

public java.lang.String getBottom()
bottom

Specified by:
getBottom in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setBottom

public void setBottom(java.lang.String bottom)
               throws org.w3c.dom.DOMException
Specified by:
setBottom in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getLeft

public java.lang.String getLeft()
left

Specified by:
getLeft in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setLeft

public void setLeft(java.lang.String left)
             throws org.w3c.dom.DOMException
Specified by:
setLeft in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getRight

public java.lang.String getRight()
right

Specified by:
getRight in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setRight

public void setRight(java.lang.String right)
              throws org.w3c.dom.DOMException
Specified by:
setRight in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getZIndex

public int getZIndex()
Specified by:
getZIndex in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setZIndex

public void setZIndex(int zIndex)
               throws org.w3c.dom.DOMException
Specified by:
setZIndex in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getShowBackground

public short getShowBackground()
showBackground

Specified by:
getShowBackground in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setShowBackground

public void setShowBackground(short showBackground)
                       throws org.w3c.dom.DOMException
Specified by:
setShowBackground in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getSoundLevel

public java.lang.String getSoundLevel()
soundLevel

Specified by:
getSoundLevel in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setSoundLevel

public void setSoundLevel(java.lang.String soundLevel)
                   throws org.w3c.dom.DOMException
Specified by:
setSoundLevel in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getRegionName

public java.lang.String getRegionName()
regionName

Specified by:
getRegionName in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setRegionName

public void setRegionName(java.lang.String regionName)
                   throws org.w3c.dom.DOMException
Specified by:
setRegionName in interface SMILRegionElement
Throws:
org.w3c.dom.DOMException

getBackgroundColor

public java.lang.String getBackgroundColor()
Specified by:
getBackgroundColor in interface ElementLayout

setBackgroundColor

public void setBackgroundColor(java.lang.String backgroundColor)
                        throws org.w3c.dom.DOMException
Specified by:
setBackgroundColor in interface ElementLayout
Throws:
org.w3c.dom.DOMException

getHeight

public java.lang.String getHeight()
Specified by:
getHeight in interface ElementLayout
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setHeight

public void setHeight(int height)
               throws org.w3c.dom.DOMException
Specified by:
setHeight in interface ElementLayout
Throws:
org.w3c.dom.DOMException

setHeight

public void setHeight(java.lang.String h)
               throws org.w3c.dom.DOMException
Prosentual height

Throws:
org.w3c.dom.DOMException

setWidth

public void setWidth(java.lang.String w)
              throws org.w3c.dom.DOMException
Prosentual width

Throws:
org.w3c.dom.DOMException

getWidth

public java.lang.String getWidth()
Specified by:
getWidth in interface ElementLayout
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.

setWidth

public void setWidth(int width)
              throws org.w3c.dom.DOMException
Specified by:
setWidth in interface ElementLayout
Throws:
org.w3c.dom.DOMException


X-Smiles 1.2