Class TLcdGXYSelectController

All Implemented Interfaces:
ILcdUndoableSource, ILcdStatusSource, ILcdGXYController, KeyListener, MouseListener, MouseMotionListener, Serializable, EventListener
Direct Known Subclasses:
TLcdGXYEditController

public class TLcdGXYSelectController extends TLcdGXYDragRectangleController implements MouseListener
Deprecated.
as of version 10.0. It is advised to use the more flexible and powerful TLcdGXYSelectController2 instead. The functionality of this class will remain present as is.
The TLcdGXYSelectController can be used for selecting Objects in an ILcdGXYView, and put them in the selection of their respective ILcdGXYLayer. The selection can be performed by clicking or dragging a rectangle on the ILcdGXYView.

An ILcdAction to be triggered on a right mouse button pressed can be set using setActionOnRightMouseButtonPressed if the selection mode is equal to ILcdGXYSelectControllerModel.FIRST_TOUCHED.

An ILcdAction to be triggered on a double click can be set using setActionOnDoubleClick.

New selection can be retrieved ILcdGXYLayer by ILcdGXYLayer (see ILcdGXYLayer.selectedObjects)

The way selection is performed can be changing the GXYSelectControllerModel property (see setGXYSelectControllerModel, selectionMode(MouseEvent) ).

Note: For new code, it is advised to use TLcdGXYSelectController2.

See Also:
  • Field Details

    • fWorkContext

      protected TLcdGXYContext fWorkContext
      Deprecated.
    • fLastSelectionClip

      protected Rectangle fLastSelectionClip
      Deprecated.
    • fSelection

      protected TLcdGXYLayerSubsetList fSelection
      Deprecated.
    • fAWTWorkBounds

      protected Rectangle fAWTWorkBounds
      Deprecated.
    • fXYWorkBounds

      protected TLcdXYBounds fXYWorkBounds
      Deprecated.
  • Constructor Details

    • TLcdGXYSelectController

      public TLcdGXYSelectController()
      Deprecated.
      Constructs a ILcdGXYController which enables selecting objects in the view using the mouse.
    • TLcdGXYSelectController

      public TLcdGXYSelectController(boolean aRegisterInstance)
      Deprecated.
      use the constructor without parameters.
  • Method Details

    • setTraceOn

      public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Overrides:
      setTraceOn in class TLcdGXYDragRectangleController
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • isTraceOn

      public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Overrides:
      isTraceOn in class TLcdGXYDragRectangleController
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • selection

      public ILcdGXYLayerSubsetList selection()
      Deprecated.
      Returns:
      all the Object currently selected
      See Also:
    • getLastMousePressedEvent

      public MouseEvent getLastMousePressedEvent()
      Deprecated.
      Retrieves the last MouseEvent received on a mousePressed.
    • getLastMouseReleasedEvent

      public MouseEvent getLastMouseReleasedEvent()
      Deprecated.
      Retrieves the last MouseEvent received on a mouseReleased.
    • lastSelected

      public ILcdGXYLayerSubsetList lastSelected()
      Deprecated.
      Returns:
      only the Object that have been selected during the last mouse interaction. It is a subset of selection().
      See Also:
    • setActionOnRightMouseButtonPressed

      public void setActionOnRightMouseButtonPressed(ActionListener aActionOnRightMouseButtonPressed)
      Deprecated.
      Sets an ActionListener to be triggered on a right mouse button pressed. null means no ActionListener to trigger.
    • getActionOnRightMouseButtonPressed

      public ActionListener getActionOnRightMouseButtonPressed()
      Deprecated.
      Gets the ActionListener to be triggered on a right mouse button pressed. null means no ActionListener to trigger.
    • isStrictInteraction

      public boolean isStrictInteraction()
      Deprecated.
      Returns whether interaction with the select clip should be strict.
      Returns:
      whether interaction with the select clip should be strict. Default value is false.
      See Also:
    • setStrictInteraction

      public void setStrictInteraction(boolean aStrictInteraction)
      Deprecated.
      Sets whether interaction with the select clip should be strict.
      Parameters:
      aStrictInteraction - if true, selection shall be applied only to the Objects interacting with the given clip. If false it can be applied to the same Objects plus others. In general, the retrieval of the Object interacting with the given clip will be faster when aStrictInteraction=false.
      See Also:
    • getSensitivity

      public int getSensitivity()
      Deprecated.
      This method returns the sensitivity that will be used when selecting objects or labels. It indicates how far (in screen coordinates) the input location (mouse cursor, etc...) can be from the visual representation of an object on the screen and still interact with it. This value will be passed to all created instances of TLcdGXYContext passed to the painters.
      Returns:
      the sensitivity to be used for selecting objects.
      See Also:
    • setSensitivity

      public void setSensitivity(int aSensitivity)
      Deprecated.
      This method sets the sensitivity that should be used by painters to determine which object is selected by the input device (usually the mouse).
      Parameters:
      aSensitivity - the sensitivity that will be used for selecting objects.
      See Also:
    • setActionOnDoubleClick

      public void setActionOnDoubleClick(ActionListener aActionOnDoubleClick)
      Deprecated.
      Sets an ActionListener to be triggered on a mouse double click. null means no ActionListener to trigger.
    • getActionOnDoubleClick

      public ActionListener getActionOnDoubleClick()
      Deprecated.
      Gets the ActionListener to be triggered on a mouse double click. null means no ActionListener to trigger.
    • setSelectInBoundsAllowed

      public void setSelectInBoundsAllowed(boolean aSelectInBoundsAllowed)
      Deprecated.
      Sets if selection can be performed by dragging a Rectangle on the ILcdGXYView.
    • isInvertSelectionOnAlternateModeDrag

      public boolean isInvertSelectionOnAlternateModeDrag()
      Deprecated.
      Indicates whether objects that were selected and are selected again dragging a rectangle in ALTERNATE mode should be removed from the selection. Default value is false for backwards compatibility, i.e. dragging a rectangle on top of selected objects will not influence the selected objects. Note that this only applies for selection with a rectangle, not for selection with a click.
      Returns:
      whether objects that were selected and are selected again dragging a rectangle in ALTERNATE mode should be removed from the selection.
      See Also:
    • setInvertSelectionOnAlternateModeDrag

      public void setInvertSelectionOnAlternateModeDrag(boolean aInvertSelectionOnAlternateModeDrag)
      Deprecated.
      Sets whether currently selected objects should be removed from the selection when they are selected again in the current operation dragging a rectangle in ALTERNATE mode.
      Parameters:
      aInvertSelectionOnAlternateModeDrag - true to have a more consistent behavior, as consecutive clicks also remove objects from the selection.
      See Also:
    • isSelectInBoundsAllowed

      public boolean isSelectInBoundsAllowed()
      Deprecated.
      See Also:
    • isActionOnRightMouseButtonPerformed

      protected boolean isActionOnRightMouseButtonPerformed()
      Deprecated.
      Tells if the ILcdAction to be triggered on a right mouse button pressed has been performed or not.
    • setGXYSelectControllerModel

      public void setGXYSelectControllerModel(ILcdGXYSelectControllerModel aGXYSelectControllerModel)
      Deprecated.
      Customizes how this TLcdGXYSelectController performs the selection on a ILcdGXYView.
      Parameters:
      aGXYSelectControllerModel - the ILcdGXYSelectControllerModel to set. null is a valid argument.
      See Also:
    • getGXYSelectControllerModel

      public ILcdGXYSelectControllerModel getGXYSelectControllerModel()
      Deprecated.
      See Also:
    • setMousePressedSensitivity

      public void setMousePressedSensitivity(int aMousePressedSensitivity)
      Deprecated.
      Sets the size in pixels of (one side of) the square around the mouse that is taken into account for selection when clicking the mouse.
      Parameters:
      aMousePressedSensitivity - the size of (one side of) the square that is taken into account for selection when clicking the mouse.
      See Also:
    • getMousePressedSensitivity

      public int getMousePressedSensitivity()
      Deprecated.
      Returns the dimension of the square around the mouse pointer taken into account when selecting using a mouse click.
      See Also:
    • startInteraction

      public void startInteraction(ILcdGXYView aGXYView)
      Deprecated.
      Implements ILcdGXYController.startInteraction.
      Specified by:
      startInteraction in interface ILcdGXYController
      Overrides:
      startInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController will interact with.
      See Also:
    • terminateInteraction

      public void terminateInteraction(ILcdGXYView aGXYView)
      Deprecated.
      Implements ILcdGXYController.terminateInteraction. Its restores the original painting mode of aGXYView.
      Specified by:
      terminateInteraction in interface ILcdGXYController
      Overrides:
      terminateInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController interacted with.
      See Also:
    • getSelectionClip

      public Rectangle getSelectionClip()
      Deprecated.
      Returns:
      the clip of the current selection
    • getPreviousSelectionClip

      public Rectangle getPreviousSelectionClip()
      Deprecated.
      Returns:
      the clip of the previous selection
    • getSelectionCount

      protected int getSelectionCount()
      Deprecated.
      Counts the number of Objects currently selected.
    • mouseDragged

      public void mouseDragged(MouseEvent me)
      Deprecated.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class TLcdGXYDragRectangleController
    • mousePressed

      public void mousePressed(MouseEvent me)
      Deprecated.
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class TLcdGXYDragRectangleController
    • processRightMouseButtonPressed

      protected void processRightMouseButtonPressed(MouseEvent e)
      Deprecated.
      Processes a right mouse pressed. This implementation triggers the ILcdAction set with setActionOnRightMouseButtonPressed, if such ILcdAction has been set. It creates an ActionEvent with "RightMouseButtonPressed" as command field. This method can be redefined.
    • mouseReleased

      public void mouseReleased(MouseEvent me)
      Deprecated.
      Implements mouseReleased. This method can be redefined to implement a behavior after processing a new selection. Do not forget to start this redefinition by calling super.mouseReleased(me).
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class TLcdGXYDragRectangleController
    • deselectAll

      protected void deselectAll(boolean updateView)
      Deprecated.
      Deselects all Objects previously selected.
    • addInSelection

      protected void addInSelection(Object aObject, ILcdGXYPainter aGXYPainter, ILcdGXYContext aGXYContext)
      Deprecated.
      This method is called in the selection process to add aObject in the selection.
      Parameters:
      aObject - the Object to add in the selection
      aGXYPainter - the ILcdGXYPainter used to test that aObject has been touched.
      aGXYContext - the ILcdGXYContext used to perform the test
    • removeFromSelection

      protected void removeFromSelection(Object aObject, ILcdGXYPainter aGXYPainter, ILcdGXYContext aGXYContext)
      Deprecated.
      This method is called in the selection process to remove aObject from the selection.
      Parameters:
      aObject - the Object to add in the selection
      aGXYPainter - a valid ILcdGXYPainter for aObject
      aGXYContext - a valid ILcdGXYContext to use the ILcdGXYPainter
    • selectAt

      public void selectAt(MouseEvent aMouseEvent, int aSelectionMode)
      Deprecated.
      This method performs a selection update when the mouse hit at (x,y) in a ILcdGXYView.
      Parameters:
      aSelectionMode - one of TLcdGXYSelectController.FIRST_TOUCHED, TLcdGXYSelectController.ALTERNATE. On a mousePressed(MouseEvent me), aSelectionMode is the one returned by selectionMode(me).
    • selectOnLayer

      protected boolean selectOnLayer(ILcdGXYContext aGXYContext, int aSelectionMode)
      Deprecated.
      Processes a selection update on an ILcdGXYLayer (aGXYContext.getGXYLayer()) at the AWT location [ aGXYContext.getX(), aGXYContext.getY() ], taking into aSelectionMode.
      Parameters:
      aSelectionMode - one of TLcdGXYSelectController.FIRST_TOUCHED, TLcdGXYSelectController.ALTERNATE. On a mousePressed(MouseEvent me), aSelectionMode is the one returned by selectionMode(me)
    • selectInBounds

      public void selectInBounds(Rectangle aRectangle)
      Deprecated.
    • fireAllLayerCollectedSelectionChanges

      protected void fireAllLayerCollectedSelectionChanges()
      Deprecated.
    • undo

      public void undo()
      Deprecated.
      Overrides:
      undo in class TLcdGXYDragRectangleController