Package org.jjazz.cl_editor.barbox.api
Class BarBox
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jjazz.cl_editor.barbox.api.BarBox
- All Implemented Interfaces:
FocusListener
,ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
This object groups several BarRenderers in a "stack view" that represent one leadSheet bar.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionBarBox
(CL_Editor editor, int bbIndex, int modelBarIndex, ChordLeadSheet model, BarBoxConfig config, BarBoxSettings settings, BarRendererFactory brf, Object groupKey) Construct a BarBox. -
Method Summary
Modifier and TypeMethodDescriptionaddItem
(ChordLeadSheetItem<?> item) Add an item in the BarBox.void
cleanup()
Clean up everything so this object can be garbaged.void
void
int
int
The bar index in the chordleadsheet model.getPositionFromPoint
(Point barboxPoint) Return the position (bar, beat) which corresponds to a given point in the BarBox.Get the section this BarBox belongs to.int
boolean
void
moveItem
(ChordLeadSheetItem<?> item) Request BarRenderers to update after an item has moved within the bar.void
removeItem
(ChordLeadSheetItem<?> item) Remove an item from the BarBox.void
selectItem
(ChordLeadSheetItem<?> item, boolean b) The operation requests each BarRenderer to select the ItemRenderers of item.void
setBarIndex
(int bar) Set the barIndex of this BarBox.final boolean
setConfig
(BarBoxConfig bbConfig) Set the BarBoxConfig of this BarBox.void
Set how chords positions are quantized for display.void
setEnabled
(boolean b) void
setFocusOnItem
(ChordLeadSheetItem<?> item, IR_Type irType) Set the focus on an ItemRenderer for item.final void
setModel
(int modelBarIndex, ChordLeadSheet model) Set the model for this BarBox.void
setModelBarIndex
(int bar) Set the barIndex within the model.void
setSection
(CLI_Section section) Request BarRenderers to update if the section they belong to has changed.void
setSelected
(boolean b) Set the Component selected or not, forward to BarRenderers as well.void
setZoomVFactor
(int factor) Vertical zoom factor.void
showInsertionPoint
(boolean b, ChordLeadSheetItem<?> item, Position pos, boolean copyMode) void
showPlaybackPoint
(boolean b, Position pos) Change background to represent the playback point in this bar.toString()
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
BarBox
public BarBox(CL_Editor editor, int bbIndex, int modelBarIndex, ChordLeadSheet model, BarBoxConfig config, BarBoxSettings settings, BarRendererFactory brf, Object groupKey) Construct a BarBox.- Parameters:
editor
- Can be nullbbIndex
- The index of this BarBox.modelBarIndex
- Use -1 if this BarBox does not represent model data.model
-config
-settings
-brf
-groupKey
-
-
-
Method Details
-
setModel
Set the model for this BarBox.- Parameters:
modelBarIndex
- If < 0, it means this BarBox does not represent a valid bar for model.model
-
-
addItem
Add an item in the BarBox.The operation requests each BarRenderer to create ItemRenderers if appropriate.
- Parameters:
item
-- Returns:
- List The created ItemRenderers.
-
removeItem
Remove an item from the BarBox.The operation requests each BarRenderer to remove the ItemRenderer if appropriate.
- Parameters:
item
-- Returns:
- List The removed ItemRenderers. Can be an empty list.
-
setFocusOnItem
Set the focus on an ItemRenderer for item.- Parameters:
item
-irType
- The irType to search for. If null set focus on the first ItemRenderer found.
-
selectItem
The operation requests each BarRenderer to select the ItemRenderers of item.- Parameters:
item
-b
-
-
isSelected
public boolean isSelected() -
setSelected
public void setSelected(boolean b) Set the Component selected or not, forward to BarRenderers as well.- Parameters:
b
-
-
setEnabled
public void setEnabled(boolean b) - Overrides:
setEnabled
in classJComponent
-
setZoomVFactor
public void setZoomVFactor(int factor) Vertical zoom factor.- Parameters:
factor
- 0=min zoom (bird's view), 100=max zoom
-
getZoomVFactor
public int getZoomVFactor() -
getDisplayQuantizationValue
-
setDisplayQuantizationValue
Set how chords positions are quantized for display.- Parameters:
q
-
-
getModelBarIndex
public int getModelBarIndex()The bar index in the chordleadsheet model.- Returns:
- -1 if BarBox is past the end of chord leadsheet.
-
getBarIndex
public int getBarIndex() -
setBarIndex
public void setBarIndex(int bar) Set the barIndex of this BarBox.- Parameters:
bar
- A zero or positive value
-
setModelBarIndex
public void setModelBarIndex(int bar) Set the barIndex within the model. Forward to BarRenderers.- Parameters:
bar
- If < 0, it means information from model is not available (for example because the barIndex is past the end of the model.)- Throws:
IllegalArgumentException
- If bar is > or equals to model's size.
-
getPositionFromPoint
Return the position (bar, beat) which corresponds to a given point in the BarBox.- Parameters:
barboxPoint
- A point in the BarBox coordinates.- Returns:
- Null if point does not correspond to a valid bar.
-
moveItem
Request BarRenderers to update after an item has moved within the bar.- Parameters:
item
-
-
getSection
Get the section this BarBox belongs to.- Returns:
- Can be null if modelBarIndex==-1
-
setSection
Request BarRenderers to update if the section they belong to has changed.- Parameters:
section
-
-
getConfig
-
setConfig
Set the BarBoxConfig of this BarBox.There must be at least 1 active BarRenderer.
- Parameters:
bbConfig
-- Returns:
- boolean true if BarBoxConfig has been really changed, false otherwise (e.g. same value)
-
showInsertionPoint
public void showInsertionPoint(boolean b, ChordLeadSheetItem<?> item, Position pos, boolean copyMode) -
showPlaybackPoint
Change background to represent the playback point in this bar. Then delegate to BarRenderers to render the point.- Parameters:
b
-pos
-
-
cleanup
public void cleanup()Clean up everything so this object can be garbaged. -
getBarRenderers
-
toString
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
focusGained
- Specified by:
focusGained
in interfaceFocusListener
-
focusLost
- Specified by:
focusLost
in interfaceFocusListener
-