Class View.ClockPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
eu.bandm.music.applications.indisp.View.ClockPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Enclosing class:
View

class View.ClockPanel extends JComponent
GUI class which shows the selected meter as a circle of events and can mark the currently active event graphically.
  • Field Details

    • points

      int points
      Convenience cache: Number of events = number of small circles.
    • shapes

      Cache for the circles which correspond to the events.
    • innerShapes

      RectangularShape[] innerShapes
      Cache for the circles which correspond to the events.
    • weights

      int[] weights
      Cache for the weights of the circle points.
    • startX

      int[] startX
      Cache for the start position of the axis lines.
    • startY

      int[] startY
      Cache for the start position of the axis lines.
    • startDone

      boolean[] startDone
      Flag whether the caches are valid.
    • circum

      Integer circum
      Flag for the circumvention straight line.
    • radius

      int radius
      Radius of the large circle.
    • x

      int x
      Center coordinate of the large circle.
    • y

      int y
      Center coordinate of the large circle.
    • active

      int active
      Index of the currently active event. Zero-based. Can initially be -1 for "none selected".
    • predecs

      int[] predecs
      Points to the first preceding event of higher weight. Needed for tree painting.
    • clockImage

      Image clockImage
      Buffer for the clock image.
    • oldClockFill

      String oldClockFill
      Memorize to detect state change of the graphics.
    • oldAudible

      int oldAudible
      Memorize to detect size change of the graphic.
    • oldWidth

      int oldWidth
      Memorize to detect size changes of the panel.
    • oldHeight

      int oldHeight
      Memorize to detect size changes of the panel.
  • Constructor Details

    • ClockPanel

      ClockPanel()
      Only constructor.
  • Method Details

    • showPhase

      void showPhase(int i)
      Show the change of the current phase in the graphics.
      Parameters:
      i - phase to show. Must be valid 0 <= i < points.
    • calculateSizeDependent

      void calculateSizeDependent()
      Recalculate the center position and the size of the outer circle.
    • findPredecs

      void findPredecs()
    • calcStartPoint

      void calcStartPoint(int i)
      Calculate the point where the tree-branch starts which leads to the circle which represents the metric position.
    • calculateMeterPoints

      void calculateMeterPoints()
      Recalculate the shapes for all the event-representing circles and store them to shapes. Calculate the start points of the axis lines.
    • drawAll

      void drawAll(Graphics2D gr)
      Draw completely: background fill, large circle, all event-representing circles, active event marked.
    • drawAllPoints

      public void drawAllPoints(Graphics2D gr)
      Called by change of JSlider "audible".
    • drawEvent

      void drawEvent(Graphics2D gr, int pos)
    • drawActive

      void drawActive(Graphics2D gr)
      Draw only the filling of the active event and delete the filling of its (static) predecessor.
    • paint

      public void paint(Graphics g)
      Paint method called by Swing runtime: Create new image if the size of the widget has changed and paint it completely. Otherwise paint and clear only the active-event indication. Anyhow transfer the image buffer to the screen.
      Overrides:
      paint in class JComponent
    • setNsm

      void setNsm()
      Set a new NSM and update the graphics and caches accordingly. An NSM object always represents a valid meter specification.