+
+ public AlignViewportI getViewport()
+ {
+ return viewport;
+ }
+
+ public void setViewport(AlignViewportI viewport)
+ {
+ this.viewport = viewport;
+ }
+
+ /**
+ * @return the currently configured exportSettings for writing data.
+ */
+ public AlignExportSettingsI getExportSettings()
+ {
+ return exportSettings;
+ }
+
+ /**
+ * Set configuration for export of data.
+ *
+ * @param exportSettings
+ * the exportSettings to set
+ */
+ public void setExportSettings(AlignExportSettingsI exportSettings)
+ {
+ this.exportSettings = exportSettings;
+ }
+
+ /**
+ * method overridden by complex file exporter/importers which support
+ * exporting visualisation and layout settings for a view
+ *
+ * @param avpanel
+ */
+ public void configureForView(AlignmentViewPanel avpanel)
+ {
+ if (avpanel != null)
+ {
+ setViewport(avpanel.getAlignViewport());
+ }
+ // could also set export/import settings
+ }
+
+ /**
+ * Returns the preferred feature colour configuration if there is one, else
+ * null
+ *
+ * @return
+ */
+ public FeatureSettingsModelI getFeatureColourScheme()
+ {
+ return null;
+ }
+
+ public DataSourceType getDataSourceType()
+ {
+ return dataSourceType;
+ }
+
+ /**
+ * Returns a buffered reader for the input object. Returns null, or throws
+ * IOException, on failure.
+ *
+ * @param file
+ * a File, or a String which is a name of a file
+ * @param sourceType
+ * @return
+ * @throws IOException
+ */
+ public BufferedReader getBufferedReader(Object file,
+ DataSourceType sourceType) throws IOException
+ {
+ BufferedReader in = null;
+ byte[] bytes;
+
+ switch (sourceType)
+ {
+ case FILE:
+ if (file instanceof String)
+ {
+ return new BufferedReader(new FileReader((String) file));
+ }
+ bytes = Platform.getFileBytes((File) file);
+ if (bytes != null)
+ {
+ return new BufferedReader(
+ new InputStreamReader(new ByteArrayInputStream(bytes)));
+ }
+ return new BufferedReader(new FileReader((File) file));
+ case URL:
+ URL url = new URL(file.toString());
+ in = new BufferedReader(new InputStreamReader(url.openStream()));
+ break;
+ case RELATIVE_URL: // JalviewJS only
+ bytes = Platform.getFileAsBytes(file.toString());
+ if (bytes != null)
+ {
+ in = new BufferedReader(
+ new InputStreamReader(new ByteArrayInputStream(bytes)));
+ }
+ break;
+ case PASTE:
+ in = new BufferedReader(new StringReader(file.toString()));
+ break;
+ case CLASSLOADER:
+ InputStream is = getClass().getResourceAsStream("/" + file);
+ if (is != null)
+ {
+ in = new BufferedReader(new InputStreamReader(is));
+ }
+ break;
+ }
+
+ return in;
+ }