com.jfoenix.controls.RecursiveTreeItem Java Examples
The following examples show how to use
com.jfoenix.controls.RecursiveTreeItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Simulator.java From Jupiter with GNU General Public License v3.0 | 6 votes |
/** Sets simulator text table. */ private void setSymbolTable() { ArrayList<String> symFiles = new ArrayList<String>(Globals.local.keySet()); Collections.sort(symFiles); ObservableList<SymbolItem> list = FXCollections.observableArrayList(); for (String file : symFiles) { list.add(new SymbolItem(FS.toFile(file))); ArrayList<SymbolItem> other = new ArrayList<>(); for (String name : Globals.local.get(file).labels()) { other.add(new SymbolItem(name, Globals.local.get(file).getSymbol(name).getAddress())); } Collections.sort(other); other.forEach(e -> list.add(e)); } Platform.runLater(() -> symbolTable.setRoot(new RecursiveTreeItem<>(list, RecursiveTreeObject::getChildren))); }
Example #2
Source File: Simulator.java From Jupiter with GNU General Public License v3.0 | 6 votes |
/** Updates cache organization. */ private void updateCacheOrganization() { Platform.runLater(() -> { blockSize.setText(String.format("%d", program.getState().memory().cache().getBlockSize())); numBlocks.setText(String.format("%d", program.getState().memory().cache().getNumBlocks())); assoc.setText(String.format("%d", program.getState().memory().cache().getAssociativity())); cacheSize.setText(String.format("%d", program.getState().memory().cache().getCacheSize())); ObservableList<CacheItem> clist = FXCollections.observableArrayList(); int size = program.getState().memory().cache().getNumBlocks(); for (int i = 0; i < size; i++) { CacheItem item = new CacheItem(i); program.getState().memory().cache().addObserver(item); clist.add(item); } accesses.setText("0"); hits.setText("0"); hitRate.setText("0.00"); cacheTable.setRoot(new RecursiveTreeItem<>(clist, RecursiveTreeObject::getChildren)); cacheTable.refresh(); }); }
Example #3
Source File: DetailPCController.java From FlyingAgent with Apache License 2.0 | 5 votes |
private void loadDataToNetworkTable(NetworkInformation networkInformation) { ObservableList<NetworkTable> networkTableData = FXCollections.observableArrayList(); /* This data add below just for testing */ for (Network network : networkInformation.getNetworkList()) { networkTableData.add(new NetworkTable(network.getName(), network.getIpAddress(), network.getMacAddress())); } TreeItem treeItem = new RecursiveTreeItem<>(networkTableData, RecursiveTreeObject::getChildren); try { tableNetwork.setRoot(treeItem); } catch (Exception e) { System.err.println("Exception in tree item of network table !"); } }
Example #4
Source File: JfxTableEditor.java From milkman with MIT License | 4 votes |
public void setItems(List<T> items, Comparator<T> comparator) { List<RecursiveWrapper<T>> wrappedItems = items.stream().map(i -> new RecursiveWrapper<>(i)).collect(Collectors.toList()); obsWrappedItems = FXCollections.observableList(wrappedItems); if (comparator != null) { FXCollections.sort(obsWrappedItems, (ra, rb) -> comparator.compare(ra.getData(), rb.getData())); } obsWrappedItems.addListener(new ListChangeListener<RecursiveWrapper<T>>() { @Override public void onChanged(Change<? extends RecursiveWrapper<T>> c) { //forward removals: if (!c.next()) return; if (c.wasRemoved()) { for(var ri : c.getRemoved()) { items.remove(ri.getData()); } } if (c.wasAdded()) { RecursiveWrapper<T> newEntry = c.getAddedSubList().get(0); items.add(newEntry.getData()); } } }); final TreeItem<RecursiveWrapper<T>> root = new RecursiveTreeItem<>(obsWrappedItems, RecursiveTreeObject::getChildren); table.setRoot(root); Platform.runLater(() -> { table.resizeColumns(); }); //register double-click listener for empty rows, to add a new instance // this.setRowFactory(view -> { // TableRow<T> row = new TableRow<T>(); // row.setOnMouseClicked(event -> { // if (row.isEmpty() && (event.getClickCount() == 2)) { // T myItem = newItemCreator.get(); // getItems().add(myItem); // } // }); // return row; // }); //we cant click on row if there is no row, so we have to register another event handler //for when the table is empty // this.setOnMouseClicked(event -> { // if (getItems().isEmpty() && (event.getClickCount() == 2)) { // T myItem = newItemCreator.get(); // getItems().add(myItem); // } // }); }
Example #5
Source File: Simulator.java From Jupiter with GNU General Public License v3.0 | 4 votes |
/** Sets simulator text table. */ private void setText() { tlist = FXCollections.observableArrayList(); int pc = Data.TEXT; for (Statement stmt : program.statements()) { int code = stmt.code().bits(); String basic = Globals.iset.get(stmt.mnemonic()).disassemble(stmt.code()); // get source line String source = null; File file = stmt.getFile(); int line = stmt.getLine(); if (line > 0) { try { // get source from file source = FS.getLine(file, line); // use basic code if necessary source = (source == null) ? basic : source; // remove comments source = source.replaceAll("[;#].*", ""); // normalize whitespace (tabs, spaces) source = source.replaceAll("( |\t)+", " "); // normalize commas source = source.replaceAll("( )?,( )?", ", "); // remove labels source = source.replaceAll("[a-zA-Z_]([a-zA-Z0-9_]*(\\.[a-zA-Z0-9_]+)?):", ""); // trim whitespace source = source.trim(); } catch (IOException e) { source = basic; } } else { source = basic; } boolean bkpt = basic.indexOf("ebreak") >= 0; StatementItem item = new StatementItem(bkpt, pc, code, basic, source); tlist.add(item); if (bkpt) { breakpoints.put(pc, true); } else { final int addr = pc; item.bkptProperty().addListener((e, o, n) -> { if (n) { breakpoints.put(addr, true); } else { breakpoints.remove(addr); } }); } pc += Data.WORD_LENGTH; } Platform.runLater(() -> textTable.setRoot(new RecursiveTreeItem<>(tlist, RecursiveTreeObject::getChildren))); }