private void addTreeItems( List<ModFunc> modFuncs, ObservableList<TreeItem<ModFunc>> modFuncTreeItems) { for (ModFunc modFunc : modFuncs) { if (!modFunc.isSynthetic()) { TreeItem<ModFunc> item = newFuncTreeItem(modFunc); modFuncTreeItems.add(item); } } }
private ArrayList<ModFunc> toModFuncs( OtpErlangAtom moduleNameAtom, OtpErlangList exportedFuncs, boolean isExported) { ArrayList<ModFunc> mfs = new ArrayList<>(); for (OtpErlangObject exported : exportedFuncs) { ModFunc modFunc = ModFunc.toFunc(moduleNameAtom, exported, isExported); mfs.add(modFunc); } return mfs; }
private void buildObjectTreeRoot(OtpErlangList requestFunctions) { boolean isExported; for (OtpErlangObject e : requestFunctions) { OtpErlangTuple tuple = (OtpErlangTuple) e; OtpErlangAtom moduleNameAtom = (OtpErlangAtom) tuple.elementAt(0); OtpErlangList exportedFuncs = (OtpErlangList) tuple.elementAt(1); OtpErlangList localFuncs = (OtpErlangList) tuple.elementAt(2); TreeItem<ModFunc> moduleItem; moduleItem = new TreeItem<ModFunc>(ModFunc.toModule(moduleNameAtom)); moduleItem.setGraphic(treeIcon(AwesomeIcon.CUBE)); ObservableList<TreeItem<ModFunc>> modFuncs = FXCollections.observableArrayList(); SortedList<TreeItem<ModFunc>> sortedFuncs = new SortedList<TreeItem<ModFunc>>(modFuncs); FilteredList<TreeItem<ModFunc>> filteredFuncs = new FilteredList<TreeItem<ModFunc>>(sortedFuncs); sortedFuncs.setComparator(treeItemModFuncComparator()); isExported = true; addTreeItems(toModFuncs(moduleNameAtom, exportedFuncs, isExported), modFuncs); isExported = false; addTreeItems(toModFuncs(moduleNameAtom, localFuncs, isExported), modFuncs); functionLists.add(filteredFuncs); Bindings.bindContentBidirectional(moduleItem.getChildren(), filteredFuncs); treeModules.add(moduleItem); } TreeItem<ModFunc> root; root = new TreeItem<ModFunc>(); root.setExpanded(true); Bindings.bindContentBidirectional(root.getChildren(), filteredTreeModules); modulesTree.setRoot(root); }