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:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private Button showShare(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_SHARE);
    edit.setIcon(new ThemeResource("images/wpzoom/share.png"));
    edit.addListener(new Button.ClickListener() {
        @Override//from   w  w w .  j a va2  s .com
        public void buttonClick(ClickEvent event) {
            controller.getRouter().getMainWindow().showNotification("Not yet Implemented " + child.getId(),
                    Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private Button showShare(Version version) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_SHARE);
    edit.setIcon(new ThemeResource("images/wpzoom/share.png"));
    edit.addListener(new Button.ClickListener() {
        @Override/*from w  w  w  .  j  a v  a2s.c  om*/
        public void buttonClick(ClickEvent event) {
            controller.getRouter().getMainWindow().showNotification("Not yet Implemented ",
                    Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private Button downloadShow(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_DOWNLOAD);
    edit.setIcon(new ThemeResource("images/wpzoom/eye.png"));
    edit.addListener(new Button.ClickListener() {
        @Override/*from   w w  w  .jav a  2  s  . c o m*/
        public void buttonClick(ClickEvent event) {
            try {
                router.getMainWindow().open(
                        new ExternalResource(buildUri(controller.getMetadata(ViewConstants.WIKIPAGEMD))),
                        "_blank");
            } catch (EscidocClientException e) {
                controller.getRouter().getMainWindow().showNotification(
                        "No content to download! Could it be that this Wiki is empty!?",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }

        }
    });
    return edit;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private Button downloadShowVersion(final Version version) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_DOWNLOAD);
    edit.setIcon(new ThemeResource("images/wpzoom/eye.png"));
    edit.addListener(new Button.ClickListener() {
        @Override//from w  ww .  j  ava 2 s .  co  m
        public void buttonClick(ClickEvent event) {

            try {
                controller.getMetadata(ViewConstants.WIKIPAGEMD);
                router.getMainWindow().open(new ExternalResource(buildUri(version.getXLinkHref()), "_blank"));

            } catch (EscidocClientException e) {
                controller.getRouter().getMainWindow().showNotification(
                        "No content to download! Could it be that this Wiki is empty!?",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }

        }
    });
    return edit;
}

From source file:org.hip.vif.admin.groupadmin.ui.AbstractContributionView.java

License:Open Source License

private Component createBibliography(final GeneralDomainObject inBibliography, final AbstractAdminTask inTask,
        final IMessages inMessages) throws VException {
    final HorizontalLayout out = new HorizontalLayout();
    out.setWidth("100%"); //$NON-NLS-1$
    out.setStyleName("vif-bibliography"); //$NON-NLS-1$

    final Long lBiblioID = BeanWrapperHelper.getLong(TextHome.KEY_ID, inBibliography);

    final Button lRemove = new Button(inMessages.getMessage("ui.bibliography.link.button.remove")); //$NON-NLS-1$
    lRemove.addClickListener(new Button.ClickListener() {
        @Override//w w  w .  j a va2 s  .c  om
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.unlinkBibliography(lBiblioID)) {
                Notification.show(inMessages.getMessage("errmsg.biblio.remove"), Type.WARNING_MESSAGE); //$NON-NLS-1$
            }
        }
    });
    out.addComponent(lRemove);

    final Button lLink = LinkButtonHelper.createLinkButton(
            BeanWrapperHelper.getString(TextHome.KEY_REFERENCE, inBibliography),
            LinkButtonHelper.LookupType.BIBLIOGRAPHY, lBiblioID, inTask);
    lLink.setStyleName(BaseTheme.BUTTON_LINK);
    out.addComponent(lLink);

    final BibliographyFormatter lFormatter = new BibliographyFormatter(
            new BibliographyAdapter(inBibliography, TextHome.KEY_BIBLIO_TYPE));
    final Label lLabel = new Label(lFormatter.renderHtml(), ContentMode.HTML);
    lLabel.setWidth("100%"); //$NON-NLS-1$
    out.addComponent(lLabel);
    out.setExpandRatio(lLabel, 1.0f);

    return out;
}

From source file:org.hip.vif.admin.groupadmin.ui.ReferencingQuestionLookup.java

License:Open Source License

/**
 * Constructor//from  w  ww  . j ava  2s.  c o  m
 * 
 * @param inQuestions
 *            ContributionContainer
 * @param inWidth
 *            int
 * @param inHeight
 *            int
 */
public ReferencingQuestionLookup(final ContributionContainer inQuestions, final int inWidth,
        final int inHeight) {
    final IMessages lMessages = Activator.getMessages();
    lookup = new Window(lMessages.getMessage("lookup.window.title.referencing")); //$NON-NLS-1$
    lookup.addStyleName("vif-lookup"); //$NON-NLS-1$
    lookup.setWidth(inWidth, Unit.PIXELS);
    lookup.setHeight(inHeight, Unit.PIXELS);

    final VerticalLayout lLayout = (VerticalLayout) lookup.getContent();
    lLayout.setStyleName("vif-lookup"); //$NON-NLS-1$
    lLayout.setMargin(true);
    lLayout.setSpacing(true);

    lLayout.addComponent(createTable(inQuestions));

    final Button lClose = new Button(lMessages.getMessage("lookup.window.button.close"), //$NON-NLS-1$
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent inEvent) {
                    lookup.close();
                }
            });
    lClose.setClickShortcut(KeyCode.ESCAPE);
    lClose.setImmediate(true);
    lClose.setStyleName("vif-lookup-close"); //$NON-NLS-1$
    lLayout.addComponent(lClose);
}

From source file:org.hip.vif.app.admin.scr.ToolbarItemLogout.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from   w w  w  . j ava  2  s  . c  om*/
public Component getComponent() {
    final HorizontalLayout out = new HorizontalLayout();
    out.setSizeUndefined();
    final Button lLogout = new Button(Activator.getMessages().getMessage("toolbar.logout.label"));
    lLogout.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (inEvent.getButton() != lLogout) {
                return;
            }

            if (listener != null) {
                listener.processAction(new IToolbarAction() {
                    @Override
                    public void run() {
                        VaadinSession.getCurrent().getAttribute(IRiplaEventDispatcher.class)
                                .dispatch(IRiplaEventDispatcher.Event.LOGOUT, new HashMap<String, Object>());
                    }
                });
            }
        }
    });
    lLogout.setStyleName(BaseTheme.BUTTON_LINK);
    out.addComponent(lLogout);
    return out;
}

From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java

License:Open Source License

private Component createBibliography(final GeneralDomainObject inBibliography,
        final IPluggableWithLookup inTask) throws VException {
    final HorizontalLayout out = createBiblioLayout();

    final Button lLink = LinkButtonHelper.createLinkButton(
            BeanWrapperHelper.getString(TextHome.KEY_REFERENCE, inBibliography), LookupType.BIBLIOGRAPHY,
            BeanWrapperHelper.getLong(TextHome.KEY_ID, inBibliography), inTask);
    lLink.setStyleName(BaseTheme.BUTTON_LINK);
    out.addComponent(lLink);//www .j  a v  a2s . c  o m

    addBibliographyText(inBibliography, out);
    return out;
}

From source file:org.hip.vif.web.util.LinkButtonHelper.java

License:Open Source License

@SuppressWarnings("serial")
public static Button createLinkButton(final String inCaption, final LookupType inType, final Long inID,
        final IPluggableWithLookup inController) {
    final Button outLink = new Button(inCaption);
    outLink.setStyleName(BaseTheme.BUTTON_LINK);
    outLink.addClickListener(new Button.ClickListener() {
        @Override/*from ww w  .  j av  a2 s  .  c o m*/
        public void buttonClick(final ClickEvent inEvent) {
            inController.requestLookup(inType, inID);
        }
    });
    return outLink;
}

From source file:org.iespuigcastellar.attendancemanager.screenlayouts.TeacherMainLayout.java

License:Open Source License

private void initLayout() {

    passwordChangeWindow = new PasswordChangeWindow();
    passwordChangeWindow.setCaption(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON"));

    datePopupDateField = new PopupDateField("");
    datePopupDateField.setDescription(app.locale.getString("TEACHERMAINLAYOUT_DATEFIELD_DESCRIPTION"));
    datePopupDateField.setValue(new java.util.Date());
    datePopupDateField.setResolution(PopupDateField.RESOLUTION_DAY);
    datePopupDateField.setImmediate(true);
    datePopupDateField.addListener(ValueChangeEvent.class, this, "changedDate");

    classblockComboBox = new ComboBox();
    classblockComboBox.setInputPrompt(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_INPUTPROMPT"));
    classblockComboBox.setDescription(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_DESCRIPTION"));
    classblockComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    classblockComboBox.setImmediate(true);
    classblockComboBox.addContainerProperty("name", String.class, "");
    classblockComboBox.setItemCaptionPropertyId("name");
    classblockComboBox.addListener(ValueChangeEvent.class, this, "changedClassblock");

    Button logoutButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_LOGOUTBUTTON_CAPTION"));

    logoutButton.addListener(new Button.ClickListener() {
        @Override/*from w  ww  . j  ava2 s. c o m*/
        public void buttonClick(ClickEvent event) {
            Logger.log("User " + app.user.getLogin() + " closes session");
            app.storage.close();
            getApplication().close();
        }
    });

    Button changePasswordButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON"));
    changePasswordButton.setIcon(new ThemeResource("../runo/icons/16/user.png"));
    changePasswordButton.setStyleName(Button.STYLE_LINK);
    changePasswordButton.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            // Open window if not open already
            if (passwordChangeWindow.getParent() != null) {
                // Window already open
            } else {
                // open window
                getWindow().addWindow(passwordChangeWindow);
            }
        }
    });

    GridLayout optionsGridLayout = new GridLayout(2, 1);
    HorizontalLayout haLayout = new HorizontalLayout();

    haLayout.setSpacing(true);

    haLayout.addComponent(changePasswordButton);
    haLayout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_LEFT);
    haLayout.addComponent(datePopupDateField);
    haLayout.addComponent(classblockComboBox);

    optionsGridLayout.addComponent(haLayout);
    optionsGridLayout.addComponent(logoutButton);
    optionsGridLayout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);
    optionsGridLayout.setWidth("100%");

    addComponent(optionsGridLayout);

    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);
    table.addContainerProperty("Name", String.class, null);
    table.addContainerProperty("Surname 1", String.class, null);
    table.addContainerProperty("Surname 2", String.class, null);
    table.addContainerProperty("Miss", CheckBox.class, null);
    table.addContainerProperty("Excused", CheckBox.class, null);
    table.addContainerProperty("Delay", CheckBox.class, null);
    table.addContainerProperty("Expulsion", CheckBox.class, null);

    table.setColumnExpandRatio("Name", 1);
    table.setColumnExpandRatio("Surname 1", 1);
    table.setColumnExpandRatio("Surname 2", 1);

    table.setColumnHeaders(new String[] { app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_NAME"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME1"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME2"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_MISS"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXCUSED"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_DELAY"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXPULSION") });
    addComponent(table);
    setExpandRatio(table, 1);
    setSizeFull();
}