Methods Summary |
---|
private void | checkColumnNumber(int col)
if(col < 0 || col >= numCols)
throw new IllegalArgumentException("column number must be between 0 and " + (numCols - 1) + " -- attempted to use non-existant column # " + col);//NOI18N
|
private void | checkRowNumber(int row)
if(row < 0 || row >= numRows)
throw new IllegalArgumentException("Row number must be between 0 and " + (numRows - 1) + " -- attempted to use non-existant row # " + row);//NOI18N
|
public int | getColumnCount()
return numCols;
|
public java.lang.String | getColumnName(int col)
checkColumnNumber(col);
return columnNames[col];
|
public int | getRowCount()
return numRows;
|
public java.lang.String | getString(int row, int col)
checkColumnNumber(col);
checkRowNumber(row);
//System.out.println("getString[col=" + col + "][r=" + row + "]: " + data[col][row]);//NOI18N
return data[col][row];
|
public boolean | isColumnEditable(int c)
/// System.out.println("isColEditable for Column " + c + " --- " + isEditable[c]);//NOI18N
checkColumnNumber(c);
return isEditable[c];
|
public static void | main(java.lang.String[] args)
/////////////////////////////////////////////////
GenericTableInfo gti = new GenericTableInfo(2, 3);
gti.setColumnName(0, "Col 0 here!");//NOI18N
gti.setColumnName(1, "Col 1 here!");//NOI18N
for(int r = 0; r < 2; r++)
{
for(int c = 0; c < 3; c++)
{
gti.setString(r, c, "c" + c + "r" + r);//NOI18N
}
}
System.out.println("" + gti);//NOI18N
|
public void | setColumnName(int col, java.lang.String name)
checkColumnNumber(col);
columnNames[col] = name;
|
public void | setColumnReadOnly(int c)
checkColumnNumber(c);
isEditable[c] = false;
|
public void | setString(int row, int col, java.lang.String name)
checkColumnNumber(col);
checkRowNumber(row);
data[col][row] = name;
|
public java.lang.String | toString()
String s = "";//NOI18N
for(int c = 0; c < numCols; c++)
{
s += "Column Name " + c + ": " + columnNames[c] + "\n";//NOI18N
}
for(int r = 0; r < numRows; r++)
{
for(int c = 0; c < numCols; c++)
{
s += "row " + r + ", col " + c + ": " + data[c][r] + "\n";//NOI18N
}
}
return s;
|