From: hansonr Date: Thu, 20 Dec 2018 12:10:52 +0000 (-0600) Subject: JalviewFileChooser back to original; synth. ref fixed in j2sClazz.js X-Git-Tag: Release_2_11_4_0~45^2~18^2~337 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6b62e4c0242d4f6d43fb0059f32268ff9e992e4f;p=jalview.git JalviewFileChooser back to original; synth. ref fixed in j2sClazz.js --- diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 9667d7f..c275ef0 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -126,7 +126,7 @@ public class JalviewFileChooser extends JFileChooser implements DialogRunnerI, public JalviewFileChooser(String dir) { super(safePath(dir)); - setAccessory(new RecentlyOpened(this)); + setAccessory(new RecentlyOpened()); } public JalviewFileChooser(String dir, String[] suffix, String[] desc, @@ -238,7 +238,7 @@ public class JalviewFileChooser extends JFileChooser implements DialogRunnerI, setFileFilter(chosen); } - setAccessory(new RecentlyOpened(this)); + setAccessory(new RecentlyOpened()); } @Override @@ -423,6 +423,78 @@ public class JalviewFileChooser extends JFileChooser implements DialogRunnerI, } } + class RecentlyOpened extends JPanel + { + private static final long serialVersionUID = 1L; + JList list; + + RecentlyOpened() + { + setPreferredSize(new Dimension(300,100)); + String historyItems = Cache.getProperty("RECENT_FILE"); + StringTokenizer st; + Vector recent = new Vector<>(); + + if (historyItems != null) + { + st = new StringTokenizer(historyItems, "\t"); + + while (st.hasMoreTokens()) + { + recent.addElement(st.nextToken()); + } + } + + list = new JList<>(recent); + + DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); +// dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT); + list.setCellRenderer(dlcr); + + list.addMouseListener(new MouseAdapter() + { + @Override + public void mousePressed(MouseEvent evt) + { + recentListSelectionChanged(list.getSelectedValue()); + } + }); + + this.setBorder(new javax.swing.border.TitledBorder( + MessageManager.getString("label.recently_opened"))); + + final JScrollPane scroller = new JScrollPane(list); + + SpringLayout layout = new SpringLayout(); + layout.putConstraint(SpringLayout.WEST, scroller, 5, + SpringLayout.WEST, this); + layout.putConstraint(SpringLayout.NORTH, scroller, 5, + SpringLayout.NORTH, this); + + if (Platform.isAMac()) + { + scroller.setPreferredSize(new Dimension(500, 100)); + } + else + { + scroller.setPreferredSize(new Dimension(530, 200)); + } + + this.add(scroller); + + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + @Override + public void run() + { + scroller.getHorizontalScrollBar() + .setValue(scroller.getHorizontalScrollBar().getMaximum()); + } + }); + + } + + } @Override public DialogRunnerI setResponseHandler(Object response, Runnable action) @@ -470,78 +542,3 @@ public class JalviewFileChooser extends JFileChooser implements DialogRunnerI, } } } - -class RecentlyOpened extends JPanel -{ - private static final long serialVersionUID = 1L; - JList list; - private JalviewFileChooser chooser; - - RecentlyOpened(JalviewFileChooser chooser) - { - this.chooser = chooser; - setPreferredSize(new Dimension(300,100)); - String historyItems = Cache.getProperty("RECENT_FILE"); - StringTokenizer st; - Vector recent = new Vector<>(); - - if (historyItems != null) - { - st = new StringTokenizer(historyItems, "\t"); - - while (st.hasMoreTokens()) - { - recent.addElement(st.nextToken()); - } - } - - list = new JList<>(recent); - - DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); -// dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT); - list.setCellRenderer(dlcr); - - list.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent evt) - { - chooser.recentListSelectionChanged(list.getSelectedValue()); - } - }); - - this.setBorder(new javax.swing.border.TitledBorder( - MessageManager.getString("label.recently_opened"))); - - final JScrollPane scroller = new JScrollPane(list); - - SpringLayout layout = new SpringLayout(); - layout.putConstraint(SpringLayout.WEST, scroller, 5, - SpringLayout.WEST, this); - layout.putConstraint(SpringLayout.NORTH, scroller, 5, - SpringLayout.NORTH, this); - - if (Platform.isAMac()) - { - scroller.setPreferredSize(new Dimension(500, 100)); - } - else - { - scroller.setPreferredSize(new Dimension(530, 200)); - } - - this.add(scroller); - - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - scroller.getHorizontalScrollBar() - .setValue(scroller.getHorizontalScrollBar().getMaximum()); - } - }); - - } - -} diff --git a/swingjs/SwingJS-site.zip b/swingjs/SwingJS-site.zip index 18c3244..cda8f81 100644 Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ diff --git a/swingjs/timestamp b/swingjs/timestamp index e84618b..2635141 100644 --- a/swingjs/timestamp +++ b/swingjs/timestamp @@ -1 +1 @@ -20181220041423 +20181220060627 diff --git a/swingjs/ver/3.2.4/SwingJS-site.zip b/swingjs/ver/3.2.4/SwingJS-site.zip index 18c3244..cda8f81 100644 Binary files a/swingjs/ver/3.2.4/SwingJS-site.zip and b/swingjs/ver/3.2.4/SwingJS-site.zip differ diff --git a/swingjs/ver/3.2.4/timestamp b/swingjs/ver/3.2.4/timestamp index e84618b..2635141 100644 --- a/swingjs/ver/3.2.4/timestamp +++ b/swingjs/ver/3.2.4/timestamp @@ -1 +1 @@ -20181220041423 +20181220060627