public class SandwichLabelModel extends Object implements ILabelModel, ILabelModelParameterProvider
The label will be placed centered on top or below the node's Layout
using a specifiable
YOffset
.
Modifier and Type | Field and Description |
---|---|
static ILabelModelParameter |
NORTH
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
SOUTH
A convenience parameter instance that can be shared between label instances.
|
Constructor and Description |
---|
SandwichLabelModel()
Initializes a new instance of the
SandwichLabelModel class with zero offset. |
Modifier and Type | Method and Description |
---|---|
ILabelModelParameter |
createDefaultParameter()
Creates a default parameter that can be used for this model.
|
ILabelModelParameter |
createNorthParameter()
Creates a parameter for the north side of the node.
|
ILabelModelParameter |
createSouthParameter()
Creates a parameter for the south side of the node.
|
ILookup |
getContext(ILabel label,
ILabelModelParameter layoutParameter)
Provides a
lookup context for the given combination of label and parameter. |
IOrientedRectangle |
getGeometry(ILabel label,
ILabelModelParameter layoutParameter)
Calculates the
geometry of the given label using the given model parameter. |
IEnumerable<ILabelModelParameter> |
getParameters(ILabel label,
ILabelModel model)
Returns an enumerator over a set of possible
ILabelModelParameter instances that can be used for the given label
and model. |
double |
getYOffset()
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null . |
void |
setYOffset(double value)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookup
public static final ILabelModelParameter NORTH
Trying to change that instances' YOffset
will raise an IllegalStateException
.
public static final ILabelModelParameter SOUTH
Trying to change that instances' YOffset
will raise an IllegalStateException
.
public SandwichLabelModel()
SandwichLabelModel
class with zero offset.public ILabelModelParameter createDefaultParameter()
ILabelModel
createDefaultParameter
in interface ILabelModel
public ILabelModelParameter createNorthParameter()
public ILabelModelParameter createSouthParameter()
public ILookup getContext(ILabel label, ILabelModelParameter layoutParameter)
ILabelModel
lookup context
for the given combination of label and parameter.getContext
in interface ILabelModel
label
- The label to use in the context.layoutParameter
- The parameter to use for the label in the context.ILookup
interface that can be used to query additional aspects of the label/parameter
combination.ILookup.EMPTY
public final IOrientedRectangle getGeometry(ILabel label, ILabelModelParameter layoutParameter)
ILabelModel
geometry
of the given label using the given model parameter.getGeometry
in interface ILabelModel
label
- The label to calculate the geometry for.layoutParameter
- A parameter that is compatible with this model. Typically, this is a parameter that has been created by this model, and
its property Model
returns this instance.IOrientedRectangle
that describes the geometry of the label. This is typically designed as a flyweight,
therefore clients should not cache the instance but store the values if they need a snapshot for later use.public final IEnumerable<ILabelModelParameter> getParameters(ILabel label, ILabelModel model)
ILabelModelParameterProvider
ILabelModelParameter
instances that can be used for the given label
and model.getParameters
in interface ILabelModelParameterProvider
label
- The label instance to use.model
- The model to provide parameters for.public double getYOffset()
setYOffset(double)
public <TLookup> TLookup lookup(Class<TLookup> type)
ILookup
null
.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null
implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.public void setYOffset(double value)
value
- The YOffset to set.getYOffset()