java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.designer.designable.Ruler
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
Ruler.XAxis, Ruler.YAxis

public abstract class Ruler extends JPanel
Component that draws the ruler for the DesignPanel. Has two flavors implemented as subclasses - XAxis and YAxis
See Also:
  • Field Details

    • marker

      protected int marker
  • Constructor Details

  • Method Details

    • initMarker

      protected abstract void initMarker(GeneralPath markerShape)
      Create a shape to indicate the curser position (a.k.a. the "marker")
    • updateMarker

      protected abstract void updateMarker(MouseEvent event)
    • translateMarker

      protected abstract void translateMarker(Graphics g, int marker)
      Given the distance marker in pixels, translate the graphics context so that drawing the shape created by #getMarkerPosition(MouseEvent) will be at the correct position.
    • offset

      protected abstract int offset(Rectangle r)
      Whats the offset position for the given rectangle in this ruler's dimension? (i.e. for a horizontal ruler it would be r.x)
      Parameters:
      r - The rectangle in question.
    • extent

      protected abstract int extent(Rectangle r)
      Whats the extent of the given rectangle in this ruler's dimension? (i.e. for a horizontal ruler it would be r.width)
      Parameters:
      r - The rectangle in question.
    • paintTick

      protected abstract void paintTick(Graphics2D g, int value, int len, Rectangle area)
      Paint the tick mark line.
    • paintLabel

      protected abstract void paintLabel(Graphics2D g, int pos, int value, Rectangle area)
      Paint the label (a string representing the ruler value.
      Parameters:
      pos - The position in Java2D space at which to paint the label
      value - The value of the label itself.
    • getGuideType

      public abstract int getGuideType()
      What kind of guide type should be created when dragging from this ruler? Should be one of SwingConstants.HORIZONTAL or SwingConstants.VERTICAL
    • getGuidePosition

      public abstract int getGuidePosition(Point p)
    • paintComponent

      protected void paintComponent(Graphics graphics)
      Overrides:
      paintComponent in class JComponent