public abstract class AbstractMedia extends AbstractComponent
Component.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
AbstractMedia() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSource(Resource source)
Adds an alternative media file to the sources list.
|
String |
getAltText() |
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
readDesign and writeDesign
methods. |
List<Resource> |
getSources() |
protected AbstractMediaState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected AbstractMediaState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
handleConnectorRequest(VaadinRequest request,
VaadinResponse response,
String path)
Handle a request directed to this connector.
|
boolean |
isAutoplay() |
boolean |
isHtmlContentAllowed() |
boolean |
isMuted() |
boolean |
isShowControls() |
void |
pause()
Pauses the media.
|
void |
play()
Starts playback of the media.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
setAltText(String altText)
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.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResourceclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdprotected AbstractMediaState getState()
AbstractComponentgetState in class AbstractComponentprotected AbstractMediaState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractComponentmarkAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public void setSource(Resource source)
source - public void addSource(Resource source)
source - public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) throws IOException
ClientConnectorConnectorResources.
Requests to /APP/connector/[ui id]/[connector id]/ are
routed to this method with the remaining part of the requested path
available in the path parameter.
NOTE that the session is not locked when this method is called. It is the responsibility of the connector to ensure that the session is locked while handling state or other session related data. For best performance the session should be unlocked before writing a large response to the client.
handleConnectorRequest in interface ClientConnectorhandleConnectorRequest in class AbstractClientConnectorrequest - the request that should be handledresponse - the response object to which the response should be writtenpath - the requested relative pathtrue if the request has been handled,
false if no response has been written.IOException - if there is a problem generating a response.public void setSources(Resource... sources)
sources - public void setShowControls(boolean showControls)
showControls - public boolean isShowControls()
public void setAltText(String altText)
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.altText - public String getAltText()
public void setHtmlContentAllowed(boolean htmlContentAllowed)
setAltText(String)) is
rendered as HTML or not.htmlContentAllowed - public boolean isHtmlContentAllowed()
setAltText(String)) is to
be rendered as HTML.public void setAutoplay(boolean autoplay)
autoplay - public boolean isAutoplay()
public void setMuted(boolean muted)
muted - public boolean isMuted()
public void pause()
public void play()
public void writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractComponentdesign - The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext - The DesignContext instance used for writing the designpublic void readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractComponentdesign - The element to obtain the state fromdesignContext - The DesignContext instance used for parsing the designprotected Collection<String> getCustomAttributes()
AbstractComponentreadDesign and writeDesign
methods. Typically these are handled in a custom way in the overridden
versions of the above methodsgetCustomAttributes in class AbstractComponentCopyright © 2016 Vaadin Ltd. All rights reserved.