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


Java Button.setStyleName方法代码示例

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


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

示例1: enter

import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    addComponent(new HeadingLabel("ログアウト確認", VaadinIcons.INFO_CIRCLE));
    addComponent(new Label("ログアウトします。"));

    HorizontalLayout buttonArea = new HorizontalLayout();
    buttonArea.setSpacing(true);
    addComponent(buttonArea);
    setComponentAlignment(buttonArea, Alignment.MIDDLE_CENTER);

    Button cancelButton = new Button("キャンセル", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
    buttonArea.addComponent(cancelButton);

    Button logoutButton = new Button("ログアウト", click -> {
        membershipService.logout();
        getUI().getNavigator().navigateTo(FrontView.VIEW_NAME);
    });
    logoutButton.setIcon(VaadinIcons.SIGN_OUT);
    logoutButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonArea.addComponent(logoutButton);
}
 
开发者ID:JavaTrainingCourse,项目名称:obog-manager,代码行数:22,代码来源:LogoutConfirmView.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: createHeader

import com.vaadin.ui.Button; //导入方法依赖的package包/类
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
    HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
    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) {
            populateTable();
        }
    });
    header.addComponent(refresh);
    return header;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:17,代码来源:CRUDBaseSubView.java

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

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

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

示例7: buildMainLayout

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Component buildMainLayout() {
    // top-level component properties
    setWidth("100.0%");
    setHeight("-1px");
    setStyleName(StyleConstants.PAGE_INFO_COMPONENT_COMMON);

    // infoLabel
    this.titleLabel = new Label();
    initializeLabel(this.titleLabel);

    final Button collapseButton = new Button();
    collapseButton.setStyleName(Reindeer.BUTTON_LINK);
    collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
    collapseButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            PageInformationComponent.this.contentLabel.setVisible(!PageInformationComponent.this.contentLabel
                    .isVisible());
            if (PageInformationComponent.this.contentLabel.isVisible()) {
                collapseButton.setIcon(new ThemeResource(StyleConstants.COLLAPSE_IMAGE));
            } else {
                collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
            }
        }
    });

    HorizontalLayout titleLayout = new HorizontalLayout();
    initializeLayout(titleLayout);
    titleLayout.setStyleName(StyleConstants.PAGE_INFO_TITLE_LAYOUT);

    titleLayout.addComponent(this.titleLabel);
    titleLayout.addComponent(collapseButton);
    titleLayout.setExpandRatio(this.titleLabel, 1.0f);

    this.contentLabel = new Label();
    initializeLabel(this.contentLabel);
    this.contentLabel.setVisible(false);

    this.contentLabel.setStyleName(StyleConstants.PAGE_INFO_CONTENT_LABEL);
    this.contentLabel.setContentMode(ContentMode.HTML);

    VerticalLayout mainLayout = new VerticalLayout();
    initializeLayout(mainLayout);
    mainLayout.addComponent(titleLayout);
    mainLayout.addComponent(this.contentLabel);

    return mainLayout;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:50,代码来源:PageInformationComponent.java

示例8: buildHeader

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private void buildHeader() {
    this.header.addStyleName("branding");
    this.header.addStyleName("header");

    // product name and information
    Label product = new Label(this.server.getProductName() + "<br> <span class='product-version'> Version: "
            + this.server.getVersionStr() + "</span>", ContentMode.HTML);
    product.addStyleName("product-label");
    product.setSizeUndefined();

    HorizontalLayout brandingLayout = new HorizontalLayout();
    brandingLayout.addStyleName("header-content");
    brandingLayout.addComponent(new Image(null, new ThemeResource("img/logo.png")));
    brandingLayout.addComponent(product);

    // creating home help button
    Button mainHelpButton = new Button();
    mainHelpButton.setImmediate(true);
    mainHelpButton.setStyleName(Reindeer.BUTTON_LINK);
    mainHelpButton.setDescription("Help");
    mainHelpButton.setIcon(new ThemeResource("img/headerHelp.png"));
    mainHelpButton.addClickListener(new ClickListener() {

        private String guid = "";

        @Override
        public void buttonClick(ClickEvent event) {
            ViewUtil.showHelpBrowserWindow(this.guid);
        }

    });

    HorizontalLayout helpLayout = new HorizontalLayout();
    helpLayout.addComponent(mainHelpButton);
    helpLayout.addStyleName("homeHelpButton");

    // Adding current user to header
    Label user = new Label("User: " + getCurrent().getSession().getAttribute("user").toString());
    // header banner
    HorizontalLayout userlayout = new HorizontalLayout();
    userlayout.addStyleName("user");
    userlayout.addComponent(user);
    // create Logout button next to user
    userlayout.addComponent(buildLogout());
    // Adding help button to the user layout next to logout button
    userlayout.addComponent(helpLayout);

    this.header.setWidth("100%");
    this.header.setHeight("65px");
    this.header.addComponent(brandingLayout);
    this.header.addComponent(userlayout);
    this.header.setExpandRatio(brandingLayout, 1);
    this.root.addComponent(this.header);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:55,代码来源:MainUI.java

示例9: updateServerControls

import com.vaadin.ui.Button; //导入方法依赖的package包/类
private void updateServerControls() {
  int nStripes = serverGrid.getRows() - 1;
  int nServersPerStripe = serverGrid.getColumns() - 1;

  serverControls.removeAllComponents();
  serverControls.setRows(nStripes * nServersPerStripe);
  serverControls.setColumns(5);

  for (int i = consoles.getComponentCount() - 1; i > 0; i--) {
    consoles.removeTab(consoles.getTab(i));
  }

  for (int stripeId = 1; stripeId < serverGrid.getRows(); stripeId++) {
    String stripeName = "stripe-" + stripeId;

    for (int serverId = 1; serverId < serverGrid.getColumns(); serverId++) {
      FormLayout form = (FormLayout) serverGrid.getComponent(serverId, stripeId);
      if (form != null) {
        TextField serverNameTF = (TextField) form.getComponent(0);
        String serverName = serverNameTF.getValue();
        serverControls.addComponent(new Label(serverName));

        Button startBT = new Button();
        startBT.setCaption("START");
        startBT.setData(serverName);
        startBT.setStyleName("align-top");
        serverControls.addComponent(startBT);

        Button stopBT = new Button();
        stopBT.setEnabled(false);
        stopBT.setCaption("STOP");
        stopBT.setStyleName("align-top");
        stopBT.setData(serverName);
        serverControls.addComponent(stopBT);

        Label pid = new Label();
        serverControls.addComponent(pid);

        Label state = new Label();
        serverControls.addComponent(state);

        addConsole(serverName, stripeName + "-" + serverName);

        startBT.addClickListener((Button.ClickListener) event -> {
          startServer(stripeName, (String) event.getButton().getData(), startBT, stopBT, state, pid);
        });
        stopBT.addClickListener((Button.ClickListener) event -> {
          stopServer(stripeName, (String) event.getButton().getData(), stopBT);
        });
      }
    }
  }
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:54,代码来源:TinyPounderMainUI.java


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