Ejemplo n.º 1
0
    public Setting(Composite comp, String title) {
      final Composite settingComp = new Composite(comp, SWT.BORDER);
      settingComp.setLayout(new FillLayout(SWT.VERTICAL));

      final RowLayout infoLayout = new RowLayout();
      infoLayout.center = true;

      final Composite infoComp = new Composite(settingComp, SWT.NONE);
      infoComp.setLayout(infoLayout);

      final Label settingLabel = new Label(infoComp, SWT.CENTER);
      settingLabel.setText(title);

      settingValue = new Text(infoComp, SWT.BORDER | SWT.SINGLE);
      settingValue.setText("000");

      settingScale = new Scale(settingComp, SWT.BORDER);
      settingScale.setSize(200, 64);
      settingScale.setMaximum(50);
      settingScale.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event e) {
              settingValue.setText("" + settingScale.getSelection());
            }
          });
    }
Ejemplo n.º 2
0
  @Override
  protected Control createControl(Composite parent) {
    // TODO Auto-generated method stub

    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = layout.marginWidth = layout.horizontalSpacing = 0;
    composite.setLayout(layout);

    scale = new Scale(composite, SWT.HORIZONTAL);
    scale.setSize(200, 30);
    scale.setMinimum(0);
    scale.setMaximum(10);
    scale.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            System.out.println("scale: " + scale.getSelection());
            LevelHighlightingEvent event = new LevelHighlightingEvent();
            event.setHierarchyLevel(scale.getSelection());

            EventPublisher.trigger(event);
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub

          }
        });

    return composite;
  }
Ejemplo n.º 3
0
  /** {@inheritDoc} */
  public Composite createControls(Composite parent, FormToolkit toolkit) {
    Section section = toolkit.createSection(parent, Section.TITLE_BAR);
    section.setText("Sampling Rate");
    section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    GridLayout layout = new GridLayout(4, false);
    layout.marginLeft = 10;
    layout.horizontalSpacing = 10;
    composite.setLayout(layout);
    GridData gridData = new GridData(SWT.MAX, SWT.DEFAULT);
    gridData.grabExcessHorizontalSpace = true;
    composite.setLayoutData(gridData);

    final Label sliderLabel = toolkit.createLabel(composite, "no sensitivity selected", SWT.LEFT);
    GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
    data.widthHint = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    sliderLabel.setLayoutData(data);

    slider = new Scale(composite, SWT.HORIZONTAL);
    toolkit.adapt(slider, true, true);
    slider.setMinimum(0);
    slider.setMaximum(Sensitivity.values().length - 1);
    slider.setIncrement(1);
    slider.setSize(200, 10);
    slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    slider.addSelectionListener(
        new SelectionAdapter() {
          /** {@inheritDoc} */
          @Override
          public void widgetSelected(SelectionEvent event) {
            Sensitivity sensitivity = Sensitivity.fromOrd(slider.getSelection());

            switch (sensitivity) {
              case NO_SENSITIVITY:
                sliderLabel.setText("no sensitivity selected");
                break;
              case VERY_FINE:
                sliderLabel.setText("very fine");
                break;
              case FINE:
                sliderLabel.setText("fine");
                break;
              case MEDIUM:
                sliderLabel.setText("medium");
                break;
              case COARSE:
                sliderLabel.setText("coarse");
                break;
              case VERY_COARSE:
                sliderLabel.setText("very coarse");
                break;
              default:
                break;
            }
          }
        });
    slider.setSelection(DEFAULT_SENSITIVITY.ordinal());
    slider.notifyListeners(SWT.Selection, null);

    Label modeLabel = toolkit.createLabel(composite, "Sampling Rate Mode: ", SWT.LEFT);
    modeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

    timeframeModeButton = toolkit.createButton(composite, "Timeframe dividing", SWT.RADIO);
    timeframeModeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    timeframeModeButton.setSelection(true);

    return composite;
  }