Module io.github.mmm.ui.fx.media
Package io.github.mmm.ui.fx.widget.media
Class FxMediaWidget<W extends javafx.scene.Node>
- java.lang.Object
-
- io.github.mmm.ui.api.widget.AbstractUiWidget
-
- io.github.mmm.ui.spi.widget.AbstractUiNativeWidget
-
- io.github.mmm.ui.spi.widget.AbstractUiNativeWidgetWrapper<W>
-
- io.github.mmm.ui.fx.widget.FxWidget<W>
-
- io.github.mmm.ui.fx.widget.FxWidgetStyleable<W>
-
- io.github.mmm.ui.fx.widget.FxWidgetNode<W>
-
- io.github.mmm.ui.fx.widget.media.FxMediaWidget<W>
-
- Type Parameters:
W
- type ofJavaFx widget
.
- All Implemented Interfaces:
EventSource<UiEvent,UiEventListener>
,AttributeFeatureMedia
,AttributeFeaturePlayback
,AttributeFeatureVolume
,AttributeReadEnabled
,AttributeReadId
,AttributeReadValid
,AttributeReadVisible
,AttributeWriteEnabled
,AttributeWriteId
,AttributeWriteReadOnly
,AttributeWriteTooltip
,AttributeWriteValidationFailure
,AttributeWriteVisible
,UiMediaWidget
,UiNativeWidget
,UiRegularWidget
,UiWidget
,UiNativeWidgetWrapper<W>
- Direct Known Subclasses:
FxMediaPlayer
public abstract class FxMediaWidget<W extends javafx.scene.Node> extends FxWidgetNode<W> implements UiMediaWidget
Implementation ofUiMediaWidget
for JavaFx.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected io.github.mmm.ui.fx.widget.media.fx.MediaPlayerAdapter
mediaPlayerAdapter
TheMediaPlayerAdapter
.-
Fields inherited from class io.github.mmm.ui.fx.widget.FxWidget
CLASS_INVALID, CLASS_READ_ONLY, widget
-
Fields inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteValidationFailure
STYLE_INVALID
-
-
Constructor Summary
Constructors Constructor Description FxMediaWidget(W widget)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkMediaType(UiMediaType type)
protected io.github.mmm.ui.fx.widget.media.fx.MediaPlayerAdapter
createMediaPlayerAdapter()
double
getDuration()
UiMedia
getMedia()
double
getPosition()
double
getVolume()
This method gets the volume of this object.boolean
isMuted()
boolean
isPlaying()
void
setMedia(UiMedia media)
void
setMuted(boolean muted)
void
setPlaying(boolean playing)
void
setPosition(double position)
void
setVolume(double volume)
-
Methods inherited from class io.github.mmm.ui.fx.widget.FxWidgetNode
getTopWidget, setEnabledNative, setIdNative, setReadOnlyNative, setTooltipNative, setVisibleNative
-
Methods inherited from class io.github.mmm.ui.fx.widget.FxWidgetStyleable
createStyles
-
Methods inherited from class io.github.mmm.ui.fx.widget.FxWidget
getTopNode, getWidget, onAction, onClose, onFocusChange, onFocusChanged, onValueChange, onValueChanged, setTooltip, setWidget
-
Methods inherited from class io.github.mmm.ui.spi.widget.AbstractUiNativeWidgetWrapper
createDefaultStyles, getId, getStyles, getTooltip, onStylesChanged, setId, setTooltip
-
Methods inherited from class io.github.mmm.ui.spi.widget.AbstractUiNativeWidget
addListener, dispose, doDispose, doGetEnabledState, doGetVisibleState, doSetEnabledState, doSetEnabledState, doSetValidationFailure, doSetVisibleState, doSetVisibleState, ensureHandlers, fireEvent, getEventAdapter, getParent, getProgrammaticEventType, getReadOnlyFixed, getValidationFailure, hasListeners, isDisposed, isEnabled, isInitiallyVisible, isReadOnly, isValid, isVisible, isVisibleWithoutRoot, registerHandlers, removeListener, requireNotDisposed, setEnabled, setParent, setProgrammaticEventType, setReadOnly, setReadOnlyFixed, setValidationFailure, setVisible, unwrap, validateDown
-
Methods inherited from class io.github.mmm.ui.api.widget.AbstractUiWidget
isEmpty, setParent, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeFeaturePlayback
pause, play
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeFeatureVolume
mute, unmute
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeReadId
getId
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteId
setId
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteTooltip
getTooltip, setTooltip
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteValidationFailure
setValidationFailure
-
Methods inherited from interface io.github.mmm.event.EventSource
addListener, addListener, addWeakListener, removeListener
-
Methods inherited from interface io.github.mmm.ui.api.widget.UiWidget
cast, dispose, getModificationTimestamp, getParent, getReadOnlyFixed, getStyles, isDisposed, isEnabled, isEnabled, isFocused, isModified, isReadOnly, isValid, isVisible, isVisible, reset, setEnabled, setEnabled, setFocused, setReadOnly, setReadOnlyFixed, setVisible, setVisible, validate, validate, validate, validateDown, validateUp
-
-
-
-
Constructor Detail
-
FxMediaWidget
public FxMediaWidget(W widget)
The constructor.- Parameters:
widget
- theJavaFx widget
.
-
-
Method Detail
-
createMediaPlayerAdapter
protected io.github.mmm.ui.fx.widget.media.fx.MediaPlayerAdapter createMediaPlayerAdapter()
- Returns:
- the
MediaPlayerAdapter
.
-
getMedia
public UiMedia getMedia()
- Specified by:
getMedia
in interfaceUiMediaWidget
- Returns:
- the
UiMedia
ornull
in notset
.
-
setMedia
public void setMedia(UiMedia media)
- Specified by:
setMedia
in interfaceUiMediaWidget
- Parameters:
media
- theUiMedia
to set and load.
-
checkMediaType
protected void checkMediaType(UiMediaType type)
- Parameters:
type
- theUiMediaType
to verify.
-
isPlaying
public boolean isPlaying()
- Specified by:
isPlaying
in interfaceAttributeFeaturePlayback
- Returns:
true
if the media is currently playing,false
otherwise (if paused or nothing to play).
-
setPlaying
public void setPlaying(boolean playing)
- Specified by:
setPlaying
in interfaceAttributeFeaturePlayback
- Parameters:
playing
- is the new value ofAttributeFeaturePlayback.isPlaying()
. Usetrue
to play or resume andfalse
to pause. Please note that if no media is present or it is invalid, it will not get intoplaying
state even after providingtrue
-
getVolume
public double getVolume()
Description copied from interface:AttributeFeatureVolume
This method gets the volume of this object. Please note that the actual volume might be influenced by the mixer of the operating system. This is just a relative scale to the system volume.- Specified by:
getVolume
in interfaceAttributeFeatureVolume
- Returns:
- the volume in the range from
0.0
(mute) to1.0
(maximum). - See Also:
AttributeFeatureVolume.isMuted()
-
setVolume
public void setVolume(double volume)
- Specified by:
setVolume
in interfaceAttributeFeatureVolume
- Parameters:
volume
- is the new value ofAttributeFeatureVolume.getVolume()
. If negative, set to0
and if greater than1
set to1
.
-
isMuted
public boolean isMuted()
- Specified by:
isMuted
in interfaceAttributeFeatureVolume
- Returns:
true
if muted (audio is suppressed withoutsetting volume
to0
so thevolume
is not lost),false
otherwise.
-
setMuted
public void setMuted(boolean muted)
- Specified by:
setMuted
in interfaceAttributeFeatureVolume
- Parameters:
muted
- the new value ofAttributeFeatureVolume.isMuted()
.
-
getPosition
public double getPosition()
- Specified by:
getPosition
in interfaceAttributeFeatureMedia
- Returns:
- the current position of the playback as factor in the range from
0
(0%, start) to1
(100%, end).
-
setPosition
public void setPosition(double position)
- Specified by:
setPosition
in interfaceAttributeFeatureMedia
- Parameters:
position
- is the new value ofAttributeFeatureMedia.getPosition()
. If negative, set to0
and if greater than1
set to1
.
-
getDuration
public double getDuration()
- Specified by:
getDuration
in interfaceAttributeFeatureMedia
- Returns:
- the duration of the current media in seconds. Will be
0
if no media is present, media is invalid or empty.
-
-