public class TLcyLspPrintAddOn extends ALcyPreferencesAddOn
ALcyPrintableMapComponentFactory
. The factory instance
can be explicitly set by using setPrintableComponentFactory
or the class can be set by using the configuration file. If no factory is set, a default factory
will be used.
The content of the print preview dialog is created by a ALcyLspPrintPreviewFactory
. The
factory instance can be explicitly set by using setPrintPreviewFactory
or the class
can be set by using the configuration file. If no factory is set, a default factory will be used.
A TLcyProperties
object is created for every map component. It contains the current
stored values of the properties used in the print addon. Initially all configured properties from the
configuration file are added. Afterwards, the object is updated each time a property has changed eg.
the page orientation, the visibility of the footer text,...
The keys that can be used to retrieve
information from or set information to the properties (using for example get
)
are the constants of the TLcyPrintAddOn
class ending in KEY
, e.g., TLcyPrintAddOn.PAGE_FORMAT_KEY
,
TLcyPrintAddOn.HEADER_TEXT_SELECTED_KEY
, ... The value that can be expected for every key is documented
in the key constant itself, the default value is specified in constants ending in VALUE_DEFAULT
.
It is possible to decorate each printed page by overriding createPageDecorator
, or to add printed pages by overriding
createPrintPageable
. For more
information, see the javadoc of these methods.
Constructor and Description |
---|
TLcyLspPrintAddOn()
Creates a new print add-on.
|
Modifier and Type | Method and Description |
---|---|
protected TLcyProperties |
createDefaultProperties(ILcyLspMapComponent aMapComponent)
This method is used by the
getProperties(ILcyLspMapComponent) method to retrieve
the properties for a certain map component the first time printing is triggered for that map component. |
Printable |
createPageDecorator(TLcyLspPrintContext aPrintContext)
Creates a
Printable that can be used to decorate each page. |
Pageable |
createPrintPageable(Pageable aViewPageable,
TLcyLspPrintContext aPrintContext)
Returns the
Pageable that is used for printing (not for preview printing),
based on the given Pageable . |
ALcyPrintableMapComponentFactory<ILcyLspMapComponent> |
getPrintableComponentFactory()
Returns the
ALcyPrintableMapComponentFactory that is used by this addon. |
ALcyPrintPreviewFactory<TLcyLspPrintContext> |
getPrintPreviewFactory()
Returns the
ALcyPrintPreviewFactory that is used by this addon. |
TLcyProperties |
getProperties(ILcyLspMapComponent aMapComponent)
Returns the
TLcyProperties for the given map component. |
void |
performQuickPrint(TLcyProperties aProperties,
ILcyLspMapComponent aMapComponent)
Trigger the print action for
aMapComponent with aProperties
containing all desired settings. |
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's preferences tool.
|
void |
setPrintableComponentFactory(ALcyPrintableMapComponentFactory<ILcyLspMapComponent> aPrintableComponentFactory)
Sets the
ALcyPrintableMapComponentFactory that should be used by this addon. |
void |
setPrintPreviewFactory(ALcyPrintPreviewFactory<TLcyLspPrintContext> aPrintPreviewFactory)
Sets the
ALcyPrintPreviewFactory that should be used by this addon. |
createPreferencesTool, getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix, unplugFrom
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
public TLcyLspPrintAddOn()
plugInto
method must also be called.
This is typically done by a ILcyLucyEnv
instance, upon request of the application front-end.public void plugInto(ILcyLucyEnv aLucyEnv)
ALcyPreferencesAddOn
plugInto
in class ALcyPreferencesAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public ALcyPrintableMapComponentFactory<ILcyLspMapComponent> getPrintableComponentFactory()
ALcyPrintableMapComponentFactory
that is used by this addon.ALcyPrintableMapComponentFactory
that is used by this addon.public void setPrintableComponentFactory(ALcyPrintableMapComponentFactory<ILcyLspMapComponent> aPrintableComponentFactory)
ALcyPrintableMapComponentFactory
that should be used by this addon.
Please refer to TLcyLspPrintAddOn
for more information.aPrintableComponentFactory
- The printable component factory.public ALcyPrintPreviewFactory<TLcyLspPrintContext> getPrintPreviewFactory()
ALcyPrintPreviewFactory
that is used by this addon.ALcyPrintPreviewFactory
that is used by this addon.public void setPrintPreviewFactory(ALcyPrintPreviewFactory<TLcyLspPrintContext> aPrintPreviewFactory)
ALcyPrintPreviewFactory
that should be used by this addon.
Please refer to TLcyLspPrintAddOn
for more information.aPrintPreviewFactory
- The print preview factory.public TLcyProperties getProperties(ILcyLspMapComponent aMapComponent)
TLcyProperties
for the given map component. These are the current
stored values of the properties used in the print addon.
Please refer to TLcyLspPrintAddOn
for more information.
Note that if you want to change the default properties (=the properties used the first time
printing is triggered for a certain map component), it is best to override the createDefaultProperties(ILcyLspMapComponent)
method instead.aMapComponent
- The map component to query.TLcyProperties
for the given map component.protected TLcyProperties createDefaultProperties(ILcyLspMapComponent aMapComponent)
This method is used by the getProperties(ILcyLspMapComponent)
method to retrieve
the properties for a certain map component the first time printing is triggered for that map component.
By default this method returns a TLcyProperties
instance containing the settings defined in the
configuration file.
You can override this method to for example add extra settings to those properties.
Note that you can add those extra settings as well by putting them in the configuration file.
It is important that this method always returns a new TLcyProperties
instance to avoid that
changing the settings of one map component would affect the settings of another map component.
aMapComponent
- The map componentTLcyProperties
for the given map component.getProperties(ILcyLspMapComponent)
public void performQuickPrint(TLcyProperties aProperties, ILcyLspMapComponent aMapComponent)
Trigger the print action for aMapComponent
with aProperties
containing all desired settings.
This method allows you to perform a print action through the API.
aProperties
- The properties containing the desired print settings.aMapComponent
- The map component which must be printed.public Printable createPageDecorator(TLcyLspPrintContext aPrintContext)
Creates a Printable
that can be used to decorate each page. It is for example possible
to add a watermark to each page by overriding this method.
By default, this method returns null
, meaning that no decorations are added.
aPrintContext
- the print context.Printable
that can be used to decorate each page.public Pageable createPrintPageable(Pageable aViewPageable, TLcyLspPrintContext aPrintContext)
Returns the Pageable
that is used for printing (not for preview printing),
based on the given Pageable
. The given Pageable
is used to print
the view. Override this method to return a custom Pageable
, e.g. by wrapping
the given Pageable
. It is for example possible to add a title page by overriding
this method.
By default, this method returns aViewPageable
.
aViewPageable
- the Pageable
that is capable to print the view.aPrintContext
- the print context.Pageable
that is used for printing