当前位置: 首页>>代码示例>>Java>>正文


Java Button类代码示例

本文整理汇总了Java中com.vaadin.ui.Button的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Button类属于com.vaadin.ui包,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SimplyAsAnImageOrIcon

import com.vaadin.ui.Button; //导入依赖的package包/类
public SimplyAsAnImageOrIcon() {
    setCaption("Image and icon");
    addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth());
    Image image = new Image(null, new ClassResource("/pull.svg"));
    image.setWidth("300px");
    addComponent(image);
    
    addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth());
    
    Button button = new Button();
    button.setIcon(new ClassResource("/vaadin-logo.svg"));
    button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE);
    addComponent(button);
}
 
开发者ID:mstahv,项目名称:svgexamples,代码行数:15,代码来源:SimplyAsAnImageOrIcon.java

示例2: enter

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    if (!isLoggedIn()) {
        getUI().getNavigator().navigateTo(LoginView.VIEW_NAME);
        return;
    }
    addComponent(new HeadingLabel("会員名簿", VaadinIcons.BULLETS));

    printAllMembers();

    Button homeButton = new Button("会員メニュー", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
    homeButton.setIcon(VaadinIcons.USER);
    addComponent(homeButton);
    setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
 
开发者ID:JavaTrainingCourse,项目名称:obog-manager,代码行数:16,代码来源:MemberListView.java

示例3: enter

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    addComponent(new HeadingLabel("参加登録完了", VaadinIcons.CHECK));
    addComponent(new Label("参加登録が完了し、確認メールを送信しました。"));
    Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。");
    addressLabel.setCaption("お願い");
    addressLabel.setIcon(VaadinIcons.LIGHTBULB);
    addComponent(addressLabel);
    Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
    homeButton.setIcon(VaadinIcons.HOME);
    addComponent(homeButton);
    setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
 
开发者ID:JavaTrainingCourse,项目名称:obog-manager,代码行数:14,代码来源:ThanksView.java

示例4: enter

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    addComponent(new HeadingLabel("パスワードリセット要求送信完了", VaadinIcons.INFO_CIRCLE));
    addComponent(new Label("入力された E-mail アドレスへパスワードリセットの案内メールを送信しました。"));
    Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。");
    addressLabel.setCaption("お願い");
    addressLabel.setIcon(VaadinIcons.LIGHTBULB);
    addComponent(addressLabel);
    Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
    homeButton.setIcon(VaadinIcons.HOME);
    addComponent(homeButton);
    setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
 
开发者ID:JavaTrainingCourse,项目名称:obog-manager,代码行数:14,代码来源:TokenSentView.java

示例5: buildActions

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
	actionsContainer.setSpacing(true);
	// yes
	final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
			.caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE)
					.messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build())
			.onClick(e -> onDialogYesButtonClick(e.getButton())).build();
	getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes)));
	actionsContainer.addComponent(btnYes);
	actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT);
	if (getWidth() > -1) {
		btnYes.setWidth("100%");
	}
	// no
	final Button btnNo = Components.button()
			.caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE)
					.messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build())
			.onClick(e -> onDialogNoButtonClick(e.getButton())).build();
	getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo)));
	actionsContainer.addComponent(btnNo);
	actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT);
	if (getWidth() > -1) {
		btnNo.setWidth("100%");
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:27,代码来源:QuestionDialog.java

示例6: refreshButtonBar

import com.vaadin.ui.Button; //导入依赖的package包/类
private void refreshButtonBar(Step step) {
  buttonBar.removeAllComponents();
  buttonBar.setVisible(true);

  if (step == null) {
    return;
  }

  Button backButton = step.getBackButton();
  Button cancelButton = step.getCancelButton();
  Button skipButton = step.getSkipButton();
  Button nextButton = step.getNextButton();

  backButton.setVisible(getStepIterator().hasPrevious());
  cancelButton.setVisible(step.isCancellable());
  skipButton.setVisible(step.isOptional());
  nextButton.setVisible(!isComplete());

  buttonBar.addComponent(backButton);
  Spacer.addToLayout(buttonBar);
  buttonBar.addComponent(cancelButton);
  buttonBar.addComponent(skipButton);
  buttonBar.addComponent(nextButton);
}
 
开发者ID:Juchar,项目名称:md-stepper,代码行数:25,代码来源:HorizontalStepper.java

示例7: buttonClick

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public void buttonClick(Button.ClickEvent event) {
    final String alias = (String) event.getButton().getData();
    log.info("Removing ssl entry with alias: " + alias);
    boolean succeed;

    DeleteSslEntryRequest deleteRequest = new DeleteSslEntryRequest(alias);

    try {
        SslConfigurationLayout.this.deleteSslCertificateService.dispatch(deleteRequest);
        succeed = true;
    } catch (Exception e) {
        succeed = false;
        log.error("Failed to remove SSL alias from truststore", e);
    }

    SslConfigurationLayout.this.buildSslConfigurationTable();
    SslConfigurationLayout.this.deleteWindow.close();

    String outputMessage = (succeed) ? MAINTENANCE_SSLCONFIGURATION_REMOVED : MAINTENANCE_SSLCONFIGURATION_REMOVE_FAILURE;
    ViewUtil.iscNotification(getString(outputMessage, new Date()), null, Notification.Type.TRAY_NOTIFICATION);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:23,代码来源:SslConfigurationLayout.java

示例8: updateItem

import com.vaadin.ui.Button; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void updateItem(Item item, PluginApi plugin) {

    item.getItemProperty(PROP_PLUGIN_STATE).setValue(plugin.getState().toString());
    item.getItemProperty(PROP_PLUGIN_NAME).setValue(plugin.getSymbolicName());
    item.getItemProperty(PROP_PLUGIN_VERSION).setValue(plugin.getVersion());
    item.getItemProperty(PROP_PLUGIN_SERVICES).setValue(plugin.getServiceCount());

    String info;
    if (plugin.getState() == State.ERROR) {
        info = plugin.getError();
    } else {
        info = "";
    }
    item.getItemProperty(PROP_PLUGIN_INFO).setValue(info);

    Button deleteButton = new Button("Delete");
    deleteButton.addClickListener(event -> deletePlugin(plugin));
    item.getItemProperty(PROP_PLUGIN_DELETE).setValue(deleteButton);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:21,代码来源:PluginsLayout.java

示例9: createDownloadButton

import com.vaadin.ui.Button; //导入依赖的package包/类
@SuppressWarnings("serial")
private Button createDownloadButton() {
    this.download = new Button(VmidcMessages.getString(VmidcMessages_.SUMMARY_DOWNLOAD_LOG)) {
        @Override
        public void setEnabled(boolean enabled) {
            if (enabled) {
                // because setEnabled(false) calls are ignored and button is disabled
                // on client because of setDisableOnClick(true), by doing this we
                // make sure that the button is actually disabled so that setEnabled(true)
                // has effect
                getUI().getConnectorTracker().getDiffState(this).put("enabled", false);
                super.setEnabled(enabled);
            }
        }
    };
    SummaryLayout.this.download.setDisableOnClick(true);
    if (this.checkbox != null && this.checkbox.getValue()) {
        this.download.setCaption(VmidcMessages.getString(VmidcMessages_.SUMMARY_DOWNLOAD_BUNDLE));
    }
    StreamResource zipStream = getZipStream();
    FileDownloader fileDownloader = new FileDownloader(zipStream);
    fileDownloader.extend(this.download);
    return this.download;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:25,代码来源:SummaryLayout.java

示例10: createIPSettingsEditButton

import com.vaadin.ui.Button; //导入依赖的package包/类
@SuppressWarnings("serial")
private Button createIPSettingsEditButton() {
    // creating edit button
    this.editIPSettings = new Button("Edit");
    this.editIPSettings.setEnabled(true);
    this.editIPSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editIPSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editIPSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing IP settings", e);
            }
        }
    });
    return this.editIPSettings;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:19,代码来源:NetworkLayout.java

示例11: createNATEditButton

import com.vaadin.ui.Button; //导入依赖的package包/类
@SuppressWarnings("serial")
private Button createNATEditButton() {
    // creating edit button
    this.editNATSettings = new Button("Edit");
    this.editNATSettings.setEnabled(true);
    this.editNATSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editNATSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editNATSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing NAT settings", e);
            }
        }
    });
    return this.editNATSettings;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:19,代码来源:NetworkLayout.java

示例12: getTestComponent

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public Component getTestComponent() {

    TextFieldGroup field = new TextFieldGroup();

    field.setCaption("Caption");
    field.setDescription("Description");

    Button action1 = new Button("Change Mode to Danger");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.setMode(BootstrapMode.DANGER);
    });

    Button action2 = new Button("Remove Mode");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.removeMode();
    });

    MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
    layout.addComponent(field, "field");

    return layout;
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:26,代码来源:FormGroupTextFieldUI.java

示例13: getTestComponent

import com.vaadin.ui.Button; //导入依赖的package包/类
@Override
public Component getTestComponent() {

    ComboBoxGroup<String> field = new ComboBoxGroup<>();

    field.setCaption("Caption");
    field.setDescription("Description");
    field.getField().setItems("1", "2", "3");

    Button action1 = new Button("add required");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.setRequired(true);
    });

    Button action2 = new Button("remove Required");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.setRequired(false);
    });

    MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
    layout.addComponent(field, "field");

    return layout;
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:27,代码来源:FormGroupComboBoxRequiredUI.java

示例14: selectToggleButton

import com.vaadin.ui.Button; //导入依赖的package包/类
public void selectToggleButton(Button button) {
    if (!buttons.contains(button)) return;

    if (this.mode == SelectionMode.SINGLE) {
        for (Button b : buttons) {
            b.removeStyleName(ACTIVE);
        }
    }

    if (button.getStyleName().contains(ACTIVE)) {
        button.removeStyleName(ACTIVE);
    } else {
        button.addStyleName(ACTIVE);
    }

    for (Button btn : buttons) {
        if (btn.getStyleName().contains(ACTIVE)) {
            addStyleName("card");
            return;
        }
        removeStyleName("card");
    }
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:24,代码来源:ToggleButtonGroup.java

示例15: SimpleDialog

import com.vaadin.ui.Button; //导入依赖的package包/类
public SimpleDialog(String title, String message, boolean lightTheme) {
    super(title);
    addStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK);

    label = new Label(message);
    label.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.SECONDARY : Typography.Light.Subheader.SECONDARY);
    label.addStyleName(Paddings.Horizontal.LARGE + " " + Paddings.Bottom.LARGE);

    // Footer
    cancel = new Button("Cancel");
    cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
    cancel.addClickListener(e -> close());

    ok = new Button("OK");
    ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
    ok.addClickListener(e -> close());

    footer = new FlexLayout(cancel, ok);
    footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END);
    footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0);
    footer.setWidth(100, Unit.PERCENTAGE);

    // Content wrapper
    content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, label, footer);
    setContent(content);
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:27,代码来源:SimpleDialog.java


注:本文中的com.vaadin.ui.Button类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。