Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store column widths as integer #4896

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ private void updateColumnPreferences() {
NormalTableColumn normalColumn = (NormalTableColumn) column;

columnNames.add(normalColumn.getColumnName());
columnsWidths.add(String.valueOf(normalColumn.getWidth()));
columnsWidths.add(String.valueOf(Double.valueOf(normalColumn.getWidth()).intValue()));
}
}

if (columnNames.size() == columnsWidths.size() &&
columnNames.size() == preferences.getStringList(JabRefPreferences.COLUMN_NAMES).size()) {
if ((columnNames.size() == columnsWidths.size()) &&
(columnNames.size() == preferences.getStringList(JabRefPreferences.COLUMN_NAMES).size())) {
preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columnNames);
preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columnsWidths);
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jabref/gui/preferences/TableColumnsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public void storeSettings() {

for (TableRow tr : data) {
names.add(tr.getName().toLowerCase(Locale.ROOT));
widths.add(String.valueOf(tr.getLength()));
widths.add(String.valueOf(Double.valueOf(tr.getLength()).intValue()));
}

// Finally, we store the new preferences.
Expand All @@ -522,14 +522,14 @@ private void updateOrderAction() {
final HashMap<String, Integer> map = new HashMap<>();

// first element (#) not inside data
/*
for (TableColumn<BibEntry, ?> column : panel.getMainTable().getColumns()) {
String name = column.getText();
if ((name != null) && !name.isEmpty()) {
map.put(name.toLowerCase(Locale.ROOT), i);
}
/*
for (TableColumn<BibEntry, ?> column : panel.getMainTable().getColumns()) {
String name = column.getText();
if ((name != null) && !name.isEmpty()) {
map.put(name.toLowerCase(Locale.ROOT), i);
}
*/
}
*/
data.sort((o1, o2) -> {
Integer n1 = map.get(o1.getName());
Integer n2 = map.get(o2.getName());
Expand Down