Class AClickRubberband

java.lang.Object
edu.cnu.mdi.graphics.rubberband.ARubberband
edu.cnu.mdi.graphics.rubberband.AClickRubberband
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener
Direct Known Subclasses:
ALineClickRubberband, APolyClickRubberband, RubberRadArc

public abstract class AClickRubberband extends ARubberband
Minimal base for click-collected gestures. No policy switches; subclasses decide how to accumulate/end.
  • Constructor Details

  • Method Details

    • isClickBased

      public final boolean isClickBased()
      Description copied from class: ARubberband
      True if this rubberband collects points on click rather than drag. Used by toolbars to determine when to call isGestureValid() and getRubberbandVertices().
      Overrides:
      isClickBased in class ARubberband
      Returns:
      true if this rubberband collects points on click rather than drag, false if it is drag-based.
    • ensureStarted

      protected final boolean ensureStarted(Point p)
      Ensure the gesture has started and tempPoly exists, seeded with the start point.

      A no-op (returning true immediately) if tempPoly is already non-null. Otherwise delegates to ARubberband.startRubberbanding(Point), which always sets started = true for a non-null point (it has no rejection path), so this method currently always returns true. The boolean return is kept as a defensive contract in case a future startRubberbanding override introduces a genuine rejection path.

      Parameters:
      p - the point to seed the gesture with; must not be null
      Returns:
      true once the gesture has started and tempPoly is non-null
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class ARubberband