Package org.eclipse.birt.report.model.api.util

# Class CopyUtil

java.lang.Object
org.eclipse.birt.report.model.api.util.CopyUtil

public class CopyUtil extends Object
The utility class for copy/paste. It is for the UI usage. Other uses should use `DesignElementHandle.copy()`.

## Constructor Summary

Constructors
Constructor
Description
`CopyUtil()`

## Method Summary

Modifier and Type
Method
Description
`static IPasteStatus`
`canPaste(IElementCopy copy, DesignElementHandle container, int slotID)`
/** Checks whether the given copy can be pasted into the given slot of the specified element.
`static IPasteStatus`
`canPaste(IElementCopy copy, DesignElementHandle container, String propName)`
/** Checks whether the given copy can be pasted into the given slot of the specified element.
`static IElementCopy`
`copy(DesignElementHandle source)`
Returns the copy of the current element.
`static List`
`paste(IElementCopy copy, DesignElementHandle container, int slotID)`
Pastes a report item to the slot.
`static List`
`paste(IElementCopy copy, DesignElementHandle container, int slotID, int newPos)`
Pastes a report item to the slot.
`static List`
`paste(IElementCopy copy, DesignElementHandle container, String propName)`
Pastes a report item to the slot.
`static List`
`paste(IElementCopy copy, DesignElementHandle container, String propName, int newPos)`
Pastes a report item to the slot.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CopyUtil

public CopyUtil()

## Method Details

### copy

public static IElementCopy copy(DesignElementHandle source)
Returns the copy of the current element.

Parameters:
  `source` - the given element
Returns:
  the copy of the given element

### paste

public static List paste(IElementCopy copy, DesignElementHandle container, int slotID) throws SemanticException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
  `copy` - the copy from the return value of `copy`
  `container` - the target container
  `slotID` - the id of the target slot
Returns:
  a list containing all errors for the pasted element
Throws:
  `SemanticException` - if the element is not allowed in the slot

### paste

public static List paste(IElementCopy copy, DesignElementHandle container, int slotID, int newPos) throws SemanticException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
  `copy` - the copy from the return value of `copy`
  `container` - the target container
  `slotID` - the id of the target slot
  `newPos` - the target position
Returns:
  a list containing all errors for the pasted element
Throws:
  `SemanticException` - if the element is not allowed in the slot

### paste

public static List paste(IElementCopy copy, DesignElementHandle container, String propName) throws SemanticException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
  `copy` - the copy from the return value of `copy`
  `container` - the target container
  `propName` - the property name of the target container
Returns:
  a list containing all errors for the pasted element
Throws:
  `SemanticException` - if the element is not allowed in the slot

### paste

public static List paste(IElementCopy copy, DesignElementHandle container, String propName, int newPos) throws SemanticException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
  `copy` - the copy from the return value of `copy`
  `container` - the target container
  `propName` - the property name of the target container
  `newPos` - the target position
Returns:
  a list containing all errors for the pasted element
Throws:
  `SemanticException` - if the element is not allowed in the slot

### canPaste

public static IPasteStatus canPaste(IElementCopy copy, DesignElementHandle container, int slotID)
/** Checks whether the given copy can be pasted into the given slot of the specified element.

Parameters:
  `copy` - the copied instance
  `container` - the target element
  `slotID` - the target slot id
Returns:
  `true` is the copy is good for pasting. Otherwise `false`.

### canPaste

public static IPasteStatus canPaste(IElementCopy copy, DesignElementHandle container, String propName)
/** Checks whether the given copy can be pasted into the given slot of the specified element.

Parameters:
  `copy` - the copied instance
  `container` - the target element
  `propName` - the target property name
Returns:
  `true` is the copy is good for pasting. Otherwise `false`.