Class AbstractSaveImageFeature

java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractSaveImageFeature
All Implemented Interfaces:
IFeature, IFeatureProviderHolder, ISaveImageFeature, IDescription, IName
Direct Known Subclasses:
DefaultSaveImageFeature

public abstract class AbstractSaveImageFeature extends AbstractFeature implements ISaveImageFeature
Abstract base implementation of a save as image feature.
Since:
0.10
  • Constructor Details

    • AbstractSaveImageFeature

      public AbstractSaveImageFeature(IFeatureProvider fp)
      Constructor that is to be called by any subclass.
      Parameters:
      fp - The feature provider that created the feature
  • Method Details

    • getName

      public String getName()
      Returns the name of the save as image feature, by default "Save As Image"
      Specified by:
      getName in interface IName
      Overrides:
      getName in class AbstractFeature
      Returns:
      the name
    • canExecute

      public boolean canExecute(IContext context)
      Checks if this feature can be executed by delegating to the method canSave(ISaveImageContext).
      Specified by:
      canExecute in interface IFeature
      Parameters:
      context - Context information for printing.
      Returns:
      true in case this save image feature can be executed, false otherwise.
      See Also:
    • canSave

      public boolean canSave(ISaveImageContext context)
      Checks if this feature can execute. The default implementation simply returns true.
      Specified by:
      canSave in interface ISaveImageFeature
      Parameters:
      context - Context information for saving an image.
      Returns:
      true in case this save image feature can be executed, false otherwise.
    • preSave

      public void preSave(ISaveImageContext context)
      Hook method for executing stuff that needs to be done before actually saving a diagram as an image. The default implementation does nothing.
      Specified by:
      preSave in interface ISaveImageFeature
      Parameters:
      context - Context information for saving.
    • execute

      public final void execute(IContext context)
      Executes this save image feature by sequentially calling preSave(ISaveImageContext), ISaveImageFeature.save(ISaveImageContext) and postSave(ISaveImageContext). This method will fail in case the passed context is no ISaveImageContext.
      Specified by:
      execute in interface IFeature
      Parameters:
      context - Context information for saving.
      See Also:
    • postSave

      public void postSave(ISaveImageContext context)
      Hook method for executing stuff that needs to be done after actually saving a diagram as an image. The default implementation does nothing.
      Specified by:
      postSave in interface ISaveImageFeature
      Parameters:
      context - Context information for saving.
    • 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.