X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=293948ae0403cf9680d2beb46f20f097b31c6ecc;hb=a10a465359de7b8c0baff4925d4b267a28eb0071;hp=8f1aa46e4f5649fcc6ff38ff4a7281a63e668dca;hpb=1145380bdd6555637794c9db36624fa42a8818c8;p=jalview.git
diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java
index 8f1aa46..293948a 100755
--- a/src/jalview/gui/AlignFrame.java
+++ b/src/jalview/gui/AlignFrame.java
@@ -1,20 +1,19 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5.1)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
*/
package jalview.gui;
@@ -81,51 +80,66 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
this(al, null, width, height);
}
+
/**
- * Creates a new AlignFrame object with specific width, height and sequenceSetId
+ * Creates a new AlignFrame object with specific width, height and
+ * sequenceSetId
+ *
* @param al
* @param width
* @param height
* @param sequenceSetId
*/
- public AlignFrame(AlignmentI al, int width, int height, String sequenceSetId)
+ public AlignFrame(AlignmentI al, int width, int height,
+ String sequenceSetId)
{
this(al, null, width, height, sequenceSetId);
}
+
/**
- * Creates a new AlignFrame object with specific width, height and sequenceSetId
+ * Creates a new AlignFrame object with specific width, height and
+ * sequenceSetId
+ *
* @param al
* @param width
* @param height
* @param sequenceSetId
* @param viewId
*/
- public AlignFrame(AlignmentI al, int width, int height, String sequenceSetId, String viewId)
+ public AlignFrame(AlignmentI al, int width, int height,
+ String sequenceSetId, String viewId)
{
this(al, null, width, height, sequenceSetId, viewId);
}
+
/**
* new alignment window with hidden columns
*
* @param al
- * AlignmentI
+ * AlignmentI
* @param hiddenColumns
- * ColumnSelection or null
- * @param width Width of alignment frame
- * @param height height of frame.
+ * ColumnSelection or null
+ * @param width
+ * Width of alignment frame
+ * @param height
+ * height of frame.
*/
public AlignFrame(AlignmentI al, ColumnSelection hiddenColumns,
int width, int height)
{
this(al, hiddenColumns, width, height, null);
}
+
/**
- * Create alignment frame for al with hiddenColumns, a specific width and height, and specific sequenceId
+ * Create alignment frame for al with hiddenColumns, a specific width and
+ * height, and specific sequenceId
+ *
* @param al
* @param hiddenColumns
* @param width
* @param height
- * @param sequenceSetId (may be null)
+ * @param sequenceSetId
+ * (may be null)
*/
public AlignFrame(AlignmentI al, ColumnSelection hiddenColumns,
int width, int height, String sequenceSetId)
@@ -134,16 +148,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * Create alignment frame for al with hiddenColumns, a specific width and height, and specific sequenceId
+ * Create alignment frame for al with hiddenColumns, a specific width and
+ * height, and specific sequenceId
+ *
* @param al
* @param hiddenColumns
* @param width
* @param height
- * @param sequenceSetId (may be null)
- * @param viewId (may be null)
+ * @param sequenceSetId
+ * (may be null)
+ * @param viewId
+ * (may be null)
*/
- public AlignFrame(AlignmentI al, ColumnSelection hiddenColumns, int width, int height,
- String sequenceSetId, String viewId)
+ public AlignFrame(AlignmentI al, ColumnSelection hiddenColumns,
+ int width, int height, String sequenceSetId, String viewId)
{
setSize(width, height);
viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId);
@@ -163,9 +181,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* Make a new AlignFrame from exisiting alignmentPanels
*
* @param ap
- * AlignmentPanel
+ * AlignmentPanel
* @param av
- * AlignViewport
+ * AlignViewport
*/
public AlignFrame(AlignmentPanel ap)
{
@@ -174,8 +192,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
addAlignmentPanel(ap, false);
init();
}
+
/**
- * initalise the alignframe from the underlying viewport data and the configurations
+ * initalise the alignframe from the underlying viewport data and the
+ * configurations
*/
void init()
{
@@ -229,9 +249,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* button functionality.
*
* @param file
- * valid filename
+ * valid filename
* @param format
- * format of file
+ * format of file
*/
public void setFileName(String file, String format)
{
@@ -385,39 +405,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
boolean toggleSeqs = !evt.isControlDown();
boolean toggleCols = !evt.isShiftDown();
-
- boolean hide = false;
-
- SequenceGroup sg = viewport.getSelectionGroup();
- if (toggleSeqs)
- {
- if (sg != null
- && sg.getSize() != viewport.alignment.getHeight())
- {
- hideSelSequences_actionPerformed(null);
- hide = true;
- }
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
- {
- showAllSeqs_actionPerformed(null);
- }
- }
-
- if (toggleCols)
- {
- if (viewport.colSel.getSelected().size() > 0)
- {
- hideSelColumns_actionPerformed(null);
- if (!toggleSeqs)
- {
- viewport.selectionGroup = sg;
- }
- }
- else if (!hide)
- {
- showAllColumns_actionPerformed(null);
- }
- }
+ toggleHiddenRegions(toggleSeqs, toggleCols);
break;
}
case KeyEvent.VK_PAGE_UP:
@@ -558,7 +546,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
showTranslation.setVisible(nucleotide);
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
-
+ showGroupConservation.setEnabled(!nucleotide);
// Remember AlignFrame always starts as protein
if (!nucleotide)
{
@@ -581,7 +569,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* loading from Jalview2XML.java
*
* @param av
- * AlignViewport
+ * AlignViewport
*/
void setMenusFromViewport(AlignViewport av)
{
@@ -600,7 +588,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
annotationPanelMenuItem.setState(av.showAnnotation);
viewBoxesMenuItem.setSelected(av.showBoxes);
viewTextMenuItem.setSelected(av.showText);
-
+ showNonconservedMenuItem.setSelected(av.showUnconserved);
+ showGroupConsensus.setSelected(av.showGroupConsensus);
+ showGroupConservation.setSelected(av.showGroupConservation);
+ showConsensusHistogram.setSelected(av.showConsensusHistogram);
+ showSequenceLogo.setSelected(av.showSequenceLogo);
setColourSelected(ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
@@ -615,7 +607,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
updateEditMenuBar();
}
- Hashtable progressBars;
+ Hashtable progressBars, progressBarHandlers;
/*
* (non-Javadoc)
@@ -627,21 +619,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (progressBars == null)
{
progressBars = new Hashtable();
+ progressBarHandlers = new Hashtable();
}
JPanel progressPanel;
+ Long lId = new Long(id);
GridLayout layout = (GridLayout) statusPanel.getLayout();
- if (progressBars.get(new Long(id)) != null)
+ if (progressBars.get(lId) != null)
{
progressPanel = (JPanel) progressBars.get(new Long(id));
statusPanel.remove(progressPanel);
- progressBars.remove(progressPanel);
+ progressBars.remove(lId);
progressPanel = null;
if (message != null)
{
statusBar.setText(message);
}
-
+ if (progressBarHandlers.contains(lId))
+ {
+ progressBarHandlers.remove(lId);
+ }
layout.setRows(layout.getRows() - 1);
}
else
@@ -657,13 +654,41 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
layout.setRows(layout.getRows() + 1);
statusPanel.add(progressPanel);
- progressBars.put(new Long(id), progressPanel);
+ progressBars.put(lId, progressPanel);
}
// update GUI
setMenusForViewport();
validate();
}
+ public void registerHandler(final long id,
+ final IProgressIndicatorHandler handler)
+ {
+ if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
+ {
+ throw new Error(
+ "call setProgressBar before registering the progress bar's handler.");
+ }
+ progressBarHandlers.put(new Long(id), handler);
+ final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
+ if (handler.canCancel())
+ {
+ JButton cancel = new JButton("Cancel");
+ final IProgressIndicator us = this;
+ cancel.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ handler.cancelActivity(id);
+ us.setProgressBar("Cancelled "
+ + ((JLabel) progressPanel.getComponent(0)).getText(), id);
+ }
+ });
+ progressPanel.add(cancel, BorderLayout.EAST);
+ }
+ }
+
/**
*
* @return true if any progress bars are still active
@@ -704,6 +729,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (fileName != null)
{
+ // TODO: work out how to recover feature settings for correct view(s) when
+ // file is reloaded.
if (currentFileFormat.equals("Jalview"))
{
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
@@ -738,7 +765,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
protocol, currentFileFormat);
newframe.setBounds(bounds);
-
+ if (featureSettings != null && featureSettings.isShowing())
+ {
+ final Rectangle fspos = featureSettings.frame.getBounds();
+ // TODO: need a 'show feature settings' function that takes bounds -
+ // need to refactor Desktop.addFrame
+ newframe.featureSettings_actionPerformed(null);
+ final FeatureSettings nfs = newframe.featureSettings;
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ nfs.frame.setBounds(fspos);
+ }
+ });
+ this.featureSettings.close();
+ this.featureSettings = null;
+ }
this.closeMenuItem_actionPerformed(true);
}
}
@@ -757,8 +800,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void save_actionPerformed(ActionEvent e)
{
if (fileName == null
- || (currentFileFormat == null
- || !jalview.io.FormatAdapter.isValidIOFormat(currentFileFormat, true))
+ || (currentFileFormat == null || !jalview.io.FormatAdapter
+ .isValidIOFormat(currentFileFormat, true))
|| fileName.startsWith("http"))
{
saveAs_actionPerformed(null);
@@ -773,7 +816,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void saveAs_actionPerformed(ActionEvent e)
{
@@ -840,12 +883,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (!jalview.io.AppletFormatAdapter.isValidFormat(format, true))
{
- // JBPNote need to have a raise_gui flag here
- JOptionPane.showInternalMessageDialog(this, "Cannot save file "
- + fileName + " using format " + format,
- "Alignment output format not supported",
- JOptionPane.WARNING_MESSAGE);
+ 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
return false;
}
@@ -906,11 +947,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return success;
}
+ private void warningMessage(String warning, String title)
+ {
+ if (new jalview.util.Platform().isHeadless())
+ {
+ System.err.println("Warning: " + title + "\nWarning: " + warning);
+
+ }
+ else
+ {
+ JOptionPane.showInternalMessageDialog(this, warning, title,
+ JOptionPane.WARNING_MESSAGE);
+ }
+ return;
+ }
+
/**
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void outputText_actionPerformed(ActionEvent e)
{
@@ -946,7 +1002,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
@@ -964,7 +1020,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void createPNG(File f)
{
@@ -975,7 +1031,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void createEPS(File f)
{
@@ -992,7 +1048,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void printMenuItem_actionPerformed(ActionEvent e)
{
@@ -1036,10 +1092,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * Close the current view or all views in the alignment frame.
- * If the frame only contains one view then the alignment will be removed from memory.
+ * Close the current view or all views in the alignment frame. If the frame
+ * only contains one view then the alignment will be removed from memory.
*
- * @param closeAllTabs
+ * @param closeAllTabs
*/
public void closeMenuItem_actionPerformed(boolean closeAllTabs)
{
@@ -1054,24 +1110,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (closeAllTabs)
{
- for (int i = 0; i < alignPanels.size(); i++)
+ if (this.isClosed())
{
- AlignmentPanel ap = (AlignmentPanel) alignPanels.elementAt(i);
- jalview.structure.StructureSelectionManager ssm =
- jalview.structure.StructureSelectionManager
- .getStructureSelectionManager();
- ssm.removeStructureViewerListener(ap.seqPanel, null);
- ssm.removeSelectionListener(ap.seqPanel);
- PaintRefresher.RemoveComponent(ap.seqPanel.seqCanvas);
- PaintRefresher.RemoveComponent(ap.idPanel.idCanvas);
- PaintRefresher.RemoveComponent(ap);
- ap.av.alignment = null;
+ // really close all the windows - otherwise wait till
+ // setClosed(true) is called
+ for (int i = 0; i < alignPanels.size(); i++)
+ {
+ AlignmentPanel ap = (AlignmentPanel) alignPanels.elementAt(i);
+ ap.closePanel();
+ }
}
}
else
{
closeView(alignPanel);
- viewport = null;
}
}
@@ -1085,22 +1137,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
}
+ /**
+ * close alignPanel2 and shuffle tabs appropriately.
+ *
+ * @param alignPanel2
+ */
public void closeView(AlignmentPanel alignPanel2)
{
int index = tabbedPane.getSelectedIndex();
int closedindex = tabbedPane.indexOfComponent(alignPanel2);
alignPanels.removeElement(alignPanel2);
- PaintRefresher.RemoveComponent(alignPanel2.seqPanel.seqCanvas);
- PaintRefresher.RemoveComponent(alignPanel2.idPanel.idCanvas);
- PaintRefresher.RemoveComponent(alignPanel2);
- alignPanel2.av.alignment = null;
-
- if (viewport == alignPanel2.av)
- {
- viewport = null;
- }
+ // Unnecessary
+ // if (viewport == alignPanel2.av)
+ // {
+ // viewport = null;
+ // }
+ alignPanel2.closePanel();
alignPanel2 = null;
-
+
tabbedPane.removeTabAt(closedindex);
tabbedPane.validate();
@@ -1110,7 +1164,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
index--;
}
- this.tabSelectionChanged(index);
+ this.tabSelectionChanged(index);
}
/**
@@ -1152,7 +1206,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.historyList.push(command);
viewport.redoList.clear();
updateEditMenuBar();
- viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
+ viewport.hasHiddenColumns = (viewport.colSel != null
+ && viewport.colSel.getHiddenColumns() != null && viewport.colSel
+ .getHiddenColumns().size() > 0);
}
}
@@ -1184,7 +1240,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void undoMenuItem_actionPerformed(ActionEvent e)
{
@@ -1199,7 +1255,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (originalSource != null)
{
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
+ originalSource.hasHiddenColumns = (viewport.colSel != null
+ && viewport.colSel.getHiddenColumns() != null && viewport.colSel
+ .getHiddenColumns().size() > 0);
originalSource.firePropertyChange("alignment", null,
originalSource.alignment.getSequences());
}
@@ -1209,7 +1267,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void redoMenuItem_actionPerformed(ActionEvent e)
{
@@ -1227,7 +1285,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (originalSource != null)
{
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
+ originalSource.hasHiddenColumns = (viewport.colSel != null
+ && viewport.colSel.getHiddenColumns() != null && viewport.colSel
+ .getHiddenColumns().size() > 0);
originalSource.firePropertyChange("alignment", null,
originalSource.alignment.getSequences());
}
@@ -1279,7 +1339,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param up
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void moveSelectedSequences(boolean up)
{
@@ -1426,7 +1486,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void copy_actionPerformed(ActionEvent e)
{
@@ -1470,15 +1530,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (viewport.hasHiddenColumns)
{
hiddenColumns = new Vector();
- int hiddenOffset = viewport.getSelectionGroup().getStartRes();
+ int hiddenOffset = viewport.getSelectionGroup().getStartRes(),hiddenCutoff=viewport.getSelectionGroup().getEndRes();
for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
.size(); i++)
{
int[] region = (int[]) viewport.getColumnSelection()
.getHiddenColumns().elementAt(i);
-
- hiddenColumns.addElement(new int[]
+ if (region[0]>=hiddenOffset && region[1]<=hiddenCutoff)
+ {
+ hiddenColumns.addElement(new int[]
{ region[0] - hiddenOffset, region[1] - hiddenOffset });
+ }
}
}
@@ -1491,7 +1553,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void pasteNew_actionPerformed(ActionEvent e)
{
@@ -1502,7 +1564,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void pasteThis_actionPerformed(ActionEvent e)
{
@@ -1513,7 +1575,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* Paste contents of Jalview clipboard
*
* @param newAlignment
- * true to paste to a new alignment, otherwise add to this.
+ * true to paste to a new alignment, otherwise add to this.
*/
void paste(boolean newAlignment)
{
@@ -1782,7 +1844,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void cut_actionPerformed(ActionEvent e)
{
@@ -1794,7 +1856,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void delete_actionPerformed(ActionEvent evt)
{
@@ -1854,7 +1916,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void deleteGroups_actionPerformed(ActionEvent e)
{
@@ -1862,6 +1924,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
alignPanel.paintAlignment(true);
}
@@ -1869,7 +1932,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
@@ -1891,7 +1954,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
@@ -1913,7 +1976,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
{
@@ -1946,7 +2009,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
{
@@ -1957,7 +2020,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void remove2RightMenuItem_actionPerformed(ActionEvent e)
{
@@ -2034,7 +2097,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
{
@@ -2080,7 +2143,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
{
@@ -2118,21 +2181,30 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void padGapsMenuitem_actionPerformed(ActionEvent e)
{
viewport.padGaps = padGapsMenuitem.isSelected();
-
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
}
+ // else
+ {
+ // if (justifySeqs>0)
+ {
+ // alignment.justify(justifySeqs!=RIGHT_JUSTIFY);
+ }
+ }
+
+ // }
+
/**
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void findMenuItem_actionPerformed(ActionEvent e)
{
@@ -2202,7 +2274,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void font_actionPerformed(ActionEvent e)
{
@@ -2213,7 +2285,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void seqLimit_actionPerformed(ActionEvent e)
{
@@ -2235,14 +2307,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState();
alignPanel.paintAlignment(true);
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
*/
protected void followHighlight_actionPerformed()
{
if (viewport.followHighlight = this.followHighlightMenuItem.getState())
{
- alignPanel.scrollToPosition(alignPanel.seqPanel.seqCanvas.searchResults, false);
+ alignPanel.scrollToPosition(
+ alignPanel.seqPanel.seqCanvas.searchResults, false);
}
}
@@ -2250,7 +2326,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void colourTextMenuItem_actionPerformed(ActionEvent e)
{
@@ -2262,7 +2338,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
@@ -2290,6 +2366,116 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
alignPanel.paintAlignment(true);
}
+ /**
+ * called by key handler and the hide all/show all menu items
+ *
+ * @param toggleSeqs
+ * @param toggleCols
+ */
+ private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)
+ {
+
+ boolean hide = false;
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (!toggleSeqs && !toggleCols)
+ {
+ // Hide everything by the current selection - this is a hack - we do the
+ // invert and then hide
+ // first check that there will be visible columns after the invert.
+ if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel
+ .getSelected().size() > 0)
+ || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
+ .getEndRes()))
+ {
+ // now invert the sequence set, if required - empty selection implies
+ // that no hiding is required.
+ if (sg != null)
+ {
+ invertSequenceMenuItem_actionPerformed(null);
+ sg = viewport.getSelectionGroup();
+ toggleSeqs = true;
+
+ }
+ viewport.expandColSelection(sg, true);
+ // finally invert the column selection and get the new sequence
+ // selection.
+ invertColSel_actionPerformed(null);
+ toggleCols = true;
+ }
+ }
+
+ if (toggleSeqs)
+ {
+ if (sg != null && sg.getSize() != viewport.alignment.getHeight())
+ {
+ hideSelSequences_actionPerformed(null);
+ hide = true;
+ }
+ else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
+ {
+ showAllSeqs_actionPerformed(null);
+ }
+ }
+
+ if (toggleCols)
+ {
+ if (viewport.colSel.getSelected().size() > 0)
+ {
+ hideSelColumns_actionPerformed(null);
+ if (!toggleSeqs)
+ {
+ viewport.selectionGroup = sg;
+ }
+ }
+ else if (!hide)
+ {
+ showAllColumns_actionPerformed(null);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
+ * event.ActionEvent)
+ */
+ public void hideAllButSelection_actionPerformed(ActionEvent e)
+ {
+ toggleHiddenRegions(false, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
+ * .ActionEvent)
+ */
+ public void hideAllSelection_actionPerformed(ActionEvent e)
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ viewport.expandColSelection(sg, false);
+ viewport.hideAllSelectedSeqs();
+ viewport.hideSelectedColumns();
+ alignPanel.paintAlignment(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
+ * ActionEvent)
+ */
+ public void showAllhidden_actionPerformed(ActionEvent e)
+ {
+ viewport.showAllHiddenColumns();
+ viewport.showAllHiddenSeqs();
+ alignPanel.paintAlignment(true);
+ }
+
public void hideSelColumns_actionPerformed(ActionEvent e)
{
viewport.hideSelectedColumns();
@@ -2306,7 +2492,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void scaleAbove_actionPerformed(ActionEvent e)
{
@@ -2318,7 +2504,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void scaleLeft_actionPerformed(ActionEvent e)
{
@@ -2330,7 +2516,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void scaleRight_actionPerformed(ActionEvent e)
{
@@ -2342,7 +2528,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
{
@@ -2354,7 +2540,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void viewTextMenuItem_actionPerformed(ActionEvent e)
{
@@ -2366,7 +2552,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
{
@@ -2383,14 +2569,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
featureSettings.close();
featureSettings = null;
}
+ if (!showSeqFeatures.isSelected())
+ {
+ // make sure features are actually displayed
+ showSeqFeatures.setSelected(true);
+ showSeqFeatures_actionPerformed(null);
+ }
featureSettings = new FeatureSettings(this);
}
/**
- * DOCUMENT ME!
+ * Set or clear 'Show Sequence Features'
*
* @param evt
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void showSeqFeatures_actionPerformed(ActionEvent evt)
{
@@ -2403,10 +2595,33 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
+ * Set or clear 'Show Sequence Features'
+ *
+ * @param evt
+ * DOCUMENT ME!
+ */
+ public void showSeqFeaturesHeight_actionPerformed(ActionEvent evt)
+ {
+ viewport.setShowSequenceFeaturesHeight(showSeqFeaturesHeight
+ .isSelected());
+ if (viewport.getShowSequenceFeaturesHeight())
+ {
+ // ensure we're actually displaying features
+ viewport.setShowSequenceFeatures(true);
+ showSeqFeatures.setSelected(true);
+ }
+ alignPanel.paintAlignment(true);
+ if (alignPanel.getOverviewPanel() != null)
+ {
+ alignPanel.getOverviewPanel().updateOverviewImage();
+ }
+ }
+
+ /**
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
{
@@ -2481,7 +2696,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void overviewMenuItem_actionPerformed(ActionEvent e)
{
@@ -2519,7 +2734,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
@@ -2530,7 +2745,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void clustalColour_actionPerformed(ActionEvent e)
{
@@ -2543,7 +2758,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void zappoColour_actionPerformed(ActionEvent e)
{
@@ -2554,7 +2769,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void taylorColour_actionPerformed(ActionEvent e)
{
@@ -2565,7 +2780,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void hydrophobicityColour_actionPerformed(ActionEvent e)
{
@@ -2576,7 +2791,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void helixColour_actionPerformed(ActionEvent e)
{
@@ -2587,7 +2802,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void strandColour_actionPerformed(ActionEvent e)
{
@@ -2598,7 +2813,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void turnColour_actionPerformed(ActionEvent e)
{
@@ -2609,7 +2824,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void buriedColour_actionPerformed(ActionEvent e)
{
@@ -2620,7 +2835,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void nucleotideColour_actionPerformed(ActionEvent e)
{
@@ -2636,7 +2851,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void applyToAllGroups_actionPerformed(ActionEvent e)
{
@@ -2647,7 +2862,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param cs
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void changeColour(ColourSchemeI cs)
{
@@ -2772,7 +2987,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void modifyPID_actionPerformed(ActionEvent e)
{
@@ -2789,7 +3004,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void modifyConservation_actionPerformed(ActionEvent e)
{
@@ -2806,7 +3021,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void conservationMenuItem_actionPerformed(ActionEvent e)
{
@@ -2824,7 +3039,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void abovePIDThreshold_actionPerformed(ActionEvent e)
{
@@ -2842,7 +3057,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void userDefinedColour_actionPerformed(ActionEvent e)
{
@@ -2935,7 +3150,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void PIDColour_actionPerformed(ActionEvent e)
{
@@ -2946,7 +3161,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void BLOSUM62Colour_actionPerformed(ActionEvent e)
{
@@ -2957,7 +3172,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
{
@@ -2973,7 +3188,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void sortIDMenuItem_actionPerformed(ActionEvent e)
{
@@ -2987,7 +3202,22 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
+ */
+ public void sortLengthMenuItem_actionPerformed(ActionEvent e)
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByLength(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("Length Sort", oldOrder,
+ viewport.alignment));
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void sortGroupMenuItem_actionPerformed(ActionEvent e)
{
@@ -3003,7 +3233,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
{
@@ -3014,7 +3244,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
{
@@ -3037,7 +3267,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void PCAMenuItem_actionPerformed(ActionEvent e)
{
@@ -3072,7 +3302,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
{
@@ -3083,7 +3313,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
{
@@ -3094,7 +3324,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
@@ -3105,7 +3335,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
@@ -3116,11 +3346,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param type
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param pwType
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param title
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
void NewTreePanel(String type, String pwType, String title)
{
@@ -3165,8 +3395,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
else
{
- // are the sequences aligned?
- if (!viewport.alignment.isAligned())
+ // are the visible sequences aligned?
+ if (!viewport.alignment.isAligned(false))
{
JOptionPane
.showMessageDialog(
@@ -3204,9 +3434,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param title
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param order
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void addSortByOrderMenuItem(String title,
final AlignmentOrder order)
@@ -3235,10 +3465,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* Add a new sort by annotation score menu item
*
* @param sort
- * the menu to add the option to
+ * the menu to add the option to
* @param scoreLabel
- * the label used to retrieve scores for each sequence on the
- * alignment
+ * the label used to retrieve scores for each sequence on the
+ * alignment
*/
public void addSortByAnnotScoreMenuItem(JMenu sort,
final String scoreLabel)
@@ -3318,9 +3548,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* modified.
*
* @param treePanel
- * Displayed tree window.
+ * Displayed tree window.
* @param title
- * SortBy menu item title.
+ * SortBy menu item title.
*/
public void buildTreeMenu()
{
@@ -3435,10 +3665,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// jobs
// TODO: viewport.alignment.isAligned is a global state - the local
// selection may well be aligned - we preserve 2.0.8 behaviour for moment.
- if (!viewport.alignment.isAligned())
+ if (!viewport.alignment.isAligned(false))
{
seqs.setSequences(new SeqCigar[]
{ seqs.getSequences()[0] });
+ // TODO: if seqs.getSequences().length>1 then should really have warned
+ // user!
+
}
return seqs;
}
@@ -3447,7 +3680,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
{
@@ -3506,19 +3739,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* current alignment view
*
* @param nf
- * the tree
+ * the tree
* @param title
- * tree viewer title
+ * tree viewer title
* @param input
- * Associated alignment input data (or null)
+ * Associated alignment input data (or null)
* @param w
- * width
+ * width
* @param h
- * height
+ * height
* @param x
- * position
+ * position
* @param y
- * position
+ * position
* @return TreePanel handle
*/
public TreePanel ShowNewickTree(NewickFile nf, String title,
@@ -3618,9 +3851,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.getServiceClient(sh);
impl.attachWSMenuEntry(seqsrchmenu, this);
}
- // finally, add the whole shebang onto the webservices menu
wsmenu.add(seqsrchmenu);
}
+ // finally, add the whole shebang onto the webservices menu
resetWebServiceMenu();
for (int i = 0, j = wsmenu.size(); i < j; i++)
{
@@ -3643,6 +3876,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
webService.removeAll();
build_fetchdbmenu(webService);
+ build_urlServiceMenu(webService);
+ }
+
+ /**
+ * construct any groupURL type service menu entries.
+ *
+ * @param webService
+ */
+ private void build_urlServiceMenu(JMenu webService)
+ {
+ jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry(
+ webService, this);
}
/*
@@ -3696,8 +3941,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
showProducts.removeAll();
final boolean dna = viewport.getAlignment().isNucleotide();
final Alignment ds = dataset;
- String[] ptypes = CrossRef.findSequenceXrefTypes(dna, selection,
- dataset);
+ String[] ptypes = (selection == null || selection.length == 0) ? null
+ : CrossRef.findSequenceXrefTypes(dna, selection, dataset);
// Object[] prods =
// CrossRef.buildXProductsList(viewport.getAlignment().isNucleotide(),
// selection, dataset, true);
@@ -3903,9 +4148,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* Try to load a features file onto the alignment.
*
* @param file
- * contents or path to retrieve file
+ * contents or path to retrieve file
* @param type
- * access mode of file (see jalview.io.AlignFile)
+ * access mode of file (see jalview.io.AlignFile)
* @return true if features file was parsed corectly.
*/
public boolean parseFeaturesFile(String file, String type)
@@ -3925,6 +4170,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
viewport.showSequenceFeatures = true;
showSeqFeatures.setSelected(true);
+ if (alignPanel.seqPanel.seqCanvas.fr != null)
+ {
+ // update the min/max ranges where necessary
+ alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true);
+ }
+ if (featureSettings != null)
+ {
+ featureSettings.setTableData();
+ }
alignPanel.paintAlignment(true);
}
@@ -3980,8 +4234,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
java.net.URI uri = new java.net.URI(s);
- java.io.File file = new java.io.File(uri);
- files.add(file);
+ // check to see if we can handle this kind of URI
+ if (uri.getScheme().toLowerCase().startsWith("http"))
+ {
+ files.add(uri.toString());
+ }
+ else
+ {
+ // otherwise preserve old behaviour: catch all for file objects
+ java.io.File file = new java.io.File(uri);
+ files.add(file.toString());
+ }
}
}
} catch (Exception e)
@@ -4005,23 +4268,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * Attempt to load a "dropped" file: First by testing whether it's and
- * Annotation file, then a JNet file, and finally a features file. If all are
- * false then the user may have dropped an alignment file onto this
+ * Attempt to load a "dropped" file or URL string: First by testing whether
+ * it's and Annotation file, then a JNet file, and finally a features file. If
+ * all are false then the user may have dropped an alignment file onto this
* AlignFrame.
*
* @param file
- * either a filename or a URL string.
+ * either a filename or a URL string.
*/
public void loadJalviewDataFile(String file)
{
try
{
- String protocol = "File";
-
- if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1)
+ String protocol = jalview.io.FormatAdapter.FILE;
+ String f = file.toLowerCase();
+ if (f.indexOf("http:") == 0 || f.indexOf("https:") == 0
+ || f.indexOf("file:") == 0)
{
- protocol = "URL";
+ protocol = jalview.io.FormatAdapter.URL;
}
boolean isAnnotation = new AnnotationFile().readAnnotationFile(
@@ -4119,16 +4383,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
}
- /* (non-Javadoc)
- * @see jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
+ * )
*/
protected void showDbRefs_actionPerformed(ActionEvent e)
{
viewport.setShowDbRefs(showDbRefsMenuitem.isSelected());
}
- /* (non-Javadoc)
- * @see jalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.ActionEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
+ * ActionEvent)
*/
protected void showNpFeats_actionPerformed(ActionEvent e)
{
@@ -4136,7 +4407,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * find the viewport amongst the tabs in this alignment frame and close that tab
+ * find the viewport amongst the tabs in this alignment frame and close that
+ * tab
+ *
* @param av
*/
public boolean closeView(AlignViewport av)
@@ -4147,7 +4420,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return true;
}
Component[] comp = tabbedPane.getComponents();
- for (int i=0;comp!=null && i0)
+ int comp = 0, mcomp = 15;
+ String mname = null;
+ if (otherdb != null && otherdb.length > 0)
{
- for (int i=0; i