ic.doc.extension
Class LTSAPlugin

java.lang.Object
  |
  +--ic.doc.extension.LTSAPlugin

public abstract class LTSAPlugin
extends java.lang.Object


Constructor Summary
LTSAPlugin()
          Default constructor
LTSAPlugin(ic.doc.extension.LTSA p_ltsa)
          This constructor is called by the extension mechanism.
 
Method Summary
abstract  boolean addAsTab()
           
 boolean addMenuItems()
          You can add menu items to menus that already exist in LTSA, or create entire new menus.
 boolean addMenusToMenuBar()
          Deprecated. The option to add entire menus has been discontinued - use addMenuItems() instead. It is possible to add new menus to the existing LSTA menubar, implementing the menu in the plugin.
abstract  boolean addToolbarButtons()
           
 void copy()
          Override this method to implement a copy handler for your plugin.
 void cut()
          Override this method to implement a cut handler for your plugin.
 java.awt.Component getComponent()
           
 java.lang.String getFileExtension()
          If you want to define a particular file extension to look for when loading and saving files from your plugin, return that extension from this method, and it will be used in the filechooser.
 ic.doc.extension.LTSA getLTSA()
           
 javax.swing.JMenuBar getMenuBar()
          Deprecated. The option to provide your own menubar has been discontinued - use addMenuItems() instead. To make LTSA switch to a new menubar when the pluign is selected, override this method to return a fully constructed JMenuBar.
 java.util.Map getMenuItems()
          This method should return a Map of menu items to add to the LTSA menus.
 java.util.List getMenus()
          Deprecated. The option to add entire menus has been discontinued - use addMenuItems() instead. To add menus to the existing menubar, override this method to return a java.util.List of JMenus. The menus should be implemented inside the plugin and will be hooked onto the existing menubar. Menus are only added when LTSA loads the plugin, so changing the contents of this list at a later time will have no effect on the menubar. This method will not be called unless addMenusToMenuBar() returns true.
abstract  java.lang.String getName()
          A name needs to be given to a plugin so that it can be identified.
 java.util.List getToolbarButtons()
          Buttons for the LTSA toolbar together with their associated actions can be created using the LTSAButton class.
 void initialise()
          Because the constructor of this abstract class will be called by the extension mechanism, other constructors defined in subclasses will not be called.
 void newFile()
          If you have overridden providesNewFile() to return true, this method will be called when New File is selected in the LTSA GUI.
 void openFile(java.io.File p_file)
          If you have overridden providesOpenFile() to return true, this method will be called when a file is opened using the filechooser in the LTSA GUI.
 void paste()
          Override this method to implement a paste handler for your plugin.
 boolean providesCopy()
          As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar.
 boolean providesCut()
          As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar.
 boolean providesNewFile()
          You can write a handler to be triggered when the New File button or menu item is clicked in the LTSA GUI.
 boolean providesOpenFile()
          You can write a handler to be triggered when the File Open button or menu item is clicked in the LTSA GUI.
 boolean providesPaste()
          As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar.
 boolean providesSaveFile()
          You can write a handler to be triggered when the File Save button or menu item is clicked in the LTSA GUI.
 void saveFile(java.io.FileOutputStream p_fos)
          If you have overridden providesSaveFile() to return true, this method will be called when a file is saved using the filechooser in the LTSA GUI.
 boolean useOwnMenuBar()
          Deprecated. The option to provide your own menubar has been discontinued - use addMenuItems() instead. It is possible for a plugin to provide its own menu bar. The menubar should be implemented inside the plugin. When the tab corresponding to the plugin is selected in the main LTSA user interface, the menubar will switch to that provided by that plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LTSAPlugin

public LTSAPlugin()
Default constructor


LTSAPlugin

public LTSAPlugin(ic.doc.extension.LTSA p_ltsa)
This constructor is called by the extension mechanism. You should not call it explicitly (through super(..) or otherwise).

Method Detail

getLTSA

public final ic.doc.extension.LTSA getLTSA()
Returns:
a reference to the LTSA interface, enabling core LTSA functionality to be accessed from the plugin.

getName

public abstract java.lang.String getName()
A name needs to be given to a plugin so that it can be identified. If the plugin adds a tab to the LTSA user interface, this name will be used as the label.

Returns:
returns a name for the plugin.

addAsTab

public abstract boolean addAsTab()
Returns:
true if this plugin provides a component that should be added as a tab in user interface.

getComponent

public java.awt.Component getComponent()
Returns:
a reference to a java.awt.Component (all swing JComponents are a subclass of awt.Component, and so can be used here) which should be added to the main UI.

addToolbarButtons

public abstract boolean addToolbarButtons()
Returns:
true if the plugin provides any buttons to be added to the LTSA toolbar.

getToolbarButtons

public java.util.List getToolbarButtons()
Buttons for the LTSA toolbar together with their associated actions can be created using the LTSAButton class. This method should return a java.util.List of the buttons to be added. Buttons are only added when LTSA loads the plugin, so changing the contents of this list at a later time will have no effect on the toolbar.

Returns:
a List of LTSAButtons to be added to the toolbar.
See Also:
LTSAButton

providesOpenFile

public boolean providesOpenFile()
You can write a handler to be triggered when the File Open button or menu item is clicked in the LTSA GUI. If the tab for your plugin is currently selected when File Open is performed, and you provide a handler for this event, your routine will be called. In order to signal that you provide a handler, override the providesOpenFile() method to return true.

Returns:
true if you want to catch File Open commands

openFile

public void openFile(java.io.File p_file)
If you have overridden providesOpenFile() to return true, this method will be called when a file is opened using the filechooser in the LTSA GUI. A File object representing the file is passed to this method. Implement your own file reading routine here.


providesSaveFile

public boolean providesSaveFile()
You can write a handler to be triggered when the File Save button or menu item is clicked in the LTSA GUI. If the tab for your plugin is currently selected when File Save is performed, and you provide a handler for this event, your routine will be called. In order to signal that you provide a handler, override the providesSaveFile() method to return true.

Returns:
true if you want to catch File Save commands

saveFile

public void saveFile(java.io.FileOutputStream p_fos)
If you have overridden providesSaveFile() to return true, this method will be called when a file is saved using the filechooser in the LTSA GUI. A FileOutputStream object connected to the file is passed to this method. Implement your own file saving routine here, writing the output to the stream.


providesNewFile

public boolean providesNewFile()
You can write a handler to be triggered when the New File button or menu item is clicked in the LTSA GUI. If the tab for your plugin is currently selected when New is performed, and you provide a handler for this event, your routine will be called. In order to signal that you provide a handler, override the providesNewFile() method to return true.

Returns:
true if you want to catch New File commands

newFile

public void newFile()
If you have overridden providesNewFile() to return true, this method will be called when New File is selected in the LTSA GUI. Implement your own new file routine here. the output to the stream.


providesCopy

public boolean providesCopy()
As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar. To provide a copy handler, override providesCopy() so that it returns true, and implement the handler by overriding the copy() method.


copy

public void copy()
Override this method to implement a copy handler for your plugin.


providesCut

public boolean providesCut()
As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar. To provide a cut handler, override providesCut() so that it returns true, and implement the handler by overriding the cut() method.


cut

public void cut()
Override this method to implement a cut handler for your plugin.


providesPaste

public boolean providesPaste()
As with Open, Save and New, you can provide handlers for Cut, Copy and Paste to be triggered by the corresponding buttons on the LTSA toolbar. To provide a paste handler, override providesPaste() so that it returns true, and implement the handler by overriding the paste() method.


paste

public void paste()
Override this method to implement a paste handler for your plugin.


getFileExtension

public java.lang.String getFileExtension()
If you want to define a particular file extension to look for when loading and saving files from your plugin, return that extension from this method, and it will be used in the filechooser. For example if you want to load files with the extension .xml, return "xml" (no dot) from this method.


addMenuItems

public boolean addMenuItems()
You can add menu items to menus that already exist in LTSA, or create entire new menus. To signal that your plugin provides menu items to add, override addMenuItems() to return true, and implement the getMenuItems() method.


getMenuItems

public java.util.Map getMenuItems()
This method should return a Map of menu items to add to the LTSA menus. Each key-value pair in the map should comprise a JMenuItem (to which you should attach a suitable event listener) as the key, and a String giving the name of the menu that this menu item should be in as the value. In this way you can define a number of different menu items that are all to be added to the same menu. If a menu with the given name does not already exist, then a new menu will be created with this name. In this way you can add entire menus.


initialise

public void initialise()
Because the constructor of this abstract class will be called by the extension mechanism, other constructors defined in subclasses will not be called. Override this method to do any initialisation.


addMenusToMenuBar

public boolean addMenusToMenuBar()
Deprecated. The option to add entire menus has been discontinued - use addMenuItems() instead. It is possible to add new menus to the existing LSTA menubar, implementing the menu in the plugin.

Returns:
true if the plugin provides menus to add to the exising menubar.

getMenus

public java.util.List getMenus()
Deprecated. The option to add entire menus has been discontinued - use addMenuItems() instead. To add menus to the existing menubar, override this method to return a java.util.List of JMenus. The menus should be implemented inside the plugin and will be hooked onto the existing menubar. Menus are only added when LTSA loads the plugin, so changing the contents of this list at a later time will have no effect on the menubar. This method will not be called unless addMenusToMenuBar() returns true.

Returns:
a List of JMenus to add to the exisiting LTSA menubar.
See Also:
addMenusToMenuBar(), JMenu

useOwnMenuBar

public boolean useOwnMenuBar()
Deprecated. The option to provide your own menubar has been discontinued - use addMenuItems() instead. It is possible for a plugin to provide its own menu bar. The menubar should be implemented inside the plugin. When the tab corresponding to the plugin is selected in the main LTSA user interface, the menubar will switch to that provided by that plugin.

Returns:
true if the plugin provides its own menubar

getMenuBar

public javax.swing.JMenuBar getMenuBar()
Deprecated. The option to provide your own menubar has been discontinued - use addMenuItems() instead. To make LTSA switch to a new menubar when the pluign is selected, override this method to return a fully constructed JMenuBar.

Returns:
a JMenuBar corresponding to this plugin