Skip to content

Commit

Permalink
Increase relative size of abstract field in editor (#3320)
Browse files Browse the repository at this point in the history
* Increase relative size of abstract field in editor

* Fix build

* Code cleanup

* Fix imports
  • Loading branch information
tobiasdiez committed Oct 19, 2017
1 parent 460b7e8 commit 1751cba
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 192 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Updated French translation
- We improved the handling of abstracts in the "Astrophysics Data System" fetcher. [#2471](https://github.com/JabRef/jabref/issues/2471)
- We added support for pasting entries in different formats [#3143](https://github.com/JabRef/jabref/issues/3143)
- We increased the relative size of the "abstract" field in the entry editor. [Feature request in the forum](http://discourse.jabref.org/t/entry-preview-in-version-4/827)
- Crossreferenced entries are now used when a BibTex key is generated for an entry with empty fields. [#2811](https://github.com/JabRef/jabref/issues/2811)
- We now set the WM_CLASS of the UI to org-jabref-JabRefMain to allow certain Un*x window managers to properly identify its windows
- We changed the default paths for the OpenOffice/LibreOffice binaries to the default path for LibreOffice
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ public void actionPerformed(ActionEvent event) {

//TODO: See if we need to update an AutoCompleter instance:
/*
AutoCompleter<String> aComp = panel.getSuggestionProviders().get(fieldEditor.getFieldName());
AutoCompleter<String> aComp = panel.getSuggestionProviders().get(fieldEditor.getName());
if (aComp != null) {
aComp.addBibtexEntry(entry);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean compresse
FieldEditor fieldEditor;
int defaultHeight;
int wHeight = (int) (50.0 * InternalBibtexFields.getFieldWeight(field));
if (InternalBibtexFields.getFieldProperties(field).contains(FieldProperty.SINGLE_ENTRY_LINK)) {
if (InternalBibtexFields.getProperties(field).contains(FieldProperty.SINGLE_ENTRY_LINK)) {
fieldEditor = new EntryLinkListEditor(frame, bPanel.getBibDatabaseContext(), field, null, parent,
true);
defaultHeight = 0;
} else if (InternalBibtexFields.getFieldProperties(field).contains(FieldProperty.MULTIPLE_ENTRY_LINK)) {
} else if (InternalBibtexFields.getProperties(field).contains(FieldProperty.MULTIPLE_ENTRY_LINK)) {
fieldEditor = new EntryLinkListEditor(frame, bPanel.getBibDatabaseContext(), field, null, parent,
false);
defaultHeight = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean compresse

setRegularRowLayout(gridPane, rows);
}

if (GUIGlobals.currentFont != null) {
gridPane.setStyle(
"text-area-background: " + convertToHex(GUIGlobals.validFieldBackgroundColor) + ";"
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public static FieldEditorFX getForField(String fieldName, TaskExecutor taskExecu
return new PersonsEditor(fieldName, suggestionProvider, preferences, fieldCheckers);
} else if (FieldName.KEYWORDS.equals(fieldName)) {
return new KeywordsEditor(fieldName, suggestionProvider, fieldCheckers, preferences);
} else if (fieldExtras.contains(FieldProperty.MULTILINE_TEXT)) {
return new MultilineEditor(fieldName, suggestionProvider, fieldCheckers, preferences);
}

// default
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/jabref/gui/fieldeditors/MultilineEditor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.jabref.gui.fieldeditors;

import org.jabref.gui.autocompleter.AutoCompleteSuggestionProvider;
import org.jabref.logic.integrity.FieldCheckers;
import org.jabref.preferences.JabRefPreferences;

public class MultilineEditor extends SimpleEditor implements FieldEditorFX {

public MultilineEditor(String fieldName, AutoCompleteSuggestionProvider<?> suggestionProvider, FieldCheckers fieldCheckers, JabRefPreferences preferences) {
super (fieldName, suggestionProvider, fieldCheckers, preferences);
}

@Override
public double getWeight() {
return 4;
}
}
43 changes: 7 additions & 36 deletions src/main/java/org/jabref/model/entry/BibtexSingleField.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
* Class for keeping properties of a single BibTeX/biblatex field
*/
public class BibtexSingleField {
// some field constants
public static final double DEFAULT_FIELD_WEIGHT = 1;
public static final double MAX_FIELD_WEIGHT = 2;

public static final double SMALL_W = 0.30;
public static final double MEDIUM_W = 0.5;
public static final double LARGE_W = 1.5;

public static final int DEFAULT_FIELD_LENGTH = 100;

Expand All @@ -31,8 +24,7 @@ private enum Flag {
// default is: not standard, public, displayable and writable
private final Set<Flag> flags = EnumSet.of(Flag.DISPLAYABLE, Flag.WRITEABLE);

private int length = DEFAULT_FIELD_LENGTH;
private double weight = DEFAULT_FIELD_WEIGHT;
private final int length;

// properties contains a set of FieldProperty to e.g. tell the EntryEditor to add a specific
// function to this field, to format names, or to control the integrity checks.
Expand All @@ -43,14 +35,7 @@ private enum Flag {
// private String otherNames = null ;

public BibtexSingleField(String fieldName, boolean pStandard) {
name = fieldName;
setFlag(pStandard, Flag.STANDARD);
}

public BibtexSingleField(String fieldName, boolean pStandard, double pWeight) {
name = fieldName;
setFlag(pStandard, Flag.STANDARD);
weight = pWeight;
this(fieldName, pStandard, DEFAULT_FIELD_LENGTH);
}

public BibtexSingleField(String fieldName, boolean pStandard, int pLength) {
Expand All @@ -59,13 +44,6 @@ public BibtexSingleField(String fieldName, boolean pStandard, int pLength) {
length = pLength;
}

public BibtexSingleField(String fieldName, boolean pStandard, double pWeight, int pLength) {
name = fieldName;
setFlag(pStandard, Flag.STANDARD);
weight = pWeight;
length = pLength;
}

/**
* Sets or onsets the given flag
* @param setToOn if true, set the flag; if false, unset the flat
Expand Down Expand Up @@ -113,32 +91,25 @@ public boolean isWriteable() {
return flags.contains(Flag.WRITEABLE);
}

public void setExtras(Set<FieldProperty> pExtras) {
properties = pExtras;
public BibtexSingleField withProperties(FieldProperty first, FieldProperty... rest) {
properties = EnumSet.of(first, rest);
return this;
}

// fieldExtras contains mappings to tell the EntryEditor to add a specific
// function to this field, for instance a "browse" button for the "pdf" field.
public Set<FieldProperty> getFieldProperties() {
public Set<FieldProperty> getProperties() {
return properties;
}

public void setWeight(double value) {
this.weight = value;
}

public double getWeight() {
return this.weight;
}

/**
* @return The maximum (expected) length of the field value; <em>not</em> the length of the field name
*/
public int getLength() {
return this.length;
}

public String getFieldName() {
public String getName() {
return name;
}

Expand Down
10 changes: 2 additions & 8 deletions src/main/java/org/jabref/model/entry/FieldProperty.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.jabref.model.entry;

import java.util.EnumSet;
import java.util.Set;

public enum FieldProperty {
YES_NO,
DATE,
Expand All @@ -20,16 +17,13 @@ public enum FieldProperty {
EDITOR_TYPE,
PAGINATION,
TYPE,
CROSSREF,
ISO_DATE,
ISBN,
EPRINT,
BOOK_NAME,
SINGLE_ENTRY_LINK,
MULTIPLE_ENTRY_LINK,
PUBLICATION_STATE,
VERBATIM;

public static final Set<FieldProperty> ALL_OPTS = EnumSet.allOf(FieldProperty.class);

MULTILINE_TEXT,
VERBATIM
}
Loading

0 comments on commit 1751cba

Please sign in to comment.