Class TLcyLspPrintAddOn

java.lang.Object
com.luciad.lucy.addons.ALcyAddOn
com.luciad.lucy.addons.ALcyPreferencesAddOn
com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintAddOn

public class TLcyLspPrintAddOn extends ALcyPreferencesAddOn
Offers functionality to get a printed version of a Lightspeed map. By default, the following menu items are added to the menu bar of each map:
  1. Page Setup...: shows a page setup dialog.
  2. Print Preview...: shows a print preview dialog.
  3. Print...: shows a print dialog.
These actions can be customized in the configuration file of this add-on.

The page layout and its content is created as a printable component. These components are created by an 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.

Since:
2013.0
  • Constructor Details

    • TLcyLspPrintAddOn

      public TLcyLspPrintAddOn()
      Creates a new print add-on. To plug in the add-on, the plugInto method must also be called. This is typically done by a ILcyLucyEnv instance, upon request of the application front-end.
  • Method Details

    • plugInto

      public void plugInto(ILcyLucyEnv aLucyEnv)
      Description copied from class: ALcyPreferencesAddOn
      Creates and plugs in the add-on's preferences tool.
      Overrides:
      plugInto in class ALcyPreferencesAddOn
      Parameters:
      aLucyEnv - the Lucy environment to plug into
      See Also:
    • getPrintableComponentFactory

      public ALcyPrintableMapComponentFactory<ILcyLspMapComponent> getPrintableComponentFactory()
      Returns the ALcyPrintableMapComponentFactory that is used by this addon.
      Returns:
      the ALcyPrintableMapComponentFactory that is used by this addon.
    • setPrintableComponentFactory

      public void setPrintableComponentFactory(ALcyPrintableMapComponentFactory<ILcyLspMapComponent> aPrintableComponentFactory)
      Sets the ALcyPrintableMapComponentFactory that should be used by this addon.

      Please refer to TLcyLspPrintAddOn for more information.

      Parameters:
      aPrintableComponentFactory - The printable component factory.
    • getPrintPreviewFactory

      public ALcyPrintPreviewFactory<TLcyLspPrintContext> getPrintPreviewFactory()
      Returns the ALcyPrintPreviewFactory that is used by this addon.
      Returns:
      the ALcyPrintPreviewFactory that is used by this addon.
    • setPrintPreviewFactory

      public void setPrintPreviewFactory(ALcyPrintPreviewFactory<TLcyLspPrintContext> aPrintPreviewFactory)
      Sets the ALcyPrintPreviewFactory that should be used by this addon.

      Please refer to TLcyLspPrintAddOn for more information.

      Parameters:
      aPrintPreviewFactory - The print preview factory.
    • getProperties

      public TLcyProperties getProperties(ILcyLspMapComponent aMapComponent)
      Returns the 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.

      Parameters:
      aMapComponent - The map component to query.
      Returns:
      the TLcyProperties for the given map component.
    • createDefaultProperties

      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.

      Parameters:
      aMapComponent - The map component
      Returns:
      The initial TLcyProperties for the given map component.
      Since:
      2015.1.27
      See Also:
    • performQuickPrint

      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.

      Parameters:
      aProperties - The properties containing the desired print settings.
      aMapComponent - The map component which must be printed.
    • createPageDecorator

      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.

      Parameters:
      aPrintContext - the print context.
      Returns:
      a Printable that can be used to decorate each page.
    • createPrintPageable

      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.

      Parameters:
      aViewPageable - the Pageable that is capable to print the view.
      aPrintContext - the print context.
      Returns:
      the Pageable that is used for printing