|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CopyPasteManager
Interface to the IDES CopyPasteManager. The manager is responsible for keeping track of whether cut, copy and paste options should be available to the user. Registered UI elements are automatically updated with the changing status of the cut, copy and paste system. The CopyPasteManager keeps track of the active CopyPastePresentation, which is the presentation that is queried for cut, copy and paste enabled status and for appropriate actions. Also provides actions to overwrite those in default swing components if required.
| Method Summary | |
|---|---|
void |
bindCutCopy(javax.swing.AbstractButton element)
Registers an AbstractButton to be updated when the cut/copy state
changes. |
void |
bindPaste(javax.swing.AbstractButton element)
Registers an AbstractButton to be updated when the paste state
changes. |
CopyPastePresentation |
getActiveCopyPastePresentation()
Returns the active CopyPastePresentation, or null if there
is no currently active CopyPastePresentation. |
java.awt.datatransfer.Clipboard |
getClipboard()
Returns the clipboard used by IDES. |
javax.swing.Action |
getCopyOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. |
javax.swing.Action |
getCutOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. |
javax.swing.Action |
getPasteOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. |
void |
refresh()
Updates the enabled status of the cut/copy/paste items on the menu and toolbar. |
void |
unbind(javax.swing.AbstractButton element)
Unregisters an AbstractButton so that it is no longer updated
when the cut/copy/paste state changes. |
| Method Detail |
|---|
void bindCutCopy(javax.swing.AbstractButton element)
AbstractButton to be updated when the cut/copy state
changes.
element - the UI element to be registered for automatic updatesvoid bindPaste(javax.swing.AbstractButton element)
AbstractButton to be updated when the paste state
changes.
element - the UI element to be registered for automatic updatesvoid unbind(javax.swing.AbstractButton element)
AbstractButton so that it is no longer updated
when the cut/copy/paste state changes.
element - the UI element to be unregistered from automatic updatesvoid refresh()
Updates the enabled status of the cut/copy/paste items on the menu and toolbar. If the clipboard contents have changed, calls newItemOnClipboard on the active CopyPastePresentation. Refreshes whenever there is a new active CopyPastePresentation or any of the other presentations call this method.
CopyPastePresentations should call this method when there is a change in some aspect such as a selection that could change whether cut, copy and paste should be enabled.
java.awt.datatransfer.Clipboard getClipboard()
CopyPastePresentation getActiveCopyPastePresentation()
null if there
is no currently active CopyPastePresentation.
null if there
is no currently active CopyPastePresentation.javax.swing.Action getCutOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. This action is meant to overwrite the default cut action in the ActionMap of a swing component.
An example of this is copy and pasting events represented in a JTable. In order to integrate with the IDES copy and paste system, and call the proper action defined in CopyPastePresentation's getCutAction(), the ActionMap must be overwritten as follows:
JTable table = new JTable();
Action cutAction = Hub.getCopyPasteManager().getCutOverwriteAction();
Action copyAction = Hub.getCopyPasteManager().getCopyOverwriteAction();
Action pasteAction = Hub.getCopyPasteManager().getPasteOverwriteAction();
table.getActionMap().put("cut", cutAction);
table.getActionMap().put("copy", copyAction);
table.getActionMap().put("paste", pasteAction);
javax.swing.Action getCopyOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. This action is meant to overwrite the default cut action in the ActionMap of the swing component.
An example of this is copy and pasting events represented in a JTable. In order to integrate with the IDES copy and paste system, and call the proper action defined in CopyPastePresentation's getCopyAction(), the ActionMap must be overwritten as follows:
JTable table = new JTable();
Action cutAction = Hub.getCopyPasteManager().getCutOverwriteAction();
Action copyAction = Hub.getCopyPasteManager().getCopyOverwriteAction();
Action pasteAction = Hub.getCopyPasteManager().getPasteOverwriteAction();
table.getActionMap().put("cut", cutAction);
table.getActionMap().put("copy", copyAction);
table.getActionMap().put("paste", pasteAction);
javax.swing.Action getPasteOverwriteAction()
In order for copy and paste to work for swing components that already have a copy and paste implementation, the default functionality must be overwritten. This action is meant to overwrite the default cut action in the ActionMap of the swing component.
An example of this is copy and pasting events represented in a JTable. In order to integrate with the IDES copy and paste system, and call the proper action defined in CopyPastePresentation's getPasteAction(), the ActionMap must be overwritten as follows:
JTable table = new JTable();
Action cutAction = Hub.getCopyPasteManager().getCutOverwriteAction();
Action copyAction = Hub.getCopyPasteManager().getCopyOverwriteAction();
Action pasteAction = Hub.getCopyPasteManager().getPasteOverwriteAction();
table.getActionMap().put("cut", cutAction);
table.getActionMap().put("copy", copyAction);
table.getActionMap().put("paste", pasteAction);
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||