|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wpi.cs.cs509.clipboard.Clipboard
Maintains primitive Clipboard for block components.
This clipboard component supports both the original IClipboard interface (a programmatic API interface) and the graphical IClipboardGUI interface (a Microsoft-office-like Clipboard frame for maintaining multiple items on the clipboard).
As such, its provided and required are suitably configured. Note that you do not have to satisfy the required interface of the graphical component if you are only going to use the standard API.
Provided: IClipboard, IClipboardGUI (since V1.1)
Required: IClipboardAccessor (but only if connected via IClipboardGUI)
VERSIONS:
1.1.1 Fixed problems with DataType in some of its interfaces. 1.1 Added GUI Functionality 1.0 Original
Field Summary | |
protected java.util.Stack |
contents
Stack to hold the entries. |
protected ClipboardGUI |
guiInstance
Each clipboard can have a single GUI instance. |
protected java.util.Vector |
providedV
Internal storage of provided interfaces. |
protected java.util.Vector |
requiredV
Internal storage of required interfaces. |
protected boolean |
useGraphicalInterface
Determines whether to use the graphical interface of clipboard. |
Constructor Summary | |
Clipboard()
Clipboard constructor comment. |
Method Summary | |
boolean |
activate()
Used to activate the component |
protected void |
activateGUI(boolean enabled)
Activates GUI in its own thread. |
void |
clear()
Clear the contents of the clipboard |
boolean |
connect(IBlock obj,
java.lang.String interfaceName)
Gives the components an IBlock object to connect to and the interface at which to connect |
void |
deactivate()
Used to deactivate the component |
java.util.Enumeration |
getProvided()
This method returns an Enumeration of Strings, specifying all the interfaces that this component provides |
java.util.Enumeration |
getRequired()
This method returns an Enumeration of Strings, specifying all the interfaces that this component requires |
boolean |
insert(IItem i)
Inserts the given object conforming to the IItem interface into the clipboard. |
IDataType |
newDataTypeInstance(java.lang.String s)
Constructs an object conforming to the IDataType interface given a String object. |
IItem |
newItemInstance(IDataType type,
java.lang.Object o)
Constructs an object conforming to the IItem interface given an IDataType and object |
IItem |
retrieve()
Retrieves the last IItem inserted into the clipboard. |
IItem |
retrieve(IDataType type)
Retrieves most recent IItem inserted into clipboard of given type. |
IItem |
retrieveNth(int n)
Returns the nth last IItem inserted into the Clipboard counting from 1. |
IItem |
retrieveNth(int n,
IDataType type)
Returns the nth IItem in the clipboard that is a sub-type of given IDataType. |
void |
setAccessor(IClipboardAccessor ica)
Tell GUI Clipboard to whom its commands should be sent. |
void |
showClipboard(boolean flag)
Make the Clipboard GUI visible or invisible. |
java.util.Enumeration |
types()
Return Enumeration of IDataType objects representing the clipboard contents |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector providedV
protected java.util.Vector requiredV
protected java.util.Stack contents
protected ClipboardGUI guiInstance
protected boolean useGraphicalInterface
Constructor Detail |
public Clipboard()
Needs to be here for CMI.
Method Detail |
public boolean activate()
protected void activateGUI(boolean enabled)
Also responsible for telling GUI of external agent to whom requests should be redirected. If GUI does not already exist, it will become visible even if the enabled parameter is false.
public void clear()
PRE: none
POST: clipboard is empty
Modified V1.1 to work with GUI
clear
in interface IClipboard
public boolean connect(IBlock obj, java.lang.String interfaceName)
obj
- The IBlock object to connectinterfaceName
- The name of the interface as a string
public void deactivate()
public java.util.Enumeration getProvided()
public java.util.Enumeration getRequired()
public boolean insert(IItem i)
PRE: none
POST: contents.size() = contents'.size() + 1. i is the next item to be
retrieved.
Modified in V1.1 to pop up GUI if one is being used.
insert
in interface IClipboard
i
- edu.wpi.cs.cs509.graph.clipboard.Item
true
if Item successfully added.public IDataType newDataTypeInstance(java.lang.String s) throws ClipboardException
newDataTypeInstance
in interface IClipboard
ClipboardException
- If String refers to non-valid Java type.public IItem newItemInstance(IDataType type, java.lang.Object o) throws ClipboardException
newItemInstance
in interface IClipboard
type
- edu.wpi.cs.cs509.graph.clipboard.IDataTypeo
- java.lang.Object
ClipboardException
- If type was not previously constructed by clipboard.public IItem retrieve() throws ClipboardException
PRE: clipboard.size() > 1
POST: stack unchanged.
retrieve
in interface IClipboard
ClipboardException
- If clipboard is empty.public IItem retrieve(IDataType type) throws ClipboardException
PRE: clipboard.size() > 1
POST: clipboard unchanged.
retrieve
in interface IClipboard
type
- edu.wpi.cs.cs509.graph.clipboard.IDataType
ClipboardException
- No such type exists in the clipboard.public IItem retrieveNth(int n) throws ClipboardException
PRE: clipboard.size() > n
POST: clipboard unchanged.
retrieveNth
in interface IClipboard
n
- int
ClipboardException
- If n is invalid given state of clipboard.public IItem retrieveNth(int n, IDataType type) throws ClipboardException
Note: This method is not yet implemented in Version 1.1
PRE: clipboard.size() > n
POST: clipboard unchanged.
retrieveNth
in interface IClipboard
n
- inttype
- edu.wpi.cs.cs509.graph.clipboard.IDataType
ClipboardException
- the nth object of type
does not exist in
clipboard.public void setAccessor(IClipboardAccessor ica)
setAccessor
in interface IClipboardGUI
ica
- edu.wpi.cs.cs509.graph.clipboard.IClipboardAccessorpublic void showClipboard(boolean flag)
If the clipboard is NOT operating in graphical mode, nothing happens.
showClipboard
in interface IClipboardGUI
public java.util.Enumeration types()
PRE: none
POST: clipboard unchanged.
types
in interface IClipboard
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |