Skip to content
Snippets Groups Projects
Commit 95265b86 authored by tjc's avatar tjc
Browse files

allow userplot to be loaded as a URL

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@13010 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 3ad38819
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.URL;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
...@@ -250,11 +251,26 @@ public class GraphMenu extends JMenu ...@@ -250,11 +251,26 @@ public class GraphMenu extends JMenu
{ {
for(int i=0;i<plots.length; i++) for(int i=0;i<plots.length; i++)
{ {
File f = new File(plots[i]); if(plots[i].startsWith("http:") ||
if(f.exists()) plots[i].startsWith("file:") ||
addUserPlot (f); 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 else
System.err.println(plots[i]+" not found."); {
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);
...@@ -545,10 +561,10 @@ public class GraphMenu extends JMenu ...@@ -545,10 +561,10 @@ public class GraphMenu extends JMenu
/** /**
* Add a UserDataAlgorithm to the display. * Add a UserDataAlgorithm to the display.
**/ **/
private void addUserPlot (File file) private void addUserPlot (uk.ac.sanger.artemis.util.Document document)
{ {
final JCheckBox logTransform = new JCheckBox("Use log(data+1)", false); final JCheckBox logTransform = new JCheckBox("Use log(data+1)", false);
if (file == null) if (document == null)
{ {
final JFrame frame = Utilities.getComponentFrame(base_plot_group); final JFrame frame = Utilities.getComponentFrame(base_plot_group);
final StickyFileChooser dialog = new StickyFileChooser(); final StickyFileChooser dialog = new StickyFileChooser();
...@@ -565,17 +581,16 @@ public class GraphMenu extends JMenu ...@@ -565,17 +581,16 @@ public class GraphMenu extends JMenu
return; return;
} }
file = new File(dialog.getCurrentDirectory(), File file = new File(dialog.getCurrentDirectory(),
dialog.getSelectedFile().getName()); dialog.getSelectedFile().getName());
document =
new uk.ac.sanger.artemis.util.FileDocument (file);
} }
frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
if (file.length () != 0)
{ final Strand forward_strand =
final uk.ac.sanger.artemis.util.Document document =
new uk.ac.sanger.artemis.util.FileDocument (file);
final Strand forward_strand =
getEntryGroup ().getBases ().getForwardStrand (); getEntryGroup ().getBases ().getForwardStrand ();
try try
...@@ -614,7 +629,7 @@ public class GraphMenu extends JMenu ...@@ -614,7 +629,7 @@ public class GraphMenu extends JMenu
new MessageDialog (Utilities.getComponentFrame (base_plot_group), new MessageDialog (Utilities.getComponentFrame (base_plot_group),
"error while reading user data: " + e); "error while reading user data: " + e);
} }
}
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
} }
......
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