/** * Called when there was a change in one of the pin values. The event contains the changed value * in a string representation and a boolean which is true if the user pressed the 'ok' button and * false if the user pressed the 'cancel' button. */ public void pinValueChanged(PinValueEvent e) { pinsTable.setEnabled(true); if (e.getIsOk()) { valuesStr[pinsTable.getSelectedRow()] = e.getValueStr(); partPins[pinsTable.getSelectedRow()].value = Format.translateValueToShort(e.getValueStr(), dataFormat); } notifyListeners( pinsTable.getSelectedRow(), Format.translateValueToShort(e.getValueStr(), dataFormat)); }
/** Sets the value at a specific row and column. */ public void setValueAt(Object value, int row, int col) { String data = ((String) value).trim(); try { valuesStr[row] = data; partPins[row].value = Format.translateValueToShort(data, dataFormat); notifyListeners((short) row, partPins[row].value); } catch (NumberFormatException nfe) { notifyErrorListeners("Illegal value"); valuesStr[row] = Format.translateValueToString(partPins[row].value, dataFormat); } repaint(); }
/** Sets the pins list's contents with the given vector of PartPinInfo objects. */ public void setContents(Vector newPins) { partPins = new PartPinInfo[newPins.size()]; valuesStr = new String[newPins.size()]; newPins.toArray(partPins); for (int i = 0; i < partPins.length; i++) valuesStr[i] = Format.translateValueToString(partPins[i].value, dataFormat); pinsTable.clearSelection(); pinsTable.revalidate(); repaint(); }
/** Sets the element at the given index with the given value. */ public void setValueAt(int index, short value) { partPins[index].value = value; valuesStr[index] = Format.translateValueToString(value, dataFormat); repaint(); }