public interface

IUnitFormatter

com.pnfsoftware.jeb.core.output.IUnitFormatter
Known Indirect Subclasses

Class Overview

A unit formatter is used to retrieve presentations of a unit. A unit is responsible for providing 0 or more document presentations, which can then be displayed by clients. Presentations held by the formatter are of two types: transient and persisted. Persisted presentations are serialized upon saving; care should be exercised to make sure that persisted documents do not contain references to transient documents.

  • Transient presentations: primary use is to hold dynamically-generated or internal documents generated by a unit at runtime. Most presentations fall into this category.
  • Persisted presentations: primary use is to hold documents generated by clients at runtime. Example: generation and addition of presentations by a plugin or script.

Adding and removing presentations is allowed. It is the responsibility of the client code to notify of such changes by issuing UnitChange events.

See Also

Summary

Public Methods
abstract void addPresentation(IUnitDocumentPresentation presentation, boolean persisted)
Add a presentation.
abstract void dispose()
DO NOT USER.
abstract List<IUnitDocumentPresentation> getDocumentPresentations()
This method has been deprecated; Use getPresentations().
abstract IUnitDocumentPresentation getPresentation(int index)
Retrieve a presentation.
abstract int getPresentationCount()
Get the number of document presentations contained in this formatter.
abstract List<IUnitDocumentPresentation> getPresentations()
Retrieve a list of all (persisted and transient) document presentations.
abstract void insertPresentation(int index, IUnitDocumentPresentation presentation, boolean persisted)
Insert a presentation at the given index.
abstract boolean isPersisted(int index)
Determine whether or not a presentation is to be persisted upon serialization.
abstract void removePresentation(int index)
Remove a presentation.

Public Methods

public abstract void addPresentation (IUnitDocumentPresentation presentation, boolean persisted)

Add a presentation. The presentation will be appended to the list of existing presentations. If the presentation already exists in this formatter, this method will silently fail.

Parameters
presentation the presentation
persisted true to persist the presentation, false otherwise; if true, the presentation must be serializable

public abstract void dispose ()

DO NOT USER. Dispose all documents in the presentations stored within this formatter. The entity that created the formatter is responsible for disposing of it.

public abstract List<IUnitDocumentPresentation> getDocumentPresentations ()

This method has been deprecated; Use getPresentations().

Returns
  • a list of document presentations, possibly empty

public abstract IUnitDocumentPresentation getPresentation (int index)

Retrieve a presentation.

Parameters
index presentation index
Returns
  • the presentation or null

public abstract int getPresentationCount ()

Get the number of document presentations contained in this formatter.

Returns
  • the number of presentations

public abstract List<IUnitDocumentPresentation> getPresentations ()

Retrieve a list of all (persisted and transient) document presentations. This list is a copy; any attempt to modify it will raise an exception.

Returns
  • a list of document presentations, possibly empty

public abstract void insertPresentation (int index, IUnitDocumentPresentation presentation, boolean persisted)

Insert a presentation at the given index. If the presentation already exists in this formatter, this method will silently fail.

Parameters
index insertion index
presentation the presentation
persisted true to persist the presentation, false otherwise; if true, the presentation must be serializable

public abstract boolean isPersisted (int index)

Determine whether or not a presentation is to be persisted upon serialization.

Parameters
index presentation index
Returns
  • persistence indicator

public abstract void removePresentation (int index)

Remove a presentation.

Parameters
index presentation index