List of usage examples for com.vaadin.server FontAwesome FOLDER_OPEN
FontAwesome FOLDER_OPEN
To view the source code for com.vaadin.server FontAwesome FOLDER_OPEN.
Click Source Link
From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private Layout displayFolderBlock(final Folder resource) { MHorizontalLayout container = new MHorizontalLayout().withWidth("100%").withStyleName("page-item-block"); FontIconLabel iconResource = new FontIconLabel(FontAwesome.FOLDER_OPEN); iconResource.addStyleName("icon-48px"); VerticalLayout block = new VerticalLayout(); block.setWidth("600px"); HorizontalLayout headerPanel = new HorizontalLayout(); Button folderLink = new Button(resource.getName(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww. ja va 2 s.c o m public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance() .post(new PageEvent.GotoList(PageListViewImpl.this, resource.getPath())); } }); folderLink.addStyleName("link"); folderLink.addStyleName("h3"); headerPanel.addComponent(folderLink); block.addComponent(headerPanel); block.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription()))); Label lastUpdateInfo = new Label(AppContext.getMessage(Page18InEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(resource.getCreatedUser(), CurrentProjectVariables.getProjectId()), AppContext.formatDateTime(resource.getCreatedTime().getTime())), ContentMode.HTML); lastUpdateInfo.addStyleName("last-update-info"); block.addComponent(lastUpdateInfo); MHorizontalLayout controlBtns = new MHorizontalLayout().withStyleName("control-btns"); Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = -5387015552598157076L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new PageGroupWindow(resource)); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName("link"); editBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); controlBtns.addComponent(editBtn); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = -5387015552598157076L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), 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()) { PageService wikiService = ApplicationContextUtil .getSpringBean(PageService.class); wikiService.removeResource(resource.getPath()); resources.remove(resource); displayPages(resources); } } }); } }); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES)); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName("link"); controlBtns.addComponent(deleteBtn); block.addComponent(controlBtns); HorizontalLayout footer = new HorizontalLayout(); block.addComponent(footer); MHorizontalLayout wrapper = new MHorizontalLayout(); wrapper.with(iconResource, block); container.with(wrapper); return container; }
From source file:com.mycollab.module.file.view.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout(); new Restrain(contentLayout).setMaxHeight("600px"); this.setContent(contentLayout); folderTree = new Tree(); folderTree.setMultiSelect(false);/*w w w . java 2 s . c o m*/ folderTree.setSelectable(true); folderTree.setImmediate(true); folderTree.setSizeFull(); folderTree.addExpandListener(expandEvent -> { final Folder expandFolder = (Folder) expandEvent.getItemId(); // load externalResource if currentExpandFolder is rootFolder if (baseFolder.getPath().equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(UserUIContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); folderTree.addItem(externalMapFolder); folderTree.setItemIcon(externalMapFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService .getSubFolders(((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(subFolder, subFolder.getName()); folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = resourceService.getSubFolders(expandFolder.getPath()); folderTree.setItemIcon(expandFolder, FontAwesome.FOLDER_OPEN); if (subFolders != null) { for (final Folder subFolder : subFolders) { String subFolderName = subFolder.getName(); if (!subFolderName.startsWith(".")) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.FOLDER); folderTree.setItemCaption(subFolder, subFolderName); folderTree.setParent(subFolder, expandFolder); } } } } }); folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { folderTree.setItemIcon(collapseFolder, FontAwesome.DROPBOX); } else { folderTree.setItemIcon(collapseFolder, FontAwesome.FOLDER); } collapseFolder.getChilds().forEach(this::recursiveRemoveSubItem); } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childFolders = collapseFolder.getChilds(); if (childFolders.size() > 0) { childFolders.forEach(this::recursiveRemoveSubItem); folderTree.removeItem(collapseFolder); } else { folderTree.removeItem(collapseFolder); } } }); folderTree.addItemClickListener(itemClickEvent -> baseFolder = (Folder) itemClickEvent.getItemId()); CssLayout treeWrapper = new CssLayout(folderTree); treeWrapper.setSizeFull(); contentLayout.addComponent(treeWrapper); displayFiles(); MButton moveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MOVE), clickEvent -> { if (!CollectionUtils.isEmpty(movedResources)) { boolean checkingFail = false; for (Resource res : movedResources) { try { resourceMover.moveResource(res, baseFolder, UserUIContext.getUsername(), MyCollabUI.getAccountId()); } catch (Exception e) { checkingFail = true; LOG.error("Error", e); } } close(); displayAfterMoveSuccess(baseFolder, checkingFail); } }).withIcon(FontAwesome.ARROWS).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(cancelBtn, moveBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout(); new Restrain(contentLayout).setMaxHeight("600px"); this.setContent(contentLayout); folderTree = new Tree(); folderTree.setMultiSelect(false);/*from w w w.j av a2 s . co m*/ folderTree.setSelectable(true); folderTree.setImmediate(true); folderTree.setSizeFull(); folderTree.addExpandListener(new Tree.ExpandListener() { private static final long serialVersionUID = 1L; @Override public void nodeExpand(final ExpandEvent event) { final Folder expandFolder = (Folder) event.getItemId(); // load externalResource if currentExpandFolder is rootFolder if (baseFolder.getPath().equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(AppContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); folderTree.addItem(externalMapFolder); folderTree.setItemIcon(externalMapFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService.getSubFolders( ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(subFolder, subFolder.getName()); folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = resourceService.getSubFolders(expandFolder.getPath()); folderTree.setItemIcon(expandFolder, FontAwesome.FOLDER_OPEN); if (subFolders != null) { for (final Folder subFolder : subFolders) { String subFolderName = subFolder.getName(); if (!subFolderName.startsWith(".")) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.FOLDER); folderTree.setItemCaption(subFolder, subFolderName); folderTree.setParent(subFolder, expandFolder); } } } } } }); folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { folderTree.setItemIcon(collapseFolder, FontAwesome.DROPBOX); } else { folderTree.setItemIcon(collapseFolder, FontAwesome.FOLDER); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childFolders = collapseFolder.getChilds(); if (childFolders.size() > 0) { for (Folder subFolder : childFolders) { recursiveRemoveSubItem(subFolder); } folderTree.removeItem(collapseFolder); } else { folderTree.removeItem(collapseFolder); } } }); folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { baseFolder = (Folder) event.getItemId(); } }); CssLayout treeWrapper = new CssLayout(folderTree); treeWrapper.setSizeFull(); contentLayout.addComponent(treeWrapper); displayFiles(); MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (!CollectionUtils.isEmpty(movedResources)) { boolean checkingFail = false; for (Resource res : movedResources) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; LOG.error("Error", e); } } close(); displayAfterMoveSuccess(baseFolder, checkingFail); } } }); moveBtn.setIcon(FontAwesome.ARROWS); moveBtn.addStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); controlGroupBtnLayout.with(cancelBtn, moveBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private Layout displayFolderBlock(final Folder resource) { MVerticalLayout container = new MVerticalLayout().withFullWidth().withStyleName("page-item-block"); A folderHtml = new A(ProjectLinkBuilder.generatePageFolderFullLink(CurrentProjectVariables.getProjectId(), resource.getPath())).appendText(FontAwesome.FOLDER_OPEN.getHtml() + " " + resource.getName()); ELabel folderLink = ELabel.h3(folderHtml.write()); container.addComponent(folderLink);//from ww w .ja v a2s . c o m if (StringUtils.isNotBlank(resource.getDescription())) { container.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription()))); } Label lastUpdateInfo = new ELabel(UserUIContext.getMessage(PageI18nEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(CurrentProjectVariables.getProjectId(), resource.getCreatedUser(), true), UserUIContext.formatPrettyTime(resource.getCreatedTime().getTime())), ContentMode.HTML) .withDescription(UserUIContext.formatDateTime(resource.getCreatedTime().getTime())); lastUpdateInfo.addStyleName(UIConstants.META_INFO); container.addComponent(lastUpdateInfo); MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new GroupPageAddWindow(resource))) .withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING) .withIcon(FontAwesome.EDIT); editBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), 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()) { PageService pageService = AppContextUtil.getSpringBean(PageService.class); pageService.removeResource(resource.getPath()); resources.remove(resource); displayPages(resources); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING); deleteBtn.setVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES)); container.addComponent(new MHorizontalLayout(editBtn, deleteBtn)); return container; }
From source file:org.jumpmind.metl.ui.views.DeployNavigator.java
License:Open Source License
protected TreeTable buildTreeTable() { final TreeTable table = new TreeTable(); table.addStyleName(ValoTheme.TREETABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TREETABLE_NO_STRIPES); table.addStyleName(ValoTheme.TREETABLE_NO_VERTICAL_LINES); table.addStyleName(ValoTheme.TREETABLE_BORDERLESS); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSizeFull();/*from w w w .j a v a2s . c om*/ table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setEditable(true); table.setContainerDataSource(new BeanItemContainer<AbstractObject>(AbstractObject.class)); table.setTableFieldFactory(new DefaultFieldFactory() { @Override public Field<?> createField(Container container, Object itemId, Object propertyId, Component uiContext) { return buildEditableNavigatorField(itemId); } }); table.setVisibleColumns(new Object[] { "name" }); table.setColumnExpandRatio("name", 1); table.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { lastSelected = getSelectedValue(); selectionChanged(event); } }); table.addItemClickListener(new ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { if (event.getButton() == MouseButton.LEFT) { if (event.isDoubleClick()) { abortEditingItem(); openItem(event.getItemId()); if (table.areChildrenAllowed(event.getItemId())) { Object item = event.getItemId(); table.setCollapsed(item, !table.isCollapsed(item)); } } } } }); table.addCollapseListener(new CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(CollapseEvent event) { if (event.getItemId() instanceof Folder) { table.setItemIcon(event.getItemId(), FontAwesome.FOLDER); } } }); table.addExpandListener(new ExpandListener() { private static final long serialVersionUID = 1L; @Override public void nodeExpand(ExpandEvent event) { if (event.getItemId() instanceof Folder) { Folder folder = (Folder) event.getItemId(); table.setItemIcon(folder, FontAwesome.FOLDER_OPEN); } } }); table.setCellStyleGenerator(new CellStyleGenerator() { private static final long serialVersionUID = 1L; @Override public String getStyle(Table source, Object itemId, Object propertyId) { if (itemId instanceof Folder && "name".equals(propertyId)) { return "folder"; } else { return null; } } }); return table; }
From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceMainLayout.java
License:Open Source License
public BusinessServiceMainLayout(BusinessServiceManager businessServiceManager) { m_businessServiceManager = Objects.requireNonNull(businessServiceManager); m_table = new BusinessServiceTreeTable(businessServiceManager); setSizeFull();// www .j av a 2 s. c o m // Create button final Button createButton = UIHelper.createButton("New Business Service", null, FontAwesome.PLUS_SQUARE, (Button.ClickListener) event -> { final BusinessService businessService = m_businessServiceManager.createBusinessService(); final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService, m_businessServiceManager); window.addCloseListener(e -> m_table.refresh()); getUI().addWindow(window); }); createButton.setId("createButton"); // Collapse all final Button collapseButton = UIHelper.createButton("Collapse All", null, FontAwesome.FOLDER, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, true)); }); collapseButton.setId("collapseButton"); // Expand all final Button expandButton = UIHelper.createButton("Expand All", null, FontAwesome.FOLDER_OPEN, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, false)); }); expandButton.setId("expandButton"); // Refresh final Button refreshButton = UIHelper.createButton("Refresh Table", null, FontAwesome.REFRESH, (Button.ClickListener) event -> { m_table.refresh(); }); refreshButton.setId("refreshButton"); // Reload daemon final Button reloadButton = UIHelper.createButton("Reload Daemon", "Reloads the Business Service State Machine", FontAwesome.RETWEET, (Button.ClickListener) event -> { m_businessServiceManager.triggerDaemonReload(); }); reloadButton.setId("reloadButton"); // Group the create and collapse buttons on the left HorizontalLayout leftButtonGroup = new HorizontalLayout(); leftButtonGroup.setSpacing(true); leftButtonGroup.addComponent(createButton); leftButtonGroup.addComponent(collapseButton); leftButtonGroup.addComponent(expandButton); leftButtonGroup.setDefaultComponentAlignment(Alignment.TOP_LEFT); // Group the refresh and reload buttons to the right HorizontalLayout rightButtonGroup = new HorizontalLayout(); rightButtonGroup.setSpacing(true); rightButtonGroup.addComponent(refreshButton); rightButtonGroup.addComponent(reloadButton); rightButtonGroup.setDefaultComponentAlignment(Alignment.TOP_RIGHT); // Build the upper layout HorizontalLayout upperLayout = new HorizontalLayout(); upperLayout.setSpacing(true); upperLayout.addComponent(leftButtonGroup); upperLayout.addComponent(rightButtonGroup); upperLayout.setComponentAlignment(leftButtonGroup, Alignment.TOP_LEFT); upperLayout.setComponentAlignment(rightButtonGroup, Alignment.TOP_RIGHT); upperLayout.setWidth(100, Unit.PERCENTAGE); addComponent(upperLayout); // Add some space between the upper layout and the table Label sz = new Label(""); sz.setWidth(null); sz.setHeight(5, Unit.PIXELS); addComponent(sz); /** * add the table to the layout */ addComponent(m_table); setExpandRatio(m_table, 1.0f); /** * initial refresh of table */ m_table.refresh(); }