X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=e44ccdc140091260439f56005ee38829c96d7c06;hb=14bfc6fb57f123b815f08dbf5b35544abd33b3af;hp=2a5d372a5a13740b668c10950baf1fc8fc32bfdc;hpb=3794e32468caad49611d66f160f6134272752db9;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2a5d372..e44ccdc 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -24,13 +24,16 @@ import jalview.analysis.AlignmentSorter; import jalview.analysis.AlignmentUtils; import jalview.analysis.CrossRef; import jalview.analysis.Dna; +import jalview.analysis.GeneticCodeI; import jalview.analysis.ParseProperties; import jalview.analysis.SequenceIdMatcher; import jalview.api.AlignExportSettingsI; +import jalview.api.AlignFrameI; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +//from JalviewLite imports import jalview.api.FeatureRenderer; import jalview.api.FeatureSettingsControllerI; import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; @@ -64,6 +67,7 @@ import jalview.gui.ColourMenuHelper.ColourChangeListener; import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.io.AlignmentProperties; import jalview.io.AnnotationFile; +import jalview.io.BackupFiles; import jalview.io.BioJsHTMLOutput; import jalview.io.DataSourceType; import jalview.io.FileFormat; @@ -83,6 +87,7 @@ import jalview.io.ScoreMatrixFile; import jalview.io.TCoffeeScoreFile; import jalview.io.vcf.VCFLoader; import jalview.jbgui.GAlignFrame; +import jalview.project.Jalview2XML; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemes; import jalview.schemes.ResidueColourScheme; @@ -102,6 +107,7 @@ import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; @@ -125,6 +131,7 @@ import java.awt.event.MouseEvent; 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; @@ -137,6 +144,7 @@ import java.util.Hashtable; import java.util.List; import java.util.Vector; +import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComponent; import javax.swing.JEditorPane; @@ -149,13 +157,17 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; +import ext.vamsas.ServiceHandle; + /** * DOCUMENT ME! * * @author $author$ * @version $Revision$ */ -public class AlignFrame extends GAlignFrame implements DropTargetListener, +@SuppressWarnings("serial") +public class AlignFrame extends GAlignFrame + implements AlignFrameI, DropTargetListener, IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener { @@ -182,9 +194,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /** * Current filename for this alignment */ - String fileName = null; + private String fileName = null; - File fileObject; + private File fileObject; /** * Creates a new AlignFrame object with specific width and height. @@ -289,9 +301,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId); - alignPanel = new AlignmentPanel(this, viewport); - - addAlignmentPanel(alignPanel, true); init(); } @@ -311,8 +320,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.hideSequence(hiddenSeqs); } - alignPanel = new AlignmentPanel(this, viewport); - addAlignmentPanel(alignPanel, true); init(); } @@ -328,7 +335,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport = ap.av; alignPanel = ap; - addAlignmentPanel(ap, false); init(); } @@ -338,11 +344,34 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ void init() { -// setBackground(Color.white); // BH 2019 + boolean newPanel = (alignPanel == null); + viewport.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); + if (newPanel) + { + if (Platform.isJS()) + { + // need to set this up front if NOANNOTATION is + // used in conjunction with SHOWOVERVIEW. + + // I have not determined if this is appropriate for + // Jalview/Java, as it means we are setting this flag + // for all subsequent AlignFrames. For now, at least, + // I am setting it to be JalviewJS-only. + + boolean showAnnotation = Jalview.getInstance().getShowAnnotation(); + viewport.setShowAnnotation(showAnnotation); + } + alignPanel = new AlignmentPanel(this, viewport); + } + addAlignmentPanel(alignPanel, newPanel); + + // setBackground(Color.white); // BH 2019 if (!Jalview.isHeadlessMode()) { progressBar = new ProgressBar(this.statusPanel, this.statusBar); + statusPanel.setVisible(Jalview.getInstance().getShowStatus()); + alignFrameMenuBar.setVisible(Jalview.getInstance().getAllowMenuBar()); } avc = new jalview.controller.AlignViewController(this, viewport, @@ -357,7 +386,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // modifyPID.setEnabled(false); } - String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", + String sortby = jalview.bin.Cache.getDefault(Preferences.SORT_ALIGNMENT, "No sort"); if (sortby.equals("Id")) @@ -369,9 +398,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sortPairwiseMenuItem_actionPerformed(null); } - this.alignPanel.av - .setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); - setMenusFromViewport(viewport); buildSortByAnnotationScoresMenu(); calculateTree.addActionListener(new ActionListener() @@ -385,18 +411,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, }); buildColourMenu(); - if (Desktop.desktop != null) + if (Desktop.getDesktopPane() != null) { this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); - /** - * BH 2018 ignore service listeners - * - * @j2sNative - * - */ + PropertyChangeListener serviceListener = (Platform.isJS() ? null + : addServiceListeners()); + addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() { - addServiceListeners(); - } + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + // System.out.println("deregistering discoverer listener"); + if (serviceListener != null) + { + Desktop.getInstance().removeJalviewPropertyChangeListener( + "services", serviceListener); + } + closeMenuItem_actionPerformed(true); + } + }); + setGUINucleotide(); } @@ -405,7 +440,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, wrapMenuItem_actionPerformed(null); } - if (jalview.bin.Cache.getDefault("SHOW_OVERVIEW", false)) + if (jalview.bin.Cache.getDefault(Preferences.SHOW_OVERVIEW, false)) { this.overviewMenuItem_actionPerformed(null); } @@ -549,7 +584,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, switch (evt.getKeyCode()) { - case 27: // escape key + case KeyEvent.VK_ESCAPE: // escape key deselectAllSequenceMenuItem_actionPerformed(null); break; @@ -788,9 +823,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { ap.av.getAlignment().padGaps(); } - ap.av.updateConservation(ap); - ap.av.updateConsensus(ap); - ap.av.updateStrucConsensus(ap); + if (Jalview.getInstance().getStartCalculations()) + { + ap.av.updateConservation(ap); + ap.av.updateConsensus(ap); + ap.av.updateStrucConsensus(ap); + } } } @@ -810,45 +848,30 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /* Set up intrinsic listeners for dynamically generated GUI bits. */ - private void addServiceListeners() + private PropertyChangeListener addServiceListeners() { - final java.beans.PropertyChangeListener thisListener; - Desktop.instance.addJalviewPropertyChangeListener("services", - thisListener = new java.beans.PropertyChangeListener() - { - @Override - public void propertyChange(PropertyChangeEvent evt) - { - // // System.out.println("Discoverer property change."); - // if (evt.getPropertyName().equals("services")) - { - SwingUtilities.invokeLater(new Runnable() - { - - @Override - public void run() - { - System.err.println( - "Rebuild WS Menu for service change"); - BuildWebServiceMenu(); - } - - }); - } - } - }); - addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() + PropertyChangeListener serviceListener = new PropertyChangeListener() { @Override - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) + public void propertyChange(PropertyChangeEvent evt) { - // System.out.println("deregistering discoverer listener"); - Desktop.instance.removeJalviewPropertyChangeListener("services", - thisListener); - closeMenuItem_actionPerformed(true); - }; - }); + { + SwingUtilities.invokeLater(new Runnable() + { + + @Override + public void run() + { + System.err.println("Rebuild WS Menu for service change"); + BuildWebServiceMenu(); + } + }); + } + } + }; + + Desktop.getInstance().addJalviewPropertyChangeListener("services", + serviceListener); // Finally, build the menu once to get current service state new Thread(new Runnable() { @@ -858,6 +881,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, BuildWebServiceMenu(); } }).start(); + return serviceListener; } /** @@ -921,10 +945,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /* * Show/hide annotations only enabled if annotation panel is shown */ - showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); - hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); - showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); - hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); + syncAnnotationMenuItems(); + viewBoxesMenuItem.setSelected(av.getShowBoxes()); viewTextMenuItem.setSelected(av.getShowText()); showNonconservedMenuItem.setSelected(av.getShowUnconserved()); @@ -942,7 +964,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, applyToAllGroups.setState(av.getColourAppliesToAllGroups()); showNpFeatsMenuitem.setSelected(av.isShowNPFeats()); showDbRefsMenuitem.setSelected(av.isShowDBRefs()); - autoCalculate.setSelected(av.autoCalculateConsensus); + autoCalculate.setSelected(av.getAutoCalculateConsensusAndConservation()); sortByTree.setSelected(av.sortByTree); listenToViewSelections.setSelected(av.followSelection); @@ -992,14 +1014,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return progressBar.operationInProgress(); } + /** + * Sets the text of the status bar. Note that setting a null or empty value + * will cause the status bar to be hidden, with possibly undesirable flicker + * of the screen layout. + */ @Override public void setStatus(String text) { - // BH note: If text width and height are 0, then the layout manager - // will dispense of it and change the frame height. - // In JavaScript, we use \u00A0 -- unicode "non-breaking space" - // which is the unicode encoding of   - statusBar.setText(text == null || text.isEmpty() ? " " : text); } @@ -1025,103 +1047,106 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void addFromFile_actionPerformed(ActionEvent e) { - Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport); + Desktop.getInstance().inputLocalFileMenuItem_actionPerformed(viewport); } @Override public void reload_actionPerformed(ActionEvent e) { - if (fileName != null) + if (fileName == null) { - // TODO: JAL-1108 - ensure all associated frames are closed regardless of - // originating file's format - // TODO: work out how to recover feature settings for correct view(s) when - // file is reloaded. - if (FileFormat.Jalview.equals(currentFileFormat)) + return; + } + // TODO: JAL-1108 - ensure all associated frames are closed regardless of + // originating file's format + // TODO: work out how to recover feature settings for correct view(s) when + // file is reloaded. + if (FileFormat.Jalview.equals(currentFileFormat)) + { + JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames(); + for (int i = 0; i < frames.length; i++) { - JInternalFrame[] frames = Desktop.desktop.getAllFrames(); - for (int i = 0; i < frames.length; i++) + if (frames[i] instanceof AlignFrame && frames[i] != this + && ((AlignFrame) frames[i]).fileName != null + && ((AlignFrame) frames[i]).fileName.equals(fileName)) { - if (frames[i] instanceof AlignFrame && frames[i] != this - && ((AlignFrame) frames[i]).fileName != null - && ((AlignFrame) frames[i]).fileName.equals(fileName)) + try + { + frames[i].setSelected(true); + Desktop.getInstance().closeAssociatedWindows(); + } catch (java.beans.PropertyVetoException ex) { - try - { - frames[i].setSelected(true); - Desktop.instance.closeAssociatedWindows(); - } catch (java.beans.PropertyVetoException ex) - { - } } - } - Desktop.instance.closeAssociatedWindows(); - FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") - ? DataSourceType.URL - : DataSourceType.FILE; - loader.LoadFile(viewport, fileName, protocol, currentFileFormat); } - else - { - Rectangle bounds = this.getBounds(); + Desktop.getInstance().closeAssociatedWindows(); - FileLoader loader = new FileLoader(); + FileLoader loader = new FileLoader(); + DataSourceType protocol = fileName.startsWith("http:") + ? DataSourceType.URL + : DataSourceType.FILE; + loader.loadFile(viewport, + (fileObject == null ? fileName : fileObject), protocol, + currentFileFormat); + } + else + { + Rectangle bounds = this.getBounds(); - AlignFrame newframe = null; + FileLoader loader = new FileLoader(); - if (fileObject == null) - { + AlignFrame newframe = null; - DataSourceType protocol = (fileName.startsWith("http:") - ? DataSourceType.URL - : DataSourceType.FILE); - newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, - currentFileFormat); - } - else - { - newframe = loader.LoadFileWaitTillLoaded(fileObject, - DataSourceType.FILE, currentFileFormat); - } + if (fileObject == null) + { + + DataSourceType protocol = (fileName.startsWith("http:") + ? DataSourceType.URL + : DataSourceType.FILE); + newframe = loader.loadFileWaitTillLoaded(fileName, protocol, + currentFileFormat); + } + else + { + newframe = loader.loadFileWaitTillLoaded(fileObject, + DataSourceType.FILE, currentFileFormat); + } - newframe.setBounds(bounds); - if (featureSettings != null && featureSettings.isShowing()) + 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; + Jalview.execRunnable(new Runnable() { - 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() + @Override + public void run() { - @Override - public void run() - { - nfs.frame.setBounds(fspos); - } - }); - this.featureSettings.close(); - this.featureSettings = null; - } - this.closeMenuItem_actionPerformed(true); + nfs.frame.setBounds(fspos); + } + }); + this.featureSettings.close(); + this.featureSettings = null; } + this.closeMenuItem_actionPerformed(true); } } @Override public void addFromText_actionPerformed(ActionEvent e) { - Desktop.instance + Desktop.getInstance() .inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel()); } @Override public void addFromURL_actionPerformed(ActionEvent e) { - Desktop.instance.inputURLMenuItem_actionPerformed(viewport); + Desktop.getInstance().inputURLMenuItem_actionPerformed(viewport); } @Override @@ -1165,7 +1190,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // todo is this (2005) test now obsolete - value is never null? while (currentFileFormat == null) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, + JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), MessageManager .getString("label.select_file_format_before_saving"), MessageManager.getString("label.file_format_not_specified"), @@ -1230,7 +1255,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void saveAlignment(String file, FileFormatI format) { - lastSaveSuccessful = false; + lastSaveSuccessful = true; lastFilenameSaved = file; lastFormatSaved = format; @@ -1242,8 +1267,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, shortName = shortName.substring( shortName.lastIndexOf(File.separatorChar) + 1); } - lastSaveSuccessful = new jalview.project.Jalview2XML().saveAlignment(this, file, - shortName); + lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, shortName); statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] @@ -1280,21 +1304,34 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { + // create backupfiles object and get new temp filename destination + boolean doBackup = BackupFiles.getEnabled(); + BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null; try { - PrintWriter out = new PrintWriter(new FileWriter(file)); + String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file; + PrintWriter out = new PrintWriter( + new FileWriter(tempFilePath)); + out.print(output); out.close(); AlignFrame.this.setTitle(file); - setStatus(MessageManager.formatMessage( - "label.successfully_saved_to_file_in_format", - new Object[] - { fileName, format.getName() })); + statusBar.setText(MessageManager.formatMessage( + "label.successfully_saved_to_file_in_format", new Object[] + { fileName, format.getName() })); + lastSaveSuccessful = true; } catch (Exception ex) { lastSaveSuccessful = false; ex.printStackTrace(); } + + if (doBackup) + { + backupfiles.setWriteSuccess(lastSaveSuccessful); + // do the backup file roll and rename the temp file to actual file + lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile(); + } } } }; @@ -1916,16 +1953,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, StringSelection ss = new StringSelection(output); + Desktop d = Desktop.getInstance(); try { - jalview.gui.Desktop.internalCopy = true; + d.internalCopy = true; // Its really worth setting the clipboard contents // to empty before setting the large StringSelection!! Toolkit.getDefaultToolkit().getSystemClipboard() .setContents(new StringSelection(""), null); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, - Desktop.instance); + Desktop.getInstance()); } catch (OutOfMemoryError er) { new OOMWarning("copying region", er); @@ -1945,7 +1983,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, hiddenCutoff, hiddenOffset); } - Desktop.jalviewClipboard = new Object[] { seqs, + d.jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; setStatus(MessageManager.formatMessage( "label.copied_sequences_to_clipboard", new Object[] @@ -2017,12 +2055,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, boolean annotationAdded = false; AlignmentI alignment = null; - if (Desktop.jalviewClipboard != null) + Desktop d = Desktop.getInstance(); + + if (d.jalviewClipboard != null) { // The clipboard was filled from within Jalview, we must use the // sequences // And dataset from the copied alignment - SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0]; + SequenceI[] newseq = (SequenceI[]) d.jalviewClipboard[0]; // be doubly sure that we create *new* sequence objects. sequences = new SequenceI[newseq.length]; for (int i = 0; i < newseq.length; i++) @@ -2047,10 +2087,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (newAlignment) { - if (Desktop.jalviewClipboard != null) + if (d.jalviewClipboard != null) { // dataset is inherited - alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]); + alignment.setDataset((Alignment) d.jalviewClipboard[1]); } else { @@ -2066,11 +2106,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignment = viewport.getAlignment(); alwidth = alignment.getWidth() + 1; // decide if we need to import sequences from an existing dataset - boolean importDs = Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[1] != alignment.getDataset(); + boolean importDs = d.jalviewClipboard != null + && d.jalviewClipboard[1] != alignment.getDataset(); // importDs==true instructs us to copy over new dataset sequences from // an existing alignment - Vector newDs = (importDs) ? new Vector() : null; // used to create + Vector newDs = (importDs) ? new Vector<>() : null; // used to + // create // minimum dataset set for (int i = 0; i < sequences.length; i++) @@ -2209,7 +2250,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // propagate alignment changed. - viewport.getRanges().setEndSeq(alignment.getHeight()); + viewport.getRanges().setEndSeq(alignment.getHeight() - 1); if (annotationAdded) { // Duplicate sequence annotation in all views. @@ -2268,10 +2309,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, DEFAULT_HEIGHT); String newtitle = new String("Copied sequences"); - if (Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[2] != null) + if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2324,10 +2364,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, DEFAULT_HEIGHT); String newtitle = new String("Flanking alignment"); - if (Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[2] != null) + Desktop d = Desktop.getInstance(); + + if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2424,7 +2465,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, + 1) == viewport.getAlignment().getWidth()) ? true : false; if (wholeHeight && wholeWidth) { - JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop); + JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane()); dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION Object[] options = new Object[] { MessageManager.getString("action.ok"), MessageManager.getString("action.cancel") }; @@ -2464,15 +2505,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) { - SequenceGroup sg = new SequenceGroup(); - - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) - { - sg.addSequence(viewport.getAlignment().getSequenceAt(i), false); - } + SequenceGroup sg = new SequenceGroup( + viewport.getAlignment().getSequences()); sg.setEndRes(viewport.getAlignment().getWidth() - 1); viewport.setSelectionGroup(sg); + viewport.isSelectionGroupChanged(true); viewport.sendSelection(); // JAL-2034 - should delegate to // alignPanel to decide if overview needs @@ -2794,6 +2832,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newap.av.setRedoList(viewport.getRedoList()); /* + * copy any visualisation settings that are not saved in the project + */ + newap.av.setColourAppliesToAllGroups( + viewport.getColourAppliesToAllGroups()); + + /* * Views share the same mappings; need to deregister any new mappings * created by copyAlignPanel, and register the new reference to the shared * mappings @@ -2895,7 +2939,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void gatherViews_actionPerformed(ActionEvent e) { - Desktop.instance.gatherViews(this); + Desktop.getInstance().gatherViews(this); } /** @@ -2956,7 +3000,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setFollowHighlight(state); if (state) { - alignPanel.scrollToPosition(viewport.getSearchResults(), false); + alignPanel.scrollToPosition(viewport.getSearchResults()); } } @@ -3015,7 +3059,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param toggleSeqs * @param toggleCols */ - private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) + protected void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) { boolean hide = false; @@ -3103,6 +3147,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.expandColSelection(sg, false); viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3127,6 +3172,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void hideSelColumns_actionPerformed(ActionEvent e) { viewport.hideSelectedColumns(); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3148,7 +3194,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleAbove_actionPerformed(ActionEvent e) { viewport.setScaleAboveWrapped(scaleAbove.isSelected()); - // TODO: do we actually need to update overview for scale above change ? + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3162,6 +3208,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleLeft_actionPerformed(ActionEvent e) { viewport.setScaleLeftWrapped(scaleLeft.isSelected()); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3175,6 +3222,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleRight_actionPerformed(ActionEvent e) { viewport.setScaleRightWrapped(scaleRight.isSelected()); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3269,13 +3317,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { final boolean setVisible = annotationPanelMenuItem.isSelected(); viewport.setShowAnnotation(setVisible); - this.showAllSeqAnnotations.setEnabled(setVisible); - this.hideAllSeqAnnotations.setEnabled(setVisible); - this.showAllAlAnnotations.setEnabled(setVisible); - this.hideAllAlAnnotations.setEnabled(setVisible); + syncAnnotationMenuItems(); alignPanel.updateLayout(); } + private void syncAnnotationMenuItems() + { + final boolean setVisible = annotationPanelMenuItem.isSelected(); + showAllSeqAnnotations.setEnabled(setVisible); + hideAllSeqAnnotations.setEnabled(setVisible); + showAllAlAnnotations.setEnabled(setVisible); + hideAllAlAnnotations.setEnabled(setVisible); + } + + @Override public void alignmentProperties() { @@ -3300,6 +3355,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, ((JPanel) pane).add(textLabel, BorderLayout.NORTH); } else + /** + * Java only + * + * @j2sIgnore + */ { JEditorPane editPane = new JEditorPane("text/html", ""); editPane.setEditable(false); @@ -3331,12 +3391,36 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } JInternalFrame frame = new JInternalFrame(); - final OverviewPanel overview = new OverviewPanel(alignPanel); + + // BH 2019.07.26 we allow for an embedded + // undecorated overview with defined size + frame.setName(Jalview.getAppID("overview")); + // + Dimension dim = Platform.getDimIfEmbedded(frame, -1, -1); + if (dim != null && dim.width == 0) + { + dim = null; // hidden, not embedded + } + OverviewPanel overview = new OverviewPanel(alignPanel, dim); + frame.setContentPane(overview); + if (dim == null) + { + dim = new Dimension(); + // was frame.getSize(), but that is 0,0 at this point; + } + else + { + // we are imbedding, and so we have an undecorated frame + // and we can set the the frame dimensions accordingly. + } + // allowing for unresizable option using, style="resize:none" + boolean resizable = (Platform.getEmbeddedAttribute(frame, + "resize") != "none"); Desktop.addInternalFrame(frame, MessageManager .formatMessage("label.overview_params", new Object[] - { this.getTitle() }), true, frame.getWidth(), frame.getHeight(), - true, true); + { this.getTitle() }), true, dim.width, dim.height, resizable, + true); frame.pack(); frame.setLayer(JLayeredPane.PALETTE_LAYER); frame.addInternalFrameListener( @@ -3348,7 +3432,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { overview.dispose(); alignPanel.setOverviewPanel(null); - }; + } }); if (getKeyListeners().length > 0) { @@ -3418,6 +3502,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * otherwise set the chosen colour scheme (or null for 'None') */ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name, + viewport, viewport.getAlignment(), viewport.getHiddenRepSequences()); changeColour(cs); } @@ -3615,8 +3700,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void autoCalculate_actionPerformed(ActionEvent e) { - viewport.autoCalculateConsensus = autoCalculate.isSelected(); - if (viewport.autoCalculateConsensus) + viewport.setAutoCalculateConsensusAndConservation(autoCalculate.isSelected()); + if (viewport.getAutoCalculateConsensusAndConservation()) { viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); @@ -3662,7 +3747,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (_s.getLength() < sg.getEndRes()) { - JvOptionPane.showMessageDialog(Desktop.desktop, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), MessageManager.getString( "label.selected_region_to_tree_may_only_contain_residues_or_gaps"), MessageManager.getString( @@ -3694,7 +3779,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, frameTitle += this.title; - Desktop.addInternalFrame(tp, frameTitle, 600, 500); + Dimension dim = Platform.getDimIfEmbedded(tp, 600, 500); + Desktop.addInternalFrame(tp, frameTitle, dim.width, dim.height); } /** @@ -3785,7 +3871,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { sortByAnnotScore.removeAll(); // almost certainly a quicker way to do this - but we keep it simple - Hashtable scoreSorts = new Hashtable(); + Hashtable scoreSorts = new Hashtable<>(); AlignmentAnnotation aann[]; for (SequenceI sqa : viewport.getAlignment().getSequences()) { @@ -3798,11 +3884,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } } - Enumeration labels = scoreSorts.keys(); + Enumeration labels = scoreSorts.keys(); while (labels.hasMoreElements()) { addSortByAnnotScoreMenuItem(sortByAnnotScore, - (String) labels.nextElement()); + labels.nextElement()); } sortByAnnotScore.setVisible(scoreSorts.size() > 0); scoreSorts.clear(); @@ -3984,7 +4070,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); } catch (Exception ex) { - JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(), MessageManager .getString("label.problem_reading_tree_file"), JvOptionPane.WARNING_MESSAGE); @@ -3992,7 +4078,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (fin != null && fin.hasWarningMessage()) { - JvOptionPane.showMessageDialog(Desktop.desktop, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), fin.getWarningMessage(), MessageManager.getString( "label.possible_problem_with_tree_file"), @@ -4046,15 +4132,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (nf.getTree() != null) { tp = new TreePanel(alignPanel, nf, treeTitle, input); - - tp.setSize(w, h); + Dimension dim = Platform.getDimIfEmbedded(tp, -1, -1); + if (dim == null) + { + dim = new Dimension(w, h); + } + else + { + // no offset, either + x = 0; + } + tp.setSize(dim.width, dim.height); if (x > 0 && y > 0) { tp.setLocation(x, y); } - Desktop.addInternalFrame(tp, treeTitle, w, h); + Desktop.addInternalFrame(tp, treeTitle, dim.width, dim.height); } } catch (Exception ex) { @@ -4072,6 +4167,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void BuildWebServiceMenu() { + if (Jalview.isSynchronous()) + { + return; + } while (buildingMenu) { try @@ -4120,9 +4219,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final JMenu dismenu = new JMenu("Protein Disorder"); // JAL-940 - only show secondary structure prediction services from // the legacy server + Hashtable> services = Discoverer + .getInstance().getServices(); if (// Cache.getDefault("SHOW_JWS1_SERVICES", true) - // && - Discoverer.services != null && (Discoverer.services.size() > 0)) + // && + services != null && (services.size() > 0)) { // TODO: refactor to allow list of AbstractName/Handler bindings to // be @@ -4130,14 +4231,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // No MSAWS used any more: // Vector msaws = null; // (Vector) // Discoverer.services.get("MsaWS"); - Vector secstrpr = (Vector) Discoverer.services - .get("SecStrPred"); + Vector secstrpr = services.get("SecStrPred"); if (secstrpr != null) { // Add any secondary structure prediction services for (int i = 0, j = secstrpr.size(); i < j; i++) { - final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr + final ext.vamsas.ServiceHandle sh = secstrpr .get(i); jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer .getServiceClient(sh); @@ -4182,10 +4282,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, webService.add(me.webServiceNoServices); } // TODO: move into separate menu builder class. - boolean new_sspred = false; + // boolean new_sspred = false; if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { - Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer(); + Jws2Discoverer jws2servs = Jws2Discoverer.getInstance(); if (jws2servs != null) { if (jws2servs.hasServices()) @@ -4247,7 +4347,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * * @param webService */ - private void build_urlServiceMenu(JMenu webService) + protected void build_urlServiceMenu(JMenu webService) { // TODO: remove this code when 2.7 is released // DEBUG - alignmentView @@ -4355,14 +4455,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * frame's DNA sequences to their aligned protein (amino acid) equivalents. */ @Override - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { AlignmentI al = null; try { Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); - al = dna.translateCdna(); + al = dna.translateCdna(codeTable); } catch (Exception ex) { jalview.bin.Cache.log.error( @@ -4372,7 +4472,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final String errorTitle = MessageManager .getString("label.implementation_error") + MessageManager.getString("label.translation_failed"); - JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle, JvOptionPane.ERROR_MESSAGE); return; } @@ -4382,7 +4482,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); final String errorTitle = MessageManager .getString("label.translation_failed"); - JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle, JvOptionPane.WARNING_MESSAGE); } else @@ -4391,12 +4491,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, af.setFileFormat(this.currentFileFormat); final String newTitle = MessageManager .formatMessage("label.translation_of_params", new Object[] - { this.getTitle() }); + { this.getTitle(), codeTable.getId() }); af.setTitle(newTitle); if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); - viewport.openSplitFrame(af, new Alignment(seqs)); + AlignViewport.openSplitFrame(this, af, new Alignment(seqs)); } else { @@ -4429,7 +4529,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // BH 2018 return avc.parseFeaturesFile(file, sourceType, - Cache.getDefault("RELAXEDSEQIDMATCHING", false)); + Cache.getDefault(Preferences.RELAXEDSEQIDMATCHING, false)); } @@ -4516,8 +4616,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, : FormatAdapter.checkProtocol(fileName)); if (protocol == DataSourceType.FILE) { - File fl = (file instanceof File ? (File) file - : new File(fileName)); + File fl; + if (file instanceof File) { + fl = (File) file; + Platform.cacheFileData(fl); + } else { + fl = new File(fileName); + } pdbfn = fl.getName(); } else if (protocol == DataSourceType.URL) @@ -4567,7 +4672,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (filesmatched.size() > 0) { boolean autoAssociate = Cache - .getDefault("AUTOASSOCIATE_PDBANDSEQS", false); + .getDefault(Preferences.AUTOASSOCIATE_PDBANDSEQS, false); if (!autoAssociate) { String msg = MessageManager.formatMessage( @@ -4590,10 +4695,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // associating PDB files which have no IDs. for (SequenceI toassoc : (SequenceI[]) fm[2]) { - PDBEntry pe = new AssociatePdbFileWithSeq() + PDBEntry pe = AssociatePdbFileWithSeq .associatePdbWithSeq(fm[0].toString(), - (DataSourceType) fm[1], toassoc, false, - Desktop.instance); + (DataSourceType) fm[1], toassoc, false); if (pe != null) { System.err.println("Associated file : " @@ -4704,7 +4808,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // some problem - if no warning its probable that the ID matching // process didn't work - JvOptionPane.showMessageDialog(Desktop.desktop, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), tcf.getWarningMessage() == null ? MessageManager.getString( "label.check_file_matches_sequence_ids_alignment") @@ -4763,17 +4867,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - new FileLoader().LoadFile(viewport, file, sourceType, format); + new FileLoader().loadFile(viewport, file, sourceType, format); } } } if (isAnnotation) { - - alignPanel.adjustAnnotationHeight(); - viewport.updateSequenceIdColours(); - buildSortByAnnotationScoresMenu(); - alignPanel.paintAlignment(true, true); + updateForAnnotations(); } } catch (Exception ex) { @@ -4797,11 +4897,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, + (format != null ? "(parsing as '" + format + "' file)" : ""), - oom, Desktop.desktop); + oom, Desktop.getDesktopPane()); } } /** + * Do all updates necessary after an annotation file such as jnet. Also called + * from Jalview.loadAppletParams for "annotations", "jnetFile" + */ + public void updateForAnnotations() + { + alignPanel.adjustAnnotationHeight(); + viewport.updateSequenceIdColours(); + buildSortByAnnotationScoresMenu(); + alignPanel.paintAlignment(true, true); + } + + /** * Method invoked by the ChangeListener on the tabbed pane, in other words * when a different tabbed pane is selected by the user or programmatically. */ @@ -4884,6 +4996,32 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /** + * Change the display state for the given feature groups -- Added by BH from + * JalviewLite + * + * @param groups + * list of group strings + * @param state + * visible or invisible + */ + public void setFeatureGroupState(String[] groups, boolean state) + { + jalview.api.FeatureRenderer fr = null; + viewport.setShowSequenceFeatures(true); + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + + fr.setGroupVisibility(Arrays.asList(groups), state); + alignPanel.getSeqPanel().seqCanvas.repaint(); + if (alignPanel.overviewPanel != null) + { + alignPanel.overviewPanel.updateOverviewImage(); + } + } + } + + /** * Open the dialog for regex description parsing. */ @Override @@ -4982,7 +5120,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, trimrs.setSelected(trimrs.isSelected()); Cache.setProperty(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, Boolean.valueOf(trimrs.isSelected()).toString()); - }; + } }); rfetch.add(trimrs); JMenuItem fetchr = new JMenuItem( @@ -5022,19 +5160,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, }); rfetch.add(fetchr); - new Thread(new Runnable() + Jalview.execThread(new Thread(new Runnable() { @Override public void run() { - final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher - .getSequenceFetcherSingleton(); - javax.swing.SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() { - String[] dbclasses = sf.getNonAlignmentSources(); + String[] dbclasses = jalview.ws.SequenceFetcher.getInstance() + .getNonAlignmentSources(); List otherdb; JMenu dfetch = new JMenu(); JMenu ifetch = new JMenu(); @@ -5044,7 +5181,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int dbi = 0; for (String dbclass : dbclasses) { - otherdb = sf.getSourceProxy(dbclass); + otherdb = jalview.ws.SequenceFetcher.getInstance() + .getSourceProxy(dbclass); // add a single entry for this class, or submenu allowing 'fetch // all' or pick one if (otherdb == null || otherdb.size() < 1) @@ -5057,9 +5195,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (otherdb.size() == 1) { - final DbSourceProxy[] dassource = otherdb - .toArray(new DbSourceProxy[0]); DbSourceProxy src = otherdb.get(0); + DbSourceProxy[] dassource = new DbSourceProxy[] { + src }; fetchr = new JMenuItem(src.getDbSource()); fetchr.addActionListener(new ActionListener() { @@ -5246,7 +5384,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } }); } - }).start(); + })); } @@ -5379,7 +5517,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true, true); + alignPanel.paintAlignment(true, + viewport.needToUpdateStructureViews()); } } @@ -5605,7 +5744,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } catch (Exception ex) { System.err.println((ex.toString())); - JvOptionPane.showInternalMessageDialog(Desktop.desktop, + JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), MessageManager.getString("label.couldnt_run_groovy_script"), MessageManager.getString("label.groovy_support_failed"), JvOptionPane.ERROR_MESSAGE); @@ -5665,15 +5804,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, colourMenu.add(textColour); colourMenu.addSeparator(); - ColourMenuHelper.addMenuItems(colourMenu, this, viewport.getAlignment(), - false); + ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this, + viewport.getAlignment(), false); + colourMenu.add(annotationColour); + bg.add(annotationColour); colourMenu.addSeparator(); colourMenu.add(conservationMenuItem); colourMenu.add(modifyConservation); colourMenu.add(abovePIDThreshold); colourMenu.add(modifyPID); - colourMenu.add(annotationColour); ColourSchemeI colourScheme = viewport.getGlobalColourScheme(); ColourMenuHelper.setColourSelected(colourMenu, colourScheme); @@ -5709,12 +5849,73 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Cache.setProperty("LAST_DIRECTORY", choice); SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); new VCFLoader(choice).loadVCF(seqs, us); - }; + } }); chooser.showOpenDialog(null); } + /** + * BH 2019 from JalviewLite + * + * get sequence feature groups that are hidden or shown + * + * @param visible + * true is visible + * @return list + */ + public String[] getFeatureGroupsOfState(boolean visible) + { + jalview.api.FeatureRenderer fr = null; + if (alignPanel != null + && (fr = alignPanel + .getFeatureRenderer()) != null) + { + List gps = fr.getGroups(visible); + String[] _gps = gps.toArray(new String[gps.size()]); + return _gps; + } + return null; + } + + public void scrollTo(int row, int column) + { + alignPanel.getSeqPanel().scrollTo(row, column); + } + + public void scrollToRow(int row) + { + alignPanel.getSeqPanel().scrollToRow(row); + } + + public void scrollToColumn(int column) + { + alignPanel.getSeqPanel().scrollToColumn(column); + } + + /** + * + * @return list of feature groups on the view + */ + public String[] getFeatureGroups() + { + jalview.api.FeatureRenderer fr = null; + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + List gps = fr.getFeatureGroups(); + String[] _gps = gps.toArray(new String[gps.size()]); + return _gps; + } + return null; + } + + public void select(SequenceGroup sel, ColumnSelection csel, + HiddenColumns hidden) + { + alignPanel.getSeqPanel().selection(sel, csel, hidden, null); + } + } class PrintThread extends Thread @@ -5753,4 +5954,5 @@ class PrintThread extends Thread } } } + }