org.bs.mdi
Class ClipboardManager

java.lang.Object
  extended byorg.bs.mdi.ClipboardManager
All Implemented Interfaces:
ClipboardOwner

public class ClipboardManager
extends Object
implements ClipboardOwner

The ClipboardManager provides clipboard access and manages ActionConverter objects. Usually, an application has only one ClipboardManager, which can be accessed by calling the static method Application.getClipboardManager().


Constructor Summary
ClipboardManager()
          Creates a new ClipboardManager, which uses the system's default clipboard for data exchange.
 
Method Summary
 Action getContent()
          Gets the content of the clipboard.
 boolean isClipboardEmpty()
          Returns true if the clipboard is empty.
 boolean isReady()
          Returns true if this ClipboardManager is "ready".
 void lostOwnership(Clipboard clipboard, Transferable contents)
           
 void registerAllConverters(ActionConverter[] converters)
          Registers all converts in the given array.
 void registerConverter(ActionConverter converter)
          Registers an ActionConverter to be used with this ClipboardManager.
 void setContent(Action content)
          Sets the content of the clipboard.
protected  Action toAction(Transferable transferable)
           
protected  Transferable toTransferable(Action action)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClipboardManager

public ClipboardManager()
Creates a new ClipboardManager, which uses the system's default clipboard for data exchange. Note that you shouldn't create more than one ClipboardManager. The Application's default ClipboardManager can be accessed by calling the static method Application.getClipboardManager().

Method Detail

registerConverter

public void registerConverter(ActionConverter converter)
Registers an ActionConverter to be used with this ClipboardManager.

Parameters:
converter - the converter to be registered

registerAllConverters

public void registerAllConverters(ActionConverter[] converters)
Registers all converts in the given array.

Parameters:
converters - the converts to be registered.

setContent

public void setContent(Action content)
                throws ClipboardConversionException
Sets the content of the clipboard. The given Action object is automatically converted to a Transferable object.

Parameters:
content - the content to be set.
Throws:
ClipboardConversionException

getContent

public Action getContent()
                  throws ClipboardConversionException
Gets the content of the clipboard. The Transferable object is automatically converted to an Action object.

Returns:
the clipboard's content in form of an Action object
Throws:
ClipboardConversionException

isClipboardEmpty

public boolean isClipboardEmpty()
Returns true if the clipboard is empty.

Returns:
true if the clipboard is empty

toTransferable

protected Transferable toTransferable(Action action)

toAction

protected Action toAction(Transferable transferable)

isReady

public boolean isReady()
Returns true if this ClipboardManager is "ready". A ClipboardManager is considered ready if at least one ActionConverter has been registered.

Returns:
true if at least one ActionConverter has been registered

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Specified by:
lostOwnership in interface ClipboardOwner