Class TLcyPrintAreaCustomizerFactory
- All Implemented Interfaces:
ILcyCustomizerPanelFactory
,ILcyObjectCustomizerFactory
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 Summary
Modifier and TypeFieldDescriptionstatic final int
The id for creating the printer settingsILcyCustomizerPanel
.static final int
The id for creating the settingsILcyCustomizerPanel
corresponding to the printing area. -
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyPrintAreaCustomizerFactory
(ILcyLucyEnv aLucyEnv) Creates a newTLcyPrintAreaCustomizerFactory
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCreateCustomizerPanel
(Object aObject) Returnstrue
ifcreateObjectCustomizer
will return a customizer that can handle the given object,false
otherwise.boolean
canCreateObjectCustomizer
(Object aObject, ILcdModel aModel, ILcdGXYView aView) Deprecated.createCustomizerPanel
(Object aObject) Creates a new instance ofILcyCustomizerPanel
.createObjectCustomizer
(Object aObject, ILcdModel aModel, ILcdGXYView aGXYView) Deprecated.Use methods ofILcyCustomizerPanelFactory
instead.createObjectCustomizerDisplayName
(Object aObject, ILcdModel aModel, ILcdGXYView aView) Deprecated.Use methods ofILcyCustomizerPanelFactory
instead.protected ILcyCustomizerPanel
createPanel
(int aID, TLcyPrintContext aPrintContext) Creates aILcyCustomizerPanel
for the given ID.protected ILcyCustomizerPanel
createPrintAreaCustomizerPanel
(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext) Creates theILcyCustomizerPanel
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 (seeALcyPrintContext.getProperties()
).protected ILcyCustomizerPanel
createPrintAreaCustomizerPanelContent
(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext) Retrieves allILcyCustomizerPanel
s and lays them out in one bigILcyCustomizerPanel
.protected Customizer
createPrintContextCustomizer
(TLcyPrintContext aPrintContext, Object aObject, ILcdModel aModel, ILcdGXYView aGXYView) Deprecated.Use methods ofILcyCustomizerPanelFactory
instead.Returns the Lucy environment to which this customizer factory belongs.protected ILcyCustomizerPanel
getPanel
(int aID) Returns the panel, that was created earlier, as ajava.awt.Component
for the given ID.void
setLucyEnv
(ILcyLucyEnv aLucyEnv) Sets the Lucy environment to which this customizer factory belongs.
-
Field Details
-
PRINTER_SETTINGS_PANEL
public static final int PRINTER_SETTINGS_PANELThe id for creating the printer settingsILcyCustomizerPanel
. It allows to choose the page orientation.- See Also:
-
PRINTING_AREA_PANEL
public static final int PRINTING_AREA_PANELThe id for creating the settingsILcyCustomizerPanel
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 newTLcyPrintAreaCustomizerFactory
. Note that you will have to set anILcyLucyEnv
before this instance can be used. -
TLcyPrintAreaCustomizerFactory
Creates a newTLcyPrintAreaCustomizerFactory
.- Parameters:
aLucyEnv
- The lucy environment, contextual information.
-
-
Method Details
-
setLucyEnv
Sets the Lucy environment to which this customizer factory belongs.- Parameters:
aLucyEnv
- The Lucy environment to which this customizer factory belongs.
-
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 ofILcyCustomizerPanelFactory
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 interfaceILcyObjectCustomizerFactory
- Returns:
- The display name.
- See Also:
-
canCreateObjectCustomizer
@Deprecated public boolean canCreateObjectCustomizer(Object aObject, ILcdModel aModel, ILcdGXYView aView) Deprecated.Use methods ofILcyCustomizerPanelFactory
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 interfaceILcyObjectCustomizerFactory
- 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 ofILcyCustomizerPanelFactory
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 betweenILcyObjectCustomizerFactory.canCreateObjectCustomizer(Object, com.luciad.model.ILcdModel, com.luciad.view.gxy.ILcdGXYView)
andcustomizer.setObject
: at least when thecanCreateObjectCustomizer
method returns false, anIllegalArgumentException
should be thrown bysetObject
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 interfaceILcyObjectCustomizerFactory
- 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 ofILcyCustomizerPanelFactory
instead. Creates theCustomizer
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 (seeALcyPrintContext.getProperties()
). Note that the aPrintContext object is also set afterwards to the returnedCustomizer
, usingsetObject
. Subclasses can overwrite this method to return their own Customizer. They could for example return aCustomizer
that links the propertyTLcyPrintAddOn.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 usingALcyPrintContext.getProperties()
). The keys of that properties object are the various constants defined inTLcyPrintAddOn
. This aPrintContext is also set afterwards to the returned customizer usingsetObject
.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
Returns
true
ifcreateObjectCustomizer
will return a customizer that can handle the given object,false
otherwise.This implementation operates on
TLcyDomainObjectContext
s 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 interfaceILcyCustomizerPanelFactory
- 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
Creates a new instance of
ILcyCustomizerPanel
. Users of this method will most likely set an object to the returnedILcyCustomizerPanel
usingILcyCustomizerPanel.setObject(Object)
. Whether that is possible can be verified in advance usingILcyCustomizerPanelFactory.canCreateCustomizerPanel(Object)
.This implementation operates on
TLcyDomainObjectContext
s 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 interfaceILcyCustomizerPanelFactory
- Parameters:
aObject
- The object to create anILcyCustomizerPanel
for.- Returns:
- a new instance of
ILcyCustomizerPanel
. - See Also:
-
createPrintAreaCustomizerPanel
protected ILcyCustomizerPanel createPrintAreaCustomizerPanel(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext) Creates theILcyCustomizerPanel
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 (seeALcyPrintContext.getProperties()
). Note that the aPrintContext object is also set afterwards to the returnedILcyCustomizerPanel
, usingsetObject
. This function- creates all panels using
createPanel
with all ID's ending inPANEL
. - 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 usinggetPanel
.
- Parameters:
aPrintContext
- The print context object this customizer should customize. It typically only customizes the properties retrieved usingALcyPrintContext.getProperties()
). The keys of that properties object are the various constants defined inTLcyPrintAddOn
. This aPrintContext is also set afterwards to the returned customizer usingsetObject
.aContext
- TheTLcyDomainObjectContext
, can be used as contextual information.- Returns:
- The created
ILcyCustomizerPanel
.
- creates all panels using
-
createPrintAreaCustomizerPanelContent
protected ILcyCustomizerPanel createPrintAreaCustomizerPanelContent(TLcyPrintContext aPrintContext, TLcyDomainObjectContext aContext) Retrieves allILcyCustomizerPanel
s and lays them out in one bigILcyCustomizerPanel
. Therefore, this method usesgetPanel(int)
with all ID's that end inPANEL
, and lays out those components in for example aTLcyCompositeCustomizerPanel
. 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
- TheTLcyDomainObjectContext
, can be used as contextual information.- Returns:
- the created content.
-
createPanel
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 inPANEL
.aPrintContext
- The print context to use.- Returns:
- The newly created
ILcyCustomizerPanel
, or null. - See Also:
-
getPanel
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 inPANEL
.- Returns:
- the panel as a
java.awt.Component
for the given ID. - See Also:
-
ILcyCustomizerPanelFactory
instead.