public class TLspXYGridOverlayLabelBuilder extends Object
Builder that makes it possible to create XY grid overlay labels. These are text labels that are added to the view and show a grid coordinate. These labels can have a pre-defined content, and style. Note that overlay labels are not attached to grid lines, but are added to the view.
The overlay label builder can be used in 2 ways:
TLspXYGridLayerBuilder#overlayLabel
.
When using this method, the overlay label will be added to the overlay panel of the view. On top of that, the visibility
of the overlay label will be synchronized with the visibility of the layer.An example of how to use this builder:
JComponent component = TLspXYGridOverlayLabelBuilder.newBuilder(view)
.content(TLspXYGridOverlayLabelBuilder.Content.COORDINATE_AT_CENTER)
.style(gridStyle)
.build();
Modifier and Type | Class and Description |
---|---|
static class |
TLspXYGridOverlayLabelBuilder.Content
The content that is displayed in the overlay label.
|
Modifier and Type | Method and Description |
---|---|
TLspXYGridOverlayLabelBuilder |
all(TLspXYGridOverlayLabelBuilder aBuilder)
Copies all properties from the given builder.
|
JComponent |
build()
Creates an XY grid label.
|
TLspXYGridOverlayLabelBuilder |
content(TLspXYGridOverlayLabelBuilder.Content aContent)
The content which is being displayed.
|
TLspXYGridOverlayLabelBuilder |
modelReference(ILcdModelReference aModelReference)
The model reference in which the overlay label displays its coordinates.
|
static TLspXYGridOverlayLabelBuilder |
newBuilder()
Creates a new builder, capable of adding XY grid labels.
|
TLspXYGridOverlayLabelBuilder |
style(TLspXYGridStyle aXYGridStyle)
The style with which the overlay label is being displayed.
|
TLspXYGridOverlayLabelBuilder |
useWorldReference(boolean aUseWorldReference)
When set to
true , the world reference of the view will be used as
reference in which the overlay label displays coordinates. |
TLspXYGridOverlayLabelBuilder |
view(ILspView aView)
The view for which the overlay labels should be added.
|
public static TLspXYGridOverlayLabelBuilder newBuilder()
public TLspXYGridOverlayLabelBuilder view(ILspView aView)
TLspXYGridLayerBuilder#overlayLabel
.aView
- the view.public TLspXYGridOverlayLabelBuilder useWorldReference(boolean aUseWorldReference)
When set to true
, the world reference of the view will be used as
reference in which the overlay label displays coordinates. When not calling the view()
method when this
method is used, an exception will be thrown when trying to build an overlay label. Note that the view
method will be called automatically when adding this TLspXYGridOverlayLabelBuilder
to the grid layer
builder, see TLspXYGridLayerBuilder#overlayLabel
.
When this method is called with true
as argument, the modelReference
method will have no effect. When this method is called with false
as argument, the
modelReference
method must be called.
public TLspXYGridOverlayLabelBuilder modelReference(ILcdModelReference aModelReference)
useWorldReference(boolean)
is called with true
as argument. When calling this method,
useWorldReference()
will be set to false
.aModelReference
- the model reference of the grid for which an overlay label should be displayed.public TLspXYGridOverlayLabelBuilder content(TLspXYGridOverlayLabelBuilder.Content aContent)
COORDINATE_AT_CENTER
.aContent
- coordinate which is being displayed.public TLspXYGridOverlayLabelBuilder style(TLspXYGridStyle aXYGridStyle)
The style with which the overlay label is being displayed. When using this method, only
styles and formats set after using the TLspXYGridStyle.Builder.overlay()
method are used. Only the following styles are supported:
This method is optional: when it is not called, a default style is used.
aXYGridStyle
- the XY grid style.public TLspXYGridOverlayLabelBuilder all(TLspXYGridOverlayLabelBuilder aBuilder)
aBuilder
- a builderpublic JComponent build()