public abstract class AbstractFeature extends java.lang.Object implements IFeature
IFeature
.Constructor and Description |
---|
AbstractFeature(IFeatureProvider fp)
Creates a new
AbstractFeature . |
Modifier and Type | Method and Description |
---|---|
boolean |
canUndo(IContext context)
Decides if the current feature can be undone - this is the undo of the
execute operation.
|
java.lang.String |
getDescription()
Gets the description.
|
IFeatureProvider |
getFeatureProvider()
Gets the feature provider.
|
java.lang.String |
getName()
Gets the name.
|
boolean |
hasDoneChanges()
Is queried by the framework after a feature has been executed to find out
if this feature should appear in the undo stack of e.g.
|
boolean |
isAvailable(IContext context)
Decides if the current feature is available with the given context.
|
Font |
manageFont(Diagram diagram,
java.lang.String name,
int size)
Provides a font instance by either creating a new one and aggregating it
to the diagram or finding it in the diagrams list of fonts.
|
Font |
manageFont(Diagram diagram,
java.lang.String name,
int size,
boolean isItalic,
boolean isBold)
Provides a font instance by either creating a new one and aggregating it
to the diagram or finding it in the diagrams list of fonts.
|
void |
setProgressCallback(IProgress progress)
Sets the progress callback.
|
java.lang.String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
canExecute, execute
public AbstractFeature(IFeatureProvider fp)
AbstractFeature
.fp
- the fppublic boolean canUndo(IContext context)
IFeature
public boolean hasDoneChanges()
IFeature
AbstractFeature
), but features may decide to override this
behavior. Note that this is a dynamic attribute of the feature that is
queried each time after the feature has been executed.
IMPORTANT NOTE: The implementor of the feature is responsible for
correctly implementing this method! It might lead to inconsistencies in
the command stack if this method returns false
although the
feature did changes.
hasDoneChanges
in interface IFeature
true
if the feature should appear in the undo stack,
false
otherwisepublic java.lang.String getDescription()
IDescription
getDescription
in interface IDescription
public IFeatureProvider getFeatureProvider()
IFeatureProviderHolder
getFeatureProvider
in interface IFeatureProviderHolder
public java.lang.String getName()
IName
public boolean isAvailable(IContext context)
IFeature
isAvailable
in interface IFeature
context
- this is the general input for this methodIContext
public void setProgressCallback(IProgress progress)
progress
- the new progress callbackpublic java.lang.String toString()
toString
in class java.lang.Object
public Font manageFont(Diagram diagram, java.lang.String name, int size)
diagram
- the diagram that aggregates the fontsname
- the name of the fontsize
- the size of the fontpublic Font manageFont(Diagram diagram, java.lang.String name, int size, boolean isItalic, boolean isBold)
diagram
- the diagram that aggregates the fontsname
- the name of the fontsize
- the size of the fontisItalic
- the is italicisBold
- the is bold