List of usage examples for com.google.gwt.user.client.ui Button Button
protected Button(com.google.gwt.dom.client.Element element)
From source file:com.github.a2g.core.objectmodel.LoaderPanel.java
License:Apache License
public LoaderPanel(final MouseToLoaderPresenterAPI api, ColorEnum fore, ColorEnum back) { this.api = api; VerticalPanel layout = new VerticalPanel(); {/*from ww w.j av a 2 s.com*/ progress = new Label(); progress.getElement().getStyle().setProperty("color", fore.toString()); progress.getElement().getStyle().setProperty("backgroundColor", back.toString()); progress.setText("Loading..."); layout.add(progress); } { reload = new Button("Reload"); layout.add(reload); } { clickToContinue = new Button("Click to continue"); clickToContinue.setEnabled(false); layout.add(clickToContinue); } { // Initialize the progress elements containerGrid = new Grid(1, TOTAL_NUMBER_OF_CELLS); containerGrid.getElement().getStyle().setProperty("margin", "0px"); containerGrid.getElement().getStyle().setProperty("border", "0px solid white"); containerGrid.setCellPadding(0); containerGrid.setCellSpacing(0); for (int i = 0; i < TOTAL_NUMBER_OF_CELLS; i++) { Grid grid = new Grid(1, 1); grid.setHTML(0, 0, ""); grid.getElement().getStyle().setProperty("width", "5px"); grid.getElement().getStyle().setProperty("height", "15px"); grid.getElement().getStyle().setProperty("margin", "1px"); grid.getElement().getStyle().setProperty("background", "#eee"); containerGrid.setWidget(0, i, grid); } layout.add(containerGrid); } addHandler(api); this.add(layout); }
From source file:com.github.gilbertotorrezan.gwtcloudinary.client.CloudinaryUploadWidget.java
License:Open Source License
public CloudinaryUploadWidget(String html) { button = new Button(html); initialize(); }
From source file:com.github.gilbertotorrezan.gwtcloudinary.client.CloudinaryUploadWidget.java
License:Open Source License
public CloudinaryUploadWidget(SafeHtml html) { button = new Button(html); initialize(); }
From source file:com.glines.socketio.examples.gwtchat.client.GWTChatClient.java
License:Open Source License
public void onModuleLoad() { RootPanel rootPanel = RootPanel.get(); rootPanel.setSize("800", "300"); htmlPanel = new HTML("Connecting..."); htmlPanel.setStyleName("chat"); rootPanel.add(htmlPanel);/*from www .j ava2 s .c o m*/ submitPanel = new FlowPanel(); submitPanel.setStyleName("submitPanel"); rootPanel.add(submitPanel); submitPanel.setWidth("800"); submitPanel.setVisible(false); textBox = new TextBox(); textBox.setVisibleLength(109); textBox.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { onSubmit(); } } }); textBox.setSize("", "30"); submitPanel.add(textBox); Button btnSubmit = new Button("Submit"); btnSubmit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { onSubmit(); } }); btnSubmit.setHeight("30"); submitPanel.add(btnSubmit); socket = GWTSocketIOConnectionFactory.INSTANCE.create(this, null, (short) 0); socket.connect(); }
From source file:com.glines.socketio.sample.gwtchat.client.GWTChatClient.java
License:Open Source License
public void onModuleLoad() { RootPanel rootPanel = RootPanel.get(); rootPanel.setSize("800", "300"); htmlPanel = new HTML("Connecting..."); htmlPanel.setStyleName("chat"); rootPanel.add(htmlPanel);/* w w w. j a v a 2 s .co m*/ submitPanel = new FlowPanel(); submitPanel.setStyleName("submitPanel"); rootPanel.add(submitPanel); submitPanel.setWidth("800"); submitPanel.setVisible(false); textBox = new TextBox(); textBox.setVisibleLength(109); textBox.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { onSubmit(); } } }); textBox.setSize("", "30"); submitPanel.add(textBox); Button btnSubmit = new Button("Submit"); btnSubmit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { onSubmit(); } }); btnSubmit.setHeight("30"); submitPanel.add(btnSubmit); socket = GWTSocketIOConnectionFactory.INSTANCE.create(this, "", (short) 0); socket.connect(); }
From source file:com.google.api.gwt.oauth2.samples.multi.client.OAuth2SampleEntryPoint.java
License:Apache License
private void addGoogleAuth() { // Since the auth flow requires opening a popup window, it must be started // as a direct result of a user action, such as clicking a button or link. // Otherwise, a browser's popup blocker may block the popup. Button button = new Button("Authenticate with Google"); button.addClickHandler(new ClickHandler() { @Override/*w w w. j a v a 2 s.com*/ public void onClick(ClickEvent event) { final AuthRequest req = new AuthRequest(GOOGLE_AUTH_URL, GOOGLE_CLIENT_ID) .withScopes(PLUS_ME_SCOPE); // Calling login() will display a popup to the user the first time it is // called. Once the user has granted access to the application, // subsequent calls to login() will not display the popup, and will // immediately result in the callback being given the token to use. AUTH.login(req, new Callback<String, Throwable>() { @Override public void onSuccess(String token) { Window.alert("Got an OAuth token:\n" + token + "\n" + "Token expires in " + AUTH.expiresIn(req) + " ms\n"); } @Override public void onFailure(Throwable caught) { Window.alert("Error:\n" + caught.getMessage()); } }); } }); RootPanel.get().add(button); }
From source file:com.google.api.gwt.oauth2.samples.multi.client.OAuth2SampleEntryPoint.java
License:Apache License
private void addInstagramAuth() { // Since the auth flow requires opening a popup window, it must be started // as a direct result of a user action, such as clicking a button or link. // Otherwise, a browser's popup blocker may block the popup. Button button = new Button("Authenticate with Instagram"); button.addClickHandler(new ClickHandler() { @Override// ww w . jav a 2s .com public void onClick(ClickEvent event) { final AuthRequest req = new AuthRequest(INSTAGRAM_AUTH_URL, INSTAGRAM_CLIENT_ID) .withScopes(INSTAGRAM_COMMENTS_SCOPE, INSTAGRAM_LIKES_SCOPE) // Instagram expects a plus-delimited list of scopes .withScopeDelimiter("+"); AUTH.login(req, new Callback<String, Throwable>() { @Override public void onSuccess(String token) { Window.alert("Got an OAuth token:\n" + token + "\n" + "Token expires in " + AUTH.expiresIn(req) + " ms\n"); } @Override public void onFailure(Throwable caught) { Window.alert("Error:\n" + caught.getMessage()); } }); } }); RootPanel.get().add(button); }
From source file:com.google.api.gwt.oauth2.samples.multi.client.OAuth2SampleEntryPoint.java
License:Apache License
private void addFoursquareAuth() { // Since the auth flow requires opening a popup window, it must be started // as a direct result of a user action, such as clicking a button or link. // Otherwise, a browser's popup blocker may block the popup. Button button = new Button("Authenticate with Foursquare"); button.addClickHandler(new ClickHandler() { @Override//from w ww. ja va2 s .c o m public void onClick(ClickEvent event) { final AuthRequest req = new AuthRequest(FOURSQUARE_AUTH_URL, FOURSQUARE_CLIENT_ID); AUTH.login(req, new Callback<String, Throwable>() { @Override public void onSuccess(String token) { Window.alert("Got an OAuth token:\n" + token + "\n" + "Token expires in " + AUTH.expiresIn(req) + " ms\n"); } @Override public void onFailure(Throwable caught) { Window.alert("Error:\n" + caught.getMessage()); } }); } }); RootPanel.get().add(button); }
From source file:com.google.api.gwt.oauth2.samples.multi.client.OAuth2SampleEntryPoint.java
License:Apache License
private void addFacebookAuth() { // Since the auth flow requires opening a popup window, it must be started // as a direct result of a user action, such as clicking a button or link. // Otherwise, a browser's popup blocker may block the popup. Button button = new Button("Authenticate with Facebook"); button.addClickHandler(new ClickHandler() { @Override/* w ww. j a va 2 s. c o m*/ public void onClick(ClickEvent event) { final AuthRequest req = new AuthRequest(FACEBOOK_AUTH_URL, FACEBOOK_CLIENT_ID) .withScopes(FACEBOOK_EMAIL_SCOPE, FACEBOOK_BIRTHDAY_SCOPE) // Facebook expects a comma-delimited list of scopes .withScopeDelimiter(","); AUTH.login(req, new Callback<String, Throwable>() { @Override public void onSuccess(String token) { Window.alert("Got an OAuth token:\n" + token + "\n" + "Token expires in " + AUTH.expiresIn(req) + " ms\n"); } @Override public void onFailure(Throwable caught) { Window.alert("Error:\n" + caught.getMessage()); } }); } }); RootPanel.get().add(button); }
From source file:com.google.api.gwt.oauth2.samples.multi.client.OAuth2SampleEntryPoint.java
License:Apache License
private void addDailymotionAuth() { // Since the auth flow requires opening a popup window, it must be started // as a direct result of a user action, such as clicking a button or link. // Otherwise, a browser's popup blocker may block the popup. Button button = new Button("Authenticate with Dailymotion"); button.addClickHandler(new ClickHandler() { @Override/*from w w w .j a v a2s.c o m*/ public void onClick(ClickEvent event) { final AuthRequest req = new AuthRequest(DAILYMOTION_AUTH_URL, DAILYMOTION_CLIENT_ID); AUTH.login(req, new Callback<String, Throwable>() { @Override public void onSuccess(String token) { Window.alert("Got an OAuth token:\n" + token + "\n" + "Token expires in " + AUTH.expiresIn(req) + " ms\n"); } @Override public void onFailure(Throwable caught) { Window.alert("Error:\n" + caught.getMessage()); } }); } }); RootPanel.get().add(button); }