Class TLcdGXYEditableLabelPainter

All Implemented Interfaces:
ILcdCloneable, ILcdPropertyChangeSource, ILcdGXYEditor, ILcdGXYEditorProvider, ILcdGXYLabelPainter, ILcdGXYLabelPainterProvider, ILcdGXYPainter, ILcdGXYPainterProvider, Serializable, Cloneable

Deprecated.
The functionality offered by this class has been replaced with a proper ILcdGXYLabelEditor. This interface has a much cleaner separation of concerns, and is independent of the ILcdGXYPainter used for the domain object.

ILcdGXYLabelPainter implementation that allows to edit the labels by moving them around.

See Also:
  • Constructor Details

    • TLcdGXYEditableLabelPainter

      public TLcdGXYEditableLabelPainter()
      Deprecated.
    • TLcdGXYEditableLabelPainter

      public TLcdGXYEditableLabelPainter(TLcdGXYEditableLabelPainter aGXYEditableLabelPainter)
      Deprecated.
  • Method Details

    • getInnerLabelPainter

      public TLcdGXYLabelPainter getInnerLabelPainter()
      Deprecated.
    • setForcePinOnNonDefaultLocation

      public 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.
    • getBoundsToFollow

      public Hashtable getBoundsToFollow()
      Deprecated.
    • setObject

      public void setObject(Object aObject)
      Deprecated.
      Description copied from class: 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.

      Specified by:
      setObject in interface ILcdGXYEditor
      Specified by:
      setObject in interface ILcdGXYLabelPainter
      Specified by:
      setObject in interface ILcdGXYPainter
      Overrides:
      setObject in class TLcdGXYIconPainter
      Parameters:
      aObject - The object to paint and edit.
      See Also:
    • setIconSensitive

      public void setIconSensitive(boolean aIconSensitive)
      Deprecated.
    • isLabelSensitive

      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. This default implementation always returns true. Overwrite this method if other behavior is desirable (e.g. only sensitive in selected mode).
      Parameters:
      aMode - The painter or editor mode during the touch
      Returns:
      true.
    • isIconSensitive

      public boolean isIconSensitive()
      Deprecated.
    • setFrame

      public void setFrame(boolean aFrame)
      Deprecated.
      Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels. Sets the property frame to newFrame.
    • isFrame

      public boolean isFrame()
      Deprecated.
      Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.
      Returns:
      true if frame holds true, else false is returned.
    • anchorPointSFCT

      public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
      Deprecated.
      Description copied from class: ALcdGXYPainter
      Implements ILcdGXYPainter.anchorPointSFCT. aPointSFCT will be set to the center of the bounds calculated by boundsSFCT.
      Specified by:
      anchorPointSFCT in interface ILcdGXYPainter
      Overrides:
      anchorPointSFCT in class TLcdGXYIconPainter
      Parameters:
      aGraphics - the Graphics on which the representation of the object is painted
      aMode - 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.
      Throws:
      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.
      See Also:
    • boundsSFCT

      public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
      Deprecated.
      Description copied from class: TLcdGXYIconPainter
      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.

      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.

      Specified by:
      boundsSFCT in interface ILcdGXYPainter
      Overrides:
      boundsSFCT in class TLcdGXYIconPainter
      Parameters:
      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.
      Throws:
      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.
      See Also:
    • isTouched

      public boolean isTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
      Description copied from class: 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.

      Specified by:
      isTouched in interface ILcdGXYPainter
      Overrides:
      isTouched in class TLcdGXYIconPainter
      Parameters:
      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.
      Returns:
      whether the focus point of the ILcdShape object is touched.
      See Also:
    • setLocationIndex

      public void setLocationIndex(int aLocationIndex)
      Deprecated.
      Delegates to the inner label painter.
      Specified by:
      setLocationIndex in interface ILcdGXYLabelPainter
      Parameters:
      aLocationIndex - the index of the location. Must be between 0 and getPossibleLocationCount() - 1.
      See Also:
    • getLocationIndex

      public int getLocationIndex()
      Deprecated.
      Delegates to to the inner label painter.
      Specified by:
      getLocationIndex in interface ILcdGXYLabelPainter
      Returns:
      the index of the position. Must be between 0 and getPossibleLocationCount() - 1.
      See Also:
    • getPossibleLocationCount

      public int getPossibleLocationCount(Graphics aGraphics)
      Deprecated.
      Delegates to to the inner label painter.
      Specified by:
      getPossibleLocationCount in interface ILcdGXYLabelPainter
      Parameters:
      aGraphics - the Graphics the label will be painted on.
      Returns:
      the number of possible locations where this ILcdGXYLabelPainter can paint/draw the labels of the set Object.
      See Also:
    • setSelectionFilled

      public void setSelectionFilled(boolean aSelectionFilled)
      Deprecated.
      Sets whether the selected label should be filled. Takes only effect if the label is not filled by default.
    • isSelectionFilled

      public boolean isSelectionFilled()
      Deprecated.
      See Also:
    • setSelectionBackground

      public void setSelectionBackground(Color aSelectionBackground)
      Deprecated.
      Sets the background color of the label if isSelectionFilled(). Takes only effect if the label is not filled by default.
    • getSelectionBackground

      public Color getSelectionBackground()
      Deprecated.
      See Also:
    • labelBoundsSFCT

      public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangleSFCT) throws TLcdNoBoundsException
      Deprecated.
      Delegates to to the inner label painter.
      Specified by:
      labelBoundsSFCT in interface ILcdGXYLabelPainter
      Parameters:
      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.
      Returns:
      the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
      Throws:
      TLcdNoBoundsException - if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.
      See Also:
    • paint

      public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
      Description copied from class: TLcdGXYIconPainter
      Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.

      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.

      Specified by:
      paint in interface ILcdGXYPainter
      Overrides:
      paint in class TLcdGXYIconPainter
      Parameters:
      aGraphics - The graphics to paint the object on.
      aMode - The mode to render the object in.
      aGXYContext - The context to render the object in.
    • edit

      public boolean edit(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
      Description copied from class: 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.

      Specified by:
      edit in interface ILcdGXYEditor
      Overrides:
      edit in class TLcdGXYIconPainter
      Parameters:
      aGraphics - The graphics to edit the object on.
      aMode - The mode to render the object in.
      aGXYContext - The context to render the object in.
      Returns:
      true if the object has changed when this method returns, false otherwise.
      See Also:
    • getGXYPainter

      public final ILcdGXYPainter getGXYPainter(Object aObject)
      Deprecated.
      Description copied from interface: ILcdGXYPainterProvider
      Finds an 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;
       }
       

      Specified by:
      getGXYPainter in interface ILcdGXYPainterProvider
      Overrides:
      getGXYPainter in class ALcdGXYPainter
      Parameters:
      aObject - the object to find a painter for
      Returns:
      a painter that can be used to paint or locate the object; or null if no painter could be found for the given object, or the object could not be set on the retrieved painter.
    • getGXYEditor

      public final ILcdGXYEditor getGXYEditor(Object aObject)
      Deprecated.
      Description copied from class: TLcdGXYIconPainter
      Returns this instance as editor for editing the specified 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.
      Specified by:
      getGXYEditor in interface ILcdGXYEditorProvider
      Overrides:
      getGXYEditor in class TLcdGXYIconPainter
      Parameters:
      aObject - the object to be edited.
      Returns:
      this instance as editor for editing the specified Object.
    • getGXYLabelPainter

      public final ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
      Deprecated.
      Description copied from interface: ILcdGXYLabelPainterProvider
      Finds an 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;
       }
       

      Specified by:
      getGXYLabelPainter in interface ILcdGXYLabelPainterProvider
      Parameters:
      aObject - the object to find a label painter for
      Returns:
      a label painter that can be used to label the object; or null if no label painter could be found for the given object, or the object could not be set on the retrieved label painter.
    • putBoundsToFollow

      public void putBoundsToFollow(Object aObject, Rectangle aBounds)
      Deprecated.
    • removeBoundsToFollow

      public void removeBoundsToFollow(Object aObject)
      Deprecated.
    • retrieveLabels

      protected String[] retrieveLabels(int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
      Retrieves the labels to be painted for aObject. This method is called within the paintLabel method. By default, it returns an array of one 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)
      Parameters:
      aMode - the label painting mode
    • retrieveLabels

      protected String[] retrieveLabels(ILcdGXYContext aGXYContext)
      Deprecated.
      See Also:
    • paintLabel

      public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
      Delegates to to the inner label painter.
      Specified by:
      paintLabel in interface ILcdGXYLabelPainter
      Parameters:
      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.
      See Also:
    • getDeltaLabelLocation

      public Dimension getDeltaLabelLocation(Object aObject)
      Deprecated.
      Returns the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.
      Parameters:
      aObject - the object to return the delta for.
      Returns:
      the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.
      See Also:
    • putDeltaLabelLocation

      public void putDeltaLabelLocation(Object aObject, Dimension aDimension)
      Deprecated.
      Sets the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.
      Parameters:
      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.
      See Also:
    • removeDeltaLabelLocation

      public void removeDeltaLabelLocation(Object aObject)
      Deprecated.
      Clears the distance in screens coordinates between the objects anchor point and the labels anchor point. This means the location index will be taken into account to determine the location of the label on the view.
      Parameters:
      aObject - the object to remove the delta for.
      See Also:
    • paintPin

      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. Overwrite this method if you want to change the look of the pin, by manipulating the graphics passed.
      Parameters:
      aGraphics - the graphics to paint the pin on.
      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.
      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.
    • editLabel

      protected boolean editLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
    • setLabelLocation

      public void setLabelLocation(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Deprecated.
    • removeAllDeltaLabelLocation

      public void removeAllDeltaLabelLocation()
      Deprecated.
      Clears the location table. All labels will be painted at the location where they would have been painted before the label was dragged.
    • removeAllBoundsToFollow

      public void removeAllBoundsToFollow()
      Deprecated.
      Clears the table indicating which labels absolute position cannot be changed.
    • clone

      public Object clone()
      Deprecated.
      Description copied from class: TLcdGXYIconPainter
      Creates and returns a copy of this object. Deep copies are made of fallback icons (TLcdGXYIconPainter.getIcon() and TLcdGXYIconPainter.getSelectionIcon()) and the snap icon but shallow copies are made of the icon providers.
      Specified by:
      clone in interface ILcdCloneable
      Specified by:
      clone in interface ILcdGXYEditorProvider
      Specified by:
      clone in interface ILcdGXYLabelPainter
      Specified by:
      clone in interface ILcdGXYLabelPainterProvider
      Specified by:
      clone in interface ILcdGXYPainterProvider
      Overrides:
      clone in class TLcdGXYIconPainter
      Returns:
      a clone of this instance.
      See Also: