Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.PushButton


     * @param seconds How many seconds to shift.
     * @param label The label to put on the button.
     */
    private PushButton newShiftDateButton(final int seconds,
                                          final String label) {
      final PushButton button = new PushButton(label);
      button.setStyleName(seconds < 0 ? "datePickerPreviousButton"
                          : "datePickerNextButton");
      button.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
          Date d = box.getValue();
          if (d == null) {
            if (seconds >= 0) {
              return;
View Full Code Here


     * Returns a new button that sets the hours when clicked.
     * @param hours An hour of the day (0-23).
     * @param label The label to put on the button.
     */
    private PushButton newSetHoursButton(final int hours) {
      final PushButton button = new PushButton(Integer.toString(hours));
      button.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
          @SuppressWarnings(/* GWT requires us to use Date */{"deprecation"})
          Date d = box.getValue();
          if (d == null) {
            d = new Date();
View Full Code Here

     * @param minutes A value for minutes (0-59).
     * @param label The label to put on the button.
     */
    private PushButton newSetMinutesButton(final int minutes,
                                           final String label) {
      final PushButton button = new PushButton(label);
      button.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
          @SuppressWarnings(/* GWT requires us to use Date */{"deprecation"})
          Date d = box.getValue();
          if (d == null) {
            d = new Date();
View Full Code Here

        // This vbox contains all of the "extra" panel on the side
        // of the calendar view.
        final VerticalPanel vbox = new VerticalPanel();
        setStyleName(vbox.getElement(), "datePickerMonthSelector");

        final PushButton now = new PushButton("now");
        now.setStyleName("datePickerNextButton");
        now.addClickHandler(new ClickHandler() {
          public void onClick(final ClickEvent event) {
            box.setValue(new Date());
          }
        });

        {
          final Grid grid = new Grid(2, 9);
          grid.setWidget(0, 0, newShiftDateButton(-3600, "1h"));
          grid.setWidget(0, 1, newShiftDateButton(-600, "10m"));
          grid.setWidget(0, 2, newShiftDateButton(-60, "1m"));
          grid.setWidget(0, 3, new InlineHTML("&lsaquo;"));
          grid.setWidget(0, 4, now);
          grid.setWidget(0, 5, new InlineHTML("&rsaquo;"));
          grid.setWidget(0, 6, newShiftDateButton(+60, "1m"));
          grid.setWidget(0, 7, newShiftDateButton(+600, "10m"));
          grid.setWidget(0, 8, newShiftDateButton(+3600, "1h"));
          grid.setWidget(1, 0, newShiftDateButton(-86400 * 30, "30d"));
          grid.setWidget(1, 1, newShiftDateButton(-86400 * 7, "1w"));
          grid.setWidget(1, 2, newShiftDateButton(-86400, "1d"));
          grid.setWidget(1, 3, new InlineHTML("&laquo;"));
          grid.setWidget(1, 4, new InlineHTML("&nbsp;"));
          grid.setWidget(1, 5, new InlineHTML("&raquo;"));
          grid.setWidget(1, 6, newShiftDateButton(+86400, "1d"));
          grid.setWidget(1, 7, newShiftDateButton(+86400 * 7, "1w"));
          grid.setWidget(1, 8, newShiftDateButton(+86400 * 30, "30d"));
          final CellFormatter formatter = grid.getCellFormatter();
          formatter.setWidth(0, 4, "100%");
          formatter.setWidth(1, 4, "100%");
          vbox.add(grid);
        }

        {
          hours_minutes = new Grid(4, 8);
          setupAmUI();
          hours_minutes.setWidget(0, 0, new InlineLabel("HH"));
          final PushButton set_am = new PushButton("AM");
          set_am.addClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent event) {
              setupAmUI();
            }
          });
          hours_minutes.setWidget(0, 7, set_am);

          final PushButton set_pm = new PushButton("PM");
          set_pm.addClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent event) {
              setupPmUI();
            }
          });
          hours_minutes.setWidget(1, 7, set_pm);
View Full Code Here

  }

  private PushButtonBean targetBean;

  public PushButtonBindings(Action source) {
    this(source, new PushButton());

    // Action.NAME
    addBinding(Action.NAME, BeanProperty.<Action, String> create(Action.NAME),
        BeanProperty.<PushButtonBean, String> create("text"));
  }
View Full Code Here

    button.addClickListener(action);
    return button;
  }

  private PushButton createPushButton(Action action) {
    PushButton pushButton = new PushButton();
    if (action.getText() != null) {
      pushButton.setText(action.getText());
    }
    if (action.getTitle() != null) {
      pushButton.getTitle();
    }
    pushButton.addClickListener(action);
    return pushButton;
  }
View Full Code Here

    lb.addItem(strings.xxlarge());
    return lb;
  }

  private PushButton createPushButton(ImageResource img, String tip) {
    PushButton pb = new PushButton(new Image(img));
    pb.addClickHandler(handler);
    pb.setTitle(tip);
    return pb;
  }
View Full Code Here

    header.addStyleName(style.dropDownMenuItem());
    menuContents.add(header);

    // Add a menu item for each method.
    for (ApiMethod method : methods) {
      PushButton methodItem = new PushButton();
      methodItem.addStyleName(style.dropDownMenuItem());
      methodItem.addStyleName(style.selectableDropDownMenuItem());
      methodItem.setText(method.getId());
      menuContents.add(methodItem);

      // When clicked, Navigate to the menu item.
      UrlBuilder builder = new UrlBuilder();
      String newUrl = builder
          .addRootNavigationItem(RootNavigationItem.ALL_VERSIONS)
          .addService(service.getName(), service.getVersion())
          .addMethodName(method.getId())
          .addQueryParams(resourceParams)
          .toString();
      methodItem.addClickHandler(linkFactory.generateMenuHandler(newUrl));
    }

    // Create the panel which will be disclosed.
    final PopupPanel popupMenu = new PopupPanel(/* auto hide */ true);
    popupMenu.setStyleName(style.dropDownMenuPopup());

    FocusPanel focusContents = new FocusPanel();
    focusContents.addMouseOutHandler(new MouseOutHandler() {
      @Override
      public void onMouseOut(MouseOutEvent event) {
        popupMenu.hide();
      }
    });
    focusContents.setWidget(menuContents);

    popupMenu.setWidget(focusContents);

    // Create the button which will disclose the menu.
    final PushButton menuButton = new PushButton(new Image(resources.downArrow()));
    menuButton.addStyleName(style.reusableResourceButton());

    menuButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        popupMenu.setPopupPositionAndShow(new PositionCallback() {
          @Override
          public void setPosition(int offsetWidth, int offsetHeight) {
            popupMenu.setPopupPosition(
                menuButton.getAbsoluteLeft() + menuButton.getOffsetWidth() - offsetWidth,
                menuButton.getAbsoluteTop() + menuButton.getOffsetHeight());
          }
        });
      }
    });

View Full Code Here

    lb.addItem(MESSAGES.xxlarge());
    return lb;
  }

  private PushButton createPushButton(AbstractImagePrototype img, String tip) {
    PushButton pb = new PushButton(img.createImage());
    pb.addClickHandler(new ToolbarClickHandler());
    pb.setTitle(tip);
    return pb;
  }
View Full Code Here

    lb.addItem(strings.xxlarge());
    return lb;
  }

  private PushButton createPushButton(AbstractImagePrototype img, String tip) {
    PushButton pb = new PushButton(img.createImage());
    pb.addClickListener(listener);
    pb.setTitle(tip);
    return pb;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.PushButton

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.