/** 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);
  }