Ejemplo n.º 1
0
  public void applyChanges() {
    annotation.setName(nameText.getText());
    if (snapToTrace.getSelection())
      annotation.setTrace(
          xyGraph.getPlotArea().getTraceList().get(xAxisOrTraceCombo.getSelectionIndex()));
    else
      annotation.setFree(
          xyGraph.getXAxisList().get(xAxisOrTraceCombo.getSelectionIndex()),
          xyGraph.getYAxisList().get(yAxisCombo.getSelectionIndex()));

    if (!useDefaultColorButton.getSelection())
      annotation.setAnnotationColor(
          XYGraphMediaFactory.getInstance().getColor(colorSelector.getColorValue()));
    else annotation.setAnnotationColor(null);
    annotation.setFont(font);
    annotation.setCursorLineStyle(CursorLineStyle.values()[cursorLineCombo.getSelectionIndex()]);
    annotation.setShowName(showNameButton.getSelection());
    annotation.setShowSampleInfo(showSampleInfoButton.getSelection());
    annotation.setShowPosition(showPositionButton.getSelection());
  }
Ejemplo n.º 2
0
 public AnnotationConfigPage(XYGraph xyGraph, Annotation annotation) {
   this.xyGraph = xyGraph;
   this.annotation = annotation;
   font = annotation.getFont();
 }
Ejemplo n.º 3
0
  private void initialize() {
    nameText.setText(annotation.getName());
    nameText.setSelection(0, nameText.getText().length());
    snapToTrace.setSelection(!annotation.isFree());
    xAxisLabel.setText(
        snapToTrace.getSelection() ? Messages.Annotation_Trace : Messages.Annotation_XAxis);
    xAxisOrTraceCombo.removeAll();
    if (!annotation.isFree()) {
      for (Trace trace : xyGraph.getPlotArea().getTraceList())
        xAxisOrTraceCombo.add(trace.getName());
      xAxisOrTraceCombo.select(xyGraph.getPlotArea().getTraceList().indexOf(annotation.getTrace()));
    } else {
      for (Axis axis : xyGraph.getXAxisList()) xAxisOrTraceCombo.add(axis.getTitle());
      xAxisOrTraceCombo.select(xyGraph.getXAxisList().indexOf(annotation.getXAxis()));
    }
    for (Axis axis : xyGraph.getYAxisList()) yAxisCombo.add(axis.getTitle());
    yAxisCombo.select(xyGraph.getYAxisList().indexOf(annotation.getYAxis()));
    yAxisLabel.setVisible(!snapToTrace.getSelection());
    yAxisCombo.setVisible(!snapToTrace.getSelection());
    useDefaultColorButton.setSelection(annotation.getAnnotationColor() == null);
    colorLabel.setVisible(!useDefaultColorButton.getSelection());
    colorSelector.getButton().setVisible(annotation.getAnnotationColor() != null);
    colorSelector.setColorValue(
        annotation.getAnnotationColor() == null
            ? annotation.getYAxis().getForegroundColor().getRGB()
            : annotation.getAnnotationColor().getRGB());

    fontLabel.setText(
        Messages.Annotation_Font
            + (font == null ? Messages.Annotation_SystemDefault : font.getFontData()[0].getName()));
    fontLabel.setFont(font);
    cursorLineCombo.select(annotation.getCursorLineStyle().getIndex());
    showNameButton.setSelection(annotation.isShowName());
    showSampleInfoButton.setSelection(annotation.isShowSampleInfo());
    showPositionButton.setSelection(annotation.isShowPosition());
  }
 public void undo() {
   annotation.setdxdy(beforeDx, beforeDy);
 }
 public void redo() {
   annotation.setdxdy(afterDx, afterDy);
 }