Synergy Home Page

au.edu.swin.synergy.plugin.editmanager
Class BEditManager

java.lang.Object
  |
  +--au.edu.swin.synergy.kernel.BPlugin
        |
        +--au.edu.swin.synergy.plugin.editmanager.BEditManager

public class BEditManager
extends BPlugin

The edit manager is responsible for dispatching cut, copy, paste and undo events to the component with the current focus. It is the responsibility of the current component to deal with these events as they see fit. This will provide backward compatability with the existing swing classes which handle control-c, x, p and z already.

Author:
Tristan Austin

Inner Class Summary
 class BEditManager.BActionListener
          This will handle program flow for the menu items
 
Fields inherited from class au.edu.swin.synergy.kernel.BPlugin
kernel
 
Constructor Summary
BEditManager()
           
 
Method Summary
protected  void dispatchEvent(JComponent focusedComponent, int keyCode, int modifierMask)
          This will dispatch the appropriate key event to the currently focussed component.
protected  void doDialect()
          This will set the text of the menus to the correct values for the current Locale
protected  void doUndoRedo(boolean undo)
          This will be called when the user selects undo or redo from the menu or presses the appropriate hot keys.
protected  void doUndoRegistration(BRegisterUndoCE registerCE)
          This will create an undo listener for the source of the event and return the listener in the event itself.
 void editOccured(BUndoManager undoManager)
          When called, this will update the undo and redo menu items appropriate if the undo manager in which the edit occured is also the current edit manager.
 BStringList getDependancies()
          Return a list of plugin dependancies
 void onBCommandEvent(Object source, BCommandEvent event)
          This is where all events are received through.
 void relinquishUndoManager(BUndoManager undoManager)
          This will remove the current undo manager if it is this one
protected  void setCutCopyEnabled(boolean enabled)
          Sets the enabled state of the cut and copy menu items to the state specified.
protected  void setPasteEnabled(boolean enabled)
          Sets the enabled state of the paste menu items to the state specified.
protected  void setUndoItems()
          This will set the appropriate text and enabled states on the undo and redo menu items as per the current undo manager.
protected  void setUndoManager(BUndoManager undoManager)
          This will change the current undo manager to the one specified
 void setup(BStringList params)
          This is called when the plugin is first loaded.
protected  void unregisterUndoManager(Object source)
          This will remove the undo manager mapped to the given source
 
Methods inherited from class au.edu.swin.synergy.kernel.BPlugin
dispatchEvent, dispatchEventAndWait, dispatchEventServer, dispatchEventServerAndWait, dispatchEventTo, dispatchEventToAndWait, getKernel, setKernel, setup, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BEditManager

public BEditManager()
Method Detail

onBCommandEvent

public void onBCommandEvent(Object source,
                            BCommandEvent event)
This is where all events are received through.
Overrides:
onBCommandEvent in class BPlugin

doUndoRegistration

protected void doUndoRegistration(BRegisterUndoCE registerCE)
This will create an undo listener for the source of the event and return the listener in the event itself. It is up to the source to inform the edit manager when it should be used.

unregisterUndoManager

protected void unregisterUndoManager(Object source)
This will remove the undo manager mapped to the given source
Parameters:
source - The source of the undo manager

editOccured

public void editOccured(BUndoManager undoManager)
When called, this will update the undo and redo menu items appropriate if the undo manager in which the edit occured is also the current edit manager.
Parameters:
undoManager - The undo manager that was updated

setUndoManager

protected void setUndoManager(BUndoManager undoManager)
This will change the current undo manager to the one specified
Parameters:
undoManager - The manager to make current

relinquishUndoManager

public void relinquishUndoManager(BUndoManager undoManager)
This will remove the current undo manager if it is this one

setUndoItems

protected void setUndoItems()
This will set the appropriate text and enabled states on the undo and redo menu items as per the current undo manager.

setPasteEnabled

protected void setPasteEnabled(boolean enabled)
Sets the enabled state of the paste menu items to the state specified.
Parameters:
enabled - True to enable, false to disable

setCutCopyEnabled

protected void setCutCopyEnabled(boolean enabled)
Sets the enabled state of the cut and copy menu items to the state specified.
Parameters:
enabled - True to enable, false to disable

setup

public void setup(BStringList params)
This is called when the plugin is first loaded. It is responsible for registering the menu items and setting everything up.
Parameters:
params - The paramaters supplied by the configuration file
Overrides:
setup in class BPlugin

getDependancies

public BStringList getDependancies()
Return a list of plugin dependancies
Returns:
a list of plugins such as "au.edu.swin.synergy.plugin.mod13.BWindowManager" or null if there are no dependancies
Overrides:
getDependancies in class BPlugin

doDialect

protected void doDialect()
This will set the text of the menus to the correct values for the current Locale

dispatchEvent

protected void dispatchEvent(JComponent focusedComponent,
                             int keyCode,
                             int modifierMask)
This will dispatch the appropriate key event to the currently focussed component.
Parameters:
keyCode - The key code to send

doUndoRedo

protected void doUndoRedo(boolean undo)
This will be called when the user selects undo or redo from the menu or presses the appropriate hot keys. It will tell the current undo manager to undo redo depending on the und ovalue given.
Parameters:
undo - True to undo, false to redo

Synergy Home Page