Example usage for com.google.gwt.user.client.ui PushButton PushButton

List of usage examples for com.google.gwt.user.client.ui PushButton PushButton

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui PushButton PushButton.

Prototype

@Deprecated
public PushButton(String upText, String downText, ClickListener listener) 

Source Link

Document

Constructor for PushButton.

Usage

From source file:com.google.gwt.examples.PushButtonExample.java

License:Apache License

public void onModuleLoad() {
    // Make a new button that does something when you click it.
    PushButton b = new PushButton("Jump", "Jump?", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Crash...");
            Window.alert("Uh Oh...");
        }//  w w  w  .  jav  a2s  . c o m
    });

    // In a real application, you would have to have css styles defined for
    // gwt-PushButton-up,gwt-PushButton-up-hovering,gwt-PushButton-up-disabled,
    // gwt-PushButton-down,.gwt-PushButton-down-hovering,.gwt-PushButton-down-disabled

    // Add the push button to the root panel.
    RootPanel.get().add(b);
}

From source file:de.eckhartarnold.client.ControlPanel.java

License:Apache License

/**
 * (Re-)creates the button panel using the images stored in the 
 * <code>icons</code> map as symbols on the buttons.
 *//*  w  ww.  ja  v  a2s.  co  m*/
protected void composePanel() {
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // progress bar   
    progress = new ProgressBar(slideshow.size());
    int btnSize;
    if (filmstrip != null)
        btnSize = buttonSize / 2;
    else
        btnSize = buttonSize;
    if (btnSize >= 24)
        progress.setLabelingType(ProgressBar.VALUE_LABEL);
    else
        progress.setLabelingType(ProgressBar.NO_LABEL);
    if (btnSize <= 32)
        progress.getFrame().addStyleDependentName("thin");
    if (btnSize > 48)
        progress.getBar().addStyleDependentName("16px");
    else if (btnSize > 32)
        progress.getBar().addStyleDependentName("12px");
    else if (btnSize >= 28)
        progress.getBar().addStyleDependentName("10px");
    else if (btnSize >= 24)
        progress.getBar().addStyleDependentName("9px");
    else if (btnSize >= 20)
        progress.getBar().addStyleDependentName("4px");
    else
        progress.getBar().addStyleDependentName("3px");
    int value = slideshow.getCurrentSlide();
    if (value >= 0)
        progress.setValue(value + 1);

    // button panel
    //    begin = new PushButton(icons.get("begin"), icons.get("begin_down"), this);
    //    Tooltip.addToWidget(beginTooltip, begin);    
    back = new PushButton(icons.get("back"), icons.get("back_down"), this);
    Tooltip.addToWidget(backTooltip, back);

    if (homeButtonHandler != null) {
        home = new PushButton(icons.get("gallery"), icons.get("gallery_down"), homeButtonHandler);
    } else {
        home = new PushButton(icons.get("gallery"), icons.get("gallery_down"));
    }
    Tooltip.addToWidget(homeTooltip, home);
    play = new ToggleButton(icons.get("play"), icons.get("pause"), this);
    Tooltip.addToWidget(playPauseTooltip, play);
    if (slideshow.isRunning())
        play.setDown(true);

    next = new PushButton(icons.get("next"), icons.get("next_down"), this);
    Tooltip.addToWidget(nextTooltip, next);
    //    end = new PushButton(icons.get("end"), icons.get("end_down"), this);
    //    Tooltip.addToWidget(endTooltip, end);

    // if ((buttonsShown & BEGIN) != 0) buttonPanel.add(begin);
    if ((buttonsShown & BACK) != 0)
        buttonPanel.add(back);
    if ((buttonsShown & HOME) != 0)
        buttonPanel.add(home);
    if (filmstrip != null) {
        filmstrip.setHeight(buttonSize * 2 + "px");
        vpanel.add(filmstrip);
        vpanel.add(progress);
        vpanel.setWidth("100%");
        buttonPanel.add(vpanel);
        buttonPanel.setCellWidth(vpanel, "100%");
        buttonPanel.addStyleName("controlFilmstripBackground");
        addButtonStyles("controlFilmstripButton");
    } else {
        buttonPanel.addStyleName("controlPanelBackground");
        addButtonStyles("controlPanelButton");
    }
    if ((buttonsShown & PLAY) != 0)
        buttonPanel.add(play);
    if ((buttonsShown & NEXT) != 0)
        buttonPanel.add(next);
    // if ((buttonsShown & END) != 0) buttonPanel.add(end);    

    enableOrDisableButtons();
    if (filmstrip != null) {
        wrapper.setWidget(buttonPanel);
    } else {
        vpanel.add(buttonPanel);
        vpanel.add(progress);
        wrapper.setWidget(vpanel);
    }
}

From source file:de.eckhartarnold.client.Gallery.java

License:Apache License

private void initGallery(ImageCollectionInfo collection) {
    HashMap<String, String> info = collection.getInfo();
    this.title = info.get("title");
    this.subtitle = info.get("subtitle");
    this.bottomLineText = info.get("bottom line");
    if (bottomLineText != null) {
        this.bottomLine = new HTML(
                "<hr class=\"galleryBottomSeparator\" />\n" + this.bottomLineText + "\n<br />");
        bottomLine.addStyleName("bottomLine");
    }//  w w w  . ja  v a 2  s.c om

    if (this.title != null) {
        HTML title = new HTML(this.title);
        title.addStyleName("galleryTitle");
        panel.insert(title, 0);
    }

    if (this.subtitle != null) {
        HTML subtitle = new HTML(this.subtitle);
        subtitle.addStyleName("gallerySubTitle");
        panel.insert(subtitle, 1);
    }

    PushButton slideshowButton = new PushButton(new Image("icons/start.png"), new Image("icons/start_down.png"),
            new ClickHandler() {
                public void onClick(ClickEvent event) {
                    fireStartSlideshow();
                }
            });
    slideshowButton.setPixelSize(64, 32);
    slideshowButton.addStyleName("galleryStartButton");
    Tooltip.addToWidget(new Tooltip(I18N.i18n.runSlideshow()), slideshowButton);
    panel.insert(new HTML("<hr class=\"galleryTopSeparator\" />"), 2);
    panel.insert(slideshowButton, 3);
    panel.insert(new HTML("<br /><br />"), 4);

    addBottomLine();
}