com.bramosystems.oss.player.core.client.skin
Class VolumeControl

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.bramosystems.oss.player.core.client.skin.VolumeControl
All Implemented Interfaces:
HasVolumeChangeHandlers, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class VolumeControl
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.event.dom.client.MouseUpHandler, HasVolumeChangeHandlers

Widget to control the volume of a player. The control is placed on a player as an icon which when clicked upon, opens a popup panel containing the slider widget for the volume.

VolumeChangeHandlers are notified whenever the slider is adjusted.

CSS Styles

 .player-VolumeControl { the slider widget }
 .player-VolumeControl .volume { the volume level indicator }
 .player-VolumeControl .track  { the sliders' track indicator }
 

Author:
Sikirulai Braheem
See Also:
VolumeChangeHandler

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
VolumeControl(com.google.gwt.user.client.ui.Image icon, int sliderHeight)
          Constructs VolumeControl.
VolumeControl(int sliderHeight)
          Constructs VolumeControl.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addVolumeChangeHandler(VolumeChangeHandler handler)
          Adds the specified handler to the player.
protected  void initWidget(com.google.gwt.user.client.ui.Widget widget)
          Overridden to prevent subclasses from changing the wrapped widget.
 void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
           
 void setPopupStyleName(String styleName)
          Assigns a CSS style class name to the volume slider popup panel.
 void setVolume(double volume)
          Sets the level of the volume slider control.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

VolumeControl

public VolumeControl(com.google.gwt.user.client.ui.Image icon,
                     int sliderHeight)
Constructs VolumeControl. The control is displayed as the specified icon. An horizontal slider of height sliderHeight is displayed when the icon is clicked on.

The slider popup panel has a fixed width of 50px.

Parameters:
icon - represents the volume control object.
sliderHeight - the height of the volume slider control.

VolumeControl

public VolumeControl(int sliderHeight)
Constructs VolumeControl. This constructor is provided for complete CSS styling support. An horizontal slider of height sliderHeight is displayed when this control is clicked on.

The slider popup panel has a fixed width of 50px.

Parameters:
sliderHeight - the height of the volume slider control.
Since:
1.2
Method Detail

setVolume

public final void setVolume(double volume)
Sets the level of the volume slider control.

Note: VolumeChangeListeners are not notified by this method.

Parameters:
volume - value between 0 (silent) and 1 (the maximum). Any value outside the range will be ignored.

onMouseUp

public void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
Specified by:
onMouseUp in interface com.google.gwt.event.dom.client.MouseUpHandler

initWidget

protected void initWidget(com.google.gwt.user.client.ui.Widget widget)
Overridden to prevent subclasses from changing the wrapped widget.

Overrides:
initWidget in class com.google.gwt.user.client.ui.Composite

addVolumeChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addVolumeChangeHandler(VolumeChangeHandler handler)
Adds the specified handler to the player. The handler is called whenever the state of the volume slider changes.

Specified by:
addVolumeChangeHandler in interface HasVolumeChangeHandlers
Parameters:
handler - the handler
Returns:
the HandlerRegistration used to remove the handler
See Also:
VolumeChangeHandler

setPopupStyleName

public void setPopupStyleName(String styleName)
Assigns a CSS style class name to the volume slider popup panel.

Parameters:
styleName - CSS style class name


Copyright © 2009-2011. All Rights Reserved.