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

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

Introduction

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

Prototype

public Button(String html, ClickHandler handler) 

Source Link

Document

Creates a button with the given HTML caption and click listener.

Usage

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java

License:Open Source License

private Button createCloseDialogButton() {
    return new Button("close", new ClickHandler() {
        @Override/*from  w  w w  .  j  ava 2s  .  c o m*/
        public void onClick(ClickEvent ce) {
            commitDialog.hide();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java

License:Open Source License

private Button createCommitChangesButton() {
    return new Button("Commit Changes", new ClickHandler() {
        @Override//  w ww  .  j  a va2s .c  o m
        public void onClick(ClickEvent ce) {
            gitCommands.commitChangesToLocalRepository(SelectionHelper.getCurrentProjectDirectory(), logMessage,
                    committerName, committerEmail);
            commitDialog.hide();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitPushChangesDialogWidget.java

License:Open Source License

@Override
protected Button createCloseDialogButton() {
    return new Button("close", new ClickHandler() {
        @Override//from   w w w.  jav a2s  .  com
        public void onClick(ClickEvent ce) {
            dialog.hide();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitPushChangesDialogWidget.java

License:Open Source License

@Override
protected Button createExecutePushButton() {
    return new Button("Push Changes", new ClickHandler() {
        @Override/*from w  w  w  .  j a  va 2 s .  c  o m*/
        public void onClick(ClickEvent ce) {
            String projectDirectory = SelectionHelper.getCurrentProjectDirectory();
            gitCommands.pushToRemoteRepository(projectDirectory, gitURLEntered, remoteLoginName,
                    remoteLoginPassword);
            dialog.hide();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.HelpDialogWidget.java

License:Open Source License

private Button createOpenButton() {
    return new Button(title, new ClickHandler() {
        @Override//from   w w w .  ja  v  a  2  s. c o m
        public void onClick(ClickEvent ce) {
            helpDialog.show();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.HelpDialogWidget.java

License:Open Source License

private Button createCloseButton() {
    return new Button("close", new ClickHandler() {
        @Override/*  w  w  w. j a v a2 s  . co  m*/
        public void onClick(ClickEvent ce) {
            helpDialog.hide();
        }
    });
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.OperationResultDialog.java

License:Open Source License

private Button createCloseDialogButton() {
    return new Button("OK", new ClickHandler() {
        @Override/*from  w  w w. j  a va 2  s  . co  m*/
        public void onClick(ClickEvent ce) {
            statusDialog.hide();
        }
    });
}

From source file:com.google.appinventor.client.wizards.TemplateUploadWizard.java

License:Open Source License

/**
 * The UI consists of a vertical panel that holds a drop-down list box,
 *   a Horizontal panel that holds the templates list (cell list) plus
 *   the selected template. This is inserted in the Wizard dialog.
 *
 * @param templates should never be null
 * @return the main panel for Wizard dialog.
 *///  ww w .  java  2 s  .  c om
VerticalPanel createUI(final ArrayList<TemplateInfo> templates) {
    VerticalPanel panel = new VerticalPanel();
    panel.setStylePrimaryName("gwt-SimplePanel");
    panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    templatePanel = new HorizontalPanel();
    templatePanel.add(makeTemplateSelector(templates));
    if (templates.size() > 0)
        templatePanel.add(new TemplateWidget(templates.get(0), templateHostUrl));

    templatesMenu = makeTemplatesMenu();

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(templatesMenu);
    removeButton = new Button("Remove this repository", new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            removeCurrentlySelectedRepository();
        }
    });
    removeButton.setVisible(false);
    hPanel.add(removeButton);
    panel.add(hPanel);
    panel.add(templatePanel);
    return panel;
}

From source file:com.google.caliper.cloud.client.NameEditor.java

License:Apache License

private void showEditor(String initialText) {
    panel.clear();/* w  w w  .java2 s .c  o  m*/

    // build the text box and save button
    textBox = new TextBox();
    textBox.setText(initialText);

    panel.add(textBox);
    panel.add(new Button("Save", this));

    textBox.setFocus(true);
    textBox.selectAll();

    textBox.addKeyPressHandler(this);
}

From source file:com.google.code.gwt.database.sample.hellodatabase.client.HelloDatabase.java

License:Apache License

/**
 * This is the entry point method.//from   ww w.j  a  v  a 2s.  com
 */
public void onModuleLoad() {
    if (!Database.isSupported()) {
        Window.alert("HTML 5 Database is NOT supported in this browser!");
        return;
    }

    // Create the dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Welcome to GWT Database Demo!");
    dialogBox.setAnimationEnabled(true);
    Button closeButton = new Button("close", new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("100%");
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    final VerticalPanel clickedData = new VerticalPanel();
    dialogVPanel.add(clickedData);
    dialogVPanel.add(closeButton);

    dialogBox.setWidget(dialogVPanel);

    Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png");
    Button addClickButton = new Button("Add Click", new ClickHandler() {
        public void onClick(ClickEvent event) {
            dbService.insertClick(new Date(), new RowIdListCallback() {
                public void onFailure(DataServiceException error) {
                    Window.alert("Failed to add click! " + error);
                }

                public void onSuccess(final List<Integer> rowIds) {
                    dbService.getClicks(new ListCallback<ClickRow>() {
                        public void onFailure(DataServiceException error) {
                            Window.alert("Failed to query clicks! " + error);
                        }

                        public void onSuccess(List<ClickRow> result) {
                            clickedData.clear();
                            clickedData.add(new Label("Last click insert ID: " + rowIds.get(0)));
                            for (ClickRow row : result) {
                                clickedData.add(new Label("Clicked on " + row.getClicked()));
                            }
                            dialogBox.center();
                            dialogBox.show();
                        }
                    });
                }
            });
        }
    });
    Button getCountButton = new Button("Get Counts", new ClickHandler() {
        public void onClick(ClickEvent event) {
            getCount();
        }
    });

    vPanel = new VerticalPanel();
    // We can add style names.
    vPanel.addStyleName("widePanel");
    vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    vPanel.add(img);
    vPanel.add(addClickButton);
    vPanel.add(getCountButton);

    // Add image and button to the RootPanel
    RootPanel.get().add(vPanel);

    // Create table 'clickcount' if it doesn't exist already:
    dbService.initTable(new VoidCallback() {
        public void onFailure(DataServiceException error) {
            Window.alert("Failed to initialize table! " + error);
        }

        public void onSuccess() {
            Window.alert("Database initialized successfully.");
            getCount();
        }
    });

    getVersion();
}