ILcdGXYLabelEditor
. This interface has a much cleaner separation
of concerns, and is independent of the ILcdGXYPainter
used for the domain object.public class TLcdGXYEditableLabelPainter extends TLcdGXYIconPainter implements ILcdGXYPainter, ILcdGXYPainterProvider, ILcdGXYLabelPainter, ILcdGXYLabelPainterProvider, ILcdGXYEditor, ILcdGXYEditorProvider
ILcdGXYLabelPainter
implementation that allows to edit the labels by
moving them around.
TLcdGXYIconPainter.ScalingMode
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
DEFAULT, SELECTED
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
Constructor and Description |
---|
TLcdGXYEditableLabelPainter()
Deprecated.
|
TLcdGXYEditableLabelPainter(TLcdGXYEditableLabelPainter aGXYEditableLabelPainter)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
anchorPointSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
Point aPointSFCT)
Deprecated.
Implements
ILcdGXYPainter.anchorPointSFCT . |
void |
boundsSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Deprecated.
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object
in the given mode taking into account the given context.
|
Object |
clone()
Deprecated.
Creates and returns a copy of this object.
|
boolean |
edit(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
This implementation edits the
ILcdShape object set to the painter. |
protected boolean |
editLabel(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
|
Hashtable |
getBoundsToFollow()
Deprecated.
|
Dimension |
getDeltaLabelLocation(Object aObject)
Deprecated.
Returns the fixed distance in screen coordinates between the objects anchor point and the
labels anchor point.
|
ILcdGXYEditor |
getGXYEditor(Object aObject)
Deprecated.
Returns this instance as editor for editing the specified
Object . |
ILcdGXYLabelPainter |
getGXYLabelPainter(Object aObject)
Deprecated.
Finds an
ILcdGXYLabelPainter that can be used to label the object passed. |
ILcdGXYPainter |
getGXYPainter(Object aObject)
Deprecated.
Finds an
ILcdGXYPainter that can be used to paint or locate the object passed. |
TLcdGXYLabelPainter |
getInnerLabelPainter()
Deprecated.
|
int |
getLocationIndex()
Deprecated.
Delegates to to the inner label painter.
|
int |
getPossibleLocationCount(Graphics aGraphics)
Deprecated.
Delegates to to the inner label painter.
|
Color |
getSelectionBackground()
Deprecated.
|
boolean |
isFrame()
Deprecated.
Labels can be drawn surrounded by a frame, the frame property determines
whether to frame the labels.
|
boolean |
isIconSensitive()
Deprecated.
|
protected boolean |
isLabelSensitive(int aMode)
Deprecated.
This method returns whether the label is taken into account as a mouse-
sensitive part of the object when touching the object in
mode aMode.
|
boolean |
isSelectionFilled()
Deprecated.
|
boolean |
isTouched(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
Returns whether the mouse position in the given context is touching the painted icon.
|
double |
labelBoundsSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
Rectangle aRectangleSFCT)
Deprecated.
Delegates to to the inner label painter.
|
void |
paint(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
Displays the representation of the object in the given mode on the Graphics passed, taking into
account the context passed.
|
void |
paintLabel(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
Delegates to to the inner label painter.
|
protected void |
paintPin(Graphics aGraphics,
int aMode,
int aStartPointX,
int aStartPointY,
int aEndPointX,
int aEndPointY)
Deprecated.
Draws the pin on the given graphics between the given lines.
|
void |
putBoundsToFollow(Object aObject,
Rectangle aBounds)
Deprecated.
|
void |
putDeltaLabelLocation(Object aObject,
Dimension aDimension)
Deprecated.
Sets the fixed distance in screen coordinates between the objects anchor point and the
labels anchor point.
|
void |
removeAllBoundsToFollow()
Deprecated.
Clears the table indicating which labels absolute position cannot be changed.
|
void |
removeAllDeltaLabelLocation()
Deprecated.
Clears the location table.
|
void |
removeBoundsToFollow(Object aObject)
Deprecated.
|
void |
removeDeltaLabelLocation(Object aObject)
Deprecated.
Clears the distance in screens coordinates between the objects anchor point and the
labels anchor point.
|
protected String[] |
retrieveLabels(ILcdGXYContext aGXYContext)
Deprecated.
replaced by
retrieveLabels(int, ILcdGXYContext) |
protected String[] |
retrieveLabels(int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
Retrieves the labels to be painted for aObject.
|
void |
setForcePinOnNonDefaultLocation(boolean aForcePinOnNonDefaultLocation)
Deprecated.
If set to true, this forces drawing of the pin when the label has been
edited regardless of the value of
ALcdGXYStampLabelPainter.isWithPin() of
the inner label painter. |
void |
setFrame(boolean aFrame)
Deprecated.
Labels can be drawn surrounded by a frame, the frame property determines
whether to frame the labels.
|
void |
setIconSensitive(boolean aIconSensitive)
Deprecated.
|
void |
setLabelLocation(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Deprecated.
|
void |
setLocationIndex(int aLocationIndex)
Deprecated.
Delegates to the inner label painter.
|
void |
setObject(Object aObject)
Deprecated.
Sets the object to paint and edit.
|
void |
setSelectionBackground(Color aSelectionBackground)
Deprecated.
Sets the background color of the label if isSelectionFilled().
|
void |
setSelectionFilled(boolean aSelectionFilled)
Deprecated.
Sets whether the selected label should be filled.
|
acceptSnapTarget, clearImageCache, clearImageCache, firePropertyChangeEvent, getCreationClickCount, getCursor, getHaloAlgorithm, getHaloColor, getHaloThickness, getIcon, getIcon, getIconProvider, getObject, getPaintCache, getScale, getScalingMode, getSelectionIcon, getSelectionIconProvider, getSnapIcon, isHaloEnabled, isUseImageCache, isUseOrientation, paintSnap, setHaloAlgorithm, setHaloColor, setHaloEnabled, setHaloThickness, setIcon, setIconProvider, setModelModelTransformationClass, setPaintCache, setScale, setScalingMode, setSelectionIcon, setSelectionIconProvider, setSnapIcon, setUseImageCache, setUseOrientation, snapTarget, supportSnap
addPropertyChangeListener, firePropertyChangeEvent, getDisplayName, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCursor, getDisplayName, getObject, snapTarget, supportSnap
getObject
acceptSnapTarget, getCreationClickCount, getDisplayName, getObject
addPropertyChangeListener, removePropertyChangeListener
public TLcdGXYEditableLabelPainter()
public TLcdGXYEditableLabelPainter(TLcdGXYEditableLabelPainter aGXYEditableLabelPainter)
public TLcdGXYLabelPainter getInnerLabelPainter()
public void setForcePinOnNonDefaultLocation(boolean aForcePinOnNonDefaultLocation)
ALcdGXYStampLabelPainter.isWithPin()
of
the inner label painter.public Hashtable getBoundsToFollow()
public void setObject(Object aObject)
TLcdGXYIconPainter
Sets the object to paint and edit. The object should be an instance of or refer to
an instance of ILcdShape
for painting and ILcd2DEditableShape
for editing.
This painter/editor can be used to paint the object without using the edit functionality. This
method shall therefore only check if the object implements ILcdShape
and shall throw
a ClassCastException
if it does not.
When this painter is used as editor with an object that does not implement the interface ILcd2DEditableShape
, the edit
method shall throw the necessary exception.
setObject
in interface ILcdGXYEditor
setObject
in interface ILcdGXYLabelPainter
setObject
in interface ILcdGXYPainter
setObject
in class TLcdGXYIconPainter
aObject
- The object to paint and edit.TLcdGXYIconPainter.getObject()
public void setIconSensitive(boolean aIconSensitive)
protected boolean isLabelSensitive(int aMode)
aMode
- The painter or editor mode during the touchpublic boolean isIconSensitive()
public void setFrame(boolean aFrame)
newFrame
.public boolean isFrame()
true
if frame holds true
,
else false
is returned.public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
ALcdGXYPainter
ILcdGXYPainter.anchorPointSFCT
.
aPointSFCT
will be set to the center of the
bounds calculated by boundsSFCT.anchorPointSFCT
in interface ILcdGXYPainter
anchorPointSFCT
in class TLcdGXYIconPainter
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is painted in (see class documentation)aGXYContext
- the context for which the representation of the object is painted. It contains amongst others
the transformations from model to world and world to view.aPointSFCT
- the point that has to be moved to the location of the anchor point of the representation of
the object. This point must not be taken into account when the method has thrown a TLcdNoBoundsException.TLcdNoBoundsException
- if no anchor point can be determined for the representation of the object.
This can be when the object does not have a representation in the given context, for example when it is located in
a part of the world which is not visible in the projection as set in the views world reference.paint
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
TLcdGXYIconPainter
If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model
space for ILcdBounded
objects.
boundsSFCT
in interface ILcdGXYPainter
boundsSFCT
in class TLcdGXYIconPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.aBoundsSFCT
- The bounds to update.TLcdNoBoundsException
- if no bounds can be determined for the representation of the object.
This can happen when the object does not have a representation in the given context, for example when it is located
in a part of the world which is not visible in the current view.isTouched
public boolean isTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYIconPainter
Returns whether the mouse position in the given context is touching the painted icon.
This implementation will use the method TLcdGXYIconPainter.getIcon(int)
with the specified render
mode to determine which icon needs to be touched.
isTouched
in interface ILcdGXYPainter
isTouched
in class TLcdGXYIconPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.ILcdShape
object is touched.boundsSFCT
public void setLocationIndex(int aLocationIndex)
setLocationIndex
in interface ILcdGXYLabelPainter
aLocationIndex
- the index of the location. Must be between 0 and getPossibleLocationCount()
- 1.ILcdGXYLabelPainter.getLocationIndex()
public int getLocationIndex()
getLocationIndex
in interface ILcdGXYLabelPainter
ILcdGXYLabelPainter.setLocationIndex(int)
public int getPossibleLocationCount(Graphics aGraphics)
getPossibleLocationCount
in interface ILcdGXYLabelPainter
aGraphics
- the Graphics the label will be painted on.ILcdGXYLabelPainter
can
paint/draw the labels of the set Object.ILcdGXYLabelPainter.setLocationIndex(int)
public void setSelectionFilled(boolean aSelectionFilled)
public boolean isSelectionFilled()
setSelectionFilled(boolean)
public void setSelectionBackground(Color aSelectionBackground)
public Color getSelectionBackground()
setSelectionBackground(Color)
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangleSFCT) throws TLcdNoBoundsException
labelBoundsSFCT
in interface ILcdGXYLabelPainter
aGraphics
- the aGraphics
to consider.aMode
- the representation mode of the label.aGXYContext
- the ILcdGXYContext
the drawing depends on.aRectangleSFCT
- the Rectangle
containing the bounds of the label in view /
graphics coordinates as side effect.TLcdNoBoundsException
- if the Object doesn't have any valid bounds, e.g. if it is always
invisible in the current projection.ILcdGXYLabelPainter.DEFAULT
,
ILcdGXYLabelPainter.SELECTED
public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYIconPainter
This implementation will use the method TLcdGXYIconPainter.getIcon(int)
with the specified render mode to
determine how the object needs to be rendered. In ILcdGXYPainter.RESHAPING
and ILcdGXYPainter.TRANSLATING
mode,
the ILcdShape
object is rendered as if the point was moved along the same distance
in view coordinates as passed in the context.
If the halo effect is enabled, a halo effect will be added around the icon. Note that the halo effect
will only be added when the rendering mode does not contain the mode SELECTED
.
paint
in interface ILcdGXYPainter
paint
in class TLcdGXYIconPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.public boolean edit(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYIconPainter
This implementation edits the ILcdShape
object set to the painter. The object needs to
implement the interface ILcd2DEditableShape
otherwise a ClassCastException
will be thrown.
In ILcdGXYEditor.START_CREATION
, ILcdGXYEditor.TRANSLATED
and ILcdGXYEditor.RESHAPED
render mode, the focus
point of the ILcdShape
object is moved to the location beneath the mouse pointer.
If, in all render modes, a snap target is found for the moved point, the snap target location is used for the moved point.
edit
in interface ILcdGXYEditor
edit
in class TLcdGXYIconPainter
aGraphics
- The graphics to edit the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.ILcdGXYContext
,
acceptSnapTarget
public final ILcdGXYPainter getGXYPainter(Object aObject)
ILcdGXYPainterProvider
ILcdGXYPainter
that can be used to paint or locate the object passed.
The painter provider is responsible for setting the object to the painter before returning the painter. An implementation should therefore have the following structure:
public ILcdGXYPainter getGXYPainter(Object aObject) {
ILcdGXYPainter painter = ... // find the painter for the object
if (painter != null) {
painter.setObject(aObject);
}
return painter;
}
getGXYPainter
in interface ILcdGXYPainterProvider
getGXYPainter
in class ALcdGXYPainter
aObject
- the object to find a painter forpublic final ILcdGXYEditor getGXYEditor(Object aObject)
TLcdGXYIconPainter
Object
. If this
Object
is not the same as the Object
set to this painter, the
TLcdGXYIconPainter.setObject(Object)
method is called to update the object set to the painter.getGXYEditor
in interface ILcdGXYEditorProvider
getGXYEditor
in class TLcdGXYIconPainter
aObject
- the object to be edited.Object
.public final ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
ILcdGXYLabelPainterProvider
ILcdGXYLabelPainter
that can be used to label the object passed.
The label painter provider is responsible for setting the object to the label painter before returning the label painter. An implementation should therefore have the following structure:
public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject) {
ILcdGXYLabelPainter labelPainter = ... // find the label painter for the object
if (labelPainter != null) {
labelPainter.setObject(aObject);
}
return labelPainter;
}
getGXYLabelPainter
in interface ILcdGXYLabelPainterProvider
aObject
- the object to find a label painter forpublic void removeBoundsToFollow(Object aObject)
protected String[] retrieveLabels(int aMode, ILcdGXYContext aGXYContext)
String
containing aObject.toString()
.
Re-define this method in sub-classes for returning other labels.
Never modify the content of the returned array.
If it is not redefined it calls the method retrieveLabels(ILcdGXYContext)
aMode
- the label painting modeprotected String[] retrieveLabels(ILcdGXYContext aGXYContext)
retrieveLabels(int, ILcdGXYContext)
retrieveLabels(int, ILcdGXYContext)
public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
paintLabel
in interface ILcdGXYLabelPainter
aGraphics
- the Graphics
instance on which to paint.aMode
- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aGXYContext
- the ILcdGXYContext
in which the label painting has to be
performed.ILcdGXYLabelPainter.DEFAULT
,
ILcdGXYLabelPainter.SELECTED
public Dimension getDeltaLabelLocation(Object aObject)
aObject
- the object to return the delta for.putDeltaLabelLocation(java.lang.Object, java.awt.Dimension)
public void putDeltaLabelLocation(Object aObject, Dimension aDimension)
aObject
- the object to store the delta for.aDimension
- the delta for the label in screen coordinates. This is the vector between the
objects anchor point and the labels anchor point. Once this is set, the location index of the
inner label painter is ignored.removeDeltaLabelLocation(java.lang.Object)
public void removeDeltaLabelLocation(Object aObject)
aObject
- the object to remove the delta for.putDeltaLabelLocation(java.lang.Object, java.awt.Dimension)
protected void paintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY)
aGraphics
- the graphics to paint the pin on.aStartPointX
- the x coordinate of the start point of the pin.aStartPointY
- the y coordinate of the start point of the pin.aEndPointX
- the x coordinate of the end point of the pin.aEndPointY
- the y coordinate of the end point of the pin.aMode
- the mode this objects label is painted in (e.g. ILcdGXYLabelPainter.SELECTED).
This method is called by the inner label painter to paint a pin.protected boolean editLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
public void setLabelLocation(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
public void removeAllDeltaLabelLocation()
public void removeAllBoundsToFollow()
public Object clone()
TLcdGXYIconPainter
TLcdGXYIconPainter.getIcon()
and TLcdGXYIconPainter.getSelectionIcon()
) and the snap icon but shallow copies are made of the icon providers.clone
in interface ILcdCloneable
clone
in interface ILcdGXYEditorProvider
clone
in interface ILcdGXYLabelPainter
clone
in interface ILcdGXYLabelPainterProvider
clone
in interface ILcdGXYPainterProvider
clone
in class TLcdGXYIconPainter
Object.clone()