From 6ee8c0bd098c788991e2b15ef973b68c8a7e425c Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Thu, 7 Jan 2010 10:20:39 +0000 Subject: [PATCH] add the ability to add user plots from a JVM option (userplot) git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@12867 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- .../sanger/artemis/components/GraphMenu.java | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/uk/ac/sanger/artemis/components/GraphMenu.java b/uk/ac/sanger/artemis/components/GraphMenu.java index 520157c1a..63c7f6d36 100644 --- a/uk/ac/sanger/artemis/components/GraphMenu.java +++ b/uk/ac/sanger/artemis/components/GraphMenu.java @@ -168,7 +168,7 @@ public class GraphMenu extends JMenu { try { - addUserPlot (); + addUserPlot (null); adjustSplitPane(true); } catch(java.lang.OutOfMemoryError emem) @@ -241,6 +241,26 @@ public class GraphMenu extends JMenu new MessageDialog (frame, "error while reading usage data: " + e); } } + + // add user plots from the command line JVM option + if(System.getProperty("userplot") != null) + { + String plots[] = System.getProperty("userplot").split("\\s"); + try + { + for(int i=0;i<plots.length; i++) + { + File f = new File(plots[i]); + if(f.exists()) + addUserPlot (f); + else + System.err.println(plots[i]+" not found."); + } + splitPane.setDividerSize(3); + splitPane.setDividerLocation(150); + } + catch(Exception e){} + } } /** @@ -525,28 +545,30 @@ public class GraphMenu extends JMenu /** * Add a UserDataAlgorithm to the display. **/ - private void addUserPlot () + private void addUserPlot (File file) { - final JFrame frame = Utilities.getComponentFrame (base_plot_group); - final StickyFileChooser dialog = new StickyFileChooser (); - - dialog.setDialogTitle ("Select a data file name ..."); - dialog.setDialogType (JFileChooser.OPEN_DIALOG); final JCheckBox logTransform = new JCheckBox("Use log(data+1)", false); - dialog.setAccessory(logTransform); - - final int status = dialog.showOpenDialog (frame); - - if (status != JFileChooser.APPROVE_OPTION || - dialog.getSelectedFile () == null) + if (file == null) { - return; - } + final JFrame frame = Utilities.getComponentFrame(base_plot_group); + final StickyFileChooser dialog = new StickyFileChooser(); - final File file = - new File (dialog.getCurrentDirectory (), - dialog.getSelectedFile ().getName ()); + dialog.setDialogTitle("Select a data file name ..."); + dialog.setDialogType(JFileChooser.OPEN_DIALOG); + dialog.setAccessory(logTransform); + + final int status = dialog.showOpenDialog(frame); + if(status != JFileChooser.APPROVE_OPTION || + dialog.getSelectedFile() == null) + { + return; + } + + file = new File(dialog.getCurrentDirectory(), + dialog.getSelectedFile().getName()); + } + frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (file.length () != 0) { -- GitLab