Class CL_Editor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, org.openide.util.Lookup.Provider

public abstract class CL_Editor extends JPanel implements org.openide.util.Lookup.Provider
A ChordLeadSheet editor.

Editor's lookup contains :
- editor's ActionMap
- edited ChordLeadSheet
- edited Song (container of the ChordLeadSheet if there is one)
- editor's Zoomable instances
- selected items or bars

The editor creates BarBoxes using a BarBoxConfig based on the editor's default config, and on the BarRenderer types obtained from the BarRendererProvider instances found in the global lookup.

See Also:
  • Field Details

    • PROP_NB_COLUMNS

      public static final String PROP_NB_COLUMNS
      oldvalue=old nbCols, newValue=new nbCols.

      Note that the NbColumns setting is serialized via the ZoomHFactor.

      See Also:
    • PROP_SECTION_QUANTIZATION

      public static final String PROP_SECTION_QUANTIZATION
      oldvalue=CLI_Section, newValue=new quantization value.

      Don't change the String value, it's also used as client property name during CLI_Section serialization since JJazzLab 4.

      See Also:
    • PROP_SECTION_COLOR

      public static final String PROP_SECTION_COLOR
      oldvalue=CLI_Section, newValue=new color.

      Don't change the String value, it's also used as client property name during CLI_Section serialization since JJazzLab 4.

      See Also:
    • PROP_SECTION_START_ON_NEW_LINE

      public static final String PROP_SECTION_START_ON_NEW_LINE
      oldvalue=CLI_Section, newValue=new boolean.

      Don't change the String value, it's also used as client property name during CLI_Section serialization since JJazzLab 4.

      See Also:
    • PROP_BAR_ANNOTATION_VISIBLE

      public static final String PROP_BAR_ANNOTATION_VISIBLE
      oldValue=old boolean, newValue=new boolean

      Don't change the String value, it's also used as a client property name during Song serialization since JJazzLab 4.

      See Also:
    • PROP_BAR_ANNOTATION_NB_LINES

      public static final String PROP_BAR_ANNOTATION_NB_LINES
      oldValue=old number of liens, newValue=new number of lines

      Don't change the String value, it's also used as a client property name during Song serialization since JJazzLab 4.

      See Also:
  • Constructor Details

    • CL_Editor

      public CL_Editor()
  • Method Details

    • setEditorMouseListener

      public abstract void setEditorMouseListener(CL_EditorMouseListener brm)
    • getModel

      public abstract ChordLeadSheet getModel()
      Returns:
      The ChordLeadSheet model for this CL_Editor.
    • getSongModel

      public abstract Song getSongModel()
      Returns:
      The Song which contains the ChordLeadSheet. Can be null.
    • getUndoManager

      public abstract org.openide.awt.UndoRedo getUndoManager()
      Returns:
      The UndoManager used but this editor.
    • getSettings

      public abstract CL_EditorSettings getSettings()
      The settings of the editor.
      Returns:
    • getBarRendererFactory

      public abstract BarRendererFactory getBarRendererFactory()
      The factory used by this editor via BarBoxes.
      Returns:
    • setDisplayQuantizationValue

      public abstract void setDisplayQuantizationValue(CLI_Section section, Quantization q)
      Set how chords positions are quantized for display.

      Fires a property change event.

      Parameters:
      q -
      section - If null, set the quantization display for all sections.
      See Also:
      • #getSectionQuantizationPropertyName(org.jjazz.chordleadsheet.api.Section)
    • getDisplayQuantizationValue

      public abstract Quantization getDisplayQuantizationValue(CLI_Section section)
      Parameters:
      section -
      Returns:
      The quantization used to display the specified section.
    • getFocusedBar

      public abstract SelectedBar getFocusedBar(boolean includeFocusedItem)
      Get the focused SelectedBar, if any.
      Parameters:
      includeFocusedItem - If true and focus is on a ChordLeadSheetItem, return the SelectedBar for this item.
      Returns:
      Can be null.
    • setSectionStartOnNewLine

      public abstract void setSectionStartOnNewLine(CLI_Section section, boolean b)
      Set if the bar corresponding to specified section should start on a new line.

      Fires a property change event.

      Parameters:
      section -
      b -
      See Also:
      • #getSectionOnNewLinePropertyName(org.jjazz.chordleadsheet.api.Section)
    • isSectionStartOnNewLine

      public abstract boolean isSectionStartOnNewLine(CLI_Section section)
      Parameters:
      section -
      Returns:
      True if section bar should start on new line.
    • setSectionColor

      public abstract void setSectionColor(CLI_Section section, Color c)
      Set the color associated to a section.

      Fires a property change event.

      Parameters:
      section - Must be one of the ColorSetManager reference colors.
      c -
      See Also:
      • #getSectionColorPropertyName(org.jjazz.chordleadsheet.api.Section)
    • getSectionColor

      public abstract Color getSectionColor(CLI_Section section)
      Get the color associated to a section.
      Parameters:
      section -
      Returns:
    • setBarBoxConfig

      public abstract void setBarBoxConfig(BarBoxConfig bbConfig, Integer... barIndexes)
      Set the BarBoxConfig for specified bars.
      Parameters:
      bbConfig -
      barIndexes - If no arg specified, apply bbConfig to all bars
    • getBarBoxConfig

      public abstract BarBoxConfig getBarBoxConfig(int barIndex)
      Get the BarBoxConfig of the specified bar.
      Parameters:
      barIndex -
      Returns:
    • isBarAnnotationVisible

      public abstract boolean isBarAnnotationVisible()
      Check if bar annotations are visible.
      Returns:
    • setBarAnnotationVisible

      public abstract void setBarAnnotationVisible(boolean b)
      Set bar annotations visible or not.

      Fire a PROP_BAR_ANNOTATIONS_VISIBLE change event.

      Parameters:
      b -
    • getBarAnnotationNbLines

      public abstract int getBarAnnotationNbLines()
      Get the number of lines of a bar annotation.
      Returns:
    • setBarAnnotationNbLines

      public abstract void setBarAnnotationNbLines(int n)
      Set the number of lines of a bar annotation.

      Fire a PROP_BAR_ANNOTATIONS_NB_LINES change event.

      Parameters:
      n - A value between 1 and 10
    • setNbColumns

      public abstract void setNbColumns(int nbCols)
    • getNbColumns

      public abstract int getNbColumns()
    • getNbBarBoxes

      public abstract int getNbBarBoxes()
    • cleanup

      public abstract void cleanup()
      Clean up everything so component can be garbaged.
    • getPositionFromPoint

      public abstract Position getPositionFromPoint(Point editorPoint)
      Return the Position that correspond to a graphical point in the editor.

      If point is on a model bar try to retrieve the beat value. If point is on a non-model bar (eg past end), return only the bar, beat is set to 0. If point is somewhere else return null.

      Parameters:
      editorPoint - A point in the editor's coordinates.
      Returns:
      Null if point does not correspond to a barbox
    • makeBarVisible

      public abstract void makeBarVisible(int barIndex)
      Make sure a specific bar is visible.
      Parameters:
      barIndex - int The index of the bar to be made visible
    • setZoomVFactor

      public abstract void setZoomVFactor(int factor)
      Set the zoom vertical factor.
      Parameters:
      factor - A value between 0 and 100 included.
    • getZoomVFactor

      public abstract int getZoomVFactor()
      Get the zoom vertical factor.
      Returns:
      A value between 0 and 100 included.
    • selectBars

      public abstract void selectBars(int barIndexFrom, int barIndexTo, boolean b)
      Select the bars in the specified barIndex range.
      Parameters:
      barIndexFrom - int
      barIndexTo - int
      b - True to select, False to unselect.
    • selectBarsExcept

      public abstract void selectBarsExcept(int barIndexFrom, int barIndexTo, boolean b)
      Select the bars out of the specified barIndex range.
      Parameters:
      barIndexFrom - int
      barIndexTo - int
      b - True to select, False to unselect.
    • selectItem

      public abstract void selectItem(ChordLeadSheetItem<?> item, boolean b)
      Select the ItemRenderer(s) whose model is item.
      Parameters:
      item -
      b - True to select, False to unselect.
    • selectItems

      public abstract void selectItems(List<? extends ChordLeadSheetItem> items, boolean b)
      Replace the current selection with the specified items.
      Parameters:
      items -
      b - True to select, False to unselect.
    • setFocusOnBar

      public abstract void setFocusOnBar(int barIndex)
      Set the focus on one bar in the editor.
      Parameters:
      barIndex - int The index of the bar.
    • setFocusOnItem

      public abstract void setFocusOnItem(ChordLeadSheetItem<?> item, IR_Type irClass)
      Set the focus on an ItemRenderer whose model is item.
      Parameters:
      item -
      irClass - the type of ItemRenderer to focus if there is multiple ItemRenderers for one item. If null, focus on the first ItemRenderer found.
    • requestAttention

      public abstract void requestAttention(ChordLeadSheetItem<?> item)
      Cause the renderer(s) of the specified item to do a brief UI change to request user attention.
      Parameters:
      item -
      Throws:
      IllegalArgumentException - If ChordLeadSheet model does not contain item.
    • showInsertionPoint

      public abstract void showInsertionPoint(boolean b, ChordLeadSheetItem<?> item, Position pos, boolean copyMode)
      Show an insertion point in the editor for copy/move operations.
      Parameters:
      b - Show/hide the insertion point. If false other arguments are not used.
      item - The item for which we show the insertion point for.
      pos - The position of the insertion point.
      copyMode - If true insertion point is shown for a copy operation, otherwise it's a move operation.
    • showPlaybackPoint

      public abstract void showPlaybackPoint(boolean b, Position pos)
      Show a playback point in the editor at specified position.
      Parameters:
      b - Show/hide the playback point.
      pos -
    • getBarRectangle

      public abstract Rectangle getBarRectangle(int barBoxIndex)
      Get the dimensions of the specified BarBox.
      Parameters:
      barBoxIndex -
      Returns:
      A Rectangle in the screen coordinates of this editor.
    • unselectAll

      public void unselectAll()
      Clear the editor selection.