Package edu.cnu.mdi.graphics.rubberband
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
Minimal base for click-collected gestures.
No policy switches; subclasses decide how to accumulate/end.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
ARubberband.Policy -
Field Summary
Fields inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
active, backgroundImage, component, currentPt, fillColor, highlightColor1, highlightColor2, image, policy, poly, rubberbanded, started, startPt, tempPoly -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAClickRubberband(Component component, IRubberbanded rubberbanded, ARubberband.Policy policy) -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanEnsure the gesture has started andtempPolyexists, seeded with the start point.final booleanTrue if this rubberband collects points on click rather than drag.voidMethods inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
addPoint, begin, cancel, computeVertices, draw, endRubberbanding, getCurrent, getRubberbandBounds, getRubberbandVertices, getStart, isActive, isGestureValid, modifyCurrentPoint, mouseClicked, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased, setActive, setCurrent, setFillColor, setHighlightColor1, setHighlightColor2, startRubberbanding
-
Constructor Details
-
AClickRubberband
protected AClickRubberband(Component component, IRubberbanded rubberbanded, ARubberband.Policy policy)
-
-
Method Details
-
isClickBased
public final boolean isClickBased()Description copied from class:ARubberbandTrue if this rubberband collects points on click rather than drag. Used by toolbars to determine when to call isGestureValid() and getRubberbandVertices().- Overrides:
isClickBasedin classARubberband- Returns:
- true if this rubberband collects points on click rather than drag, false if it is drag-based.
-
ensureStarted
Ensure the gesture has started andtempPolyexists, seeded with the start point.A no-op (returning
trueimmediately) iftempPolyis already non-null. Otherwise delegates toARubberband.startRubberbanding(Point), which always setsstarted = truefor a non-null point (it has no rejection path), so this method currently always returnstrue. Thebooleanreturn is kept as a defensive contract in case a futurestartRubberbandingoverride introduces a genuine rejection path.- Parameters:
p- the point to seed the gesture with; must not benull- Returns:
trueonce the gesture has started andtempPolyis non-null
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classARubberband
-