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


Java Button.setId方法代码示例

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


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

示例1: createMenuButton

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {

    final Button button = new Button(caption, (e) -> {
      contentLayout.removeAllComponents();
      contentLayout.addComponent(content.get());
    });
    button.setIcon(icon);
    button.addStyleName(ValoTheme.BUTTON_HUGE);
    button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button.addStyleName(ValoTheme.MENU_ITEM);
    button.setWidth("100%");

    button.setId(buttonID().apply(MainView.class, caption));

    return button;
  }
 
开发者ID:Java-Publications,项目名称:javamagazin-009-microkernel,代码行数:18,代码来源:MainView.java

示例2: buildToolbarButton

import com.vaadin.ui.Button; //导入方法依赖的package包/类
/**
 * @param toolbar
 *            HorizontalLayout which contains all the action Buttons
 * @param toolbarButton
 *            Which Tool bar button to create (Provided using ENUM constant)
 * @param listner
 *            Click listener called when this button is clicked
 * @return
 */

public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
        ClickListener listner) {
    Button button = new Button(toolbarButton.getText());
    button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    button.setDescription(toolbarButton.getTooltip());
    button.setStyleName(ValoTheme.BUTTON_LINK);
    if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
        button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
    }
    button.setEnabled(false);
    button.setId(toolbarButton.getId());
    button.addClickListener(listner);
    toolbar.addComponent(button);
    return button;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:26,代码来源:ViewUtil.java

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

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

示例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("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

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

示例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("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,代码来源:NativeSelectGroupUI.java

示例8: 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 Ratio to 12, 6, 6, 6, 6");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.setRatio(12, 6, 6, 6, 6);
    });

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

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

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

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

示例10: 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 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,代码行数:25,代码来源:FormGroupTextFieldRequiredUI.java

示例11: getTestComponent

import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
    ComboBoxGroup<String> field = new ComboBoxGroup<String>()
            .withCaption("Caption").withDescription("Description")
            .withItems("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,代码行数:24,代码来源:FormGroupComboBoxUI.java

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

示例13: createMenuButtonForNotification

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
  final Button button
      = new Button(caption,
                   (e) -> {
                     UI ui = UI.getCurrent();
                     ConfirmDialog.show(
                         ui,
                         message, // ToDo extract in Executor
                         (ConfirmDialog.Listener) dialog -> {
                           if (dialog.isConfirmed()) {
                             VaadinSession vaadinSession = ui.getSession();
                             vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
                             vaadinSession.close();
                             ui.getPage().setLocation("/");
                           }
                           else {
                             // User did not confirm
                             // CANCEL STUFF
                           }
                         });
                   });

  button.setIcon(icon);
  button.addStyleName(ValoTheme.BUTTON_HUGE);
  button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
  button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
  button.addStyleName(ValoTheme.MENU_ITEM);
  button.setWidth("100%");

  button.setId(buttonID().apply(MainView.class, caption));

  return button;

}
 
开发者ID:Java-Publications,项目名称:javamagazin-009-microkernel,代码行数:35,代码来源:MainView.java

示例14: createMenuButtonForNotification

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Pair<String, Button> createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
  final Button button
      = new Button(caption,
                   (e) -> {
                     UI ui = UI.getCurrent();
                     ConfirmDialog.show(
                         ui,
                         message, // ToDo extract in Executor
                         (ConfirmDialog.Listener) dialog -> {
                           if (dialog.isConfirmed()) {

                             getSubject().logout(); //removes all identifying information and invalidates their session too.

                             VaadinSession vaadinSession = ui.getSession();
                             vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
                             vaadinSession.close();
                             ui.getPage().setLocation("/");
                           }
                           else {
                             // User did not confirm
                             // CANCEL STUFF
                           }
                         });
                   });

  button.setIcon(icon);
  button.addStyleName(ValoTheme.BUTTON_HUGE);
  button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
  button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
  button.addStyleName(ValoTheme.MENU_ITEM);
  button.setWidth("100%");

  button.setId(buttonID().apply(MainView.class, caption));

  return new Pair<>(mapToShiroRole(caption), button);

}
 
开发者ID:Java-Publications,项目名称:vaadin-016-helloworld-14,代码行数:38,代码来源:MenuComponent.java

示例15: createMenuButton

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Pair<String, Button> createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {
  final Button button = new Button(caption, (e) -> {
    contentLayout.removeAllComponents();
    contentLayout.addComponent(content.get());
  });
  button.setIcon(icon);
  button.addStyleName(ValoTheme.BUTTON_HUGE);
  button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
  button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
  button.addStyleName(ValoTheme.MENU_ITEM);
  button.setWidth("100%");

  button.setId(buttonID().apply(this.getClass(), caption));
  return new Pair<>(mapToShiroRole(caption), button);
}
 
开发者ID:Java-Publications,项目名称:vaadin-016-helloworld-14,代码行数:16,代码来源:MenuComponent.java


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