예제 #1
0
  public void handleItemChanged(TimeStampedDataItem changedItem) {
    int index = myInput.getItems().indexOf(changedItem);
    if (index < 0) {
      return;
    }

    double currentXValue = myXComponent.getDoubleValue(changedItem);
    BackedXYDataItem chartItem = (BackedXYDataItem) mySeries.getDataItem(index);
    if (chartItem.getDomainItem() != changedItem) {
      int shouldBeAt = myInput.getItems().indexOf(chartItem.getDomainItem());
      throw new IllegalStateException(
          "domain position for element: "
              + changedItem
              + //
              " is "
              + index
              + //
              ", but chart series contains "
              + chartItem.getDomainItem()
              + //
              " which should be at position: "
              + shouldBeAt);
    }
    if (currentXValue == chartItem.getXValue()) {
      mySeries.updateByIndex(index, myYComponent.getDoubleValue(changedItem));
    } else {
      handleItemDeleted(index, changedItem);
      handleItemAdded(index, changedItem);
    }
  }
예제 #2
0
 @Override
 protected void doUndo(final IProgressMonitor monitor, final IAdaptable info)
     throws ExecutionException {
   final GriddableSeries series = getOperationEnvironment().getSeries();
   final TimeStampedDataItem wasInserted = getOperationEnvironment().getSubject();
   series.deleteItem(wasInserted);
 }
예제 #3
0
 @Override
 protected EnvironmentState doExecute(final IProgressMonitor monitor, final IAdaptable info)
     throws ExecutionException {
   final GriddableSeries series = getOperationEnvironment().getSeries();
   final TimeStampedDataItem toBeInserted = getOperationEnvironment().getSubject();
   series.insertItemAt(toBeInserted, myInsertPosition);
   return new EnvironmentState.ItemAtKnownPosition(getOperationEnvironment(), myInsertPosition);
 }
예제 #4
0
 public void setInput(GriddableSeries input) {
   myInput = input;
   int index = 0;
   for (TimeStampedDataItem nextItem : input.getItems()) {
     handleItemAdded(index, nextItem);
     index++;
   }
 }
 public void dispose() {
   if (myData != null) {
     myData.removePropertyChangeListener(this);
     myData = null;
   }
 }
 public TableRefresher(ColumnViewer viewer, GriddableSeries data) {
   myColumnViewer = viewer;
   myData = data;
   myData.addPropertyChangeListener(this);
 }
 public Object[] getElements(Object inputElement) {
   if (inputElement != myInput) {
     return NOTHING;
   }
   return myInput.getItems().toArray();
 }