Ejemplo n.º 1
0
  /** This method initializes groupCurve1 */
  private void createGroupCurve() {
    groupCurve = new Group(content, SWT.NONE);
    groupCurve.setLayout(new GridLayout(3, false));
    groupCurve.setText(Messages.getString("ECContentReal.0")); // $NON-NLS-1$
    groupCurve.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    createCanvasCurve();
    lblCurve = new Label(groupCurve, SWT.NONE);
    lblCurve.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    lblCurve.setText(""); // $NON-NLS-1$
    btnDeletePoints = new Button(groupCurve, SWT.NONE);
    btnDeletePoints.setToolTipText(Messages.getString("ECContentReal.3")); // $NON-NLS-1$
    btnDeletePoints.setText(Messages.getString("ECView.RemoveSelection")); // $NON-NLS-1$
    btnDeletePoints.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
    btnDeletePoints.setEnabled(false);
    btnDeletePoints.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            btnPQ.setSelection(true);
            btnPQ.setEnabled(false);
            btnKP.setSelection(false);
            btnKP.setEnabled(false);
            spnrK.setEnabled(false);
            btnDeletePoints.setEnabled(false);
            setPointP(null);
            setPointQ(null);
            setPointR(null);
            updateCurve(false);
          }
        });
    Label label = new Label(groupCurve, SWT.NONE);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
    label.setText(Messages.getString("ECView.ZoomGraph")); // $NON-NLS-1$
    sliderZoom = new Slider(groupCurve, SWT.NONE);
    sliderZoom.setSelection(10);
    sliderZoom.setMaximum(57);
    sliderZoom.setMinimum(0);
    sliderZoom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    sliderZoom.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            curve.updateCurve(
                spnrA.getSelection(),
                spnrB.getSelection(),
                50 - sliderZoom.getSelection(),
                canvasCurve.getSize());
            points = curve.getPoints();
            updateCurve(false);
          }
        });
  }
Ejemplo n.º 2
0
  /** This method initializes compositeIntro */
  private void createCompositeIntro() {
    compositeIntro = new Composite(content, SWT.NONE);
    compositeIntro.setBackground(white);
    compositeIntro.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    compositeIntro.setLayout(new GridLayout(1, false));

    Label label = new Label(compositeIntro, SWT.NONE);
    label.setFont(FontService.getHeaderFont());
    label.setBackground(white);
    label.setText(Messages.getString("ECView.Title")); // $NON-NLS-1$

    stDescription = new StyledText(compositeIntro, SWT.READ_ONLY);
    stDescription.setText(Messages.getString("ECView.Description")); // $NON-NLS-1$
    stDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
  }
Ejemplo n.º 3
0
  /** This method initializes groupCurveType1 */
  private void createGroupCurveType() {
    groupCurveType = new Group(groupSettings, SWT.NONE);
    groupCurveType.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    groupCurveType.setLayout(new GridLayout(3, true));
    groupCurveType.setText(Messages.getString("ECView.SelectCurveType")); // $NON-NLS-1$
    rbtnReal = new Button(groupCurveType, SWT.RADIO);
    rbtnReal.setText(Messages.getString("ECView.RealNumbers")); // $NON-NLS-1$
    rbtnReal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
    rbtnReal.setSelection(true);
    rbtnReal.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.showReal();
          }
        });
    rbtnFP = new Button(groupCurveType, SWT.RADIO);
    rbtnFP.setText("F(p)"); // $NON-NLS-1$
    rbtnFP.setSelection(false);
    rbtnFP.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
    rbtnFP.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.showFp();
          }
        });
    rbtnFM = new Button(groupCurveType, SWT.RADIO);
    rbtnFM.setText("F(2^m)"); // $NON-NLS-1$
    rbtnFM.setSelection(false);
    rbtnFM.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
    rbtnFM.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.showFm();
          }
        });
  }
Ejemplo n.º 4
0
 /** Sets the label beneath the canvas */
 public void setCurveLabel() {
   String s;
   if (points == null) {
     s = Messages.getString("ECView.NoCurve"); // $NON-NLS-1$
   } else s = curve.toString();
   lblCurve.setText(s);
 }
Ejemplo n.º 5
0
  public void setPointQ(FpPoint q) {
    if (q == null) {
      pointQ = null;
      lblQ.setText(""); // $NON-NLS-1$
      setPointR(null);
    } else {
      pointQ = q;
      lblQ.setText(
          "("
              + ((double) pointQ.x / 100)
              + "|"
              + ((double) pointQ.y / 100)
              + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

      btnDeletePoints.setEnabled(true);

      view.log(
          Messages.getString("ECView.Point")
              + " Q = "
              + "("
              + ((double) pointQ.x / 100)
              + "|"
              + ((double) pointQ.y / 100)
              + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
      setPointR(curve.addPoints(pointP, pointQ));
    }
    updateCurve(false);
  }
Ejemplo n.º 6
0
  /** This method initializes groupSize */
  private void createGroupSize() {
    groupSize = new Group(groupSettings, SWT.NONE);
    groupSize.setText(Messages.getString("ECView.SelectCurveSize")); // $NON-NLS-1$
    groupSize.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    groupSize.setLayout(new GridLayout(2, true));
    rbtnSmall = new Button(groupSize, SWT.RADIO);
    rbtnSmall.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
    rbtnSmall.setText(Messages.getString("ECView.Small")); // $NON-NLS-1$
    rbtnSmall.setSelection(true);
    rbtnLarge = new Button(groupSize, SWT.RADIO);
    rbtnLarge.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
    rbtnLarge.setText(Messages.getString("ECView.Large")); // $NON-NLS-1$
    rbtnLarge.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            view.showLarge();
          }
        });
  }
Ejemplo n.º 7
0
 public void setPointP(FpPoint p) {
   if (p == null) {
     pointP = null;
     setPointQ(null);
     lblP.setText(""); // $NON-NLS-1$
     btnDeletePoints.setEnabled(false);
     btnKP.setEnabled(false);
     btnPQ.setEnabled(false);
     btnPQ.setSelection(true);
   } else {
     btnKP.setEnabled(true);
     btnPQ.setEnabled(true);
     btnKP.setEnabled(true);
     btnPQ.setEnabled(true);
     btnPQ.setSelection(true);
     btnDeletePoints.setEnabled(true);
     pointP = p;
     view.log(
         "\n"
             + Messages.getString("ECView.Curve")
             + ": "
             + lblCurve.getText()); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     view.log(
         Messages.getString("ECView.Point")
             + " P = "
             + "("
             + ((double) pointP.x / 100)
             + "|"
             + ((double) pointP.y / 100)
             + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
     lblP.setText(
         "("
             + ((double) pointP.x / 100)
             + "|"
             + ((double) pointP.y / 100)
             + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   }
   updateCurve(false);
 }
Ejemplo n.º 8
0
 /** This method initializes groupSettings */
 private void createGroupSettings() {
   groupSettings = new Group(content, SWT.NONE);
   groupSettings.setText(Messages.getString("ECContentReal.9")); // $NON-NLS-1$
   groupSettings.setLayout(new GridLayout(1, false));
   groupSettings.setLayout(new GridLayout(1, false));
   GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, true);
   gridData.widthHint = 300;
   groupSettings.setLayoutData(gridData);
   createGroupSize();
   createGroupCurveType();
   createGroupCurveAttributes();
   createGroupCalculations();
   createGroupSave();
 }
Ejemplo n.º 9
0
 public void setPointR(FpPoint r) {
   if (r == null) {
     pointR = null;
     lblR.setText(""); // $NON-NLS-1$
   } else {
     pointR = r;
     lblR.setText(
         "("
             + ((double) pointR.x / 100)
             + "|"
             + ((double) pointR.y / 100)
             + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     view.log(
         Messages.getString("ECView.Point")
             + " R = P + Q = "
             + "("
             + ((double) pointR.x / 100)
             + "|"
             + ((double) pointR.y / 100)
             + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
   }
 }
Ejemplo n.º 10
0
  /** This method initializes groupCalculations */
  private void createGroupCalculations() {
    groupCalculations = new Group(groupSettings, SWT.NONE);
    groupCalculations.setText(Messages.getString("ECContentReal.35")); // $NON-NLS-1$
    groupCalculations.setLayout(new GridLayout(3, false));
    groupCalculations.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    Label label = new Label(groupCalculations, SWT.WRAP);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    label.setText(Messages.getString("ECContentReal.36")); // $NON-NLS-1$

    btnPQ = new Button(groupCalculations, SWT.RADIO);
    btnPQ.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    btnPQ.setText(Messages.getString("ECContentReal.37")); // $NON-NLS-1$
    btnPQ.setSelection(true);
    btnPQ.setEnabled(false);
    btnPQ.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            setPointQ(null);
          }
        });

    btnKP = new Button(groupCalculations, SWT.RADIO);
    btnKP.setText(Messages.getString("ECContentReal.38")); // $NON-NLS-1$
    btnKP.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    btnKP.setEnabled(false);
    btnKP.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            spnrK.setEnabled(btnKP.getSelection());
            FpPoint q = curve.multiplyPoint(pointP, spnrK.getSelection());
            setPointQ(q);
            updateCurve(false);
          }
        });
    spnrK = new Spinner(groupCalculations, SWT.BORDER);
    spnrK.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
    spnrK.setMinimum(1);
    spnrK.setEnabled(false);
    spnrK.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            FpPoint q = curve.multiplyPoint(pointP, spnrK.getSelection());
            setPointQ(q);
            updateCurve(false);
          }
        });

    label = new Label(groupCalculations, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 3, 1));
    label.setText(Messages.getString("ECContentReal.39")); // $NON-NLS-1$

    label = new Label(groupCalculations, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    label.setText("P ="); // $NON-NLS-1$
    lblP = new Label(groupCalculations, SWT.NONE);
    lblP.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    lblP.setText(""); // $NON-NLS-1$

    label = new Label(groupCalculations, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    label.setText("Q ="); // $NON-NLS-1$
    lblQ = new Label(groupCalculations, SWT.NONE);
    lblQ.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    lblQ.setText(""); // $NON-NLS-1$

    label = new Label(groupCalculations, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    label.setText("R = P + Q ="); // $NON-NLS-1$
    lblR = new Label(groupCalculations, SWT.NONE);
    lblR.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    lblR.setText(""); // $NON-NLS-1$
  }
Ejemplo n.º 11
0
 /** This method initializes groupCurveAttributes */
 private void createGroupCurveAttributes() {
   groupCurveAttributes = new Group(groupSettings, SWT.NONE);
   groupCurveAttributes.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
   groupCurveAttributes.setLayout(new GridLayout(2, false));
   groupCurveAttributes.setText(Messages.getString("ECView.SelectCurveAttributes")); // $NON-NLS-1$
 }
Ejemplo n.º 12
0
  /** This method initializes groupSave */
  private void createGroupSave() {
    groupSave = new Group(groupSettings, SWT.NONE);
    groupSave.setLayout(new GridLayout(2, false));
    groupSave.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    groupSave.setText(Messages.getString("ECView.SaveResults")); // $NON-NLS-1$

    cSaveResults = new Combo(groupSave, SWT.READ_ONLY);
    cSaveResults.setItems(
        new String[] {
          Messages.getString("ECView.No"),
          Messages.getString("ECView.ToTextEditor"),
          Messages.getString("ECView.ToTextFile")
        }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    cSaveResults.select(view.saveTo);
    cSaveResults.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 2, 1));
    cSaveResults.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.saveTo = cSaveResults.getSelectionIndex();
            btnBrowse.setEnabled(view.saveTo == 2);
            btnSave.setEnabled(view.saveTo != 0);
            cbAutoSave.setEnabled(view.saveTo != 0);
            if (view.saveTo != 0 && view.autoSave) view.saveLog();
            lblSaveResults.setText(view.saveTo == 2 ? view.getFileName() : ""); // $NON-NLS-1$
          }
        });

    btnBrowse = new Button(groupSave, SWT.NONE);
    btnBrowse.setText(Messages.getString("ECView.Browse")); // $NON-NLS-1$
    btnBrowse.setEnabled(view.saveTo == 2);
    btnBrowse.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.selectFileLocation();
            lblSaveResults.setText(view.saveTo == 2 ? view.getFileName() : ""); // $NON-NLS-1$
          }
        });
    btnSave = new Button(groupSave, SWT.NONE);
    btnSave.setText(Messages.getString("ECView.SaveNow")); // $NON-NLS-1$
    btnSave.setEnabled(view.saveTo != 0);
    btnSave.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.saveLog();
            lblSaveResults.setText(view.saveTo == 2 ? view.getFileName() : ""); // $NON-NLS-1$
          }
        });
    cbAutoSave = new Button(groupSave, SWT.CHECK);
    cbAutoSave.setText(Messages.getString("ECView.AutoSave")); // $NON-NLS-1$
    cbAutoSave.setEnabled(view.autoSave);
    cbAutoSave.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 2, 1));
    cbAutoSave.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            view.autoSave = cbAutoSave.getSelection();
            lblSaveResults.setText(view.saveTo == 2 ? view.getFileName() : ""); // $NON-NLS-1$
          }
        });
    lblSaveResults = new Label(groupSave, SWT.NONE);
    lblSaveResults.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    lblSaveResults.setText(""); // $NON-NLS-1$
  }