Skip to content
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[master]
- Feature: Gridlines are now optional (and disabled by default)
- Fix for bug #1270: Cleanup entries error 3
- Fix for bug #919: Accents don't export to RTF (by ruy.takata)
- Change the CrossRef content negotiation for bibtex DOI import (by sheffien)
Expand Down
29 changes: 27 additions & 2 deletions src/main/java/net/sf/jabref/AppearancePrefsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
class AppearancePrefsTab extends JPanel implements PrefsTab {

JabRefPreferences _prefs;
private JCheckBox colorCodes, overrideFonts;//, useCustomIconTheme;
private JCheckBox colorCodes, overrideFonts, showGrid;//, useCustomIconTheme;
private ColorSetupPanel colorPanel = new ColorSetupPanel();
private Font font = GUIGlobals.CURRENTFONT;
private int oldMenuFontSize;
private boolean oldOverrideFontSize;
private JTextField fontSize;//, customIconThemeFile;
private JTextField fontSize, gridPadding;//, customIconThemeFile;

/**
* Customization of appearance parameters.
Expand All @@ -57,6 +57,9 @@ public AppearancePrefsTab(JabRefPreferences prefs) {
("Use antialiasing font"));*/
overrideFonts = new JCheckBox(Globals.lang("Override default font settings"));

gridPadding = new JTextField(5);
showGrid = new JCheckBox(Globals.lang("Show gridlines"));

//useCustomIconTheme = new JCheckBox(Globals.lang("Use custom icon theme"));
//customIconThemeFile = new JTextField();
FormLayout layout = new FormLayout
Expand All @@ -79,6 +82,14 @@ public AppearancePrefsTab(JabRefPreferences prefs) {
//builder.nextLine();
builder.append(colorCodes);
builder.nextLine();
builder.append(showGrid);
builder.nextLine();
JPanel panelGridPadding = new JPanel();
lab = new JLabel(Globals.lang("Additional cell padding (in px)") + ":");
panelGridPadding.add(lab);
panelGridPadding.add(gridPadding);
builder.append(panelGridPadding);
builder.nextLine();
JButton fontButton = new JButton(Globals.lang("Set table font"));
builder.append(fontButton);
builder.nextLine();
Expand Down Expand Up @@ -149,6 +160,8 @@ public void setValues() {
fontSize.setEnabled(overrideFonts.isSelected());
//useCustomIconTheme.setSelected(_prefs.getBoolean("useCustomIconTheme"));
//customIconThemeFile.setText(_prefs.get("customIconThemeFile"));
showGrid.setSelected(_prefs.getBoolean("tableShowGrid"));
gridPadding.setText("" + _prefs.getInt("tablePadding"));
colorPanel.setValues();
}

Expand All @@ -167,6 +180,7 @@ public void storeSettings() {
_prefs.putBoolean("overrideDefaultFonts", overrideFonts.isSelected());
GUIGlobals.CURRENTFONT = font;
colorPanel.storeSettings();
_prefs.putBoolean("tableShowGrid", showGrid.isSelected());
try {
int size = Integer.parseInt(fontSize.getText());
if ((overrideFonts.isSelected() != oldOverrideFontSize) ||
Expand All @@ -179,6 +193,7 @@ public void storeSettings() {
Globals.lang("Changed font settings"),
JOptionPane.WARNING_MESSAGE);
}
_prefs.putInt("tablePadding", Integer.parseInt(gridPadding.getText()));

} catch (NumberFormatException ex) {
ex.printStackTrace();
Expand All @@ -196,6 +211,16 @@ public boolean readyToClose() {
JOptionPane.ERROR_MESSAGE);
return false;
}
try {
// Test if table padding is a number:
Integer.parseInt(gridPadding.getText());
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog
(null, Globals.lang("You must enter an integer value in the text field for") + " '" +
Globals.lang("Additional cell padding (in px)") + "'", Globals.lang("Changed table settings"),
JOptionPane.ERROR_MESSAGE);
return false;
}
return true;

}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/sf/jabref/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.sf.jabref;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
Expand Down Expand Up @@ -45,6 +46,7 @@
import java.util.logging.Logger;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
Expand Down Expand Up @@ -2078,6 +2080,10 @@ protected boolean accept(Component c) {

splitPane.setTopComponent(mainTable.getPane());

// Remove borders
splitPane.setBorder(BorderFactory.createEmptyBorder());
setBorder(BorderFactory.createEmptyBorder());

//setupTable();
// If an entry is currently being shown, make sure it stays shown,
// otherwise set the bottom component to null.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jabref/EntryEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;

import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
Expand Down Expand Up @@ -129,7 +130,7 @@ void setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyField,

DefaultFormBuilder builder = new DefaultFormBuilder
(new FormLayout(colSpec, rowSpec), panel);

for (int i = 0; i < fields.length; i++) {
// Create the text area:
int editorType = BibtexFields.getEditorType(fields[i]);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jabref/FieldNameLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public FieldNameLabel(String name) {
setVerticalAlignment(TOP);
//setFont(GUIGlobals.fieldNameFont);
setForeground(GUIGlobals.entryEditorLabelColor);
setBorder(BorderFactory.createMatteBorder(1,0,0,0, Color.GRAY));
// setBorder(BorderFactory.createMatteBorder(1,0,0,0, Color.GRAY));
//setBorder(BorderFactory.createEtchedBorder());
setBorder(BorderFactory.createEmptyBorder());
}

public void paintComponent(Graphics g) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/GUIGlobals.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class GUIGlobals {
public static final int
SPLIT_PANE_DIVIDER_SIZE = 4,
SPLIT_PANE_DIVIDER_LOCATION = 145 + 15, // + 15 for possible scrollbar.
TABLE_ROW_PADDING = 4,
TABLE_ROW_PADDING = 8,
KEYBIND_COL_0 = 200,
KEYBIND_COL_1 = 80, // Added to the font size when determining table
MAX_CONTENT_SELECTOR_WIDTH = 240; // The max width of the combobox for content selectors.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ public void addTab(BasePanel bp, File file, boolean raisePanel) {
} else {
title = file.getName();
}
tabbedPane.add(title, bp);
tabbedPane.add("<html><div style='padding:2px 5px;'>" + title + "</div></html>", bp);
tabbedPane.setToolTipTextAt(tabbedPane.getTabCount()-1,
file != null ? file.getAbsolutePath() : null);
if (raisePanel) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ private JabRefPreferences() {
defaults.put("tableReqFieldBackground", "230:235:255");
defaults.put("tableOptFieldBackground", "230:255:230");
defaults.put("tableText", "0:0:0");
defaults.put("tablePadding", 0);
defaults.put("tableShowGrid", Boolean.FALSE);
defaults.put("gridColor", "210:210:210");
defaults.put("grayedOutBackground", "210:210:210");
defaults.put("grayedOutText", "40:40:40");
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jabref/SidePaneComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.awt.event.ActionListener;
import java.net.URL;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JToolBar;
Expand Down Expand Up @@ -50,7 +51,7 @@ public SidePaneComponent(SidePaneManager manager, URL icon, String title) {
close.addActionListener(new CloseButtonListener());
setToolBar(tlb);
// setBorder(BorderFactory.createEtchedBorder());

setBorder(BorderFactory.createEmptyBorder());
// setBorder(BorderFactory.createMatteBorder(1,1,1,1,java.awt.Color.green));
// setPreferredSize(new java.awt.Dimension
// (GUIGlobals.SPLIT_PANE_DIVIDER_LOCATION, 200));
Expand Down
20 changes: 16 additions & 4 deletions src/main/java/net/sf/jabref/gui/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.sf.jabref.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand All @@ -25,6 +26,7 @@

import javax.swing.*;
import javax.swing.plaf.TableUI;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;

Expand Down Expand Up @@ -84,6 +86,7 @@ public MainTable(MainTableFormat tableFormat, EventList<BibtexEntry> list, JabRe

addFocusListener(Globals.focusListener);
setAutoResizeMode(Globals.prefs.getInt("autoResizeMode"));

this.tableFormat = tableFormat;
this.panel = panel;
// This SortedList has a Comparator controlled by the TableComparatorChooser
Expand All @@ -109,9 +112,17 @@ public MainTable(MainTableFormat tableFormat, EventList<BibtexEntry> list, JabRe
selectionModel = new EventSelectionModel<BibtexEntry>(sortedForGrouping);
setSelectionModel(selectionModel);
pane = new JScrollPane(this);
pane.setBorder(BorderFactory.createEmptyBorder());
pane.getViewport().setBackground(Globals.prefs.getColor("tableBackground"));
setGridColor(Globals.prefs.getColor("gridColor"));

if(Globals.prefs.getBoolean("tableShowGrid"))
setShowGrid(true);
else
{
setShowGrid(false);
setIntercellSpacing(new Dimension(0, 0));
}

this.setTableHeader(new PreventDraggingJTableHeader(this.getColumnModel()));

comparatorChooser = this.createTableComparatorChooser(this, sortedForTable,
Expand Down Expand Up @@ -217,7 +228,7 @@ public JScrollPane getPane() {
public TableCellRenderer getCellRenderer(int row, int column) {

int score = -3;
TableCellRenderer renderer = defRenderer;
DefaultTableCellRenderer renderer = defRenderer;

int status = getCellStatus(row, column);

Expand Down Expand Up @@ -256,14 +267,15 @@ else if (column == 0) {
} else
renderer = compRenderer;
}
renderer.setHorizontalAlignment( JLabel.CENTER );
}
else if (tableColorCodes) {
if (status == REQUIRED)
renderer = reqRenderer;
else if (status == OPTIONAL)
renderer = optRenderer;
else if (status == BOOLEAN)
renderer = getDefaultRenderer(Boolean.class);
renderer = (DefaultTableCellRenderer) getDefaultRenderer(Boolean.class);
}

// For MARKED feature:
Expand Down Expand Up @@ -525,7 +537,7 @@ public void scrollTo(int y) {
*/
public void updateFont() {
setFont(GUIGlobals.CURRENTFONT);
setRowHeight(GUIGlobals.TABLE_ROW_PADDING + GUIGlobals.CURRENTFONT.getSize());
setRowHeight(GUIGlobals.TABLE_ROW_PADDING + Globals.prefs.getInt("tablePadding") + GUIGlobals.CURRENTFONT.getSize());
}

public void ensureVisible(int row) {
Expand Down