Package com.google.gwt.widgetideas.datepicker.client

Examples of com.google.gwt.widgetideas.datepicker.client.DatePicker$Styles


  }

  private Widget eventPicker() {

    // Set up code
    final DatePicker picker = new DatePicker();
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(picker);
    VerticalPanel monitorEvents = new VerticalPanel();
    panel.add(monitorEvents);

    // Log hover events.
    HighlightHandler logHovers = new HighlightHandler<Date>() {
      public void onHighlight(HighlightEvent<Date> event) {
        Log.info("Hover:" + event.getHighlightedValue());
      }
    };
    monitorEvents.add(toggleHandler("Log hover events", picker, logHovers));

    // Log select events.
    ChangeHandler logSelects = new ChangeHandler<Date>() {
      public void onChange(ChangeEvent<Date> event) {
        Log.info("Select:" + event.getOldValue() + "-->" + event.getNewValue());
      }
    };
    monitorEvents.add(toggleHandler("Log select events", picker, logSelects));

    // Disable selected date
    ChangeHandler toggleEnabled = new ChangeHandler<Date>() {
      public void onChange(ChangeEvent<Date> event) {
        Date d = event.getNewValue();
        picker.setVisibleDateEnabled(d, !picker.isDateEnabled(d));
      }
    };

    monitorEvents.add(toggleHandler("Toggle enabled property", picker,
        toggleEnabled));
View Full Code Here


    return panel;
  }

  private DatePicker simplePicker() {
    DatePicker picker = new DatePicker();
    Date d = new Date();
    d.setMonth(2);
    d.setDate(1);
    picker.setSelectedDate(d);
    return picker;
  }
View Full Code Here

    picker.setSelectedDate(d);
    return picker;
  }

  private Widget stylingPicker() {
    final DatePicker picker = new DatePicker();
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(picker);
    VerticalPanel styling = new VerticalPanel();
    panel.add(styling);

    // 5th of each month is red.
    RenderingHandler redHandler = new RenderingHandler() {
      public void onRendered(RenderingEvent event) {
        Date shown = picker.getDateShown();
        Date d = new Date();
        d.setYear(shown.getYear());
        d.setMonth(shown.getMonth());
        d.setDate(5);
        picker.addVisibleDateStyle(d, "red-date");
      }
    };

    styling.add(toggleHandler("5th of the month will be red", picker,
        redHandler));

    // Random style adder.
    ChangeHandler<Date> randomStyles = new ChangeHandler<Date>() {
      String[] styles = {
          "blue-background", "green-border", "red-text", "big-text",
          "green-background", "underlined-and-bold-text", "yellow-background"};

      int styleIndex = 0;

      public void onChange(ChangeEvent<Date> event) {
        if (event.getNewValue() != null) {
          styleIndex = ++styleIndex % styles.length;
          String styling = styles[styleIndex];
          Log.info(event.getNewValue() + " has style " + styling, "styling");
          picker.addGlobalDateStyle(event.getNewValue(), styling);
        }
      }
    };
    styling.add(toggleHandler("Add random style to selected date", picker,
        randomStyles));

    // Visibly disable selected date.
    ChangeHandler<Date> disabler = new ChangeHandler<Date>() {

      public void onChange(ChangeEvent<Date> event) {
        if (event.getNewValue() != null) {
          picker.setVisibleDateEnabled(event.getNewValue(), false);
        }
      }
    };
    styling.add(toggleHandler("Disable selected date", picker, disabler));
    return panel;
View Full Code Here

TOP

Related Classes of com.google.gwt.widgetideas.datepicker.client.DatePicker$Styles

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.