public FileTreePane() { loadDynamicComponentFxml(FileTreePane.class, this); rootFileTreeItem = new RootFileTreeItem(this); // The root here is *not* the real root of the file system and should be hidden, because // (1) we might want to have 'virtual' visible roots like "Home", "Desktop", "Drives" and // (2) even if we displayed only the real file system without any shortcuts like "Desktop", // we'd still have multiple roots on a crappy pseudo-OS like Windows still having these shitty // drive letters. treeTableView.setShowRoot(false); treeTableView.setRoot(rootFileTreeItem); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); treeTableView .getSelectionModel() .selectedItemProperty() .addListener( (ChangeListener<TreeItem<FileTreeItem<?>>>) (observable, o, n) -> updateSelectedFiles()); treeTableView .getSelectionModel() .getSelectedItems() .addListener((InvalidationListener) observable -> updateSelectedFiles()); selectedFiles.addListener(selectedFilesChangeListener); showHiddenFilesCheckBox.selectedProperty().bindBidirectional(showHiddenFilesProperty); // TODO remove the following line - preferably replace by proper, use-case-dependent management! selectedFiles.add(IOUtil.getUserHome()); updateDisable(); }
/** * Add a buyer to the registry as they enter the market * * @param buyer buyer entering the market */ public void registerBuyer(EconomicAgent buyer) { boolean isNew = buyers.add(buyer); // addSalesDepartmentListener it to the set assert isNew; // make sure it wasn't there before! // record it, if necessary if (MacroII.hasGUI()) { // todo logtodo network.addAgent(buyer); } }
@Test public void mirroredSet() throws Exception { ObservableSet<String> source = FXCollections.observableSet(); source.add("alpha"); source.add("beta"); ObservableSet<String> dest = ObservableMirrors.mirrorSet(source, gate); assertEquals(0, gate.getTaskQueueSize()); assertEquals(2, dest.size()); source.add("delta"); assertEquals(1, gate.getTaskQueueSize()); assertEquals(2, dest.size()); gate.waitAndRun(); assertEquals(0, gate.getTaskQueueSize()); assertEquals(3, dest.size()); source.removeAll(ImmutableList.of("alpha", "beta")); assertEquals(2, gate.getTaskQueueSize()); gate.waitAndRun(); gate.waitAndRun(); assertEquals(1, dest.size()); assertTrue(dest.contains("delta")); }