X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=2e6ea520d9cc36b90a79628e16b083ceb5bfc2de;hb=1dabd11f09a42682d2b62d0a7bfccfd4114e07d9;hp=f9b6413cda4671e9fd0dd195e6e2d5e2874d6af6;hpb=2ac096ecd8ee1a5c11480e864fce7cf78d661c66;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f9b6413..2e6ea52 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * 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; @@ -406,8 +405,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { boolean toggleSeqs = !evt.isControlDown(); boolean toggleCols = !evt.isShiftDown(); - toggleHiddenRegions(toggleSeqs,toggleCols); - break; + toggleHiddenRegions(toggleSeqs, toggleCols); + break; } case KeyEvent.VK_PAGE_UP: if (viewport.wrapAlignment) @@ -624,7 +623,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } JPanel progressPanel; - Long lId=new Long(id); + Long lId = new Long(id); GridLayout layout = (GridLayout) statusPanel.getLayout(); if (progressBars.get(lId) != null) { @@ -730,7 +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. + // 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(); @@ -765,19 +765,22 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protocol, currentFileFormat); newframe.setBounds(bounds); - if (featureSettings!=null && featureSettings.isShowing()) { + 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 + // 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() { + SwingUtilities.invokeLater(new Runnable() + { public void run() { nfs.frame.setBounds(fspos); } }); this.featureSettings.close(); - this.featureSettings=null; + this.featureSettings = null; } this.closeMenuItem_actionPerformed(true); } @@ -1203,7 +1206,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.historyList.push(command); viewport.redoList.clear(); updateEditMenuBar(); - viewport.hasHiddenColumns = (viewport.colSel!=null && viewport.colSel.getHiddenColumns() != null && viewport.colSel.getHiddenColumns().size()>0); + viewport.hasHiddenColumns = (viewport.colSel != null + && viewport.colSel.getHiddenColumns() != null && viewport.colSel + .getHiddenColumns().size() > 0); } } @@ -1250,7 +1255,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (originalSource != null) { - originalSource.hasHiddenColumns = (viewport.colSel!=null && viewport.colSel.getHiddenColumns() != null && viewport.colSel.getHiddenColumns().size()>0); + originalSource.hasHiddenColumns = (viewport.colSel != null + && viewport.colSel.getHiddenColumns() != null && viewport.colSel + .getHiddenColumns().size() > 0); originalSource.firePropertyChange("alignment", null, originalSource.alignment.getSequences()); } @@ -1278,7 +1285,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (originalSource != null) { - originalSource.hasHiddenColumns = (viewport.colSel!=null && viewport.colSel.getHiddenColumns() != null && viewport.colSel.getHiddenColumns().size()>0); + originalSource.hasHiddenColumns = (viewport.colSel != null + && viewport.colSel.getHiddenColumns() != null && viewport.colSel + .getHiddenColumns().size() > 0); originalSource.firePropertyChange("alignment", null, originalSource.alignment.getSequences()); } @@ -2354,41 +2363,48 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.hideAllSelectedSeqs(); 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) + 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 + // 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())) + 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; + // 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()) + if (sg != null && sg.getSize() != viewport.alignment.getHeight()) { hideSelSequences_actionPerformed(null); hide = true; @@ -2413,31 +2429,43 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { showAllColumns_actionPerformed(null); } - } + } } - /* (non-Javadoc) - * @see jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.event.ActionEvent) + /* + * (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) + /* + * (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.expandColSelection(sg, false); viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); alignPanel.paintAlignment(true); } - /* (non-Javadoc) - * @see jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.ActionEvent) + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event. + * ActionEvent) */ public void showAllhidden_actionPerformed(ActionEvent e) { @@ -3639,7 +3667,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] }); - // TODO: if seqs.getSequences().length>1 then should really have warned user! + // TODO: if seqs.getSequences().length>1 then should really have warned + // user! } return seqs; @@ -3850,11 +3879,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /** * construct any groupURL type service menu entries. + * * @param webService */ private void build_urlServiceMenu(JMenu webService) { - jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry(webService, this); + jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry( + webService, this); } /* @@ -4142,7 +4173,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // update the min/max ranges where necessary alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true); } - if (featureSettings!=null) + if (featureSettings != null) { featureSettings.setTableData(); } @@ -4555,8 +4586,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } - /* (non-Javadoc) - * @see jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt.event.ActionEvent) + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt + * .event.ActionEvent) */ protected void showConsensusHistogram_actionPerformed(ActionEvent e) { @@ -4564,14 +4599,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } - /* (non-Javadoc) - * @see jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt.event.ActionEvent) + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt + * .event.ActionEvent) */ protected void showSequenceLogo_actionPerformed(ActionEvent e) { viewport.setShowSequenceLogo(showSequenceLogo.getState()); alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } + protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e) { alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); @@ -4599,7 +4639,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, for (int g = 0; g < gps.length; g++) { gps[g].setShowunconserved(viewport.getShowUnconserved()); - gps[g].setIncludeAllConsSymbols(viewport.isIncludeAllConsensusSymbols()); + gps[g].setIncludeAllConsSymbols(viewport + .isIncludeAllConsensusSymbols()); viewport.alignment.addGroup(gps[g]); Color col = new Color((int) (Math.random() * 255), (int) (Math .random() * 255), (int) (Math.random() * 255));