Example usage for com.vaadin.ui Button setData

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

Introduction

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

Prototype

public void setData(Object data) 

Source Link

Document

Sets the data object, that can be used for any application specific data.

Usage

From source file:org.eclipse.hawkbit.ui.distributions.footer.DistributionsConfirmationWindowLayout.java

License:Open Source License

private ConfirmationTab createAssignSWModuleConfirmationTab() {

    assignmnetTab = new ConfirmationTab();

    assignmnetTab.getConfirmAll().setId(UIComponentIdProvider.SAVE_ASSIGNMENT);
    assignmnetTab.getConfirmAll().setIcon(FontAwesome.SAVE);
    assignmnetTab.getConfirmAll().setCaption(i18n.getMessage("button.assign.all"));
    assignmnetTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmnetTab));

    assignmnetTab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL));
    assignmnetTab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_ASSIGNMENT);
    assignmnetTab.getDiscardAll().addClickListener(event -> discardAllSWAssignments(assignmnetTab));

    // Add items container to the table.
    assignmnetTab.getTable().setContainerDataSource(getSWAssignmentsTableContainer());

    // Add the discard action column
    assignmnetTab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
        final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY);
        style.append(' ');
        style.append(SPUIStyleDefinitions.REDICON);
        final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
                style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class);
        deleteIcon.setData(itemId);
        deleteIcon.setImmediate(true);/*  ww  w. jav  a 2  s .  c om*/
        deleteIcon.addClickListener(event -> discardSWAssignment(
                (String) ((Button) event.getComponent()).getData(), itemId, assignmnetTab));
        return deleteIcon;
    });

    assignmnetTab.getTable().setVisibleColumns(DIST_NAME, SOFTWARE_MODULE_NAME, DISCARD);
    assignmnetTab.getTable().setColumnHeaders(i18n.getMessage("header.dist.first.assignment.table"),
            i18n.getMessage("header.dist.second.assignment.table"),
            i18n.getMessage("header.third.assignment.table"));

    assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2);
    assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2);
    assignmnetTab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
    assignmnetTab.getTable().setColumnAlignment(DISCARD, Align.CENTER);
    return assignmnetTab;

}

From source file:org.eclipse.hawkbit.ui.filtermanagement.TargetFilterTable.java

License:Open Source License

private Button getDeleteButton(final Long itemId) {
    final Item row = getItem(itemId);
    final String tfName = (String) row.getItemProperty(SPUILabelDefinitions.NAME).getValue();
    final Button deleteIcon = SPUIComponentProvider.getButton(getDeleteIconId(tfName), "",
            i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE_CUSTOM_FILTER),
            ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class);
    deleteIcon.setData(itemId);
    deleteIcon.addClickListener(this::onDelete);
    return deleteIcon;
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.TargetFilterTable.java

License:Open Source License

private Button customFilterDetailButton(final Long itemId) {
    final Item row1 = getItem(itemId);
    final String tfName = (String) row1.getItemProperty(SPUILabelDefinitions.NAME).getValue();

    final Button updateIcon = SPUIComponentProvider.getButton(getDetailLinkId(tfName), tfName,
            i18n.getMessage(UIMessageIdProvider.TOOLTIP_UPDATE_CUSTOM_FILTER), null, false, null,
            SPUIButtonStyleNoBorder.class);
    updateIcon.setData(tfName);
    updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link");
    updateIcon.addClickListener(this::onClickOfDetailButton);
    return updateIcon;
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.TargetFilterTable.java

License:Open Source License

private Button customFilterDistributionSetButton(final Long itemId) {
    final Item row1 = getItem(itemId);
    final ProxyDistribution distSet = (ProxyDistribution) row1
            .getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET).getValue();
    final ActionType actionType = (ActionType) row1
            .getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_ACTION_TYPE).getValue();

    final String buttonId = "distSetButton";
    Button updateIcon;
    if (distSet == null) {
        updateIcon = SPUIComponentProvider.getButton(buttonId,
                i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT),
                i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null,
                SPUIButtonStyleNoBorder.class);
    } else {/*from w ww.  ja va 2s  .c  o m*/
        updateIcon = actionType.equals(ActionType.FORCED)
                ? SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(),
                        i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false,
                        FontAwesome.BOLT, SPUIButtonStyleNoBorderWithIcon.class)
                : SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(),
                        i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false,
                        null, SPUIButtonStyleNoBorder.class);
        updateIcon.setSizeUndefined();
    }

    updateIcon.addClickListener(this::onClickOfDistributionSetButton);
    updateIcon.setData(row1);
    updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link");

    return updateIcon;
}

From source file:org.eclipse.hawkbit.ui.management.dstable.DistributionTable.java

License:Open Source License

private Button createPinBtn(final Object itemId) {

    final Item item = getContainerDataSource().getItem(itemId);
    final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();

    final String version = (String) item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
    final DistributionSetIdName distributionSetIdName = new DistributionSetIdName((Long) itemId, name, version);

    final Button pinBtn = new Button();
    pinBtn.setIcon(FontAwesome.THUMB_TACK);
    pinBtn.setHeightUndefined();/* w  w  w  .java  2s  .c  om*/
    pinBtn.addStyleName(getPinStyle());
    pinBtn.setData(distributionSetIdName);
    pinBtn.setId(getPinButtonId(name, version));
    pinBtn.setImmediate(true);
    pinBtn.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_DISTRIBUTION_SET_PIN));
    return pinBtn;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetTable.java

License:Open Source License

private Button getTagetPinButton(final Object itemId) {
    final Button pinBtn = new Button();
    final String controllerId = (String) getContainerDataSource().getItem(itemId)
            .getItemProperty(SPUILabelDefinitions.VAR_CONT_ID).getValue();
    final TargetIdName pinnedTarget = new TargetIdName((Long) itemId, controllerId);
    final StringBuilder pinBtnStyle = new StringBuilder(ValoTheme.BUTTON_BORDERLESS_COLORED);
    pinBtnStyle.append(' ');
    pinBtnStyle.append(ValoTheme.BUTTON_SMALL);
    pinBtnStyle.append(' ');
    pinBtnStyle.append(ValoTheme.BUTTON_ICON_ONLY);
    pinBtn.setStyleName(pinBtnStyle.toString());
    pinBtn.setHeightUndefined();//w  w w  . ja  v a2 s  . co  m
    pinBtn.setData(pinnedTarget);
    pinBtn.setId(UIComponentIdProvider.TARGET_PIN_ICON + controllerId);
    pinBtn.addClickListener(this::addPinClickListener);
    pinBtn.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_TARGET_PIN));
    if (isPinned(pinnedTarget)) {
        pinBtn.addStyleName(TARGET_PINNED);
        targetPinned = Boolean.TRUE;
        targetPinnedBtn = pinBtn;
        getEventBus().publish(this, PinUnpinEvent.PIN_TARGET);
    }
    pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
    HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, itemId);
    return pinBtn;
}

From source file:org.eclipse.hawkbit.ui.management.targettag.filter.TargetFilterQueryButtons.java

License:Open Source License

private Button createFilterButton(final Long id, final String name, final Object itemId) {
    final Button button = SPUIComponentProvider.getButton("", name, name, "", false, null,
            SPUITagButtonStyle.class);
    button.addStyleName("custom-filter-button");
    button.setId(name);/*from   w w  w .  ja v  a  2  s . c om*/
    if (id != null) {
        button.setCaption(name);
    }
    button.setDescription(name);
    button.setData(itemId);
    button.addClickListener(event -> customTargetTagFilterButtonClick.processButtonClick(event));
    return button;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings({ "deprecation", "serial" })
private void paintEditTagList() {
    tagListLayout.removeAllComponents();
    tagListLayout.setWidth("100%"); //$NON-NLS-1$

    Label tagLabel = new Label("Tags:");
    tagLabel.setSizeUndefined();/*from  w  ww  .  j a va 2 s .c  om*/
    tagListLayout.addComponent(tagLabel);

    SortedSet<String> tags = TaggingUtils.getTags(project);
    for (String tag : tags) {
        Layout l = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                if (c instanceof Label) {
                    return "float: left; line-height: 18px; padding-right: 3px"; //$NON-NLS-1$
                } else {
                    return "float: left; line-height: 18px; padding-right: 5px"; //$NON-NLS-1$
                }
            }
        };
        Label label = new Label(tag);
        label.setSizeUndefined();
        l.addComponent(label);

        Button removeButton = new Button("(remove)", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                String tag = (String) event.getButton().getData();
                TaggingUtils.removeTag(project, tag);
                util.persist(project);
                paintTagEdit();
            }
        });
        removeButton.setStyleName(Button.STYLE_LINK);
        removeButton.setData(tag);
        removeButton.setSizeUndefined();
        l.addComponent(removeButton);
        tagListLayout.addComponent(l);
    }
}

From source file:org.escidoc.browser.ui.GroupRolesView.java

License:Open Source License

private Button buildRemoveButton(int rowNumber, Grant grant) {
    Button removeButton = new Button();
    removeButton.setIcon(new ThemeResource("images/assets/minus.png"));
    removeButton.setData(Integer.valueOf(rowNumber));
    removeButton.addListener(new OnRemoveGrant(grant, groupId, repositories, router.getMainWindow()));
    return removeButton;
}

From source file:org.escidoc.browser.ui.useraccount.UserRolesView.java

License:Open Source License

private Button buildRemoveButton(int rowNumber, Grant grant) {
    Button removeButton = new Button();
    removeButton.setIcon(new ThemeResource("images/assets/minus.png"));
    removeButton.setData(Integer.valueOf(rowNumber));
    removeButton.addListener(new OnRemoveGrant(grant, userProxy, repositories, router.getMainWindow()));
    return removeButton;
}