import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;
import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
* @version $Revision$
*/
public class AlignFrame extends GAlignFrame implements DropTargetListener,
- IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener
+ IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener,
+ PropertyChangeListener
{
public static final int DEFAULT_WIDTH = 700;
init();
}
+ @Override
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ Desktop.getDesktop().propertyChange(evt);
+ }
+
/**
* initalise the alignframe from the underlying viewport data and the
* configurations
int value = chooser.showSaveDialog(this);
+
if (value == JalviewFileChooser.APPROVE_OPTION)
{
currentFileFormat = chooser.getSelectedFormat();
chooser.setToolTipText(
MessageManager.getString("label.load_jalview_annotations"));
- int value = chooser.showOpenDialog(null);
+ Desktop.getDesktop().dialogData = new Object[] { "SelectedFile",
+ new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ Object[] data = Desktop.getDesktop().dialogData;
+ int value = ((Integer) data[0]).intValue();
+
+ if (value == JFileChooser.APPROVE_OPTION)
+ {
+ JalviewFileChooser chooser = (JalviewFileChooser) data[2];
+ String choice = chooser.getSelectedFile().getPath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
+ loadJalviewDataFile(choice, null, null, null);
+ }
+ }
+
+ }, chooser };
+
+ chooser.showOpenDialog(null);
+
- if (value == JalviewFileChooser.APPROVE_OPTION)
- {
- String choice = chooser.getSelectedFile().getPath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
- loadJalviewDataFile(choice, null, null, null);
- }
}
* Try to load a features file onto the alignment.
*
* @param file
- * contents or path to retrieve file
+ * contents or path to retrieve file or a File object
* @param sourceType
* access mode of file (see jalview.io.AlignFile)
* @return true if features file was parsed correctly.
*/
- public boolean parseFeaturesFile(String file, DataSourceType sourceType)
+ public boolean parseFeaturesFile(Object file, DataSourceType sourceType)
{
+ // BH 2018
return avc.parseFeaturesFile(file, sourceType,
Cache.getDefault("RELAXEDSEQIDMATCHING", false));
// Java's Transferable for native dnd
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Transferable t = evt.getTransferable();
+
+
final AlignFrame thisaf = this;
- final List<String> files = new ArrayList<>();
+ final List<Object> files = new ArrayList<>();
List<DataSourceType> protocols = new ArrayList<>();
try
* Object[] { String,SequenceI}
*/
ArrayList<Object[]> filesmatched = new ArrayList<>();
- ArrayList<String> filesnotmatched = new ArrayList<>();
+ ArrayList<Object> filesnotmatched = new ArrayList<>();
for (int i = 0; i < files.size(); i++)
{
- String file = files.get(i).toString();
+ // BH 2018
+ Object file = files.get(i);
+ String fileName = file.toString();
String pdbfn = "";
- DataSourceType protocol = FormatAdapter.checkProtocol(file);
+ DataSourceType protocol = (file instanceof File ? DataSourceType.FILE : FormatAdapter.checkProtocol(fileName));
if (protocol == DataSourceType.FILE)
{
- File fl = new File(file);
+ File fl = (file instanceof File ? (File) file : new File(fileName));
pdbfn = fl.getName();
}
else if (protocol == DataSourceType.URL)
{
- URL url = new URL(file);
+ URL url = new URL(fileName);
pdbfn = url.getFile();
}
if (pdbfn.length() > 0)
}
if (mtch != null)
{
- FileFormatI type = null;
+ FileFormatI type;
try
{
type = new IdentifyFile().identify(file, protocol);
{
return;
}
- for (String fn : filesnotmatched)
+ for (Object fn : filesnotmatched)
{
loadJalviewDataFile(fn, null, null, null);
}
* @param file
* either a filename or a URL string.
*/
- public void loadJalviewDataFile(String file, DataSourceType sourceType,
+ public void loadJalviewDataFile(Object file, DataSourceType sourceType,
FileFormatI format, SequenceI assocSeq)
{
+ // BH 2018 was String file
try
{
if (sourceType == null)
}
}
+
}
class PrintThread extends Thread