/** * 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); }
/** * Return a list of the ranges. Each range is a pair of consecutive values in the returned array. */ public double[] getRanges() { double[] allRanges = new double[getRowCount() * 2]; double[] thisRange; XGraphicsRange XRange; for (int i = 0, j = 0; i < getRowCount(); i++, j += 2) { XRange = (XGraphicsRange) rangeObjects.get(i); thisRange = XRange.getRange(); allRanges[j] = thisRange[0]; allRanges[j + 1] = thisRange[1]; } return allRanges; }