The Meta-Environment API

nl.cwi.sen1.visplugin
Class VisualizationPluginController

java.lang.Object
  extended by nl.cwi.sen1.gui.plugin.DefaultStudioPlugin
      extended by nl.cwi.sen1.visplugin.VisualizationPluginController
All Implemented Interfaces:
nl.cwi.sen1.gui.plugin.StudioPlugin, VisualizationPluginTif
Direct Known Subclasses:
ExampleVisualizationController

public abstract class VisualizationPluginController
extends nl.cwi.sen1.gui.plugin.DefaultStudioPlugin
implements VisualizationPluginTif

The VisualizationPluginController class represents the base class for the different plugin controllers.

Author:
Aldert Boerhoop

Nested Class Summary
static class VisualizationPluginController.requestType
           
 class VisualizationPluginController.WindowProperties
           
 
Field Summary
private  VisualizationPluginBridge m_bridge
           
protected  nl.cwi.sen1.relationstores.Factory m_factory
           
private  java.util.ArrayList<VisualizationPluginController.WindowProperties> m_openWindows
           
private  java.lang.String m_pluginName
           
private  aterm.pure.PureFactory m_pureFactory
           
private  nl.cwi.sen1.gui.Studio m_studio
           
private  aterm.ATerm[] m_supportedTypes
           
private static java.lang.String TOOL_NAME
           
 
Constructor Summary
VisualizationPluginController()
           
 
Method Summary
abstract  VisualizationPluginWindow createWindow()
          Create a new instance of the plugin window
 void exportToClicked(VisualizationPluginController.requestType exportRequestType, int windowId)
          Opens a file dialog with the correct properties
 VisualizationPluginBridge getBridge()
          Returns the bridge of the visualization plugin controller.
 java.lang.String getName()
          Had to be implemented (studioplugin.getName)
abstract  java.lang.String getPluginName()
          Get the name of the plugin
abstract  aterm.ATerm[] getSupportedTypes()
          Get the supported types of the plugin
 VisualizationPluginWindow getWindowById(int windowId)
          Returns a plugin window given by its ID.
protected  VisualizationPluginController.requestType getWindowExportRequestType(int windowId)
          Gets the export request type.
 void initPluginController(aterm.pure.PureFactory pureFactory)
          Initialize the plugin controller
 void initStudioPlugin(nl.cwi.sen1.gui.Studio studioArgument)
          Initialize the plugin
protected  boolean isTypeSupported(aterm.ATerm type)
          Checks if a type is supported.
 void openLocationInEditor(nl.cwi.sen1.relationstores.types.Location loc)
           
 void recAckEvent(aterm.ATerm t0)
           
 void recTerminate(aterm.ATerm event)
          Close the plugin
 void vpFactOutOfDate(int storeId, int factId)
          Sends an out of date ack.
 void vpFileDialogCancel(int windowId)
          Calls the correct function to handle the user cancel of the file dialog
 void vpFileDialogResult(int windowId, java.lang.String fileName)
          Calls the correct function to handle the export
 aterm.ATerm vpGetName()
          Get the name of the plugin (Incomming call from the toolbus)
 aterm.ATerm vpIsTypeSupported(aterm.ATerm type)
          Checks if the type is supported (Incomming call from the toolbus)
 void vpRstoreUnloaded(int rstoreId)
          The VPI will call this method when an rstore has been unloaded.
 void vpVisualizeFact(int storeId, int factId, aterm.ATerm fact)
          Visualize the fact (Incomming call from the toolbus)
 
Methods inherited from class nl.cwi.sen1.gui.plugin.DefaultStudioPlugin
addStudioPluginListener, fireStudioPluginClosed, removeStudioPluginListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOOL_NAME

private static final java.lang.String TOOL_NAME
See Also:
Constant Field Values

m_pureFactory

private aterm.pure.PureFactory m_pureFactory

m_studio

private nl.cwi.sen1.gui.Studio m_studio

m_pluginName

private java.lang.String m_pluginName

m_supportedTypes

private aterm.ATerm[] m_supportedTypes

m_openWindows

private java.util.ArrayList<VisualizationPluginController.WindowProperties> m_openWindows

m_bridge

private VisualizationPluginBridge m_bridge

m_factory

protected nl.cwi.sen1.relationstores.Factory m_factory
Constructor Detail

VisualizationPluginController

public VisualizationPluginController()
Method Detail

getBridge

public VisualizationPluginBridge getBridge()
Returns the bridge of the visualization plugin controller.

Returns:
The bridge object.

initStudioPlugin

public void initStudioPlugin(nl.cwi.sen1.gui.Studio studioArgument)
Initialize the plugin

Specified by:
initStudioPlugin in interface nl.cwi.sen1.gui.plugin.StudioPlugin
Parameters:
Studio - studioArgument

initPluginController

public final void initPluginController(aterm.pure.PureFactory pureFactory)
Initialize the plugin controller

Parameters:
PureFactory - pureFactory that should be used by the controller

vpVisualizeFact

public final void vpVisualizeFact(int storeId,
                                  int factId,
                                  aterm.ATerm fact)
Visualize the fact (Incomming call from the toolbus)

Specified by:
vpVisualizeFact in interface VisualizationPluginTif
Parameters:
Rstore - id, Fact id and the fact to visualize

getName

public final java.lang.String getName()
Had to be implemented (studioplugin.getName)

Specified by:
getName in interface nl.cwi.sen1.gui.plugin.StudioPlugin
Returns:
The plugin name

vpFactOutOfDate

public final void vpFactOutOfDate(int storeId,
                                  int factId)
Sends an out of date ack. to the asigned plugin window

Specified by:
vpFactOutOfDate in interface VisualizationPluginTif
Parameters:
Store - id and the Fact id

vpRstoreUnloaded

public final void vpRstoreUnloaded(int rstoreId)
The VPI will call this method when an rstore has been unloaded. The VisualizationController will check which VisualizationPluginWindows correspond with the specified rstoreId and these windows will be notified.

Specified by:
vpRstoreUnloaded in interface VisualizationPluginTif
Parameters:
rstoreId - The rstoreId of the unloaded rstore.

vpGetName

public final aterm.ATerm vpGetName()
Get the name of the plugin (Incomming call from the toolbus)

Specified by:
vpGetName in interface VisualizationPluginTif

vpIsTypeSupported

public final aterm.ATerm vpIsTypeSupported(aterm.ATerm type)
Checks if the type is supported (Incomming call from the toolbus)

Specified by:
vpIsTypeSupported in interface VisualizationPluginTif

isTypeSupported

protected boolean isTypeSupported(aterm.ATerm type)
Checks if a type is supported. Is overridable by children to support alternative ways to check for a type. For instance checking for n-size relations.


recTerminate

public void recTerminate(aterm.ATerm event)
Close the plugin

Specified by:
recTerminate in interface VisualizationPluginTif
Parameters:
ATerm - event

recAckEvent

public void recAckEvent(aterm.ATerm t0)
Specified by:
recAckEvent in interface VisualizationPluginTif

createWindow

public abstract VisualizationPluginWindow createWindow()
Create a new instance of the plugin window

Returns:
The instance of the plugin window

getPluginName

public abstract java.lang.String getPluginName()
Get the name of the plugin

Returns:
The plugin name

getSupportedTypes

public abstract aterm.ATerm[] getSupportedTypes()
Get the supported types of the plugin

Returns:
The supported types

exportToClicked

public void exportToClicked(VisualizationPluginController.requestType exportRequestType,
                            int windowId)
Opens a file dialog with the correct properties

Parameters:
requestType - exportRequestType type of export, int windowId of the window who requested the export

vpFileDialogResult

public void vpFileDialogResult(int windowId,
                               java.lang.String fileName)
Calls the correct function to handle the export

Specified by:
vpFileDialogResult in interface VisualizationPluginTif
Parameters:
int - windowId of the window who requested the export, String fileName thats entered in the file dialog

getWindowById

public VisualizationPluginWindow getWindowById(int windowId)
Returns a plugin window given by its ID.

Parameters:
windowId - ID of the window to return.
Returns:
The window object.

getWindowExportRequestType

protected VisualizationPluginController.requestType getWindowExportRequestType(int windowId)
Gets the export request type.

Parameters:
windowId - ID of the window to get the export request type of.
Returns:
The export request type of the window. TODO: Should be handled through proper export handlers, but the current architecture doesn't allow this without extensive refactoring.

vpFileDialogCancel

public void vpFileDialogCancel(int windowId)
Calls the correct function to handle the user cancel of the file dialog

Specified by:
vpFileDialogCancel in interface VisualizationPluginTif
Parameters:
int - windowId of the window who requested the export

openLocationInEditor

public void openLocationInEditor(nl.cwi.sen1.relationstores.types.Location loc)

The Meta-Environment API