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.ephesoft.dcma.gwt.rv.client.view.ReviewValidatePanel.java

License:Open Source License

public void setButtonsForUrls() {
    urlButtonPanel.clear();//from w w  w.j av a 2s  .  co  m
    urlAndShortcutMap = presenter.batchDTO.getUrlAndShortcutMap();
    urlAndTitleMap = presenter.batchDTO.getUrlAndTitleMap();
    if (null != urlAndShortcutMap && !urlAndShortcutMap.isEmpty()) {

        Set<String> urlList = urlAndShortcutMap.keySet();
        for (final String url : urlList) {
            if (urlAndShortcutMap.get(url) != null && !urlAndShortcutMap.get(url).isEmpty()) {
                String buttonName = LocaleDictionary.get().getConstantValue(urlAndApplicationMap.get(url));

                Button button = new Button(buttonName, new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent arg0) {
                        presenter.showExternalAppForHtmlPattern(urlAndShortcutMap.get(url),
                                urlAndTitleMap.get(url));
                    }
                });
                button.setWidth("55px");
                button.setVisible(true);
                String title = url.substring(url.indexOf('('), url.length());
                button.setTitle(title);
                urlButtonPanel.setSpacing(5);
                urlButtonPanel.add(button);
            }
        }

    }
}

From source file:com.example.app.client.EchoWidget.java

License:Apache License

public EchoWidget(final EchoServiceAsync service, final ExceptionHandler handler) {
    final Grid grid = new Grid(3, 2);
    final TextBox box = new TextBox();

    grid.setWidget(0, 0, label("Message"));
    grid.setWidget(0, 1, box);/*from  w  w w.  j  av a 2  s .  com*/
    grid.setWidget(1, 0, label("Result"));
    grid.setWidget(2, 1, new Button("Invoke", new ClickHandler() {
        //@Override
        public void onClick(ClickEvent event) {
            service.echo(box.getText(), new AsyncCallback<String>() {
                //@Override
                public void onFailure(Throwable caught) {
                    grid.setText(1, 1, "ERROR: " + caught.toString());
                    handler.handle(caught);
                }

                //@Override
                public void onSuccess(String result) {
                    grid.setText(1, 1, result);
                }
            });
        }
    }));
    initWidget(grid);
}

From source file:com.example3.client.Hello.java

License:Apache License

public void onModuleLoad() {
    thisHelloObj = this;
    Button b = new Button("Click me", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("Hello, AJAX");
            //  HelloJsonp.get();
        }/*from   w  w  w .  j  a  v  a 2 s. c o m*/
    });

    RootPanel.get().add(b);

    Button b2 = new Button("Click me b2", new ClickHandler() {
        public void onClick(ClickEvent event) {
            HelloFront front = new HelloFront();
            front.init();
        }
    });
    RootPanel.get().add(b2);
    thisHelloRoot = RootPanel.get();
}

From source file:com.example3.client.HelloFront.java

License:Apache License

public void init() {

    /* panel *///from w  ww.  ja v a  2s  . c  om
    VerticalPanel pnl = new VerticalPanel();
    pnl.setWidth("100%");
    pnl.setBorderWidth(3);
    pnl.setSpacing(3);

    /* table */
    FlexTable tbl = new FlexTable();
    tbl.setWidth("100%");
    tbl.setBorderWidth(3);
    tbl.getColumnFormatter().setWidth(0, "100%");

    /* row */
    int row = 0;
    {
        TextArea txt = new TextArea();
        txt.setWidth("100%");
        txt.setText("HelloJsonp Test");
        Button btn = new Button("Click to test", new ClickHandler() {
            public void onClick(ClickEvent event) {
                HelloJsonp.get();
            }
        });
        tbl.setWidget(row, 0, txt);
        tbl.setWidget(row, 1, btn);
    }

    /* add table to panel, panel to root */
    pnl.add(tbl);
    Hello.hookNewRoot(pnl);
    thisPanel = pnl;
}

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

License:Open Source License

/**
 * Close Button/*  w  w w  . ja  v  a 2  s . c  o  m*/
 * @return
 */
protected Button createCloseDialogButton() {
    return new Button("Close", new ClickHandler() {
        @Override
        public void onClick(ClickEvent ce) {
            dialog.hide();
        }
    });
}

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

License:Open Source License

@Override
protected Button createExecutePushButton() {
    return new Button("Deploy", new ClickHandler() {
        @Override/*from   www  . j  a  va2s. co m*/
        public void onClick(ClickEvent ce) {
            String projectDirectory = SelectionHelper.getCurrentProjectDirectory();
            deploy(remoteLoginName, remoteLoginPassword, projectDirectory);

            dialog.hide();
        }
    });
}

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

License:Open Source License

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

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

License:Open Source License

private Button createNewProjectButton() {
    return new Button("New Project", new ClickHandler() {
        @Override//from   w w  w .  j a v a  2s.  com
        public void onClick(ClickEvent ce) {
            gitCommands.initializeNewRepository(saveToLocation);
            cloneDialog.hide();
        }
    });
}

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

License:Open Source License

@Override
protected Button createExecutePushButton() {
    return new Button("Create File", new ClickHandler() {
        @Override// ww  w. ja va  2 s  .c o  m
        public void onClick(ClickEvent ce) {
            String filePath = SelectionHelper.getCurrentDirectory() + "/" + fileName;
            String projectDirectory = SelectionHelper.getCurrentProjectDirectory();
            fileCommands.saveFile(filePath, fileContents);

            //If Add to Git Checkbox is ticked
            if (addToGIT) {
                gitCommands.addFileToRepository(projectDirectory, fileName);
            }
            dialog.hide();
        }
    });
}

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

License:Open Source License

private Button createExecuteCloneButton() {
    return new Button("Clone Repository", new ClickHandler() {
        @Override//www .  jav a 2 s . c om
        public void onClick(ClickEvent ce) {
            //TODO - Implement Clone
            gitCommands.cloneGITRepositoryOverHttp(saveToLocation, gitURLEntered);
            cloneDialog.hide();
        }
    });
}