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


Java Button.setWidth方法代码示例

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


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

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

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

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

示例4: buildLogout

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button buildLogout() {
    Button exit = new Button("Logout");
    exit.setDescription("Logout");
    exit.setWidth("100%");
    exit.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getSession().setAttribute("user", null);
            for (UI ui : getSession().getUIs()) {
                ui.close();
            }
        }
    });
    return exit;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:16,代码来源:MainUI.java

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

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