com.vaadin.ui.
Class AbstractMedia
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractMedia
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, Serializable, EventListener
- extends AbstractComponent
public class AbstractMedia
Abstract base class for the HTML5 media components.
Author:
Vaadin Ltd
See Also:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Field Summary |
---|
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
AbstractMedia()
|
Method Summary | |
---|---|
void |
addSource(Resource source)
Adds an alternative media file to the sources list. |
String |
getAltText()
|
List<Resource> |
getSources()
|
boolean |
isAutoplay()
|
boolean |
isHtmlContentAllowed()
|
boolean |
isMuted()
|
boolean |
isShowControls()
|
void |
paintContent(PaintTarget target)
Paints any needed component-specific things to the given UIDL stream. |
void |
pause()
Pauses the media. |
void |
play()
Starts playback of the media. |
void |
setAltText(String text)
Sets the alternative text to be displayed if the browser does not support HTML5. |
void |
setAutoplay(boolean autoplay)
Sets whether the media is to automatically start playback when enough data has been loaded. |
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Set whether the alternative text ( setAltText(String) ) is
rendered as HTML or not. |
void |
setMuted(boolean muted)
Set whether to mute the audio or not. |
void |
setShowControls(boolean showControls)
Sets whether or not the browser should show native media controls. |
void |
setSource(Resource source)
Sets a single media file as the source of the media component. |
void |
setSources(Resource... sources)
Set multiple sources at once. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
AbstractMedia
public AbstractMedia()
Method Detail |
---|
setSource
public void setSource(Resource source)
- Parameters:
source
-
Sets a single media file as the source of the media component.
addSource
public void addSource(Resource source)
- Parameters:
source
-
Adds an alternative media file to the sources list. Which of the sources is used is selected by the browser depending on which file formats it supports. See wikipedia for a table of formats supported by different browsers.
setSources
public void setSources(Resource... sources)
- Parameters:
sources
-
Set multiple sources at once. Which of the sources is used is selected by the browser depending on which file formats it supports. See wikipedia for a table of formats supported by different browsers.
getSources
public List<Resource> getSources()
- Returns:
- The sources pointed to in this media.
setShowControls
public void setShowControls(boolean showControls)
- Parameters:
showControls
-
Sets whether or not the browser should show native media controls.
isShowControls
public boolean isShowControls()
- Returns:
- true if the browser is to show native media controls.
setAltText
public void setAltText(String text)
- Parameters:
text
-
Sets the alternative text to be displayed if the browser does not support
HTML5. This text is rendered as HTML if
setHtmlContentAllowed(boolean)
is set to true. With HTML
rendering, this method can also be used to implement fallback to a
flash-based player, see the Mozilla Developer Network for details.
getAltText
public String getAltText()
- Returns:
- The text/html that is displayed when a browser doesn't support HTML5.
setHtmlContentAllowed
public void setHtmlContentAllowed(boolean htmlContentAllowed)
- Parameters:
htmlContentAllowed
-
Set whether the alternative text (setAltText(String)
) is
rendered as HTML or not.
isHtmlContentAllowed
public boolean isHtmlContentAllowed()
- Returns:
- true if the alternative text (
setAltText(String)
) is to be rendered as HTML.
setAutoplay
public void setAutoplay(boolean autoplay)
- Parameters:
autoplay
-
Sets whether the media is to automatically start playback when enough data has been loaded.
isAutoplay
public boolean isAutoplay()
- Returns:
- true if the media is set to automatically start playback.
setMuted
public void setMuted(boolean muted)
- Parameters:
muted
-
Set whether to mute the audio or not.
isMuted
public boolean isMuted()
- Returns:
- true if the audio is muted.
pause
public void pause()
Pauses the media.
play
public void play()
Starts playback of the media.
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Overrides:
paintContent
in classAbstractComponent
- Parameters:
target
- the target UIDL stream where the component should paint itself to- Throws:
PaintException
- if the paint operation failed.
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The
more general AbstractComponent.paint(PaintTarget)
method handles all general
attributes common to all components, and it calls this method to paint
any component-specific attributes to the UIDL stream.