/** Creates a control panel for adjusting the number of histogram classes */
  private void createNumClassesPanel() {

    int numClasses = getModel().getSettings().getNumClasses();
    fldNumClasses = (new InputPanelW(null, app, -1, false)).getTextComponent();
    fldNumClasses.setEditable(false);
    fldNumClasses.setOpaque(true);
    fldNumClasses.setColumns(2);
    fldNumClasses.setVisible(false);

    sliderNumClasses = new Slider(3, 20);
    sliderNumClasses.setValue(numClasses);

    sliderNumClasses.setMajorTickSpacing(1);

    sliderNumClasses.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            getModel().getSettings().setNumClasses(sliderNumClasses.getValue());
            fldNumClasses.setText(("" + getModel().getSettings().getNumClasses()));
            getModel().updatePlot(true);
          }
        });

    numClassesPanel = new FlowPanel();
    numClassesPanel.add(sliderNumClasses);
    numClassesPanel.add(fldNumClasses);
  }
Esempio n. 2
0
  private void initSlider() {

    mySlider = new Slider(0, 100);
    mySlider.setMajorTickSpacing(25);
    mySlider.setMinorTickSpacing(5);
    mySlider.addChangeHandler(this);
    Slider.addInputHandler(mySlider.getElement(), this);

    sliderLabel = new Label();
    FlowPanel panel = new FlowPanel();
    panel.add(mySlider);
    panel.add(sliderLabel);
    sliderLabel.addStyleName("popupSliderLabel");
    panel.addStyleName("panelRow");
    myPopup.getPanel().add(panel);
  }
Esempio n. 3
0
 /** @param value {@code int} */
 public void setSliderValue(int value) {
   if (mySlider == null) {
     return;
   }
   mySlider.setValue(value);
   sliderLabel.setText(value + "");
   updateGUI();
 }
Esempio n. 4
0
 public void showSlider(boolean show) {
   if (show) {
     getMySlider().setVisible(show);
     sliderLabel.setVisible(show);
   } else if (mySlider != null) {
     mySlider.setVisible(false);
     sliderLabel.setVisible(false);
   }
 }
Esempio n. 5
0
 public void onSliderInput() {
   if (mySlider != null) {
     setSliderValue(mySlider.getValue());
   }
   if (changeEventHandler != null) {
     changeEventHandler.fireActionPerformed(this);
   } else {
     ((EuclidianStyleBarW) app.getActiveEuclidianView().getStyleBar()).fireActionPerformed(this);
   }
   fireActionPerformed();
   updateGUI();
 }
Esempio n. 6
0
 /** @return {@code int} or {@code -1} if the {@link Slider slider} is null */
 public int getSliderValue() {
   return mySlider == null ? -1 : mySlider.getValue();
 }