org.eclipse.graphiti.features.impl
Class AbstractPrintFeature

java.lang.Object
  extended by org.eclipse.graphiti.features.impl.AbstractFeature
      extended by org.eclipse.graphiti.features.impl.AbstractPrintFeature
All Implemented Interfaces:
IFeature, IFeatureProviderHolder, IPrintFeature, IDescription, IName
Direct Known Subclasses:
DefaultPrintFeature

public abstract class AbstractPrintFeature
extends AbstractFeature
implements IPrintFeature

Abstract base implementation of a save as image feature.

Since:
0.10

Field Summary
private static String NAME
           
 
Constructor Summary
AbstractPrintFeature(IFeatureProvider fp)
          Constructor that is to be called by any subclass.
 
Method Summary
 boolean canExecute(IContext context)
          Checks if this feature can be executed by delegating to the method canPrint(IPrintContext).
 boolean canPrint(IPrintContext context)
          Checks if this feature can execute.
 void execute(IContext context)
          Executes this print feature by sequentially calling prePrint(IPrintContext), IPrintFeature.print(IPrintContext) and postPrint(IPrintContext).
 String getName()
          Returns the name of the print feature, by default "Print"
 boolean hasDoneChanges()
          Hook method that reports if changes have been done while executing this feature.
 void postPrint(IPrintContext context)
          Hook method for executing stuff that needs to be done after actually printing a diagram.
 void prePrint(IPrintContext context)
          Hook method for executing stuff that needs to be done before actually printing a diagram.
 
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, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString, updatePictogramElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.graphiti.features.IPrintFeature
print
 
Methods inherited from interface org.eclipse.graphiti.features.IFeature
canUndo, isAvailable
 
Methods inherited from interface org.eclipse.graphiti.IDescription
getDescription
 
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
 

Field Detail

NAME

private static final String NAME
Constructor Detail

AbstractPrintFeature

public AbstractPrintFeature(IFeatureProvider fp)
Constructor that is to be called by any subclass.

Parameters:
fp - The feature provider that created the feature
Method Detail

getName

public String getName()
Returns the name of the print feature, by default "Print"

Specified by:
getName in interface IName
Overrides:
getName in class AbstractFeature
Returns:
the name

canExecute

public final boolean canExecute(IContext context)
Checks if this feature can be executed by delegating to the method canPrint(IPrintContext).

Specified by:
canExecute in interface IFeature
Parameters:
context - Context information for printing.
Returns:
true in case this print feature can be executed, false otherwise.
See Also:
IContext

canPrint

public boolean canPrint(IPrintContext context)
Checks if this feature can execute. The default implementation simply returns true. Note that the Graphiti framework already checks the availability of printer in the print action that triggers this feature.

Specified by:
canPrint in interface IPrintFeature
Parameters:
context - Context information for printing.
Returns:
true in case this print feature can be executed, false otherwise.

prePrint

public void prePrint(IPrintContext context)
Hook method for executing stuff that needs to be done before actually printing a diagram. The default implementation does nothing.

Specified by:
prePrint in interface IPrintFeature
Parameters:
context - Context information for printing.

execute

public final void execute(IContext context)
Executes this print feature by sequentially calling prePrint(IPrintContext), IPrintFeature.print(IPrintContext) and postPrint(IPrintContext). This method will fail in case the passed context is no IPrintContext.

Specified by:
execute in interface IFeature
Parameters:
context - Context information for printing.
See Also:
IContext

postPrint

public void postPrint(IPrintContext context)
Hook method for executing stuff that needs to be done after actually printing a diagram. The default implementation does nothing.

Specified by:
postPrint in interface IPrintFeature
Parameters:
context - Context information for printing.

hasDoneChanges

public boolean hasDoneChanges()
Hook method that reports if changes have been done while executing this feature. In case false is returned the feature will not appear in the undo stack. The default implementation simply returns false.

Specified by:
hasDoneChanges in interface IFeature
Overrides:
hasDoneChanges in class AbstractFeature
Returns:
true in case changes have been made, false otherwise.


Copyright (c) SAP AG 2005, 2012.