Class TLcdGXYNewController

All Implemented Interfaces:
ILcdUndoableSource, ILcdStatusSource, ILcdGXYController, KeyListener, MouseListener, MouseMotionListener, Serializable, EventListener

public class TLcdGXYNewController extends ALcdGXYSmartController implements MouseListener, MouseMotionListener
Deprecated.
For new code, we recommend using the more flexible and powerful TLcdGXYNewController2. The functionality of this class will remain present as is.
Creates an object, initializes it by interacting with the mouse through a sequence of mouse events and adds it to one of the a layer in a view. The controller is configured with a controller model which determines
  • the choice of an ILcdGXYLayer,
  • the object to create,
  • the addition of the new Object in the chosen ILcdGXYLayer

Before this controller can be used on a view, the controller model has to be set.

Please refer to ALcdGXYNewControllerModel for undo/redo support.

See Also:
  • Constructor Details

    • TLcdGXYNewController

      public TLcdGXYNewController()
      Deprecated.
      Constructs a controller to create and initialize new objects via mouse interaction. Note that a controller model has to be set before this controller can be used on a view.
      See Also:
    • TLcdGXYNewController

      public TLcdGXYNewController(ILcdGXYNewControllerModel aControllerModel)
      Deprecated.
      Constructs a controller to create and initialize new objects via mouse interaction.
      Parameters:
      aControllerModel - the model that defines what type of object will be created and how and where it will be displayed in the view.
    • TLcdGXYNewController

      public TLcdGXYNewController(boolean aRegisterInstance)
      Deprecated.
      use the constructor without parameters.
      Parameters:
      aRegisterInstance - whether to register this controller as a Bean.
  • 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 ALcdGXYSmartController
      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 ALcdGXYSmartController
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • startInteraction

      public void startInteraction(ILcdGXYView aGXYView)
      Deprecated.
      Description copied from class: ALcdGXYController
      Sets up the controller to receive input through the view passed.

      All ILcdGXYView implementations that support interaction call this method when the controller has been made active with setGXYController on the view, so this method shouldn't normally be called directly. Note that most view implementations add the controller as listener if appropriate before calling this method.

      Sets the cursor on the view and sets the view for which this controller is now active. Sends out a status event based on the short description.

      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.
      Description copied from class: ALcdGXYController
      Releases a few items. Can be redefined but this 'super' method should be called too.
      Specified by:
      terminateInteraction in interface ILcdGXYController
      Overrides:
      terminateInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController interacted with.
      See Also:
    • isContinueEdit

      protected boolean isContinueEdit(int aPointCount, MouseEvent aMouseEvent)
      Deprecated.
      Returns true if creation is not yet finished, false otherwise.
      Parameters:
      aPointCount - the number of points created until now
      aMouseEvent - the current mouse event
      Returns:
      true when any of the following holds:
      • the number of points created is less than the number required to create the shape returned by the controller model;
      • the creation click count is unlimited and no double-click, right or middle button click has occurred.
      false otherwise.
      See Also:
    • doPanGXYView

      protected void doPanGXYView(int aDeltaX, int aDeltaY)
      Deprecated.
      Description copied from class: ALcdGXYSmartController
      Performs the pan of this ILcdGXYController ILcdGXYView
      Overrides:
      doPanGXYView in class ALcdGXYSmartController
      Parameters:
      aDeltaX - delta along the X axis, in AWT pixels
      aDeltaY - delta along the Y axis, in AWT pixels
    • doZoomGXYView

      protected void doZoomGXYView(double aDoubleFactor)
      Deprecated.
      Description copied from class: ALcdGXYSmartController
      Performs the zoom of this ILcdGXYController ILcdGXYView
      Overrides:
      doZoomGXYView in class ALcdGXYSmartController
      Parameters:
      aDoubleFactor - zoom factor with which to multiply the view's scale
    • mouseDragged

      public void mouseDragged(MouseEvent aMouseEvent)
      Deprecated.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class ALcdGXYSmartController
    • mouseMoved

      public void mouseMoved(MouseEvent aMouseEvent)
      Deprecated.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class ALcdGXYSmartController
    • mouseMovedOrDragged

      protected void mouseMovedOrDragged(MouseEvent aMouseEvent)
      Deprecated.
      Handles what should be done to visualize the creation of the object.
      Parameters:
      aMouseEvent - the current mouse event.
    • paint

      public void paint(Graphics aGraphics)
      Deprecated.
      Description copied from class: ALcdGXYController
      Enables the controller to give visual feedback on the current user interactions. Note that the controller is responsible for repainting the view.

      Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.

      Specified by:
      paint in interface ILcdGXYController
      Overrides:
      paint in class ALcdGXYController
      Parameters:
      aGraphics - the Graphics on which the view was rendered.
    • finishEdit

      public void finishEdit(MouseEvent aMouseEvent)
      Deprecated.
      Finishes creation of the object. At this time the object is ready to be added into an ILcdGXYLayer. If there is a action to trigger after creation, it is called within this method.
      Parameters:
      aMouseEvent - the last mouse event.
    • cancelEdit

      public void cancelEdit(MouseEvent aMouseEvent)
      Deprecated.
      Cancels the creation of the object. The action to trigger after creation is called within this method.
      Parameters:
      aMouseEvent - the current mouse event.
    • mouseReleased

      public void mouseReleased(MouseEvent aMouseEvent)
      Deprecated.
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class ALcdGXYSmartController
    • setControllerModel

      public void setControllerModel(ILcdGXYNewControllerModel aControllerModel)
      Deprecated.
      Sets the ILcdGXYNewControllerModel to delegate to.
      Parameters:
      aControllerModel - the ILcdGXYNewControllerModel to delegate to.
      See Also:
    • getControllerModel

      public ILcdGXYNewControllerModel getControllerModel()
      Deprecated.
      Returns the ILcdGXYNewControllerModel this TLcdGXYNewController delegates to.
      Returns:
      the ILcdGXYNewControllerModel this TLcdGXYNewController delegates to.
      See Also:
    • getUndoLeft

      public int getUndoLeft()
    • getRedoLeft

      public int getRedoLeft()
    • resetUndoHistory

      public void resetUndoHistory()
    • undo

      public void undo()
    • redo

      public void redo()
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
      Deprecated.
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
      Deprecated.
    • setActionToTriggerAfterCreation

      public void setActionToTriggerAfterCreation(ILcdAction aNewActionToTriggerAfterCreation)
      Deprecated.
      Sets the ILcdAction that will be triggered just after this ILcdGXYController has created a new Object and added it to an ILcdModel. It might be interesting for example to set an ILcdGXYController ( using a TLcdGXYSetControllerAction) that can edit the new Object, just after this one has been created and initialized. When no action is set, the new controller model will be requested for an object and a layer when creation has been finished or has been canceled.
      Parameters:
      aNewActionToTriggerAfterCreation - the ILcdAction to be triggered or null if no ILcdAction has to be triggered.
      See Also:
    • getActionToTriggerAfterCreation

      public ILcdAction getActionToTriggerAfterCreation()
      Deprecated.
      Returns the ILcdAction that will be will be triggered just after this ILcdGXYController has created a new Object, initialized it and added it to an ILcdModel.
      Returns:
      the ILcdAction to be triggered after creation of a new Object.
      See Also:
    • setSnappables

      public void setSnappables(ILcdGXYLayerSubsetList aNewSnappables)
      Deprecated.
      Sets the Objects to snap to when initializing a new created Object: null is a valid argument.
      Parameters:
      aNewSnappables - the new value for the snappables property. null is a valid argument.
      See Also:
    • getSnappables

      public ILcdGXYLayerSubsetList getSnappables()
      Deprecated.
      Returns the Objects to snap to when initializing a new created Object: null is a valid returned value.
      Returns:
      the Objects to snap to when initializing a new created Object: null is a valid returned value.
      See Also:
    • getObject

      protected Object getObject()
      Deprecated.
      Returns the object that the NewController is creating.
      Returns:
      the object that the NewController is creating.
    • isUseEditingBoundsForRepaint

      public boolean isUseEditingBoundsForRepaint()
      Deprecated.
      Returns whether the new controller repaints only part of the ILcdGXYView while creating.
      Returns:
      whether the new controller repaints only part of the ILcdGXYView while creating.
      Since:
      3.1
      See Also:
    • setUseEditingBoundsForRepaint

      public void setUseEditingBoundsForRepaint(boolean aUseEditingBoundsForRepaint)
      Deprecated.
      Sets whether the new controller should repaint only part of the ILcdGXYView while creating. The default value is false.
      In order to use this mode the ILcdGXYPainter of the object under creation should properly implement the method ILcdGXYPainter.boundsSFCT, i.c., they should take the modes ILcdGXYPainter.CREATING, ILcdGXYPainter.TRANSLATING, and ILcdGXYPainter.RESHAPING into account.
      Parameters:
      aUseEditingBoundsForRepaint - the new useClip value.
      Since:
      3.1
      See Also:
    • getEditingBoundsForRepaintMargin

      public int getEditingBoundsForRepaintMargin()
      Deprecated.
      Returns the margin to extend the dirty region when repainting only part of the view. It is only used if the property useEditingBoundsForRepaint is true. It is expressed in screen pixels.
      Returns:
      the margin to extend the dirty region when repainting only part of the view.
      See Also:
    • setEditingBoundsForRepaintMargin

      public void setEditingBoundsForRepaintMargin(int aEditingBoundsForRepaintMargin)
      Deprecated.
      Sets the margin to extend the dirty region when repainting only part of the view. It is only used if the property useEditingBoundsForRepaint is true. It is expressed in screen pixels.
      Parameters:
      aEditingBoundsForRepaintMargin - the new editingBoundsForRepaintMargin value (screen pixels).
      See Also:
    • mouseExited

      public void mouseExited(MouseEvent me)
      Deprecated.
      Only pans the view when an object is actively being created.
      Specified by:
      mouseExited in interface MouseListener
      Overrides:
      mouseExited in class ALcdGXYSmartController
      Parameters:
      me - the mouse event indicating that the mouse has left the view.
      See Also: