Class TLcyLspPrintPreviewFactory
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.
- Since:
- 2013.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe id for the panel containing navigation actions affecting what part of the map is printed.static final intThe id for creating the options panel.static final intPart ofOPTIONS_PANELthat allows to modify the classification.static final intPart ofOPTIONS_PANELthat allows to modify the visibility of the classification banner component.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the crop marks.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the footer text.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the header text.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the legend.static final intPart ofOPTIONS_PANELthat allows to modify the visibility of the header text component.static final intPart ofOPTIONS_PANELthat allows to modify the header text.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the overview.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the position marks.static final intPart ofOPTIONS_PANELthat allows to change the print factor.static final intPart ofOPTIONS_PANELthat allows to change the rasterization quality.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the scale icon.static final intPart ofOPTIONS_PANELthat allows to change the visibility of the scale text.static final intPart ofOPTIONS_PANELthat allows to modify the visibility of the title component.static final intPart ofOPTIONS_PANELthat allows to modify the title component text.static final intThe id for creating the panel that shows the preview of the actual page that are going to be printed.static final intPart ofPAGE_PREVIEW_PANELthat shows the close button.static final intMost important part ofPAGE_PREVIEW_PANELthat shows the actual pages.static final intPart ofPAGE_PREVIEW_PANELthat shows the print button.static final intPart ofPAGE_PREVIEW_PANELthat allows to choose the page preview scale.static final intThe id for creating the action to pan downstatic final intThe id for creating the action to pan to the leftstatic final intThe id for creating the action to pan to the rightstatic final intThe id for creating the action to pan upstatic final intThe id for creating the actual print action.static final intThe id for the panel that contains the print and cancel buttons:PAGE_PREVIEW_PANEL_PRINT_COMPONENTandPAGE_PREVIEW_PANEL_CLOSE_COMPONENT.static final intThe id for creating the printer settings panel.static final intThe id for creating the settings panel corresponding to the printing area.static final intThe id for creating the action to zoom instatic final intThe id for creating the action to zoom out -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TLcyLspPrintPreviewFactory(ILcyLucyEnv aLucyEnv) Creates a newTLcyPrintPreviewFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected ILcdActioncreateAction(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) Creates anILcdActionfor the given ID.protected ComponentcreateComponent(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) Creates a widget for the given ID.protected ComponentcreatePanel(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) Creates a panel for the given ID.createPrintPreview(TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) This function creates all actions usingcreateAction(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)with all ID's ending in_ACTION.protected ComponentcreatePrintPreviewContent(TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) Retrieves all panels and lays them out in ajava.awt.Component.protected ILcdActiongetAction(int aID) Returns theILcdActionfor the given ID.protected ComponentgetComponent(int aID) Returns thejava.awt.Componentfor the given ID.Returns the associated lucy environment.protected ComponentgetPanel(int aID) Returns the panel as ajava.awt.Componentfor the given ID.voidsetLucyEnv(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:
-
PAN_LEFT_ACTION
public static final int PAN_LEFT_ACTIONThe id for creating the action to pan to the left- See Also:
-
PAN_RIGHT_ACTION
public static final int PAN_RIGHT_ACTIONThe id for creating the action to pan to the right- See Also:
-
PAN_UP_ACTION
public static final int PAN_UP_ACTIONThe id for creating the action to pan up- See Also:
-
PAN_DOWN_ACTION
public static final int PAN_DOWN_ACTIONThe id for creating the action to pan down- See Also:
-
ZOOM_IN_ACTION
public static final int ZOOM_IN_ACTIONThe id for creating the action to zoom in- See Also:
-
ZOOM_OUT_ACTION
public static final int ZOOM_OUT_ACTIONThe id for creating the action to zoom out- 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:
-
MAP_EXTENTS_PANEL
public static final int MAP_EXTENTS_PANELThe id for the panel containing navigation actions affecting what part of the map is printed.- 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_*_COMPONENTconstants. 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_*_COMPONENTconstants, except forPAGE_PREVIEW_PANEL_PRINT_COMPONENTandPAGE_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_COMPONENTandPAGE_PREVIEW_PANEL_CLOSE_COMPONENT.- See Also:
-
PAGE_PREVIEW_PANEL_MAIN_COMPONENT
public static final int PAGE_PREVIEW_PANEL_MAIN_COMPONENTMost important part ofPAGE_PREVIEW_PANELthat shows the actual pages.- See Also:
-
PAGE_PREVIEW_PANEL_PRINT_COMPONENT
public static final int PAGE_PREVIEW_PANEL_PRINT_COMPONENTPart ofPAGE_PREVIEW_PANELthat shows the print button. It uses thePRINT_ACTIONto create that button.- See Also:
-
PAGE_PREVIEW_PANEL_CLOSE_COMPONENT
public static final int PAGE_PREVIEW_PANEL_CLOSE_COMPONENTPart ofPAGE_PREVIEW_PANELthat 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_PANELthat allows to choose the page preview scale.- See Also:
-
OPTIONS_PANEL_HEADER_TEXT_COMPONENT
public static final int OPTIONS_PANEL_HEADER_TEXT_COMPONENTPart ofOPTIONS_PANELthat 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_PANELthat allows to change the visibility of the footer text.- See Also:
-
OPTIONS_PANEL_LEGEND_COMPONENT
public static final int OPTIONS_PANEL_LEGEND_COMPONENTPart ofOPTIONS_PANELthat allows to change the visibility of the legend.- See Also:
-
OPTIONS_PANEL_OVERVIEW_COMPONENT
public static final int OPTIONS_PANEL_OVERVIEW_COMPONENTPart ofOPTIONS_PANELthat 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_PANELthat 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_PANELthat 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_PANELthat 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_PANELthat 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_PANELthat allows to change the rasterization quality.- See Also:
-
OPTIONS_PANEL_PRINT_FACTOR_COMPONENT
public static final int OPTIONS_PANEL_PRINT_FACTOR_COMPONENTPart ofOPTIONS_PANELthat allows to change the print factor.- See Also:
-
OPTIONS_PANEL_TITLE_TEXT_COMPONENT
public static final int OPTIONS_PANEL_TITLE_TEXT_COMPONENTPart ofOPTIONS_PANELthat 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_PANELthat allows to modify the title component text.- See Also:
-
OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENT
public static final int OPTIONS_PANEL_MODIFIABLE_HEADER_COMPONENTPart ofOPTIONS_PANELthat allows to modify the visibility of the header text component. The difference with theOPTIONS_PANEL_HEADER_TEXT_COMPONENTis 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_PANELthat 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_PANELthat 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_PANELthat allows to modify the classification.- Since:
- 2016.1.1
- See Also:
-
-
Constructor Details
-
TLcyLspPrintPreviewFactory
public TLcyLspPrintPreviewFactory()Default constructor. Creates a newTLcyPrintPreviewFactory. Note that you will have to set anILcyLucyEnvbefore 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. -
TLcyLspPrintPreviewFactory
Creates a newTLcyPrintPreviewFactory.- Parameters:
aLucyEnv- The lucy environment, contextual information.
-
-
Method Details
-
getLucyEnv
Description copied from class:ALcyPrintPreviewFactoryReturns the associated lucy environment.- Specified by:
getLucyEnvin classALcyPrintPreviewFactory<TLcyLspPrintContext>- Returns:
- the associated lucy environment.
- See Also:
-
setLucyEnv
Description copied from class:ALcyPrintPreviewFactorySets the associated lucy environment.- Specified by:
setLucyEnvin classALcyPrintPreviewFactory<TLcyLspPrintContext>- Parameters:
aLucyEnv- The lucy environment.- See Also:
-
createPrintPreview
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. - creates all components using
createComponent(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)with all ID's ending in_COMPONENT. - creates all panels using
createPanel(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)with all ID's ending in_PANEL. - calls
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.
Componentcreated in the last step is returned. It is up to the user of this factory to make the returnedComponentvisible 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.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)method can usegetComponent(int)to retrieve its sub components, and thecreateComponent(int, com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction)method can usegetAction(int)to retrieve needed actions. Warning: Should not be overridden without calling the super function.- Specified by:
createPrintPreviewin classALcyPrintPreviewFactory<TLcyLspPrintContext>- 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.lightspeed.TLcyLspPrintContext, com.luciad.gui.ILcdAction).
- creates all actions using
-
createPrintPreviewContent
protected Component createPrintPreviewContent(TLcyLspPrintContext 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
protected ILcdAction createAction(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) Creates anILcdActionfor 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 theILcdActionfor the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, 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
ILcdActionfor the given ID.
-
createComponent
protected Component createComponent(int aID, TLcyLspPrintContext 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.Componentfor the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, 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.Componentfor the given ID.
-
createPanel
protected Component createPanel(int aID, TLcyLspPrintContext aPrintContext, ILcdAction aCloseAction) 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.Componentfor the given ID. Please refer tocreatePrintPreview(com.luciad.lucy.addons.print.lightspeed.TLcyLspPrintContext, 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.Componentfor the given ID.
-