use of de.unijena.cheminf.mortar.gui.views.MoleculesDataTableView in project MORTAR by FelixBaensch.
the class MainViewController method openMoleculesTab.
//
/**
* Opens molecules tab
*/
private void openMoleculesTab() {
this.moleculesDataTableView = new MoleculesDataTableView();
this.moleculesDataTableView.setItemsList(this.moleculeDataModelList);
GridTabForTableView tmpMoleculesTab = new GridTabForTableView(Message.get("MainTabPane.moleculesTab.title"), TabNames.Molecules.name(), this.moleculesDataTableView);
this.mainTabPane.getTabs().add(tmpMoleculesTab);
int tmpRowsPerPage = this.settingsContainer.getRowsPerPageSetting();
int tmpPageCount = this.moleculeDataModelList.size() / tmpRowsPerPage;
if (this.moleculeDataModelList.size() % tmpRowsPerPage > 0) {
tmpPageCount++;
}
Pagination tmpPagination = new Pagination(tmpPageCount, 0);
tmpPagination.setPageFactory((pageIndex) -> this.moleculesDataTableView.createMoleculeTableViewPage(pageIndex, this.settingsContainer));
VBox.setVgrow(tmpPagination, Priority.ALWAYS);
HBox.setHgrow(tmpPagination, Priority.ALWAYS);
tmpMoleculesTab.addPaginationToGridPane(tmpPagination, 0, 0, 2, 2);
this.fragmentationButton = new Button(Message.get("MainTabPane.moleculesTab.fragmentButton.text"));
ButtonBar tmpButtonBar = new ButtonBar();
tmpButtonBar.setPadding(new Insets(0, 0, 0, 0));
this.fragmentationButton.setPrefWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.fragmentationButton.setMinWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.fragmentationButton.setMaxWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.fragmentationButton.setPrefHeight(GuiDefinitions.GUI_BUTTON_HEIGHT_VALUE);
tmpButtonBar.getButtons().add(this.fragmentationButton);
tmpButtonBar.setButtonMinWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
Label tmpLabel = new Label();
tmpLabel.textProperty().bind(this.fragmentationService.selectedFragmenterNamePropertyProperty());
Tooltip tmpTooltip = new Tooltip();
tmpTooltip.textProperty().bind(this.fragmentationService.selectedFragmenterNamePropertyProperty());
tmpLabel.setTooltip(tmpTooltip);
HBox.setHgrow(tmpLabel, Priority.ALWAYS);
tmpButtonBar.getButtons().add(tmpLabel);
this.cancelFragmentationButton = new Button(Message.get("MainTabPane.moleculesTab.cancelFragmentationButton.text"));
this.cancelFragmentationButton.setTooltip(new Tooltip(Message.get("MainTabPane.moleculesTab.cancelFragmentationButton.tooltip")));
this.cancelFragmentationButton.setPrefWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.cancelFragmentationButton.setMinWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.cancelFragmentationButton.setMaxWidth(GuiDefinitions.GUI_BUTTON_WIDTH_VALUE);
this.cancelFragmentationButton.setPrefHeight(GuiDefinitions.GUI_BUTTON_HEIGHT_VALUE);
this.cancelFragmentationButton.setVisible(false);
tmpButtonBar.getButtons().add(this.cancelFragmentationButton);
tmpMoleculesTab.addNodeToGridPane(tmpButtonBar, 0, 1, 1, 1);
this.fragmentationButton.setOnAction(event -> {
this.startFragmentation();
});
this.cancelFragmentationButton.setOnAction(event -> {
this.interruptFragmentation();
});
this.moleculesDataTableView.addTableViewHeightListener(this.settingsContainer);
this.moleculesDataTableView.getCopyMenuItem().setOnAction(event -> GuiUtil.copySelectedTableViewCellsToClipboard(this.moleculesDataTableView));
this.moleculesDataTableView.setOnKeyPressed(event -> {
if (GuiDefinitions.KEY_CODE_COPY.match(event)) {
GuiUtil.copySelectedTableViewCellsToClipboard(this.moleculesDataTableView);
}
});
this.moleculesDataTableView.setOnSort((EventHandler<SortEvent<TableView>>) event -> {
GuiUtil.sortTableViewGlobally(event, tmpPagination, tmpRowsPerPage);
});
}
Aggregations