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.esofthead.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
public void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }//w w w. j a va 2s. co m final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getInstance().getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getInstance().getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul() .appendChild(new Li().appendText("Size: " + FileUtils.getVolumeDisplay(attachment.getSize()))) .setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText( "Last modified: " + AppContext.formatPrettyTime(attachment.getLastModified().getTime()))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); CssLayout attachmentNameWrap = new CssLayout(); attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentNameWrap.setStyleName("attachment-name-wrap"); Label attachmentName = new Label(StringUtils.trim(docName, 60, true)); attachmentName.setStyleName("attachment-name"); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); Button trashBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); trashBtn.setIcon(FontAwesome.TRASH_O); trashBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); Button downloadBtn = new Button(); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:com.esofthead.mycollab.vaadin.web.ui.AttachmentPanel.java
License:Open Source License
private void displayFileName(File file, final String fileName) { final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth(); Button removeBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*w ww .jav a2 s . co m*/ public void buttonClick(ClickEvent event) { File file = fileStores.get(fileName); if (file != null) { file.delete(); } fileStores.remove(fileName); AttachmentPanel.this.removeComponent(fileAttachmentLayout); if (multiFileUpload != null) { multiFileUpload.removeAndReInitMultiUpload(); } } }); removeBtn.setIcon(FontAwesome.TRASH_O); removeBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); removeBtn.setWidthUndefined(); ELabel fileLbl = new ELabel(fileName, ContentMode.HTML).withDescription(fileName) .withStyleName(UIConstants.TEXT_ELLIPSIS); fileAttachmentLayout.with( new ELabel(FileAssetsUtil.getFileIconResource(fileName).getHtml(), ContentMode.HTML) .withWidthUndefined(), fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length())) .withStyleName(UIConstants.META_INFO).withWidthUndefined(), removeBtn).expand(fileLbl); this.addComponent(fileAttachmentLayout); }
From source file:com.esofthead.mycollab.vaadin.web.ui.ProjectPreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) { optionBtn = new PopupButton(); optionBtn.addStyleName(UIConstants.BOX); optionBtn.setIcon(FontAwesome.ELLIPSIS_H); if (permissionItem != null) { boolean canWrite = CurrentProjectVariables.canWrite(permissionItem); boolean canAccess = CurrentProjectVariables.canAccess(permissionItem); boolean canRead = CurrentProjectVariables.canRead(permissionItem); if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) { Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { T item = previewForm.getBean(); previewForm.fireAssignForm(item); }/*from ww w. j a va 2s. com*/ }); assignBtn.setIcon(FontAwesome.SHARE); assignBtn.setStyleName(UIConstants.BUTTON_ACTION); editButtons.addComponent(assignBtn); assignBtn.setEnabled(canWrite); } if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireAddForm(item); } }); addBtn.setIcon(FontAwesome.PLUS); addBtn.setStyleName(UIConstants.BUTTON_ACTION); addBtn.setEnabled(canWrite); editButtons.addComponent(addBtn); } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireEditForm(item); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName(UIConstants.BUTTON_ACTION); editBtn.setEnabled(canWrite); editButtons.addComponent(editBtn); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { T item = previewForm.getBean(); previewForm.fireDeleteForm(item); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName(UIConstants.BUTTON_DANGER); deleteBtn.setEnabled(canAccess); editButtons.addComponent(deleteBtn); } if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) { final PrintButton printBtn = new PrintButton(); printBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { T item = previewForm.getBean(); previewForm.firePrintForm(printBtn, item); } }); printBtn.setStyleName(UIConstants.BUTTON_OPTION); printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_PRINT)); printBtn.setEnabled(canRead); editButtons.addComponent(printBtn); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireCloneForm(item); } }); cloneBtn.setIcon(FontAwesome.ROAD); cloneBtn.setEnabled(canWrite); popupButtonsControl.addOption(cloneBtn); } layout.with(editButtons); if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) { ButtonGroup navigationBtns = new ButtonGroup(); Button previousItem = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { T item = previewForm.getBean(); previewForm.fireGotoPrevious(item); } }); previousItem.setIcon(FontAwesome.CHEVRON_LEFT); previousItem.setCaptionAsHtml(true); previousItem.setStyleName(UIConstants.BUTTON_OPTION); previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)); previousItem.setEnabled(canRead); navigationBtns.addButton(previousItem); Button nextItemBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { T item = previewForm.getBean(); previewForm.fireGotoNextItem(item); } }); nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT); nextItemBtn.setStyleName(UIConstants.BUTTON_OPTION); nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)); nextItemBtn.setEnabled(canRead); navigationBtns.addButton(nextItemBtn); layout.addComponent(navigationBtns); } if (popupButtonsControl.getComponentCount() > 0) { optionBtn.setContent(popupButtonsControl); layout.addComponent(optionBtn); } } return layout; }
From source file:com.etest.view.systemadministration.CurriculumMainUI.java
Table populateDataTable() { table.removeAllItems();/* w w w . j a v a 2 s . c o m*/ int i = 0; for (Curriculum c : cs.getAllCurriculum()) { HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button edit = new Button("edit"); edit.setSizeFull(); edit.setIcon(FontAwesome.PENCIL); edit.setData(c.getCurriculumId()); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(buttonClickListener); h.addComponent(edit); Button delete = new Button("del"); delete.setSizeFull(); delete.setIcon(FontAwesome.TRASH_O); delete.setData(c.getCurriculumId()); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(buttonClickListener); h.addComponent(delete); table.addItem(new Object[] { // c.getCurriculumId(), CommonVariableMap.getYearLevel(c.getYearLevel()), c.getSubject(), c.getDescriptiveTitle(), CommonVariableMap.getNormCourseOffering(c.getNormCourseOffering()), h }, i); i++; } table.setPageLength(table.size()); // table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> { // table.removeListener(ItemClickEvent.class, listener); // }); // // table.addItemClickListener((ItemClickEvent event) -> { // Property itemProperty = event.getItem().getItemProperty("id"); // // Window sub = new CurriculumFormWindow(CommonUtilities.convertStringToInt(itemProperty.getValue().toString())); // if(sub.getParent() == null){ // UI.getCurrent().addWindow(sub); // } // sub.addCloseListener((Window.CloseEvent e) -> { // populateDataTable(); // }); // }); return table; }
From source file:com.etest.view.systemadministration.FacultyMainUI.java
Table populateDataTable() { table.removeAllItems();/*from www. j a v a 2 s . co m*/ int i = 0; for (Users u : fs.getAllFaculty()) { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button edit = new Button("edit"); edit.setWidth("100%"); edit.setData(u.getFacultyId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(modifyBtnClickListener); hlayout.addComponent(edit); Button delete = new Button("del"); delete.setWidth("100%"); delete.setData(u.getFacultyId()); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(modifyBtnClickListener); hlayout.addComponent(delete); table.addItem(new Object[] { u.getName().toUpperCase(), u.getUsername_(), u.getUserType(), hlayout }, new Integer(i)); i++; } table.setPageLength(table.size()); // table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> { // table.removeListener(ItemClickEvent.class, listener); // }); // table.addItemClickListener((ItemClickEvent event) -> { // Property itemProperty = event.getItem().getItemProperty("name"); // facultyId = fs.getFacultyIdByName(itemProperty.getValue().toString()); // // Window sub = new FacultyFormWindow(facultyId); // if(sub.getParent() == null){ // UI.getCurrent().addWindow(sub); // } // }); return table; }
From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java
Table populateDataTable() { table.removeAllItems();/*from w ww . j a v a 2 s . c o m*/ int i = 0; for (TeamTeach tt : tts.getAllMembersFromTeam(getTeamTeachId())) { String position; boolean isFacultyTeamLeader = tts.isFacultyTeamLeader(getTeamTeachId(), tt.getFacultyId()); if (isFacultyTeamLeader) { position = "Team Leader"; } else { position = "Member"; } HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button editPositionBtn = new Button("edit"); editPositionBtn.setWidthUndefined(); editPositionBtn.setData(tt.getFacultyId()); editPositionBtn.setIcon(FontAwesome.EDIT); editPositionBtn.addStyleName(ValoTheme.BUTTON_LINK); editPositionBtn.addStyleName(ValoTheme.BUTTON_TINY); editPositionBtn.addClickListener(modifyBtnClickListener); hlayout.addComponent(editPositionBtn); Button removeMemberBtn = new Button("del"); removeMemberBtn.setWidthUndefined(); removeMemberBtn.setData(tt.getFacultyId()); removeMemberBtn.setIcon(FontAwesome.TRASH_O); removeMemberBtn.addStyleName(ValoTheme.BUTTON_LINK); removeMemberBtn.addStyleName(ValoTheme.BUTTON_TINY); removeMemberBtn.addClickListener(modifyBtnClickListener); hlayout.addComponent(removeMemberBtn); if (!position.equals("Member")) { editPositionBtn.setEnabled(false); removeMemberBtn.setEnabled(false); } table.addItem(new Object[] { tt.getFacultyId(), tt.getName(), position, hlayout }, i); i++; } table.setPageLength(table.size()); return table; }
From source file:com.etest.view.systemadministration.SemestralTeam.RemoveSemestralTeamWindow.java
public RemoveSemestralTeamWindow(int teamTeachId) { this.teamTeachId = teamTeachId; setCaption("DELETE WINDOW"); setWidth("270px"); setModal(true);//from ww w . java2s . co m center(); VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull(); vlayout.setMargin(true); Button removeBtn = new Button("REMOVE SEMESTRAL TEAM?"); removeBtn.setWidth("100%"); removeBtn.setIcon(FontAwesome.TRASH_O); removeBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); removeBtn.addStyleName(ValoTheme.BUTTON_SMALL); removeBtn.addClickListener((Button.ClickEvent event) -> { boolean result = tts.removeSemestralTeam(getTeamTeachId()); if (result) { close(); } }); removeBtn.setImmediate(true); vlayout.addComponent(removeBtn); setContent(vlayout); getContent().setHeightUndefined(); }
From source file:com.etest.view.systemadministration.SemestralTeamUI.java
void populateDataTable() { table.removeAllItems();//from w w w.java 2 s. c o m int i = 0; for (TeamTeach tt : tts.getAllSemestralTeamTeach()) { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button membersBtn = new Button(); membersBtn.setWidth("100%"); membersBtn.setData(tt.getTeamTeachId()); if (tts.countTeamMembers(tt.getTeamTeachId()) < 2) { membersBtn.setCaption("add"); membersBtn.setIcon(FontAwesome.USER); } else { membersBtn.setCaption("view"); membersBtn.setIcon(FontAwesome.USERS); } Button removeTLBtn = new Button("del"); removeTLBtn.setWidth("100%"); removeTLBtn.setIcon(FontAwesome.TRASH_O); removeTLBtn.setData(tt.getTeamTeachId()); hlayout.addComponent(membersBtn); hlayout.addComponent(removeTLBtn); table.addItem(new Object[] { tt.getSchoolYear(), CommonVariableMap.getNormCourseOffering(tt.getNormCourseOffering()), CommonVariableMap.getYearLevel(tt.getYearLevel()), tt.getSubject(), tt.getTeamLeader(), hlayout }, i); i++; membersBtn.addStyleName(ValoTheme.BUTTON_LINK); membersBtn.addStyleName(ValoTheme.BUTTON_TINY); membersBtn.addClickListener(modifyBtnListener); removeTLBtn.addStyleName(ValoTheme.BUTTON_LINK); removeTLBtn.addStyleName(ValoTheme.BUTTON_TINY); removeTLBtn.addClickListener(modifyBtnListener); } table.setPageLength(table.size()); }
From source file:com.etest.view.systemadministration.syllabus.SyllabusFormWindow.java
Component buildSyllabusForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/* w w w .ja va 2 s . c om*/ subjects.setCaption("Subject: "); subjects.setWidth("50%"); subjects.setIcon(FontAwesome.BOOK); subjects.addStyleName(ValoTheme.COMBOBOX_SMALL); form.addComponent(subjects); topicNo.setCaption("Topic No: "); topicNo.setWidth("50%"); topicNo.setIcon(FontAwesome.TAG); topicNo.addStyleName(ValoTheme.TEXTFIELD_SMALL); form.addComponent(topicNo); topic.setCaption("Topic: "); topic.setWidth("100%"); topic.setIcon(FontAwesome.TAG); topic.setInputPrompt("Enter Topic.."); topic.setRows(3); topic.addStyleName(ValoTheme.TEXTAREA_SMALL); form.addComponent(topic); estimatedTime.setCaption("Estimated Time: "); estimatedTime.setWidth("50%"); estimatedTime.setIcon(FontAwesome.TAG); estimatedTime.addStyleName(ValoTheme.TEXTFIELD_SMALL); form.addComponent(estimatedTime); Button save = new Button("SAVE"); save.setWidth("50%"); save.setIcon(FontAwesome.SAVE); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addStyleName(ValoTheme.BUTTON_SMALL); save.addClickListener(buttonClickListener); Button update = new Button("UPDATE"); update.setWidth("60%"); update.setIcon(FontAwesome.PENCIL); update.addStyleName(ValoTheme.BUTTON_PRIMARY); update.addStyleName(ValoTheme.BUTTON_SMALL); update.addClickListener(buttonClickListener); Button remove = new Button("REMOVE"); remove.setWidth("60%"); remove.setIcon(FontAwesome.TRASH_O); remove.addStyleName(ValoTheme.BUTTON_PRIMARY); remove.addStyleName(ValoTheme.BUTTON_SMALL); remove.addClickListener(buttonClickListener); if (getSyllabusId() != 0) { s = ss.getSyllabusById(syllabusId); subjects.setValue(s.getCurriculumId()); topicNo.setValue(String.valueOf(s.getTopicNo())); estimatedTime.setValue(String.valueOf(s.getEstimatedTime())); topic.setValue(s.getTopic()); if (getButtonCaption().equals("edit")) { form.addComponent(update); } else { form.addComponent(remove); } } else { form.addComponent(save); } return form; }
From source file:com.etest.view.systemadministration.syllabus.SyllabusMainUI.java
Table populateDataTable() { table.removeAllItems();/* w w w . j av a2 s . c o m*/ int i = 0; for (Syllabus s : ss.getAllSyllabus()) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button edit = new Button("edit"); edit.setWidthUndefined(); edit.setData(s.getSyllabusId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(buttonClickListener); v.addComponent(edit); Button delete = new Button("del"); delete.setWidthUndefined(); delete.setData(s.getSyllabusId()); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(buttonClickListener); v.addComponent(delete); Label descriptiveTitle = new Label(s.getTopic(), ContentMode.HTML); descriptiveTitle.setStyleName("label-padding"); Label topic = new Label(s.getTopic(), ContentMode.HTML); topic.setStyleName("label-padding"); table.addItem(new Object[] { // s.getSyllabusId(), s.getSubject(), descriptiveTitle, s.getTopicNo(), topic, s.getEstimatedTime(), v }, i); i++; } table.setPageLength(table.size()); return table; }