|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.eliad.model.AbstractGenericModel | +--com.eliad.model.AbstractGridModel | +--com.eliad.model.GenericGridModel
This is an implementation of GridModel
that
uses a Vector
of Vector
s to store the
cell value objects.
GridModel
, Serialized FormFields inherited from class com.eliad.model.AbstractGenericModel |
listeners_ |
Constructor Summary | |
GenericGridModel()
Constructs a default DefaultGridModel
which is a grid of ten columns and ten rows. |
|
GenericGridModel(int numRows,
int numColumns)
Constructs a GenericGridModel with
numRows and numColumns of
null object values. |
|
GenericGridModel(java.lang.Object[][] data)
Constructs a GenericGridModel and initializes the grid
by passing data and columnNames
to the setDataVector
method. |
|
GenericGridModel(java.util.Vector data)
Constructs a GenericGridModel and initializes the grid
by passing data
to the setDataVector method. |
Method Summary | |
void |
addColumn(java.lang.Object[] columnData)
Adds a column to the end of the model. |
void |
addColumn(java.util.Vector columnData)
Adds a column to the end of the model. |
void |
addRow(java.lang.Object[] rowData)
Adds a row to the end of the model. |
void |
addRow(java.util.Vector rowData)
Adds a row to the end of the model. |
void |
beforeItemsMoved(RulerModelEvent e)
Calls to send a prenotification that ruler items are to be moved. |
protected static java.util.Vector |
convertToVector(java.lang.Object[] anArray)
Returns a vector that contains the same objects as the array. |
protected static java.util.Vector |
convertToVector(java.lang.Object[][] anArray)
Returns a vector of vectors that contains the same objects as the array. |
int |
getColumnCount()
Returns the number of columns in this grid. |
int |
getRowCount()
Returns the number of rows in this grid. |
java.lang.Object |
getValueAt(int row,
int column)
Returns an attribute value for the cell at row
and column . |
void |
insertColumn(int column,
java.lang.Object[] columnData)
Inserts a column at column in the model. |
void |
insertColumn(int column,
java.util.Vector columnData)
Inserts a column at column in the model. |
void |
insertRow(int row,
java.lang.Object[] rowData)
Inserts a row at row in the model. |
void |
insertRow(int row,
java.util.Vector rowData)
Inserts a row at row in the model. |
boolean |
isCellEditable(int row,
int column)
Returns whether a given cell may be edited. |
void |
removeColumns(int column,
int count)
Removes the column at column from the model. |
void |
removeRows(int row,
int count)
Removes the row at row from the model. |
void |
rulerDataChanged(RulerModelEvent e)
Called whenever some data in the ruler model changes. |
void |
rulerModelChanged(RulerModelEvent e)
Called whenever the ruler model changes. |
void |
rulerStructureChanged(RulerModelEvent e)
Called whenever the ruler model structure undergoes a local change. |
void |
setColumnCount(int columnCount)
Sets the number of columns in the model. |
void |
setDataVector(java.lang.Object[][] newData)
Replaces the value in the dataVector instance
variable with the values in the array newData .
|
void |
setDataVector(java.util.Vector newData)
Replaces the current dataVector instance variable with the
new Vector of rows, newData . |
void |
setDataVector(java.util.Vector newData,
int columnCount)
Replaces the current dataVector instance variable with the
new Vector of rows, newData . |
void |
setRowCount(int rowCount)
Sets the number of rows in the model. |
void |
setSize(int newRowCount,
int newColumnCount)
Sets the size of the model. |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Sets the object value for the cell at column and
row . |
Methods inherited from class com.eliad.model.AbstractGenericModel |
getListenerCount,
getListeners |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GenericGridModel()
DefaultGridModel
which is a grid of ten columns and ten rows.public GenericGridModel(int numRows, int numColumns)
GenericGridModel
with
numRows
and numColumns
of
null
object values.numRows
- the number of rows in the gridnumColumns
- the number of columns in the gridsetValueAt(java.lang.Object, int, int)
public GenericGridModel(java.util.Vector data)
GenericGridModel
and initializes the grid
by passing data
to the setDataVector
method.data
- the data of the gridcolumnNames
- vector
containing the names
of the new columnssetDataVector(java.util.Vector, int)
public GenericGridModel(java.lang.Object[][] data)
GenericGridModel
and initializes the grid
by passing data
and columnNames
to the setDataVector
method. The first index in the Object[][]
array is
the row index and the second is the column index.data
- the data of the gridcolumnNames
- the names of the columnssetDataVector(java.util.Vector, int)
Method Detail |
public void setDataVector(java.util.Vector newData, int columnCount)
dataVector
instance variable with the
new Vector of rows, newData
. Each row in
newData
is adjusted to match the number of columns in the first one,
either by shortening the Vector
if it is too long,
or adding null
values if it is too short.
newData
- the new data vectorpublic void setDataVector(java.util.Vector newData)
dataVector
instance variable with the
new Vector of rows, newData
. Each row in
newData
is adjusted to match the number of columns in the first one,
either by shortening the Vector
if it is too long,
or adding null
values if it is too short.
newData
- the new data vectorpublic void setDataVector(java.lang.Object[][] newData)
dataVector
instance
variable with the values in the array newData
.
The first index in the Object[][]
array is the row index and the second is the column index.
columnNames
are the names of the new columns.newData
- the new data vectorsetDataVector(Vector)
public void setSize(int newRowCount, int newColumnCount)
newSize
- the new number of rowssetRowCount(int)
public void setRowCount(int rowCount)
rowCount
and greater are discarded. setColumnCount(int)
public void setColumnCount(int columnCount)
null
cell values.
If the new size is less than the current size, all columns at index
columnCount
and greater are discarded.columnCount
- the new number of columns in the modelsetColumnCount(int)
public void addRow(java.util.Vector rowData)
null
values unless rowData
is specified.
Notification of the row being added will be generated.rowData
- optional data of the row being addedpublic void addRow(java.lang.Object[] rowData)
null
values unless rowData
is specified.
Notification of the row being added will be generated.rowData
- optional data of the row being addedpublic void insertRow(int row, java.util.Vector rowData)
row
in the model. The new row
will contain null
values unless rowData
is specified. Notification of the row being inserted will be generated.row
- the row index of the row to be insertedrowData
- optional data of the row being addedpublic void insertRow(int row, java.lang.Object[] rowData)
row
in the model. The new row
will contain null
values unless rowData
is specified. Notification of the row being inserted will be generated.row
- the row index of the row to be insertedrowData
- optional data of the row being addedpublic void addColumn(java.util.Vector columnData)
null
values unless columnData
is specified.
Notification of the column being added will be generated.columnData
- optional data of the column being addedpublic void addColumn(java.lang.Object[] columnData)
null
values unless columnData
is specified.
Notification of the column being added will be generated.columnData
- optional data of the column being addedpublic void insertColumn(int column, java.util.Vector columnData)
column
in the model. The new column
will contain null
values unless columnData
is specified. Notification of the row being inserted will be generated.column
- the column index of the column to be insertedcolumnData
- optional data of the column being addedpublic void insertColumn(int column, java.lang.Object[] columnData)
column
in the model. The new column
will contain null
values unless columnData
is specified. Notification of the column being inserted will be generated.column
- the column index of the column to be insertedcolumnData
- optional data of the column being addedpublic void removeRows(int row, int count)
row
from the model. Notification
of the row being removed will be sent to all the listeners.row
- the row index of the row to be removedpublic void removeColumns(int column, int count)
column
from the model. Notification
of the column being removed will be sent to all the listeners.column
- the column index of the column to be removedpublic int getRowCount()
public int getColumnCount()
public boolean isCellEditable(int row, int column)
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queriedsetValueAt(java.lang.Object, int, int)
public java.lang.Object getValueAt(int row, int column)
row
and column
.row
- the row whose value is to be queriedcolumn
- the column whose value is to be queriedpublic void setValueAt(java.lang.Object aValue, int row, int column)
column
and
row
. aValue
is the new value. This method
will generate a tableChanged
notification.aValue
- the new value; this can be nullrow
- the row whose value is to be changedcolumn
- the column whose value is to be changedprotected static java.util.Vector convertToVector(java.lang.Object[] anArray)
anArray
- the array to be convertedanArray
is null
,
returns null
protected static java.util.Vector convertToVector(java.lang.Object[][] anArray)
anArray
- the double array to be convertedanArray
is
null
, returns null
public void rulerModelChanged(RulerModelEvent e)
e
- the event that characterizes the change.public void rulerStructureChanged(RulerModelEvent e)
e
- the event that characterizes the change.public void rulerDataChanged(RulerModelEvent e)
e
- the event that characterizes the change.public void beforeItemsMoved(RulerModelEvent e) throws java.beans.PropertyVetoException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |