|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPlayback
public class Playback
This class contains all the graphical components for the
playback module. It also loads log files and prepares
them for playback. It implements functions used to
execute moves from the stored moves list. It also
uses a thread class PlaybackThread
to implement
auto-playback.
Field Summary | |
---|---|
(package private) javax.swing.JTextArea |
arrangementComments
Arrangement comments for a log file in the summary dialog |
(package private) javax.swing.JButton |
closeSummaryButton
Close button for the summary dialog |
(package private) javax.swing.JTextPane |
descText
Description for an unused or blank tile in the summary dialog |
(package private) javax.swing.JButton |
forwardButton
The forward button (step forward) |
(package private) javax.swing.ImageIcon |
forwardIcon
Icon for the forward button |
(package private) java.util.ListIterator |
mlIterator
The list iterator for the log moveList |
(package private) java.util.LinkedList |
moveList
A linked list of LogEntries |
(package private) javax.swing.JLabel |
moveNumberLabel
Label for the move number |
(package private) CLIPFrame |
parentFrame
The frame the application runs in |
(package private) PlaybackThread |
pbThread
The thread class used for autoplayback |
(package private) javax.swing.JSlider |
playbackSlider
The playback slider |
(package private) javax.swing.JComboBox |
playbackSpeed
Auto-Playback speed adjustement combo box |
(package private) javax.swing.JButton |
playButton
The play button (auto-playback) |
(package private) javax.swing.ImageIcon |
playIcon
Icon for the play button |
(package private) javax.swing.JLabel |
previousMoveTime
Label for the previous move time |
(package private) javax.swing.JButton |
rewindButton
The rewind button (step back) |
(package private) javax.swing.ImageIcon |
rewindIcon
Icon for the rewind button |
(package private) javax.swing.JButton |
skipBeginButton
The skip to beginning button (skips to first entry) |
(package private) javax.swing.ImageIcon |
skipBeginIcon
Icon for the skip to beginning button |
(package private) javax.swing.JButton |
skipEndButton
The skip to end button (skips to last entry) |
(package private) javax.swing.ImageIcon |
skipEndIcon
Icon for the skip to end button |
(package private) long |
speed1_2
Half speed ms delay time |
(package private) java.lang.String |
speed1_2Label
Label for Half speed |
(package private) long |
speed1_4
One fourth speed ms delay time |
(package private) java.lang.String |
speed1_4Label
Label for one fourth speed |
(package private) long |
speed1_8
One eighth speed ms delay time |
(package private) java.lang.String |
speed1_8Label
Label for one eighth speed |
(package private) long |
speed2
Double speed ms delay time |
(package private) java.lang.String |
speed2Label
Label for double speed |
(package private) long |
speed4
Quadruple speed ms delay time |
(package private) java.lang.String |
speed4Label
Label for quadruple speed |
(package private) long |
speed8
Eight times speed ms delay time |
(package private) java.lang.String |
speed8Label
Label for eight times speed |
(package private) long |
speedNorm
Normal speed ms delay time |
(package private) java.lang.String |
speedNormLabel
Label for normal speed |
(package private) javax.swing.JLabel |
statusDisplayLabel
Label for the move description |
(package private) javax.swing.JButton |
stopButton
The stop button (pause) |
(package private) javax.swing.ImageIcon |
stopIcon
Icon for the stop button |
(package private) javax.swing.JButton |
summaryButton
The comments button (to display unused/blank/arrangement comments) |
(package private) javax.swing.JDialog |
summaryDialog
The Dialog containing the summary information |
(package private) int |
summaryDialogMaxHeight
Max height of the summary dialog |
(package private) int |
summaryDialogMaxWidth
Max width of the summary dialog |
(package private) Grid |
theGrid
The grid object |
(package private) TileBin |
theTileBin
The tilebin object |
(package private) UserInterface |
theUserInterface
The user interface object |
(package private) javax.swing.ImageIcon[] |
tileSummaryIcons
Array of Icons for the summary list in the summary dialog |
(package private) javax.swing.JList |
tileSummaryList
List to hold summary tile icons in the summary dialog |
(package private) javax.swing.JScrollPane |
tileSummaryListPane
Scrollpane for the list in the summary dialog |
(package private) javax.swing.JLabel |
totalTime
Label for the total elapsed time |
Constructor Summary | |
---|---|
Playback(Grid grid,
TileBin tileBin,
CLIPFrame frame,
UserInterface ui)
Constructor sets references to the grid, tilebin, frame, and user interface objects. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev)
The action listener attached to the playback controls and handles the execution of click events on those controls. |
void |
beginPlayback()
Begins playback mode by setting start values for playback controls and labels. |
javax.swing.JPanel |
createControlPanel()
Creates a panel to hold all of the controls and labels needed for playback mode. |
private javax.swing.JPanel |
createPlaybackSummaryPanel()
Creates a panel to display the summary information components. |
private void |
displaySummaryDialog()
Creates and displays the summary dialog containing info on all unused and blank tiles plus overall tile arrangement comments. |
private void |
displaySummaryTileInfo()
Displays summary tile information in the summary dialog for the selected tile in the summary tile list. |
private long |
getPlaybackSpeed(java.lang.String sp)
Returns the delay time for the passed in speed String. |
private java.lang.String |
getPreviousMoveTime(LogEntry cur)
Takes a log entry and generates a string representing the previous move time. |
private int |
getReverseMove(int type)
This returns the opposite log entry type from the one passed in but only works for the four basic move types. |
private java.lang.String |
getTotalTime(LogEntry cur)
Takes a log entry and generates a string representing the elapsed time. |
boolean |
isEndOfLog()
Returns true if the list iterator is at
the end of the move list. |
void |
loadLogFile(java.lang.String path)
Loads a log file at the specified path and prepares it for playback. |
LogEntry |
moveToNextEntry()
Returns a LogEntry of the next entry in the moveList . |
LogEntry |
moveToPreviousEntry()
Returns a LogEntry of the previous entry in the moveList . |
private void |
playbackMove(int type,
int x,
int y,
int tileID)
Handles the execution of the four 'move' type log entries. |
void |
processEntry(LogEntry cur)
This takes a LogEntry and first checks the type
of entry it is followed by performing that entry. |
private void |
skipToMove(int move)
Skips to the specified move number. |
void |
stateChanged(javax.swing.event.ChangeEvent e)
This method fires whenever the slider on the slider bar changes. |
void |
stopAutoPlayback()
Stops the playback thread if it is currently running. |
private void |
undoEntry(LogEntry cur)
This takes a LogEntry and first checks the type
of entry it is followed by executing the reverse of that entry. |
private void |
updateStatusLabel(int type)
This checks the move type passed in and then displays an appropriate message in the move description label. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Grid theGrid
TileBin theTileBin
CLIPFrame parentFrame
UserInterface theUserInterface
java.util.LinkedList moveList
LogEntry
java.util.ListIterator mlIterator
moveList
PlaybackThread pbThread
javax.swing.JButton rewindButton
javax.swing.JButton forwardButton
javax.swing.JButton playButton
javax.swing.JButton stopButton
javax.swing.JSlider playbackSlider
javax.swing.JButton summaryButton
javax.swing.JButton skipEndButton
javax.swing.JButton skipBeginButton
javax.swing.JComboBox playbackSpeed
javax.swing.ImageIcon rewindIcon
javax.swing.ImageIcon forwardIcon
javax.swing.ImageIcon stopIcon
javax.swing.ImageIcon playIcon
javax.swing.ImageIcon skipEndIcon
javax.swing.ImageIcon skipBeginIcon
javax.swing.JLabel moveNumberLabel
javax.swing.JLabel previousMoveTime
javax.swing.JLabel totalTime
javax.swing.JLabel statusDisplayLabel
javax.swing.JTextPane descText
javax.swing.JTextArea arrangementComments
javax.swing.JList tileSummaryList
javax.swing.ImageIcon[] tileSummaryIcons
javax.swing.JScrollPane tileSummaryListPane
javax.swing.JButton closeSummaryButton
javax.swing.JDialog summaryDialog
final int summaryDialogMaxWidth
final int summaryDialogMaxHeight
final java.lang.String speed1_8Label
final long speed1_8
final java.lang.String speed1_4Label
final long speed1_4
final java.lang.String speed1_2Label
final long speed1_2
final java.lang.String speedNormLabel
final long speedNorm
final java.lang.String speed2Label
final long speed2
final java.lang.String speed4Label
final long speed4
final java.lang.String speed8Label
final long speed8
Constructor Detail |
---|
public Playback(Grid grid, TileBin tileBin, CLIPFrame frame, UserInterface ui)
grid
- The grid objecttileBin
- The tilebin objectframe
- The frame the application runs inui
- The user interface objectMethod Detail |
---|
private javax.swing.JPanel createPlaybackSummaryPanel()
public javax.swing.JPanel createControlPanel()
public void loadLogFile(java.lang.String path)
path
- Path of the log fileprivate void displaySummaryDialog()
createPlaybackSummaryPanel()
private void displaySummaryTileInfo()
public void beginPlayback()
public LogEntry moveToNextEntry()
LogEntry
of the next entry in the moveList
.
If no entry is obtained (end of list) then this
function returns null
.
null
if its at the end of the list.LogEntry
public LogEntry moveToPreviousEntry()
LogEntry
of the previous entry in the moveList
.
If no entry is obtained (beginning of list) then this
function returns null
.
null
if its at the beginning of the list.LogEntry
private void playbackMove(int type, int x, int y, int tileID)
type
- Type of move to executex
- Target X location to move the tile toy
- Targer Y location to move the tile totileID
- ID of the tile to moveLogEntry
private void skipToMove(int move)
move
- The move number to skip toLogEntry
public void processEntry(LogEntry cur)
LogEntry
and first checks the type
of entry it is followed by performing that entry.
cur
- A LogEntry to executeLogEntry
private void undoEntry(LogEntry cur)
LogEntry
and first checks the type
of entry it is followed by executing the reverse of that entry.
cur
- A LogEntry to undoLogEntry
private java.lang.String getPreviousMoveTime(LogEntry cur)
cur
- LogEntry to get the previous move time from
LogEntry
private java.lang.String getTotalTime(LogEntry cur)
cur
- LogEntry to get the elapsed time from
LogEntry
public void actionPerformed(java.awt.event.ActionEvent ev)
actionPerformed
in interface java.awt.event.ActionListener
ev
- The action event that fired this methodpublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
e
- The ChangeEvent that fired this methodprivate void updateStatusLabel(int type)
type
- Type of move to update the move description label withLogEntry
,
statusDisplayLabel
private int getReverseMove(int type)
type
- Type of move to get the opposite of
LogEntry
public void stopAutoPlayback()
PlaybackThread
public boolean isEndOfLog()
true
if the list iterator is at
the end of the move list.
true
if the list iterator is at
the end of the move list; false
otherwise.mlIterator
private long getPlaybackSpeed(java.lang.String sp)
sp
- String to get the speed delay time for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |