Class InputTrack

All Implemented Interfaces:
PropertyChangeListener, EventListener, Drawable, Interactive, Measurable, Trackable
Direct Known Subclasses:
Protractor, TapeMeasure

public abstract class InputTrack extends TTrack
Superclass for Protractor and TapeMeasure, both of which have a clickable editable interface for changing the value.
Author:
hansonr
  • Field Details

    • inputField

      protected NumberField inputField
    • editListener

      protected MouseListener editListener
    • editing

      protected boolean editing
    • fixedPosition

      protected boolean fixedPosition
    • ruler

      protected Ruler ruler
    • rulerCheckbox

      protected JCheckBox rulerCheckbox
  • Constructor Details

    • InputTrack

      public InputTrack(int type)
  • Method Details

    • checkKeyFrame

      protected abstract boolean checkKeyFrame()
    • createInputField

      protected abstract NumberField createInputField()
    • endEditing

      protected abstract void endEditing(Step step, String rawText)
    • getLayoutBounds

      protected abstract Rectangle getLayoutBounds(Step step)
    • refreshStep

      protected abstract void refreshStep(Step step)
    • setInputValue

      protected abstract void setInputValue(Step step)
    • setTrackerPanel

      public void setTrackerPanel(TrackerPanel panel)
      Description copied from class: TTrack
      Install the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables) and add this track to the panel's specific (outgoing) listener lists so that the track can respond to external changes. This method is overridden to add specific TrackerPanel events for subclasses.
      Overrides:
      setTrackerPanel in class TTrack
      Parameters:
      panel - the TrackerPanel
    • setFootprint

      public void setFootprint(String name)
      Description copied from class: TTrack
      Sets the footprint to the specified choice.
      Overrides:
      setFootprint in class TTrack
      Parameters:
      name - the name of the desired footprint
    • setColor

      public void setColor(Color color)
      Description copied from class: TTrack
      Sets the color.
      Overrides:
      setColor in class TTrack
      Parameters:
      color - the desired color
    • getStep

      public Step getStep(TPoint point, TrackerPanel trackerPanel)
      Description copied from class: TTrack
      Gets a step containing a TPoint. May return null.
      Overrides:
      getStep in class TTrack
      Parameters:
      point - a TPoint
      trackerPanel - ignored
      Returns:
      the step containing the TPoint
    • setFontLevel

      public void setFontLevel(int level)
      Description copied from class: TTrack
      Sets the font level.
      Overrides:
      setFontLevel in class TTrack
      Parameters:
      level - the desired font level
    • getRuler

      protected Ruler getRuler()
      Gets the Ruler. Subclasses override to return the appropriate Ruler type.
      Returns:
      the Ruler
    • setEditAction

      protected void setEditAction(Step step, Point pt, String rawText)
    • isFixedPosition

      public boolean isFixedPosition()
      Gets the fixed position property.
      Returns:
      true if fixed
    • setFixedPosition

      protected void setFixedPosition(boolean fixed)
      Sets the fixed property. When fixed, it has the same position at all times.
      Overrides:
      setFixedPosition in class TTrack
      Parameters:
      fixed - true to fix
    • setTrailVisible

      public void setTrailVisible(boolean visible)
      Overrides TTrack setTrailVisible method to keep trails hidden.
      Overrides:
      setTrailVisible in class TTrack
      Parameters:
      visible - ignored
    • deleteStep

      public Step deleteStep(int n)
      Overrides TTrack deleteStep method to prevent deletion.
      Overrides:
      deleteStep in class TTrack
      Parameters:
      n - the frame number
      Returns:
      the deleted step
    • getKeyStep

      protected Step getKeyStep(Step step)
      Returns the key step for a given step. The key step defines the positions of the tape ends.
      Parameters:
      step - the step
      Returns:
      the key step
    • getStep

      public Step getStep(int n)
      Overrides TTrack getStep method to provide fixedTape behavior.
      Overrides:
      getStep in class TTrack
      Parameters:
      n - the frame number
      Returns:
      the step
    • setEditing

      protected void setEditing(boolean edit, Step target, Point pt)
      Sets the editing flag.
      Parameters:
      edit - true to edit the scale
      target - the tape or protractor step that handles the edit process
      pt - TODO
    • stopEditing

      protected void stopEditing()
    • mouseClickedAction

      protected void mouseClickedAction(Point pt)
    • setMagValue

      protected void setMagValue()
    • getAttachmentLength

      protected int getAttachmentLength()
      Overrides:
      getAttachmentLength in class TTrack
    • isAutoTrackable

      protected boolean isAutoTrackable(int pointIndex)
      Determines if the given point index is autotrackable.
      Overrides:
      isAutoTrackable in class TTrack
      Parameters:
      pointIndex - the points[] index
      Returns:
      true if autotrackable