Class CL_BarEditorDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, DisplayTransposableRenderer

public abstract class CL_BarEditorDialog extends JDialog implements DisplayTransposableRenderer
A JDialog used to edit a ChordLeadSheet bar.

The Dialog should not directly change the model, it should just return the proposed changes. The calling application will update the model (if dialog returned OK) and manage the undo/redo aspects.

See Also:
  • Constructor Details

    • CL_BarEditorDialog

      public CL_BarEditorDialog()
      Dialog is automatically owned by WindowManager.getDefault().getMainWindow()
  • Method Details

    • getDefault

      public static CL_BarEditorDialog getDefault()
    • preset

      public abstract void preset(Preset preset, ChordLeadSheet cls, int barIndex, boolean swing)
      Preset the dialog before using it.

      Method must take into account a possible display transposition if it was previously set.

      Parameters:
      preset -
      cls - ChordLeadSheet
      barIndex -
      swing - If true the bar is in swing mode, eg half-bar position for a 3/4 rhythm is 5/3=1.666...
      See Also:
    • isExitOk

      public abstract boolean isExitOk()
      Returns:
      True if dialog was exited OK, false if dialog operation was cancelled.
    • getSection

      public abstract CLI_Section getSection()
      Return the section which should be inserted, or used to update bar's existing section.
      Returns:
      Can be null if section data (name or timesignature) has not changed.
    • getAddedItems

      public abstract List<ChordLeadSheetItem> getAddedItems()
      The new items that should be inserted in the bar.
      Returns:
      Can be empty if no items inserted.
    • getRemovedItems

      public abstract List<ChordLeadSheetItem> getRemovedItems()
      The items that should be removed in the bar.
      Returns:
      Can be empty if no items to remove.
    • getChangedItems

      public abstract Map<ChordLeadSheetItem,Object> getChangedItems()
      The Items for which data should be changed.
      Returns:
      Can be empty. Associate the new data for each changed item.
    • cleanup

      public abstract void cleanup()
      Cleanup references to preset data and dialog results.

    • setDisplayTransposition

      public abstract void setDisplayTransposition(int dt)
      Must be called before calling preset() to be effective.
      Specified by:
      setDisplayTransposition in interface DisplayTransposableRenderer
      Parameters:
      dt -
      See Also:
    • getDisplayTransposition

      public abstract int getDisplayTransposition()
      Specified by:
      getDisplayTransposition in interface DisplayTransposableRenderer