Skip to content

Commit

Permalink
Table row height adjusts on Windows as the font scales with the menu (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus authored and koppor committed Aug 17, 2016
1 parent 6649636 commit 1af96f3
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- [#462](https://github.com/JabRef/jabref/issues/462) Extend the OpenConsoleFeature by offering a selection between default terminal emulator and configurable command execution.
- The field name in the layout files for entry type is changed from `bibtextype` to `entrytype`. Please update your existing files as support for `bibtextype` will be removed eventually.
- [#1516](https://github.com/JabRef/jabref/issues/1516) Selected field names are written in uppercase in the entry editor
- Table row height is adjusted on Windows which is useful for high resolution displays
- For developers: Moved the bst package into logic. This requires the regeneration of antlr sources, execute: gradlew generateSource
- [#1026](https://github.com/JabRef/jabref/issues/1026) JabRef does no longer delete user comments outside of BibTeX entries and strings
- [#1249](https://github.com/JabRef/jabref/issues/1249) Date layout formatter added
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/sf/jabref/collab/ChangeDisplayDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import net.sf.jabref.gui.BasePanel;
import net.sf.jabref.gui.undo.NamedCompound;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.database.BibDatabase;

Expand Down Expand Up @@ -64,6 +65,8 @@ public ChangeDisplayDialog(JFrame owner, final BasePanel panel,
}
tree = new JTree(root);
tree.addTreeSelectionListener(this);
GUIUtil.correctRowHeight(tree);

JSplitPane pane = new JSplitPane();
pane.setLeftComponent(new JScrollPane(tree));
JPanel infoBorder = new JPanel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import net.sf.jabref.gui.JabRefFrame;
import net.sf.jabref.gui.actions.MnemonicAwareAction;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;

import com.jgoodies.forms.builder.ButtonBarBuilder;
Expand Down Expand Up @@ -181,6 +182,8 @@ public void actionPerformed(ActionEvent e) {
table.getColumnModel().getColumn(3).setMinWidth(100);
table.getColumnModel().getColumn(0).setResizable(false);

GUIUtil.correctRowHeight(table);

JScrollPane sp = new JScrollPane(table);

JPanel upper = new JPanel();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/sf/jabref/gui/FindUnlinkedFilesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import net.sf.jabref.gui.importer.EntryFromFileCreatorManager;
import net.sf.jabref.gui.importer.UnlinkedFilesCrawler;
import net.sf.jabref.gui.importer.UnlinkedPDFFileFilter;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.EntryTypes;
import net.sf.jabref.model.entry.EntryType;
Expand Down Expand Up @@ -798,6 +799,8 @@ public void windowClosing(WindowEvent e) {
labelImportingInfo.setVisible(false);

tree = new JTree();
GUIUtil.correctRowHeight(tree);

scrollpaneTree = new JScrollPane(tree);
scrollpaneTree.setWheelScrollingEnabled(true);

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/gui/StringDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import net.sf.jabref.gui.undo.UndoableInsertString;
import net.sf.jabref.gui.undo.UndoableRemoveString;
import net.sf.jabref.gui.undo.UndoableStringChange;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.gui.util.PositionWindow;
import net.sf.jabref.logic.bibtex.LatexFieldFormatter;
import net.sf.jabref.logic.bibtex.LatexFieldFormatterPreferences;
Expand Down Expand Up @@ -122,6 +123,7 @@ protected boolean accept(Component c) {
if (!base.hasNoStrings()) {
table.setRowSelectionInterval(0, 0);
}
GUIUtil.correctRowHeight(table);

gbl.setConstraints(table.getPane(), con);
pan.add(table.getPane());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

import net.sf.jabref.Globals;
import net.sf.jabref.gui.JabRefFrame;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.integrity.IntegrityCheck;
import net.sf.jabref.logic.integrity.IntegrityMessage;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.preferences.JabRefPreferences;

import com.jgoodies.forms.builder.FormBuilder;
import com.jgoodies.forms.layout.FormLayout;
Expand Down Expand Up @@ -95,7 +94,7 @@ public boolean include(Entry<?, ?> entry) {
}
});

table.setRowHeight(Globals.prefs.getInt(JabRefPreferences.MENU_FONT_SIZE) + 2);
GUIUtil.correctRowHeight(table);

table.getColumnModel().getColumn(0).setPreferredWidth(100);
table.getColumnModel().getColumn(1).setPreferredWidth(60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import net.sf.jabref.gui.fieldeditors.TextField;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.FocusRequester;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.autocompleter.AutoCompleter;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldProperties;
Expand Down Expand Up @@ -151,7 +152,10 @@ private void setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyField
int wHeight = (int) (50.0 * InternalBibtexFields.getFieldWeight(field));
if (InternalBibtexFields.getFieldExtras(field).contains(FieldProperties.FILE_EDITOR)) {
fieldEditor = new FileListEditor(frame, bPanel.getBibDatabaseContext(), field, null, parent);

fileListEditor = (FileListEditor) fieldEditor;
GUIUtil.correctRowHeight(fileListEditor);

defaultHeight = 0;
} else {
fieldEditor = new TextArea(field, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import net.sf.jabref.gui.help.HelpAction;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.FocusRequester;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.help.HelpFile;
import net.sf.jabref.logic.l10n.Localization;

Expand Down Expand Up @@ -83,6 +84,7 @@ public ExportCustomizationDialog(final JabRefFrame frame) {
table.setRowSelectionInterval(0, 0);
}

GUIUtil.correctRowHeight(table);

JButton addExport = new JButton(Localization.lang("Add new"));
addExport.addActionListener(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import net.sf.jabref.gui.desktop.JabRefDesktop;
import net.sf.jabref.gui.entryeditor.EntryEditor;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.util.io.FileUtil;
import net.sf.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -106,6 +107,8 @@ public FileListEditor(JabRefFrame frame, BibDatabaseContext databaseContext, Str
setTableHeader(null);
addMouseListener(new TableClickListener());

GUIUtil.correctRowHeight(this);

JButton add = new JButton(IconTheme.JabRefIcon.ADD_NOBOX.getSmallIcon());
add.setToolTipText(Localization.lang("New file link (INSERT)"));
JButton remove = new JButton(IconTheme.JabRefIcon.REMOVE_NOBOX.getSmallIcon());
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/sf/jabref/gui/groups/GroupsTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package net.sf.jabref.gui.groups;

import java.awt.Cursor;
import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.datatransfer.Transferable;
Expand Down Expand Up @@ -49,6 +48,7 @@
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;

import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.groups.AbstractGroup;
import net.sf.jabref.logic.groups.EntriesGroupChange;
import net.sf.jabref.logic.groups.GroupTreeNode;
Expand Down Expand Up @@ -96,9 +96,7 @@ public class GroupsTree extends JTree implements DragSourceListener,
* @param groupSelector the parent UI component
*/
public GroupsTree(GroupSelector groupSelector) {
// Adjust height according to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4760081
FontMetrics metrics = getFontMetrics(getFont());
setRowHeight(Math.max(getRowHeight(), metrics.getHeight()));
GUIUtil.correctRowHeight(this);

this.groupSelector = groupSelector;
DragGestureRecognizer dgr = DragSource.getDefaultDragSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.sf.jabref.gui.help.HelpAction;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.FocusRequester;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.help.HelpFile;
import net.sf.jabref.logic.importer.ImportFormatPreferences;
import net.sf.jabref.logic.importer.fileformat.CustomImporter;
Expand Down Expand Up @@ -99,6 +100,8 @@ public ImportCustomizationDialog(final JabRefFrame frame) {
customImporterTable.setRowSelectionInterval(0, 0);
}

GUIUtil.correctRowHeight(customImporterTable);

JButton addFromFolderButton = new JButton(Localization.lang("Add from folder"));
addFromFolderButton.addActionListener(e -> {
CustomImporter importer = new CustomImporter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import net.sf.jabref.gui.undo.NamedCompound;
import net.sf.jabref.gui.undo.UndoableInsertEntry;
import net.sf.jabref.gui.undo.UndoableRemoveEntry;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.gui.util.comparator.IconComparator;
import net.sf.jabref.gui.util.component.CheckBoxMessage;
import net.sf.jabref.logic.bibtex.comparator.FieldComparator;
Expand Down Expand Up @@ -237,6 +238,8 @@ public ImportInspectionDialog(JabRefFrame frame, BasePanel panel, String undoNam
setupComparatorChooser();
glTable.addMouseListener(new TableClickListener());

GUIUtil.correctRowHeight(glTable);

setWidths();

getContentPane().setLayout(new BorderLayout());
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/gui/importer/ZipFileChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import javax.swing.table.TableColumnModel;

import net.sf.jabref.gui.util.FocusRequester;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.importer.fileformat.CustomImporter;
import net.sf.jabref.logic.importer.fileformat.ImportFormat;
import net.sf.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -94,6 +95,7 @@ public ZipFileChooser(ImportCustomizationDialog importCustomizationDialog, ZipFi
if (table.getRowCount() > 0) {
table.setRowSelectionInterval(0, 0);
}
GUIUtil.correctRowHeight(table);

// cancel: no entry is selected
JButton cancelButton = new JButton(Localization.lang("Cancel"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import net.sf.jabref.gui.help.HelpAction;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.net.MonitoredURLDownload;

import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.help.HelpFile;
import net.sf.jabref.logic.journals.Abbreviation;
import net.sf.jabref.logic.journals.JournalAbbreviationLoader;
Expand Down Expand Up @@ -192,6 +192,8 @@ public ManageJournalsPanel(final JabRefFrame frame) {
viewBuiltin.addActionListener(e -> {
JTable table = new JTable(JournalAbbreviationsUtil.getTableModel(Globals.journalAbbreviationLoader
.getRepository(JournalAbbreviationPreferences.fromPreferences(Globals.prefs)).getAbbreviations()));
GUIUtil.correctRowHeight(table);

JScrollPane pane = new JScrollPane(table);
JOptionPane.showMessageDialog(null, pane, Localization.lang("Journal list preview"),
JOptionPane.INFORMATION_MESSAGE);
Expand Down Expand Up @@ -325,6 +327,8 @@ private void setupUserTable() {

tableModel.setJournals(userAbbreviations);
userTable = new JTable(tableModel);
GUIUtil.correctRowHeight(userTable);

userTable.addMouseListener(tableModel.getMouseListener());
userPanel.add(new JScrollPane(userTable), BorderLayout.CENTER);
}
Expand Down Expand Up @@ -580,6 +584,8 @@ private void setupPanel() {
.readJournalListFromFile(new File(tf.getText()));

JTable table = new JTable(JournalAbbreviationsUtil.getTableModel(abbreviations));
GUIUtil.correctRowHeight(table);

JScrollPane pane = new JScrollPane(table);
JOptionPane.showMessageDialog(null, pane, Localization.lang("Journal list preview"),
JOptionPane.INFORMATION_MESSAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.swing.table.TableColumnModel;

import net.sf.jabref.Globals;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;

/**
Expand Down Expand Up @@ -93,6 +94,8 @@ private KeyBindingTable setupTable() {
table.setColumnSelectionAllowed(false);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setAutoCreateRowSorter(true);
GUIUtil.correctRowHeight(table);

return table;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.sf.jabref.Globals;
import net.sf.jabref.gui.JabRefFrame;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.openoffice.CitationEntry;

Expand Down Expand Up @@ -87,6 +88,8 @@ public CitationManager(final JabRefFrame frame, OOBibBase ooBase)
}
tableModel = new DefaultEventTableModel<>(list, new CitationEntryFormat());
table = new JTable(tableModel);
GUIUtil.correctRowHeight(table);

diag.add(new JScrollPane(table), BorderLayout.CENTER);

ButtonBarBuilder bb = new ButtonBarBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import net.sf.jabref.gui.actions.BrowseAction;
import net.sf.jabref.gui.desktop.JabRefDesktop;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.gui.util.PositionWindow;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.openoffice.OOBibStyle;
Expand Down Expand Up @@ -228,6 +229,8 @@ private void setupTable() {
cm.getColumn(0).setPreferredWidth(100);
cm.getColumn(1).setPreferredWidth(200);
cm.getColumn(2).setPreferredWidth(80);
GUIUtil.correctRowHeight(table);

selectionModel = (DefaultEventSelectionModel<OOBibStyle>) GlazedListsSwing
.eventSelectionModelWithThreadProxyList(sortedStyles);
table.setSelectionModel(selectionModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.sf.jabref.gui.IconTheme;
import net.sf.jabref.gui.OSXCompatibleToolbar;
import net.sf.jabref.gui.help.HelpAction;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.help.HelpFile;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.layout.format.NameFormatter;
Expand Down Expand Up @@ -169,6 +170,8 @@ public void setValueAt(Object value, int row, int col) {
};

table = new JTable(tableModel);
GUIUtil.correctRowHeight(table);

TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(140);
columnModel.getColumn(1).setPreferredWidth(400);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javax.swing.table.AbstractTableModel;

import net.sf.jabref.gui.WrapLayout;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.preferences.JabRefPreferencesFilter;

Expand Down Expand Up @@ -48,6 +49,8 @@ public PreferencesFilterDialog(JabRefPreferencesFilter preferencesFilter, JFrame

table = new JTable();
table.setAutoCreateRowSorter(true);
GUIUtil.correctRowHeight(table);

updateModel();
panel.add(new JScrollPane(table), BorderLayout.CENTER);

Expand Down Expand Up @@ -102,7 +105,7 @@ public int getColumnCount() {

@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (rowIndex < 0 || rowIndex - 1 > preferences.size()) {
if ((rowIndex < 0) || ((rowIndex - 1) > preferences.size())) {
return "n/a";
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/gui/preftabs/TableColumnsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import net.sf.jabref.gui.JabRefFrame;
import net.sf.jabref.gui.OSXCompatibleToolbar;
import net.sf.jabref.gui.help.HelpAction;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.help.HelpFile;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.entry.BibtexSingleField;
Expand Down Expand Up @@ -247,6 +248,7 @@ public void setValueAt(Object value, int row, int col) {
TableColumnModel cm = colSetup.getColumnModel();
cm.getColumn(0).setPreferredWidth(140);
cm.getColumn(1).setPreferredWidth(80);
GUIUtil.correctRowHeight(colSetup);

FormLayout layout = new FormLayout
("1dlu, 8dlu, left:pref, 4dlu, fill:pref","");
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/sf/jabref/gui/preftabs/XmpPrefsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import net.sf.jabref.gui.IconTheme;
import net.sf.jabref.gui.OSXCompatibleToolbar;
import net.sf.jabref.gui.util.GUIUtil;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -125,6 +126,8 @@ public void setValueAt(Object value, int row, int col) {
};

table = new JTable(tableModel);
GUIUtil.correctRowHeight(table);

TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(140);

Expand Down
Loading

0 comments on commit 1af96f3

Please sign in to comment.