Class CopyBuffer

java.lang.Object
org.jjazz.cl_editor.api.CopyBuffer

public class CopyBuffer extends Object
Singleton class to manage ChordLeadSheetItems and Bars for copy/paste operations. There are 2 modes of copy, ItemMode and BarMode.
  • Method Details

    • getInstance

      public static CopyBuffer getInstance()
    • itemModeCopy

      public void itemModeCopy(List<? extends ChordLeadSheetItem> items)
      Put items in the buffer in ItemMode.
      Parameters:
      items -
    • barModeCopy

      public void barModeCopy(List<ChordLeadSheetItem> items, int fromBarIndex, int toBarIndex)
      Put a copy of each item in the buffer in BarMode
      Parameters:
      items -
      fromBarIndex -
      toBarIndex -
    • clear

      public void clear()
    • getSize

      public int getSize()
      Returns:
      int The size of ChordLeadSheetItems in the buffer.
    • isBarCopyMode

      public boolean isBarCopyMode()
    • getBarMinIndex

      public int getBarMinIndex()
    • getBarMaxIndex

      public int getBarMaxIndex()
    • isEmpty

      public boolean isEmpty()
    • getItemsCopy

      public List<ChordLeadSheetItem> getItemsCopy(ChordLeadSheet targetCls, int targetBarIndex)
      Return a copy of the items in the buffer adjusted to targetBarIndex and with the specified container.

      In ItemMode, the items are shitfed so the first item start at targetBarIndex. In BarMode, the items are shifted so that getBarMinIndex() match targetBarIndex.

      Parameters:
      targetCls - The container of the new items. If null container is not changed.
      targetBarIndex - The barIndex where items are copied to. If barIndex<0, positions are not changed. @return
      Returns: