public class TLcyLspPrintPreviewFactory extends ALcyPrintPreviewFactory<TLcyLspPrintContext>
The main create function createPrintPreview
first creates all actions,
all components and then all panels using the functions createAction
,
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.
Modifier and Type | Field and Description |
---|---|
static int |
MAP_EXTENTS_PANEL
The id for the panel containing navigation actions affecting what part of the map is printed.
|
static int |
OPTIONS_PANEL
The id for creating the options panel.
|
static int |
OPTIONS_PANEL_CLASSIFICATION_COMBO_BOX_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the classification. |
static int |
OPTIONS_PANEL_CLASSIFICATION_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the visibility of the classification banner component. |
static int |
OPTIONS_PANEL_CROP_MARKS_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the crop marks. |
static int |
OPTIONS_PANEL_FOOTER_TEXT_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the footer text. |
static int |
OPTIONS_PANEL_HEADER_TEXT_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the header text. |
static int |
OPTIONS_PANEL_LEGEND_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the legend. |
static int |
OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the visibility of the header text component. |
static int |
OPTIONS_PANEL_MODIFIABLE_HEADER_TEXT_FIELD_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the header text. |
static int |
OPTIONS_PANEL_OVERVIEW_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the overview. |
static int |
OPTIONS_PANEL_POSITION_MARKS_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the position marks. |
static int |
OPTIONS_PANEL_PRINT_FACTOR_COMPONENT
Part of
OPTIONS_PANEL that allows to change the print factor. |
static int |
OPTIONS_PANEL_RASTERIZATION_QUALITY_COMPONENT
Part of
OPTIONS_PANEL that allows to change the rasterization quality. |
static int |
OPTIONS_PANEL_SCALE_ICON_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the scale icon. |
static int |
OPTIONS_PANEL_SCALE_TEXT_COMPONENT
Part of
OPTIONS_PANEL that allows to change the visibility of the scale text. |
static int |
OPTIONS_PANEL_TITLE_TEXT_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the visibility of the title component. |
static int |
OPTIONS_PANEL_TITLE_TEXT_FIELD_COMPONENT
Part of
OPTIONS_PANEL that allows to modify the title component text. |
static int |
PAGE_PREVIEW_PANEL
The id for creating the panel that shows the preview of the actual page
that are going to be printed.
|
static int |
PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
Part of
PAGE_PREVIEW_PANEL that shows the close button. |
static int |
PAGE_PREVIEW_PANEL_MAIN_COMPONENT
Most important part of
PAGE_PREVIEW_PANEL that shows the actual pages. |
static int |
PAGE_PREVIEW_PANEL_PRINT_COMPONENT
Part of
PAGE_PREVIEW_PANEL that shows the print button. |
static int |
PAGE_PREVIEW_PANEL_SCALE_COMPONENT
Part of
PAGE_PREVIEW_PANEL that allows to choose the page preview scale. |
static int |
PAN_DOWN_ACTION
The id for creating the action to pan down
|
static int |
PAN_LEFT_ACTION
The id for creating the action to pan to the left
|
static int |
PAN_RIGHT_ACTION
The id for creating the action to pan to the right
|
static int |
PAN_UP_ACTION
The id for creating the action to pan up
|
static int |
PRINT_ACTION
The id for creating the actual print action.
|
static int |
PRINT_PANEL
The id for the panel that contains the print and cancel buttons:
PAGE_PREVIEW_PANEL_PRINT_COMPONENT and PAGE_PREVIEW_PANEL_CLOSE_COMPONENT . |
static int |
PRINTER_SETTINGS_PANEL
The id for creating the printer settings panel.
|
static int |
PRINTING_AREA_PANEL
The id for creating the settings panel corresponding to the printing area.
|
static int |
ZOOM_IN_ACTION
The id for creating the action to zoom in
|
static int |
ZOOM_OUT_ACTION
The id for creating the action to zoom out
|
Constructor and Description |
---|
TLcyLspPrintPreviewFactory()
Default constructor.
|
TLcyLspPrintPreviewFactory(ILcyLucyEnv aLucyEnv)
Creates a new
TLcyPrintPreviewFactory . |
Modifier and Type | Method and Description |
---|---|
protected ILcdAction |
createAction(int aID,
TLcyLspPrintContext aPrintContext,
ILcdAction aCloseAction)
Creates an
ILcdAction for the given ID. |
protected Component |
createComponent(int aID,
TLcyLspPrintContext aPrintContext,
ILcdAction aCloseAction)
Creates a widget for the given ID.
|
protected Component |
createPanel(int aID,
TLcyLspPrintContext aPrintContext,
ILcdAction aCloseAction)
Creates a panel for the given ID.
|
Component |
createPrintPreview(TLcyLspPrintContext aPrintContext,
ILcdAction aCloseAction)
This function
creates all actions using
createAction(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction) with all ID's ending in _ACTION . |
protected Component |
createPrintPreviewContent(TLcyLspPrintContext aPrintContext,
ILcdAction aCloseAction)
Retrieves all panels and lays them out in a
java.awt.Component . |
protected ILcdAction |
getAction(int aID)
Returns the
ILcdAction for the given ID. |
protected Component |
getComponent(int aID)
Returns the
java.awt.Component for the given ID. |
ILcyLucyEnv |
getLucyEnv()
Returns the associated lucy environment.
|
protected Component |
getPanel(int aID)
Returns the panel as a
java.awt.Component for the given ID. |
void |
setLucyEnv(ILcyLucyEnv aLucyEnv)
Sets the associated lucy environment.
|
public static final int PRINT_ACTION
public static final int PAN_LEFT_ACTION
public static final int PAN_RIGHT_ACTION
public static final int PAN_UP_ACTION
public static final int PAN_DOWN_ACTION
public static final int ZOOM_IN_ACTION
public static final int ZOOM_OUT_ACTION
public static final int PRINTER_SETTINGS_PANEL
public static final int PRINTING_AREA_PANEL
public static final int MAP_EXTENTS_PANEL
public static final int OPTIONS_PANEL
OPTIONS_*_COMPONENT
constants. It allows for example to
toggle the visibility of the overview, legend, header text, ...public static final int PAGE_PREVIEW_PANEL
PAGE_PREVIEW_PANEL_*_COMPONENT
constants, except for
PAGE_PREVIEW_PANEL_PRINT_COMPONENT
and PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
.public static final int PRINT_PANEL
PAGE_PREVIEW_PANEL_PRINT_COMPONENT
and PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
.public static final int PAGE_PREVIEW_PANEL_MAIN_COMPONENT
PAGE_PREVIEW_PANEL
that shows the actual pages.public static final int PAGE_PREVIEW_PANEL_PRINT_COMPONENT
PAGE_PREVIEW_PANEL
that shows the print button. It uses
the PRINT_ACTION
to create that button.public static final int PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
PAGE_PREVIEW_PANEL
that shows the close button. It uses
the close action given as a parameter to this factory to create that button.public static final int PAGE_PREVIEW_PANEL_SCALE_COMPONENT
PAGE_PREVIEW_PANEL
that allows to choose the page preview scale.public static final int OPTIONS_PANEL_HEADER_TEXT_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the header text.public static final int OPTIONS_PANEL_FOOTER_TEXT_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the footer text.public static final int OPTIONS_PANEL_LEGEND_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the legend.public static final int OPTIONS_PANEL_OVERVIEW_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the overview.public static final int OPTIONS_PANEL_SCALE_ICON_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the scale icon.public static final int OPTIONS_PANEL_SCALE_TEXT_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the scale text.public static final int OPTIONS_PANEL_CROP_MARKS_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the crop marks.public static final int OPTIONS_PANEL_POSITION_MARKS_COMPONENT
OPTIONS_PANEL
that allows to change the visibility of the position marks.public static final int OPTIONS_PANEL_RASTERIZATION_QUALITY_COMPONENT
OPTIONS_PANEL
that allows to change the rasterization quality.public static final int OPTIONS_PANEL_PRINT_FACTOR_COMPONENT
OPTIONS_PANEL
that allows to change the print factor.public static final int OPTIONS_PANEL_TITLE_TEXT_COMPONENT
OPTIONS_PANEL
that allows to modify the visibility of the title component.public static final int OPTIONS_PANEL_TITLE_TEXT_FIELD_COMPONENT
OPTIONS_PANEL
that allows to modify the title component text.public static final int OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENT
OPTIONS_PANEL
that allows to modify the visibility of the header text component.
The difference with the OPTIONS_PANEL_HEADER_TEXT_COMPONENT
is that the text controlled by this component can be modified by the
user in the UI.public static final int OPTIONS_PANEL_MODIFIABLE_HEADER_TEXT_FIELD_COMPONENT
OPTIONS_PANEL
that allows to modify the header text.public static final int OPTIONS_PANEL_CLASSIFICATION_COMPONENT
OPTIONS_PANEL
that allows to modify the visibility of the classification banner component.public static final int OPTIONS_PANEL_CLASSIFICATION_COMBO_BOX_COMPONENT
OPTIONS_PANEL
that allows to modify the classification.public TLcyLspPrintPreviewFactory()
TLcyPrintPreviewFactory
. Note that
you will have to set an ILcyLucyEnv
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.public TLcyLspPrintPreviewFactory(ILcyLucyEnv aLucyEnv)
TLcyPrintPreviewFactory
.aLucyEnv
- The lucy environment, contextual information.public ILcyLucyEnv getLucyEnv()
ALcyPrintPreviewFactory
getLucyEnv
in class ALcyPrintPreviewFactory<TLcyLspPrintContext>
ALcyPrintPreviewFactory.setLucyEnv(com.luciad.lucy.ILcyLucyEnv)
public void setLucyEnv(ILcyLucyEnv aLucyEnv)
ALcyPrintPreviewFactory
setLucyEnv
in class ALcyPrintPreviewFactory<TLcyLspPrintContext>
aLucyEnv
- The lucy environment.ALcyPrintPreviewFactory.getLucyEnv()
public Component createPrintPreview(TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction)
createAction(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in _ACTION
.
createComponent(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in _COMPONENT
.
createPanel(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
with all ID's ending in _PANEL
.
createPrintPreviewContent(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, 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 returned Component
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 the createPanel(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
method can use getComponent(int)
to retrieve its sub
components, and the createComponent(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
method can use getAction(int)
to retrieve needed
actions.
Warning: Should not be overridden without calling the super function.createPrintPreview
in class ALcyPrintPreviewFactory<TLcyLspPrintContext>
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.createPrintPreviewContent(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
.protected Component createPrintPreviewContent(TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction)
java.awt.Component
.
Therefore, this method uses getPanel(int)
with all ID's that end in
PANEL
, and lays out those components in for example a
javax.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.aPrintContext
- The print context to use.aCloseAction
- The close action to use.protected ILcdAction createAction(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction)
ILcdAction
for the given ID.aID
- The id describing which action to create. This is a constant that ends in ACTION
.aPrintContext
- The print context to use.aCloseAction
- The close action, contextual information.ILcdAction
, or null.protected ILcdAction getAction(int aID)
ILcdAction
for the given ID.
Please refer to createPrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.aID
- The id describing which action to return. This is a constant that ends in ACTION
.ILcdAction
for the given ID.protected Component createComponent(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction)
getAction(int)
in this method,
to build widgets that use an action.
These widgets will typically interact with the properties object of aPrintContext
(see ALcyPrintContext.getProperties()
). Such a widget
could for example be a checkbox that is synchronized with the value of the
TLcyPrintAddOn.OVERVIEW_VISIBLE_KEY
, or a slider that represents the value of
TLcyPrintAddOn.RASTERIZATION_QUALITY_KEY
.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.java.awt.Component
, or null.protected Component getComponent(int aID)
java.awt.Component
for the given ID.
Please refer to createPrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.aID
- The id describing which component to return. This is a constant that ends in COMPONENT
.java.awt.Component
for the given ID.protected Component createPanel(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction)
getComponent(int)
in this method, to build panels that are composed of components.aID
- The id describing which panel to create. This is a constant that ends in PANEL
.aPrintContext
- The print context to use.aCloseAction
- The close action, contextual information.java.awt.Component
, or null.protected Component getPanel(int aID)
java.awt.Component
for the given ID.
Please refer to createPrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)
to know when this method can be used.aID
- The id describing which panel to return. This is a constant that ends in PANEL
.java.awt.Component
for the given ID.