List of usage examples for javafx.scene.control Tab isClosable
public final boolean isClosable()
From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java
private void selectedDataSetsChanged() { List<FXDataSetWrapper> dataSets = listViewDataSets.getSelectionModel().getSelectedItems(); Map<FXDataSetWrapper, DataSetView> currentListOfViews = getListOfOpenDataSetViewsForAnalysis(); Map<FXDataSetWrapper, DataSetView> newMap = new HashMap<>(); if (currentListOfViews == null) currentListOfViews = new LinkedHashMap<>(); //TODO Rework that. Close all dataset tabs. Not more Tag them with Common / Project / Dataset? for (int i = appTabs.getTabs().size() - 1; i > 0; i--) { Tab appTab = appTabs.getTabs().get(i); if (appTab.isClosable()) appTabs.getTabs().remove(appTab); }//from w w w . ja v a 2 s.c o m activeDataSetViews.clear(); for (FXDataSetWrapper dsw : dataSets) { if (dsw == null) continue; //This case can occur, if the analysis changed. Then dsw can be null which leads to an exception.. if (currentListOfViews.containsKey(dsw)) { newMap.put(dsw, currentListOfViews.get(dsw)); } else { DataSetView dsv = new DataSetView(currentAnalysis, dsw); newMap.put(dsw, dsv); } } List<FXDataSetWrapper> keysSorted = new LinkedList<>(newMap.keySet()); Collections.sort(keysSorted); for (FXDataSetWrapper dsw : keysSorted) { addTab(newMap.get(dsw), dsw.getId(), TabType.Dataset, true); } synchronized (openDataSetViews) { openDataSetViews.put(currentAnalysis, newMap); } appTabs.getSelectionModel().select(1); }