org.openbp.cockpit.modeler
Class ClipboardSupport

java.lang.Object
  extended by org.openbp.cockpit.modeler.ClipboardSupport

public class ClipboardSupport
extends java.lang.Object

Helper class that contains functions for the modeler clipboard support.

Author:
Heiko Erhardt

Constructor Summary
ClipboardSupport(WorkspaceDrawingView workspaceView, ResourceCollection resourceCollection, boolean socketsAndParamsOnly)
          Private constructor prevents instantiation.
 
Method Summary
 boolean canCopy()
          Checks if a copy action can be performed.
 boolean canCut()
          Checks if a cut action can be performed.
 boolean canDelete()
          Checks if a delete action can be performed.
 boolean canPaste(java.awt.datatransfer.Transferable content)
          Checks whether the actual clipboard contents can be pasted.
 java.awt.datatransfer.Transferable cut()
          Cuts the current selection and creates a transferable object that contains the data to be copied from the given modeler view.
 void delete()
          Deletes the current selection.
 java.awt.datatransfer.Transferable getCopyData()
          Creates a transferable object that contains the data to be copied from the given modeler view.
 void paste(java.awt.datatransfer.Transferable content)
          Pastes data from the given transferable to the modeler view.
 boolean pasteParams(ProcessItem source)
          Pastes parameters from the given source process to the modeler view.
 boolean pasteProcess(ProcessItem source)
          Pastes nodes and control/data links from the given source process to the modeler view.
 boolean pasteQualifier(ModelQualifier source)
          Pastes a model qualifier to a placeholder node.
 boolean pasteSockets(ProcessItem source)
          Pastes sockets from the given source process to the modeler view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClipboardSupport

public ClipboardSupport(WorkspaceDrawingView workspaceView,
                        ResourceCollection resourceCollection,
                        boolean socketsAndParamsOnly)
Private constructor prevents instantiation.

Parameters:
workspaceView - Workspace view we are associated with
resourceCollection - Resource for messages
socketsAndParamsOnly - true: Allows for socket and parameter pasting only.
false: Allows for pasting all supported items.
Method Detail

canCopy

public boolean canCopy()
Checks if a copy action can be performed.

Returns:
true: Process nodes, sockets or parameters are selected.
false: No appropriate object is selected.

canDelete

public boolean canDelete()
Checks if a delete action can be performed.

Returns:
true: Process nodes, sockets or parameters are selected.
false: No appropriate object is selected.

canCut

public boolean canCut()
Checks if a cut action can be performed.

Returns:
true: Process nodes, sockets or parameters are selected.
false: No appropriate object is selected.

getCopyData

public java.awt.datatransfer.Transferable getCopyData()
Creates a transferable object that contains the data to be copied from the given modeler view. The transferable includes all objects that are currently selected. Depending on the type of selected objects, this may be:
- A set of nodes and the links connecting the nodes
- A set of sockets
- A set of parameters of a socket

Returns:
The transferable or null if there is no appropriate selection

cut

public java.awt.datatransfer.Transferable cut()
Cuts the current selection and creates a transferable object that contains the data to be copied from the given modeler view.

Returns:
The transferable or null if there is no appropriate selection

delete

public void delete()
Deletes the current selection.


canPaste

public boolean canPaste(java.awt.datatransfer.Transferable content)
Checks whether the actual clipboard contents can be pasted.

Parameters:
content - Transferable object held by the clipboard
Returns:
true: The clipboard contains process nodes, sockets or parameters is selected.
false: The clipboard contains no appropriate objects.

paste

public void paste(java.awt.datatransfer.Transferable content)
Pastes data from the given transferable to the modeler view.

Parameters:
content - Content to paste; The transferable object is expected to contain data that was created by the getCopyData() method.

pasteProcess

public boolean pasteProcess(ProcessItem source)
                     throws java.lang.CloneNotSupportedException
Pastes nodes and control/data links from the given source process to the modeler view.

Parameters:
source - Process that contains the nodes to paste
Throws:
java.lang.CloneNotSupportedException

pasteSockets

public boolean pasteSockets(ProcessItem source)
                     throws java.lang.CloneNotSupportedException
Pastes sockets from the given source process to the modeler view.

Parameters:
source - Process that contains the sockets to paste
Throws:
java.lang.CloneNotSupportedException

pasteParams

public boolean pasteParams(ProcessItem source)
                    throws java.lang.CloneNotSupportedException
Pastes parameters from the given source process to the modeler view.

Parameters:
source - Process that contains the parameters to paste
Throws:
java.lang.CloneNotSupportedException

pasteQualifier

public boolean pasteQualifier(ModelQualifier source)
Pastes a model qualifier to a placeholder node.

Parameters:
source - Model qualifier of the object to reference


Copyright © 2011. All Rights Reserved.