diff --git a/uk/ac/sanger/artemis/components/GraphMenu.java b/uk/ac/sanger/artemis/components/GraphMenu.java index 72b05f3cd27a8fcd01a769e0652b103ffa1e4f40..fde8f89f3d0242698da434a97ee6aa4da720a657 100644 --- a/uk/ac/sanger/artemis/components/GraphMenu.java +++ b/uk/ac/sanger/artemis/components/GraphMenu.java @@ -46,6 +46,7 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.IOException; import java.io.File; +import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.Vector; @@ -170,7 +171,7 @@ public class GraphMenu extends JMenu { try { - addUserPlot (null); + addUserPlot ((uk.ac.sanger.artemis.util.Document)null, false); adjustSplitPane(true); } catch(java.lang.OutOfMemoryError emem) @@ -245,34 +246,24 @@ public class GraphMenu extends JMenu } // add user plots from the command line JVM option - if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null) + if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null || + System.getProperty("loguserplot"+ (index > 0 ? index : "")) != null) { - String plots[] = System.getProperty("userplot"+ (index > 0 ? index : "")).split("[\\s,]"); + String plots[] = new String[]{}; + if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null) + plots = System.getProperty("userplot"+ (index > 0 ? index : "")).split("[\\s,]"); + + String logplots[] = new String[]{}; + if(System.getProperty("loguserplot"+ (index > 0 ? index : "")) != null) + logplots = System.getProperty("loguserplot"+ (index > 0 ? index : "")).split("[\\s,]"); try { for(int i=0;i<plots.length; i++) - { - if(plots[i].startsWith("http:") || - plots[i].startsWith("file:") || - plots[i].startsWith("ftp:")) - { - uk.ac.sanger.artemis.util.Document document = - new uk.ac.sanger.artemis.util.URLDocument (new URL(plots[i])); - addUserPlot (document); - } - else - { - File f = new File(plots[i]); - if(f.exists()) - { - uk.ac.sanger.artemis.util.Document document = - new uk.ac.sanger.artemis.util.FileDocument (f); - addUserPlot (document); - } - else - System.err.println(plots[i]+" not found."); - } - } + addUserPlot (plots[i], false); + + for(int i=0;i<logplots.length; i++) + addUserPlot (logplots[i], true); + splitPane.setDividerSize(3); splitPane.setDividerLocation(150); } @@ -559,12 +550,27 @@ public class GraphMenu extends JMenu return true; } + private void addUserPlot (final String plot, final boolean isLog) throws MalformedURLException + { + if (plot.startsWith("http:") || plot.startsWith("file:") || plot.startsWith("ftp:")) + addUserPlot(new uk.ac.sanger.artemis.util.URLDocument(new URL(plot)), isLog); + else + { + File f = new File(plot); + if (f.exists()) + addUserPlot(new uk.ac.sanger.artemis.util.FileDocument(f), isLog); + else + System.err.println(plot + " not found."); + } + } + /** * Add a UserDataAlgorithm to the display. **/ - private void addUserPlot (uk.ac.sanger.artemis.util.Document document) + private void addUserPlot (uk.ac.sanger.artemis.util.Document document, + boolean isLog) { - final JCheckBox logTransform = new JCheckBox("Use log(data+1)", false); + final JCheckBox logTransform = new JCheckBox("Use log(data+1)", isLog); if (document == null) { final JFrame frame = Utilities.getComponentFrame(base_plot_group);