Example usage for com.vaadin.server FontAwesome TRASH_O

List of usage examples for com.vaadin.server FontAwesome TRASH_O

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome TRASH_O.

Prototype

FontAwesome TRASH_O

To view the source code for com.vaadin.server FontAwesome TRASH_O.

Click Source Link

Usage

From source file:lifetime.component.CrudMenu.java

License:Apache License

/**
 * Add crud specific control buttons, one for each crud action.
 *///w w  w. ja va2 s. c o m
@Override
protected void addControls() {
    addButton = new LifetimeButtonLink(username, getLanguage(), "Create", FontAwesome.PLUS);
    addButton.setId(StyleClassName.C_BUTTON.getId());

    readButton = new LifetimeButtonLink(username, getLanguage(), "Read", FontAwesome.EYE);
    readButton.setId(StyleClassName.R_BUTTON.getId());

    updateButton = new LifetimeButtonLink(username, getLanguage(), "Update", FontAwesome.EDIT);
    updateButton.setId(StyleClassName.U_BUTTON.getId());

    deleteButton = new LifetimeButtonLink(username, getLanguage(), "Delete", FontAwesome.TRASH_O);
    deleteButton.setId(StyleClassName.D_BUTTON.getId());

    addControl(addButton);
    addControl(readButton);
    addControl(updateButton);
    addControl(deleteButton);
}

From source file:management.limbr.ui.entity.EntityEditorViewImpl.java

License:Open Source License

@PostConstruct
public void init() {
    FormLayout content = new FormLayout();
    content.setWidthUndefined();/* ww w  . j  a  va2 s.  c  o m*/

    for (java.lang.reflect.Field field : entityClass.getDeclaredFields()) {
        if ("id".equals(field.getName())) {
            continue;
        }
        Field uiField = getUIField(field);
        fieldMap.put(field.getName(), uiField);
        content.addComponent(uiField);
    }

    save = new Button(messages.get("saveButtonLabel"), FontAwesome.SAVE);
    Button cancel = new Button(messages.get("cancelButtonLabel"));
    delete = new Button(messages.get("deleteButtonLabel"), FontAwesome.TRASH_O);

    CssLayout actions = new CssLayout(save, cancel, delete);
    content.addComponent(actions);

    content.setMargin(true);
    setContent(content);
    setClosable(true);
    setResizable(false);
    setModal(true);

    save.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::save));
    delete.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::deleteClicked));
    cancel.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::cancel));
}

From source file:me.uni.emuseo.view.categories.CategoryTable.java

License:Open Source License

public CategoryTable() {

    setSortEnabled(false);//ww w  .  j a  v  a2s  .  c  o  m
    addActionHandler(new Handler() {

        private static final long serialVersionUID = -1458601748782504737L;

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if (target == null) {
                return;
            }
            switch (action.getCaption()) {
            case "Edytuj":
                onEdit((CategoryDTO) target);
                break;
            case "Usu":
                onDelete((CategoryDTO) target);
                break;
            default:
                break;
            }
        }

        @Override
        public Action[] getActions(Object target, Object sender) {

            Action actionEdit = new Action("Edytuj", FontAwesome.EDIT);
            Action actionDelete = new Action("Usu", FontAwesome.TRASH_O);
            return new Action[] { actionEdit, actionDelete };
        }
    });
    setItemDescriptionGenerator(new CategoryDescriptionGenerator());

    beans = new BeanItemContainer<CategoryDTO>(CategoryDTO.class);
    setContainerDataSource(beans);
    setVisibleColumns(new Object[] { "name", "exhibitsCount" });
    setColumnHeaders("Nazwa", "Ilo eksponatw");

}

From source file:me.uni.emuseo.view.exhibits.ExhibitTable.java

License:Open Source License

public ExhibitTable() {

    setSortEnabled(false);/*from w  ww  . j a  va2  s.c o  m*/
    addActionHandler(new Handler() {

        private static final long serialVersionUID = -1458601748782504737L;

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if (target == null) {
                return;
            }
            switch (action.getCaption()) {
            case "Edytuj":
                onEdit((ExhibitDTO) target);
                break;
            case "Usu":
                onDelete((ExhibitDTO) target);
                break;
            case EDIT_IMAGE_CAPTION:
                onImageEdit((ExhibitDTO) target);
                break;
            case SHOW_CAPTION:
                onShow((ExhibitDTO) target);
                break;
            default:
                break;
            }
        }

        @Override
        public Action[] getActions(Object target, Object sender) {

            Action actionEdit = new Action("Edytuj", FontAwesome.EDIT);
            Action actionDelete = new Action("Usu", FontAwesome.TRASH_O);
            Action actionEditImage = new Action(EDIT_IMAGE_CAPTION, FontAwesome.FILE_IMAGE_O);
            Action actionShow = new Action(SHOW_CAPTION, FontAwesome.EYE);
            return new Action[] { actionEdit, actionDelete, actionEditImage, actionShow };
        }
    });
    setItemDescriptionGenerator(new ExhibitDescriptionGenerator());

    beans = new BeanItemContainer<ExhibitDTO>(ExhibitDTO.class);
    setContainerDataSource(beans);
    beans.addNestedContainerBean("exhibitCategory");
    setVisibleColumns(new Object[] { "exhibitName", "exhibitNo", "genericYear", "exhibitCategory.name",
            "exhibitLocation" });
    setColumnHeaders("Nazwa", "Numer kat.", "Wiek w latach", "Kategoria", "Lokalizacja");

}

From source file:me.uni.emuseo.view.users.UserTable.java

License:Open Source License

public UserTable() {

    setSortEnabled(false);/* w  ww.jav a2  s . c  om*/
    addActionHandler(new Handler() {

        private static final long serialVersionUID = -1458601748782504737L;

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if (target == null) {
                return;
            }
            switch (action.getCaption()) {
            case "Edytuj":
                onEdit((UserDTO) target);
                break;
            case "Usu":
                onDelete((UserDTO) target);
                break;
            default:
                break;
            }
        }

        @Override
        public Action[] getActions(Object target, Object sender) {

            Action actionEdit = new Action("Edytuj", FontAwesome.EDIT);
            Action actionDelete = new Action("Usu", FontAwesome.TRASH_O);
            return new Action[] { actionEdit, actionDelete };
        }
    });
    setItemDescriptionGenerator(new UserDescriptionGenerator());

    beans = new BeanItemContainer<UserDTO>(UserDTO.class);
    setContainerDataSource(beans);
    setVisibleColumns("firstName", "lastName", "login", "emailAddress", "phoneNumber", "userType");
    setColumnHeaders("Imi", "Nazwisko", "Login", "Adres e-mail", "Nr telefonu", "Typ konta");

}

From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout.java

License:Open Source License

private void addGeneratedColumnButton(final Table table) {
    table.addGeneratedColumn(ACTION, new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override/*  w w w.  ja  va  2  s  .com*/
        public Button generateCell(final Table source, final Object itemId, final Object columnId) {
            final String fileName = (String) table.getContainerDataSource().getItem(itemId)
                    .getItemProperty(PROVIDED_FILE_NAME).getValue();
            final Button deleteIcon = SPUIComponentProvider.getButton(
                    fileName + "-" + UIComponentIdProvider.UPLOAD_FILE_DELETE_ICON, "",
                    i18n.getMessage(UIMessageIdProvider.CAPTION_DISCARD),
                    ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O,
                    SPUIButtonStyleNoBorder.class);
            deleteIcon.setData(itemId);
            deleteIcon.addClickListener(event -> confirmAndDeleteArtifact((Long) itemId, fileName));
            return deleteIcon;
        }
    });

}

From source file:org.eclipse.hawkbit.ui.artifacts.footer.UploadViewConfirmationWindowLayout.java

License:Open Source License

private ConfirmationTab createSMDeleteConfirmationTab() {
    final ConfirmationTab tab = new ConfirmationTab();

    tab.getConfirmAll().setId(UIComponentIdProvider.SW_DELETE_ALL);
    tab.getConfirmAll().setIcon(FontAwesome.TRASH_O);
    tab.getConfirmAll().setCaption(i18n.getMessage("button.delete.all"));
    tab.getConfirmAll().addClickListener(event -> deleteSMAll(tab));

    tab.getDiscardAll().setCaption(i18n.getMessage("button.discard.all"));
    tab.getDiscardAll().addClickListener(event -> discardSMAll(tab));

    // Add items container to the table.
    tab.getTable().setContainerDataSource(getSWModuleTableContainer());

    // Add the discard action column
    tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> {
        final ClickListener clickListener = event -> discardSoftwareDelete(event, itemId, tab);
        return createDiscardButton(itemId, clickListener);
    });//  w  w  w. j  av a  2 s.  co m

    tab.getTable().setVisibleColumns(SW_MODULE_NAME_MSG, SW_DISCARD_CHGS);
    tab.getTable().setColumnHeaders(i18n.getMessage("upload.swModuleTable.header"),
            i18n.getMessage("header.second.deletetarget.table"));

    tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
    tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
    tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER);
    return tab;
}

From source file:org.eclipse.hawkbit.ui.artifacts.footer.UploadViewConfirmationWindowLayout.java

License:Open Source License

private void deleteSMAll(final ConfirmationTab tab) {
    final Set<Long> swmoduleIds = artifactUploadState.getDeleteSofwareModules().keySet();
    softwareModuleManagement.delete(swmoduleIds);
    eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));

    addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE + i18n
            .getMessage("message.swModule.deleted", artifactUploadState.getDeleteSofwareModules().size()));
    /*/*from   ww w. j  av a 2 s .  co  m*/
     * Check if any information / files pending to upload for the deleted
     * software modules. If so, then delete the files from the upload list.
     */
    final List<CustomFile> tobeRemoved = new ArrayList<>();
    for (final Long id : swmoduleIds) {
        final String deleteSoftwareNameVersion = artifactUploadState.getDeleteSofwareModules().get(id);

        for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
            final String swNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
                    customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
            if (deleteSoftwareNameVersion != null && deleteSoftwareNameVersion.equals(swNameVersion)) {
                tobeRemoved.add(customFile);
            }
        }
    }
    if (!tobeRemoved.isEmpty()) {
        artifactUploadState.getFileSelected().removeAll(tobeRemoved);
    }
    artifactUploadState.getDeleteSofwareModules().clear();
    removeCurrentTab(tab);
    setActionMessage(i18n.getMessage("message.software.delete.success"));
    eventBus.publish(this, UploadArtifactUIEvent.DELETED_ALL_SOFWARE);
}

From source file:org.eclipse.hawkbit.ui.artifacts.footer.UploadViewConfirmationWindowLayout.java

License:Open Source License

private ConfirmationTab createSMtypeDeleteConfirmationTab() {
    final ConfirmationTab tab = new ConfirmationTab();

    tab.getConfirmAll().setId(UIComponentIdProvider.SAVE_DELETE_SW_MODULE_TYPE);
    tab.getConfirmAll().setIcon(FontAwesome.TRASH_O);
    tab.getConfirmAll().setCaption(i18n.getMessage("button.delete.all"));
    tab.getConfirmAll().addClickListener(event -> deleteSMtypeAll(tab));

    tab.getDiscardAll().setCaption(i18n.getMessage("button.discard.all"));
    tab.getDiscardAll().addClickListener(event -> discardSMtypeAll(tab));

    // Add items container to the table.
    tab.getTable().setContainerDataSource(getSWModuleTypeTableContainer());

    // Add the discard action column
    tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
        final ClickListener clickListener = event -> discardSoftwareTypeDelete(
                (String) ((Button) event.getComponent()).getData(), itemId, tab);
        return createDiscardButton(itemId, clickListener);
    });//w w  w  .  j  a v  a 2 s .co m

    tab.getTable().setVisibleColumns(SW_MODULE_TYPE_NAME, DISCARD);
    tab.getTable().setColumnHeaders(i18n.getMessage("header.first.delete.swmodule.type.table"),
            i18n.getMessage("header.second.delete.swmodule.type.table"));

    tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2);
    tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
    tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER);
    return tab;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java

License:Open Source License

private void populateUploadDetailsTable() {
    for (final CustomFile customFile : uploadLayout.getFileSelected()) {
        final String swNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
                customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
        final String itemId = swNameVersion + "/" + customFile.getFileName();
        final Item newItem = tableContainer.addItem(itemId);
        final SoftwareModule bSoftwareModule = artifactUploadState.getBaseSwModuleList().get(swNameVersion);
        newItem.getItemProperty(BASE_SOFTWARE_ID).setValue(bSoftwareModule.getId());

        addFileNameLayout(newItem, swNameVersion, customFile.getFileName(), itemId);

        newItem.getItemProperty(SW_MODULE_NAME).setValue(HawkbitCommonUtil.getFormatedLabel(swNameVersion));
        newItem.getItemProperty(SIZE).setValue(customFile.getFileSize());
        final Button deleteIcon = SPUIComponentProvider.getButton(
                UIComponentIdProvider.UPLOAD_DELETE_ICON + "-" + itemId, "", SPUILabelDefinitions.DISCARD,
                ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O,
                SPUIButtonStyleSmallNoBorder.class);
        deleteIcon.addClickListener(this);
        deleteIcon.setData(itemId);//from  w  ww.j a  v a  2s  .  c  om
        newItem.getItemProperty(ACTION).setValue(deleteIcon);

        final TextField sha1 = createTextField(swNameVersion + "/" + customFile.getFileName() + "/sha1");

        final TextField md5 = createTextField(swNameVersion + "/" + customFile.getFileName() + "/md5");

        createTextField(swNameVersion + "/" + customFile.getFileName() + "/customFileName");

        newItem.getItemProperty(SHA1_CHECKSUM).setValue(sha1);
        newItem.getItemProperty(MD5_CHECKSUM).setValue(md5);
        newItem.getItemProperty(CUSTOM_FILE).setValue(customFile);
    }
}