/** * Set the value of an element (when edited by hand). * * @param oValue the new value. * @param row the new value row. * @param column the new value column. */ public void setValueAt(Object oValue, int row, int column) { if (column == 0) { return; } try { double value = 0.0; // oValue can be String or a Number. if (oValue instanceof String) { value = AstDouble.parseDouble((String) oValue, plot.getMapping(), 1); } else if (oValue instanceof Number) { value = ((Number) oValue).doubleValue(); } XGraphicsRange xRange = (XGraphicsRange) rangeObjects.get(row); double[] range = xRange.getRange(); if (column == 1) { range[0] = value; } else { range[1] = value; } xRange.setRange(range); } catch (Exception e) { e.printStackTrace(); } }
/** Return the value of an element. */ public Object getValueAt(int row, int column) { if (column == 0) { return new Integer(row); } XGraphicsRange xRange = (XGraphicsRange) rangeObjects.get(row); double[] range = xRange.getRange(); return new AstDouble(range[column - 1], plot.getMapping(), 1); }