Package com.google.gwt.gen2.datepicker.client

Examples of com.google.gwt.gen2.datepicker.client.DatePicker


      Panel contents = createSchoolNavBar();
      FastTree.injectDefaultCss();
      CollapsiblePanel.injectDefaultCss();

      // The panel.
      final CollapsiblePanel panel = new CollapsiblePanel();
      panel.addCollapsedStateHandler(new CollapsedStateHandler() {
        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });

      panel.addExpandedStateHandler(new ExpandedStateHandler() {
        public void onExpandedState(ExpandedStateEvent e) {
          Window.alert("panel expanded");
        }
      });

      String value = Location.getParameter("collapsed");
      if (value != null) {
        value = value.trim();
        if (value.equals("true")) {
          panel.setCollapsedState(true);
        } else if (value.equals("false")) {
          // do nothing, default.
        } else {
          Window.alert("collapsed should not be given " + value
              + " use true or false instead");
        }
      }
      RootPanel.get("collapsible-panel").add(panel);
      panel.add(contents);
      panel.setHeight(Window.getClientHeight() - 1 + "px");
      panel.hookupControlToggle(controlButton);
    } catch (RuntimeException e) {
      if (GWT.isScript()) {
        Log.severe(e.getMessage());
      }
      throw e;
View Full Code Here


      FastTree.injectDefaultCss();
      CollapsiblePanel.injectDefaultCss();

      // The panel.
      final CollapsiblePanel panel = new CollapsiblePanel();
      panel.addCollapsedStateHandler(new CollapsedStateHandler() {
        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });
View Full Code Here

        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });

      panel.addExpandedStateHandler(new ExpandedStateHandler() {
        public void onExpandedState(ExpandedStateEvent e) {
          Window.alert("panel expanded");
        }
      });
View Full Code Here

    navBar.setSize("200px", "");

    navBar.add(controlButton);
    controlButton.setStylePrimaryName("CollapsibleTitle");

    final FastTree contents = new FastTree();
    navBar.add(contents);

    FastTreeItem students = contents.addItem("Students");
    students.addItem("Jill");
    students.addItem("Jack");
    students.addItem("Molly");
    students.addItem("Ms. Muffat");

    FastTreeItem teachers = contents.addItem("Teachers");
    teachers.addItem("Mrs Black");
    teachers.addItem("Mr White");

    FastTreeItem admin = contents.addItem("Administrators");
    admin.addItem("The Soup Nazi");
    admin.addItem("The Grand High Supreme Master Pubba");
    return navBar;
  }
View Full Code Here

    controlButton.setStylePrimaryName("CollapsibleTitle");

    final FastTree contents = new FastTree();
    navBar.add(contents);

    FastTreeItem students = contents.addItem("Students");
    students.addItem("Jill");
    students.addItem("Jack");
    students.addItem("Molly");
    students.addItem("Ms. Muffat");

    FastTreeItem teachers = contents.addItem("Teachers");
    teachers.addItem("Mrs Black");
    teachers.addItem("Mr White");

    FastTreeItem admin = contents.addItem("Administrators");
    admin.addItem("The Soup Nazi");
    admin.addItem("The Grand High Supreme Master Pubba");
    return navBar;
  }
View Full Code Here

  }

  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);

    monitorEvents.add(new HighlightHandlerCheckBox("Log highlight events",
        picker, new HighlightHandler<Date>() {
          public void onHighlight(HighlightEvent<Date> event) {
            Log.info("Highlight: " + event.getValue());
          }
        }));

    monitorEvents.add(new SelectionHandlerCheckBox("Log select events", picker,
        new SelectionHandler<Date>() {
          public void onSelection(SelectionEvent<Date> event) {
            Log.info("Select: " + event.getOldValue() + "-->"
                + event.getNewValue());
          }
        }));

    monitorEvents.add(new SelectionHandlerCheckBox("Disable selected item",
        picker, new SelectionHandler<Date>() {
          public void onSelection(SelectionEvent<Date> event) {
            Date d = event.getNewValue();
            picker.setEnabledOnVisibleDate(d, !picker.isVisibleDateEnabled(d));
          }
        }));
    return panel;
  };
View Full Code Here

        }));
    return panel;
  };

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

    picker.setValue(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);

    styling.add(new ShowRangeHandlerCheckBox(
        "First and last displayed date will be underlined and bold", picker,
        new ShowRangeHandler<Date>() {
          public void onShowRange(ShowRangeEvent<Date> event) {
            Date startDate = event.getStart();
            Date endDate = event.getEnd();
            picker.addStyleToVisibleDate(startDate, "underlined-and-bold-text");
            picker.addStyleToVisibleDate(endDate, "underlined-and-bold-text");
          }
        }));

    styling.add(new ShowRangeHandlerCheckBox("5th of the month will be red",
        picker, new ShowRangeHandler<Date>() {
          public void onShowRange(ShowRangeEvent<Date> event) {
            Date monthShown = picker.getDateShown();
            Date d = new Date(monthShown.getTime());
            d.setDate(5);
            Log.info("Adding a red style to the 5th day of the month");
            picker.addStyleToVisibleDate(d, "red-date");
          }
        }));

    styling.add(new SelectionHandlerCheckBox(
        "Add random style to selected date", picker,
        new SelectionHandler<Date>() {
          String[] styles = {
              "blue-background", "green-border", "red-text", "big-text",
              "green-background", "underlined-and-bold-text",
              "yellow-background"};

          int styleIndex = 0;

          public void onSelection(SelectionEvent<Date> event) {
            if (event.getNewValue() != null) {
              styleIndex = ++styleIndex % styles.length;
              String styling = styles[styleIndex];
              Log.info(event.getNewValue() + " has style " + styling, "styling");
              picker.addGlobalStyleToDate(event.getNewValue(), styling);
            }
          }
        }));

    return panel;
View Full Code Here

    return DESC_SELECTION;
  }

  @Override
  protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Add the current status
    statusLabel = new Label();
    form.addLabeledWidget("Selection Status:", statusLabel);

    // Add the current policy
    policyBox = new ListBox();
    policyBox.addItem("Multi Row");
    policyBox.addItem("Single Row");
    policyBox.addItem("Checkboxes");
    policyBox.addItem("Radio Buttons");
    form.addLabeledWidget("Selection Policy:", policyBox);

    // Add button to change policy
    {
      Button button = new Button("Set Selection Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          SelectionGrid grid = ScrollTableDemo.get().getDataTable();
          switch (policyBox.getSelectedIndex()) {
            case 0:
              grid.setSelectionPolicy(SelectionPolicy.MULTI_ROW);
              break;
            case 1:
              grid.setSelectionPolicy(SelectionPolicy.ONE_ROW);
              break;
            case 2:
              grid.setSelectionPolicy(SelectionPolicy.CHECKBOX);
              break;
            case 3:
              grid.setSelectionPolicy(SelectionPolicy.RADIO);
              break;
          }
          PagingScrollTableDemo.get().getPagingScrollTable().reloadPage();
        }
      });
      form.addButton(button);
    }

    // Add button to change status
    {
      Button button = new Button("Toggle Status", new ClickHandler() {
        public void onClick(ClickEvent event) {
          SelectionGrid grid = ScrollTableDemo.get().getDataTable();
          grid.setSelectionEnabled(!grid.isSelectionEnabled());
          refreshPolicy();
        }
      });
      form.addButton(button);
    }

    // Refresh policy and return
    refreshPolicy();
    return form;
View Full Code Here

    return "Set the contents of a cell";
  }

  @Override
  protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("3");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index", rowBox);

    // Column selection
    final TextBox columnBox = new TextBox();
    columnBox.setText("4");
    columnBox.setWidth("50px");
    form.addLabeledWidget("Column Index", columnBox);

    // Text selection
    final TextBox textBox = new TextBox();
    textBox.setText("<b>Hello World</b>");
    form.addLabeledWidget("Text:", textBox);

    // Add button to set text
    {
      Button button = new Button("Set Cell Text", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int row = Integer.parseInt(rowBox.getText());
            int column = Integer.parseInt(columnBox.getText());
            String text = textBox.getText();
            ScrollTableDemo.get().getDataTable().setText(row, column, text);
          } catch (NumberFormatException e) {
            Window.alert("Please enter valid integers for the row and column.");
          } catch (IndexOutOfBoundsException e) {
            Window.alert("The row or column index you entered is out of bounds.");
          }
        }
      });
      form.addButton(button);
    }

    // Add button to set html
    {
      Button button = new Button("Set Cell HTML", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int row = Integer.parseInt(rowBox.getText());
            int column = Integer.parseInt(columnBox.getText());
            String text = textBox.getText();
            ScrollTableDemo.get().getDataTable().setHTML(row, column, text);
          } catch (NumberFormatException e) {
            Window.alert("Please enter valid integers for the row and column.");
          } catch (IndexOutOfBoundsException e) {
            Window.alert("The row or column index you entered is out of bounds.");
          }
        }
      });
      form.addButton(button);
    }

    return form;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.datepicker.client.DatePicker

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.