Skip to content

Commit

Permalink
Merge pull request #99 from FelixBaensch/issue-84-column-swap
Browse files Browse the repository at this point in the history
Issue 84 column swap
  • Loading branch information
JonasSchaub authored Apr 30, 2024
2 parents 2bc3205 + 38a678e commit a92d428
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ private Tab createFragmentsTab(String aFragmentationName){
int tmpRowsPerPage = this.settingsContainer.getRowsPerPageSetting();
tmpFragmentsDataTableView.setOnSort((EventHandler<SortEvent<TableView>>) event -> GuiUtil.sortTableViewGlobally(event, tmpPagination, tmpRowsPerPage));
tmpFragmentsDataTableView.widthProperty().addListener((observable, oldValue, newValue) -> {
for(Object tmpObject : tmpFragmentsDataTableView.getItems()) {
for (Object tmpObject : tmpFragmentsDataTableView.getItems()) {
((MoleculeDataModel) tmpObject).setStructureImageWidth(tmpFragmentsDataTableView.getStructureColumn().getWidth());
((FragmentDataModel) tmpObject).getFirstParentMolecule().setStructureImageWidth(tmpFragmentsDataTableView.getParentMolColumn().getWidth());
}
Expand Down Expand Up @@ -1365,7 +1365,7 @@ private Tab createItemsTab(String aFragmentationName){
int tmpRowsPerPage = this.settingsContainer.getRowsPerPageSetting();
tmpItemizationDataTableView.setOnSort((EventHandler<SortEvent<TableView>>) event -> GuiUtil.sortTableViewGlobally(event, tmpPagination, tmpRowsPerPage));
tmpItemizationDataTableView.widthProperty().addListener((observable, oldValue, newValue) -> {
for(Object tmpObject : tmpItemizationDataTableView.getItems()) {
for (Object tmpObject : tmpItemizationDataTableView.getItems()) {
((MoleculeDataModel) tmpObject).setStructureImageWidth(tmpItemizationDataTableView.getMoleculeStructureColumn().getWidth());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public static void setImageStructureHeight(TableView aTableView, double aHeight,
/ aRowsPerPage;
if (aTableView.getClass().equals(ItemizationDataTableView.class)) {
tmpHeight =
(aHeight - 2*GuiDefinitions.GUI_TABLE_VIEW_HEADER_HEIGHT - GuiDefinitions.GUI_PAGINATION_CONTROL_PANEL_HEIGHT)
(aHeight - 2 * GuiDefinitions.GUI_TABLE_VIEW_HEADER_HEIGHT - GuiDefinitions.GUI_PAGINATION_CONTROL_PANEL_HEIGHT)
/ aRowsPerPage;
}
if (tmpHeight < GuiDefinitions.GUI_STRUCTURE_IMAGE_MIN_HEIGHT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ public FragmentsDataTableView(IConfiguration aConfiguration){
//activate for future bulk export?
//this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
DecimalFormat tmpPercentageForm = new DecimalFormat("#.##%");
//-smilesColumn
this.smilesColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.smilesColumn.header"));
this.smilesColumn.setMinWidth(80);
this.smilesColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.075) //magic number
);
this.smilesColumn.setResizable(true);
this.smilesColumn.setEditable(false);
this.smilesColumn.setSortable(true);
this.smilesColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.UNIQUE_SMILES.getText()));
this.smilesColumn.setCellFactory(tableColumn ->{
TableCell<FragmentDataModel, String> tmpCell = new TableCell<>();
Text tmpText = new Text();
tmpText.setTextAlignment(TextAlignment.CENTER);
tmpCell.setGraphic(tmpText);
tmpCell.setPrefHeight(Region.USE_COMPUTED_SIZE);
tmpText.wrappingWidthProperty().bind(this.smilesColumn.widthProperty());
tmpText.textProperty().bind(tmpCell.itemProperty());
return tmpCell;
});
this.smilesColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.smilesColumn);
//-structureColumn
this.structureColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.structureColumn.header"));
this.structureColumn.setMinWidth(150); //magic number
Expand All @@ -143,28 +165,31 @@ public FragmentsDataTableView(IConfiguration aConfiguration){
this.structureColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.STRUCTURE.getText()));
this.structureColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.structureColumn);
//-smilesColumn
this.smilesColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.smilesColumn.header"));
this.smilesColumn.setMinWidth(50);
this.smilesColumn.prefWidthProperty().bind(
//-parentMolNameColumn
this.parentMolNameColumn = new TableColumn<>();
Label tmpParentNameLabel = new Label(Message.get("MainTabPane.fragmentsTab.tableView.parentMolNameColumn.header"));
tmpParentNameLabel.setTooltip(GuiUtil.createTooltip(Message.get("MainTabPane.fragmentsTab.tableView.parentMolNameColumn.tooltip")));
this.parentMolNameColumn.setGraphic(tmpParentNameLabel);
this.parentMolNameColumn.setMinWidth(80);
this.parentMolNameColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.075) //magic number
);
this.smilesColumn.setResizable(true);
this.smilesColumn.setEditable(false);
this.smilesColumn.setSortable(true);
this.smilesColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.UNIQUE_SMILES.getText()));
this.smilesColumn.setCellFactory(tableColumn ->{
this.parentMolNameColumn.setResizable(true);
this.parentMolNameColumn.setEditable(false);
this.parentMolNameColumn.setSortable(true);
this.parentMolNameColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.PARENT_MOLECULE_NAME.getText()));
this.parentMolNameColumn.setCellFactory(tableColumn ->{
TableCell<FragmentDataModel, String> tmpCell = new TableCell<>();
Text tmpText = new Text();
tmpText.setTextAlignment(TextAlignment.CENTER);
tmpCell.setGraphic(tmpText);
tmpCell.setPrefHeight(Region.USE_COMPUTED_SIZE);
tmpText.wrappingWidthProperty().bind(this.smilesColumn.widthProperty());
tmpText.wrappingWidthProperty().bind(this.parentMolNameColumn.widthProperty());
tmpText.textProperty().bind(tmpCell.itemProperty());
return tmpCell;
});
this.smilesColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.smilesColumn);
this.parentMolNameColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.parentMolNameColumn);
//-parentMolColumn
this.parentMolColumn = new TableColumn<>();
Label tmpParentMolLabel = new Label(Message.get("MainTabPane.fragmentsTab.tableView.parentMolColumn.header"));
Expand All @@ -180,25 +205,11 @@ public FragmentsDataTableView(IConfiguration aConfiguration){
this.parentMolColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.PARENT_MOLECULE_STRUCTURE.getText()));
this.parentMolColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.parentMolColumn);
//-parentMolNameColumn
this.parentMolNameColumn = new TableColumn<>();
Label tmpParentNameLabel = new Label(Message.get("MainTabPane.fragmentsTab.tableView.parentMolNameColumn.header"));
tmpParentNameLabel.setTooltip(GuiUtil.createTooltip(Message.get("MainTabPane.fragmentsTab.tableView.parentMolNameColumn.tooltip")));
this.parentMolNameColumn.setGraphic(tmpParentNameLabel);
this.parentMolNameColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.075) //magic number
);
this.parentMolNameColumn.setResizable(true);
this.parentMolNameColumn.setEditable(false);
this.parentMolNameColumn.setSortable(true);
this.parentMolNameColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.PARENT_MOLECULE_NAME.getText()));
this.parentMolNameColumn.setStyle("-fx-alignment: CENTER");
this.getColumns().add(this.parentMolNameColumn);
//-frequencyColumn
this.frequencyColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.frequencyColumn.header"));
this.frequencyColumn.setMinWidth(50); //magic number
this.frequencyColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.1) //magic number
this.widthProperty().multiply(0.098) //magic number
);
this.frequencyColumn.setResizable(true);
this.frequencyColumn.setEditable(false);
Expand All @@ -208,9 +219,9 @@ public FragmentsDataTableView(IConfiguration aConfiguration){
this.getColumns().add(this.frequencyColumn);
//-percentageColumn
this.percentageColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.percentageColumn.header"));
this.percentageColumn.setMinWidth(20); //magic number
this.percentageColumn.setMinWidth(50); //magic number
this.percentageColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.1) //magic number
this.widthProperty().multiply(0.098) //magic number
);
this.percentageColumn.setResizable(true);
this.percentageColumn.setEditable(false);
Expand All @@ -229,23 +240,29 @@ protected void updateItem(Double value, boolean empty){
});
this.percentageColumn.setStyle("-fx-alignment: CENTER-RIGHT");
this.getColumns().add(this.percentageColumn);
//-frequencyColumn
this.moleculeFrequencyColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.header"));
//-moleculeFrequencyColumn
this.moleculeFrequencyColumn = new TableColumn<>();
Label tmpMolFrequencyLabel = new Label(Message.get("MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.header"));
tmpMolFrequencyLabel.setTooltip(GuiUtil.createTooltip(Message.get("MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.tooltip")));
this.moleculeFrequencyColumn.setGraphic(tmpMolFrequencyLabel);
this.moleculeFrequencyColumn.setMinWidth(50); //magic number
this.moleculeFrequencyColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.1) //magic number
this.widthProperty().multiply(0.098) //magic number
);
this.moleculeFrequencyColumn.setResizable(true);
this.moleculeFrequencyColumn.setEditable(false);
this.moleculeFrequencyColumn.setSortable(true);
this.moleculeFrequencyColumn.setCellValueFactory(new PropertyValueFactory(DataModelPropertiesForTableView.MOLECULE_FREQUENCY.getText()));
this.moleculeFrequencyColumn.setStyle("-fx-alignment: CENTER-RIGHT");
this.getColumns().add(this.moleculeFrequencyColumn);
//-percentageColumn
this.moleculePercentageColumn = new TableColumn<>(Message.get("MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.header"));
this.moleculePercentageColumn.setMinWidth(20); //magic number
//-moleculePercentageColumn
this.moleculePercentageColumn = new TableColumn<>();
Label tmpMolPercentageLabel = new Label(Message.get("MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.header"));
tmpMolPercentageLabel.setTooltip(GuiUtil.createTooltip(Message.get("MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.tooltip")));
this.moleculePercentageColumn.setGraphic(tmpMolPercentageLabel);
this.moleculePercentageColumn.setMinWidth(50); //magic number
this.moleculePercentageColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.0975) //magic number
this.widthProperty().multiply(0.098) //magic number
);
this.moleculePercentageColumn.setResizable(true);
this.moleculePercentageColumn.setEditable(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public MoleculesDataTableView(IConfiguration aConfiguration) {
this.structureColumn = new TableColumn<>(Message.get("MainTabPane.moleculesTab.tableView.structureColumn.header"));
this.structureColumn.setMinWidth(150); //magic number
this.structureColumn.prefWidthProperty().bind(
this.widthProperty().multiply(0.7975) //magic number
this.widthProperty().multiply(0.796) //magic number
);
this.structureColumn.setResizable(true);
this.structureColumn.setEditable(false);
Expand Down Expand Up @@ -184,7 +184,7 @@ public Node createMoleculeTableViewPage(int aPageIndex, SettingsContainer aSetti
}
this.selectionAllCheckBoxAction = false;
});
this.itemsObservableList.addListener((ListChangeListener) change -> {
this.itemsObservableList.addListener((ListChangeListener<? super MoleculeDataModel>) change -> {
if (this.selectionAllCheckBoxAction) {
// No further action needed with column checkbox data when the select all checkbox is operated on
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ private List<String> createFragmentsTabPdfFile(File aPdfFile,
Chunk tmpHeader = new Chunk(Message.get("Exporter.fragmentationTab.pdfCellHeader.header"),
FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.UNDERLINE));
Paragraph tmpSpace = new Paragraph(" ");
tmpFragmentationTable.addCell(tmpFragmentCell);
tmpFragmentationTable.addCell(tmpSmilesStringCell);
tmpFragmentationTable.addCell(tmpFragmentCell);
tmpFragmentationTable.addCell(tmpFrequencyCell);
tmpFragmentationTable.addCell(tmpPercentageCell);
tmpFragmentationTable.addCell(tmpMolFrequencyCell);
Expand Down Expand Up @@ -656,8 +656,8 @@ private List<String> createFragmentsTabPdfFile(File aPdfFile,
PdfPCell tmpCellOfMolPercentage = new PdfPCell(new Paragraph(tmpStringMoleculePercentage));
tmpCellOfMolPercentage.setHorizontalAlignment(Element.ALIGN_RIGHT);
tmpImageFragmentCell.addElement(tmpImageFragment);
tmpFragmentationTable.addCell(tmpImageFragmentCell);
tmpFragmentationTable.addCell(tmpFragmentDataModel.getUniqueSmiles());
tmpFragmentationTable.addCell(tmpImageFragmentCell);
tmpFragmentationTable.addCell(tmpCellOfFrequency);
tmpFragmentationTable.addCell(tmpCellOfPercentage);
tmpFragmentationTable.addCell(tmpCellOfMolFrequency);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ MainTabPane.fragmentsTab.tableView.structureColumn.header = Structure
MainTabPane.fragmentsTab.tableView.smilesColumn.header = SMILES
MainTabPane.fragmentsTab.tableView.frequencyColumn.header = Frequency
MainTabPane.fragmentsTab.tableView.percentageColumn.header = Percentage
MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.header = Molecule Frequency
MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.header = Molecule Percentage
MainTabPane.fragmentsTab.tableView.parentMolColumn.header = Sample Parent
MainTabPane.fragmentsTab.tableView.parentMolColumn.tooltip = First occurred molecule which contains fragment
MainTabPane.fragmentsTab.tableView.parentMolNameColumn.header = Sample Parent
MainTabPane.fragmentsTab.tableView.parentMolNameColumn.tooltip = First occurred molecule which contains fragment
MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.header = Mol. Frequency
MainTabPane.fragmentsTab.tableView.moleculeFrequencyColumn.tooltip = Molecule Frequency
MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.header = Mol. Percentage
MainTabPane.fragmentsTab.tableView.moleculePercentageColumn.tooltip = Molecule Percentage
MainTabPane.fragmentsTab.tableView.parentMolColumn.header = Parent Structure
MainTabPane.fragmentsTab.tableView.parentMolColumn.tooltip = Sample Parent Structure: first fragmented molecule which contained the fragment
MainTabPane.fragmentsTab.tableView.parentMolNameColumn.header = Parent Name
MainTabPane.fragmentsTab.tableView.parentMolNameColumn.tooltip = Sample Parent Name: name of first fragmented molecule which contained the fragment
#ItemizationTab#
MainTabPane.itemizationTab.title = Items
MainTabPane.itemizationTab.csvButton.txt = CSV
Expand Down Expand Up @@ -147,9 +149,9 @@ Exporter.fragmentationTab.pdfCellHeader.header = MORTAR Fragmentation Tab Export
Exporter.fragmentationTab.pdfCellHeader.smiles = SMILES
Exporter.fragmentationTab.pdfCellHeader.frequency = Frequency
Exporter.fragmentationTab.pdfCellHeader.percentage = Percentage
Exporter.fragmentationTab.pdfCellHeader.moleculeFrequency = Molecule Frequency
Exporter.fragmentationTab.pdfCellHeader.moleculePercentage = Molecule Percentage
Exporter.fragmentationTab.pdfCellHeader.fragment = Fragment
Exporter.fragmentationTab.pdfCellHeader.moleculeFrequency = Mol. Frequency
Exporter.fragmentationTab.pdfCellHeader.moleculePercentage = Mol. Percentage
Exporter.fragmentationTab.pdfCellHeader.fragment = Structure
Exporter.itemsTab.pdfCellHeader.header = MORTAR Itemization Tab Export
Exporter.itemsTab.pdfCellHeader.name = Name
Exporter.itemsTab.pdfCellHeader.structure = Structure
Expand Down

0 comments on commit a92d428

Please sign in to comment.