コード例 #1
0
ファイル: LifePanel.java プロジェクト: ut5/telemediclab.life
 private void clearModel() {
   for (int row = 0; row < lifeModel.getRowCount(); row++) {
     for (int col = 0; col < lifeModel.getColumnCount(); col++) {
       lifeModel.setValueAt(new LifeCell(), row, col);
     }
   }
 }
コード例 #2
0
ファイル: DataPanel.java プロジェクト: Serabe/geogebra
  private void populateDataTable(ArrayList<GeoElement> dataArray) {

    if (dataArray == null || dataArray.size() < 1) {
      return;
    }

    TableModel dataModel = null;
    GeoPoint2 geo = null;
    String[] titles = statDialog.getDataTitles();

    switch (statDialog.getMode()) {
      case StatDialog.MODE_ONEVAR:
        dataModel = new DefaultTableModel(dataArray.size(), 1);
        for (int row = 0; row < dataArray.size(); ++row) {
          dataModel.setValueAt(dataArray.get(row).toDefinedValueString(), row, 0);
        }

        dataTable.setModel(dataModel);
        dataTable.getColumnModel().getColumn(0).setHeaderValue(titles[0]);

        updateSelectionList(dataArray);

        break;

      case StatDialog.MODE_REGRESSION:
        dataModel = new DefaultTableModel(dataArray.size(), 2);
        for (int row = 0; row < dataArray.size(); ++row) {
          dataModel.setValueAt(((GeoPoint2) (dataArray.get(row))).getInhomX(), row, 0);
          dataModel.setValueAt(((GeoPoint2) (dataArray.get(row))).getInhomY(), row, 1);
        }

        dataTable.setModel(dataModel);
        dataTable
            .getColumnModel()
            .getColumn(0)
            .setHeaderValue(app.getMenu("Column.X") + ": " + titles[0]);
        dataTable
            .getColumnModel()
            .getColumn(1)
            .setHeaderValue(app.getMenu("Column.Y") + ": " + titles[1]);

        updateSelectionList(dataArray);

        break;
    }
  }
コード例 #3
0
  @Override
  public void refresh() {
    init();
    super.refresh();

    TableModel model = getModel();
    ((DefaultTableModel) model).setNumRows(entities.size());

    int i = 0;
    for (Message message : entities) {
      model.setValueAt(
          message.getMessUser().getFirstName() + " " + message.getMessUser().getLastName(), i, 0);
      model.setValueAt(message.getMessDate(), i, 1);
      model.setValueAt(message.getDescription(), i, 2);
      i += 1;
    }

    setModel(model);
  }
コード例 #4
0
  private void createTableModel() {
    String[] columnTitles =
        new String[] {
          StringResource.getString("columnVisibleTbTitle1"),
          StringResource.getString("columnVisibleTbTitle2")
        };
    tm =
        new DefaultTableModel(columnTitles, pagedTm.tm.getColumnCount()) {
          public Class<?> getColumnClass(int arg0) {
            if (arg0 == 0) return Boolean.class;
            else return String.class;
          }

          public boolean isCellEditable(int arg0, int arg1) {
            return (arg1 == 0);
          }
        };
    for (int i = 0; i < pagedTm.tm.getColumnCount(); i++) {
      tm.setValueAt(pagedTm.isVisible(i), i, 0);
      tm.setValueAt(pagedTm.tm.getColumnName(i), i, 1);
    }
  }
コード例 #5
0
  public void calculaSumas() {
    try {
      TableModel tm = this.tablaPrincipal.getModel();
      int tamTabla = tm.getRowCount();
      double costo, cantidad, totalFila, sumaTotal;
      sumaTotal = 0.0;

      for (int i = 0; i < tamTabla; i++) {
        if (tm.getValueAt(i, 2) != null && tm.getValueAt(i, 3) != null) {
          costo = Double.valueOf(String.valueOf(tm.getValueAt(i, 2)));
          cantidad = Double.valueOf(String.valueOf(tm.getValueAt(i, 3)));
          totalFila = costo * cantidad;

          tm.setValueAt(totalFila, i, 4);
          sumaTotal += totalFila;
        }
      }

      txtSumaTotal.setText(String.valueOf(sumaTotal));
    } catch (Exception e) {
      Dialogos.lanzarAlerta("Cantidades invalidas, puede que algun numero este mal escrito");
    }
  }
コード例 #6
0
  @Override
  public void tableChanged(TableModelEvent e) {
    int row = e.getFirstRow();
    int column = e.getColumn();
    TableModel model = (TableModel) e.getSource();

    if ((row == -1) || (column == -1)) return;
    Object obj = model.getValueAt(row, column);
    try {
      if (column == 11) {
        int data = ((Number) obj).intValue();
        int old_value = ((Number) model.getValueAt(row, 4)).intValue();
        if (data <= 0) {
          model.setValueAt(old_value, row, column);
        }
      }
    } catch (NumberFormatException exc) {
      System.out.println("here");

    } catch (NullPointerException nul) {

    }
  }
コード例 #7
0
 public void setValueAt(Object value, int row, int column) {
   original.setValueAt(value, row, column);
 }
コード例 #8
0
 public void setValueAt(Object value, int row, int column) {
   model.setValueAt(value, row, column);
 }
コード例 #9
0
ファイル: TableSorter.java プロジェクト: jdepend/cooper
 public void setValueAt(Object aValue, int row, int column) {
   tableModel.setValueAt(aValue, modelIndex(row), column);
 }
コード例 #10
0
ファイル: TableMap.java プロジェクト: xrl/opensplice_dds
 /**
  * Sets the value of the cell located at the supplied row and column to the supplied value.
  *
  * @param aValue The value to set.
  * @param aRow The row of the cell.
  * @param aColumn The column of the cell.
  */
 public void setValueAt(Object aValue, int aRow, int aColumn) {
   model.setValueAt(aValue, aRow, aColumn);
 }
コード例 #11
0
  public void AnimalListToTables(AnimalList animalList) {
    List<Herbivores> herbivoresList = animalList.getHerbivoresList();
    List<Predator> predatorList = animalList.getPredatorList();
    List<Grass> grassList = animalList.getGrassList();

    int countHerbivores = herbivoresList.size();
    int countPredator = predatorList.size();
    int countGrass = grassList.size();

    tableHerbivores.setModel(
        new DefaultTableModel(
            new Object[countHerbivores][4], IClientFormStringConst.GUI_HEADER_TABLE_ANIMAL) {
          Class[] columnTypes =
              new Class[] {Integer.class, String.class, Boolean.class, Integer.class};

          public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
          }
        });

    tablePredator.setModel(
        new DefaultTableModel(
            new Object[countPredator][4], IClientFormStringConst.GUI_HEADER_TABLE_ANIMAL) {
          Class[] columnTypes =
              new Class[] {Integer.class, String.class, Boolean.class, Integer.class};

          public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
          }
        });

    tableGrass.setModel(
        new DefaultTableModel(
            new Object[countGrass][1], IClientFormStringConst.GUI_HEADER_TABLE_GRASS) {
          Class[] columnTypes = new Class[] {Integer.class};

          public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
          }
        });

    TableModel tableHerbivoresModel = tableHerbivores.getModel();
    TableModel tablePredatorModel = tablePredator.getModel();
    TableModel tableGrassModel = tableGrass.getModel();

    for (int i = 0; i < countHerbivores; i++) {
      Herbivores herbivores = herbivoresList.get(i);
      tableHerbivoresModel.setValueAt(herbivores.getId(), i, 0);
      tableHerbivoresModel.setValueAt(herbivores.getName(), i, 1);
      tableHerbivoresModel.setValueAt(herbivores.isLive(), i, 2);
      tableHerbivoresModel.setValueAt(herbivores.getM(), i, 3);
    }

    for (int i = 0; i < countPredator; i++) {
      Predator predator = predatorList.get(i);
      tablePredatorModel.setValueAt(predator.getId(), i, 0);
      tablePredatorModel.setValueAt(predator.getName(), i, 1);
      tablePredatorModel.setValueAt(predator.isLive(), i, 2);
      tablePredatorModel.setValueAt(predator.getM(), i, 3);
    }

    for (int i = 0; i < countGrass; i++) {
      Grass grass = grassList.get(i);
      tableGrassModel.setValueAt(grass.getM(), i, 0);
    }
  }
コード例 #12
0
 public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
   model.setValueAt(aValue, rowIndex, columnIndex);
 }