public class InteriorLabelModel extends Object implements ILabelModel, ILabelModelParameterProvider
Layout
bounds.
This label model supports nine positions inside of the layout's bounds.
Modifier and Type | Class and Description |
---|---|
static class |
InteriorLabelModel.Position
Enumeration of the possible positions of the
InteriorLabelModel . |
Modifier and Type | Field and Description |
---|---|
static ILabelModelParameter |
CENTER
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
EAST
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
NORTH
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
NORTH_EAST
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
NORTH_WEST
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.
|
static ILabelModelParameter |
SOUTH_EAST
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
SOUTH_WEST
A convenience parameter instance that can be shared between label instances.
|
static ILabelModelParameter |
WEST
A convenience parameter instance that can be shared between label instances.
|
Constructor and Description |
---|
InteriorLabelModel()
Creates a new instance of this model with empty insets.
|
Modifier and Type | Method and Description |
---|---|
ILabelModelParameter |
createDefaultParameter()
Creates a default parameter that can be used for this model.
|
ILabelModelParameter |
createParameter(InteriorLabelModel.Position position)
Creates the parameter for the given position.
|
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. |
InsetsD |
getInsets()
Gets the insets to use within the node's
Layout . |
SizeD |
getMinimumNodeSize(ILabel label,
ILabelModelParameter layoutParameter)
Returns the minimum size this model would require for the node owner of the label if the the given label was used with
the provided parameter.
|
InsetsD |
getNodeInsets(ILabel label,
ILabelModelParameter layoutParameter)
Returns the insets this model would require for the node owner of the label if the the given label was used with the
provided 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. |
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null . |
void |
setInsets(InsetsD value)
Sets the insets to use within the node's
Layout . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookup
public static final ILabelModelParameter CENTER
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter EAST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter NORTH
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter NORTH_EAST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter NORTH_WEST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter SOUTH
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter SOUTH_EAST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter SOUTH_WEST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public static final ILabelModelParameter WEST
Trying to change that instances' Insets
will raise an IllegalStateException
.
public InteriorLabelModel()
public ILabelModelParameter createDefaultParameter()
ILabelModel
createDefaultParameter
in interface ILabelModel
public ILabelModelParameter createParameter(InteriorLabelModel.Position position)
position
- The position.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 InsetsD getInsets()
Layout
.setInsets(InsetsD)
public SizeD getMinimumNodeSize(ILabel label, ILabelModelParameter layoutParameter)
label
- The label to use.layoutParameter
- The parameter to use.public InsetsD getNodeInsets(ILabel label, ILabelModelParameter layoutParameter)
label
- The label to use.layoutParameter
- The parameter to use.public 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 <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 setInsets(InsetsD value)
Layout
.value
- The Insets to set.getInsets()