Class TLcyPrintPreviewFactory
The main create function createPrintPreview(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
first creates all
actions, all components and then all panels using the functions createAction(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
, createComponent
and createPanel
. Then it calls
createPrintPreviewContent()
, which will create the
content of the print preview using the created panels by calling getPanel
. And finally it will create the actual content of the print
preview dialog.
Note however that ID's are used. This is because there are different types
of, for example, panels that can be created: the option panel, the printing
area settings panel,... All possible ID's that can be passed to the createPanel
method all end with the same suffix "PANEL". The
same thing goes for "COMPONENT" (createComponent
,
getComponent
) and "ACTION" (createAction
,
getAction
.
As an example, imagine you want to change the behaviour of the options panel.
Browsing this class learns there is a OPTIONS_PANEL
constant.
Because it ends with "PANEL", this constant can only be passed to
the createPanel
method. Therefore we can override the
method createPanel
, check if the ID is
OPTIONS_PANEL
and return a custom panel. Or use
super.createComponent
and change some settings before returning
it. If you want to remove the component completely, you can simply return
null.
The method createPrintPreview
should not be overridden without using the super
function. Changing the layout of the content of the print preview dialog can
be done by overriding createPrintPreviewContent
. The internal elements are already created and
should be retrieved by calling getComponent
.
Note that this class requires a default constructor to be able to configure it in the configuration file of the print add-on.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The id for creating the options panel.static final int
Part ofOPTIONS_PANEL
that allows to modify the classification.static final int
Part ofOPTIONS_PANEL
that allows to modify the visibility of the classification banner component.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the crop marks.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the footer text.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the header text.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the legend.static final int
Part ofOPTIONS_PANEL
that allows to modify the visibility of the header text component.static final int
Part ofOPTIONS_PANEL
that allows to modify the header text.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the overview.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the position marks.static final int
Part ofOPTIONS_PANEL
that allows to change the print factor.static final int
Part ofOPTIONS_PANEL
that allows to change the rasterization quality.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the scale icon.static final int
Part ofOPTIONS_PANEL
that allows to change the visibility of the scale text.static final int
Part ofOPTIONS_PANEL
that allows to modify the visibility of the title component.static final int
Part ofOPTIONS_PANEL
that allows to modify the title component text.static final int
The id for creating the panel that shows the preview of the actual page that are going to be printed.static final int
Part ofPAGE_PREVIEW_PANEL
that shows the close button.static final int
Most important part ofPAGE_PREVIEW_PANEL
that shows the actual pages.static final int
Part ofPAGE_PREVIEW_PANEL
that shows the print button.static final int
Part ofPAGE_PREVIEW_PANEL
that allows to choose the page preview scale.static final int
The id for creating the actual print action.static final int
The id for the panel that contains the print and cancel buttons:PAGE_PREVIEW_PANEL_PRINT_COMPONENT
andPAGE_PREVIEW_PANEL_CLOSE_COMPONENT
.static final int
The id for creating the printer settings panel.static final int
The id for creating the settings panel corresponding to the printing area. -
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyPrintPreviewFactory
(ILcyLucyEnv aLucyEnv) Creates a newTLcyPrintPreviewFactory
. -
Method Summary
Modifier and TypeMethodDescriptionprotected ILcdAction
createAction
(int aID, TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Creates anILcdAction
for the given ID.protected Component
createComponent
(int aID, TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Creates a widget for the given ID.protected Component
createPanel
(int aID, TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Creates a panel for the given ID.createPrintPreview
(TLcyPrintContext aPrintContext, ILcdAction aCloseAction) This function creates all actions usingcreateAction(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in_ACTION
.protected Component
createPrintPreviewContent
(TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Retrieves all panels and lays them out in ajava.awt.Component
.protected ILcdAction
getAction
(int aID) Returns theILcdAction
for the given ID.protected Component
getComponent
(int aID) Returns thejava.awt.Component
for the given ID.Returns the associated lucy environment.protected Component
getPanel
(int aID) Returns the panel as ajava.awt.Component
for the given ID.void
setLucyEnv
(ILcyLucyEnv aLucyEnv) Sets the associated lucy environment.
-
Field Details
-
PRINT_ACTION
public static final int PRINT_ACTIONThe id for creating the actual print action.- See Also:
-
PRINTER_SETTINGS_PANEL
public static final int PRINTER_SETTINGS_PANELThe id for creating the printer settings panel. It allows to choose the printer and the page layout.- See Also:
-
PRINTING_AREA_PANEL
public static final int PRINTING_AREA_PANELThe id for creating the settings panel corresponding to the printing area. It allows the user to select the number of pages, the scale, ...- See Also:
-
OPTIONS_PANEL
public static final int OPTIONS_PANELThe id for creating the options panel. The options panel is itself composed out of all widgets that correspond toOPTIONS_*_COMPONENT
constants. It allows for example to toggle the visibility of the overview, legend, header text, ...- See Also:
-
PAGE_PREVIEW_PANEL
public static final int PAGE_PREVIEW_PANELThe id for creating the panel that shows the preview of the actual page that are going to be printed. The page preview panel is itself composed out of all widgets that correspond toPAGE_PREVIEW_PANEL_*_COMPONENT
constants, except forPAGE_PREVIEW_PANEL_PRINT_COMPONENT
andPAGE_PREVIEW_PANEL_CLOSE_COMPONENT
.- See Also:
-
PRINT_PANEL
public static final int PRINT_PANELThe id for the panel that contains the print and cancel buttons:PAGE_PREVIEW_PANEL_PRINT_COMPONENT
andPAGE_PREVIEW_PANEL_CLOSE_COMPONENT
.- See Also:
-
PAGE_PREVIEW_PANEL_MAIN_COMPONENT
public static final int PAGE_PREVIEW_PANEL_MAIN_COMPONENTMost important part ofPAGE_PREVIEW_PANEL
that shows the actual pages.- See Also:
-
PAGE_PREVIEW_PANEL_PRINT_COMPONENT
public static final int PAGE_PREVIEW_PANEL_PRINT_COMPONENTPart ofPAGE_PREVIEW_PANEL
that shows the print button. It uses thePRINT_ACTION
to create that button.- See Also:
-
PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
public static final int PAGE_PREVIEW_PANEL_CLOSE_COMPONENTPart ofPAGE_PREVIEW_PANEL
that shows the close button. It uses the close action given as a parameter to this factory to create that button.- See Also:
-
PAGE_PREVIEW_PANEL_SCALE_COMPONENT
public static final int PAGE_PREVIEW_PANEL_SCALE_COMPONENTPart ofPAGE_PREVIEW_PANEL
that allows to choose the page preview scale.- See Also:
-
OPTIONS_PANEL_HEADER_TEXT_COMPONENT
public static final int OPTIONS_PANEL_HEADER_TEXT_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the header text.- See Also:
-
OPTIONS_PANEL_FOOTER_TEXT_COMPONENT
public static final int OPTIONS_PANEL_FOOTER_TEXT_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the footer text.- See Also:
-
OPTIONS_PANEL_LEGEND_COMPONENT
public static final int OPTIONS_PANEL_LEGEND_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the legend.- See Also:
-
OPTIONS_PANEL_OVERVIEW_COMPONENT
public static final int OPTIONS_PANEL_OVERVIEW_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the overview.- See Also:
-
OPTIONS_PANEL_SCALE_ICON_COMPONENT
public static final int OPTIONS_PANEL_SCALE_ICON_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the scale icon.- See Also:
-
OPTIONS_PANEL_SCALE_TEXT_COMPONENT
public static final int OPTIONS_PANEL_SCALE_TEXT_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the scale text.- See Also:
-
OPTIONS_PANEL_CROP_MARKS_COMPONENT
public static final int OPTIONS_PANEL_CROP_MARKS_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the crop marks.- See Also:
-
OPTIONS_PANEL_POSITION_MARKS_COMPONENT
public static final int OPTIONS_PANEL_POSITION_MARKS_COMPONENTPart ofOPTIONS_PANEL
that allows to change the visibility of the position marks.- See Also:
-
OPTIONS_PANEL_RASTERIZATION_QUALITY_COMPONENT
public static final int OPTIONS_PANEL_RASTERIZATION_QUALITY_COMPONENTPart ofOPTIONS_PANEL
that allows to change the rasterization quality.- See Also:
-
OPTIONS_PANEL_PRINT_FACTOR_COMPONENT
public static final int OPTIONS_PANEL_PRINT_FACTOR_COMPONENTPart ofOPTIONS_PANEL
that allows to change the print factor.- See Also:
-
OPTIONS_PANEL_TITLE_TEXT_COMPONENT
public static final int OPTIONS_PANEL_TITLE_TEXT_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the visibility of the title component.- See Also:
-
OPTIONS_PANEL_TITLE_TEXT_FIELD_COMPONENT
public static final int OPTIONS_PANEL_TITLE_TEXT_FIELD_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the title component text.- See Also:
-
OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENT
public static final int OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the visibility of the header text component. The difference with theOPTIONS_PANEL_HEADER_TEXT_COMPONENT
is that the text controlled by this component can be modified by the user in the UI.- Since:
- 2016.1.1
- See Also:
-
OPTIONS_PANEL_MODIFIABLE_HEADER_TEXT_FIELD_COMPONENT
public static final int OPTIONS_PANEL_MODIFIABLE_HEADER_TEXT_FIELD_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the header text.- Since:
- 2016.1.1
- See Also:
-
OPTIONS_PANEL_CLASSIFICATION_COMPONENT
public static final int OPTIONS_PANEL_CLASSIFICATION_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the visibility of the classification banner component.- Since:
- 2016.1.1
- See Also:
-
OPTIONS_PANEL_CLASSIFICATION_COMBO_BOX_COMPONENT
public static final int OPTIONS_PANEL_CLASSIFICATION_COMBO_BOX_COMPONENTPart ofOPTIONS_PANEL
that allows to modify the classification.- Since:
- 2016.1.1
- See Also:
-
-
Constructor Details
-
TLcyPrintPreviewFactory
public TLcyPrintPreviewFactory()Default constructor. Creates a newTLcyPrintPreviewFactory
. Note that you will have to set anILcyLucyEnv
before this instance can be used. Note that this class requires a default constructor to be able to configure it in the configuration file of the print add-on. -
TLcyPrintPreviewFactory
Creates a newTLcyPrintPreviewFactory
.- Parameters:
aLucyEnv
- The lucy environment, contextual information.
-
-
Method Details
-
getLucyEnv
Description copied from class:ALcyPrintPreviewFactory
Returns the associated lucy environment.- Specified by:
getLucyEnv
in classALcyPrintPreviewFactory<TLcyPrintContext>
- Returns:
- the associated lucy environment.
- See Also:
-
setLucyEnv
Description copied from class:ALcyPrintPreviewFactory
Sets the associated lucy environment.- Specified by:
setLucyEnv
in classALcyPrintPreviewFactory<TLcyPrintContext>
- Parameters:
aLucyEnv
- The lucy environment.- See Also:
-
createPrintPreview
This function- creates all actions using
createAction(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in_ACTION
. - creates all components using
createComponent(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in_COMPONENT
. - creates all panels using
createPanel(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in_PANEL
. - calls
createPrintPreviewContent(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
, which creates the content of the print preview by laying out all panels created in the previous step.
Component
created in the last step is returned. It is up to the user of this factory to make the returnedComponent
visible in for example a frame or a dialog. Note that because of this order, panels can be composed of components, and components can use the actions. So thecreatePanel(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
method can usegetComponent(int)
to retrieve its sub components, and thecreateComponent(int, com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
method can usegetAction(int)
to retrieve needed actions. Warning: Should not be overridden without calling the super function.- Specified by:
createPrintPreview
in classALcyPrintPreviewFactory<TLcyPrintContext>
- Parameters:
aPrintContext
- The print context to use.aCloseAction
- The close action. As the print preview has no idea how it will be represented (in a dialog, in a frame, ...) this action is provided to allow the print preview to close itself.- Returns:
- the print preview, created by
createPrintPreviewContent(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
.
- creates all actions using
-
createPrintPreviewContent
protected Component createPrintPreviewContent(TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Retrieves all panels and lays them out in ajava.awt.Component
. Therefore, this method usesgetPanel(int)
with all ID's that end inPANEL
, and lays out those components in for example ajavax.swing.JPanel
. This function should be overridden when the global layout of the print preview dialog needs to be changed, for example when the main panels such as the 'Printer settings' panel, 'Printing area' panel, 'Options' panel and 'Page preview' panel need to be rearranged, or when a new panel needs to be added.- Parameters:
aPrintContext
- The print context to use.aCloseAction
- The close action to use.- Returns:
- the created content.
-
createAction
Creates anILcdAction
for the given ID.- Parameters:
aID
- The id describing which action to create. This is a constant that ends inACTION
.aPrintContext
- The print context to use.aCloseAction
- The close action, contextual information.- Returns:
- The newly created
ILcdAction
, or null.
-
getAction
Returns theILcdAction
for the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.- Parameters:
aID
- The id describing which action to return. This is a constant that ends inACTION
.- Returns:
- the
ILcdAction
for the given ID.
-
createComponent
protected Component createComponent(int aID, TLcyPrintContext aPrintContext, ILcdAction aCloseAction) Creates a widget for the given ID. It is safe to usegetAction(int)
in this method, to build widgets that use an action. These widgets will typically interact with the properties object of aPrintContext (seeALcyPrintContext.getProperties()
). Such a widget could for example be a checkbox that is synchronized with the value of theTLcyPrintAddOn.OVERVIEW_VISIBLE_KEY
, or a slider that represents the value ofTLcyPrintAddOn.RASTERIZATION_QUALITY_KEY
.- Parameters:
aID
- The id describing which component to create. This is a constant that ends in_COMPONENT
.aPrintContext
- The print context to use.aCloseAction
- The close action, contextual information.- Returns:
- The newly created
java.awt.Component
, or null.
-
getComponent
Returns thejava.awt.Component
for the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.- Parameters:
aID
- The id describing which component to return. This is a constant that ends inCOMPONENT
.- Returns:
- the
java.awt.Component
for the given ID.
-
createPanel
Creates a panel for the given ID. It is safe to usegetComponent(int)
in this method, to build panels that are composed of components.- Parameters:
aID
- The id describing which panel to create. This is a constant that ends inPANEL
.aPrintContext
- The print context to use.aCloseAction
- The close action, contextual information.- Returns:
- The newly created
java.awt.Component
, or null.
-
getPanel
Returns the panel as ajava.awt.Component
for the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.TLcyPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.- 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.
-