org.zkoss.zul
Class Audio

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Audio
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HtmlBasedComponent, Component, Scope, ComponentCtrl, Audio, XulElement

public class Audio
extends XulElement
implements Audio

An audio clip.

An extension to XUL.

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
protected  class Audio.ExtraCtrl
          A utility class to implement AbstractComponent.getExtraCtrl().
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children
 
Field Summary
protected  java.lang.String _src
           
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
Fields inherited from class org.zkoss.zk.ui.AbstractComponent
_visible
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
Audio()
           
Audio(java.lang.String src)
           
 
Method Summary
 java.lang.String getAlign()
          Returns the alignment.
 java.lang.String getBorder()
          Returns the width of the border.
 Audio getContent()
          Returns the content set by setContent(org.zkoss.sound.Audio).
 java.lang.String getOuterAttrs()
          Returns the exterior attributes for generating the enclosing HTML tag; never return null.
 java.lang.String getSrc()
          Returns the src.
 boolean isAutostart()
          Returns whether to auto start playing the audio.
 boolean isChildable()
          Default: not childable.
 boolean isLoop()
          Returns whether to play the audio repeatedly.
protected  java.lang.Object newExtraCtrl()
          Used by AbstractComponent.getExtraCtrl() to create a client control.
 void pause()
          Pauses the audio at the cient.
 void play()
          Plays the audio at the client.
 void setAlign(java.lang.String align)
          Sets the alignment: one of top, texttop, middle, absmiddle, bottom, absbottom, baseline, left, right and center.
 void setAutostart(boolean autostart)
          Sets whether to auto start playing the audio.
 void setBorder(java.lang.String border)
          Sets the width of the border.
 void setContent(Audio audio)
          Sets the content directly.
 void setLoop(boolean loop)
          Sets whether to play the audio repeatedly.
 void setSrc(java.lang.String src)
          Sets the src.
 void stop()
          Stops the audio at the cient.
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addSharedAnnotationMap, addSharedEventHandlerMap, appendAsapAttr, appendAsapAttr, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, containsVariable, detach, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getCommand, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getMoldURI, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, insertBefore, invalidate, isAsapRequired, isInvalidated, isListenerAvailable, isVisible, newChildren, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zul.impl.api.XulElement
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, unsetVariable
 

Field Detail

_src

protected java.lang.String _src
Constructor Detail

Audio

public Audio()

Audio

public Audio(java.lang.String src)
Method Detail

play

public void play()
Plays the audio at the client.

Specified by:
play in interface Audio

stop

public void stop()
Stops the audio at the cient.

Specified by:
stop in interface Audio

pause

public void pause()
Pauses the audio at the cient.

Specified by:
pause in interface Audio

getAlign

public java.lang.String getAlign()
Returns the alignment.

Default: null (use browser default).

Specified by:
getAlign in interface Audio

setAlign

public void setAlign(java.lang.String align)
              throws WrongValueException
Sets the alignment: one of top, texttop, middle, absmiddle, bottom, absbottom, baseline, left, right and center.

Specified by:
setAlign in interface Audio
Throws:
WrongValueException

getBorder

public java.lang.String getBorder()
Returns the width of the border.

Default: null (use browser default).

Specified by:
getBorder in interface Audio

setBorder

public void setBorder(java.lang.String border)
               throws WrongValueException
Sets the width of the border.

Specified by:
setBorder in interface Audio
Throws:
WrongValueException

getSrc

public java.lang.String getSrc()
Returns the src.

Default: null.

Specified by:
getSrc in interface Audio

setSrc

public void setSrc(java.lang.String src)
Sets the src.

Calling this method implies setContent(null). In other words, the last invocation of setSrc(java.lang.String) overrides the previous setContent(org.zkoss.sound.Audio), if any.

Specified by:
setSrc in interface Audio
See Also:
setContent(org.zkoss.sound.Audio)

isAutostart

public final boolean isAutostart()
Returns whether to auto start playing the audio.

Default: false;


setAutostart

public final void setAutostart(boolean autostart)
Sets whether to auto start playing the audio.


isLoop

public final boolean isLoop()
Returns whether to play the audio repeatedly.

Default: false;

Since:
3.6.1

setLoop

public final void setLoop(boolean loop)
Sets whether to play the audio repeatedly.

Since:
3.6.1

setContent

public void setContent(Audio audio)
Sets the content directly.

Default: null.

Calling this method implies setSrc(null). In other words, the last invocation of setContent(org.zkoss.sound.Audio) overrides the previous setSrc(java.lang.String), if any.

Specified by:
setContent in interface Audio
Parameters:
audio - the audio to display.
See Also:
setSrc(java.lang.String)

getContent

public Audio getContent()
Returns the content set by setContent(org.zkoss.sound.Audio).

Note: it won't fetch what is set thru by setSrc(java.lang.String). It simply returns what is passed to setContent(org.zkoss.sound.Audio).

Specified by:
getContent in interface Audio

getOuterAttrs

public java.lang.String getOuterAttrs()
Description copied from class: HtmlBasedComponent
Returns the exterior attributes for generating the enclosing HTML tag; never return null.

Used only by component developers.

Default: Generates the tooltip text, style, sclass, draggable and droppable attribute if necessary. In other words, the corresponding attribute is generated if HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(), HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable() are defined.

You have to call both HtmlBasedComponent.getOuterAttrs() and HtmlBasedComponent.getInnerAttrs() to generate complete attributes.

For simple components that all attributes are put on the outest HTML element, all you need is as follows.

<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>

If you want to put attributes in a nested HTML element, you shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs() in a different tag, the tag must be named with "${self.uuid}!real".

<xx id="${self.uuid}"${self.outerAttrs}>
 <yy id="${self.uuid}!real"${self.innerAttrs}>...

Note: This class handles non-deferrable event listeners automatically. However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event the component handles in HtmlBasedComponent.getOuterAttrs() as follows.


        appendAsapAttr(sb, Events.ON_OPEN);
  appendAsapAttr(sb, Events.ON_CHANGE);

Theorectically, you could put any attributes in either HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs(). However, zkau.js assumes all attributes are put at the outer one. If you want something different, you have to provide your own setAttr (refer to how checkbox is implemented).

Overrides:
getOuterAttrs in class XulElement

isChildable

public boolean isChildable()
Default: not childable.

Specified by:
isChildable in interface Component
Overrides:
isChildable in class AbstractComponent

newExtraCtrl

protected java.lang.Object newExtraCtrl()
Description copied from class: HtmlBasedComponent
Used by AbstractComponent.getExtraCtrl() to create a client control. It is used only by component developers.

Defaut: creates an instance of HtmlBasedComponent.ExtraCtrl.

Overrides:
newExtraCtrl in class HtmlBasedComponent


Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo