| java.lang.Object | ||
| ↳ | com.pnfsoftware.jeb.core.events.JebEventSource | |
| ↳ | com.pnfsoftware.jeb.core.units.AbstractUnit | |
Known Direct Subclasses
|
Known Indirect Subclasses
|
Skeleton implementation for an IUnit. It is highly recommended that plugins extend this
class or one of the its subclasses instead of implementing IUnit entirely.
Implementors must implement their own constructor; the default constructor is used for deserialization only. Example of a typical unit constructor:
public DerivedClass(String name, IUnitProcessor unitProcessor, IUnitCreator parent,
IPropertyDefinitionManager pdm) {
super(..., name, unitProcessor, parent, pdm);
...
}
Notes on persistence:
canBePersisted() returns true.IUnitFormatter for more information.custom deserializer.| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
AbstractUnit(String formatType, String name, IUnit parent)
Build a new child from parent
IUnit | |||||||||||
|
AbstractUnit(String formatType, String name, IUnitProcessor unitProcessor, IUnitCreator parent, IPropertyDefinitionManager pdm)
Initialize a new unit object.
| |||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AbstractUnit() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
addChild(IUnit unit)
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| void |
addChild(IUnit unit, boolean persisted)
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| void |
addChildUnit(IUnit unit)
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| final void | addNotification(IUnitNotification notification) | ||||||||||
| boolean |
canBePersisted()
Determine if this unit can be persisted.
| ||||||||||
| void |
dispose()
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| List<? extends IUnit> |
getChildren()
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| ICommandInterpreter |
getCommandInterpreter()
Get a command interpreter provided by the unit, if any.
| ||||||||||
| long |
getCreationTimestamp()
Get the date of creation of this unit.
| ||||||||||
| String |
getDescription()
Get a description string for that unit.
| ||||||||||
| String |
getFormatType()
Mandatory unit type.
| ||||||||||
| IUnitFormatter |
getFormatter()
Retrieve a fresh formatter for that unit.
| ||||||||||
| byte[] |
getIconData()
The icon bytes representing units of such type.
| ||||||||||
| String |
getName()
Get the unit name.
| ||||||||||
| String |
getNotes()
Get user-defined notes.
| ||||||||||
| IUnitNotificationManager |
getNotificationManager()
Get a reference to the notification manager.
| ||||||||||
| IUnitCreator |
getParent()
Retrieve the creator (or parent) of this unit.
| ||||||||||
| IPropertyDefinitionManager |
getPropertyDefinitionManager()
Retrieve the PDM used by this unit.
| ||||||||||
| IPropertyManager |
getPropertyManager()
Retrieve the PM used by this unit.
| ||||||||||
| String |
getStatus()
Get the status for the unit.
| ||||||||||
| IUnitProcessor |
getUnitProcessor()
Retrieve the unit processor used by this unit.
| ||||||||||
| void |
initializePropertyObjects(IUnitCreator parent, IUnitProcessor processor, IPropertyDefinitionManager pdm)
Overrides are allowed.
| ||||||||||
| boolean |
isProcessed()
Verify if the unit was successfully processed.
| ||||||||||
| boolean |
isTransientChild(IUnit unit)
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| void |
onPropertyChange(String fqPropertyName)
This method is called when a project property is changed.
| ||||||||||
| void |
removeChild(IUnit unit)
Sub-classes overriding this method must override related methods consistently.
| ||||||||||
| void |
setName(String name)
Set the unit name.
| ||||||||||
| void |
setNotes(String notes)
Set user-defined notes.
| ||||||||||
| void |
setParent(IUnitCreator parent)
Set the parent unit or artifact.
| ||||||||||
| final void |
setProcessed(boolean processed)
Mark the unit as processed and notify the client.
| ||||||||||
| void |
setProcessed(boolean processed, boolean notify)
Mark the unit as processed and optionally notify clients by issuing a
UnitChange
event. | ||||||||||
| void |
setStatus(String status)
Set the plugin status.
| ||||||||||
| void | setStatus(String status, boolean notify) | ||||||||||
| void |
setUnitProcessor(IUnitProcessor processor)
Set the unit processor.
| ||||||||||
| String | toString() | ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void | addChild(IUnit unit, boolean persisted, boolean notify) | ||||||||||
| void | removeChild(IUnit unit, boolean notify) | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.pnfsoftware.jeb.core.events.JebEventSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IUnit
| |||||||||||
From interface
com.pnfsoftware.jeb.util.events.IEventSource
| |||||||||||
Build a new child from parent IUnit
| formatType | the mandatory format type, normally one provided by the identifier |
|---|---|
| name | the unit name |
| parent | the parent unit |
Initialize a new unit object.
The PDM is provided by the IUnitIdentifier (if created from there). Else, it can be provided manually by the caller. If pdm is null, an unattached PDM will be created with no property and a region name matching the unit formatType.
| formatType | the mandatory format type, normally one provided by the identifier |
|---|---|
| name | the unit name |
| unitProcessor | the unit processor |
| parent | the parent unit or artifact |
| pdm | optional an optional property definition manager |
Sub-classes overriding this method must override related methods consistently.
| unit | the child unit |
|---|
Sub-classes overriding this method must override related methods consistently.
| unit | the child unit |
|---|---|
| persisted | true if the unit should be persisted upon project saving |
Sub-classes overriding this method must override related methods consistently.
| unit | the child unit |
|---|
Determine if this unit can be persisted. This method can be used by parent units and client code to verify if a child unit can legally be persisted.
Sub-classes overriding this method must override related methods consistently.
Sub-classes overriding this method must override related methods consistently.
Get a command interpreter provided by the unit, if any.
Get the date of creation of this unit.
Get a description string for that unit.
Mandatory unit type. The type should be unique across all units. It should be the same as the
identifier's type.
Retrieve a fresh formatter for that unit. Formatters are used to produce document outputs, that represent the unit in whole or in part.
The icon bytes representing units of such type. Typically, the data represents a 16x16 BMP or PNG image. Clients may use this data to represent labels for such units in a graphical way.
Get the unit name.
Get user-defined notes. The notes can be textual data of any sort.
Get a reference to the notification manager.
Retrieve the creator (or parent) of this unit. It can be a parent unit or a live artifact, for top-level units.
Retrieve the PDM used by this unit. For consistency, it is recommend that all units of a given type return equivalent PDMs.
Retrieve the PM used by this unit.
Get the status for the unit. Plugins should set a status if processing failed. Implementors
must notify their listeners by issuing a UnitStatusChanged event.
Retrieve the unit processor used by this unit.
Overrides are allowed. If so, super.initializePropertyObjects() must be called
first.
| parent | the parent unit or artifact |
|---|---|
| processor | the processor |
| pdm | the property definition manager for units of this type |
Verify if the unit was successfully processed.
Sub-classes overriding this method must override related methods consistently.
| unit | the child unit |
|---|
This method is called when a project property is changed. The default implementation does nothing: Implementors may safely override. Note that project-wide properties are being tracked, not solely those defined by the current unit's identifier.
Sub-classes overriding this method must override related methods consistently.
| unit | the unit removed |
|---|
Set the unit name.
| name | the unit name |
|---|
Set user-defined notes. The notes can be textual data of any sort.
| notes | the notes |
|---|
Set the parent unit or artifact.
| parent | the parent |
|---|
Mark the unit as processed and notify the client. Same as
setProcessed(processed, true).
Mark the unit as processed and optionally notify clients by issuing a UnitChange
event. Implementors wishing to override this method must also override isProcessed()
.
Set the plugin status. This method also takes care of notifying listeners by issuing a
UnitStatusChanged event.
| status | the new status |
|---|
Set the unit processor. This method is called by the managing project or (engines) context.
| processor | the unit processor |
|---|