diff --git a/CHANGELOG.md b/CHANGELOG.md index 52105585c0f..0e353a4f2e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We improved the performance when pasting and importing entries in an existing library. [#11843](https://github.com/JabRef/jabref/pull/11843) - When fulltext search is selected but indexing is deactivated, a dialog is now shown asking if the user wants to enable indexing now [#9491](https://github.com/JabRef/jabref/issues/9491) - We changed instances of 'Search Selected' to 'Search Pre-configured' in Web Search Preferences UI. [#11871](https://github.com/JabRef/jabref/pull/11871) +- We added a new CSS style class `main-table` for the main table. [#11881](https://github.com/JabRef/jabref/pull/11881) ### Fixed diff --git a/src/main/java/org/jabref/gui/Base.css b/src/main/java/org/jabref/gui/Base.css index 14ae1873d4a..49d581717c7 100644 --- a/src/main/java/org/jabref/gui/Base.css +++ b/src/main/java/org/jabref/gui/Base.css @@ -340,7 +340,6 @@ TextFlow > .hyperlink:visited, -fx-underline: true; } - .glyph-icon { /* This adjusts text alignment within the bounds of text nodes so that the text is always vertically centered within the bounds. Based on @@ -1517,4 +1516,221 @@ We want to have a look that matches our icons in the tool-bar */ -fx-background-color: transparent; } +/* endregion */ + +/* region: maintable css */ + + +.main-table .column-icon { + -fx-alignment: baseline-center; + -fx-padding: 0; +} + +.main-table .column-header.column-icon > .label { + -fx-padding: 0; + -fx-alignment: baseline-center; +} + +.main-table .empty-special-field { + visibility: hidden; +} + +.main-table .table-row-cell:hover .empty-special-field { + visibility: visible; + -fx-icon-color: -jr-gray-2; + -fx-fill: -jr-gray-2; +} + +.main-table .table-row-cell:dragOver-bottom { + -fx-border-color: -jr-drag-target; + -fx-border-width: 0 0 2 0; + -fx-padding: 0 0 -2 0; +} + +.main-table .table-row-cell:dragOver-center { + -fx-border-color: -jr-drag-target; + -fx-border-width: 1 1 1 1; + -fx-padding: -1 -1 -1 -1; + -fx-background-color: -jr-drag-target-hover; +} + +.main-table .table-row-cell:dragOver-top { + -fx-border-color: -jr-drag-target; + -fx-border-width: 2 0 0 0; + -fx-padding: -2 0 0 0; +} + +/** even and odd are swapped around somehow. Below "odd" matches lines 2, 4, ... **/ + +.main-table .table-row-cell:matching-search-and-groups { + -fx-background-color: -jr-match-1-even; +} +.main-table .table-row-cell:matching-search-and-groups > .table-cell { + -fx-text-fill: -jr-match-1-text-color; +} +.main-table .table-row-cell:matching-search-and-groups:focused > .table-cell { + -fx-text-fill: -fx-focused-text-base-color; +} +.main-table .table-row-cell:matching-search-and-groups:focused:hover > .table-cell { + -fx-text-fill: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-search-and-groups:focused:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-search-and-groups:hover > .table-cell { + -fx-text-fill: -jr-hover-text; +} +.main-table .table-row-cell:matching-search-and-groups > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-match-1-text-color; +} +.main-table .table-row-cell:matching-search-and-groups:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-hover-text; +} +.main-table .table-row-cell:matching-search-and-groups:odd { + -fx-background-color: -jr-match-1-odd; +} +.main-table .table-row-cell:matching-search-and-groups:odd:selected, +.main-table .table-row-cell:matching-search-and-groups:odd:focused, +.main-table .table-row-cell:matching-search-and-groups:odd:focused:hover, +.main-table .table-row-cell:matching-search-and-groups:focused:hover { + -fx-background-color: -jr-selected; +} +.main-table .table-row-cell:matching-search-and-groups:odd:hover { + -fx-background-color: -jr-hover; +} + +.main-table .table-row-cell:matching-search-not-groups { + -fx-background-color: -jr-match-2-even; +} +.main-table .table-row-cell:matching-search-not-groups > .table-cell { + -fx-text-fill: -jr-match-2-text-color; +} +.main-table .table-row-cell:matching-search-not-groups:focused > .table-cell { + -fx-text-fill: -fx-focused-text-base-color; +} +.main-table .table-row-cell:matching-search-not-groups:focused:hover > .table-cell { + -fx-text-fill: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-search-not-groups:focused:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-search-not-groups:hover > .table-cell { + -fx-text-fill: -jr-hover-text; +} +.main-table .table-row-cell:matching-search-not-groups > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-match-2-text-color; +} +.main-table .table-row-cell:matching-search-not-groups:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-hover-text; +} +.main-table .table-row-cell:matching-search-not-groups:odd { + -fx-background-color: -jr-match-2-odd; +} +.main-table .table-row-cell:matching-search-not-groups:odd:selected, +.main-table .table-row-cell:matching-search-not-groups:odd:focused, +.main-table .table-row-cell:matching-search-not-groups:odd:focused:hover, +.main-table .table-row-cell:matching-search-not-groups:focused:hover { + -fx-background-color: -jr-selected; +} +.main-table .table-row-cell:matching-search-not-groups:odd:hover { + -fx-background-color: -jr-hover; +} + +.main-table .table-row-cell:matching-groups-not-search { + -fx-background-color: -jr-match-3-even; +} +.main-table .table-row-cell:matching-groups-not-search > .table-cell { + -fx-text-fill: -jr-match-3-text-color; +} +.main-table .table-row-cell:matching-groups-not-search:focused > .table-cell { + -fx-text-fill: -fx-focused-text-base-color; +} +.main-table .table-row-cell:matching-groups-not-search:focused:hover > .table-cell { + -fx-text-fill: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-groups-not-search:focused:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:matching-groups-not-search:hover > .table-cell { + -fx-text-fill: -jr-hover-text; +} +.main-table .table-row-cell:matching-groups-not-search > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-match-3-text-color; +} +.main-table .table-row-cell:matching-groups-not-search:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-hover-text; +} +.main-table .table-row-cell:matching-groups-not-search:odd { + -fx-background-color: -jr-match-3-odd; +} +.main-table .table-row-cell:matching-groups-not-search:odd:selected, +.main-table .table-row-cell:matching-groups-not-search:odd:focused, +.main-table .table-row-cell:matching-groups-not-search:odd:focused:hover, +.main-table .table-row-cell:matching-groups-not-search:focused:hover { + -fx-background-color: -jr-selected; +} +.main-table .table-row-cell:matching-groups-not-search:odd:hover { + -fx-background-color: -jr-hover; +} + +.main-table .table-row-cell:not-matching-search-and-groups { + -fx-background-color: -jr-match-4-even; +} +.main-table .table-row-cell:not-matching-search-and-groups > .table-cell { + -fx-text-fill: -jr-match-4-text-color; +} +.main-table .table-row-cell:not-matching-search-and-groups:focused > .table-cell { + -fx-text-fill: -fx-focused-text-base-color; +} +.main-table .table-row-cell:not-matching-search-and-groups:focused:hover > .table-cell { + -fx-text-fill: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:not-matching-search-and-groups:focused:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-maintable-focused-hover-text; +} +.main-table .table-row-cell:not-matching-search-and-groups:hover > .table-cell { + -fx-text-fill: -jr-hover-text; +} +.main-table .table-row-cell:not-matching-search-and-groups > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-match-4-text-color; +} +.main-table.table-row-cell:not-matching-search-and-groups:hover > .table-cell > .ikonli-font-icon { + -fx-icon-color: -jr-hover-text; +} +.main-table .table-row-cell:not-matching-search-and-groups:odd { + -fx-background-color: -jr-match-4-odd; +} +.main-table .table-row-cell:not-matching-search-and-groups:odd:selected, +.main-table .table-row-cell:not-matching-search-and-groups:odd:focused, +.main-table .table-row-cell:not-matching-search-and-groups:odd:focused:hover, +.main-table .table-row-cell:not-matching-search-and-groups:focused:hover { + -fx-background-color: -jr-selected; +} +.main-table .table-row-cell:not-matching-search-and-groups:odd:hover { + -fx-background-color: -jr-hover; +} + +.rating > .container { + -fx-spacing: 2; +} + +.rating > .container > .button { + -fx-pref-width: 16; + -fx-pref-height: 10; + -fx-background-repeat: no-repeat no-repeat; + -fx-background-size: 16 16; + -fx-border-style: none; + -fx-border-width: 0; + -fx-padding: 0; +} + +.rating > .container > .button.strong { + +} + +.rating > .container > .button:hover { + -fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.6), 8, 0.0, 0, 0); +} + + /* endregion */ diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.css b/src/main/java/org/jabref/gui/maintable/MainTable.css deleted file mode 100644 index f468033b854..00000000000 --- a/src/main/java/org/jabref/gui/maintable/MainTable.css +++ /dev/null @@ -1,210 +0,0 @@ -.column-icon { - -fx-alignment: baseline-center; - -fx-padding: 0; -} - -.column-header.column-icon > .label { - -fx-padding: 0; - -fx-alignment: baseline-center; -} - -.empty-special-field { - visibility: hidden; -} - -.table-row-cell:hover .empty-special-field { - visibility: visible; - -fx-icon-color: -jr-gray-2; - -fx-fill: -jr-gray-2; -} - -.table-row-cell:dragOver-bottom { - -fx-border-color: -jr-drag-target; - -fx-border-width: 0 0 2 0; - -fx-padding: 0 0 -2 0; -} - -.table-row-cell:dragOver-center { - -fx-border-color: -jr-drag-target; - -fx-border-width: 1 1 1 1; - -fx-padding: -1 -1 -1 -1; - -fx-background-color: -jr-drag-target-hover; -} - -.table-row-cell:dragOver-top { - -fx-border-color: -jr-drag-target; - -fx-border-width: 2 0 0 0; - -fx-padding: -2 0 0 0; -} - -/** even and odd are swapped around somehow. Below "odd" matches lines 2, 4, ... **/ - -.table-row-cell:matching-search-and-groups { - -fx-background-color: -jr-match-1-even; -} -.table-row-cell:matching-search-and-groups > .table-cell { - -fx-text-fill: -jr-match-1-text-color; -} -.table-row-cell:matching-search-and-groups:focused > .table-cell { - -fx-text-fill: -fx-focused-text-base-color; -} -.table-row-cell:matching-search-and-groups:focused:hover > .table-cell { - -fx-text-fill: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-search-and-groups:focused:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-search-and-groups:hover > .table-cell { - -fx-text-fill: -jr-hover-text; -} -.table-row-cell:matching-search-and-groups > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-match-1-text-color; -} -.table-row-cell:matching-search-and-groups:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-hover-text; -} -.table-row-cell:matching-search-and-groups:odd { - -fx-background-color: -jr-match-1-odd; -} -.table-row-cell:matching-search-and-groups:odd:selected, -.table-row-cell:matching-search-and-groups:odd:focused, -.table-row-cell:matching-search-and-groups:odd:focused:hover, -.table-row-cell:matching-search-and-groups:focused:hover { - -fx-background-color: -jr-selected; -} -.table-row-cell:matching-search-and-groups:odd:hover { - -fx-background-color: -jr-hover; -} - -.table-row-cell:matching-search-not-groups { - -fx-background-color: -jr-match-2-even; -} -.table-row-cell:matching-search-not-groups > .table-cell { - -fx-text-fill: -jr-match-2-text-color; -} -.table-row-cell:matching-search-not-groups:focused > .table-cell { - -fx-text-fill: -fx-focused-text-base-color; -} -.table-row-cell:matching-search-not-groups:focused:hover > .table-cell { - -fx-text-fill: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-search-not-groups:focused:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-search-not-groups:hover > .table-cell { - -fx-text-fill: -jr-hover-text; -} -.table-row-cell:matching-search-not-groups > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-match-2-text-color; -} -.table-row-cell:matching-search-not-groups:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-hover-text; -} -.table-row-cell:matching-search-not-groups:odd { - -fx-background-color: -jr-match-2-odd; -} -.table-row-cell:matching-search-not-groups:odd:selected, -.table-row-cell:matching-search-not-groups:odd:focused, -.table-row-cell:matching-search-not-groups:odd:focused:hover, -.table-row-cell:matching-search-not-groups:focused:hover { - -fx-background-color: -jr-selected; -} -.table-row-cell:matching-search-not-groups:odd:hover { - -fx-background-color: -jr-hover; -} - -.table-row-cell:matching-groups-not-search { - -fx-background-color: -jr-match-3-even; -} -.table-row-cell:matching-groups-not-search > .table-cell { - -fx-text-fill: -jr-match-3-text-color; -} -.table-row-cell:matching-groups-not-search:focused > .table-cell { - -fx-text-fill: -fx-focused-text-base-color; -} -.table-row-cell:matching-groups-not-search:focused:hover > .table-cell { - -fx-text-fill: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-groups-not-search:focused:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-maintable-focused-hover-text; -} -.table-row-cell:matching-groups-not-search:hover > .table-cell { - -fx-text-fill: -jr-hover-text; -} -.table-row-cell:matching-groups-not-search > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-match-3-text-color; -} -.table-row-cell:matching-groups-not-search:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-hover-text; -} -.table-row-cell:matching-groups-not-search:odd { - -fx-background-color: -jr-match-3-odd; -} -.table-row-cell:matching-groups-not-search:odd:selected, -.table-row-cell:matching-groups-not-search:odd:focused, -.table-row-cell:matching-groups-not-search:odd:focused:hover, -.table-row-cell:matching-groups-not-search:focused:hover { - -fx-background-color: -jr-selected; -} -.table-row-cell:matching-groups-not-search:odd:hover { - -fx-background-color: -jr-hover; -} - -.table-row-cell:not-matching-search-and-groups { - -fx-background-color: -jr-match-4-even; -} -.table-row-cell:not-matching-search-and-groups > .table-cell { - -fx-text-fill: -jr-match-4-text-color; -} -.table-row-cell:not-matching-search-and-groups:focused > .table-cell { - -fx-text-fill: -fx-focused-text-base-color; -} -.table-row-cell:not-matching-search-and-groups:focused:hover > .table-cell { - -fx-text-fill: -jr-maintable-focused-hover-text; -} -.table-row-cell:not-matching-search-and-groups:focused:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-maintable-focused-hover-text; -} -.table-row-cell:not-matching-search-and-groups:hover > .table-cell { - -fx-text-fill: -jr-hover-text; -} -.table-row-cell:not-matching-search-and-groups > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-match-4-text-color; -} -.table-row-cell:not-matching-search-and-groups:hover > .table-cell > .ikonli-font-icon { - -fx-icon-color: -jr-hover-text; -} -.table-row-cell:not-matching-search-and-groups:odd { - -fx-background-color: -jr-match-4-odd; -} -.table-row-cell:not-matching-search-and-groups:odd:selected, -.table-row-cell:not-matching-search-and-groups:odd:focused, -.table-row-cell:not-matching-search-and-groups:odd:focused:hover, -.table-row-cell:not-matching-search-and-groups:focused:hover { - -fx-background-color: -jr-selected; -} -.table-row-cell:not-matching-search-and-groups:odd:hover { - -fx-background-color: -jr-hover; -} - -.rating > .container { - -fx-spacing: 2; -} - -.rating > .container > .button { - -fx-pref-width: 16; - -fx-pref-height: 10; - -fx-background-repeat: no-repeat no-repeat; - -fx-background-size: 16 16; - -fx-border-style: none; - -fx-border-width: 0; - -fx-padding: 0; -} - -.rating > .container > .button.strong { - -} - -.rating > .container > .button:hover { - -fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.6), 8, 0.0, 0, 0); -} diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index e8939f9aec8..4a94fd56b5f 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -114,6 +114,8 @@ public MainTable(MainTableDataModel model, this.setOnDragOver(this::handleOnDragOverTableView); this.setOnDragDropped(this::handleOnDragDroppedTableView); + this.getStyleClass().add("main-table"); + MainTableColumnFactory mainTableColumnFactory = new MainTableColumnFactory( database, preferences, @@ -185,8 +187,6 @@ public MainTable(MainTableDataModel model, // Enable sorting model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty()); - this.getStylesheets().add(Objects.requireNonNull(MainTable.class.getResource("MainTable.css")).toExternalForm()); - // Store visual state new PersistenceVisualStateTable(this, mainTablePreferences.getColumnPreferences()).addListeners(); diff --git a/src/main/java/org/jabref/gui/search/SearchResultsTable.java b/src/main/java/org/jabref/gui/search/SearchResultsTable.java index 5bb4049ecae..76ebb2cff26 100644 --- a/src/main/java/org/jabref/gui/search/SearchResultsTable.java +++ b/src/main/java/org/jabref/gui/search/SearchResultsTable.java @@ -12,7 +12,6 @@ import org.jabref.gui.DialogService; import org.jabref.gui.StateManager; import org.jabref.gui.maintable.BibEntryTableViewModel; -import org.jabref.gui.maintable.MainTable; import org.jabref.gui.maintable.MainTableColumnFactory; import org.jabref.gui.maintable.MainTablePreferences; import org.jabref.gui.maintable.PersistenceVisualStateTable; @@ -35,6 +34,8 @@ public SearchResultsTable(SearchResultsTableDataModel model, TaskExecutor taskExecutor) { super(); + this.getStyleClass().add("main-table"); + MainTablePreferences mainTablePreferences = preferences.getMainTablePreferences(); List> allCols = new MainTableColumnFactory( @@ -68,8 +69,6 @@ public SearchResultsTable(SearchResultsTableDataModel model, // Enable sorting model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty()); - this.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); - // Store visual state new PersistenceVisualStateTable(this, preferences.getSearchDialogColumnPreferences()).addListeners();