public SimpleNode[] getChildren() { final List<SimpleNode> nodes = new ArrayList<SimpleNode>(myBuffer.size()); for (final OfbizFileSet entry : myBuffer) { if (!entry.isRemoved()) { final FileSetNode setNode = new FileSetNode(entry); nodes.add(setNode); } } return ArrayUtil.toObjectArray(nodes, SimpleNode.class); }
FileSetNode(final OfbizFileSet fileSet) { mySet = fileSet; final PresentationData presentationData = getPresentation(); final String name = mySet.getName(); if (fileSet.getFiles().isEmpty()) { presentationData.addText(name, getErrorAttributes()); presentationData.setTooltip("No files attached"); } else { presentationData.addText(name, getPlainAttributes()); presentationData.setLocationString("" + fileSet.getFiles().size()); } }
public SimpleNode[] getChildren() { final List<SimpleNode> nodes = new ArrayList<SimpleNode>(); for (final VirtualFilePointer file : mySet.getFiles()) { nodes.add(new ConfigFileNode(file, this)); } return ArrayUtil.toObjectArray(nodes, SimpleNode.class); }
private void remove() { final SimpleNode[] nodes = myTree.getSelectedNodesIfUniform(); for (final SimpleNode node : nodes) { if (node instanceof FileSetNode) { final OfbizFileSet fileSet = ((FileSetNode) node).mySet; if (fileSet.getFiles().isEmpty()) { myBuffer.remove(fileSet); return; } final int result = Messages.showYesNoDialog( myPanel, String.format("Remove File Set '%s' ?", fileSet.getName()), "Confirm removal", Messages.getQuestionIcon()); if (result == DialogWrapper.OK_EXIT_CODE) { if (fileSet.isAutodetected()) { fileSet.setRemoved(true); myBuffer.add(fileSet); } else { myBuffer.remove(fileSet); } } } else if (node instanceof ConfigFileNode) { final VirtualFilePointer filePointer = ((ConfigFileNode) node).myFilePointer; final OfbizFileSet fileSet = ((FileSetNode) node.getParent()).mySet; fileSet.removeFile(filePointer); } } }
public Object[] getEqualityObjects() { return new Object[] {mySet, mySet.getName(), mySet.getFiles()}; }