Java 8 TableModel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TableModel class.

This code example shows how to use the following methods:getColumnName, getValueAt
  { 
    DataFactory dataFactory = createDataFactory(queryBroken);
    final TableModel tableModel = dataFactory.queryData("default", new ParameterDataRow());
//    new DataPreviewDialog().showData(tableModel); 
 
    Assert.assertEquals("[Markets].[(All)]", tableModel.getColumnName(2));
    Assert.assertEquals("[Product].[Line]", tableModel.getColumnName(1));
    Assert.assertNotNull(tableModel.getValueAt(0, 3));
    Assert.assertNotNull(tableModel.getValueAt(1, 1));
    Assert.assertNotNull(tableModel.getValueAt(2, 2));
 
//    TableModelInfo.printTableModel(tableModel); 
  } 
 
  /** 
   * Validates that queries with empty results (no rows or no columns) 
   * are correctly handled by CachingDataFactory. 
   * <p/> 
   * http://jira.pentaho.com/browse/PRD-4628 
   */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnName, getValueAt
  { 
    DataFactory dataFactory = createDataFactory(queryBroken);
    final TableModel tableModel = dataFactory.queryData("default", new ParameterDataRow());
//    new DataPreviewDialog().showData(tableModel); 
 
    Assert.assertEquals("[Markets].[(All)]", tableModel.getColumnName(2));
    Assert.assertEquals("[Product].[Line]", tableModel.getColumnName(1));
    Assert.assertNotNull(tableModel.getValueAt(0, 3));
    Assert.assertNotNull(tableModel.getValueAt(1, 1));
    Assert.assertNotNull(tableModel.getValueAt(2, 2));
 
//    TableModelInfo.printTableModel(tableModel); 
  } 
 
  /** 
   * Validates that queries with empty results (no rows or no columns) 
   * are correctly handled by CachingDataFactory. 
   * <p/> 
   * http://jira.pentaho.com/browse/PRD-4628 
   */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnCount, getRowCount, getValueAt
   * @param column the column index. 
   * @return The physical row. 
   */ 
  private int calculateRow(final int row, final int column)
  { 
    if (column < model.getColumnCount())
    { 
      // high row ... 
      return row * 2;
    } 
    else 
    { 
      // low row ... 
      return (row * 2) + 1;
    } 
  } 
 
  /** 
   * Returns the value for the cell at <code>columnIndex</code> and <code>rowIndex</code>. 
   * 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnCount, getRowCount, getValueAt
            + "model.addRow(\"row1\");" + "return model;" + "}" ); 
 
    try { 
      sqlReportDataFactory.initialize( new DesignTimeDataFactoryContext() );
      TableModel data = sqlReportDataFactory.queryData( "default", new StaticDataRow() );
      Assert.assertEquals( 1, data.getColumnCount() );
      Assert.assertEquals( 1, data.getRowCount() );
      Assert.assertEquals( "row1", data.getValueAt( 0, 0 ) );
    } finally { 
      sqlReportDataFactory.close();
    } 
  } 
 
  private void assertEqualsArray(final String[] o, final String[] strings)
  { 
    if (o == null)
    { 
      System.out.println(Arrays.asList(strings));
      return; 
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowCount
    public void setValueAt(Object aValue, int aRow, int aColumn) {
        model.setValueAt(aValue, aRow, aColumn);
    } 
 
    public int getRowCount() { 
        return (model == null) ? 0 : model.getRowCount();
    } 
 
    public int getColumnCount() { 
        return (model == null) ? 0 : model.getColumnCount();
    } 
 
    public String getColumnName(int aColumn) {
        return model.getColumnName(aColumn);
    } 
 
    public Class getColumnClass(int aColumn) {
        return model.getColumnClass(aColumn);
    } 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getValueAt
    int index = s.indexOf(' ');
    result[i] = new String[] {s.substring(0, index != -1 ? index:s.length()),index != -1 ? s.substring(index + 1):""};
  } 
 
  protected Object getStringAtIndex(TableModel tableModel, int i) {
    String name = (String) tableModel.getValueAt(i, 0);
    String value = (String) tableModel.getValueAt(i, 1);
    if (name.length() == 0) return null;
    if (value.length() == 0) return name;
    return name + " " + value;
  } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowCount
    if (queryLimit <= 0)
    { 
      throw new IllegalArgumentException();
    } 
    this.backend = backend;
    this.queryLimit = Math.min(queryLimit, backend.getRowCount());
    if (backend instanceof MetaTableModel)
    { 
      metaBackend = (MetaTableModel) backend;
    } 
  } 
 
  public int getRowCount() 
  { 
    return queryLimit;
  } 
 
  public int getColumnCount() 
  { 
    return backend.getColumnCount();
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowCount
    return new ReportDataRow(reportData, this);
  } 
 
  public boolean isAdvanceable() 
  { 
    return cursor < (reportData.getRowCount() - 1);
  } 
 
  public boolean isReadable() 
  { 
    return cursor >= 0 && cursor < reportData.getRowCount();
  } 
 
  public TableModel getReportData()
  { 
    return reportData;
  } 
 
  public int getCursor() 
  { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getValueAt
        } 
        return compareObjects(data, row1, column, row2);
    } 
 
    private int compareObjects(TableModel data, int row1, int column, int row2) {
        Object v1 = data.getValueAt(row1, column);
        String s1 = v1.toString();
        Object v2 = data.getValueAt(row2, column);
        String s2 = v2.toString();
        int result = s1.compareTo(s2);
 
        if (result < 0)
            return -1; 
        if (result > 0)
            return 1; 
        return 0; 
    } 
 
    private int compareBooleans(TableModel data, int row1, int column, int row2) {
        Boolean bool1 = (Boolean) data.getValueAt(row1, column);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowCount
    return currentRow;
  } 
 
  public void setCurrentRow(final int currentRow)
  { 
    if (currentRow < -1 || currentRow >= data.getRowCount())
    { 
      throw new IndexOutOfBoundsException();
    } 
 
    this.currentRow = currentRow;
  } 
 
  /** 
   * Returns the value of the function, expression or column using its specific name. The given name is translated 
   * into a valid column number and the the column is queried. For functions and expressions, the 
   * <code>getValue()</code> method is called and for columns from the tablemodel the tablemodel method 
   * <code>getValueAt(row, column)</code> gets called. 
   * 
   * @param col the item index. 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 TableModel Methods: