List of usage examples for com.vaadin.server FontAwesome TRASH_O
FontAwesome TRASH_O
To view the source code for com.vaadin.server FontAwesome TRASH_O.
Click Source Link
From source file:com.etest.view.testbank.CellCaseWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// w w w . ja v a 2s . c om subject.setCaption("Subject: "); subject.setWidth("50%"); subject.addValueChangeListener((new CurriculumPropertyChangeListener(topic))); form.addComponent(subject); topic.setCaption("Topic: "); topic.setWidth("80%"); topic.setInputPrompt("Select a Topic.."); topic.addStyleName(ValoTheme.COMBOBOX_SMALL); form.addComponent(topic); caseTopic = new TextArea(); caseTopic.setCaption("Case: "); caseTopic.setWidth("100%"); caseTopic.setRows(5); form.addComponent(caseTopic); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); hlayout.setSpacing(true); Button save = new Button("SAVE"); save.setWidth("200px"); save.setIcon(FontAwesome.SAVE); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addStyleName(ValoTheme.BUTTON_SMALL); save.addClickListener(buttonClickListener); Button modify = new Button("MODIFY"); modify.setWidth("200px"); modify.setIcon(FontAwesome.EDIT); modify.addStyleName(ValoTheme.BUTTON_PRIMARY); modify.addStyleName(ValoTheme.BUTTON_SMALL); modify.addClickListener(buttonClickListener); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.setEnabled(UserAccess.approve()); approve.addClickListener(buttonClickListener); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.setEnabled(UserAccess.delete()); delete.addClickListener(buttonClickListener); if (getCellCaseId() != 0) { CellCase cc = ccs.getCellCaseById(getCellCaseId()); subject.setValue(cc.getCurriculumId()); topic.setValue(cc.getSyllabusId()); caseTopic.setValue(cc.getCaseTopic()); approve.setVisible(cc.getApprovalStatus() == 0); hlayout.addComponent(approve); hlayout.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT); hlayout.addComponent(modify); hlayout.setComponentAlignment(modify, Alignment.MIDDLE_RIGHT); hlayout.addComponent(delete); hlayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT); } else { hlayout.addComponent(save); hlayout.setComponentAlignment(save, Alignment.MIDDLE_RIGHT); } form.addComponent(hlayout); form.setComponentAlignment(hlayout, Alignment.MIDDLE_RIGHT); return form; }
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
Table populateDataTable() { table.removeAllItems();/*from w w w.j a va 2 s. c o m*/ int i = 0; for (ItemKeys key : k.getItemKeysByCellItemId(getCellItemId())) { Button delete = new Button("remove"); delete.setWidth("100%"); delete.setData(key.getItemKeyId()); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName(ValoTheme.BUTTON_QUIET); delete.addClickListener(removeBtnClickListener); table.addItem(new Object[] { key.getItemKey(), key.getAnswer(), delete }, i); i++; } table.setPageLength(table.size()); return table; }
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
Window removeKeyWindow(int itemKeyId) { Window sub = new Window("REMOVE KEY"); sub.setWidth("300px"); sub.setModal(true);// www . j a v a2 s. c om sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button remove = new Button("CONFIRM REMOVE KEY?"); remove.setWidth("100%"); remove.setIcon(FontAwesome.TRASH_O); remove.addStyleName(ValoTheme.BUTTON_PRIMARY); remove.addStyleName(ValoTheme.BUTTON_SMALL); remove.addClickListener((Button.ClickEvent event) -> { boolean result = k.removeItemKey(itemKeyId); if (result) { sub.close(); close(); } }); v.addComponent(remove); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// w w w. j ava 2s. c o m int itemNo = 1; Label caseTopic; Label stem; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); form.addComponent(caseTopic); Map<Integer, Integer> value = tqCases.getValue(); for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) { Integer itemId = itemIds.getKey(); Integer itemKeyId = itemIds.getValue(); List<String> keyList = k.getAllItemKey(itemId); if (keyList.isEmpty()) { ShowErrorNotification .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem()); return null; } stem = new Label(); // stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0))); stem.setValue(itemNo + ". " + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId))); stem.setContentMode(ContentMode.HTML); form.addComponent(stem); GridLayout glayout = new GridLayout(2, 2); glayout.setWidth("100%"); glayout.setSpacing(true); glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML), 0, 0); glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML), 0, 1); glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML), 1, 0); glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML), 1, 1); form.addComponent(glayout); itemNo++; } } HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); h.addComponent(delete); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); h.addComponent(approve); if (tq.isTQCoverageApproved(getTQCoverageId())) { approve.setVisible(false); } else { approve.setVisible(true); } form.addComponent(h); return form; }
From source file:com.etest.view.tq.TQCoverageWindow.java
Window confirmDeleteWindow() { Window sub = new Window("TQ Coverage"); sub.setWidth("250px"); sub.setResizable(false);/*from w w w . j a v a2s . c o m*/ sub.setModal(true); sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button("DELETE TQ?"); delete.setWidth("100%"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = tq.deleteTQCoverage(getTQCoverageId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.mycollab.mobile.module.project.ui.form.field.ProjectFormAttachmentUploadField.java
License:Open Source License
private void displayFileName(File file, final String fileName) { final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth(); MButton removeBtn = new MButton("", clickEvent -> { File tmpFile = fileStores.get(fileName); if (tmpFile != null) { tmpFile.delete();//from w w w . j a v a2s. com } fileStores.remove(fileName); rowWrap.removeComponent(fileAttachmentLayout); }).withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK); ELabel fileLbl = ELabel.html(fileName).withDescription(fileName).withStyleName(UIConstants.TEXT_ELLIPSIS); fileAttachmentLayout .with(ELabel.fontIcon(FileAssetsUtil.getFileIconResource(fileName)).withWidthUndefined(), fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length())) .withStyleName(UIConstants.META_INFO).withWidthUndefined(), removeBtn) .expand(fileLbl); rowWrap.addComponent(fileAttachmentLayout); }
From source file:com.mycollab.mobile.module.project.ui.ProjectCommentInputView.java
License:Open Source License
private Component createAttachmentRow(String fileName) { final MHorizontalLayout uploadSucceedLayout = new MHorizontalLayout().withFullWidth(); Label uploadResult = new Label(fileName); uploadSucceedLayout.with(uploadResult).expand(uploadResult); MButton removeAttachment = new MButton("", clickEvent -> statusWrapper.removeComponent(uploadSucceedLayout)) .withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK); uploadSucceedLayout.addComponent(removeAttachment); return uploadSucceedLayout; }
From source file:com.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }// w ww . j a va 2 s. c om final MHorizontalLayout attachmentLayout = new MHorizontalLayout().withStyleName("attachment-row") .withFullWidth(); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Component thumbnail; if (StringUtils.isNotBlank(attachment.getThumbnail())) { thumbnail = new Image(null, VaadinResourceFactory.getResource(attachment.getThumbnail())); } else { thumbnail = ELabel.fontIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); ELabel attachmentLink = new ELabel(docName).withStyleName(UIConstants.META_INFO, UIConstants.TEXT_ELLIPSIS); attachmentLayout.with(attachmentLink).expand(attachmentLink); MButton removeAttachment = new MButton("", clickEvent -> { ConfirmDialog.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), dialog -> { if (dialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true, MyCollabUI.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.mycollab.module.crm.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)) .withFullWidth();/* ww w. ja v a 2 s .c o m*/ UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName(WebThemes.MESSAGE_CONTAINER); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)).withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName(UIConstants.META_INFO); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button if (hasDeletePermission(comment)) { MButton msgDeleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { CommentService commentService = AppContextUtil.getSpringBean(CommentService.class); commentService.removeWithSession(comment, UserUIContext.getUsername(), MyCollabUI.getAccountId()); ((BeanList) host).removeRow(layout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth(); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.mycollab.module.crm.ui.components.CrmActivityComponent.java
License:Open Source License
private Component buildCommentBlock(final SimpleComment comment) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withFullWidth(); ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);//w w w . j av a 2 s . co m MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth() .withStyleName(WebThemes.MESSAGE_CONTAINER); MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setStyleName(UIConstants.META_INFO); if (hasDeletePermission(comment)) { MButton msgDeleteBtn = new MButton("", clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { CommentService commentService = AppContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment, UserUIContext.getUsername(), MyCollabUI.getAccountId()); activityBox.removeComponent(layout); } })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY); messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl); } else { messageHeader.with(timePostLbl).expand(timePostLbl); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false) .withFullWidth(); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }