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


Java Button.addStyleName方法代码示例

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


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

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

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

示例6: selectTab

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

    for (Button b : buttons) {
        b.removeStyleName(SELECTED);
    }

    if (button.getStyleName().contains(SELECTED)) {
        button.removeStyleName(SELECTED);
    } else {
        button.addStyleName(SELECTED);
    }
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:14,代码来源:Tabs.java

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

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

示例9: addHeaderAndButtons

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private void addHeaderAndButtons() {
	HorizontalLayout topLayout = new HorizontalLayout();
	topLayout.setWidth("80%");

	Label header = new Label("Message Console");
	header.addStyleName(ValoTheme.LABEL_H2);

	Button showButton = new Button("");
	showButton.setCaption("Show");
	showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
	showButton.addClickListener(click -> {
		System.out.println("[x] Show button clicked ...");
		dataGrid.setItems();
	});

	Button sendButton = new Button("");
	sendButton.setCaption("Send");
	sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	sendButton.setIcon(VaadinIcons.PLUS);

	sendButton.addClickListener(click -> {
		System.out.println("[x] Send button clicked ...");

		Runnable runner = new Runnable() {
			@Override
			public void run() {
				sender.send();
			}
		};

		new Thread(runner).start();
	});

	topLayout.addComponent(header);
	topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
	topLayout.addComponent(showButton);
	topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
	topLayout.addComponent(sendButton);
	topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);

	addComponent(topLayout);
}
 
开发者ID:MikeQin,项目名称:spring-boot-vaadin-rabbitmq-pipeline-demo,代码行数:44,代码来源:DemoView.java

示例10: addHeaderAndButtons

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private void addHeaderAndButtons() {
	HorizontalLayout topLayout = new HorizontalLayout();
	topLayout.setWidth("80%");

	Label header = new Label("Streaming Console");
	header.addStyleName(ValoTheme.LABEL_H2);

	Button showButton = new Button("");
	showButton.setCaption("Stream");
	showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
	showButton.addClickListener(click -> {
		System.out.println("[x] Show button clicked ...");
		// Start the data feed thread
		new FeederThread().start();	
	});

	Button sendButton = new Button("");
	sendButton.setCaption("Send");
	sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	sendButton.setIcon(VaadinIcons.PLUS);
	sendButton.addClickListener(click -> {
		
		Runnable r = new Runnable() {
			@Override
			public void run() {
				System.out.println("[x] Send button clicked ...");
				sender.stream();
			}
		};

		new Thread(r).start();
	});

	topLayout.addComponent(header);
	topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
	topLayout.addComponent(showButton);
	topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
	topLayout.addComponent(sendButton);
	topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);

	addComponent(topLayout);
}
 
开发者ID:MikeQin,项目名称:spring-boot-vaadin-rabbitmq-pipeline-demo,代码行数:44,代码来源:StreamView.java

示例11: getTableItemsSelectionButton

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button getTableItemsSelectionButton(String text) {
    Button itemsSelectionButton = new Button(text);
    itemsSelectionButton.addStyleName(ValoTheme.BUTTON_LINK);
    itemsSelectionButton.addStyleName(StyleConstants.LINK_BUTTON);
    return itemsSelectionButton;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:7,代码来源:BaseSecurityGroupWindow.java

示例12: addVoltronCommandsControls

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private void addVoltronCommandsControls() {
  serverControls = new GridLayout();
  serverControls.setWidth(50, Unit.PERCENTAGE);
  voltronControlLayout.addComponentsAndExpand(serverControls);

  HorizontalLayout row1 = new HorizontalLayout();

  Button clusterStartBtn = new Button();
  clusterStartBtn.setCaption("Start all servers");
  clusterStartBtn.addStyleName("align-bottom");
  clusterStartBtn.addClickListener(event -> {
    for (Component child : serverControls) {
      if (child instanceof Button && "START".equals(child.getCaption()) && child.isEnabled()) {
        ((Button) child).click();
      }
    }
  });
  row1.addComponents(clusterStartBtn);

  if (kitAwareClassLoaderDelegator.isEEKit()) {
    clusterNameTF = new TextField();
    clusterNameTF.setCaption("Cluster name");
    clusterNameTF.setValue("MyCluster");

    Button clusterConfigBtn = new Button();
    clusterConfigBtn.addStyleName("align-bottom");
    clusterConfigBtn.setCaption("Configure");
    clusterConfigBtn.setData("configure");
    clusterConfigBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);

    Button clusterReConfigBtn = new Button();
    clusterReConfigBtn.addStyleName("align-bottom");
    clusterReConfigBtn.setCaption("Reconfigure");
    clusterReConfigBtn.setData("reconfigure");
    clusterReConfigBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);

    Button clusterBackupBtn = new Button();
    clusterBackupBtn.addStyleName("align-bottom");
    clusterBackupBtn.setCaption("Backup");
    clusterBackupBtn.setData("backup");
    clusterBackupBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);

    Button clusterDumpBtn = new Button();
    clusterDumpBtn.addStyleName("align-bottom");
    clusterDumpBtn.setCaption("Dump");
    clusterDumpBtn.setData("dump");
    clusterDumpBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);

    Button clusterStopBtn = new Button();
    clusterStopBtn.addStyleName("align-bottom");
    clusterStopBtn.setCaption("Stop cluster");
    clusterStopBtn.setData("stop");
    clusterStopBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);

    row1.addComponents(clusterNameTF, clusterConfigBtn, clusterReConfigBtn, clusterBackupBtn, clusterDumpBtn, clusterStopBtn);
  }

  voltronControlLayout.addComponentsAndExpand(row1);

  consoles = new TabSheet();
  mainConsole = addConsole("Main", "main");
  voltronControlLayout.addComponentsAndExpand(consoles);
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:64,代码来源:TinyPounderMainUI.java

示例13: createNextButton

import com.vaadin.ui.Button; //导入方法依赖的package包/类
/**
 * Create a new next button.
 *
 * @return The next button
 */
protected Button createNextButton() {
  Button button = new Button("Next");
  button.addStyleName(ValoTheme.BUTTON_PRIMARY);
  return button;
}
 
开发者ID:Juchar,项目名称:md-stepper,代码行数:11,代码来源:Step.java


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