public class StripeLabelModel extends Object implements ILabelModel, ILabelModelParameterProvider
This label model supports four positions inside of the stripe bounds. The east and west positions are rotated
automatically. The Owner
is expected to be an IStripe
instance, i.e. the parameter
supports only IStripe
instances.
Modifier and Type | Class and Description |
---|---|
static class |
StripeLabelModel.Position
Enumeration of the possible positions of the
InteriorLabelModel . |
Modifier and Type | Field and Description |
---|---|
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 |
SOUTH
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 |
---|
StripeLabelModel()
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(StripeLabelModel.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 in form of an
IOrientedRectangle for a 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 |
getRatio()
Gets the ratio how far the label should be positioned from the border in the header area.
|
boolean |
isUsingActualInsetsEnabled()
Gets a value indicating whether to use the
actual insets or the normal Insets
of a stripe for centering the label inside the stripe header area. |
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null . |
void |
setRatio(double value)
Sets the ratio how far the label should be positioned from the border in the header area.
|
void |
setUsingActualInsetsEnabled(boolean value)
Sets a value indicating whether to use the
actual insets or the normal Insets
of a stripe for centering the label inside the stripe header area. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookup
public static final ILabelModelParameter EAST
Trying to change that instances' Ratio
will raise an IllegalStateException
.
public static final ILabelModelParameter NORTH
Trying to change that instances' Ratio
will raise an IllegalStateException
.
public static final ILabelModelParameter SOUTH
Trying to change that instances' Ratio
will raise an IllegalStateException
.
public static final ILabelModelParameter WEST
Trying to change that instances' Ratio
will raise an IllegalStateException
.
public StripeLabelModel()
public ILabelModelParameter createDefaultParameter()
ILabelModel
createDefaultParameter
in interface ILabelModel
public ILabelModelParameter createParameter(StripeLabelModel.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)
IOrientedRectangle
for a given label using the given model parameter.
The geometry is calculated in table coordinates, i.e. relative to
RelativeLocation
.
getGeometry
in interface ILabelModel
label
- the label to calculate the geometry forlayoutParameter
- A parameter that has been created by this model. This is typically the parameter that yielded this instance through its
Model
property.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 double getRatio()
0 means the label is positioned on the outer border, 1 means it is positioned at the inner border of the header or inset area. Default value is 0.5
setRatio(double)
public boolean isUsingActualInsetsEnabled()
actual insets
or the normal Insets
of a stripe for centering the label inside the stripe header area.
If true
the header insets are used. Default is false
setUsingActualInsetsEnabled(boolean)
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 setRatio(double value)
0 means the label is positioned on the outer border, 1 means it is positioned at the inner border of the header or inset area. Default value is 0.5
value
- The Ratio to set.getRatio()
public void setUsingActualInsetsEnabled(boolean value)
actual insets
or the normal Insets
of a stripe for centering the label inside the stripe header area.
If true
the header insets are used. Default is false
value
- The UsingActualInsetsEnabled to set.isUsingActualInsetsEnabled()