anvil.gui
Interface AnvilMain


public interface AnvilMain

Defines an interface to the main Anvil object for plug-in modules wishing to access Anvil objects and functions.


Method Summary
 void addAnvilMainChangeListener(anvil.gui.AnvilMainChangeListener l)
          Adds listener that listens to event like loading a new annotation.
 void addAnvilMediaTimeListener(anvil.media.AnvilMediaTimeListener li)
          Adds the specified media time listener to receive media time change events from this component.
 void addSelectionChangeListener(anvil.gui.coding.SelectionChangeListener l)
          Adds listener that listens to changing element selection.
 void addSubwindow(javax.swing.JFrame comp)
          If a window is subwindow to Anvil, Anvil will hide this window when the Anvil Main window is clicked away.
 void addSubwindow(javax.swing.JFrame comp, boolean annobound)
          If a window is subwindow to Anvil, Anvil will hide this window when the Anvil Main window is clicked away.
 void disableSelector()
          Switches off selector mode.
 void elementSelected(anvil.annot.AnnotationElement el)
          This is called by a viewer.
 void enableSelector(anvil.gui.coding.ElementEditWindow win, int color)
          Switches on selection mode, a mode taken on by all viewers where elements can be selected in the element edit dialog.
 anvil.annot.AnnotationContainer getActiveContainer()
          Returns container that is currently active.
 anvil.annot.Annotation getAnnotation()
          Returns annotation object if there is one loaded, null otherwise.
 java.lang.String getCurrentVideoFilename()
          Returns path of current video.
 java.io.File getPlugInPath()
          Returns path where Anvil plugins should be located
 javax.media.Processor getProcessor()
          Returns processor if a video is currently loaded, null otherwise.
 java.util.List getSubwindows()
          Returns list of currently registered subwindows.
 java.io.File getSystemPath()
          Returns path where the Anvil system is located.
 anvil.gui.TimeAlignedViewer getTimeAlignedViewer()
          Returns time-aligned viewer if one is active.
 java.lang.String getVersion()
          Returns current Anvil version.
 javax.media.Time getVideoDuration()
          Returns media time duration of current video.
 javax.media.Time getVideoTime()
          Returns media time of current video.
 javax.swing.JFrame getVideoWindow()
          Returns window where the video resides.
 boolean hasVideo()
          Tells you whether a video is loaded.
 javax.media.Time mapFrameToTime(int frame)
          Maps frame number to time with respect to current video.
 int mapTimeToFrame(javax.media.Time time)
          Maps time to frame number with respect to current video.
 boolean newAnnotation()
          Creates new annotation object according to the default specification.
 void plugInExited(anvil.gui.AnvilPlugIn plugin)
          Must be called when plugin is exited by itself.
 void removeAnvilMainChangeListener(anvil.gui.AnvilMainChangeListener l)
          Removes listener.
 void removeAnvilMediaTimeListener(anvil.media.AnvilMediaTimeListener li)
          Removes the specified media time listener so that it no longer receives media time events from this component.
 void removeSelectionChangeListener(anvil.gui.coding.SelectionChangeListener l)
          Removes listener.
 boolean removeSubwindow(java.awt.Component comp)
          Removes component from Anvil's subwindow list.
 void setVideoEffect(javax.media.Effect effect)
          Sets video effect that will be implemented next time a video is loaded.
 void setVideoFrame(int framenum)
          Positions video at frame the given frame number.
 void setVideoTime(javax.media.Time time)
          Positions video at given time.
 void unsetVideoEffect()
          Removes any effect that was previously installed.
 

Method Detail

addAnvilMediaTimeListener

public void addAnvilMediaTimeListener(anvil.media.AnvilMediaTimeListener li)
Adds the specified media time listener to receive media time change events from this component. If li is null, no exception is thrown and no action is performed.


addAnvilMainChangeListener

public void addAnvilMainChangeListener(anvil.gui.AnvilMainChangeListener l)
Adds listener that listens to event like loading a new annotation.


addSelectionChangeListener

public void addSelectionChangeListener(anvil.gui.coding.SelectionChangeListener l)
Adds listener that listens to changing element selection.


addSubwindow

public void addSubwindow(javax.swing.JFrame comp,
                         boolean annobound)
If a window is subwindow to Anvil, Anvil will hide this window when the Anvil Main window is clicked away.

Parameters:
comp - Component to add
annobound - when true, component is closed as soon as the annotation is closed.

addSubwindow

public void addSubwindow(javax.swing.JFrame comp)
If a window is subwindow to Anvil, Anvil will hide this window when the Anvil Main window is clicked away.

Parameters:
comp - Component to add

disableSelector

public void disableSelector()
Switches off selector mode.


elementSelected

public void elementSelected(anvil.annot.AnnotationElement el)
This is called by a viewer. Main will then spread the word about the changed selection via the SelectionChangeListener interface.


enableSelector

public void enableSelector(anvil.gui.coding.ElementEditWindow win,
                           int color)
Switches on selection mode, a mode taken on by all viewers where elements can be selected in the element edit dialog.


getActiveContainer

public anvil.annot.AnnotationContainer getActiveContainer()
Returns container that is currently active.


getCurrentVideoFilename

public java.lang.String getCurrentVideoFilename()
Returns path of current video.

Returns:
full path or null if no video is loaded.

getProcessor

public javax.media.Processor getProcessor()
Returns processor if a video is currently loaded, null otherwise.


getSubwindows

public java.util.List getSubwindows()
Returns list of currently registered subwindows.


getVideoDuration

public javax.media.Time getVideoDuration()
Returns media time duration of current video.


getVideoTime

public javax.media.Time getVideoTime()
Returns media time of current video.


getSystemPath

public java.io.File getSystemPath()
Returns path where the Anvil system is located.


getPlugInPath

public java.io.File getPlugInPath()
Returns path where Anvil plugins should be located


getTimeAlignedViewer

public anvil.gui.TimeAlignedViewer getTimeAlignedViewer()
Returns time-aligned viewer if one is active.


getVersion

public java.lang.String getVersion()
Returns current Anvil version.


getVideoWindow

public javax.swing.JFrame getVideoWindow()
Returns window where the video resides.


getAnnotation

public anvil.annot.Annotation getAnnotation()
Returns annotation object if there is one loaded, null otherwise.

Returns:
Currently loaded annotation object or null.

hasVideo

public boolean hasVideo()
Tells you whether a video is loaded.

Returns:
true if there is a video, false otherwise.

mapFrameToTime

public javax.media.Time mapFrameToTime(int frame)
Maps frame number to time with respect to current video.


mapTimeToFrame

public int mapTimeToFrame(javax.media.Time time)
Maps time to frame number with respect to current video. If no video is there an empirically verified method computes the frame.


newAnnotation

public boolean newAnnotation()
Creates new annotation object according to the default specification. Checks with user whether old one should be saved.

Returns:
true if new annotation was created, false otherwise.

plugInExited

public void plugInExited(anvil.gui.AnvilPlugIn plugin)
Must be called when plugin is exited by itself. Do not call this method if plug-in exits because of AnvilMain.

See Also:
AnvilPlugIn.exitFromAnvil()

removeAnvilMediaTimeListener

public void removeAnvilMediaTimeListener(anvil.media.AnvilMediaTimeListener li)
Removes the specified media time listener so that it no longer receives media time events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If li is null, no exception is thrown and no action is performed.


removeAnvilMainChangeListener

public void removeAnvilMainChangeListener(anvil.gui.AnvilMainChangeListener l)
Removes listener.


removeSelectionChangeListener

public void removeSelectionChangeListener(anvil.gui.coding.SelectionChangeListener l)
Removes listener.


removeSubwindow

public boolean removeSubwindow(java.awt.Component comp)
Removes component from Anvil's subwindow list.

Returns:
whether window was in list.

setVideoEffect

public void setVideoEffect(javax.media.Effect effect)
Sets video effect that will be implemented next time a video is loaded.


unsetVideoEffect

public void unsetVideoEffect()
Removes any effect that was previously installed.


setVideoFrame

public void setVideoFrame(int framenum)
Positions video at frame the given frame number.

Parameters:
framenum - frame number to set video to.

setVideoTime

public void setVideoTime(javax.media.Time time)
Positions video at given time.

Parameters:
time - time to set video to.