Class BeatBasedLayoutManager

java.lang.Object
org.jjazz.cl_editor.barrenderer.api.BeatBasedLayoutManager
All Implemented Interfaces:
LayoutManager

public class BeatBasedLayoutManager extends Object implements LayoutManager
This LayoutManager places ItemRenderers at their corresponding beat position, depending on the DisplayQuantization setting.

ItemRenderers are set to their preferredSize.

  • Constructor Details

    • BeatBasedLayoutManager

      public BeatBasedLayoutManager()
  • Method Details

    • getPositionFromPoint

      public Position getPositionFromPoint(BarRenderer br, int xPos)
      Return the Position that corresponds to the X-coordinate xPos in the BarRenderer.
      Parameters:
      xPos - int The x position in the BarRenderer coordinates.
      Returns:
      Position
    • getBeatXPosition

      public int getBeatXPosition(float beat, int barWidth, TimeSignature ts)
      Calculate the X position for a beat, in a bar who has width=barWidth.
      Parameters:
      beat - A float representing the beat position.
      barWidth - An integer for the width of the bar.
      ts -
      Returns:
      An integer representing the X position of pos.
    • layoutContainer

      public void layoutContainer(Container parent)
      Layout all children at their respective beat position with their preferredSize.
      Specified by:
      layoutContainer in interface LayoutManager
      Parameters:
      parent - Container
    • minimumLayoutSize

      public Dimension minimumLayoutSize(Container parent)
      Specified by:
      minimumLayoutSize in interface LayoutManager
    • preferredLayoutSize

      public Dimension preferredLayoutSize(Container parent)
      Specified by:
      preferredLayoutSize in interface LayoutManager
    • addLayoutComponent

      public void addLayoutComponent(String name, Component comp)
      Specified by:
      addLayoutComponent in interface LayoutManager
    • removeLayoutComponent

      public void removeLayoutComponent(Component comp)
      Specified by:
      removeLayoutComponent in interface LayoutManager
    • getDisplayQuantization

      public Quantization getDisplayQuantization()
    • setDisplayQuantization

      public void setDisplayQuantization(Quantization displayQuantization)