Skip to content
Snippets Groups Projects
Commit 22c621a6 authored by tcarver's avatar tcarver
Browse files

add loguserplot as a JVM option

parent feba0dab
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ import java.awt.event.ItemEvent; ...@@ -46,6 +46,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.io.IOException; import java.io.IOException;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
...@@ -170,7 +171,7 @@ public class GraphMenu extends JMenu ...@@ -170,7 +171,7 @@ public class GraphMenu extends JMenu
{ {
try try
{ {
addUserPlot (null); addUserPlot ((uk.ac.sanger.artemis.util.Document)null, false);
adjustSplitPane(true); adjustSplitPane(true);
} }
catch(java.lang.OutOfMemoryError emem) catch(java.lang.OutOfMemoryError emem)
...@@ -245,34 +246,24 @@ public class GraphMenu extends JMenu ...@@ -245,34 +246,24 @@ public class GraphMenu extends JMenu
} }
// add user plots from the command line JVM option // 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 try
{ {
for(int i=0;i<plots.length; i++) for(int i=0;i<plots.length; i++)
{ addUserPlot (plots[i], false);
if(plots[i].startsWith("http:") ||
plots[i].startsWith("file:") || for(int i=0;i<logplots.length; i++)
plots[i].startsWith("ftp:")) addUserPlot (logplots[i], true);
{
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.");
}
}
splitPane.setDividerSize(3); splitPane.setDividerSize(3);
splitPane.setDividerLocation(150); splitPane.setDividerLocation(150);
} }
...@@ -559,12 +550,27 @@ public class GraphMenu extends JMenu ...@@ -559,12 +550,27 @@ public class GraphMenu extends JMenu
return true; 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. * 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) if (document == null)
{ {
final JFrame frame = Utilities.getComponentFrame(base_plot_group); final JFrame frame = Utilities.getComponentFrame(base_plot_group);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment