Class TLcyPrintAreaCustomizerFactory

java.lang.Object
com.luciad.lucy.addons.print.TLcyPrintAreaCustomizerFactory
All Implemented Interfaces:
ILcyCustomizerPanelFactory, ILcyObjectCustomizerFactory

public class TLcyPrintAreaCustomizerFactory extends Object implements ILcyObjectCustomizerFactory, ILcyCustomizerPanelFactory
This factory creates the Customizer or ILcyCustomizerPanel (the GUI) that allows the user to edit the print area when it is selected.

This implementation creates a panel containing two customizer panels. The top panel lets the user modify the page orientation (portrait or landscape) of the print area. The bottom panel lets the user modify the properties corresponding to the printing area. This panel allows to type in the page row count, the page column count, the scale and to change the 'snap to pages' checkbox.

To replace the GUI with a custom one, create an extension of this class that overwrites the method createPrintAreaCustomizerPanelContent(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.lucy.util.context.TLcyDomainObjectContext) and configure the TLcyPrintAddOn to use that extension.

  • Field Details

    • PRINTER_SETTINGS_PANEL

      public static final int PRINTER_SETTINGS_PANEL
      The id for creating the printer settings ILcyCustomizerPanel. It allows to choose the page orientation.
      See Also:
    • PRINTING_AREA_PANEL

      public static final int PRINTING_AREA_PANEL
      The id for creating the settings ILcyCustomizerPanel corresponding to the printing area. It allows the user to select the number of pages, the scale, ...
      See Also:
  • Constructor Details

    • TLcyPrintAreaCustomizerFactory

      public TLcyPrintAreaCustomizerFactory()
      Default constructor. Creates a new TLcyPrintAreaCustomizerFactory. Note that you will have to set an ILcyLucyEnv before this instance can be used.
    • TLcyPrintAreaCustomizerFactory

      public TLcyPrintAreaCustomizerFactory(ILcyLucyEnv aLucyEnv)
      Creates a new TLcyPrintAreaCustomizerFactory.
      Parameters:
      aLucyEnv - The lucy environment, contextual information.
  • Method Details

    • setLucyEnv

      public void setLucyEnv(ILcyLucyEnv aLucyEnv)
      Sets the Lucy environment to which this customizer factory belongs.
      Parameters:
      aLucyEnv - The Lucy environment to which this customizer factory belongs.
    • getLucyEnv

      public ILcyLucyEnv getLucyEnv()
      Returns the Lucy environment to which this customizer factory belongs.
      Returns:
      The Lucy environment to which this customizer factory belongs.
    • createObjectCustomizerDisplayName

      @Deprecated public String createObjectCustomizerDisplayName(Object aObject, ILcdModel aModel, ILcdGXYView aView)
      Deprecated.
      Use methods of ILcyCustomizerPanelFactory instead.
      Description copied from interface: ILcyObjectCustomizerFactory
      Returns a display name for the customizer that will be created by createObjectCustomizer( aObject, aModel, aView )
      Specified by:
      createObjectCustomizerDisplayName in interface ILcyObjectCustomizerFactory
      Returns:
      The display name.
      See Also:
    • canCreateObjectCustomizer

      @Deprecated public boolean canCreateObjectCustomizer(Object aObject, ILcdModel aModel, ILcdGXYView aView)
      Deprecated.
      Use methods of ILcyCustomizerPanelFactory instead.
      Description copied from interface: ILcyObjectCustomizerFactory
      Returns true if createObjectCustomizer will return a customizer that can handle the given object, false otherwise.
      Specified by:
      canCreateObjectCustomizer in interface ILcyObjectCustomizerFactory
      Parameters:
      aObject - The object to test if a customizer can be created for it.
      aModel - The model that contains aObject. This parameter can be null if no model is available.
      aView - The view the given object is in. This parameter can be null is no such view is available.
      Returns:
      True if createObjectCustomizer will return a customizer that can handle the given object, false otherwise.
      See Also:
    • createObjectCustomizer

      @Deprecated public Customizer createObjectCustomizer(Object aObject, ILcdModel aModel, ILcdGXYView aGXYView)
      Deprecated.
      Use methods of ILcyCustomizerPanelFactory instead.
      Description copied from interface: ILcyObjectCustomizerFactory
      Returns a Customizer for the given object. The Customizer should accept the given object, so it should not throw an exception when setObject( aObject ) is invoked on the created Customizer. Furthermore, the created Customizer must throw an IllegalArgumentException when an attempt is made to set any type of object to the Customizer that it cannot handle. All this is to be able to reuse the same Customizer instance (performance!) for customizing several objects, one after another. This typically means there is a strong relation between ILcyObjectCustomizerFactory.canCreateObjectCustomizer(Object, com.luciad.model.ILcdModel, com.luciad.view.gxy.ILcdGXYView) and customizer.setObject: at least when the canCreateObjectCustomizer method returns false, an IllegalArgumentException should be thrown by setObject for the same object.

      setObject(null) can be used on the created Customizer to (temporarily) de-initialize it.

      Note: the implementation of this method must not call setObject on the newly created Customizer as this is the responsibility of the user of the created Customizer.

      Specified by:
      createObjectCustomizer in interface ILcyObjectCustomizerFactory
      Parameters:
      aObject - The object to create a customizer for.
      aModel - The model that contains aObject. This parameter can be null if no model is available.
      aGXYView - The view the given object is in. This parameter can be null if no such view is available.
      Returns:
      The Customizer that can handle the given object.
      See Also:
    • createPrintContextCustomizer

      @Deprecated protected Customizer createPrintContextCustomizer(TLcyPrintContext aPrintContext, Object aObject, ILcdModel aModel, ILcdGXYView aGXYView)
      Deprecated.
      Use methods of ILcyCustomizerPanelFactory instead.

      Creates the Customizer that can modify the attributes of the print area (area that can be drawn on the map to exactly define what needs to be printed), by offering a user interface that allows modifying the properties stored in the given aPrintContext (see ALcyPrintContext.getProperties()).

      Note that the aPrintContext object is also set afterwards to the returned Customizer, using setObject.

      Subclasses can overwrite this method to return their own Customizer. They could for example return a Customizer that links the property TLcyPrintAddOn.PRINTING_AREA_PREFIX + TLcyPrintAddOn.PRINTING_AREA_CHOICE_VALUE_PRINT_AREA + "." + TLcyPrintAddOn.SNAP_TO_FULL_PAGES_SELECTED_SUFFIX to a checkbox in its user interface.

      Parameters:
      aPrintContext - The print context object this customizer should customize. It typically only customizes the properties retrieved using ALcyPrintContext.getProperties()). The keys of that properties object are the various constants defined in TLcyPrintAddOn. This aPrintContext is also set afterwards to the returned customizer using setObject.
      aObject - The object, can be used as contextual information.
      aModel - The model, can be used as contextual information.
      aGXYView - The view, can be used as contextual information.
      Returns:
      The created Customizer.
    • canCreateCustomizerPanel

      public boolean canCreateCustomizerPanel(Object aObject)

      Returns true if createObjectCustomizer will return a customizer that can handle the given object, false otherwise.

      This implementation operates on TLcyDomainObjectContexts that contain a reference to a print area (area that can be drawn on the map to exactly define what needs to be printed).

      Specified by:
      canCreateCustomizerPanel in interface ILcyCustomizerPanelFactory
      Parameters:
      aObject - The object to test if a customizer can be created for it.
      Returns:
      true if createObjectCustomizer will return a customizer that can handle the given object, false otherwise.
      See Also:
    • createCustomizerPanel

      public ILcyCustomizerPanel createCustomizerPanel(Object aObject)

      Creates a new instance of ILcyCustomizerPanel. Users of this method will most likely set an object to the returned ILcyCustomizerPanel using ILcyCustomizerPanel.setObject(Object). Whether that is possible can be verified in advance using ILcyCustomizerPanelFactory.canCreateCustomizerPanel(Object).

      This implementation operates on TLcyDomainObjectContexts that contain a reference to a print area (area that can be drawn on the map to exactly define what needs to be printed).

      Specified by:
      createCustomizerPanel in interface ILcyCustomizerPanelFactory
      Parameters:
      aObject - The object to create an ILcyCustomizerPanel for.
      Returns:
      a new instance of ILcyCustomizerPanel.
      See Also:
    • createPrintAreaCustomizerPanel

      protected ILcyCustomizerPanel createPrintAreaCustomizerPanel(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext)
      Creates the ILcyCustomizerPanel that can modify the attributes of the print area (area that can be drawn on the map to exactly define what needs to be printed), by offering a user interface that allows modifying the properties stored in the given aPrintContext (see ALcyPrintContext.getProperties()).

      Note that the aPrintContext object is also set afterwards to the returned ILcyCustomizerPanel, using setObject.

      This function

      1. creates all panels using createPanel with all ID's ending in PANEL.
      2. calls createPrintAreaCustomizerPanelContent, which creates the content of the customizer panel by laying out all panels created in the previous step. Those panels can be retrieved using getPanel.

      Warning: Should not be overridden without calling the super function.

      Parameters:
      aPrintContext - The print context object this customizer should customize. It typically only customizes the properties retrieved using ALcyPrintContext.getProperties()). The keys of that properties object are the various constants defined in TLcyPrintAddOn. This aPrintContext is also set afterwards to the returned customizer using setObject.
      aContext - The TLcyDomainObjectContext, can be used as contextual information.
      Returns:
      The created ILcyCustomizerPanel.
    • createPrintAreaCustomizerPanelContent

      protected ILcyCustomizerPanel createPrintAreaCustomizerPanelContent(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext)
      Retrieves all ILcyCustomizerPanels and lays them out in one big ILcyCustomizerPanel. Therefore, this method uses getPanel(int) with all ID's that end in PANEL, and lays out those components in for example a TLcyCompositeCustomizerPanel.

      This function should be overridden when the global layout of the print are customizer panel needs to be changed, for example when the main panels such as the 'Printer settings' panel, 'Printing area' panel need to be rearranged, or when a new panel needs to be added.

      Parameters:
      aPrintContext - The print context to use.
      aContext - The TLcyDomainObjectContext, can be used as contextual information.
      Returns:
      the created content.
    • createPanel

      protected ILcyCustomizerPanel createPanel(int aID, TLcyPrintContext aPrintContext)

      Creates a ILcyCustomizerPanel for the given ID.

      Please refer to createPrintAreaCustomizerPanel for an overview of the method call sequence.

      Parameters:
      aID - The id describing which panel to create. This is a constant that ends in PANEL.
      aPrintContext - The print context to use.
      Returns:
      The newly created ILcyCustomizerPanel, or null.
      See Also:
    • getPanel

      protected ILcyCustomizerPanel getPanel(int aID)

      Returns the panel, that was created earlier, as a java.awt.Component for the given ID.

      Please refer to createPrintAreaCustomizerPanel for an overview of the method call sequence.

      Parameters:
      aID - The id describing which panel to return. This is a constant that ends in PANEL.
      Returns:
      the panel as a java.awt.Component for the given ID.
      See Also: