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

# Interface IElementCommand

All Known Implementing Classes:
  `ElementCommand`

public interface IElementCommand
Represents a extended element command that is integrated with the BIRT command stack. Note that BIRT commands cannot fail. BIRT assumes that all semantic or other checking has been done before executing the command. (BIRT itself divides the command mechanism into two layers: a command that does the checking and can perform multiple operations, and an activity record that records the low-level undo/redo information. This object is analogous to a BIRT activity record.)

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canRedo()`
Tells if this record can be redone.
`boolean`
`canUndo()`
Tells if this record can be undone.
`void`
`execute()`
Executes the record.
`DesignElementHandle`
`getElementHandle()`
Gets the extendedItem handle from the extension user.
`String`
`getLabel()`
Gets the label of this record.
`void`
`redo()`
Redoes the record.
`void`
`undo()`
Undoes the record.

## Method Details

### execute

void execute()
Executes the record. Derived classes do the desired operation. All semantic and other checks must have already been done; the record operation must succeed.

### undo

void undo()
Undoes the record. Leaves the state of the IR identical to what it was before execute was called. Note that the operation must be designed so that it succeeds if the IR is in the correct state: the same state it was in after execute( ) was called. (If the IR is in any other state, then a programming error has occurred.)

### redo

void redo()
Redoes the record. Logically repeats the execute record. The state of the IR must be identical to that after undo( ) has executed. After the call, the state of the IR must be identical to that after execute( ) was called.

### canUndo

boolean canUndo()
Tells if this record can be undone. All records should be undoable in the production system. A record may temporarily not support undo during a development cycle.

Returns:
  true if the record can be undone, false otherwise

### canRedo

boolean canRedo()
Tells if this record can be redone. All records should be redoable in the production system. A record may temporarily not support redo during a development cycle.

Returns:
  true if redoable, false otherwise.

### getLabel

String getLabel()
Gets the label of this record. This label should be localized. The label is optional.

Returns:
  the label of this record

### getElementHandle

DesignElementHandle getElementHandle()
Gets the extendedItem handle from the extension user. This is for sending notifications.

Returns:
  the ExtendedItem handle