Example usage for com.vaadin.ui Button addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.hybridbpm.ui.component.bpm.OpenCaseColumnGenerator.java

License:Apache License

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    Case case1 = (Case) itemId;
    String title = (String) source.getItem(itemId).getItemProperty("caseTitle").getValue();
    Button button = new Button(title, clickListener);
    button.setData(case1);
    button.addStyleName(ValoTheme.BUTTON_LINK);
    button.setDescription("Open case");
    return button;
}

From source file:com.hybridbpm.ui.component.bpm.OpenTaskColumnGenerator.java

License:Apache License

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    Task task = (Task) itemId;/*from   w ww  .j a va2 s .c o  m*/
    Button button = new Button(task.getTaskTitle(), clickListener);
    button.setData(task);
    button.addStyleName(ValoTheme.BUTTON_LINK);
    button.setDescription("Open task");
    return button;
}

From source file:com.hybridbpm.ui.component.bpm.StartProcessColumnGenerator.java

License:Apache License

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    StartProcess spd = (StartProcess) itemId;
    Button button = new Button(spd.getProcessModel().getTitle().getValue(HybridbpmUI.getCurrent().getLocale()),
            clickListener);/*from w ww.j av a 2 s.c  om*/
    button.setData(spd);
    button.addStyleName(ValoTheme.BUTTON_LINK);
    button.setIcon(FontAwesome.valueOf(spd.getIcon()));
    button.setDescription("Start case");
    return button;
}

From source file:com.hybridbpm.ui.component.document.DocumentColumnGenerator.java

License:Apache License

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    Document document = (Document) itemId;
    Button button = new Button(document.getName());
    button.setData(document);/*from  w  ww.j  a  v  a  2s  .c  om*/
    button.addStyleName(ValoTheme.BUTTON_LINK);
    if (Objects.equals(document.getType(), Document.TYPE.FILE)) {
        OnDemandFileDownloader onDemandFileDownloader = new OnDemandFileDownloader(document.getId().toString(),
                document.getName());
        onDemandFileDownloader.extend(button);
        button.setDescription(Translate.getMessage("btnDownload"));
    } else {
        button.setDescription(Translate.getMessage("btnOpen"));
        button.addClickListener(clickListener);
    }
    return button;
}

From source file:com.jain.addon.action.ActionButtonGroup.java

License:Apache License

/**
 * Method to initialize component// w  w w . ja v a 2s  . c  om
 */
@JNIComponentInit
public void initActions() {
    if (!initialized) {
        int i = 0;
        Button actionButton = null;
        for (JNAction action : actions) {
            actionButton = new Button(actionsToName.get(action), listener);

            if (StringHelper.isNotEmptyWithTrim(action.description()))
                actionButton.setDescription(action.description());
            else
                actionButton.setDescription(actionsToName.get(action));

            actionButton.setVisible(validatePermission(action));

            findNAddIcon(action, actionButton);

            if (StringHelper.isNotEmptyWithTrim(getActionStyle()))
                actionButton.setStyleName(getActionStyle());

            if (i == 0)
                actionButton.addStyleName(getFirstActionStyle());

            i++;
            addComponent(actionButton);
            setComponentAlignment(actionButton, Alignment.TOP_RIGHT);
        }
        if (actionButton != null)
            actionButton.addStyleName(getLastActionStyle());
        initialized = true;
    } else {
        throw new IllegalArgumentException("Please add action before adding component into container");
    }
}

From source file:com.jain.addon.web.layout.segment.ButtonSegment.java

License:Apache License

/**
 * Initialize a button segment by adding resources {@link JNINamedResourceVisible} and {@link ClickListener}. <br/> 
 * Every {@link JNINamedResourceVisible} will be converted into button having this {@link ClickListener}.
 * @param listener -  {@link ClickListener} for the button
 * @param namedResources - {@link JNINamedResourceVisible} to create button and there visibility
 *//*  www .  j  a  v  a2 s.  c  o m*/
public void createSegment(ClickListener listener, JNINamedResourceVisible... namedResources) {
    if (namedResources != null) {
        this.namedResources = namedResources;

        int i = 0;
        Button action = null;
        for (JNINamedResourceVisible named : namedResources) {
            action = new Button(named.getDisplayName(), listener);
            action.setDescription(named.getDescription());
            action.setVisible(named.isVisible());

            if (StringHelper.isNotEmptyWithTrim(buttonStyle))
                action.setStyleName(firstButtonStyle);

            if (i == 0)
                action.addStyleName(firstButtonStyle);

            i++;
            addComponent(action);
            setComponentAlignment(action, Alignment.TOP_RIGHT);
        }

        if (action != null)
            action.addStyleName(lastButtonStyle);
    }
}

From source file:com.klwork.explorer.ui.business.organization.GroupMenuBar.java

License:Apache License

public void addButton(Button button) {
    button.addStyleName(ExplorerLayout.STYLE_TOOLBAR_BUTTON);

    actionButtons.add(button);//from w w  w . j  av a2s. c  om
    // Button is added after the spacer
    addComponent(button);
    setComponentAlignment(button, Alignment.MIDDLE_LEFT);
}

From source file:com.klwork.explorer.ui.business.query.SocialListQuery.java

License:Apache License

public void initReAuthorButton(SocialUserAccount sc, HorizontalLayout buttonLayout) {
    if (checkExpried(sc)) {//??
        Integer scType = sc.getType();
        Button authorButton = new Button("?");
        authorButton.setDescription("?????");
        authorButton.addStyleName(Reindeer.BUTTON_LINK);
        authorButton.addClickListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                //socialAccountList.openReAuthorityBrowserWindow(opener);
            }//from www  . jav  a2s . c  o  m
        });

        //??button?
        socialAccountList.initButtonByBrowWindow(scType, authorButton);
        buttonLayout.addComponent(authorButton);
    }
}

From source file:com.klwork.explorer.ui.content.GenericAttachmentRenderer.java

License:Apache License

public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) {
    Button attachmentLink = new Button(attachment.getName());
    attachmentLink.addStyleName(Reindeer.BUTTON_LINK);

    attachmentLink.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            parent.showAttachmentDetail(attachment);
        }//from   w  ww.  j a v a2  s  . co  m
    });
    return attachmentLink;
}

From source file:com.klwork.explorer.ui.content.url.UrlAttachmentRenderer.java

License:Apache License

public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) {

    // If the attachment has no description, overview link is link to actual page
    // instead of showing popup with details.
    if (attachment.getDescription() != null && !"".equals(attachment.getDescription())) {
        Button attachmentLink = new Button(attachment.getName());
        attachmentLink.addStyleName(Reindeer.BUTTON_LINK);

        attachmentLink.addListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                parent.showAttachmentDetail(attachment);
            }// ww w  .  j a v a 2s . co  m
        });
        return attachmentLink;
    } else {
        return new Link(attachment.getName(), new ExternalResource(attachment.getUrl()));
    }
}