Ejemplo n.º 1
0
  /**
   * 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();
    }
  }
Ejemplo n.º 2
0
 /** 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);
 }
Ejemplo n.º 3
0
 /**
  * React to a range being removed
  *
  * @param index list index of the range to remove.
  */
 public void removeRange(int index) {
   try {
     XGraphicsRange xRange = (XGraphicsRange) rangeObjects.get(index);
     xRange.delete();
     rangeObjects.remove(index);
     fireTableRowsDeleted(index, index);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 4
0
 /** Lookup which XGraphicsRange contains an XRangeFigure... */
 public int findFigure(XRangeFigure figure) {
   XGraphicsRange XRange;
   for (int i = 0, j = 0; i < getRowCount(); i++, j += 2) {
     XRange = (XGraphicsRange) rangeObjects.get(i);
     if (XRange.isFigure(figure)) {
       return i;
     }
   }
   return -1;
 }
Ejemplo n.º 5
0
 /**
  * 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;
 }