import java.util.List;
import java.util.Locale;
import java.util.Vector;
-import java.util.concurrent.Callable;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import jalview.io.NewickFile;
import jalview.io.ScoreMatrixFile;
import jalview.io.TCoffeeScoreFile;
+import jalview.io.exceptions.ImageOutputException;
import jalview.io.vcf.VCFLoader;
import jalview.jbgui.GAlignFrame;
import jalview.project.Jalview2XML;
import jalview.util.ImageMaker.TYPE;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.util.imagemaker.BitmapImageSizing;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
-import jalview.ws.datamodel.alphafold.PAEContactMatrix;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
@Override
public void setProgressBar(String message, long id)
{
- if (!Platform.isHeadless())
+ if (!Platform.isHeadless() && progressBar != null)
progressBar.setProgressBar(message, id);
}
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
- progressBar.registerHandler(id, handler);
+ if (progressBar != null)
+ progressBar.registerHandler(id, handler);
}
/**
@Override
public boolean operationInProgress()
{
- return progressBar.operationInProgress();
+ return progressBar == null ? false : progressBar.operationInProgress();
}
/**
}
AlignExportSettingsI options = new AlignExportSettingsAdapter(false);
- Callable<Void> cancelAction = () -> {
+ Runnable cancelAction = () -> {
lastSaveSuccessful = false;
- return null;
};
- Callable<Void> outputAction = () -> {
+ Runnable outputAction = () -> {
// todo defer this to inside formatSequences (or later)
AlignmentExportData exportData = viewport.getAlignExportData(options);
String output = new FormatAdapter(alignPanel, options)
AlignFrame.this.getViewport().setSavedUpToDate(true);
}
}
- return null;
};
/*
{
try
{
- outputAction.call();
+ outputAction.run();
} catch (Exception e)
{
// TODO Auto-generated catch block
FileFormatI fileFormat = FileFormats.getInstance()
.forName(fileFormatName);
AlignExportSettingsI options = new AlignExportSettingsAdapter(false);
- Callable<Void> outputAction = () -> {
+ Runnable outputAction = () -> {
// todo defer this to inside formatSequences (or later)
AlignmentExportData exportData = viewport.getAlignExportData(options);
CutAndPasteTransfer cap = new CutAndPasteTransfer();
oom);
cap.dispose();
}
- return null;
};
/*
{
try
{
- outputAction.call();
+ outputAction.run();
} catch (Exception e)
{
e.printStackTrace();
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
- htmlSVG.exportHTML(null);
+ try
+ {
+ htmlSVG.exportHTML(null);
+ } catch (ImageOutputException x)
+ {
+ // report problem to console and raise dialog
+ }
}
@Override
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
- bjs.exportHTML(null);
+ try
+ {
+ bjs.exportHTML(null);
+ } catch (ImageOutputException x)
+ {
+ // report problem to console and raise dialog
+ }
}
public void createImageMap(File file, String image)
{
- alignPanel.makePNGImageMap(file, image);
+ try
+ {
+ alignPanel.makePNGImageMap(file, image);
+ } catch (ImageOutputException x)
+ {
+ // report problem to console and raise dialog
+ }
+ }
+
+ @Override
+ public void createPNG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ createPNG(null);
+ } catch (ImageOutputException ioex)
+ {
+ // raise dialog, and report via console
+ }
+ }
+
+ @Override
+ public void createEPS_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ createEPS(null);
+ } catch (ImageOutputException ioex)
+ {
+ // raise dialog, and report via console
+ }
+
+ }
+
+ @Override
+ public void createSVG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ createSVG(null);
+ } catch (ImageOutputException ioex)
+ {
+ // raise dialog, and report via console
+ }
+
}
/**
*
* @param f
*/
- @Override
- public void createPNG(File f)
+ public void createPNG(File f) throws ImageOutputException
{
- createPNG(f, null, 0.0f, 0, 0);
+ createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
}
- public void createPNG(File f, String renderer, float bitmapscale,
- int bitmapwidth, int bitmapheight)
+ public void createPNG(File f, String renderer, BitmapImageSizing userBis)
+ throws ImageOutputException
{
- alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, bitmapscale,
- bitmapwidth, bitmapheight);
+ alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis);
}
/**
*
* @param f
*/
- @Override
- public void createEPS(File f)
+ public void createEPS(File f) throws ImageOutputException
{
createEPS(f, null);
}
- public void createEPS(File f, String renderer)
+ public void createEPS(File f, String renderer) throws ImageOutputException
{
alignPanel.makeAlignmentImage(TYPE.EPS, f, renderer);
}
*
* @param f
*/
- @Override
- public void createSVG(File f)
+ public void createSVG(File f) throws ImageOutputException
{
createSVG(f, null);
}
- public void createSVG(File f, String renderer)
+ public void createSVG(File f, String renderer) throws ImageOutputException
{
alignPanel.makeAlignmentImage(TYPE.SVG, f, renderer);
}
String choice = chooser.getSelectedFile().getPath();
Cache.setProperty("LAST_DIRECTORY", choice);
loadJalviewDataFile(chooser.getSelectedFile(), null, null, null);
- return null;
});
chooser.showOpenDialog(this);
// annotation was duplicated earlier
alignment.addAnnotation(sequences[i].getAnnotation()[a]);
// take care of contact matrix too
- ContactMatrixI cm=sequences[i].getContactMatrixFor(sequences[i].getAnnotation()[a]);
- if (cm!=null)
+ ContactMatrixI cm = sequences[i]
+ .getContactMatrixFor(sequences[i].getAnnotation()[a]);
+ if (cm != null)
{
- alignment.addContactListFor(sequences[i].getAnnotation()[a], cm);
+ alignment.addContactListFor(sequences[i].getAnnotation()[a],
+ cm);
}
-
+
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a],
a);
}
return;
}
- Callable okAction = () -> {
+ Runnable okAction = () -> {
SequenceI[] cut = sg.getSequences()
.toArray(new SequenceI[sg.getSize()]);
{
}
}
- return null;
};
/*
{
try
{
- okAction.call();
+ okAction.run();
} catch (Exception e)
{
e.printStackTrace();
@Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
- scaleAbove.setVisible(wrapMenuItem.isSelected());
- scaleLeft.setVisible(wrapMenuItem.isSelected());
- scaleRight.setVisible(wrapMenuItem.isSelected());
- viewport.setWrapAlignment(wrapMenuItem.isSelected());
+ setWrapFormat(wrapMenuItem.isSelected());
+ }
+
+ public void setWrapFormat(boolean b)
+ {
+ scaleAbove.setVisible(b);
+ scaleLeft.setVisible(b);
+ scaleRight.setVisible(b);
+ viewport.setWrapAlignment(b);
alignPanel.updateLayout();
}
.getString("label.possible_problem_with_tree_file"),
JvOptionPane.WARNING_MESSAGE);
}
- return null;
});
chooser.showOpenDialog(this);
}
return tp;
}
- public void showContactMapTree(AlignmentAnnotation aa,
- ContactMatrixI cm)
+ public void showContactMapTree(AlignmentAnnotation aa, ContactMatrixI cm)
{
int x = 4, y = 5;
int w = 400, h = 500;
Cache.setProperty("LAST_DIRECTORY", choice);
SequenceI[] seqs = viewport.getAlignment().getSequencesArray();
new VCFLoader(choice).loadVCF(seqs, us);
- return null;
});
chooser.showOpenDialog(null);