當前位置: 首頁>>代碼示例>>Java>>正文


Java Button.addClickListener方法代碼示例

本文整理匯總了Java中com.vaadin.ui.Button.addClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.addClickListener方法的具體用法?Java Button.addClickListener怎麽用?Java Button.addClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.Button的用法示例。


在下文中一共展示了Button.addClickListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTestComponent

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {

    CheckBoxGroup field = new CheckBoxGroup();

    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,代碼來源:CheckBoxGroupUI.java

示例2: 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

示例3: getTestComponent

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {
    CheckBoxMultiGroup<String> field = new CheckBoxMultiGroup<>();

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

    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,代碼來源:CheckBoxMultiGroupUI.java

示例4: 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

示例5: getTestComponent

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {

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

    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,代碼來源:CheckBoxMultiGroupRequiredUI.java

示例6: init

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest vaadinRequest) {
	final VerticalLayout layout = new VerticalLayout();

	final TextField name = new TextField();
	name.setCaption("Type your name here:");

	Button button = new Button("Click Me");
	button.addClickListener(e -> {
		layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
	});

	layout.addComponents(name, button);

	setContent(layout);
}
 
開發者ID:peterl1084,項目名稱:vaadin-karaf,代碼行數:17,代碼來源:MyUI.java

示例7: getTestComponent

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {

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

    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,代碼來源:NativeSelectGroupRequiredUI.java

示例8: 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

示例9: createNavigationButton

import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Button createNavigationButton(String caption, final String viewName) {
    Button button = new Button(caption);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    // If you didn't choose Java 8 when creating the project, convert this
    // to an anonymous listener class
    button.addClickListener(event -> getUI().getNavigator().navigateTo(viewName));
    return button;
}
 
開發者ID:MikeQin,項目名稱:spring-boot-vaadin-rabbitmq-pipeline-demo,代碼行數:9,代碼來源:NavigatorUI.java

示例10: ScrollableDialog

import com.vaadin.ui.Button; //導入方法依賴的package包/類
public ScrollableDialog(String title, boolean lightTheme) {
    super(title);
    setPrimaryStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK);
    addStyleName(Styles.Windows.SCROLLABLE);

    scrollableLayout = new FlexLayout(FlexLayout.FlexDirection.COLUMN);
    scrollableLayout.setOverflow(FlexLayout.Overflow.AUTO);
    scrollableLayout.addStyleName(Paddings.Horizontal.LARGE);
    scrollableLayout.addStyleName(FlexItem.FlexGrow.GROW_1);

    // 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.addStyleName(lightTheme ? Borders.Light.TOP : Borders.Dark.TOP);
    footer.setWidth(100, Sizeable.Unit.PERCENTAGE);

    // Content wrapper
    content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, scrollableLayout, footer);
    content.addStyleName(MaxHeights.MH_FULL);
    setContent(content);
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:31,代碼來源:ScrollableDialog.java

示例11: createHeader

import com.vaadin.ui.Button; //導入方法依賴的package包/類
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title, final boolean isChildTable) {

    HorizontalLayout header = null;
    if (isChildTable) {
        header = ViewUtil.createSubHeader(title, getChildHelpGuid());
    } else {
        header = ViewUtil.createSubHeader(title, getParentHelpGuid());
    }

    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isChildTable) {
                populateChildTable(getParentItem());
            } else {
                populateParentTable();
            }
        }
    });
    header.addComponent(refresh);
    return header;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:28,代碼來源:CRUDBaseView.java

示例12: createHeaderForSslList

import com.vaadin.ui.Button; //導入方法依賴的package包/類
private HorizontalLayout createHeaderForSslList() {
    HorizontalLayout header = ViewUtil.createSubHeader("List of available certificates", null);

    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener((Button.ClickListener) event -> buildSslConfigurationTable());
    header.addComponent(refresh);
    return header;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:12,代碼來源:SslConfigurationLayout.java

示例13: createSubHeader

import com.vaadin.ui.Button; //導入方法依賴的package包/類
/**
 * @param caption
 *            Caption Text Representing Header
 * @param guid
 *            Help GUID for caller view
 * @return
 *         Horizontal Layout containing Caption text and Help button
 */
public static HorizontalLayout createSubHeader(String caption, String guid) {

    HorizontalLayout subHeader = new HorizontalLayout();
    subHeader.setWidth("100%");
    subHeader.setHeight("35px");
    subHeader.setSpacing(true);
    subHeader.addStyleName("toolbar");
    final Label title = new Label(caption);
    title.setSizeUndefined();
    subHeader.addComponent(title);
    subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    subHeader.setExpandRatio(title, 1);

    // create help button if we have some GUID else do not add this button
    if (guid != null) {

        Button helpButton = new Button();
        helpButton.setImmediate(true);
        helpButton.setStyleName(Reindeer.BUTTON_LINK);
        helpButton.setDescription("Help");
        helpButton.setIcon(new ThemeResource("img/Help.png"));
        subHeader.addComponent(helpButton);
        helpButton.addClickListener(new HelpButtonListener(guid));
    }

    return subHeader;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:36,代碼來源:ViewUtil.java

示例14: 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("Add ErrorMessage");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.getField().setComponentError(new ErrorMessage() {
            @Override
            public ErrorLevel getErrorLevel() {
                return ErrorLevel.ERROR;
            }

            @Override
            public String getFormattedHtmlMessage() {
                return "<strong>ERROR HERE</strong>";
            }
        });
    });

    Button action2 = new Button("Remove ErrorMessage");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.getField().setComponentError(null);
    });

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

    return layout;
}
 
開發者ID:knoobie,項目名稱:bootstrap-formgroup,代碼行數:36,代碼來源:FormGroupTextFieldErrorMessageUI.java

示例15: addTab

import com.vaadin.ui.Button; //導入方法依賴的package包/類
public Button addTab(MaterialIcons icon) {
    Button button = new Button();
    button.setPrimaryStyleName(lightTheme ? Styles.Tabs.Icon.LIGHT : Styles.Tabs.Icon.DARK);
    button.setIcon(icon);
    button.addClickListener(event -> selectTab(button));
    buttons.add(button);
    addComponent(button);
    return button;
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:10,代碼來源:Tabs.java


注:本文中的com.vaadin.ui.Button.addClickListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。