From ed6aeb0bd6d2274d7d1e5798e722b84bd92caf32 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Sun, 9 Sep 2018 19:28:55 +0200 Subject: [PATCH 01/11] Save sort order column of main table --- src/main/java/org/jabref/gui/JabRefFrame.java | 2 +- .../gui/maintable/ColumnPreferences.java | 16 +++++++++- .../gui/maintable/MainTableColumnFactory.java | 7 +++++ .../PersistenceVisualStateTable.java | 29 +++++++++++++++++++ .../jabref/preferences/JabRefPreferences.java | 28 +++++++++++++++++- 5 files changed, 79 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index d440752b7a2..10e21cec067 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -1022,7 +1022,7 @@ public void addParserResult(ParserResult pr, boolean focusPanel) { */ @Deprecated public void output(final String s) { - statusLine.show(s, 3000); + DefaultTaskExecutor.runInJavaFXThread(() -> statusLine.show(s, 3000)); } private void initActions() { diff --git a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java index ead48b18a3d..b26dac8d848 100644 --- a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java +++ b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java @@ -2,6 +2,8 @@ import java.util.List; import java.util.Map; +import java.util.Optional; +import javafx.scene.control.TableColumn.SortType; import org.jabref.model.entry.BibtexSingleField; import org.jabref.model.entry.specialfields.SpecialField; @@ -16,8 +18,9 @@ public class ColumnPreferences { private final List specialFieldColumns; private final List extraFileColumns; private final Map columnWidths; + private final List columnSortOrder; - public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths) { + public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths, List columnSortOrder) { this.showFileColumn = showFileColumn; this.showUrlColumn = showUrlColumn; this.preferDoiOverUrl = preferDoiOverUrl; @@ -26,6 +29,7 @@ public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean this.specialFieldColumns = specialFieldColumns; this.extraFileColumns = extraFileColumns; this.columnWidths = columnWidths; + this.columnSortOrder = columnSortOrder; } public boolean showFileColumn() { @@ -59,4 +63,14 @@ public List getNormalColumns() { public double getPrefColumnWidth(String columnName) { return columnWidths.getOrDefault(columnName, BibtexSingleField.DEFAULT_FIELD_LENGTH); } + + public Optional getSortTypeForColumn(String columnName) { + + if (columnName.equals(columnSortOrder.get(0))) { + return Optional.of(SortType.valueOf(columnSortOrder.get(1))); + } + return Optional.empty(); + + } + } diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java index fa771bc9a3b..80922edede0 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java @@ -109,6 +109,7 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre columns.add(createSpecialFieldColumn((field))); } + return columns; } @@ -120,6 +121,7 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre new ValueTableCellFactory>() .withGraphic(this::createGroupColorRegion) .install(column); + column.setSortable(true); return column; } @@ -156,8 +158,11 @@ private Node createGroupColorRegion(BibEntryTableViewModel entry, List() .withText(text -> text) .install(column); + column.setSortable(true); column.setPrefWidth(preferences.getPrefColumnWidth(columnName)); + preferences.getSortTypeForColumn(columnName).ifPresent(column::setSortType); columns.add(column); + } return columns; } @@ -199,6 +204,7 @@ private TableColumn column.setComparator(new RankingFieldComparator()); } + column.setSortable(true); return column; } @@ -375,6 +381,7 @@ private TableColumn> createExtraFileCol .withGraphic(linkedFiles -> createFileIcon(linkedFiles.stream().filter(linkedFile -> linkedFile.getFileType().equalsIgnoreCase(externalFileTypeName)).collect(Collectors.toList()))) .install(column); + return column; } diff --git a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java index 2b6e3708466..c6a7f586a7c 100644 --- a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java +++ b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java @@ -4,6 +4,7 @@ import java.util.List; import javafx.collections.ListChangeListener; +import javafx.collections.ObservableList; import javafx.scene.control.TableColumn; import org.jabref.preferences.JabRefPreferences; @@ -22,6 +23,30 @@ public PersistenceVisualStateTable(final MainTable mainTable, JabRefPreferences this.preferences = preferences; mainTable.getColumns().addListener(this::onColumnsChanged); + mainTable.getSortOrder().addListener(this::onColumnSortOrderChanged); + + } + + private void onColumnSortOrderChanged(ListChangeListener.Change> change) { + boolean changed = false; + while (change.next()) { + changed = true; + } + + if (changed) { + updateSortOrderPreferences(change.getList()); + } + } + + private void updateSortOrderPreferences(ObservableList> observableList) { + if(observableList.isEmpty()) + return; + TableColumn column = observableList.get(0); + if (column instanceof NormalTableColumn) { + NormalTableColumn normalColumn = (NormalTableColumn) column; + preferences.setMainTableColumnSortOrder(normalColumn.getColumnName(), normalColumn.getSortType().name()); + } + } private void onColumnsChanged(ListChangeListener.Change> change) { @@ -33,6 +58,7 @@ private void onColumnsChanged(ListChangeListener.Change columnNames = new ArrayList<>(); List columnsWidths = new ArrayList<>(); + List columnSortOrders = new ArrayList<>(); for (TableColumn column : mainTable.getColumns()) { if (column instanceof NormalTableColumn) { @@ -48,6 +75,8 @@ private void updateColumnPreferences() { columnNames.add(normalColumn.getColumnName()); columnsWidths.add(String.valueOf(normalColumn.getWidth())); + columnSortOrders.add(normalColumn.getSortType().name()); + } } diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index d398ff19978..abe694bd1e3 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -151,6 +151,8 @@ public class JabRefPreferences implements PreferencesService { public static final String NEWLINE = "newline"; public static final String COLUMN_WIDTHS = "columnWidths"; public static final String COLUMN_NAMES = "columnNames"; + public static final String SORT_COLUMN = "columnSortOrders"; + public static final String SIDE_PANE_COMPONENT_PREFERRED_POSITIONS = "sidePaneComponentPreferredPositions"; public static final String SIDE_PANE_COMPONENT_NAMES = "sidePaneComponentNames"; public static final String XMP_PRIVACY_FILTERS = "xmpPrivacyFilters"; @@ -536,6 +538,8 @@ private JabRefPreferences() { defaults.put(COLUMN_NAMES, "entrytype;author/editor;title;year;journal/booktitle;bibtexkey"); defaults.put(COLUMN_WIDTHS, "75;300;470;60;130;100"); + defaults.put(SORT_COLUMN, "title;ASCENDING"); + defaults.put(XMP_PRIVACY_FILTERS, "pdf;timestamp;keywords;owner;note;review"); defaults.put(USE_XMP_PRIVACY_FILTER, Boolean.FALSE); defaults.put(WORKING_DIRECTORY, USER_HOME); @@ -1870,6 +1874,17 @@ private Map createColumnWidths() { return map; } + private Map createColumnSortOrder() { + List columns = getStringList(COLUMN_NAMES); + List sortOrders = getStringList(SORT_COLUMN); + + Map map = new TreeMap<>(); + for (int i = 0; i < columns.size(); i++) { + map.put(columns.get(i), sortOrders.get(i)); + } + return map; + } + public ColumnPreferences getColumnPreferences() { return new ColumnPreferences( getBoolean(FILE_COLUMN), @@ -1879,7 +1894,9 @@ public ColumnPreferences getColumnPreferences() { getStringList(COLUMN_NAMES), createSpecialFieldColumns(), createExtraFileColumns(), - createColumnWidths()); + createColumnWidths(), + getMainTableColumnSortOrder()); + } public MainTablePreferences getMainTablePreferences() { @@ -1955,4 +1972,13 @@ public void setIdBasedFetcherForEntryGenerator(String fetcherName) { public String getIdBasedFetcherForEntryGenerator() { return get(ID_ENTRY_GENERATOR); } + + public void setMainTableColumnSortOrder(String column, String sortType) { + putStringList(SORT_COLUMN, Arrays.asList(column, sortType)); + } + + public List getMainTableColumnSortOrder() { + return getStringList(SORT_COLUMN); + } + } From f9f7d3332c190c7452e6d9b95d344687daa8f5ca Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Mon, 10 Sep 2018 13:26:53 +0200 Subject: [PATCH 02/11] add sort type listener for each column --- .../gui/maintable/ColumnPreferences.java | 1 + .../org/jabref/gui/maintable/MainTable.java | 8 ++++++ .../gui/maintable/MainTableColumnFactory.java | 3 --- .../gui/maintable/NormalTableColumn.java | 4 +-- .../PersistenceVisualStateTable.java | 26 +------------------ 5 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java index b26dac8d848..c5f6c9c767a 100644 --- a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java +++ b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; + import javafx.scene.control.TableColumn.SortType; import org.jabref.model.entry.BibtexSingleField; diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 4678e6dfb30..04723b50246 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -83,6 +83,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, ); this.getColumns().addAll(new MainTableColumnFactory(database, preferences.getColumnPreferences(), externalFileTypes, panel.getUndoManager(), frame.getDialogService()).createColumns()); + new ViewModelTableRowFactory() .withOnMouseClickedEvent((entry, event) -> { if (event.getClickCount() == 2) { @@ -114,6 +115,13 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.pane.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); + //Set sort order column from preferences, currently only single column suported + this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType->{ + this.getSortOrder().add(col); + col.setSortType(sortType); + })); + + // Store visual state new PersistenceVisualStateTable(this, Globals.prefs); diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java index 80922edede0..d3a05b7e13e 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java @@ -109,7 +109,6 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre columns.add(createSpecialFieldColumn((field))); } - return columns; } @@ -160,9 +159,7 @@ private Node createGroupColorRegion(BibEntryTableViewModel entry, List getColumnValue(BibEntryTableViewModel entry) { return null; } - ObjectBinding[] dependencies = bibtexFields.stream().map(entry::getField).toArray(ObjectBinding[]::new); + ObjectBinding[] dependencies = bibtexFields.stream().map(entry::getField).toArray(ObjectBinding[]::new); return Bindings.createStringBinding(() -> computeText(entry), dependencies); } @@ -99,7 +99,7 @@ private String computeText(BibEntryTableViewModel entry) { result = toUnicode.format(MainTableNameFormatter.formatName(result)); } - if (result != null && !bibtexFields.contains(BibEntry.KEY_FIELD)) { + if ((result != null) && !bibtexFields.contains(BibEntry.KEY_FIELD)) { result = toUnicode.format(result).trim(); } return result; diff --git a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java index c6a7f586a7c..7fabc59e729 100644 --- a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java +++ b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java @@ -4,7 +4,6 @@ import java.util.List; import javafx.collections.ListChangeListener; -import javafx.collections.ObservableList; import javafx.scene.control.TableColumn; import org.jabref.preferences.JabRefPreferences; @@ -23,30 +22,7 @@ public PersistenceVisualStateTable(final MainTable mainTable, JabRefPreferences this.preferences = preferences; mainTable.getColumns().addListener(this::onColumnsChanged); - mainTable.getSortOrder().addListener(this::onColumnSortOrderChanged); - - } - - private void onColumnSortOrderChanged(ListChangeListener.Change> change) { - boolean changed = false; - while (change.next()) { - changed = true; - } - - if (changed) { - updateSortOrderPreferences(change.getList()); - } - } - - private void updateSortOrderPreferences(ObservableList> observableList) { - if(observableList.isEmpty()) - return; - TableColumn column = observableList.get(0); - if (column instanceof NormalTableColumn) { - NormalTableColumn normalColumn = (NormalTableColumn) column; - preferences.setMainTableColumnSortOrder(normalColumn.getColumnName(), normalColumn.getSortType().name()); - } - + mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(observable -> preferences.setMainTableColumnSortOrder(col.getText(), col.getSortType().name()))); } private void onColumnsChanged(ListChangeListener.Change> change) { From 2300b75d6f2b6aa3fbacd2862a4ed917a8a08424 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Mon, 10 Sep 2018 13:46:01 +0200 Subject: [PATCH 03/11] fix checkstyle --- src/main/java/org/jabref/gui/maintable/MainTable.java | 4 +--- .../java/org/jabref/gui/maintable/MainTableColumnFactory.java | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 04723b50246..8f3b6ece28d 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -62,7 +62,6 @@ public class MainTable extends TableView { private final NewDroppedFileHandler fileHandler; private final CustomLocalDragboard localDragboard = GUIGlobals.localDragboard; - public MainTable(MainTableDataModel model, JabRefFrame frame, BasePanel panel, BibDatabaseContext database, MainTablePreferences preferences, ExternalFileTypes externalFileTypes, KeyBindingRepository keyBindingRepository) { @@ -116,12 +115,11 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.pane.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); //Set sort order column from preferences, currently only single column suported - this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType->{ + this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType -> { this.getSortOrder().add(col); col.setSortType(sortType); })); - // Store visual state new PersistenceVisualStateTable(this, Globals.prefs); diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java index d3a05b7e13e..ff343bc16c4 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java @@ -377,8 +377,6 @@ private TableColumn> createExtraFileCol new ValueTableCellFactory>() .withGraphic(linkedFiles -> createFileIcon(linkedFiles.stream().filter(linkedFile -> linkedFile.getFileType().equalsIgnoreCase(externalFileTypeName)).collect(Collectors.toList()))) .install(column); - - return column; } From bde05ce613b7e678627701b67ab8e148c1d29087 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Mon, 10 Sep 2018 13:53:10 +0200 Subject: [PATCH 04/11] remove old method --- .../org/jabref/preferences/JabRefPreferences.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index abe694bd1e3..70748549187 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -1874,17 +1874,6 @@ private Map createColumnWidths() { return map; } - private Map createColumnSortOrder() { - List columns = getStringList(COLUMN_NAMES); - List sortOrders = getStringList(SORT_COLUMN); - - Map map = new TreeMap<>(); - for (int i = 0; i < columns.size(); i++) { - map.put(columns.get(i), sortOrders.get(i)); - } - return map; - } - public ColumnPreferences getColumnPreferences() { return new ColumnPreferences( getBoolean(FILE_COLUMN), From 6e9a564f9eb944e194c2fae6f5cf44dd8a4d1c93 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 11 Sep 2018 13:21:16 +0200 Subject: [PATCH 05/11] refactor code --- .../gui/maintable/ColumnPreferences.java | 11 +++-------- .../org/jabref/gui/maintable/MainTable.java | 18 +++++------------- .../maintable/PersistenceVisualStateTable.java | 3 ++- .../jabref/preferences/JabRefPreferences.java | 14 ++++++++++---- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java index c5f6c9c767a..b7b24cb74ce 100644 --- a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java +++ b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java @@ -19,9 +19,9 @@ public class ColumnPreferences { private final List specialFieldColumns; private final List extraFileColumns; private final Map columnWidths; - private final List columnSortOrder; + private final Map columnSortOrder; - public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths, List columnSortOrder) { + public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths, Map columnSortOrder) { this.showFileColumn = showFileColumn; this.showUrlColumn = showUrlColumn; this.preferDoiOverUrl = preferDoiOverUrl; @@ -66,12 +66,7 @@ public double getPrefColumnWidth(String columnName) { } public Optional getSortTypeForColumn(String columnName) { - - if (columnName.equals(columnSortOrder.get(0))) { - return Optional.of(SortType.valueOf(columnSortOrder.get(1))); - } - return Optional.empty(); - + return Optional.ofNullable(columnSortOrder.get(columnName)); } } diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 8f3b6ece28d..9762fef5e1c 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -95,6 +95,11 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, .setOnDragOver(this::handleOnDragOver) .setOnMouseDragEntered(this::handleOnDragEntered) .install(this); + //Set sort order column from preferences, currently only the sort type of exactly one column is stored + this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType -> { + col.setSortType(sortType); + this.getSortOrder().add(col); + })); if (preferences.resizeColumnsToFit()) { this.setColumnResizePolicy(new SmartConstrainedResizePolicy()); @@ -102,7 +107,6 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.setItems(model.getEntriesFilteredAndSorted()); - // Enable sorting model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty()); @@ -114,21 +118,9 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.pane.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); - //Set sort order column from preferences, currently only single column suported - this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType -> { - this.getSortOrder().add(col); - col.setSortType(sortType); - })); - // Store visual state new PersistenceVisualStateTable(this, Globals.prefs); - // TODO: enable DnD - //setDragEnabled(true); - //TransferHandler xfer = new EntryTableTransferHandler(this, frame, panel); - //setTransferHandler(xfer); - //pane.setTransferHandler(xfer); - // TODO: Float marked entries //model.updateMarkingState(Globals.prefs.getBoolean(JabRefPreferences.FLOAT_MARKED_ENTRIES)); diff --git a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java index 7fabc59e729..6465f24fdd9 100644 --- a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java +++ b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java @@ -22,7 +22,8 @@ public PersistenceVisualStateTable(final MainTable mainTable, JabRefPreferences this.preferences = preferences; mainTable.getColumns().addListener(this::onColumnsChanged); - mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(observable -> preferences.setMainTableColumnSortOrder(col.getText(), col.getSortType().name()))); + mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(obs -> preferences.setMainTableColumnSortOrder(col.getText(), col.getSortType()))); + } private void onColumnsChanged(ListChangeListener.Change> change) { diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 70748549187..d14439af13f 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -34,6 +34,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javafx.scene.control.TableColumn.SortType; + import org.jabref.Globals; import org.jabref.JabRefException; import org.jabref.JabRefMain; @@ -1962,12 +1964,16 @@ public String getIdBasedFetcherForEntryGenerator() { return get(ID_ENTRY_GENERATOR); } - public void setMainTableColumnSortOrder(String column, String sortType) { - putStringList(SORT_COLUMN, Arrays.asList(column, sortType)); + public void setMainTableColumnSortOrder(String column, SortType sortType) { + putStringList(SORT_COLUMN, Arrays.asList(column, sortType.name())); } - public List getMainTableColumnSortOrder() { - return getStringList(SORT_COLUMN); + public Map getMainTableColumnSortOrder() { + List columnSortOrder = getStringList(SORT_COLUMN); + Map columnWithSortType = new HashMap<>(); + columnWithSortType.put(columnSortOrder.get(0), SortType.valueOf(columnSortOrder.get(1))); + return columnWithSortType; + } } From 067896eb17c5a63bf6616e1a19f096b3ac52c77e Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 12 Sep 2018 11:50:26 +0200 Subject: [PATCH 06/11] store column sort oder for all columns --- .../gui/maintable/ColumnPreferences.java | 13 +++--- .../org/jabref/gui/maintable/MainTable.java | 22 +++++---- .../PersistenceVisualStateTable.java | 11 ++++- .../jabref/preferences/JabRefPreferences.java | 45 ++++++++++--------- 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java index b7b24cb74ce..15f0c788cb2 100644 --- a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java +++ b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java @@ -2,8 +2,6 @@ import java.util.List; import java.util.Map; -import java.util.Optional; - import javafx.scene.control.TableColumn.SortType; import org.jabref.model.entry.BibtexSingleField; @@ -19,9 +17,9 @@ public class ColumnPreferences { private final List specialFieldColumns; private final List extraFileColumns; private final Map columnWidths; - private final Map columnSortOrder; + private final Map columnSortType; - public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths, Map columnSortOrder) { + public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean preferDoiOverUrl, boolean showEprintColumn, List normalColumns, List specialFieldColumns, List extraFileColumns, Map columnWidths, Map columnSortType) { this.showFileColumn = showFileColumn; this.showUrlColumn = showUrlColumn; this.preferDoiOverUrl = preferDoiOverUrl; @@ -30,7 +28,7 @@ public ColumnPreferences(boolean showFileColumn, boolean showUrlColumn, boolean this.specialFieldColumns = specialFieldColumns; this.extraFileColumns = extraFileColumns; this.columnWidths = columnWidths; - this.columnSortOrder = columnSortOrder; + this.columnSortType = columnSortType; } public boolean showFileColumn() { @@ -65,8 +63,7 @@ public double getPrefColumnWidth(String columnName) { return columnWidths.getOrDefault(columnName, BibtexSingleField.DEFAULT_FIELD_LENGTH); } - public Optional getSortTypeForColumn(String columnName) { - return Optional.ofNullable(columnSortOrder.get(columnName)); + public Map getSortTypesForColumns() { + return columnSortType; } - } diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 8f68f9d9aa8..3d1f67362bc 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.nio.file.Path; import java.util.List; +import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -13,6 +14,8 @@ import javafx.collections.ListChangeListener; import javafx.scene.control.ScrollPane; import javafx.scene.control.SelectionMode; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableColumn.SortType; import javafx.scene.control.TableRow; import javafx.scene.control.TableView; import javafx.scene.input.ClipboardContent; @@ -72,11 +75,10 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.undoManager = panel.getUndoManager(); fileHandler = new NewDroppedFileHandler(frame.getDialogService(), database, externalFileTypes, - Globals.prefs.getFilePreferences(), + Globals.prefs.getFilePreferences(), Globals.prefs.getImportFormatPreferences(), Globals.prefs.getUpdateFieldPreferences(), - Globals.getFileUpdateMonitor() - + Globals.getFileUpdateMonitor() ); this.getColumns().addAll(new MainTableColumnFactory(database, preferences.getColumnPreferences(), externalFileTypes, panel.getUndoManager(), frame.getDialogService()).createColumns()); @@ -93,11 +95,15 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, .setOnDragOver(this::handleOnDragOver) .setOnMouseDragEntered(this::handleOnDragEntered) .install(this); - //Set sort order column from preferences, currently only the sort type of exactly one column is stored - this.getColumns().forEach(col -> preferences.getColumnPreferences().getSortTypeForColumn(col.getText()).ifPresent(sortType -> { - col.setSortType(sortType); - this.getSortOrder().add(col); - })); + + for (Entry entries : preferences.getColumnPreferences().getSortTypesForColumns().entrySet()) + { + Optional> column = this.getColumns().stream().filter(col -> entries.getKey().equals(col.getText())).findFirst(); + column.ifPresent(col->{ + col.setSortType(entries.getValue()); + this.getSortOrder().add(col); + }); + } if (preferences.resizeColumnsToFit()) { this.setColumnResizePolicy(new SmartConstrainedResizePolicy()); diff --git a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java index 6465f24fdd9..8df3fb0659c 100644 --- a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java +++ b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java @@ -1,10 +1,13 @@ package org.jabref.gui.maintable; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import javafx.collections.ListChangeListener; import javafx.scene.control.TableColumn; +import javafx.scene.control.TableColumn.SortType; import org.jabref.preferences.JabRefPreferences; @@ -16,13 +19,14 @@ public class PersistenceVisualStateTable { private final MainTable mainTable; private final JabRefPreferences preferences; + private final Map columnsSortOrder = new LinkedHashMap<>(); public PersistenceVisualStateTable(final MainTable mainTable, JabRefPreferences preferences) { this.mainTable = mainTable; this.preferences = preferences; mainTable.getColumns().addListener(this::onColumnsChanged); - mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(obs -> preferences.setMainTableColumnSortOrder(col.getText(), col.getSortType()))); + mainTable.getColumns().forEach(col -> col.sortTypeProperty().addListener(obs -> updateColumnSortType(col.getText(), col.getSortType()))); } @@ -38,6 +42,11 @@ private void onColumnsChanged(ListChangeListener.Change fieldDirectories = Stream.of(FieldName.FILE, FieldName.PDF, FieldName.PS) .collect(Collectors.toMap(field -> field, field -> get(field + FilePreferences.DIR_SUFFIX, ""))); return new FilePreferences( - getUser(), - fieldDirectories, - getBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR), - get(IMPORT_FILENAMEPATTERN), - get(IMPORT_FILEDIRPATTERN) - ); + getUser(), + fieldDirectories, + getBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR), + get(IMPORT_FILENAMEPATTERN), + get(IMPORT_FILEDIRPATTERN)); } public UpdateFieldPreferences getUpdateFieldPreferences() { @@ -1535,7 +1535,7 @@ private NameFormatterPreferences getNameFormatterPreferences() { public FileLinkPreferences getFileLinkPreferences() { return new FileLinkPreferences( - Collections.singletonList(get(FieldName.FILE + FilePreferences.DIR_SUFFIX)), + Collections.singletonList(get(FieldName.FILE + FilePreferences.DIR_SUFFIX)), fileDirForDatabase); } @@ -1630,8 +1630,8 @@ public JournalAbbreviationPreferences getJournalAbbreviationPreferences() { public CleanupPreferences getCleanupPreferences(JournalAbbreviationLoader journalAbbreviationLoader) { return new CleanupPreferences( - getLayoutFormatterPreferences(journalAbbreviationLoader), - getFilePreferences()); + getLayoutFormatterPreferences(journalAbbreviationLoader), + getFilePreferences()); } public CleanupPreset getCleanupPreset() { @@ -1890,8 +1890,7 @@ public ColumnPreferences getColumnPreferences() { createSpecialFieldColumns(), createExtraFileColumns(), createColumnWidths(), - getMainTableColumnSortOrder()); - + getMainTableColumnSortTypes()); } public MainTablePreferences getMainTablePreferences() { @@ -1968,16 +1967,20 @@ public String getIdBasedFetcherForEntryGenerator() { return get(ID_ENTRY_GENERATOR); } - public void setMainTableColumnSortOrder(String column, SortType sortType) { - putStringList(SORT_COLUMN, Arrays.asList(column, sortType.name())); + public void setMainTableColumnSortType(Map sortOrder) { + putStringList(COLUMN_IN_SORT_ORDER, new ArrayList<>(sortOrder.keySet())); + List sortTypes = sortOrder.values().stream().map(SortType::name).collect(Collectors.toList()); + putStringList(COlUMN_IN_SORT_ORDER_TYPE, sortTypes); } - public Map getMainTableColumnSortOrder() { - List columnSortOrder = getStringList(SORT_COLUMN); - Map columnWithSortType = new HashMap<>(); - columnWithSortType.put(columnSortOrder.get(0), SortType.valueOf(columnSortOrder.get(1))); - return columnWithSortType; - + public Map getMainTableColumnSortTypes() { + List columns = getStringList(COLUMN_IN_SORT_ORDER); + List sortTypes = getStringList(COlUMN_IN_SORT_ORDER_TYPE).stream().map(SortType::valueOf).collect(Collectors.toList()); + Map map = new LinkedHashMap<>(); + for (int i = 0; i < columns.size(); i++) { + map.put(columns.get(i), sortTypes.get(i)); + } + return map; } } From 15c7c44fee6f4a239a60f0ef8cab5f96c47e577f Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 12 Sep 2018 12:03:13 +0200 Subject: [PATCH 07/11] fix checkstyle --- .../java/org/jabref/gui/maintable/ColumnPreferences.java | 1 + src/main/java/org/jabref/gui/maintable/MainTable.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java index 15f0c788cb2..7a6d88ac463 100644 --- a/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java +++ b/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java @@ -2,6 +2,7 @@ import java.util.List; import java.util.Map; + import javafx.scene.control.TableColumn.SortType; import org.jabref.model.entry.BibtexSingleField; diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 3d1f67362bc..45bbeaedc28 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -79,6 +79,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, Globals.prefs.getImportFormatPreferences(), Globals.prefs.getUpdateFieldPreferences(), Globals.getFileUpdateMonitor() + ); this.getColumns().addAll(new MainTableColumnFactory(database, preferences.getColumnPreferences(), externalFileTypes, panel.getUndoManager(), frame.getDialogService()).createColumns()); @@ -96,10 +97,9 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, .setOnMouseDragEntered(this::handleOnDragEntered) .install(this); - for (Entry entries : preferences.getColumnPreferences().getSortTypesForColumns().entrySet()) - { + for (Entry entries : preferences.getColumnPreferences().getSortTypesForColumns().entrySet()) { Optional> column = this.getColumns().stream().filter(col -> entries.getKey().equals(col.getText())).findFirst(); - column.ifPresent(col->{ + column.ifPresent(col -> { col.setSortType(entries.getValue()); this.getSortOrder().add(col); }); From 2a8296bbca78fb6f881b62154a2a7635882eac4c Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 12 Sep 2018 12:31:49 +0200 Subject: [PATCH 08/11] remove unused code --- .../org/jabref/gui/maintable/PersistenceVisualStateTable.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java index 8df3fb0659c..131e8b05c2e 100644 --- a/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java +++ b/src/main/java/org/jabref/gui/maintable/PersistenceVisualStateTable.java @@ -53,7 +53,6 @@ private void updateColumnSortType(String text, SortType sortType) { private void updateColumnPreferences() { List columnNames = new ArrayList<>(); List columnsWidths = new ArrayList<>(); - List columnSortOrders = new ArrayList<>(); for (TableColumn column : mainTable.getColumns()) { if (column instanceof NormalTableColumn) { @@ -61,8 +60,6 @@ private void updateColumnPreferences() { columnNames.add(normalColumn.getColumnName()); columnsWidths.add(String.valueOf(normalColumn.getWidth())); - columnSortOrders.add(normalColumn.getSortType().name()); - } } From 9af6979094e6db0d095bac0333223a80305d8238 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 13 Sep 2018 12:09:41 +0200 Subject: [PATCH 09/11] remove old comparator choser remove old table prefs sort order fields also from prefs --- .../org/jabref/gui/maintable/MainTable.java | 78 ----------- .../preferences/ExportSortingPrefsTab.java | 14 +- .../jabref/gui/preferences/TablePrefsTab.java | 121 +----------------- .../jabref/preferences/JabRefPreferences.java | 29 +---- 4 files changed, 11 insertions(+), 231 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index 45bbeaedc28..62167d44da8 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -352,84 +352,6 @@ public List getSelectedEntries() { .collect(Collectors.toList()); } - /** - * This method sets up what Comparators are used for the various table columns. - * The ComparatorChooser enables and disables such Comparators as the user clicks - * columns, but this is where the Comparators are defined. Also, the ComparatorChooser - * is initialized with the sort order defined in Preferences. - */ - private void setupComparatorChooser() { - // TODO: Proper sorting - - /* - // Set initial sort columns: - - // Default sort order: - String[] sortFields = new String[] { - Globals.prefs.get(JabRefPreferences.TABLE_PRIMARY_SORT_FIELD), - Globals.prefs.get(JabRefPreferences.TABLE_SECONDARY_SORT_FIELD), - Globals.prefs.get(JabRefPreferences.TABLE_TERTIARY_SORT_FIELD) - }; - boolean[] sortDirections = new boolean[] { - Globals.prefs.getBoolean(JabRefPreferences.TABLE_PRIMARY_SORT_DESCENDING), - Globals.prefs.getBoolean(JabRefPreferences.TABLE_SECONDARY_SORT_DESCENDING), - Globals.prefs.getBoolean(JabRefPreferences.TABLE_TERTIARY_SORT_DESCENDING) - }; // descending - - model.getSortedForUserDefinedTableColumnSorting().getReadWriteLock().writeLock().lock(); - try { - for (int i = 0; i < sortFields.length; i++) { - int index = -1; - - // TODO where is this prefix set? - // if (!sortFields[i].startsWith(MainTableFormat.ICON_COLUMN_PREFIX)) - if (sortFields[i].startsWith("iconcol:")) { - for (int j = 0; j < tableFormat.getColumnCount(); j++) { - if (sortFields[i].equals(tableFormat.getColumnName(j))) { - index = j; - break; - } - } - } else { - index = tableFormat.getColumnIndex(sortFields[i]); - } - if (index >= 0) { - comparatorChooser.appendComparator(index, 0, sortDirections[i]); - } - } - } finally { - model.getSortedForUserDefinedTableColumnSorting().getReadWriteLock().writeLock().unlock(); - } - - // Add action listener so we can remember the sort order: - comparatorChooser.addSortActionListener(e -> { - // Get the information about the current sort order: - List fields = getCurrentSortFields(); - List order = getCurrentSortOrder(); - // Update preferences: - int count = Math.min(fields.size(), order.size()); - if (count >= 1) { - Globals.prefs.put(JabRefPreferences.TABLE_PRIMARY_SORT_FIELD, fields.get(0)); - Globals.prefs.putBoolean(JabRefPreferences.TABLE_PRIMARY_SORT_DESCENDING, order.get(0)); - } - if (count >= 2) { - Globals.prefs.put(JabRefPreferences.TABLE_SECONDARY_SORT_FIELD, fields.get(1)); - Globals.prefs.putBoolean(JabRefPreferences.TABLE_SECONDARY_SORT_DESCENDING, order.get(1)); - } else { - Globals.prefs.put(JabRefPreferences.TABLE_SECONDARY_SORT_FIELD, ""); - Globals.prefs.putBoolean(JabRefPreferences.TABLE_SECONDARY_SORT_DESCENDING, false); - } - if (count >= 3) { - Globals.prefs.put(JabRefPreferences.TABLE_TERTIARY_SORT_FIELD, fields.get(2)); - Globals.prefs.putBoolean(JabRefPreferences.TABLE_TERTIARY_SORT_DESCENDING, order.get(2)); - } else { - Globals.prefs.put(JabRefPreferences.TABLE_TERTIARY_SORT_FIELD, ""); - Globals.prefs.putBoolean(JabRefPreferences.TABLE_TERTIARY_SORT_DESCENDING, false); - } - }); - */ - } - private Optional findEntry(BibEntry entry) { return model.getEntriesFilteredAndSorted() .stream() diff --git a/src/main/java/org/jabref/gui/preferences/ExportSortingPrefsTab.java b/src/main/java/org/jabref/gui/preferences/ExportSortingPrefsTab.java index cf1e1554819..8ca2d2bc027 100644 --- a/src/main/java/org/jabref/gui/preferences/ExportSortingPrefsTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExportSortingPrefsTab.java @@ -14,7 +14,6 @@ import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; - /** * Preference tab for file sorting options. */ @@ -26,7 +25,7 @@ class ExportSortingPrefsTab extends Pane implements PrefsTab { private final RadioButton exportInTableOrder; private final RadioButton exportInSpecifiedOrder; private final SaveOrderConfigDisplay exportOrderPanel; - private final GridPane builder = new GridPane(); + private final GridPane builder = new GridPane(); public ExportSortingPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; @@ -38,9 +37,9 @@ public ExportSortingPrefsTab(JabRefPreferences prefs) { exportOrderPanel = new SaveOrderConfigDisplay(); - EventHandler listener = (event) -> { - boolean selected = event.getSource() == exportInSpecifiedOrder; - exportOrderPanel.setEnabled(selected); + EventHandler listener = (event) -> { + boolean selected = event.getSource() == exportInSpecifiedOrder; + exportOrderPanel.setEnabled(selected); }; exportInOriginalOrder.setOnAction(listener); @@ -52,9 +51,9 @@ public ExportSortingPrefsTab(JabRefPreferences prefs) { // create GUI builder.add(exportSortOrder, 1, 1); builder.add(new Separator(), 2, 1); - builder.add(exportInOriginalOrder, 1, 2); + builder.add(exportInOriginalOrder, 1, 2); builder.add(new Line(), 2, 3); - builder.add(exportInTableOrder, 1, 4); + builder.add(exportInTableOrder, 1, 4); builder.add(new Line(), 2, 5); builder.add(exportInSpecifiedOrder, 1, 6); builder.add(new Line(), 2, 7); @@ -64,6 +63,7 @@ public ExportSortingPrefsTab(JabRefPreferences prefs) { } + @Override public Node getBuilder() { return builder; } diff --git a/src/main/java/org/jabref/gui/preferences/TablePrefsTab.java b/src/main/java/org/jabref/gui/preferences/TablePrefsTab.java index 9069ac21e09..4ec10405351 100644 --- a/src/main/java/org/jabref/gui/preferences/TablePrefsTab.java +++ b/src/main/java/org/jabref/gui/preferences/TablePrefsTab.java @@ -1,24 +1,13 @@ package org.jabref.gui.preferences; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Objects; - -import javafx.collections.FXCollections; import javafx.scene.Node; import javafx.scene.control.CheckBox; -import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; -import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; -import org.jabref.Globals; import org.jabref.logic.l10n.Localization; -import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.InternalBibtexFields; import org.jabref.preferences.JabRefPreferences; class TablePrefsTab extends Pane implements PrefsTab { @@ -26,9 +15,6 @@ class TablePrefsTab extends Pane implements PrefsTab { private final JabRefPreferences prefs; private final CheckBox autoResizeMode; - private final CheckBox priDesc; - private final CheckBox secDesc; - private final CheckBox terDesc; private final RadioButton namesAsIs; private final RadioButton namesFf; @@ -38,13 +24,6 @@ class TablePrefsTab extends Pane implements PrefsTab { private final RadioButton noAbbrNames; private final RadioButton lastNamesOnly; - private final TextField priField; - private final TextField secField; - private final TextField terField; - private final TextField numericFields; - private final ComboBox priSort; - private final ComboBox secSort; - private final ComboBox terSort; private final GridPane builder = new GridPane(); /** @@ -62,13 +41,6 @@ public TablePrefsTab(JabRefPreferences prefs) { * * http://sourceforge.net/tracker/index.php?func=detail&aid=1540646&group_id=92314&atid=600306 */ - List fieldNames = InternalBibtexFields.getAllPublicFieldNames(); - fieldNames.add(BibEntry.KEY_FIELD); - Collections.sort(fieldNames); - String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]); - priSort = new ComboBox<>(FXCollections.observableArrayList(allPlusKey)); - secSort = new ComboBox<>(FXCollections.observableArrayList(allPlusKey)); - terSort = new ComboBox<>(FXCollections.observableArrayList(allPlusKey)); autoResizeMode = new CheckBox(Localization.lang("Fit table horizontally on screen")); namesAsIs = new RadioButton(Localization.lang("Show names unchanged")); @@ -79,36 +51,6 @@ public TablePrefsTab(JabRefPreferences prefs) { abbrNames = new RadioButton(Localization.lang("Abbreviate names")); lastNamesOnly = new RadioButton(Localization.lang("Show last names only")); - priField = new TextField(); - secField = new TextField(); - terField = new TextField(); - - numericFields = new TextField(); - - priSort.setValue(Localization.lang("")); - terSort.setValue(Localization.lang("= Abbreviate\ journal\ names\ of\ the\ selected\ entries\ (ISO\ abbreviation)=Abbreviate journal names of the selected entries (ISO abbreviation) Abbreviate\ journal\ names\ of\ the\ selected\ entries\ (MEDLINE\ abbreviation)=Abbreviate journal names of the selected entries (MEDLINE abbreviation)