List of usage examples for com.vaadin.server FontAwesome FOLDER
FontAwesome FOLDER
To view the source code for com.vaadin.server FontAwesome FOLDER.
Click Source Link
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);/*from ww w. jav a2 s. c om*/ 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);/* ww w . j a v a 2 s . com*/ 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.wintindustries.pfserver.interfaces.container.PFFolderContainer.java
private static void recursivlyCreateTree(HierarchicalContainer container, PFFolder parent, PFFolder child) { Item childFolder = container.addItem(child); container.getContainerProperty(child, "Name").setValue(child.getName()); container.getContainerProperty(child, "Icon").setValue(FontAwesome.FOLDER); container.getContainerProperty(child, "IsFolder").setValue(true); //childFolder.addItemProperty("Name", new ObjectProperty(child.getName(), String.class)); //childFolder.addItemProperty("icon", new ObjectProperty(FontAwesome.FOLDER,Resource.class)); //childFolder.addItemProperty("name", ) // childFolder. if (parent != null) container.setParent(child, parent); container.setChildrenAllowed(child, true); // now add in files if (child.getDocuments() != null) { for (PFFile file : child.getDocuments()) { // container.addItem(file.g) }//from w w w.j ava 2 s. c o m } for (PFFolder folder : child.getFolders()) { recursivlyCreateTree(container, child, folder); } }
From source file:com.wintindustries.pfserver.interfaces.container.PFFolderProxyContainer.java
private static void recursivlyCreateTree(HierarchicalContainer container, PFFolder parent, PFFolderProxy parentProxy, PFFolder child, PFDataSource source) { System.out.println("HEARTBEAT"); PFFolderProxy childproxy = new PFFolderProxy(child, source); Item childFolder = container.addItem(childproxy); container.getContainerProperty(childproxy, "Name").setValue(childproxy.getName()); container.getContainerProperty(childproxy, "Icon").setValue(FontAwesome.FOLDER); container.getContainerProperty(childproxy, "IsFolder").setValue(true); //childFolder.addItemProperty("Name", new ObjectProperty(child.getName(), String.class)); //childFolder.addItemProperty("icon", new ObjectProperty(FontAwesome.FOLDER,Resource.class)); //childFolder.addItemProperty("name", ) // childFolder. if (parent != null) container.setParent(childproxy, parentProxy); container.setChildrenAllowed(childproxy, true); // now add in files System.out.println(source.getDatabase().getSessionManager()); source.Session().getSession().refresh(child); Hibernate.initialize(child);/*from w ww . j a v a 2 s. c o m*/ if (child.getDocuments() != null) { System.out.println("Folder name : " + child.getName()); for (PFFile file : child.getDocuments()) { // container.addItem(file.g) } } for (PFFolder folder : child.getFolders()) { recursivlyCreateTree(container, child, childproxy, folder, source); } }
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 www . j a va 2s . c o m*/ 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.jumpmind.metl.ui.views.DeployNavigator.java
License:Open Source License
protected void addChildren(Folder folder) { if (folder.getParent() != null) { treeTable.setChildrenAllowed(folder.getParent(), true); }// w ww. j a v a2 s . com treeTable.addItem(folder); treeTable.setItemIcon(folder, FontAwesome.FOLDER); treeTable.setCollapsed(folder, true); treeTable.setChildrenAllowed(folder, false); if (folder.getParent() != null) { treeTable.setParent(folder, folder.getParent()); } List<Folder> children = folder.getChildren(); for (Folder child : children) { addChildren(child); } List<AgentName> agents = context.getConfigurationService().findAgentsInFolder(folder); for (AgentName agent : agents) { addAgent(folder, agent); } }
From source file:org.jumpmind.metl.ui.views.ManageNavigator.java
License:Open Source License
public void refresh() { Object selected = treeTable.getValue(); List<Object> expandedItems = new ArrayList<Object>(); Collection<?> items = treeTable.getItemIds(); for (Object object : items) { if (!treeTable.isCollapsed(object)) { expandedItems.add(object);//ww w .jav a 2s .com } } treeTable.removeAllItems(); treeTable.addItem(agentsFolder); treeTable.setItemIcon(agentsFolder, FontAwesome.FOLDER); List<Folder> folders = context.getConfigurationService().findFolders(null, FolderType.AGENT); for (Folder folder : folders) { addChildFolder(folder, agentsFolder); } treeTable.addItem(flowsFolder); treeTable.setItemIcon(flowsFolder, FontAwesome.FOLDER); addFlowsToFolder(flowsFolder); for (Object object : expandedItems) { treeTable.setCollapsed(object, false); } treeTable.focus(); if (treeTable.containsId(selected)) { treeTable.setValue(selected); } }
From source file:org.jumpmind.metl.ui.views.ManageNavigator.java
License:Open Source License
protected void addChildFolder(Folder folder, AbstractObject root) { treeTable.addItem(folder);// w w w.ja v a 2s . co m treeTable.setItemIcon(folder, FontAwesome.FOLDER); treeTable.setCollapsed(folder, true); if (folder.getParent() != null) { treeTable.setParent(folder, folder.getParent()); } else { treeTable.setParent(folder, root); } List<Folder> children = folder.getChildren(); for (Folder child : children) { addChildFolder(child, root); } if (folder.getFolderType() == FolderType.AGENT) { addAgentsToFolder(folder); } }
From source file:org.jumpmind.metl.ui.views.ManageNavigator.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 .java 2 s . c o m table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setEditable(false); table.setContainerDataSource(new BeanItemContainer<AbstractObject>(AbstractObject.class)); table.setVisibleColumns(new Object[] { "name" }); table.setColumnExpandRatio("name", 1); table.addItemClickListener(new ItemClickListener() { public void itemClick(ItemClickEvent event) { if (event.getButton() == MouseButton.LEFT) { if (event.isDoubleClick()) { if (treeTable.hasChildren(event.getItemId())) { treeTable.setCollapsed(event.getItemId(), !treeTable.isCollapsed(event.getItemId())); } } } } }); table.addCollapseListener(new CollapseListener() { public void nodeCollapse(CollapseEvent event) { if (event.getItemId() instanceof Folder) { table.setItemIcon(event.getItemId(), FontAwesome.FOLDER); } } }); table.setCellStyleGenerator(new CellStyleGenerator() { 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();/*from w w w . ja va2 s. co 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(); }