Пример #1
0
 public void setValueAt(Object aValue, int row, int col) {
   int current = applyInsertModeForCursor(block.getIndex());
   /**/
   if (row != current) {
     Err.error("Should be updating the current row, " + current + " not " + row + " for " + block);
     // block.setIndex( true, row);
   }
   /**/
   TableIdEnum id = IdEnum.newTable(getTableControl(), row, col, getColumnClass(col), null);
   TableSignatures.setText(id, aValue);
 }
Пример #2
0
  public Object getValueAt(int row, int col) {
    Object result = null;
    if (row < getRowCount()) {
      pr("{{ row " + row + " is less than getRowCount() " + getRowCount(), true);
      if (!TableSignatures.useNew(getTableControl())
          && row == applyInsertModeForCursor(block.getIndex())) {
        pr(
            "{{ for row "
                + row
                + " col "
                + col
                + ", getting from special insert buffer, actual index is "
                + block.getIndex(),
            true);
        TableIdEnum id = IdEnum.newTable(getTableControl(), row, col, getColumnClass(col), null);
        result = TableSignatures.getText(id);
      } else {
        pr("{{ for row " + row + " col " + col + ", getting directly from database table", true);
        fillFlat(applyInsertModeForAllOtherRows(row));

        AbstractTableItemAdapter ta = null;
        if (!doingNonVisual()) {
          ta = (AbstractTableItemAdapter) flatColumns.get(col);
          if (ta.getTableControl().getClass() == TableComp.class) {
            Err.error("Expected a Visual table, got " + ta.getTableControl().getClass().getName());
          }
        } else {
          ta = (AbstractTableItemAdapter) nvFlatColumns.get(getNonVisualOrdinal());
          if (ta.getTableControl().getClass() != TableComp.class) {
            Err.error(
                "Expected a Non-Visual table, got " + ta.getTableControl().getClass().getName());
          }
        }
        pr("Getting database table value from DoAdapter() id " + ta.getDoAdapter().id, true);
        Object obj = ta.getStoredFlatObject();
        pr("StoredFlatObject: " + obj, true);
        if (obj != null) {
          pr("\tis of type " + obj.getClass().getName(), true);
        }
        result = ta.getDoAdapter().getFieldValue(obj);
      }
      if (!doingNonVisual() && nvTables != null) {
        if (row != lastRowPainted) {
          int i = 0;
          for (Iterator iterator = nvTables.iterator(); iterator.hasNext(); i++) {
            TableComp tableComp = (TableComp) iterator.next();
            setNonVisualOrdinal(i);
            tableComp.getModel().getValueAt(row, 0);
            setNonVisualOrdinal(VISUAL_MODE);
          }
          lastRowPainted = row;
        }
      }
    } else {
      Print.pr("Want row " + row);
      Print.pr("Row count is " + getRowCount());
      Err.error("Table asking for a row that's not there: <" + row + "> for block " + block);
    }
    if (result != null) {
      pr(
          "Value at "
              + col
              + ", "
              + row
              + " is "
              + result
              + " of type "
              + result.getClass().getName()
              + " from ID:"
              + id);
    }
    return result;
  }