import jalview.api.ViewStyleI;
import jalview.api.analysis.ScoreModelI;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentExportData;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.AlignmentView;
*/
void init()
{
- progressBar = new ProgressBar(this.statusPanel, this.statusBar);
+ if (!Jalview.isHeadlessMode())
+ {
+ progressBar = new ProgressBar(this.statusPanel, this.statusBar);
+ }
avc = new jalview.controller.AlignViewController(this, viewport,
alignPanel);
{
warningMessage("Cannot save file " + fileName + " using format "
+ format, "Alignment output format not supported");
- saveAs_actionPerformed(null);
- // JBPNote need to have a raise_gui flag here
+ if (!Jalview.isHeadlessMode())
+ {
+ saveAs_actionPerformed(null);
+ }
return false;
}
- ExportData exportData = getAlignmentForExport(format);
- FormatAdapter f = new FormatAdapter(alignPanel);
+ AlignmentExportData exportData = getAlignmentForExport(format, viewport);
+ if (exportData.getSettings().isCancelled())
+ {
+ return false;
+ }
+ FormatAdapter f = new FormatAdapter(alignPanel,
+ exportData.getSettings());
String output = f.formatSequences(format,
exportData.getAlignment(), // class cast exceptions will
// occur in the distant future
protected void outputText_actionPerformed(ActionEvent e)
{
- ExportData exportData = getAlignmentForExport(e.getActionCommand());
+ AlignmentExportData exportData = getAlignmentForExport(
+ e.getActionCommand(), viewport);
if (exportData.getSettings().isCancelled())
{
return;
}
- public ExportData getAlignmentForExport(String exportFomat)
+ public static AlignmentExportData getAlignmentForExport(String exportFormat,
+ AlignViewportI viewport)
{
AlignmentI alignmentToExport = null;
String[] omitHidden = null;
boolean hasHiddenSeqs = hiddenSeqs.getSize() > 0;
AlignExportSettings settings = new AlignExportSettings(hasHiddenSeqs,
- viewport.hasHiddenColumns(), exportFomat);
+ viewport.hasHiddenColumns(), exportFormat);
settings.isExportAnnotations();
if (viewport.hasHiddenColumns() && !settings.isExportHiddenColumns())
alignmentStartEnd = getStartEnd(alignmentStartEnd, viewport
.getColumnSelection().getHiddenColumns());
}
- return new ExportData(alignmentToExport, omitHidden, alignmentStartEnd,
+ AlignmentExportData ed = new AlignmentExportData(alignmentToExport, omitHidden, alignmentStartEnd,
settings);
+ return ed;
}
- private static int[] getStartEnd(int[] aligmentStartEnd,
+ public static int[] getStartEnd(int[] aligmentStartEnd,
List<int[]> hiddenCols)
{
int startPos = aligmentStartEnd[0];
for (int[] hiddenCol : hiddenCols)
{
// System.out.println("comparing : " + hiddenCol[0] + "-" + hiddenCol[1]);
-
lowestRange = (hiddenCol[0] <= startPos) ? hiddenCol : lowestRange;
higestRange = (hiddenCol[1] >= endPos) ? hiddenCol : higestRange;
}
if (closeAllTabs)
{
+ /*
+ * this will raise an INTERNAL_FRAME_CLOSED event and this method will
+ * be called recursively, with the frame now in 'closed' state
+ */
this.setClosed(true);
}
} catch (Exception ex)
viewport.getSelectionGroup().getEndRes() + groupAdjustment);
}
+ /*
+ * just extend the last slide command if compatible; but not if in
+ * SplitFrame mode (to ensure all edits are broadcast - JAL-1802)
+ */
boolean appendHistoryItem = false;
Deque<CommandI> historyList = viewport.getHistoryList();
- if (historyList != null
+ boolean inSplitFrame = getSplitViewContainer() != null;
+ if (!inSplitFrame && historyList != null
&& historyList.size() > 0
&& historyList.peek() instanceof SlideSequencesCommand)
{
}
/*
- * Views share the same edits, undo and redo stacks, mappings.
+ * Views share the same edits undo and redo stacks
*/
newap.av.setHistoryList(viewport.getHistoryList());
newap.av.setRedoList(viewport.getRedoList());
- newap.av.getAlignment().setCodonFrames(
- viewport.getAlignment().getCodonFrames());
+
+ /*
+ * Views share the same mappings; need to deregister any new mappings
+ * created by copyAlignPanel, and register the new reference to the shared
+ * mappings
+ */
+ newap.av.replaceMappings(viewport.getAlignment());
newap.av.viewName = getNewViewName(viewTitle);
al.getCodonFrames().addAll(cf);
final StructureSelectionManager ssm = StructureSelectionManager
.getStructureSelectionManager(Desktop.instance);
- ssm.addMappings(cf);
+ ssm.registerMappings(cf);
}
else
{
"Exception during translation. Please report this !", ex);
final String msg = MessageManager
.getString("label.error_when_translating_sequences_submit_bug_report");
- final String title = MessageManager
+ final String errorTitle = MessageManager
.getString("label.implementation_error")
+ MessageManager.getString("translation_failed");
- JOptionPane.showMessageDialog(Desktop.desktop, msg, title,
+ JOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
JOptionPane.ERROR_MESSAGE);
return;
}
{
final String msg = MessageManager
.getString("label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation");
- final String title = MessageManager
+ final String errorTitle = MessageManager
.getString("label.translation_failed");
- JOptionPane.showMessageDialog(Desktop.desktop, msg, title,
+ JOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
JOptionPane.WARNING_MESSAGE);
}
else
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
{
final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
- viewport.openSplitFrame(af, new Alignment(seqs),
- al.getCodonFrames());
+ viewport.openSplitFrame(af, new Alignment(seqs));
}
else
{
aa.visible = visible;
}
}
- alignPanel.validateAnnotationDimensions(false);
+ alignPanel.validateAnnotationDimensions(true);
alignPanel.alignmentChanged();
}
sf.setComplementVisible(this, show);
}
}
-
- public class ExportData
- {
- private AlignmentI alignment;
-
- private String[] omitHidden;
-
- private int[] startEnd;
-
- private AlignExportSettings settings;
-
- public ExportData(AlignmentI align, String[] ommit, int[] startEnd,
- AlignExportSettings settings)
- {
- this.alignment = align;
- this.omitHidden = ommit;
- this.startEnd = startEnd;
- this.settings = settings;
- }
-
- public AlignmentI getAlignment()
- {
- return alignment;
- }
-
- public void setAlignment(AlignmentI alignment)
- {
- this.alignment = alignment;
- }
-
- public String[] getOmitHidden()
- {
- return omitHidden;
- }
-
- public void setOmitHidden(String[] omitHidden)
- {
- this.omitHidden = omitHidden;
- }
-
- public int[] getStartEndPostions()
- {
- return startEnd;
- }
-
- public void setStartEndPostions(int[] startEnd)
- {
- this.startEnd = startEnd;
- }
-
- public AlignExportSettings getSettings()
- {
- return settings;
- }
-
- public void setSettings(AlignExportSettings settings)
- {
- this.settings = settings;
- }
- }
-
}
class PrintThread extends Thread