All Packages Class Hierarchy This Package Previous Next Index
Class ejmf.toolkit.multiplayer.TrackModel
java.lang.Object
|
+----com.sun.java.swing.table.AbstractTableModel
|
+----ejmf.toolkit.multiplayer.TrackModel
- public class TrackModel
- extends AbstractTableModel
A model of a collection of Tracks. This model is specifically
designed to serve as a model for a JTable.
The model maintains information about Tracks in a TrackList.
Objects interested in changes to model can register as a
TrackModelListener. When a change occurs in the model, listeners
are notified with a TrackModelEvent delivered to their
trackModelUpdate method. There are four types of TrackModel
events: assignment, playing time change, start time change, and
deassignment.
- See Also:
- AbstractTableModel, JTable, TrackList, TrackModelEvent
-
TrackModel(String[], TrackList)
- Create a TrackModel with table column names and
a TrackList.
-
addTrackModelListener(TrackModelListener)
- Add a TrackModelListener
-
assignTrack(Player, MediaLocator)
- Populate a Track with information about a Player.
-
assignTrack(String, double, double)
-
Assign a new Track.
-
clear()
-
Deassign all Tracks in TrackList maintained by TrackModel.
-
deassignTrack(int)
- Deassign Track at index in the TrackModel.
-
deassignTrack(Player)
- Deassign Track associated with Player in the TrackModel.
-
fireTableCellUpdated(int, int)
- Fire an event in response to update of table cell.
-
fireTrackModelUpdate(TrackModelEvent)
- Notify all listeners of a Track update.
-
getAvailableTrack()
- Get next Track that does not have a Player associated
with it.
-
getColumnClass(int)
- Return Class stored within a column.
-
getColumnCount()
- Since we extend AbstractTableModel, we override
getColumnCount.
-
getColumnName(int)
- Since we extend AbstractTableModel, we override
getColumnName.
-
getNumberOfAssignedTracks()
- Report number of tracks that are currently assigned.
-
getNumberOfAvailableTracks()
- Report number of tracks currently available or
unassigned.
-
getNumberOfTracks()
- Report total number of tracks managed by this model.
-
getRowCount()
- Since we extend AbstractTableModel, we override
getRowCount.
-
getTrack(int)
-
Return Track at index specified by argument.
-
getTrackList()
- Return TrackList associated with TrackModel.
-
getValueAt(int, int)
-
Return value within a cell identified by arguments.
-
isCellEditable(int, int)
- Report that start time and playing time columns are
editable.
-
read(File)
- Read contents of a MIX file and assign Tracks.
-
removeTrackModelListener(TrackModelListener)
- Remove TrackModelListener identified by argument
-
setMediaLocator(int, MediaLocator)
- Set the media locator for the Track at
index
.
-
setPlayer(int, Player)
-
Initialize the Player assoicated with a Track.
-
setPlayingTime(int, double)
- Set the playing time of the
index
Track.
-
setPlayingTime(int, String)
- Set the playing time of the
index
Track.
-
setStartTime(int, double)
- Set the start time of the
index
Track.
-
setStartTime(int, String)
- Set the start time of the
index
Track.
-
setValueAt(Object, int, int)
- Set the value in the table in the cell at (
row, column
).
-
write(ExtensionFilter, File)
-
Generate output for current Tracks.
TrackModel
public TrackModel(String columnNames[],
TrackList trackList)
- Create a TrackModel with table column names and
a TrackList.
- Parameters:
- columnNames - A String[] identifying table columns
- trackList - A TrackList
getTrackList
public TrackList getTrackList()
- Return TrackList associated with TrackModel.
getTrack
public Track getTrack(int index)
- Return Track at index specified by argument.
- Parameters:
- index - Index into TrackList.
- Returns:
- a Track at index passed as argument
assignTrack
public void assignTrack(Player player,
MediaLocator ml)
- Populate a Track with information about a Player.
- Parameters:
- player - Player whose media is maintained by this
track.
- ml - MediaLocator associated with Player.
assignTrack
public void assignTrack(String fileName,
double stTime,
double plTime) throws IllegalArgumentException, IOException, NoPlayerException
- Assign a new Track. Suppress update notification of obj.
- Parameters:
- fileName - media file name from which Player will be built.
- stTime - Offset at which media begins to play.
- plTime - Length of time media is played.
- Throws: IOException
- thrown if DataSource can not
be connected to.
- Throws: NoPlayerException
- thrown if no handler exists
for Player
- Throws: IllegalArgumentException
- thrown if file name argument
can not be converted to media locator.
deassignTrack
public void deassignTrack(int index)
- Deassign Track at index in the TrackModel.
- Parameters:
- index - Index of Track to be deassigned.
deassignTrack
public void deassignTrack(Player player)
- Deassign Track associated with Player in the TrackModel.
- Parameters:
- player - Player from which Track is derived.
clear
public void clear()
- Deassign all Tracks in TrackList maintained by TrackModel.
setMediaLocator
public void setMediaLocator(int index,
MediaLocator ml)
- Set the media locator for the Track at
index
.
- Parameters:
- index - Index of Track.
- ml - New MediaLocator value.
setPlayingTime
public void setPlayingTime(int index,
String seconds)
- Set the playing time of the
index
Track.
- Parameters:
- index - Track number.
- seconds - A String representing a seconds value.
setPlayingTime
public void setPlayingTime(int index,
double seconds)
- Set the playing time of the
index
Track.
- Parameters:
- index - Track number.
- seconds - A double representing a seconds value.
setStartTime
public void setStartTime(int index,
String seconds)
- Set the start time of the
index
Track.
- Parameters:
- index - Track number.
- seconds - A String representing a seconds value.
setStartTime
protected void setStartTime(int index,
double seconds)
- Set the start time of the
index
Track.
- Parameters:
- index - Track number.
- seconds - A double representing a seconds value.
setPlayer
public void setPlayer(int index,
Player player)
- Initialize the Player assoicated with a Track.
- Parameters:
- index - Index of Track with which Player is
to be associated.
- player - Player to associated with Track.
getAvailableTrack
public int getAvailableTrack()
- Get next Track that does not have a Player associated
with it.
- Returns:
- The index of available Track.
getNumberOfAvailableTracks
public int getNumberOfAvailableTracks()
- Report number of tracks currently available or
unassigned.
- Returns:
- The number of available Tracks
getNumberOfTracks
public int getNumberOfTracks()
- Report total number of tracks managed by this model.
- Returns:
- number of Tracks managed by model.
getNumberOfAssignedTracks
public int getNumberOfAssignedTracks()
- Report number of tracks that are currently assigned.
- Returns:
- number of Tracks currently assigned a Player
fireTableCellUpdated
protected void fireTableCellUpdated(int row,
int col)
- Fire an event in response to update of table cell.
Simply calls corresponding
super
method.
- Overrides:
- fireTableCellUpdated in class AbstractTableModel
- See Also:
- AbstractTableModel;
getColumnCount
public int getColumnCount()
- Since we extend AbstractTableModel, we override
getColumnCount.
- Overrides:
- getColumnCount in class AbstractTableModel
- See Also:
- AbstractTableModel;
getColumnName
public String getColumnName(int index)
- Since we extend AbstractTableModel, we override
getColumnName.
- Overrides:
- getColumnName in class AbstractTableModel
- See Also:
- AbstractTableModel;
isCellEditable
public boolean isCellEditable(int row,
int col)
- Report that start time and playing time columns are
editable.
- Parameters:
- row - Identifies a Track within TrackModel
- col - Identifies a field within a Track.
- Returns:
- true if start time or playing time column
is identified by
col
.
- Overrides:
- isCellEditable in class AbstractTableModel
- See Also:
- AbstractTableModel;
getRowCount
public int getRowCount()
- Since we extend AbstractTableModel, we override
getRowCount. The row count is the number of Tracks
in TrackModel.
- Returns:
- The number of Tracks in TrackModel.
- Overrides:
- getRowCount in class AbstractTableModel
- See Also:
- AbstractTableModel;
getValueAt
public Object getValueAt(int row,
int col)
- Return value within a cell identified by arguments.
- Parameters:
- row - Identifies a Track within TrackModel
- col - Identifies a field within a Track.
- Overrides:
- getValueAt in class AbstractTableModel
- See Also:
- AbstractTableModel;
setValueAt
public void setValueAt(Object aValue,
int row,
int col)
- Set the value in the table in the cell at (
row, column
).
- Parameters:
- aValue - The value to place in the cell.
- row - The row index of the cell.
- col - The column index of the cell.
- Overrides:
- setValueAt in class AbstractTableModel
- See Also:
- AbstractTableModel;
getColumnClass
public Class getColumnClass(int col)
- Return Class stored within a column.
- Parameters:
- col - A column index.
- Overrides:
- getColumnClass in class AbstractTableModel
- See Also:
- AbstractTableModel;
write
public void write(ExtensionFilter ff,
File trackFile)
- Generate output for current Tracks.
Type of ExtensionFilter determines format of output.
HTMLFileFilter generates a series of PARAM tags.
Each PARAM looks like:
where n is 0..n-1.
Otherwise, a Mix file is generated.
read
public int read(File trackFile)
- Read contents of a MIX file and assign Tracks.
- Parameters:
- trackFile - A File reference of a MIX file.
- Returns:
- 0 if file is successfully read, -1 otherwise.
addTrackModelListener
public void addTrackModelListener(TrackModelListener tml)
- Add a TrackModelListener
- Parameters:
- tml - A TrackModelListener
removeTrackModelListener
public void removeTrackModelListener(TrackModelListener tml)
- Remove TrackModelListener identified by argument
- Parameters:
- tml - A TrackModelListener
fireTrackModelUpdate
protected void fireTrackModelUpdate(TrackModelEvent tme)
- Notify all listeners of a Track update.
- Parameters:
- tme - The event the occurred on the Track.
All Packages Class Hierarchy This Package Previous Next Index