Class BarRenderer
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
A BarRenderer is a container for ItemRenderers. A BarRenderer has a barIndex and a modelBarIndex (the barIndex within the model). Both values are equal when showing bars within the model, but if showing a bar past the end of the model, modelBarIndex = -1.
- 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
ConstructorDescriptionBarRenderer
(CL_Editor editor, int barIndex, BarRendererSettings settings, ItemRendererFactory irf, Object groupKey) Construct a BarRenderer. -
Method Summary
Modifier and TypeMethodDescriptionaddItemRenderer
(ChordLeadSheetItem<?> item) Add one ItemRenderer for item e.void
cleanup()
Clean up everything so this object can be garbaged.int
Get the current CLI_Section for this BarRenderer.abstract Quantization
Get the available drawing area of the Bar.The editor to which this BarRenderer belongs to.Return a shared instance of a hidden JDialog used to get dimensions of Font-based objects.Get the group key to which this BarRenderer is linked.getItemRenderer
(ChordLeadSheetItem<?> item) Get the ItemRenderer of the specified item.Get all child components which are ItemRenderers.getModel()
int
The bar index in the chordleadsheet model.abstract int
abstract boolean
isRegisteredItemClass
(ChordLeadSheetItem<?> item) Return True if this item's class is supported by this BarRenderer.final boolean
abstract void
moveItemRenderer
(ChordLeadSheetItem<?> item) Move one item of this bar.void
removeItemRenderer
(ChordLeadSheetItem<?> item) Remove an ItemRenderer from this bar.void
selectItem
(ChordLeadSheetItem<?> item, boolean b) void
setBarIndex
(int bar) Set the barIndex of this BarRenderer.abstract void
final void
setEnabled
(boolean b) void
setModel
(int modelBarIndex, ChordLeadSheet clsModel) Set the model for this BarRenderer.void
setModelBarIndex
(int bar) Set the barIndex within the model.abstract void
setSection
(CLI_Section section) Set the section for this bar.final void
setSelected
(boolean b) Set the Component selected or not.abstract void
setZoomVFactor
(int factor) Vertical zoom factor.abstract void
showInsertionPoint
(boolean b, ChordLeadSheetItem<?> item, Position pos, boolean copyMode) Show or hide an insertion point for the specified item.abstract void
showPlaybackPoint
(boolean b, Position pos) Show or hide the playback point at specified position.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
-
BarRenderer
public BarRenderer(CL_Editor editor, int barIndex, BarRendererSettings settings, ItemRendererFactory irf, Object groupKey) Construct a BarRenderer.- Parameters:
editor
- Can be nullbarIndex
- The barIndex of this BarRenderer.settings
-irf
-groupKey
- A key object that allow several BarRenderer instances to share common objects
-
-
Method Details
-
setModel
Set the model for this BarRenderer.- Parameters:
modelBarIndex
- If < 0, it means this BarRenderer does not represent a valid bar for modelclsModel
-
-
getModel
-
getSettings
-
getCLI_Section
Get the current CLI_Section for this BarRenderer.- Returns:
- Can be null if getModelBarIndex() == -1. The CLI_Section can be on this bar or a previous one.
-
getItemRendererFactory
-
getItemRenderers
Get all child components which are ItemRenderers.- Returns:
-
addItemRenderer
Add one ItemRenderer for item e.- Parameters:
item
-- Returns:
- ItemRenderer The object that has been created and added.
-
removeItemRenderer
Remove an ItemRenderer from this bar.- Parameters:
item
-- Returns:
- ItemRenderer The ItemRenderer that has been removed, or null if ItemRenderer was not found.
-
selectItem
-
setSelected
public final void setSelected(boolean b) Set the Component selected or not.- Parameters:
b
- Select the Component if b is true.
-
isSelected
public final boolean isSelected() -
setEnabled
public final void setEnabled(boolean b) - Overrides:
setEnabled
in classJComponent
-
setDisplayQuantizationValue
-
getDisplayQuantizationValue
-
setZoomVFactor
public abstract void setZoomVFactor(int factor) Vertical zoom factor.- Parameters:
factor
- 0=min zoom (bird's view), 100=max zoom
-
getZoomVFactor
public abstract int getZoomVFactor() -
setBarIndex
public void setBarIndex(int bar) Set the barIndex of this BarRenderer.Some BarRenderer might use this information when rendering the bar.
- Parameters:
bar
- A zero or positive value
-
setModelBarIndex
public void setModelBarIndex(int bar) Set the barIndex within the model.All items shown in this BarRenderer will belong to this bar.
- Parameters:
bar
- If < 0, it means information from model is not available (for example because the barIndex is past the end of the leadsheet.)- Throws:
IllegalArgumentException
- If bar is > or equals to model's size.
-
moveItemRenderer
Move one item of this bar.The new position is also within this bar.
- Parameters:
item
-
-
setSection
Set the section for this bar.- Parameters:
section
-
-
isRegisteredItemClass
Return True if this item's class is supported by this BarRenderer.- Parameters:
item
-- Returns:
-
showInsertionPoint
public abstract void showInsertionPoint(boolean b, ChordLeadSheetItem<?> item, Position pos, boolean copyMode) Show or hide an insertion point for the specified item.- Parameters:
b
- Show if true, hide if false.item
-pos
- The position of the insertion pointcopyMode
-
-
showPlaybackPoint
Show or hide the playback point at specified position.- Parameters:
b
- Show if true, hide if false.pos
-
-
cleanup
public void cleanup()Clean up everything so this object can be garbaged.Model is set to null.
-
getItemRenderer
Get the ItemRenderer of the specified item.- Parameters:
item
-- Returns:
- Can be null.
-
getBarIndex
public int getBarIndex() -
getModelBarIndex
public int getModelBarIndex()The bar index in the chordleadsheet model.- Returns:
- -1 if we're past the end of chord leadsheet.
-
getDrawingArea
Get the available drawing area of the Bar.This implementation returns an area corresponding to getInsets() except the width is slightly reduced.
- Returns:
- A Rectangle object representing the available drawing area.
-
getEditor
The editor to which this BarRenderer belongs to.- Returns:
- Can be null
-
getGroupKey
Get the group key to which this BarRenderer is linked.The groupKey can be used by BarRenderer instances to share objects between BarRenderer that belong to a same groupKey. It is used for example by getFontMetricsDialog() and BR_Chords.getPrefSizePanelSharedInstance().
- Returns:
- See Also:
-
toString
-
getFontMetricsDialog
Return a shared instance of a hidden JDialog used to get dimensions of Font-based objects.JDialog instances are shared between BarRenderers which have the same groupKey.
- Returns:
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-