org.eclipse.graphiti.ui.features
Class DefaultPrintFeature
java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractPrintFeature
org.eclipse.graphiti.ui.features.DefaultPrintFeature
- All Implemented Interfaces:
- IFeature, IFeatureProviderHolder, IPrintFeature, IDescription, IName
public class DefaultPrintFeature
- extends AbstractPrintFeature
- implements IPrintFeature
The default feature implementation for printing a diagram. This feature is
used to trigger printing from inside an open and initialized
DiagramEditor
. It relies on an existing GraphicalViewer
showing the diagram to print.
- Since:
- 0.10 Has been moved from plug-in org.eclipse.graphiti package
org.eclipse.graphiti.features
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature |
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramBehavior, getDiagramEditor, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString, updatePictogramElement |
Methods inherited from interface org.eclipse.graphiti.IName |
getName |
DefaultPrintFeature
public DefaultPrintFeature(IFeatureProvider fp)
- Creates a new
DefaultPrintFeature
.
- Parameters:
fp
- The feature provider providing this feature
print
public void print(IPrintContext context)
- Performs the print operation. The default implementation delegates to
getGraphicalViewer(IPrintContext)
to retrieve the
GraphicalViewer
that already displays the diagram, queries for
PrinterData
to use by calling
getPrinterData(IPrintContext)
and finally uses
#getPrintOperation(Printer, IPrintConfiguration)
to create an
operation to perform the printing. All those methods may be overridden to
change the default behavior, so normally one would not need to override
this method unless the complete sequence needs to changed or the printing
is performed in a completely different scenario.
- Specified by:
print
in interface IPrintFeature
- Parameters:
context
- Context information for printing.
getGraphicalViewer
protected GraphicalViewer getGraphicalViewer(IPrintContext context)
- Must return a
GraphicalViewer
that contains the diagram to be
printed. The default implementation returns the viewer of the
DiagramEditor
that started this print feature; this is the one
associated to the feature provider of the currently opened diagram, see
AbstractFeature.getDiagramEditor()
.
- Parameters:
context
- Context information for printing.
- Returns:
- the viewer holding the diagram to print.
getPrinterData
protected PrinterData getPrinterData(IPrintContext context)
- Creates the
PrinterData
information used for this print feature.
The default implementation simply gets the info for the default printer
of the system or the first printer in the list of available printers in
case no default is defined.
- Parameters:
context
- Context information for printing.
- Returns:
- The printer data to use for this print feature.
getPrintConfiguration
protected IPrintConfiguration getPrintConfiguration(GraphicalViewer viewer,
Printer printer)
- Called to create a configuration object for the printing that defines
what to print on which printer and how. The default implementation
returns the standard Graphiti dialog used for printing that allows the
user to define which printer to use, which figure to print and various
other print settings.
- Parameters:
viewer
- The viewer displaying the diagram to printprinter
- The printer to use as default
- Returns:
- A newly created dialog that implements the
IPrintConfiguration
interface used in the print job.
getPrintOperation
protected PrintFigureOperation getPrintOperation(IPrintConfiguration printConfiguration)
- Called to create the operation that is actually used for printing a
diagram. The default implementation returns the Graphiti default print
operation that should be sufficient for almost all use cases.
- Parameters:
printConfiguration
- The IPrintConfiguration
instance that was used to
configure this print operation. In the default implementation
this is the dialog to use for selecting the printer and other
settings.
- Returns:
- The operation that will be used to actually perform the printing.
Copyright (c) SAP AG 2005, 2012.