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

java.lang.Object
  extended byjava.awt.event.WindowAdapter
      extended byfi.hut.tml.xsmiles.mlfc.smil.viewer.swing.SMILViewer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, Viewer, java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener

public class SMILViewer
extends java.awt.event.WindowAdapter
implements Viewer, java.awt.event.ActionListener

This is a standalone application, SMIL Viewer, showing how to display SMIL presenations. This class shows a deeper approach compared to the SMILApp class, thus giving also more flexibility.

To run this viewer as a standalone application, classpath should include xerces.jar and xml-apis.jar


Field Summary
static long initMem
           
static long initTime
           
 
Constructor Summary
SMILViewer()
           
SMILViewer(java.lang.String fileName)
           
SMILViewer(java.net.URL url)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Control buttons.
 void addTimePoint(java.lang.String elementId)
          Called from the SMILDocument, when a new time point is found during prefetching.
 void displayStatusText(java.lang.String txt)
          Displays a status text
 java.net.URL getBaseURL()
          Return the base URL of the document.
 Decorator getDecorator()
           
 BrushHandler getNewBrushHandler()
          Returns a new BrushHandler for SMIL core logic.
 DrawingArea getNewDrawingArea(int type, boolean block)
          Creates a new DrawingArea.
 MediaHandler getNewForeignHandler(org.w3c.dom.Element e)
          Returns a new ForeignHandler for SMIL core logic.
 LinkHandler getNewLinkHandler()
          Creates a new LinkHandler.
 MediaHandler getNewMediaHandler()
          Creates a new MediaHandler.
 boolean getPlayAudio()
          Returns true if audio should be played.
 boolean getPlayImage()
          Returns true if images should be played.
 boolean getPlayVideo()
          Returns true if video should be played.
 SMILDocument getSMILDoc()
          Get the SMILDocument.
 java.lang.String getSystemAudioDesc()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemBitrate()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemCaptions()
          Returns a system attribute for the SMILDocument.
 boolean getSystemComponent(java.lang.String component)
          Returns the value of systemAttribute for the SMIL core logic.
 java.lang.String getSystemCPU()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemLanguage()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemOperatingSystem()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemOverdubOrCaption()
          Returns a system attribute for the SMILDocument.
 java.lang.String getSystemOverdubOrSubtitle()
          Returns a system attribute for the SMILDocument.
 boolean getSystemRequired(java.lang.String prefix)
          Returns the value of systemAttribute for the SMIL core logic.
 int getSystemScreenDepth()
          Returns a system attribute for the SMILDocument.
 int getSystemScreenHeight()
          Returns a system attribute for the SMILDocument.
 int getSystemScreenWidth()
          Returns a system attribute 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)
          Called when an external link is activated.
 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(java.io.Reader reader, java.lang.String path)
          Initializes the SMIL presentation for playing.
 boolean isHost()
          SMILDoc requires this from the SMILMLFC, which may return true or false.
static void main(java.lang.String[] args)
          Main method
 void setDocumentBaseURI(java.lang.String base)
           
 void setRootlayoutContainer(java.awt.Container rootlayout)
          Set the root-layout container.
 void setTitle(java.lang.String title)
          Set the title for the presentation.
 void start()
          Start the presentation.
 void stop()
          Stop the presentation.
 java.net.URL toURL(java.io.File file)
           
 void windowClosing(java.awt.event.WindowEvent e)
          Window closed.
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initTime

public static long initTime

initMem

public static long initMem
Constructor Detail

SMILViewer

public SMILViewer()

SMILViewer

public SMILViewer(java.lang.String fileName)

SMILViewer

public SMILViewer(java.net.URL url)
Method Detail

main

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


init

public boolean init(java.io.Reader reader,
                    java.lang.String path)
Initializes the SMIL presentation for playing.

Parameters:
reader - Reader, where the presentation is loaded from
path - Path to the file (can be a URL)

start

public void start()
Start the presentation.


stop

public void stop()
Stop the presentation.


getSMILDoc

public SMILDocument getSMILDoc()
Get the SMILDocument. Called from other Swing handlers.

Specified by:
getSMILDoc in interface Viewer
Returns:
Currently opened SMIL document.

setDocumentBaseURI

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

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)
Called when an external link is activated.

Specified by:
gotoExternalLink in interface Viewer
Parameters:
url - Link destination

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 txt)
Displays a status text

Specified by:
displayStatusText in interface Viewer

getNewMediaHandler

public MediaHandler getNewMediaHandler()
Creates a new MediaHandler. Works as a factory for SMILDocument.

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()
Creates a new LinkHandler. Works as a factory for SMILDocument.

Specified by:
getNewLinkHandler in interface Viewer

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

setRootlayoutContainer

public void setRootlayoutContainer(java.awt.Container rootlayout)
Set the root-layout container. The container will hold the SMIL presentation.

Parameters:
rootlayout - Container for SMIL presentation

getNewDrawingArea

public DrawingArea getNewDrawingArea(int type,
                                     boolean block)
Creates a new DrawingArea. Works as a factory for SMILDocument.

Specified by:
getNewDrawingArea in interface Viewer

addTimePoint

public void addTimePoint(java.lang.String elementId)
Called from the SMILDocument, when a new time point is found during prefetching.

Specified by:
addTimePoint in interface Viewer

getWindowWidth

public int getWindowWidth()
Returns window width for the SMILDocument.

Specified by:
getWindowWidth in interface Viewer

getWindowHeight

public int getWindowHeight()
Returns window height for the SMILDocument.

Specified by:
getWindowHeight in interface Viewer

getSystemBitrate

public java.lang.String getSystemBitrate()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemBitrate in interface Viewer

getSystemCaptions

public java.lang.String getSystemCaptions()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemCaptions in interface Viewer

getSystemLanguage

public java.lang.String getSystemLanguage()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemLanguage in interface Viewer

getSystemOverdubOrCaption

public java.lang.String getSystemOverdubOrCaption()
Returns a system attribute for the SMILDocument.

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 a system attribute for the SMILDocument.

Specified by:
getSystemScreenWidth in interface Viewer

getSystemScreenHeight

public int getSystemScreenHeight()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemScreenHeight in interface Viewer

getSystemScreenDepth

public int getSystemScreenDepth()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemScreenDepth in interface Viewer

getSystemOverdubOrSubtitle

public java.lang.String getSystemOverdubOrSubtitle()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemOverdubOrSubtitle in interface Viewer

getSystemAudioDesc

public java.lang.String getSystemAudioDesc()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemAudioDesc in interface Viewer

getSystemOperatingSystem

public java.lang.String getSystemOperatingSystem()
Returns a system attribute for the SMILDocument.

Specified by:
getSystemOperatingSystem in interface Viewer

getSystemCPU

public java.lang.String getSystemCPU()
Returns a system attribute for the SMILDocument.

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()
Returns true if images should be played.

Specified by:
getPlayImage in interface Viewer

getPlayAudio

public boolean getPlayAudio()
Returns true if audio should be played.

Specified by:
getPlayAudio in interface Viewer

getPlayVideo

public boolean getPlayVideo()
Returns true if video should be played.

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 title)
Set the title for the presentation.

Specified by:
setTitle in interface Viewer
Parameters:
title - 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

toURL

public java.net.URL toURL(java.io.File file)
                   throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Control buttons.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Window closed. Stops the presentation and exits.

Specified by:
windowClosing in interface java.awt.event.WindowListener

getDecorator

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


X-Smiles 1.2