dguitar.gui
Class BarMTP

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bydguitar.gui.Bar
                      extended bydguitar.gui.BarMTP
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, OptionsDisplay, java.io.Serializable
Direct Known Subclasses:
BarStandard, BarTablature

public abstract class BarMTP
extends Bar

This class extends Bar, and it holds a MeasureTrackPair. Music is represented usually as an array of Tracks and Measures Tracks are usually represented as rows. Measure are usually represtend as columns. A music track pair is the intersection of a row with a column.

Author:
Mauricio Gracia Gutiérrez
See Also:
Serialized Form

Nested Class Summary
(package private)  class BarMTP.PaintedBeatInfo
           
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean addEONs
          Are Effects On Note going to be added for the first time ?
protected  boolean addSilence
          Are silences going to be added for the first time ?
protected  java.awt.Color colorNext
          This is the color of the horizontal rhytm lina that goes forward to the Next beat
protected  java.awt.Color colorPrev
          This is the color of the horizontal rhythm line that goes back to the Previous beat
protected  int fontAscent
          The fontAscent of the Fret font
protected  int lastNumHLines
          The last Number of Horinzontal rhythm lines that were draw.
private  int min_width
           
static int MIN_WIDTH
           
private  GPDuration minDuration
           
protected  GPMeasureTrackPair mtp
           
 
Fields inherited from class dguitar.gui.Bar
BP, displayTimeSignature, isFirst, isLast, measure, minx, TS
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
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
BarMTP(DisplayOptions currentDisplayOptions, BarPanel BP)
          Creates a new instance of BarTablature, related the BarPanel BP
 
Method Summary
protected abstract  int calculateHeightOfString(int s)
           
private  int calculateMinX()
           
protected  int calculateWidth(int inc)
           
protected  int calculateWidth(java.util.List beats)
           
protected  int calculateWidthOfBeat(GPBeat beat)
           
private  void commonConstructor()
           
 java.util.List getBeats()
           
 GPMeasureTrackPair getMeasureTrackPair()
           
 MusicCursorPosition getMusicCursorPosition(int beat)
           
 MusicCursorPosition getMusicCursorPosition(MusicCursor musicCursor)
          Creates a musicCursorPosition for this Bar
 boolean hasBeats()
           
 GPDuration minDurationOfBeats()
          Gets the minDuration of a measure-track pair This method is used for proporcional spacing
protected  GPBeat nextBeat(java.util.List Beats, int b, int max)
           
protected  void paintBeat(java.awt.Graphics g, int currentX, GPBeat beat, GPBeat prev, GPBeat next, BarMTP.PaintedBeatInfo I)
          paint a singleBeat, given the currentX position, beat, Nots and the noteIndex. is also uses the prev and next GPBeat
protected  void paintComponent(java.awt.Graphics gg)
          Calls the UI delegate's paint method, if the UI delegate is non-null.
protected abstract  void paintEffects(java.awt.Graphics g, int currentX, int y, GPEffectsOnNote EON, int contEON, GPBeat beat)
           
protected  void paintMeasureTrackPair(java.awt.Graphics g)
          This methods overrides the method of Bar and actually paints the frets Graphics g object that is passed has already a copy of the
protected abstract  void paintNote(java.awt.Graphics g, int currentX, int y, GPNote note)
          This method paint the notes using g, currentX, y and a GPNote
protected  void paintRhythm(java.awt.Graphics g, int x, int y, GPBeat beat, GPBeat prev, GPBeat next)
          paints the vertical and horizontal rhythm lines.
protected abstract  void paintRhythmHL(java.awt.Graphics g, int x, int lowest, int n, GPBeat prev)
           
protected abstract  void paintSilence(java.awt.Graphics g, int currentX, GPBeat beat, int contSilences)
           
 void setMeasureTrackPair(GPMeasureTrackPair m)
           
 void setMinDuration(GPDuration d)
           
 void setMinWidth(int value)
           
 MusicCursorPosition snapX(int xx, MusicCursor musicCursor)
           
 
Methods inherited from class dguitar.gui.Bar
equals, equalTimeSignature, getBottomOffset, getDisplayOptions, getExtendBottom, getExtendTop, getHeight, getMaximumSize, getMeasure, getMinimumSize, getPreferredSize, getTopOffset, getWidth, paintMeasure, setBottomOffset, setDisplayOptions, setExtendBottom, setExtendTop, setMeasure, setTopOffset
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

addSilence

protected boolean addSilence
Are silences going to be added for the first time ?


addEONs

protected boolean addEONs
Are Effects On Note going to be added for the first time ?


fontAscent

protected int fontAscent
The fontAscent of the Fret font


lastNumHLines

protected int lastNumHLines
The last Number of Horinzontal rhythm lines that were draw.


colorPrev

protected java.awt.Color colorPrev
This is the color of the horizontal rhythm line that goes back to the Previous beat


colorNext

protected java.awt.Color colorNext
This is the color of the horizontal rhytm lina that goes forward to the Next beat


mtp

protected GPMeasureTrackPair mtp

minDuration

private GPDuration minDuration

MIN_WIDTH

public static final int MIN_WIDTH
See Also:
Constant Field Values

min_width

private int min_width
Constructor Detail

BarMTP

public BarMTP(DisplayOptions currentDisplayOptions,
              BarPanel BP)
Creates a new instance of BarTablature, related the BarPanel BP

Method Detail

commonConstructor

private void commonConstructor()

getMusicCursorPosition

public MusicCursorPosition getMusicCursorPosition(MusicCursor musicCursor)
Creates a musicCursorPosition for this Bar

Specified by:
getMusicCursorPosition in class Bar
Parameters:
musicCursor -
Returns:
a musicCursorPosition for a MeasureTrackPair..MTP

snapX

public MusicCursorPosition snapX(int xx,
                                 MusicCursor musicCursor)
Specified by:
snapX in class Bar

getMusicCursorPosition

public MusicCursorPosition getMusicCursorPosition(int beat)
Specified by:
getMusicCursorPosition in class Bar
Returns:
a sdaPoint where the beat is located. (the top string)

getMeasureTrackPair

public GPMeasureTrackPair getMeasureTrackPair()

setMeasureTrackPair

public void setMeasureTrackPair(GPMeasureTrackPair m)

hasBeats

public boolean hasBeats()

getBeats

public java.util.List getBeats()

calculateWidthOfBeat

protected int calculateWidthOfBeat(GPBeat beat)

calculateWidth

protected int calculateWidth(java.util.List beats)

calculateWidth

protected int calculateWidth(int inc)
Specified by:
calculateWidth in class Bar

minDurationOfBeats

public final GPDuration minDurationOfBeats()
Gets the minDuration of a measure-track pair This method is used for proporcional spacing


calculateHeightOfString

protected abstract int calculateHeightOfString(int s)

paintRhythmHL

protected abstract void paintRhythmHL(java.awt.Graphics g,
                                      int x,
                                      int lowest,
                                      int n,
                                      GPBeat prev)

paintNote

protected abstract void paintNote(java.awt.Graphics g,
                                  int currentX,
                                  int y,
                                  GPNote note)
This method paint the notes using g, currentX, y and a GPNote


paintSilence

protected abstract void paintSilence(java.awt.Graphics g,
                                     int currentX,
                                     GPBeat beat,
                                     int contSilences)

paintEffects

protected abstract void paintEffects(java.awt.Graphics g,
                                     int currentX,
                                     int y,
                                     GPEffectsOnNote EON,
                                     int contEON,
                                     GPBeat beat)

paintRhythm

protected final void paintRhythm(java.awt.Graphics g,
                                 int x,
                                 int y,
                                 GPBeat beat,
                                 GPBeat prev,
                                 GPBeat next)
paints the vertical and horizontal rhythm lines. Its asumed that beat is not null


paintBeat

protected final void paintBeat(java.awt.Graphics g,
                               int currentX,
                               GPBeat beat,
                               GPBeat prev,
                               GPBeat next,
                               BarMTP.PaintedBeatInfo I)
paint a singleBeat, given the currentX position, beat, Nots and the noteIndex. is also uses the prev and next GPBeat


nextBeat

protected final GPBeat nextBeat(java.util.List Beats,
                                int b,
                                int max)

calculateMinX

private final int calculateMinX()

paintMeasureTrackPair

protected final void paintMeasureTrackPair(java.awt.Graphics g)
This methods overrides the method of Bar and actually paints the frets Graphics g object that is passed has already a copy of the


paintComponent

protected void paintComponent(java.awt.Graphics gg)
Description copied from class: Bar
Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate).

if you override this in a subclass you should not make permanent changes to the passed in Graphics. for example, you should not alter the clip Rectangle or modify the transform. if you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoker super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in a non-opaque color. if you do not honor the opaque property you will likely see visual artifacts.

Overrides:
paintComponent in class Bar
Parameters:
gg - the Graphics object to protect
See Also:
Component.paint(java.awt.Graphics)

setMinDuration

public void setMinDuration(GPDuration d)

setMinWidth

public void setMinWidth(int value)