com.michaelbaranov.microba.marker
Class DefaultMarkerModel
AbstractBoundedTableModelWithSelection
com.michaelbaranov.microba.marker.DefaultMarkerModel
- MarkerMutationModel
public class DefaultMarkerModel
extends AbstractBoundedTableModelWithSelection
implements MarkerMutationModel
A basic implementation of
BoundedRangeModel
,
ListSelectionModel
and
MutationModel
all in
one. Used by default by
JMarkerBar
as data model, selection
model and mutation model.
int | addMarkAtPosition(int position) - Adds a marker with specified position.
|
Class | getColumnClass(int columnIndex) - This implementation returns
Integer.class for
columnIndex=0.
|
int | getColumnCount() - Returns the numbar of columns in the
TableModel .This
implementation always returns 1.
|
String | getColumnName(int columnIndex) - This implementation returns
"Position" for columnIndex=0.
|
int | getLowerBound()
|
int | getRowCount() - Returns the count of markers.
|
int | getUpperBound()
|
Object | getValueAt(int rowIndex, int columnIndex) - Returns the position of a marker, specified by index.
|
boolean | isCellEditable(int rowIndex, int columnIndex) - This implementation always returns
true , indicating that
all markers are movable.
|
void | removeMarkerAtIndex(int index) - Removes a marker, specified by index.
|
void | setLowerBound(int lowerBound) - Sets current lower bound.
|
void | setUpperBound(int upperBound) - Sets current upper bound.
|
void | setValueAt(Object aValue, int rowIndex, int columnIndex) - Assigns a new position to a marker, specified by index (moves the
marker).
|
DefaultMarkerModel
public DefaultMarkerModel()
Constructs a DefaultMarkerModel
.
addMarkAtPosition
public int addMarkAtPosition(int position)
Adds a marker with specified position. Actually appends a row to
TableModel
with specified position value. Returns the
index of the added mark.
This implementation does not check if the specified marker position lies
beyond current upper and lower bounds.
getColumnClass
public Class getColumnClass(int columnIndex)
This implementation returns Integer.class
for
columnIndex=0.
columnIndex
- should be 0.
getColumnCount
public int getColumnCount()
Returns the numbar of columns in the TableModel
.This
implementation always returns 1.
getColumnName
public String getColumnName(int columnIndex)
This implementation returns "Position"
for columnIndex=0.
columnIndex
- should be 0.
getLowerBound
public int getLowerBound()
getRowCount
public int getRowCount()
Returns the count of markers. Actually returns the cound of rows in the
TableModel
.
getUpperBound
public int getUpperBound()
getValueAt
public Object getValueAt(int rowIndex,
int columnIndex)
Returns the position of a marker, specified by index.
rowIndex
- marker index.columnIndex
- should be 0.
- an Integer position of the marker.
isCellEditable
public boolean isCellEditable(int rowIndex,
int columnIndex)
This implementation always returns true
, indicating that
all markers are movable. Override to change behaviour.
removeMarkerAtIndex
public void removeMarkerAtIndex(int index)
Removes a marker, specified by index. Actually removes a row from the
TableModel
.
setLowerBound
public void setLowerBound(int lowerBound)
Sets current lower bound.
lowerBound
- new lower bound value.
setUpperBound
public void setUpperBound(int upperBound)
Sets current upper bound.
upperBound
- new upper bound value.
setValueAt
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Assigns a new position to a marker, specified by index (moves the
marker).
This implementation does not check if the specified marker position lies
beyond current upper and lower bounds.
aValue
- an Integer new position.rowIndex
- marker index.columnIndex
- should be 0.