Java Code Examples for com.google.gwt.user.client.ui.Button#setVisible()

The following examples show how to use com.google.gwt.user.client.ui.Button#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * 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.
 */
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;
}
 
Example 2
Source File: HtmlButtonRenderer.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void render(final RendererCellReference cell, final String text, final Button button) {
    final boolean buttonEnable = isButtonEnable(cell.getElement().getClassName());
    if (text != null) {
        button.setHTML(text);
    }
    applystyles(button, buttonEnable);
    // this is to allow the button to disappear, if the text is null
    button.setVisible(text != null);
    button.getElement().setId(UIComponentIdProvider.ROLLOUT_ACTION_ID + "." + cell.getColumnIndex());
    button.setEnabled(buttonEnable);
}
 
Example 3
Source File: GridButtonRenderer.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void render(final RendererCellReference cell, final FontIconData iconMetadata, final Button button) {
    if (iconMetadata.getFontIconHtml() != null) {
        button.setHTML(iconMetadata.getFontIconHtml());
    }
    applyStyles(button, iconMetadata.isDisabled(), iconMetadata.getStyle());
    button.getElement().setId(iconMetadata.getId());
    button.getElement().setTitle(iconMetadata.getTitle());
    button.setEnabled(!iconMetadata.isDisabled());
    // this is to allow the button to disappear, if the text is null
    button.setVisible(iconMetadata.getFontIconHtml() != null);
}
 
Example 4
Source File: LogFilePanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Button hiddenButton(String action, String styleName) {
    Button button = new Button();
    button.setStyleName(styleName);
    button.getElement().setAttribute("action", action);
    button.setVisible(false);
    return button;
}
 
Example 5
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initReportSection() {
  final HTML reportPrompt = new HTML();
  reportPrompt.setHTML(MESSAGES.galleryReportPrompt());
  reportPrompt.addStyleName("primary-prompt");
  final TextArea reportText = new TextArea();
  reportText.addStyleName("action-textarea");
  final Button submitReport = new Button(MESSAGES.galleryReportButton());
  submitReport.addStyleName("action-button");
  final Label descriptionError = new Label();
  descriptionError.setText("Description required");
  descriptionError.setStyleName("ode-ErrorMessage");
  descriptionError.setVisible(false);
  appReportPanel.add(reportPrompt);
  appReportPanel.add(descriptionError);
  appReportPanel.add(reportText);
  appReportPanel.add(submitReport);

  final OdeAsyncCallback<Boolean> isReportdByUserCallback = new OdeAsyncCallback<Boolean>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(Boolean isAlreadyReported) {
          if(isAlreadyReported) { //already reported, cannot report again
            reportPrompt.setHTML(MESSAGES.galleryAlreadyReportedPrompt());
            reportText.setVisible(false);
            submitReport.setVisible(false);
            submitReport.setEnabled(false);
          } else {
            submitReport.addClickHandler(new ClickHandler() {
              public void onClick(ClickEvent event) {
                final OdeAsyncCallback<Long> reportClickCallback = new OdeAsyncCallback<Long>(
                    // failure message
                    MESSAGES.galleryError()) {
                      @Override
                      public void onSuccess(Long id) {
                        reportPrompt.setHTML(MESSAGES.galleryReportCompletionPrompt());
                        reportText.setVisible(false);
                        submitReport.setVisible(false);
                        submitReport.setEnabled(false);
                      }
                  };
                if (!reportText.getText().trim().isEmpty()){
                  Ode.getInstance().getGalleryService().addAppReport(app, reportText.getText(),
                    reportClickCallback);
                  descriptionError.setVisible(false);
                } else {
                  descriptionError.setVisible(true);
                }
              }
            });
          }
        }
    };
  Ode.getInstance().getGalleryService().isReportedByUser(app.getGalleryAppId(),
      isReportdByUserCallback);
}
 
Example 6
Source File: UniTimeHeaderPanel.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void setEnabled(int button, boolean enabled) {
	Button b = (Button)iButtons.getWidget(button);
	b.setVisible(enabled); b.setEnabled(enabled);
	for (UniTimeHeaderPanel clone: iClones)
		clone.setEnabled(button, enabled);
}
 
Example 7
Source File: UniTimeHeaderPanel.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void setEnabled(int button, boolean enabled, boolean visible) {
	Button b = (Button)iButtons.getWidget(button);
	b.setVisible(visible); b.setEnabled(enabled);
	for (UniTimeHeaderPanel clone: iClones)
		clone.setEnabled(button, enabled, visible);
}