public void addFile(final Path child) { checkCleanupLoading(); // Util.getHeaderSafeHtml( images.file(), child.getFileName() ) final TreeItem newFile = parent.addItem(TreeItem.Type.ITEM, child.getFileName()); newFile.setUserObject(child); }
public void addDirectory(final Path child) { checkCleanupLoading(); // Util.getHeaderSafeHtml( images.openedFolder(), child.getFileName() ) final TreeItem newDirectory = parent.addItem(TreeItem.Type.FOLDER, child.getFileName()); newDirectory.addItem(TreeItem.Type.LOADING, LAZY_LOAD); newDirectory.setUserObject(child); }
private void checkCleanupLoading() { if (parent.getChild(0) != null && parent.getChild(0).getUserObject() == null) { parent.getChild(0).remove(); } }
private boolean needsLoading(final TreeItem item) { return item.getChildCount() == 1 && LAZY_LOAD.equals(item.getChild(0).getText()); }