Skip to content

Commit

Permalink
Updated preview entries
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Jul 22, 2016
1 parent 2989a1b commit 258faef
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 63 deletions.
20 changes: 3 additions & 17 deletions src/main/java/net/sf/jabref/gui/openoffice/StyleSelectDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
import net.sf.jabref.logic.openoffice.OOBibStyle;
import net.sf.jabref.logic.openoffice.OpenOfficePreferences;
import net.sf.jabref.logic.openoffice.StyleLoader;
import net.sf.jabref.logic.util.TestEntry;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;
import net.sf.jabref.model.entry.IdGenerator;
import net.sf.jabref.preferences.JabRefPreferences;

import ca.odell.glazedlists.BasicEventList;
Expand Down Expand Up @@ -109,7 +108,7 @@ class StyleSelectDialog {
private final Rectangle toRect = new Rectangle(0, 0, 1, 1);
private final JButton ok = new JButton(Localization.lang("OK"));
private final JButton cancel = new JButton(Localization.lang("Cancel"));
private final BibEntry prevEntry = new BibEntry(IdGenerator.next());
private final BibEntry prevEntry;

private boolean okPressed;
private final StyleLoader loader;
Expand All @@ -121,7 +120,7 @@ public StyleSelectDialog(JabRefFrame frame, OpenOfficePreferences preferences, S
this.frame = Objects.requireNonNull(frame);
this.preferences = Objects.requireNonNull(preferences);
this.loader = Objects.requireNonNull(loader);
setupPrevEntry();
prevEntry = TestEntry.getTestEntry();
init();

}
Expand Down Expand Up @@ -372,19 +371,6 @@ private Optional<OOBibStyle> getSelectedStyle() {
return Optional.empty();
}

private void setupPrevEntry() {
prevEntry.setField(FieldName.AUTHOR, "Smith, Bill and Jones, Bob and Williams, Jeff");
prevEntry.setField(FieldName.EDITOR, "Taylor, Phil");
prevEntry.setField(FieldName.TITLE, "Title of the test entry for reference styles");
prevEntry.setField(FieldName.VOLUME, "34");
prevEntry.setField(FieldName.YEAR, "2008");
prevEntry.setField(FieldName.JOURNAL, "BibTeX journal");
prevEntry.setField(FieldName.PUBLISHER, "JabRef publishing");
prevEntry.setField(FieldName.ADDRESS, "Trondheim");
prevEntry.setField("www", "https://github.com/JabRef");
}


static class StyleTableFormat implements TableFormat<OOBibStyle> {

@Override
Expand Down
49 changes: 3 additions & 46 deletions src/main/java/net/sf/jabref/gui/preftabs/PreviewPrefsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@

import net.sf.jabref.gui.PreviewPanel;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.util.TestEntry;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;
import net.sf.jabref.model.entry.IdGenerator;
import net.sf.jabref.preferences.JabRefPreferences;

import org.apache.commons.logging.Log;
Expand Down Expand Up @@ -154,7 +153,7 @@ public PreviewPrefsTab(JabRefPreferences prefs) {
});

testButton.addActionListener(e -> {
PreviewPrefsTab.getTestEntry();
TestEntry.getTestEntry();
try {
PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout1.getText());
testPanel.setPreferredSize(new Dimension(800, 350));
Expand All @@ -169,7 +168,7 @@ public PreviewPrefsTab(JabRefPreferences prefs) {
});

testButton2.addActionListener(e -> {
PreviewPrefsTab.getTestEntry();
TestEntry.getTestEntry();
try {
PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout2.getText());
testPanel.setPreferredSize(new Dimension(800, 350));
Expand All @@ -185,48 +184,6 @@ public PreviewPrefsTab(JabRefPreferences prefs) {
});
}

private static BibEntry getTestEntry() {
if (PreviewPrefsTab.entry != null) {
return PreviewPrefsTab.entry;
}
PreviewPrefsTab.entry = new BibEntry(IdGenerator.next(), "article");
PreviewPrefsTab.entry.setCiteKey("conceicao1997");
PreviewPrefsTab.entry.setField(FieldName.AUTHOR,
"Luis E. C. Conceic{\\~a}o and Terje van der Meeren and Johan A. J. Verreth and M S. Evjen and D. F. Houlihan and H. J. Fyhn");
PreviewPrefsTab.entry.setField(FieldName.TITLE,
"Amino acid metabolism and protein turnover in larval turbot (Scophthalmus maximus) fed natural zooplankton or Artemia");
PreviewPrefsTab.entry.setField(FieldName.YEAR, "1997");
PreviewPrefsTab.entry.setField(FieldName.JOURNAL, "Marine Biology");
PreviewPrefsTab.entry.setField(FieldName.MONTH, "January");
PreviewPrefsTab.entry.setField(FieldName.NUMBER, "2");
PreviewPrefsTab.entry.setField(FieldName.VOLUME, "123");
PreviewPrefsTab.entry.setField("pdf", "conceicao1997.pdf");
PreviewPrefsTab.entry.setField(FieldName.PAGES, "255--265");
PreviewPrefsTab.entry.setField(FieldName.KEYWORDS, "energetics, artemia, metabolism, amino acid, turbot");
PreviewPrefsTab.entry.setField(FieldName.URL, "http://ejournals.ebsco.com/direct.asp?ArticleID=TYY4NT82XA9H7R8PFPPV");
PreviewPrefsTab.entry.setField(FieldName.ABSTRACT,
"Abstract The present paper studied the influence of different food regimes "
+ "on the free amino acid (FAA) pool, the rate of protein turnover, the flux of amino acids, and "
+ "their relation to growth of larval turbot (Scophthalmus maximus L.) from first feeding until "
+ "metamorphosis. The amino acid profile of protein was stable during the larval period although "
+ "some small, but significant, differences were found. Turbot larvae had proteins which were rich "
+ "in leucine and aspartate, and poor in glutamate, suggesting a high leucine requirement. The "
+ "profile of the FAA pool was highly variable and quite different from the amino acid profile in "
+ "protein. The proportion of essential FAA decreased with development. High contents of free tyrosine "
+ "and phenylalanine were found on Day 3, while free taurine was present at high levels throughout "
+ "the experimental period. Larval growth rates were positively correlated with taurine levels, "
+ "suggesting a dietary dependency for taurine and/or sulphur amino acids.\n\nReduced growth rates in "
+ "Artemia-fed larvae were associated with lower levels of free methionine, indicating that this diet "
+ "is deficient in methionine for turbot larvae. Leucine might also be limiting turbot growth as the "
+ "different diet organisms had lower levels of this amino acid in the free pool than was found in the "
+ "larval protein. A previously presented model was used to describe the flux of amino acids in growing "
+ "turbot larvae. The FAA pool was found to be small and variable. It was estimated that the daily dietary "
+ "amino acid intake might be up to ten times the larval FAA pool. In addition, protein synthesis and "
+ "protein degradation might daily remove and return, respectively, the equivalent of up to 20 and 10 "
+ "times the size of the FAA pool. In an early phase (Day 11) high growth rates were associated with a "
+ "relatively low protein turnover, while at a later stage (Day 17), a much higher turnover was observed.");
return PreviewPrefsTab.entry;
}

@Override
public void setValues() {
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/net/sf/jabref/logic/util/TestEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.sf.jabref.logic.util;

import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;
import net.sf.jabref.model.entry.IdGenerator;

public class TestEntry {

private static BibEntry entry;


public static BibEntry getTestEntry() {
if (entry == null) {
entry = new BibEntry(IdGenerator.next(), "article");
entry.setField(FieldName.AUTHOR, "Smith, Bill and Jones, Bob and Williams, Jeff");
entry.setField(FieldName.EDITOR, "Taylor, Phil");
entry.setField(FieldName.TITLE, "Title of the test entry");
entry.setField(FieldName.NUMBER, "3");
entry.setField(FieldName.VOLUME, "34");
entry.setField(FieldName.YEAR, "2016");
entry.setField(FieldName.PAGES, "45--67");
entry.setField(FieldName.MONTH, "July");
entry.setField(FieldName.FILE, ":testentry.pdf:PDF");
entry.setField(FieldName.JOURNAL, "BibTeX Journal");
entry.setField(FieldName.PUBLISHER, "JabRef Publishing");
entry.setField(FieldName.ADDRESS, "Trondheim");
entry.setField(FieldName.URL, "https://github.com/JabRef");
entry.setField(FieldName.ABSTRACT,
"This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical bib-file mananger.");
}
return entry;
}
}

0 comments on commit 258faef

Please sign in to comment.