dguitar.gui
Class SongPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bydguitar.gui.SongPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, OptionsDisplay, java.io.Serializable

public class SongPanel
extends javax.swing.JPanel
implements OptionsDisplay

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

Nested Class Summary
 
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
private  int count
           
private  DisplayOptions displayOptions
           
private  java.awt.GridBagLayout gridBagLayout
           
private  boolean hasTracks
           
private  int linesOnBottom
          How many lines are added to the bottom
private  int linesOnTop
          How many lines are added to the top
private  java.util.List measures
           
private  MusicCursorPosition musicCursorPosition
           
private  int numMeasures
           
private  int numTracks
           
private  javax.swing.JPanel Panel
           
private  GPSong piece
           
private  boolean spacingChange
           
private  javax.swing.JTabbedPane TabPane
           
private  java.util.List tracks
           
private  boolean viewChange
           
 
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
SongPanel()
          Creates a new instance of SongPanel
SongPanel(DisplayOptions aDisplayOptions)
          To create a SongPanel with displayOptions already created.
 
Method Summary
private  void addScrollPane()
           
private  void addTabPane()
           
private  void addTrackMeasures()
          add The different track and measures of a song, but they are empty.
private  void addTrackPanel(GPTrack track)
          Adds a tracks...VERY IMPORTANT validate() method should be invoqued as required
protected  void alignBars()
           
 void changeView()
           
 void displayPiece()
          this method sets the MeasuresTracksPairs, and the then calls refresh() ;
 DisplayOptions getDisplayOptions()
           
protected  TrackPanel getFirstTrackPanel()
          a method to start to Iterate over the Track Panels is provided
private  int getMaxWidth(int m)
           
 boolean getMinPieceSpacing()
           
protected  TrackPanel getNextTrackPanel()
           
 int getNoteSpacing()
           
 int getNumTracks()
           
 GPSong getPiece()
          Gets the Piece object that was read using readPieceFrom(GPInputStream GIS)
 TrackPanel getTrackPanel(int pos)
          This method allows you to obtain the TrackPanel at pos position, starting from 0
 boolean hasChanged()
           
private  void initComponents()
           
 boolean isMultiTrackView()
           
private  GPDuration minDurationOfMeasure(int m)
          calculate the min duration of the beat of measure ´m´ it is assumed that m < numMeasures
private  void multiTrackViewChanged()
          Call this method when you change variable this.DO.multiTrackView
 void musicCursorsAlign()
           
 void musicCursorsSetEnable(boolean value)
           
 void musicCursorsSetVisible(boolean value)
           
 boolean readPieceFrom(GPInputStream GPis)
          This method reads from a GPInputStream, and displays any exceptions
private  void removeScrollPane()
           
private  void removeTabPane()
           
protected  void scrollOthers(TrackPanel tp)
          NOT USED...and not working Scrolls the other TrackPanel according to TP
 void setDisplayOptions(DisplayOptions dO)
           
private  void setMeasuresTracksPairs()
           
private  void setMinDuration(GPDuration minDuration, int m)
          this methos propagate the minDuration vertically..acrros the tracks m is the measure number
 void setMinPieceSpacing(boolean b)
           
private  void setMinWidth(int min, int m)
           
 void setMultiTrackView(boolean b)
           
 void setMusicCursorSingleColor(boolean single)
           
 void setNoteSpacing(int ns)
           
 void setNumTracks(int numTracks)
           
 void toggleDisplayUnsupportedEffects()
          remember to call validate when necesary.
 void toggleMinPieceSpacing()
          Call this to swith back and forward between the two types of spacing remember to call validate when necesary.
 void toggleMultiTrackView()
           
 void toggleSingleMusicCursorColor()
           
 void toggleViewMusicCursors()
           
 void validate()
          Validates this container and all of its subcomponents.
 
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, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gridBagLayout

private java.awt.GridBagLayout gridBagLayout

piece

private GPSong piece

measures

private java.util.List measures

tracks

private java.util.List tracks

numMeasures

private int numMeasures

numTracks

private int numTracks

TabPane

private javax.swing.JTabbedPane TabPane

Panel

private javax.swing.JPanel Panel

count

private int count

hasTracks

private boolean hasTracks

viewChange

private boolean viewChange

spacingChange

private boolean spacingChange

displayOptions

private DisplayOptions displayOptions

musicCursorPosition

private MusicCursorPosition musicCursorPosition

linesOnTop

private int linesOnTop
How many lines are added to the top


linesOnBottom

private int linesOnBottom
How many lines are added to the bottom

Constructor Detail

SongPanel

public SongPanel()
Creates a new instance of SongPanel


SongPanel

public SongPanel(DisplayOptions aDisplayOptions)
To create a SongPanel with displayOptions already created.

Parameters:
aDisplayOptions -
Method Detail

setDisplayOptions

public void setDisplayOptions(DisplayOptions dO)
Specified by:
setDisplayOptions in interface OptionsDisplay
Parameters:
dO - The displayOptions to set.

getDisplayOptions

public DisplayOptions getDisplayOptions()
Specified by:
getDisplayOptions in interface OptionsDisplay
Returns:
Returns the dO.

initComponents

private void initComponents()

addScrollPane

private void addScrollPane()

addTabPane

private void addTabPane()

removeScrollPane

private void removeScrollPane()

removeTabPane

private void removeTabPane()

setMinPieceSpacing

public void setMinPieceSpacing(boolean b)

toggleMinPieceSpacing

public void toggleMinPieceSpacing()
Call this to swith back and forward between the two types of spacing remember to call validate when necesary.


toggleDisplayUnsupportedEffects

public void toggleDisplayUnsupportedEffects()
remember to call validate when necesary.


toggleSingleMusicCursorColor

public void toggleSingleMusicCursorColor()

toggleViewMusicCursors

public void toggleViewMusicCursors()

getMinPieceSpacing

public boolean getMinPieceSpacing()

getPiece

public GPSong getPiece()
Gets the Piece object that was read using readPieceFrom(GPInputStream GIS)


changeView

public void changeView()

displayPiece

public void displayPiece()
this method sets the MeasuresTracksPairs, and the then calls refresh() ;


musicCursorsAlign

public void musicCursorsAlign()

musicCursorsSetVisible

public void musicCursorsSetVisible(boolean value)

musicCursorsSetEnable

public void musicCursorsSetEnable(boolean value)

multiTrackViewChanged

private void multiTrackViewChanged()
Call this method when you change variable this.DO.multiTrackView


setMultiTrackView

public void setMultiTrackView(boolean b)

toggleMultiTrackView

public void toggleMultiTrackView()

isMultiTrackView

public boolean isMultiTrackView()

addTrackPanel

private void addTrackPanel(GPTrack track)
Adds a tracks...VERY IMPORTANT validate() method should be invoqued as required


getTrackPanel

public TrackPanel getTrackPanel(int pos)
This method allows you to obtain the TrackPanel at pos position, starting from 0

Parameters:
pos - the trackPanel index starting from 0
Returns:
a TrackPanel located at that position

getFirstTrackPanel

protected TrackPanel getFirstTrackPanel()
a method to start to Iterate over the Track Panels is provided


getNextTrackPanel

protected TrackPanel getNextTrackPanel()

minDurationOfMeasure

private GPDuration minDurationOfMeasure(int m)
calculate the min duration of the beat of measure ´m´ it is assumed that m < numMeasures


setMinDuration

private void setMinDuration(GPDuration minDuration,
                            int m)
this methos propagate the minDuration vertically..acrros the tracks m is the measure number


setMinWidth

private void setMinWidth(int min,
                         int m)

getMaxWidth

private int getMaxWidth(int m)

alignBars

protected void alignBars()

setMeasuresTracksPairs

private void setMeasuresTracksPairs()

addTrackMeasures

private void addTrackMeasures()
add The different track and measures of a song, but they are empty.


hasChanged

public boolean hasChanged()

readPieceFrom

public boolean readPieceFrom(GPInputStream GPis)
This method reads from a GPInputStream, and displays any exceptions


getNoteSpacing

public int getNoteSpacing()

setNoteSpacing

public void setNoteSpacing(int ns)

setMusicCursorSingleColor

public void setMusicCursorSingleColor(boolean single)

validate

public void validate()
Validates this container and all of its subcomponents.

The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information changed) after the container has been displayed.

See Also:
Container.add(java.awt.Component), Component.invalidate(), JComponent.revalidate()

scrollOthers

protected void scrollOthers(TrackPanel tp)
NOT USED...and not working Scrolls the other TrackPanel according to TP


setNumTracks

public void setNumTracks(int numTracks)
Parameters:
numTracks - The numTracks to set.

getNumTracks

public int getNumTracks()
Returns:
Returns the numTracks.