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

java.lang.Object
  extended byHScene
      extended byfi.hut.tml.xsmiles.mlfc.smil.viewer.havi.SMILViewer
All Implemented Interfaces:
java.util.EventListener, FocusableLinkHandler, Viewer, java.awt.event.WindowListener
Direct Known Subclasses:
BrowserViewer

public class SMILViewer
extends HScene
implements Viewer, FocusableLinkHandler, java.awt.event.WindowListener

This is a sample class that shows how to view a smil document and play it using HAVi.

NOTE: THIS VIEWER IS NOT COMPLETE AND WON'T WORK CORRECTLY.

See Also:
Serialized Form

Nested Class Summary
 class SMILViewer.AA
           
 class SMILViewer.BB
           
 
Field Summary
protected static java.lang.String docPath
           
static HaviFocusManager focusManager
           
protected  HGraphicButton guiback
           
protected  HGraphicButton guiexit
           
protected  HGraphicButton guistart
           
protected  HGraphicButton guistop
           
protected  HVisible guitest
           
protected  HSinglelineEntry guiurl
           
protected  java.util.Vector history
           
static int iconHeight
           
static long initMem
           
static long initTime
           
protected  boolean jmfAvailable
           
protected  java.awt.Container rootContainer
           
protected  java.awt.Container rootlayoutContainer
           
static int screenDepth
           
static int screenHeight
           
static int screenWidth
           
protected  SMILDocumentImpl smilDoc
           
protected  HStaticText statusText
           
 
Constructor Summary
SMILViewer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Playback buttons.
 void addFocusableLink(HNavigable link)
          Add a link component to a focus list.
 void addTimePoint(java.lang.String elementId)
           
 void caretMoved(HTextEvent e)
           
protected  void createGUI()
           
 void displayError(java.lang.String url, java.lang.String errMsg)
           
 void displayStatusText(java.lang.String url)
           
 java.net.URL getBaseURL()
          Return the base URL of the document.
 java.awt.Container getContentPane()
           
 Decorator getDecorator()
           
 BrushHandler getNewBrushHandler()
          Returns a new BrushHandler for SMIL core logic.
 DrawingArea getNewDrawingArea(int type, boolean block)
          Returns a container for SMIL region elements.
 MediaHandler getNewForeignHandler(org.w3c.dom.Element e)
          Returns a new ForeignHandler for SMIL core logic.
 LinkHandler getNewLinkHandler()
          Creates a new link handler.
 MediaHandler getNewMediaHandler()
           
 boolean getPlayAudio()
           
 boolean getPlayImage()
           
 boolean getPlayVideo()
           
 SMILDocument getSMILDoc()
           
 java.lang.String getSystemAudioDesc()
           
 java.lang.String getSystemBitrate()
           
 java.lang.String getSystemCaptions()
           
 boolean getSystemComponent(java.lang.String component)
          Returns the value of systemAttribute for the SMIL core logic.
 java.lang.String getSystemCPU()
           
 java.lang.String getSystemLanguage()
           
 java.lang.String getSystemOperatingSystem()
           
 java.lang.String getSystemOverdubOrCaption()
           
 java.lang.String getSystemOverdubOrSubtitle()
           
 boolean getSystemRequired(java.lang.String prefix)
          Returns the value of systemAttribute for the SMIL core logic.
 int getSystemScreenDepth()
          Returns screen depth for the SMILDocument.
 int getSystemScreenHeight()
          Returns screen height for the SMILDocument.
 int getSystemScreenWidth()
          Returns screen width for the SMILDocument.
 java.lang.String getTitle()
          Get the title of the presentation.
 int getWindowHeight()
          Returns window height for the SMILDocument.
 int getWindowWidth()
          Returns window width for the SMILDocument.
 void gotoExternalLink(java.lang.String url)
          Open external link replacing the existing presentation
 void gotoExternalLinkNewWindow(java.lang.String url)
          Open external link in a new window
 void gotoExternalLinkTarget(java.lang.String url, java.lang.String target)
          Open external link replacing/opening new target
 boolean init(SMILViewer viewer, java.io.Reader reader, java.lang.String path)
           
protected  void initViewer(SMILDocumentImpl s)
           
 boolean isHost()
          SMILDoc requires this from the SMILMLFC, which may return true or false.
protected  boolean isJMFAvailable()
          Check if JMF class is available.
 java.awt.Image loadImage(java.lang.String s)
           
static void main(java.lang.String[] args)
           
protected  void openURL(java.lang.String url)
          Open SMIL doc at url.
protected  void openURL(java.lang.String url, java.lang.String errormsg)
          Open ERROR doc at url, if errormsg != null.
 void Quit()
           
 void removeFocusableLink(HNavigable link)
          Remove a link component from a focus list.
 void setDocumentBaseURI(java.lang.String base)
           
 void setTitle(java.lang.String t)
          Set the title for the presentation.
 void start()
           
 void stop()
           
 void textChanged(HTextEvent e)
           
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docPath

protected static java.lang.String docPath

jmfAvailable

protected boolean jmfAvailable

statusText

protected HStaticText statusText

screenWidth

public static final int screenWidth
See Also:
Constant Field Values

screenHeight

public static final int screenHeight
See Also:
Constant Field Values

screenDepth

public static final int screenDepth
See Also:
Constant Field Values

iconHeight

public static final int iconHeight
See Also:
Constant Field Values

history

protected java.util.Vector history

focusManager

public static HaviFocusManager focusManager

initTime

public static long initTime

initMem

public static long initMem

rootContainer

protected java.awt.Container rootContainer

guiurl

protected HSinglelineEntry guiurl

rootlayoutContainer

protected java.awt.Container rootlayoutContainer

guistart

protected HGraphicButton guistart

guistop

protected HGraphicButton guistop

guiexit

protected HGraphicButton guiexit

guiback

protected HGraphicButton guiback

guitest

protected HVisible guitest

smilDoc

protected SMILDocumentImpl smilDoc
Constructor Detail

SMILViewer

public SMILViewer()
Method Detail

main

public static void main(java.lang.String[] args)

createGUI

protected void createGUI()

getContentPane

public java.awt.Container getContentPane()

Quit

public void Quit()

init

public boolean init(SMILViewer viewer,
                    java.io.Reader reader,
                    java.lang.String path)

start

public void start()

stop

public void stop()

initViewer

protected void initViewer(SMILDocumentImpl s)

getBaseURL

public java.net.URL getBaseURL()
Return the base URL of the document.

Specified by:
getBaseURL in interface Viewer

gotoExternalLink

public void gotoExternalLink(java.lang.String url)
Description copied from interface: Viewer
Open external link replacing the existing presentation

Specified by:
gotoExternalLink in interface Viewer
Parameters:
url - URL to open

gotoExternalLinkTarget

public void gotoExternalLinkTarget(java.lang.String url,
                                   java.lang.String target)
Open external link replacing/opening new target

Specified by:
gotoExternalLinkTarget in interface Viewer
Parameters:
url - URL to open
target - target frame/window

gotoExternalLinkNewWindow

public void gotoExternalLinkNewWindow(java.lang.String url)
Open external link in a new window

Specified by:
gotoExternalLinkNewWindow in interface Viewer
Parameters:
url - URL to open

displayStatusText

public void displayStatusText(java.lang.String url)
Specified by:
displayStatusText in interface Viewer

getNewMediaHandler

public MediaHandler getNewMediaHandler()
Specified by:
getNewMediaHandler in interface Viewer

getNewBrushHandler

public BrushHandler getNewBrushHandler()
Returns a new BrushHandler for SMIL core logic.

Specified by:
getNewBrushHandler in interface Viewer

getNewLinkHandler

public LinkHandler getNewLinkHandler()
Description copied from interface: Viewer
Creates a new link handler.

Specified by:
getNewLinkHandler in interface Viewer

setDocumentBaseURI

public void setDocumentBaseURI(java.lang.String base)
Specified by:
setDocumentBaseURI in interface Viewer

getSMILDoc

public SMILDocument getSMILDoc()
Specified by:
getSMILDoc in interface Viewer

getNewDrawingArea

public DrawingArea getNewDrawingArea(int type,
                                     boolean block)
Returns a container for SMIL region elements. For root-layout, this will also create the frame and all GUI components.

Specified by:
getNewDrawingArea in interface Viewer

addFocusableLink

public void addFocusableLink(HNavigable link)
Add a link component to a focus list.

Specified by:
addFocusableLink in interface FocusableLinkHandler
Parameters:
link - Link component, HNavigable

removeFocusableLink

public void removeFocusableLink(HNavigable link)
Remove a link component from a focus list. Causes the whole focus path to be recalculated.

Specified by:
removeFocusableLink in interface FocusableLinkHandler
Parameters:
link - Link component, HNavigable

getNewForeignHandler

public MediaHandler getNewForeignHandler(org.w3c.dom.Element e)
Returns a new ForeignHandler for SMIL core logic. NOT IMPLEMENTED IN STANDALONE PLAYER.

Specified by:
getNewForeignHandler in interface Viewer

loadImage

public java.awt.Image loadImage(java.lang.String s)

addTimePoint

public void addTimePoint(java.lang.String elementId)
Specified by:
addTimePoint in interface Viewer

getWindowWidth

public int getWindowWidth()
Returns window width for the SMILDocument. This is the playing are width, used to create a default maximum region size.

Specified by:
getWindowWidth in interface Viewer

getWindowHeight

public int getWindowHeight()
Returns window height for the SMILDocument. This is the playing are height, used to create a default maximum region size.

Specified by:
getWindowHeight in interface Viewer

getSystemBitrate

public java.lang.String getSystemBitrate()
Specified by:
getSystemBitrate in interface Viewer

getSystemCaptions

public java.lang.String getSystemCaptions()
Specified by:
getSystemCaptions in interface Viewer

getSystemLanguage

public java.lang.String getSystemLanguage()
Specified by:
getSystemLanguage in interface Viewer

getSystemOverdubOrCaption

public java.lang.String getSystemOverdubOrCaption()
Specified by:
getSystemOverdubOrCaption in interface Viewer

getSystemRequired

public boolean getSystemRequired(java.lang.String prefix)
Returns the value of systemAttribute for the SMIL core logic.

Specified by:
getSystemRequired in interface Viewer

getSystemScreenWidth

public int getSystemScreenWidth()
Returns screen width for the SMILDocument. This is the system screen width, used in SMIL switch systemScreenSize attribute

Specified by:
getSystemScreenWidth in interface Viewer

getSystemScreenHeight

public int getSystemScreenHeight()
Returns screen height for the SMILDocument. This is the system screen height, used in SMIL switch systemScreenSize attribute

Specified by:
getSystemScreenHeight in interface Viewer

getSystemScreenDepth

public int getSystemScreenDepth()
Returns screen depth for the SMILDocument. This is the system screen depth, used in SMIL switch systemScreenSize attribute

Specified by:
getSystemScreenDepth in interface Viewer

getSystemOverdubOrSubtitle

public java.lang.String getSystemOverdubOrSubtitle()
Specified by:
getSystemOverdubOrSubtitle in interface Viewer

getSystemAudioDesc

public java.lang.String getSystemAudioDesc()
Specified by:
getSystemAudioDesc in interface Viewer

getSystemOperatingSystem

public java.lang.String getSystemOperatingSystem()
Specified by:
getSystemOperatingSystem in interface Viewer

getSystemCPU

public java.lang.String getSystemCPU()
Specified by:
getSystemCPU in interface Viewer

getSystemComponent

public boolean getSystemComponent(java.lang.String component)
Returns the value of systemAttribute for the SMIL core logic.

Specified by:
getSystemComponent in interface Viewer

getPlayImage

public boolean getPlayImage()
Specified by:
getPlayImage in interface Viewer

getPlayAudio

public boolean getPlayAudio()
Specified by:
getPlayAudio in interface Viewer

getPlayVideo

public boolean getPlayVideo()
Specified by:
getPlayVideo in interface Viewer

getTitle

public java.lang.String getTitle()
Get the title of the presentation. null if no title present.

Specified by:
getTitle in interface Viewer

setTitle

public void setTitle(java.lang.String t)
Set the title for the presentation.

Specified by:
setTitle in interface Viewer
Parameters:
t - Title for the presentation

isHost

public boolean isHost()
Description copied from interface: Viewer
SMILDoc requires this from the SMILMLFC, which may return true or false. Other viewers always return true.

Specified by:
isHost in interface Viewer

isJMFAvailable

protected boolean isJMFAvailable()
Check if JMF class is available. At the same time, set the hint...

Returns:
true if JMF is available, false otherwise

textChanged

public void textChanged(HTextEvent e)

caretMoved

public void caretMoved(HTextEvent e)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Playback buttons.


openURL

protected void openURL(java.lang.String url)
Open SMIL doc at url.


openURL

protected void openURL(java.lang.String url,
                       java.lang.String errormsg)
Open ERROR doc at url, if errormsg != null.


displayError

public void displayError(java.lang.String url,
                         java.lang.String errMsg)

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

getDecorator

public Decorator getDecorator()
Specified by:
getDecorator in interface Viewer


X-Smiles 1.2