From 5182f2959940811aefc9c59c15095a16d087af3d Mon Sep 17 00:00:00 2001 From: Loay Ghreeb Date: Thu, 15 Aug 2024 00:13:14 +0300 Subject: [PATCH 1/2] remove "Match category" --- .../java/org/jabref/gui/maintable/MainTableColumnFactory.java | 2 +- .../java/org/jabref/gui/maintable/MainTableColumnModel.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java index 39a38d9bee6..3afb91ee955 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java @@ -147,7 +147,7 @@ public static void setExactWidth(TableColumn column, double width) { private TableColumn createMatchCategoryColumn(MainTableColumnModel columnModel) { TableColumn column = new MainTableColumn<>(columnModel); - Node header = new Text(Localization.lang("Match category")); + Node header = new Text(); header.getStyleClass().add("mainTable-header"); Tooltip.install(header, new Tooltip(MainTableColumnModel.Type.MATCH_CATEGORY.getDisplayName())); column.setGraphic(header); diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java index 90e239c79aa..8f60f2fd819 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java @@ -35,7 +35,7 @@ public class MainTableColumnModel { private static final Logger LOGGER = LoggerFactory.getLogger(MainTableColumnModel.class); public enum Type { - MATCH_CATEGORY("match_category", Localization.lang("Match category")), + MATCH_CATEGORY("match_category"), INDEX("index", Localization.lang("Index")), EXTRAFILE("extrafile", Localization.lang("File type")), FILES("files", Localization.lang("Linked files")), diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 0f6277e2bcd..bcdbe8ae1f3 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -823,7 +823,6 @@ Character\ encoding\ '%0'\ is\ not\ supported.=Character encoding '%0' is not su Filter\ search\ results=Filter search results Filter\ by\ groups=Filter by groups Invert\ groups=Invert groups -Match\ category=Match category Scroll\ to\ previous\ match\ category=Scroll to previous match category Scroll\ to\ next\ match\ category=Scroll to next match category Search=Search From bd13cb9d7af6ec88c03b55a6511f646936d17a65 Mon Sep 17 00:00:00 2001 From: Loay Ghreeb Date: Fri, 16 Aug 2024 15:48:42 +0300 Subject: [PATCH 2/2] JavaDoc --- .../jabref/gui/maintable/MainTableColumnFactory.java | 11 ++++++----- .../jabref/gui/maintable/MainTableColumnModel.java | 2 +- .../java/org/jabref/gui/search/MatchCategory.java | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java index 3afb91ee955..ec977536ecb 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java @@ -145,14 +145,15 @@ public static void setExactWidth(TableColumn column, double width) { column.setMaxWidth(width); } + /** + * Creates a column for the match category. + *

This column is always hidden but is used for sorting the table + * in the floating mode. The order of the {@link MatchCategory} enum constants + * determines the sorting order.

+ */ private TableColumn createMatchCategoryColumn(MainTableColumnModel columnModel) { TableColumn column = new MainTableColumn<>(columnModel); - Node header = new Text(); - header.getStyleClass().add("mainTable-header"); - Tooltip.install(header, new Tooltip(MainTableColumnModel.Type.MATCH_CATEGORY.getDisplayName())); - column.setGraphic(header); column.setCellValueFactory(cellData -> cellData.getValue().matchCategory()); - new ValueTableCellFactory().withText(String::valueOf).install(column); column.setSortable(true); column.setSortType(TableColumn.SortType.ASCENDING); column.setVisible(false); diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java index 8f60f2fd819..568091ca4a8 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java @@ -35,7 +35,7 @@ public class MainTableColumnModel { private static final Logger LOGGER = LoggerFactory.getLogger(MainTableColumnModel.class); public enum Type { - MATCH_CATEGORY("match_category"), + MATCH_CATEGORY("match_category"), // Not localized, because this column is always hidden INDEX("index", Localization.lang("Index")), EXTRAFILE("extrafile", Localization.lang("File type")), FILES("files", Localization.lang("Linked files")), diff --git a/src/main/java/org/jabref/gui/search/MatchCategory.java b/src/main/java/org/jabref/gui/search/MatchCategory.java index e67aa15fbca..c07fe9a30d9 100644 --- a/src/main/java/org/jabref/gui/search/MatchCategory.java +++ b/src/main/java/org/jabref/gui/search/MatchCategory.java @@ -1,5 +1,8 @@ package org.jabref.gui.search; +/** + * @implNote The order of constants in this enum is important because it is used for sorting the main table. + */ public enum MatchCategory { MATCHING_SEARCH_AND_GROUPS, MATCHING_SEARCH_NOT_GROUPS,