Beispiel #1
0
 /** Print the table content */
 public void printTable() {
   for (int row = 0; row < dataTable.getRowCount(); ++row) {
     for (int col = 0; col < dataTable.getColumnCount(); ++col) {
       System.out.print("<>" + dataTable.getCell(row, col) + " ");
     }
   }
 }
Beispiel #2
0
 /**
  * get cell value by row/column index(only string is supported)
  *
  * @param rowIndex
  * @param colIndex
  * @return
  */
 public String getCell(int rowIndex, int colIndex) {
   checkRowArgument(rowIndex);
   checkColArgument(colIndex);
   if (dataTable.getCell(rowIndex, colIndex) == null) {
     System.out.println("there no content in specified cell");
     return null;
   }
   return dataTable.getCell(rowIndex, colIndex).toString();
 }
Beispiel #3
0
  /**
   * Check whether or not the cell exist
   *
   * @param value
   * @return true/false
   */
  public boolean doesCellValueExist(String value) {

    for (int row = 0; row < dataTable.getRowCount(); ++row) {
      for (int col = 0; col < dataTable.getColumnCount(); col++) {
        if (value.equals(getCell(row, col))) {
          return true;
        }
      }
    }
    return false;
  }
Beispiel #4
0
  /**
   * return the value by key , for the table only contains 2 columns , the first column is regarded
   * as key column, and the second is value column
   *
   * @param key
   * @param val
   * @return
   */
  public boolean doesKeyValueExist(String key, String val) {

    for (int row = 0; row < dataTable.getRowCount(); ++row) {
      if (!key.equals(dataTable.getCell(row, 0))) {
        continue;
      } else {
        if (val.equals(dataTable.getCell(row, 1))) {
          return true;
        } else {
          return false;
        }
      }
    }
    return false;
  }
Beispiel #5
0
 /**
  * Get the row name by index (start from 0)
  *
  * @param index
  * @return
  */
 public String getRowHeader(int index) {
   checkRowArgument(index);
   return (String) dataTable.getRowHeader(index);
 }
Beispiel #6
0
 /**
  * Get the column name by index (start from 0)
  *
  * @param index
  * @return
  */
 public String getColumnHeader(int index) {
   checkColArgument(index);
   return (String) dataTable.getColumnHeader(index);
 }
Beispiel #7
0
 /** @return the column count of the table */
 public int getColumnCount() {
   return dataTable.getColumnCount();
 }
Beispiel #8
0
  /** @return the row count of the table */
  public int getRowCount() {

    return dataTable.getRowCount();
  }