Package uk.ac.qmul.eecs.depic.daw.gui
Class SequenceGraph
- java.lang.Object
-
- uk.ac.qmul.eecs.depic.daw.gui.SequenceGraph
-
- All Implemented Interfaces:
- SequenceListener
public class SequenceGraph extends java.lang.Object implements SequenceListener
A visual representation of a sequence graph. Here used for automation graphs overlaying the audio track. It listen to sequences (automations) and, when the sequence is updated, it updates itself and triggers the registered change listeners.
-
-
Constructor Summary
Constructors Constructor and Description SequenceGraph(java.awt.Color color, java.awt.Dimension size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addChangeListener(javax.swing.event.ChangeListener l)
void
draw(java.awt.Graphics g)
protected void
fireChangeListeners()
java.awt.Color
getColor()
float
getMillisecondsPerPixel()
Sequence
getSequence()
java.util.List<java.awt.Shape>
getSequenceLines()
java.util.List<SequencePoint>
getSequencePoints()
java.awt.Dimension
getSize()
void
removeChangeListener(javax.swing.event.ChangeListener l)
<T extends SequenceEvent>
voidsequenceUpdated(T evt)
This method has to be implemented by classes that provide a continuous representation of the sequence.void
setColor(java.awt.Color c)
void
setMillisecPerPixel(float millisecPerPixel)
void
setSequence(Sequence s)
Sets a new sequence to be listened to.void
setSize(java.awt.Dimension size)
void
updateSequence()
Recompute the sequence points and lines.
-
-
-
Constructor Detail
-
SequenceGraph
public SequenceGraph(java.awt.Color color, java.awt.Dimension size)
-
-
Method Detail
-
getSize
public java.awt.Dimension getSize()
-
setSize
public void setSize(java.awt.Dimension size)
-
setColor
public void setColor(java.awt.Color c)
-
getMillisecondsPerPixel
public float getMillisecondsPerPixel()
-
setMillisecPerPixel
public void setMillisecPerPixel(float millisecPerPixel)
-
getColor
public java.awt.Color getColor()
-
getSequencePoints
public java.util.List<SequencePoint> getSequencePoints()
-
getSequenceLines
public java.util.List<java.awt.Shape> getSequenceLines()
-
draw
public void draw(java.awt.Graphics g)
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
-
fireChangeListeners
protected void fireChangeListeners()
-
sequenceUpdated
public <T extends SequenceEvent> void sequenceUpdated(T evt)
Description copied from interface:SequenceListener
This method has to be implemented by classes that provide a continuous representation of the sequence. The method a callback that is called as soon as one of the values of the the sequence is added, deleted or modified. Implementors can thus promptly update their representation to reflect the changes in the sequence.- Specified by:
sequenceUpdated
in interfaceSequenceListener
- Parameters:
evt
- an event holding information about the sequence that has been modfied.
-
setSequence
public void setSequence(Sequence s)
Sets a new sequence to be listened to. If the argument isnull
it stops listening to the previously set sequence, if any,m and clears all sequence points and lines. it callsupdateSequence
.- Parameters:
s
- the new sequence.
-
getSequence
public Sequence getSequence()
-
updateSequence
public void updateSequence()
Recompute the sequence points and lines. It should be called whenever a change is done to this object. For example aftersetSize
andsetMilliseconsPerPixel
.
-
-