Example usage for com.vaadin.ui Button setStyleName

List of usage examples for com.vaadin.ui Button setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateLayout.java

License:Apache License

private Button createCancelBtn() {
    Button button = new Button();
    button.addClickListener(new Button.ClickListener() {
        @Override//from  w w w  .  j  ava  2  s.c  o  m
        public void buttonClick(final Button.ClickEvent event) {
            uploadStatePanel.interruptUpload(fileDetailBean);
        }
    });
    button.setIcon(uploadStatePanel.getWindow().getCancelIconResource());
    button.setStyleName("small");
    button.setCaption(uploadStatePanel.getWindow().getCancelButtonCaption());
    return button;
}

From source file:cz.zcu.pia.social.network.frontend.components.login.ComponentLogin.java

/**
 * Creates register button//from ww  w  . j a v  a  2s  .  c  o m
 * @return register button
 */
private Button createRegisterButton() {
    Button register = new Button(msgs.getMessage(INFO_REGISTER));
    register.setStyleName(STYLE_BUTTON_LABEL);
    register.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {

            ((MyUI) UI.getCurrent().getUI()).getNavigator().navigateTo(ViewRegister.NAME);
        }
    });

    return register;
}

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPostPaginator.java

/**
 * Add buttons, based on number of pages
 *
 * @param numberOfPages number Of Pages// w w w  .j a  va  2  s .co  m
 */
public void addButtons(int numberOfPages) {
    this.removeAllComponents();
    buttonList.clear();
    for (int i = 0; i <= numberOfPages; i++) {
        Button b = new Button("" + i);
        b.setData(i);
        b.setStyleName("button-paginator button-label-simple");
        b.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                int page = (int) event.getButton().getData();
                if (curentPage != page) {
                    filterReference.setPageAndReload(page);
                    removeActiveStyle();
                    curentPage = page;
                    buttonList.get(curentPage).addStyleName("paginator-active");
                }
            }

        });
        if (i == 0) {
            b.addStyleName("paginator-active");
        }
        buttonList.add(b);
        this.addComponent(b);
    }

}

From source file:de.catma.ui.CatmaApplication.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    backgroundService = new UIBackgroundService(true);

    storeParameters(request.getParameterMap());

    Page.getCurrent().setTitle("CATMA 5.0 " + MINORVERSION);

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();//from ww  w . j  a va 2 s .  c om

    menuPanel = new Panel();
    menuPanel.addStyleName("menuPanel");
    mainLayout.addComponent(menuPanel);

    contentPanel = new Panel();
    contentPanel.setHeight("100%");
    contentPanel.addStyleName("contentPanel");

    defaultContentPanelLabel = new Label("Please log in to get started");
    defaultContentPanelLabel.addStyleName("defaultContentPanelLabel");
    contentPanel.setContent(defaultContentPanelLabel);

    mainLayout.addComponent(contentPanel);
    mainLayout.setExpandRatio(contentPanel, 1.0f);

    menuLayout = new HorizontalLayout();
    menuLayout.setMargin(true);
    menuLayout.setSpacing(true);

    logoResource = new ThemeResource("catma-logo.png");
    Link logoImage = new Link(null, new ExternalResource("http://www.catma.de"));
    logoImage.setIcon(logoResource);
    logoImage.setTargetName("_blank");
    menuLayout.addComponent(logoImage);

    MenuFactory menuFactory = new MenuFactory();
    try {

        initTempDirectory();
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(
                new RepositoryManager(this, tagManager, RepositoryProperties.INSTANCE.getProperties()));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        menu = menuFactory.createMenu(menuLayout, contentPanel,
                new MenuFactory.MenuEntryDefinition("Repository Manager", repositoryManagerView),
                new MenuFactory.MenuEntryDefinition("Tag Type Manager", tagManagerView),
                new MenuFactory.MenuEntryDefinition("Tagger", taggerManagerView),
                new MenuFactory.MenuEntryDefinition("Analyzer", analyzerManagerView),
                new MenuFactory.MenuEntryDefinition("Visualizer", visualizationManagerView));
        addPropertyChangeListener(CatmaApplicationEvent.userChange, menu.userChangeListener);

        Link latestFeaturesLink = new Link("Latest Features",
                new ExternalResource("http://www.catma.de/latestfeatures"));
        latestFeaturesLink.setTargetName("_blank");
        menuLayout.addComponent(latestFeaturesLink);
        menuLayout.setComponentAlignment(latestFeaturesLink, Alignment.TOP_RIGHT);
        menuLayout.setExpandRatio(latestFeaturesLink, 1.0f);

        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        menuLayout.addComponent(aboutLink);
        menuLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);

        Link termsOfUseLink = new Link("Terms of Use", new ExternalResource("http://www.catma.de/termsofuse"));
        termsOfUseLink.setTargetName("_blank");
        menuLayout.addComponent(termsOfUseLink);
        menuLayout.setComponentAlignment(termsOfUseLink, Alignment.TOP_RIGHT);

        Link manualLink = new Link("Manual", new ExternalResource(request.getContextPath() + "/manual/"));
        manualLink.setTargetName("_blank");
        menuLayout.addComponent(manualLink);
        menuLayout.setComponentAlignment(manualLink, Alignment.TOP_RIGHT);

        Link helpLink = new Link("Helpdesk", new ExternalResource("http://www.catma.de/helpdesk/"));
        helpLink.setTargetName("_blank");
        menuLayout.addComponent(helpLink);
        menuLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);
        helpLink.setVisible(false);

        btHelp = new Button(FontAwesome.QUESTION_CIRCLE);
        btHelp.addStyleName("help-button");
        btHelp.addStyleName("application-help-button");

        menuLayout.addComponent(btHelp);

        btHelp.addClickListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {

                if (uiHelpWindow.getParent() == null) {
                    UI.getCurrent().addWindow(uiHelpWindow);
                } else {
                    UI.getCurrent().removeWindow(uiHelpWindow);
                }

            }
        });

        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView);
        Button btloginLogout = new Button("Sign in", event -> loginLogoutCommand.menuSelected(null));
        btloginLogout.setStyleName(BaseTheme.BUTTON_LINK);
        btloginLogout.addStyleName("application-loginlink");

        loginLogoutCommand.setLoginLogoutButton(btloginLogout);

        menuLayout.addComponent(btloginLogout);
        menuLayout.setComponentAlignment(btloginLogout, Alignment.TOP_RIGHT);
        menuLayout.setWidth("100%");

        menuPanel.setContent(menuLayout);

        setContent(mainLayout);

        if (getParameter(Parameter.USER_IDENTIFIER) != null) {
            btloginLogout.click();
        }

        setPollInterval(10000);

        if ((getParameter(Parameter.AUTOLOGIN) != null) && (getUser() == null)) {
            getPage().setLocation(repositoryManagerView.createAuthenticationDialog().createLogInClick(this,
                    RepositoryPropertyKey.CATMA_oauthAuthorizationCodeRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthAccessTokenRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientId.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientSecret.getValue(), URLEncoder.encode("/", "UTF-8")));
        }

    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addAdminDescriptorField() {
    adminDescriptorAccordion = new Accordion();
    adminDescriptorAccordion.setWidth(ViewConstants.FIELD_WIDTH);
    adminDescriptorAccordion.setSizeFull();

    final Panel accordionPanel = new Panel();
    accordionPanel.setContent(adminDescriptorAccordion);
    accordionPanel.setSizeFull();//from w w w  .  j  a va 2  s.c om
    accordionPanel.setWidth(ViewConstants.FIELD_WIDTH);

    final Button addButton = new Button(ViewConstants.ADD_LABEL);
    final Button editButton = new Button(ViewConstants.EDIT_LABEL);
    final Button delButton = new Button(ViewConstants.REMOVE_LABEL);

    addButton.setStyleName("small");
    editButton.setStyleName("small");
    delButton.setStyleName("small");

    addButton.addListener(new NewAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    editButton.addListener(new EditAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    delButton.addListener(new RemoveAdminDescriptorListener(adminDescriptorAccordion));

    panel.addComponent(LayoutHelper.create("Admin Descriptors", accordionPanel, LABEL_WIDTH + 2, 300, false,
            new Button[] { addButton, editButton, delButton }));
}

From source file:de.escidoc.admintool.view.EscidocPagedTable.java

License:Open Source License

public HorizontalLayout createControls() {
    // final Label itemsPerPageLabel = new Label("Items per page:");
    final Label pageLabel = new Label("Page:&nbsp;", Label.CONTENT_XHTML);
    final TextField currentPageTextField = new TextField();
    currentPageTextField.setValue(String.valueOf(getCurrentPage()));
    currentPageTextField.addValidator(new IntegerValidator(null));
    final Label separatorLabel = new Label("&nbsp;/&nbsp;", Label.CONTENT_XHTML);
    final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML);
    currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    currentPageTextField.setImmediate(true);
    currentPageTextField.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
            if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) {
                @SuppressWarnings("boxing")
                final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue()));
                setCurrentPage(page);//from ww  w .j  a va 2s  . co  m
            }
        }
    });
    pageLabel.setWidth(null);
    currentPageTextField.setWidth("20px");
    separatorLabel.setWidth(null);
    totalPagesLabel.setWidth(null);

    final HorizontalLayout controlBar = new HorizontalLayout();
    final HorizontalLayout pageSize = new HorizontalLayout();
    final HorizontalLayout pageManagement = new HorizontalLayout();
    final Button first = new Button("<<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            setCurrentPage(0);
        }
    });
    final Button previous = new Button("<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            previousPage();
        }
    });
    final Button next = new Button(">", new ClickListener() {
        private static final long serialVersionUID = -1927138212640638452L;

        public void buttonClick(final ClickEvent event) {
            nextPage();
        }
    });
    final Button last = new Button(">>", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            setCurrentPage(getTotalAmountOfPages());
        }
    });
    first.setStyleName(BaseTheme.BUTTON_LINK);
    previous.setStyleName(BaseTheme.BUTTON_LINK);
    next.setStyleName(BaseTheme.BUTTON_LINK);
    last.setStyleName(BaseTheme.BUTTON_LINK);

    pageLabel.addStyleName("pagedtable-pagecaption");
    currentPageTextField.addStyleName("pagedtable-pagefield");
    separatorLabel.addStyleName("pagedtable-separator");
    totalPagesLabel.addStyleName("pagedtable-total");
    first.addStyleName("pagedtable-first");
    previous.addStyleName("pagedtable-previous");
    next.addStyleName("pagedtable-next");
    last.addStyleName("pagedtable-last");

    pageLabel.addStyleName("pagedtable-label");
    currentPageTextField.addStyleName("pagedtable-label");
    separatorLabel.addStyleName("pagedtable-label");
    totalPagesLabel.addStyleName("pagedtable-label");
    first.addStyleName("pagedtable-button");
    previous.addStyleName("pagedtable-button");
    next.addStyleName("pagedtable-button");
    last.addStyleName("pagedtable-button");

    pageSize.setSpacing(true);
    pageManagement.addComponent(first);
    pageManagement.addComponent(previous);
    pageManagement.addComponent(pageLabel);
    pageManagement.addComponent(currentPageTextField);
    pageManagement.addComponent(separatorLabel);
    pageManagement.addComponent(totalPagesLabel);
    pageManagement.addComponent(next);
    pageManagement.addComponent(last);
    pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT);
    pageManagement.setWidth(null);
    pageManagement.setSpacing(true);
    controlBar.addComponent(pageSize);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER);
    controlBar.setWidth("100%");
    controlBar.setExpandRatio(pageSize, 1);
    addListener(new PageChangeListener() {
        @SuppressWarnings("boxing")
        public void pageChanged(final PagedTableChangeEvent event) {
            previous.setEnabled(true);
            next.setEnabled(true);
            currentPageTextField.setValue(String.valueOf(getCurrentPage()));
            totalPagesLabel.setValue(getTotalAmountOfPages());
        }
    });
    return controlBar;
}

From source file:de.escidoc.admintool.view.user.OrgUnitWidgetImpl.java

License:Open Source License

public VerticalLayout build() {

    final Button[] footers = new Button[] { addOrgUnitButton, removeOrgUnitButton };

    for (final Button button : footers) {
        button.setStyleName(Reindeer.BUTTON_SMALL);
    }/* w  w  w.j  a va 2s .  c  om*/
    return LayoutHelper.create("", orgUnitTable, 0, _90, false, footers);

}

From source file:de.escidoc.admintool.view.user.password.PasswordViewImpl.java

License:Open Source License

@Override
public void addOkButton(final ClickListener updatePasswordOkListener) {
    final Button saveBtn = new Button("Change Password", updatePasswordOkListener);
    saveBtn.setStyleName(Reindeer.BUTTON_SMALL);
    footers = new HorizontalLayout();
    footers.addComponent(saveBtn);//w  ww .  j av a  2s . co  m
    layout.addComponent(footers);
}

From source file:de.escidoc.admintool.view.user.password.PasswordViewImpl.java

License:Open Source License

@Override
public void addCancelButton(final ClickListener cancelListener) {
    final Button cancelBtn = new Button(ViewConstants.CANCEL_LABEL, cancelListener);
    cancelBtn.setStyleName(Reindeer.BUTTON_SMALL);
    footers.addComponent(cancelBtn);/*from   w  w  w .j  a  v  a 2s .  co  m*/
}

From source file:de.metas.procurement.webui.ui.view.DailyReportingView.java

License:Open Source License

public DailyReportingView() {
    super();// w ww.j av a2  s. c om

    addStyleName(STYLE);

    //
    // Top
    {
        final NavigationBar navigationBar = getNavigationBar();
        navigationBar.setCaption(i18n.get("DailyReportingView.caption"));

        final NavigationButton logoutButton = new NavigationButton(i18n.get("Logout.caption"));
        logoutButton.setTargetView(this);
        logoutButton.addClickListener(new NavigationButtonClickListener() {
            @Override
            public void buttonClick(final NavigationButtonClickEvent event) {
                onLogout();
            }
        });
        navigationBar.setRightComponent(logoutButton);
    }

    //
    // Content
    {
        final VerticalLayout content = new VerticalLayout();

        // Date
        {
            datePanel = new DateNavigation();
            datePanel.addDateChangedListener(new PropertyChangeListener() {

                @Override
                public void propertyChange(final PropertyChangeEvent evt) {
                    onDayChanged(datePanel.getDate());
                }
            });

            final VerticalComponentGroup datePanelGroup = new VerticalComponentGroup();
            datePanelGroup.addComponent(datePanel);
            content.addComponent(datePanelGroup);
        }

        // Product buttons
        productButtons = new BeansVerticalComponentGroup<ProductQtyReport>() {
            @Override
            protected Component createItemComponent(final BeanItem<ProductQtyReport> item) {
                final ProductItemButton itemComp = new ProductItemButton();
                itemComp.setItem(item);
                return itemComp;
            };
        };
        content.addComponent(productButtons);

        setContent(content);
    }

    //
    // Toolbar (bottom)
    {
        final Button weekViewButton = new Button(i18n.get("DailyReportingView.weekViewButton"));
        weekViewButton.setStyleName("no-decoration");
        weekViewButton.setIcon(FontAwesome.CALENDAR);
        weekViewButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onWeekView();
            }
        });

        final Button addProductButton = new Button(i18n.get("DailyReportingView.addProductButton"));
        addProductButton.setStyleName("no-decoration");
        addProductButton.setIcon(FontAwesome.PLUS);
        addProductButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onProductAdd();
            }
        });

        final Button rfqButton = new Button(i18n.get("DailyReportingView.rfqButton"));
        rfqButton.setStyleName("no-decoration");
        rfqButton.setIcon(FontAwesome.MONEY);
        rfqButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onRfQ();
            }
        });

        final ISendService sendService = MFProcurementUI.getCurrentMFSession().getSendService();
        final Button sendButton = new Button(i18n.get("DailyReportingView.sendButton"));
        sendButton.setStyleName("no-decoration");
        sendButton.setIcon(FontAwesome.CHECK);
        final TextOverlay sendButtonOverlay = TextOverlay.extend(sendButton);
        sendButtonOverlay.setPropertyDataSource(sendService.getNotSentCounterProperty());
        sendButtonOverlay.setConverter(TextOverlay.CONVERTER_PositiveCounterOrNull);
        sendButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onSend();
            }
        });

        final Button infoButton = new Button(i18n.getWithDefault("InfoMessageView.caption.short", "Info"));
        infoButton.setStyleName("no-decoration");
        infoButton.setIcon(FontAwesome.INFO);
        infoButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                onInfo();
            }
        });

        final Toolbar toolbar = new Toolbar();
        toolbar.addComponents(weekViewButton, addProductButton, sendButton, infoButton, rfqButton);
        setToolbar(toolbar);
    }

    //
    // Initialize
    final Date today = DateUtils.getToday();
    final Date date = DateUtils.addDays(today, +1); // tomorrow (FRESH-196)
    datePanel.setDate(date);
}