Package com.google.gwt.widgetideas.client

Examples of com.google.gwt.widgetideas.client.ValueSpinner


  public SpinnerDemoPanel() {
    FlexTable table = new FlexTable();
    table.setHTML(1, 0, "Value spinner:");
    // Create a value spinner with initial value=0 that allows values between
    // -1000 and 1000
    final ValueSpinner simpleSpinner = new ValueSpinner(0, -1000, 1000);
    table.setWidget(1, 1, simpleSpinner);
    final CheckBox enableSpinner = new CheckBox("Enable/disable");
    enableSpinner.setChecked(simpleSpinner.isEnabled());
    enableSpinner.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        simpleSpinner.setEnabled(enableSpinner.isChecked());
      }
    });
    table.setWidget(1, 2, enableSpinner);

    // Create a value spinner that displays the value as a formatted date
    final ValueSpinner dateSpinner = new ValueSpinner(new Date().getTime()) {
      protected String formatValue(long value) {
        return DateTimeFormat.getLongDateFormat().format(new Date(value));
      }

      protected long parseValue(String value) {
        return DateTimeFormat.getLongDateFormat().parse(value).getTime();
      }
    };
    // Min step = milliseconds per day
    dateSpinner.getSpinner().setMinStep(86400000);
    dateSpinner.setStylePrimaryName("dateSpinner");
    table.setHTML(2, 0, "Date spinner:");
    table.setWidget(2, 1, dateSpinner);
    final CheckBox enableDateSpinner = new CheckBox("Enable/disable");
    enableDateSpinner.setChecked(dateSpinner.isEnabled());
    enableDateSpinner.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dateSpinner.setEnabled(enableDateSpinner.isChecked());
      }
    });
    table.setWidget(2, 2, enableDateSpinner);

    // A TimePicker using AM/PM 12h format
View Full Code Here

TOP

Related Classes of com.google.gwt.widgetideas.client.ValueSpinner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.