com.vaadin.ui.Button.setDisableOnClick()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中com.vaadin.ui.Button.setDisableOnClick()方法的一些代码示例,展示了Button.setDisableOnClick()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setDisableOnClick()方法的具体详情如下:
包路径:com.vaadin.ui.Button
类名称:Button
方法名:setDisableOnClick

Button.setDisableOnClick介绍

[英]Determines if a button is automatically disabled when clicked. If this is set to true the button will be automatically disabled when clicked, typically to prevent (accidental) extra clicks on a button.

Note that this is only used when the click comes from the user, not when calling #click() method programmatically. Also, if developer wants to re-enable the button, it needs to be done programmatically.
[中]确定单击按钮时是否自动禁用按钮。如果设置为true,则单击按钮时会自动禁用该按钮,通常是为了防止(意外)额外单击按钮。
请注意,这仅在单击来自用户时使用,而不是在以编程方式调用#click()方法时使用。此外,如果开发人员希望重新启用按钮,则需要以编程方式完成。

代码示例

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

public void setDisableOnClick(boolean disable) {
  selectButton.setDisableOnClick(disable);
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

@Override
public ButtonBuilder disableOnClick() {
  getInstance().setDisableOnClick(true);
  return this;
}

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin

@Override
public ButtonBuilder disableOnClick() {
  getInstance().setDisableOnClick(true);
  return this;
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

@Override
public com.holonplatform.vaadin.components.builders.ButtonConfigurator.BaseButtonConfigurator disableOnClick() {
  getInstance().setDisableOnClick(true);
  return this;
}

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin

@Override
public com.holonplatform.vaadin7.components.builders.ButtonConfigurator.BaseButtonConfigurator disableOnClick() {
  getInstance().setDisableOnClick(true);
  return this;
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Creates the button for converting an XML bundle in a property bundle.
 * @return the created button.
 */
private Component createConvertToPropertyBundleButton() {
  Button addDescriptorButton = CmsToolBar.createButton(
    FontOpenCms.SETTINGS,
    m_messages.key(Messages.GUI_CONVERT_TO_PROPERTY_BUNDLE_0));
  addDescriptorButton.setDisableOnClick(true);
  addDescriptorButton.addClickListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
      try {
        m_model.saveAsPropertyBundle();
        Notification.show("Conversion successful.");
      } catch (CmsException | IOException e) {
        CmsVaadinUtils.showAlert("Conversion failed", e.getLocalizedMessage(), null);
      }
    }
  });
  addDescriptorButton.setDisableOnClick(true);
  return addDescriptorButton;
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Create Edit button.<br>
 * Delegate the call to the media Editor to openMediaEditor {@link MediaEditorPresenter#start(InputStream)}.
 */
private Button createEditButton() {
  Button editButton = new Button(getCaption(editFileCaption, null), createEditButtonListener());
  editButton.setDisableOnClick(true);
  editButton.addStyleName("edit");
  return editButton;
}

代码示例来源:origin: org.opencms/opencms-core

m_messages.key(Messages.GUI_ADD_DESCRIPTOR_0));
addDescriptorButton.setDisableOnClick(true);

代码示例来源:origin: apache/ace

private Button createRegisterTargetsButton() {
  final Button button = new Button("R");
  button.setDisableOnClick(true);
  button.setImmediate(true);
  button.setEnabled(false);
  button.addListener(new Button.ClickListener() {
    @Override
    public void buttonClick(ClickEvent event) {
      m_targetsPanel.registerSelectedTargets();
    }
  });
  m_targetsPanel.addListener(new ValueChangeListener() {
    @Override
    public void valueChange(ValueChangeEvent event) {
      TargetsPanel targetsPanel = (TargetsPanel) event.getProperty();
      Collection<?> itemIDs = (Collection<?>) targetsPanel.getValue();
      boolean enabled = false;
      for (Object itemID : itemIDs) {
        if (targetsPanel.isItemRegistrationNeeded(itemID)) {
          enabled = true;
          break;
        }
      }
      button.setEnabled(enabled);
    }
  });
  return button;
}

代码示例来源:origin: apache/ace

button.setDisableOnClick(true);
button.setImmediate(true);
button.setEnabled(false);

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

confirmButton.setDisableOnClick(true);
cancelButton.setDisableOnClick(true);

代码示例来源:origin: apache/ace

/**
 * Creates a remove-item button for the given repository object.
 * 
 * @param object
 *            the object to create a remove-item button, cannot be <code>null</code>;
 * @param displayName
 *            the display name for the description of the button, cannot be <code>null</code>.
 * @return a remove-item button, never <code>null</code>.
 */
protected final Button createRemoveItemButton(RepositoryObject object, String displayName) {
  Button result = new Button();
  result.setIcon(createIconResource("trash"));
  result.setData(object.getDefinition());
  result.setStyleName("small tiny");
  result.setDescription("Delete " + displayName);
  result.setDisableOnClick(true);
  result.addListener(new Button.ClickListener() {
    public void buttonClick(Button.ClickEvent event) {
      try {
        handleItemRemoveObject(event.getButton().getData());
      }
      catch (Exception e) {
        // ACE-246: notify user when the removal failed!
        getWindow().showNotification("Failed to remove item!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
      }
    }
  });
  return result;
}

代码示例来源:origin: apache/ace

/**
 * Creates a remove-link button for the given repository object.
 * 
 * @param object
 *            the object to create a remove-link button, cannot be <code>null</code>;
 * @param displayName
 *            the display name for the description of the button, cannot be <code>null</code>.
 * @return a remove-link button, never <code>null</code>.
 */
protected final Button createRemoveLinkButton(RepositoryObject object, String displayName) {
  Button result = new Button();
  result.setIcon(createIconResource("unlink"));
  result.setStyleName("small tiny");
  result.setData(object.getDefinition());
  result.setDescription("Unlink " + displayName);
  // Only enable this button when actually selected...
  result.setEnabled(false);
  result.setDisableOnClick(true);
  result.addListener(new Button.ClickListener() {
    public void buttonClick(Button.ClickEvent event) {
      handleItemRemoveLink(event.getButton().getData());
    }
  });
  return result;
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Create Edit button.<br>
 * Delegate the call to the media Editor to openMediaEditor {@link MediaEditorPresenter#start(InputStream)}.
 */
private Button createEditButton() {
  Button editButton = createControlButton(deleteCaption, MagnoliaIcons.EDIT);
  editButton.addClickListener((Button.ClickListener) event -> {
    // Launch MediaEditor for this item.
    try {
      openMediaEditor();
    } catch (FileNotFoundException fnfe) {
      log.warn("could not open MediaEditor");
      uiContext.openAlert(MessageStyleTypeEnum.ERROR, "ERROR", getI18n().translate("dam.assets.uploadField.alert.couldNotOpenMediaEditor")
              + " "
              + getValue().getEditAssetAppConfiguration().getEditConfig().getMediaEditorId(),
          "ok", null);
    } finally {
      event.getButton().setEnabled(true);
    }
  });
  editButton.setDescription(getI18n().translate("field.upload.edit.file"));
  editButton.setDisableOnClick(true);
  return editButton;
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

public Notification(final MessageStyleType type) {
  layout = new CssLayout();
  layout.addStyleName("light-dialog-panel");
  layout.addStyleName("notification-dialog");
  layout.addStyleName(type.getCssClass());
  CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass());
  icon.setStyleName("dialog-icon");
  layout.addComponent(icon);
  layout.addLayoutClickListener(new LayoutClickListener() {
    @Override
    public void layoutClick(LayoutClickEvent event) {
      layout.addStyleName("notification-dialog-selected");
    }
  });
  closeButton.addStyleName("close");
  closeButton.setDisableOnClick(true);
  closeButton.setHtmlContentAllowed(true);
  closeButton.setCaption("<span class=\"m-closebutton icon-close m-closebutton-dialog\"></span>");
  closeButton.focus();
  layout.addComponent(closeButton);
}

代码示例来源:origin: fi.vm.sade.organisaatio/organisaatio-ui-widgets

selectButton.setDisableOnClick(true);
popup = new OrganisaatioPopup(organisaatioProxy);
popup.getTree().addListener(this);

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin

login.setDisableOnClick(true);
login.addClickListener(new Button.ClickListener() {
  private static final long serialVersionUID = 1L;

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

editButton.setDisableOnClick(true);
editButton.addClickListener(createEditButtonListener());

相关文章