5 import java.awt.event.*;
7 public class PreviewPrefsTab extends JPanel implements PrefsTab {
9 JabRefPreferences _prefs;
13 JPanel pan = new JPanel();
15 GridBagLayout gbl = new GridBagLayout();
17 GridBagConstraints con = new GridBagConstraints();
19 JTextArea layout1 = new JTextArea("", 1, 1), layout2 = new JTextArea("", 1, 1);
21 JButton def1 = new JButton(Globals.lang("Default")),
22 def2 = new JButton(Globals.lang("Default")), test1 = new JButton(Globals.lang("Test")),
23 test2 = new JButton(Globals.lang("Test")), help;
25 JPanel p1 = new JPanel(), p2 = new JPanel();
27 JScrollPane sp1 = new JScrollPane(layout1), sp2 = new JScrollPane(layout2);
29 private static BibtexEntry entry;
31 public PreviewPrefsTab(JabRefPreferences prefs) {
39 lab = new JLabel(Globals.lang("Preview") + " 1");
40 con.anchor = GridBagConstraints.WEST;
41 con.gridwidth = GridBagConstraints.REMAINDER;
42 con.fill = GridBagConstraints.BOTH;
45 con.insets = new Insets(2, 2, 2, 2);
46 gbl.setConstraints(lab, con);
49 gbl.setConstraints(sp1, con);
54 con.fill = GridBagConstraints.NONE;
55 con.anchor = GridBagConstraints.WEST;
56 gbl.setConstraints(test1, con);
58 gbl.setConstraints(def1, con);
60 con.gridwidth = GridBagConstraints.REMAINDER;
61 JPanel pan = new JPanel();
63 gbl.setConstraints(pan, con);
65 lab = new JLabel(Globals.lang("Preview") + " 2");
66 gbl.setConstraints(lab, con);
69 con.fill = GridBagConstraints.BOTH;
70 gbl.setConstraints(sp2, con);
74 con.fill = GridBagConstraints.NONE;
76 gbl.setConstraints(test2, con);
78 gbl.setConstraints(def2, con);
83 gbl.setConstraints(pan, con);
87 HelpAction helpAction = new HelpAction(Globals.helpDiag, GUIGlobals.previewHelp,
88 Globals.lang("Help on Preview Settings"), GUIGlobals.getIconUrl("helpSmall"));
89 JButton help = helpAction.getIconButton();
91 con.gridwidth = GridBagConstraints.REMAINDER;
92 gbl.setConstraints(help, con);
98 con.fill = GridBagConstraints.BOTH;
99 con.gridwidth = GridBagConstraints.REMAINDER;
100 lab = new JLabel(Globals.lang("Preview") + " 1");
101 gbl.setConstraints(lab, con);
104 gbl.setConstraints(p1, con);
106 lab = new JLabel(Globals.lang("Preview") + " 2");
108 JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
109 gbl.setConstraints(sep, con);
111 gbl.setConstraints(lab, con);
114 gbl.setConstraints(p2, con);
117 def1.addActionListener(new ActionListener() {
118 public void actionPerformed(ActionEvent e) {
119 String tmp = layout1.getText().replaceAll("\n", "__NEWLINE__");
120 _prefs.remove("preview0");
121 layout1.setText(_prefs.get("preview0").replaceAll("__NEWLINE__", "\n"));
122 _prefs.put("preview0", tmp);
125 def2.addActionListener(new ActionListener() {
126 public void actionPerformed(ActionEvent e) {
127 String tmp = layout2.getText().replaceAll("\n", "__NEWLINE__");
128 _prefs.remove("preview1");
129 layout2.setText(_prefs.get("preview1").replaceAll("__NEWLINE__", "\n"));
130 _prefs.put("preview1", tmp);
134 test1.addActionListener(new ActionListener() {
135 public void actionPerformed(ActionEvent e) {
137 PreviewPanel testPanel = new PreviewPanel(entry, new MetaData(), layout1.getText());
138 testPanel.setPreferredSize(new Dimension(800, 350));
139 JOptionPane.showMessageDialog(null, testPanel, Globals.lang("Preview"),
140 JOptionPane.PLAIN_MESSAGE);
144 test2.addActionListener(new ActionListener() {
145 public void actionPerformed(ActionEvent e) {
147 PreviewPanel testPanel = new PreviewPanel(entry, new MetaData(), layout2.getText());
148 testPanel.setPreferredSize(new Dimension(800, 350));
149 JOptionPane.showMessageDialog(null, new JScrollPane(testPanel), Globals
150 .lang("Preview"), JOptionPane.PLAIN_MESSAGE);
155 public static BibtexEntry getTestEntry() {
158 entry = new BibtexEntry(Util.createNeutralId(), BibtexEntryType.getType("article"));
159 entry.setField(BibtexFields.KEY_FIELD, "conceicao1997");
163 "L. E. C. Conceic{\\~a}o and T. van der Meeren and J. A. J. Verreth and M. S. Evjen and D. F. Houlihan and H. J. Fyhn");
167 "Amino acid metabolism and protein turnover in larval turbot (Scophthalmus maximus) fed natural zooplankton or Artemia");
168 entry.setField("year", "1997");
169 entry.setField("journal", "Marine Biology");
170 entry.setField("month", "January");
171 entry.setField("number", "2");
172 entry.setField("volume", "123");
173 entry.setField("pdf", "conceicao1997.pdf");
174 entry.setField("pages", "255--265");
175 entry.setField("keywords", "energetics, artemia, metabolism, amino acid, turbot");
176 entry.setField("url",
177 "http://ejournals.ebsco.com/direct.asp?ArticleID=TYY4NT82XA9H7R8PFPPV");
181 "Abstract The present paper studied the influence of different food regimes "
182 + "on the free amino acid (FAA) pool, the rate of protein turnover, the flux of amino acids, and "
183 + "their relation to growth of larval turbot (Scophthalmus maximus L.) from first feeding until "
184 + "metamorphosis. The amino acid profile of protein was stable during the larval period although "
185 + "some small, but significant, differences were found. Turbot larvae had proteins which were rich "
186 + "in leucine and aspartate, and poor in glutamate, suggesting a high leucine requirement. The "
187 + "profile of the FAA pool was highly variable and quite different from the amino acid profile in "
188 + "protein. The proportion of essential FAA decreased with development. High contents of free tyrosine "
189 + "and phenylalanine were found on Day 3, while free taurine was present at high levels throughout "
190 + "the experimental period. Larval growth rates were positively correlated with taurine levels, "
191 + "suggesting a dietary dependency for taurine and/or sulphur amino acids.\n\nReduced growth rates in "
192 + "Artemia-fed larvae were associated with lower levels of free methionine, indicating that this diet "
193 + "is deficient in methionine for turbot larvae. Leucine might also be limiting turbot growth as the "
194 + "different diet organisms had lower levels of this amino acid in the free pool than was found in the "
195 + "larval protein. A previously presented model was used to describe the flux of amino acids in growing "
196 + "turbot larvae. The FAA pool was found to be small and variable. It was estimated that the daily dietary "
197 + "amino acid intake might be up to ten times the larval FAA pool. In addition, protein synthesis and "
198 + "protein degradation might daily remove and return, respectively, the equivalent of up to 20 and 10 "
199 + "times the size of the FAA pool. In an early phase (Day 11) high growth rates were associated with a "
200 + "relatively low protein turnover, while at a later stage (Day 17), a much higher turnover was observed.");
204 public void setValues() {
205 layout1.setText(_prefs.get("preview0").replaceAll("__NEWLINE__", "\n"));
206 layout2.setText(_prefs.get("preview1").replaceAll("__NEWLINE__", "\n"));
209 public void storeSettings() {
210 _prefs.put("preview0", layout1.getText().replaceAll("\n", "__NEWLINE__"));
211 _prefs.put("preview1", layout2.getText().replaceAll("\n", "__NEWLINE__"));
214 public boolean readyToClose() {
218 public String getTabName() {
219 return Globals.lang("Entry preview");