java.lang.Object | ||
↳ | com.pnfsoftware.jeb.core.units.impl.WrapperUnit<T extends com.pnfsoftware.jeb.core.units.IUnit> | |
↳ | com.pnfsoftware.jeb.core.units.impl.InteractiveWrapperUnit |
Simple wrapper (decorator) for IInteractiveUnit
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
InteractiveWrapperUnit(IInteractiveUnit unit, IUnitProvider provider) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
IInputLocation |
addressToLocation(String address)
Convert a unit-specific address to location information relative to the input.
| ||||||||||
boolean |
canExecuteAction(ActionContext actionContext)
Verify if an action can be executed.
| ||||||||||
boolean |
executeAction(ActionContext actionContext, IActionData actionData, boolean notify)
Execute an action and optionally notify clients if the action was executed successfully and
modified the unit contents.
| ||||||||||
boolean |
executeAction(ActionContext actionContext, IActionData actionData)
Execute an action.
| ||||||||||
List<Integer> |
getAddressActions(String address)
Provide a list of actions that may be executed at the given address.
| ||||||||||
String |
getAddressLabel(String address)
Retrieve the label at a given address.
| ||||||||||
Map<String, String> |
getAddressLabels()
Retrieve all labels.
| ||||||||||
String |
getAddressOfItem(long id)
Attempt to determine the best address for a given item.
| ||||||||||
List<Integer> |
getGlobalActions()
Provide a list of actions that may be executed globally.
| ||||||||||
String |
getInlineComment(String address)
Retrieve the primary comment at a given address.
| ||||||||||
Map<String, String> |
getInlineComments()
Retrieve all primary comments.
| ||||||||||
List<Integer> |
getItemActions(long id)
Provide a list of actions that may be executed on the item with the given id.
| ||||||||||
long |
getItemAtAddress(String address)
Attempt to determine the best item for a given address.
| ||||||||||
Object |
getItemObject(long id)
Optionally provide an object associated with the given item.
| ||||||||||
IMetadataManager |
getMetadataManager()
Get a reference to the metadata manager for this unit.
| ||||||||||
List<Long> |
getRelatedItems(long id)
Retrieve items related to the provided item id.
| ||||||||||
boolean |
isValidAddress(String address)
Determine if the provided address is a valid address for this unit.
| ||||||||||
String |
locationToAddress(IInputLocation location)
Convert a location relative to the input to a unit-specific address.
| ||||||||||
boolean |
prepareExecution(ActionContext actionContext, IActionData actionData)
Prepare the execution of an action.
| ||||||||||
boolean |
setInlineComment(String address, String comment)
Set or delete the primary comment at a given address.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.pnfsoftware.jeb.core.units.impl.WrapperUnit
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.IUnitCreator
| |||||||||||
From interface
com.pnfsoftware.jeb.core.IUserDataSupport
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IAddressableUnit
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IInteractiveUnit
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IUnit
| |||||||||||
From interface
com.pnfsoftware.jeb.corei.IWrap
| |||||||||||
From interface
com.pnfsoftware.jeb.util.events.IEventSource
|
unit | IUnit to be delegated |
---|---|
provider | provider that extends the unit behavior |
Convert a unit-specific address to location information relative to the input. The default implementation returns null.
Example: the location information could contain an (offset, size) tuple if the input is a
sequence of bytes, such as for IBinaryUnit
.
Note: The addressing scheme is unit specific, and defined by the plugin developer. Addresses should not start with the reserved '@' prefix.
address | mandatory address |
---|
Verify if an action can be executed. Clients must call this method before attempting to call
prepareExecution
or
executeAction
.
actionContext | location context for the action |
---|
Execute an action and optionally notify clients if the action was executed successfully and modified the unit contents.
Note: setting `notify` to false can be handy when executing many actions in a short time span
(which could result in many events being generated). However, since clients will not be
notified that the unit has changed, it is good practice for code to manually issue a single
UnitChange
after the unit has received that series of modification.
actionContext | context for the action |
---|---|
actionData | data for the action |
notify | true to notify clients if the action was successfully executed and the unit contents has changed |
Execute an action. On success, the plugin should notify listeners if the unit contents has
changed, by issuing a UnitChange
event.
actionContext | location context for the action |
---|---|
actionData | data for the action |
Provide a list of actions that may be executed at the given address. Global actions should not be returned by this method, even though they may be executed on the given (or any) address as well.
address | the target address |
---|
Retrieve the label at a given address. The default implementation returns null.
address | mandatory address |
---|
Retrieve all labels. The default implementation returns an empty map.
Attempt to determine the best address for a given item. Implementors may return null if a conversion is deemed impossible, inaccurate or irrelevant.
Clients use this method to provide navigation capability, for example, jumping from an item to the master (main) related item, that would be located at the resulting address.
Plugin developers are recommended to implement this method.
id | the item id |
---|
Provide a list of actions that may be executed globally.
Retrieve the primary comment at a given address. The default implementation returns null.
address | mandatory address |
---|
Retrieve all primary comments. The default implementation returns an empty map.
Provide a list of actions that may be executed on the item with the given id. Global actions should not be returned by this method, even though they may be executed on the given (or any) item id as well.
id | the target item identifier |
---|
Attempt to determine the best item for a given address. Implementors may return 0 if a conversion is deemed impossible, inaccurate or irrelevant.
address | the address |
---|
Optionally provide an object associated with the given item. This method may return null, an opaque object, or an object defined by the contract of the implementing object or sub-interface. The SPI of sub-interfaces should specify the item id formats, if any, as well as types and semantics associated with the objects returned by this method.
id | the item id |
---|
Get a reference to the metadata manager for this unit. The metadata manager is optional;
units may decide to not provide one. Units inheriting from AbstractInteractiveUnit
or
AbstractInteractiveBinaryUnit
do offer a default metadata
manager
.
Retrieve items related to the provided item id. The definition and context of 'relation' is implementation dependent.
id | an item id |
---|
Determine if the provided address is a valid address for this unit.
Convert a location relative to the input to a unit-specific address. The default implementation returns null.
Note: The addressing scheme is unit specific, and defined by the plugin developer. Addresses should not start with the reserved '@' prefix.
location | mandatory location |
---|
Prepare the execution of an action. Clients must call this method before attempting to call
executeAction
.
actionContext | location context for the action |
---|---|
actionData | data for the action |
Set or delete the primary comment at a given address. The default implementation returns false.
comment | the new comment; null to remove any previous comment |
---|