import jalview.datamodel.SequenceI;
import jalview.io.AnnotationFile;
import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormatI;
import jalview.io.FileParse;
import jalview.io.IdentifyFile;
import jalview.io.JPredFile;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
public void loadAnnotationFrom(AlignFrame alf, String annotation)
{
if (new AnnotationFile().annotateAlignmentView(alf.getAlignViewport(),
- annotation, AppletFormatAdapter.PASTE))
+ annotation, DataSourceType.PASTE))
{
alf.alignPanel.fontChanged();
alf.alignPanel.setScrollValues(0, 0);
}
else
{
- alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
+ alf.parseFeaturesFile(annotation, DataSourceType.PASTE);
}
}
public boolean loadFeaturesFrom(AlignFrame alf, String features,
boolean autoenabledisplay)
{
- return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE,
+ return alf.parseFeaturesFile(features, DataSourceType.PASTE,
autoenabledisplay);
}
{
AlignmentI al = null;
- String format = new IdentifyFile().identify(text,
- AppletFormatAdapter.PASTE);
try
{
- al = new AppletFormatAdapter().readFile(text,
- AppletFormatAdapter.PASTE, format);
+ FileFormatI format = new IdentifyFile().identify(text,
+ DataSourceType.PASTE);
+ al = new AppletFormatAdapter().readFile(text, DataSourceType.PASTE,
+ format);
if (al.getHeight() > 0)
{
return new AlignFrame(al, this, title, false);
}
- } catch (java.io.IOException ex)
+ } catch (IOException ex)
{
ex.printStackTrace();
}
/**
* State variable: protocol for access to file source
*/
- String protocol;
+ DataSourceType protocol;
String _file; // alignment file or URL spec
*/
if (path.startsWith("PASTE"))
{
- protocol = AppletFormatAdapter.PASTE;
+ protocol = DataSourceType.PASTE;
return path.substring(5);
}
*/
if (path.indexOf("://") != -1)
{
- protocol = AppletFormatAdapter.URL;
+ protocol = DataSourceType.URL;
return path;
}
System.err.println("Prepended document base '" + documentBase
+ "' to make: '" + withDocBase + "'");
}
- protocol = AppletFormatAdapter.URL;
+ protocol = DataSourceType.URL;
return withDocBase;
}
if (!withCodeBase.equals(withDocBase)
&& HttpUtils.isValidUrl(withCodeBase))
{
- protocol = AppletFormatAdapter.URL;
+ protocol = DataSourceType.URL;
if (debug)
{
System.err.println("Prepended codebase '" + codeBase
*/
if (inArchive(path))
{
- protocol = AppletFormatAdapter.CLASSLOADER;
+ protocol = DataSourceType.CLASSLOADER;
}
return path;
}
return null;
}
String resolvedFile = resolveFileProtocol(fileParam);
- String format = new IdentifyFile().identify(resolvedFile, protocol);
- dbgMsg("File identified as '" + format + "'");
AlignmentI al = null;
try
{
+ FileFormatI format = new IdentifyFile().identify(resolvedFile,
+ protocol);
+ dbgMsg("File identified as '" + format + "'");
al = new AppletFormatAdapter().readFile(resolvedFile, protocol,
format);
if ((al != null) && (al.getHeight() > 0))
// update the focus.
currentAlignFrame = newAlignFrame;
- if (protocol == AppletFormatAdapter.PASTE)
+ if (protocol == DataSourceType.PASTE)
{
newAlignFrame.setTitle(MessageManager.formatMessage(
"label.sequences_from", new Object[] { applet
}
else
{
- pdbs.addElement(new Object[] { pdb, seqs, chains,
- new String(protocol) });
+ pdbs.addElement(new Object[] { pdb, seqs, chains, protocol });
}
}
}