fi.hut.tml.xsmiles.mlfc.smil.viewer.havi
Class HaviMediaHandler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.smil.viewer.havi.HaviMediaHandler
All Implemented Interfaces:
java.awt.event.ActionListener, CSSStylableMedia, java.util.EventListener, MediaHandler
Direct Known Subclasses:
HaviLinkHandler

public class HaviMediaHandler
extends java.lang.Object
implements MediaHandler, java.awt.event.ActionListener, CSSStylableMedia

Interface to media.


Field Summary
protected  java.lang.String alt
           
protected  java.awt.Container container
           
protected  org.w3c.dom.css.CSSStyleDeclaration CSSStyle
           
protected  java.lang.String documentURL
           
protected  HaviDrawingArea drawingArea
           
protected  Media media
           
protected  MediaListener mediaListener
           
protected  java.lang.String mimeType
           
protected  boolean playing
           
protected  boolean prefetched
           
 SMILDocumentImpl smilDoc
           
protected  java.lang.String url
           
 Viewer viewer
           
 
Constructor Summary
HaviMediaHandler()
          Create a new MediaHandler for MLFC.
HaviMediaHandler(java.lang.String documentURL)
          Create a new MediaHandler for Swing.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addListener(MediaListener mediaListener)
          Add a media listener (currently supports only one listener)
 void close()
           
 void freeze()
           
 java.lang.Object getComponent()
          get the possible component (only used when run in x-smiles
 int getHeight()
           
 int getLeft()
           
 int getOriginalHeight()
          Get the real height of the media.
 int getOriginalWidth()
          Get the real width of the media.
 int getTop()
           
 int getWidth()
           
 boolean isStatic()
          Checks if this media is static or continuous.
 void pause()
           
 void play()
           
 void prefetch()
           
 void setAlt(java.lang.String alt)
          Sets the alt text for the media.
 void setAudioVolume(int percentage)
          Set the volume of audio (if available).
 void setBounds(int x, int y, int w, int h)
           
 void setDrawingArea(DrawingArea d)
          Set the drawing area.
 void setMediaTime(int millisecs)
          Set the media time position.
 void setMIMEType(java.lang.String type)
          Force this media to use this media type
 void setRootLayoutSize(int width, int height)
          This media handler will know the rootlayout size after this is called.
 void setStyle(org.w3c.dom.css.CSSStyleDeclaration style)
          (CSSStylableMedia interface) set the resolved CSS style for this element
 void setURL(java.lang.String url)
          Sets the URL of the media.
 void setViewer(Viewer v)
          Set the viewer - required for prefetch, URL creation etc.
 boolean shouldBeHandledByXSmiles(java.lang.String url, java.lang.String mime)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alt

protected java.lang.String alt

url

protected java.lang.String url

mediaListener

protected MediaListener mediaListener

drawingArea

protected HaviDrawingArea drawingArea

container

protected java.awt.Container container

documentURL

protected java.lang.String documentURL

prefetched

protected boolean prefetched

playing

protected boolean playing

media

protected Media media

mimeType

protected java.lang.String mimeType

CSSStyle

protected org.w3c.dom.css.CSSStyleDeclaration CSSStyle

smilDoc

public SMILDocumentImpl smilDoc

viewer

public Viewer viewer
Constructor Detail

HaviMediaHandler

public HaviMediaHandler()
Create a new MediaHandler for MLFC.


HaviMediaHandler

public HaviMediaHandler(java.lang.String documentURL)
Create a new MediaHandler for Swing.

Parameters:
documentURL - The URL for smil document path.
Method Detail

setViewer

public void setViewer(Viewer v)
Description copied from interface: MediaHandler
Set the viewer - required for prefetch, URL creation etc.

Specified by:
setViewer in interface MediaHandler

setDrawingArea

public void setDrawingArea(DrawingArea d)
Set the drawing area. The given drawing area MUST be SwingDrawingArea.

Specified by:
setDrawingArea in interface MediaHandler

addListener

public void addListener(MediaListener mediaListener)
Add a media listener (currently supports only one listener)

Specified by:
addListener in interface MediaHandler

isStatic

public boolean isStatic()
Checks if this media is static or continuous.

Specified by:
isStatic in interface MediaHandler
Returns:
true if media is static.

setRootLayoutSize

public void setRootLayoutSize(int width,
                              int height)
This media handler will know the rootlayout size after this is called.

Specified by:
setRootLayoutSize in interface MediaHandler
Parameters:
width - RootLayout width
height - RootLayout height

setAlt

public void setAlt(java.lang.String alt)
Description copied from interface: MediaHandler
Sets the alt text for the media.

Specified by:
setAlt in interface MediaHandler

setStyle

public void setStyle(org.w3c.dom.css.CSSStyleDeclaration style)
(CSSStylableMedia interface) set the resolved CSS style for this element

Specified by:
setStyle in interface CSSStylableMedia

setURL

public void setURL(java.lang.String url)
Description copied from interface: MediaHandler
Sets the URL of the media.

Specified by:
setURL in interface MediaHandler

setMIMEType

public void setMIMEType(java.lang.String type)
Description copied from interface: MediaHandler
Force this media to use this media type

Specified by:
setMIMEType in interface MediaHandler

prefetch

public void prefetch()
Specified by:
prefetch in interface MediaHandler

shouldBeHandledByXSmiles

public boolean shouldBeHandledByXSmiles(java.lang.String url,
                                        java.lang.String mime)

play

public void play()
Specified by:
play in interface MediaHandler

pause

public void pause()
Specified by:
pause in interface MediaHandler

stop

public void stop()
Specified by:
stop in interface MediaHandler

freeze

public void freeze()
Specified by:
freeze in interface MediaHandler

close

public void close()
Specified by:
close in interface MediaHandler

setMediaTime

public void setMediaTime(int millisecs)
Set the media time position. Usually used to skip the beginning of media.

Specified by:
setMediaTime in interface MediaHandler
Parameters:
millisecs - Time in milliseconds

getTop

public int getTop()
Specified by:
getTop in interface MediaHandler

getLeft

public int getLeft()
Specified by:
getLeft in interface MediaHandler

getWidth

public int getWidth()
Specified by:
getWidth in interface MediaHandler

getHeight

public int getHeight()
Specified by:
getHeight in interface MediaHandler

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Specified by:
setBounds in interface MediaHandler

getOriginalWidth

public int getOriginalWidth()
Get the real width of the media.

Specified by:
getOriginalWidth in interface MediaHandler

getOriginalHeight

public int getOriginalHeight()
Get the real height of the media.

Specified by:
getOriginalHeight in interface MediaHandler

setAudioVolume

public void setAudioVolume(int percentage)
Set the volume of audio (if available).

Specified by:
setAudioVolume in interface MediaHandler
Parameters:
percentage - 0-100-oo , 100 giving normal sound level.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getComponent

public java.lang.Object getComponent()
Description copied from interface: MediaHandler
get the possible component (only used when run in x-smiles

Specified by:
getComponent in interface MediaHandler


X-Smiles 1.2