X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;fp=src%2Fjalview%2Fgui%2FAlignFrame.java;h=1b09868fe23694a9ab375096d4173a000dc4dc5d;hb=4f77328104498504339216829abf5ea87e2791ec;hp=bac06e9268598862cddacd96b50026f61ec60494;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index bac06e9..1b09868 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -28,12 +28,10 @@ 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; @@ -107,7 +105,6 @@ 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; @@ -165,8 +162,7 @@ import ext.vamsas.ServiceHandle; * @version $Revision$ */ @SuppressWarnings("serial") -public class AlignFrame extends GAlignFrame - implements AlignFrameI, DropTargetListener, +public class AlignFrame extends GAlignFrame implements DropTargetListener, IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener { @@ -300,6 +296,9 @@ public class AlignFrame extends GAlignFrame viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId); + alignPanel = new AlignmentPanel(this, viewport); + + addAlignmentPanel(alignPanel, true); init(); } @@ -319,6 +318,8 @@ public class AlignFrame extends GAlignFrame { viewport.hideSequence(hiddenSeqs); } + alignPanel = new AlignmentPanel(this, viewport); + addAlignmentPanel(alignPanel, true); init(); } @@ -334,6 +335,7 @@ public class AlignFrame extends GAlignFrame { viewport = ap.av; alignPanel = ap; + addAlignmentPanel(ap, false); init(); } @@ -343,34 +345,11 @@ public class AlignFrame extends GAlignFrame */ void init() { - 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 +// 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, @@ -385,7 +364,7 @@ public class AlignFrame extends GAlignFrame // modifyPID.setEnabled(false); } - String sortby = jalview.bin.Cache.getDefault(Preferences.SORT_ALIGNMENT, + String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", "No sort"); if (sortby.equals("Id")) @@ -397,6 +376,9 @@ public class AlignFrame extends GAlignFrame sortPairwiseMenuItem_actionPerformed(null); } + this.alignPanel.av + .setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); + setMenusFromViewport(viewport); buildSortByAnnotationScoresMenu(); calculateTree.addActionListener(new ActionListener() @@ -410,7 +392,7 @@ public class AlignFrame extends GAlignFrame }); buildColourMenu(); - if (Desktop.getDesktopPane() != null) + if (Desktop.desktop != null) { this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); if (!Platform.isJS()) @@ -425,7 +407,7 @@ public class AlignFrame extends GAlignFrame wrapMenuItem_actionPerformed(null); } - if (jalview.bin.Cache.getDefault(Preferences.SHOW_OVERVIEW, false)) + if (jalview.bin.Cache.getDefault("SHOW_OVERVIEW", false)) { this.overviewMenuItem_actionPerformed(null); } @@ -569,7 +551,7 @@ public class AlignFrame extends GAlignFrame switch (evt.getKeyCode()) { - case KeyEvent.VK_ESCAPE: // escape key + case 27: // escape key deselectAllSequenceMenuItem_actionPerformed(null); break; @@ -808,12 +790,9 @@ public class AlignFrame extends GAlignFrame { ap.av.getAlignment().padGaps(); } - if (Jalview.getInstance().getStartCalculations()) - { - ap.av.updateConservation(ap); - ap.av.updateConsensus(ap); - ap.av.updateStrucConsensus(ap); - } + ap.av.updateConservation(ap); + ap.av.updateConsensus(ap); + ap.av.updateStrucConsensus(ap); } } @@ -836,12 +815,14 @@ public class AlignFrame extends GAlignFrame private void addServiceListeners() { final java.beans.PropertyChangeListener thisListener; - Desktop.getInstance().addJalviewPropertyChangeListener("services", + 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() { @@ -865,7 +846,7 @@ public class AlignFrame extends GAlignFrame javax.swing.event.InternalFrameEvent evt) { // System.out.println("deregistering discoverer listener"); - Desktop.getInstance().removeJalviewPropertyChangeListener("services", + Desktop.instance.removeJalviewPropertyChangeListener("services", thisListener); closeMenuItem_actionPerformed(true); } @@ -942,8 +923,10 @@ public class AlignFrame extends GAlignFrame /* * Show/hide annotations only enabled if annotation panel is shown */ - syncAnnotationMenuItems(); - + showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); + hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); + showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); + hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); viewBoxesMenuItem.setSelected(av.getShowBoxes()); viewTextMenuItem.setSelected(av.getShowText()); showNonconservedMenuItem.setSelected(av.getShowUnconserved()); @@ -961,7 +944,7 @@ public class AlignFrame extends GAlignFrame applyToAllGroups.setState(av.getColourAppliesToAllGroups()); showNpFeatsMenuitem.setSelected(av.isShowNPFeats()); showDbRefsMenuitem.setSelected(av.isShowDBRefs()); - autoCalculate.setSelected(av.getAutoCalculateConsensusAndConservation()); + autoCalculate.setSelected(av.autoCalculateConsensus); sortByTree.setSelected(av.sortByTree); listenToViewSelections.setSelected(av.followSelection); @@ -1044,7 +1027,7 @@ public class AlignFrame extends GAlignFrame @Override public void addFromFile_actionPerformed(ActionEvent e) { - Desktop.getInstance().inputLocalFileMenuItem_actionPerformed(viewport); + Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport); } @Override @@ -1058,7 +1041,7 @@ public class AlignFrame extends GAlignFrame // file is reloaded. if (FileFormat.Jalview.equals(currentFileFormat)) { - JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames(); + JInternalFrame[] frames = Desktop.desktop.getAllFrames(); for (int i = 0; i < frames.length; i++) { if (frames[i] instanceof AlignFrame && frames[i] != this @@ -1068,20 +1051,20 @@ public class AlignFrame extends GAlignFrame try { frames[i].setSelected(true); - Desktop.getInstance().closeAssociatedWindows(); + Desktop.instance.closeAssociatedWindows(); } catch (java.beans.PropertyVetoException ex) { } } } - Desktop.getInstance().closeAssociatedWindows(); + Desktop.instance.closeAssociatedWindows(); FileLoader loader = new FileLoader(); DataSourceType protocol = fileName.startsWith("http:") ? DataSourceType.URL : DataSourceType.FILE; - loader.loadFile(viewport, fileName, protocol, currentFileFormat); + loader.LoadFile(viewport, fileName, protocol, currentFileFormat); } else { @@ -1097,12 +1080,12 @@ public class AlignFrame extends GAlignFrame DataSourceType protocol = (fileName.startsWith("http:") ? DataSourceType.URL : DataSourceType.FILE); - newframe = loader.loadFileWaitTillLoaded(fileName, protocol, + newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, currentFileFormat); } else { - newframe = loader.loadFileWaitTillLoaded(fileObject, + newframe = loader.LoadFileWaitTillLoaded(fileObject, DataSourceType.FILE, currentFileFormat); } @@ -1133,14 +1116,14 @@ public class AlignFrame extends GAlignFrame @Override public void addFromText_actionPerformed(ActionEvent e) { - Desktop.getInstance() + Desktop.instance .inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel()); } @Override public void addFromURL_actionPerformed(ActionEvent e) { - Desktop.getInstance().inputURLMenuItem_actionPerformed(viewport); + Desktop.instance.inputURLMenuItem_actionPerformed(viewport); } @Override @@ -1184,7 +1167,7 @@ public class AlignFrame extends GAlignFrame // todo is this (2005) test now obsolete - value is never null? while (currentFileFormat == null) { - JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager .getString("label.select_file_format_before_saving"), MessageManager.getString("label.file_format_not_specified"), @@ -1306,7 +1289,6 @@ public class AlignFrame extends GAlignFrame String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file; PrintWriter out = new PrintWriter( new FileWriter(tempFilePath)); - out.print(output); out.close(); AlignFrame.this.setTitle(file); @@ -1947,17 +1929,16 @@ public class AlignFrame extends GAlignFrame StringSelection ss = new StringSelection(output); - Desktop d = Desktop.getInstance(); try { - d.internalCopy = true; + jalview.gui.Desktop.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.getInstance()); + Desktop.instance); } catch (OutOfMemoryError er) { new OOMWarning("copying region", er); @@ -1977,7 +1958,7 @@ public class AlignFrame extends GAlignFrame hiddenCutoff, hiddenOffset); } - d.jalviewClipboard = new Object[] { seqs, + Desktop.jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; setStatus(MessageManager.formatMessage( "label.copied_sequences_to_clipboard", new Object[] @@ -2049,14 +2030,12 @@ public class AlignFrame extends GAlignFrame boolean annotationAdded = false; AlignmentI alignment = null; - Desktop d = Desktop.getInstance(); - - if (d.jalviewClipboard != null) + if (Desktop.jalviewClipboard != null) { // The clipboard was filled from within Jalview, we must use the // sequences // And dataset from the copied alignment - SequenceI[] newseq = (SequenceI[]) d.jalviewClipboard[0]; + SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0]; // be doubly sure that we create *new* sequence objects. sequences = new SequenceI[newseq.length]; for (int i = 0; i < newseq.length; i++) @@ -2081,10 +2060,10 @@ public class AlignFrame extends GAlignFrame if (newAlignment) { - if (d.jalviewClipboard != null) + if (Desktop.jalviewClipboard != null) { // dataset is inherited - alignment.setDataset((Alignment) d.jalviewClipboard[1]); + alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]); } else { @@ -2100,8 +2079,8 @@ public class AlignFrame extends GAlignFrame alignment = viewport.getAlignment(); alwidth = alignment.getWidth() + 1; // decide if we need to import sequences from an existing dataset - boolean importDs = d.jalviewClipboard != null - && d.jalviewClipboard[1] != alignment.getDataset(); + boolean importDs = Desktop.jalviewClipboard != null + && Desktop.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 @@ -2178,7 +2157,7 @@ public class AlignFrame extends GAlignFrame newGraphGroups.add(q, null); } newGraphGroups.set(newann.graphGroup, - new Integer(++fgroup)); + Integer.valueOf(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); @@ -2225,7 +2204,7 @@ public class AlignFrame extends GAlignFrame newGraphGroups.add(q, null); } newGraphGroups.set(newann.graphGroup, - new Integer(++fgroup)); + Integer.valueOf(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); @@ -2303,9 +2282,10 @@ public class AlignFrame extends GAlignFrame DEFAULT_HEIGHT); String newtitle = new String("Copied sequences"); - if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) + if (Desktop.jalviewClipboard != null + && Desktop.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2358,11 +2338,10 @@ public class AlignFrame extends GAlignFrame DEFAULT_HEIGHT); String newtitle = new String("Flanking alignment"); - Desktop d = Desktop.getInstance(); - - if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) + if (Desktop.jalviewClipboard != null + && Desktop.jalviewClipboard[2] != null) { - HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2]; + HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; af.viewport.setHiddenColumns(hc); } @@ -2459,7 +2438,7 @@ public class AlignFrame extends GAlignFrame + 1) == viewport.getAlignment().getWidth()) ? true : false; if (wholeHeight && wholeWidth) { - JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane()); + JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop); dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION Object[] options = new Object[] { MessageManager.getString("action.ok"), MessageManager.getString("action.cancel") }; @@ -2933,7 +2912,7 @@ public class AlignFrame extends GAlignFrame @Override public void gatherViews_actionPerformed(ActionEvent e) { - Desktop.getInstance().gatherViews(this); + Desktop.instance.gatherViews(this); } /** @@ -3311,20 +3290,13 @@ public class AlignFrame extends GAlignFrame { final boolean setVisible = annotationPanelMenuItem.isSelected(); viewport.setShowAnnotation(setVisible); - syncAnnotationMenuItems(); + this.showAllSeqAnnotations.setEnabled(setVisible); + this.hideAllSeqAnnotations.setEnabled(setVisible); + this.showAllAlAnnotations.setEnabled(setVisible); + this.hideAllAlAnnotations.setEnabled(setVisible); 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() { @@ -3385,38 +3357,12 @@ public class AlignFrame extends GAlignFrame } JInternalFrame frame = new JInternalFrame(); - - // BH 2019.07.26 we allow for an embedded - // undecorated overview with defined size - frame.setName(Jalview.getAppID("overview")); - // - Dimension dim = (Dimension) Platform.getEmbeddedAttribute(frame, - Platform.EMBEDDED_DIM); - if (dim != null && dim.width == 0) - { - dim = null; // hidden, not embedded - } - - OverviewPanel overview = new OverviewPanel(alignPanel, dim); - + final OverviewPanel overview = new OverviewPanel(alignPanel); 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, dim.width, dim.height, resizable, - true); + { this.getTitle() }), true, frame.getWidth(), frame.getHeight(), + true, true); frame.pack(); frame.setLayer(JLayeredPane.PALETTE_LAYER); frame.addInternalFrameListener( @@ -3696,8 +3642,8 @@ public class AlignFrame extends GAlignFrame @Override public void autoCalculate_actionPerformed(ActionEvent e) { - viewport.setAutoCalculateConsensusAndConservation(autoCalculate.isSelected()); - if (viewport.getAutoCalculateConsensusAndConservation()) + viewport.autoCalculateConsensus = autoCalculate.isSelected(); + if (viewport.autoCalculateConsensus) { viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); @@ -3743,7 +3689,7 @@ public class AlignFrame extends GAlignFrame { if (_s.getLength() < sg.getEndRes()) { - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), + JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager.getString( "label.selected_region_to_tree_may_only_contain_residues_or_gaps"), MessageManager.getString( @@ -4065,7 +4011,7 @@ public class AlignFrame extends GAlignFrame viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); } catch (Exception ex) { - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(), + JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), MessageManager .getString("label.problem_reading_tree_file"), JvOptionPane.WARNING_MESSAGE); @@ -4073,7 +4019,7 @@ public class AlignFrame extends GAlignFrame } if (fin != null && fin.hasWarningMessage()) { - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), + JvOptionPane.showMessageDialog(Desktop.desktop, fin.getWarningMessage(), MessageManager.getString( "label.possible_problem_with_tree_file"), @@ -4201,11 +4147,9 @@ public class AlignFrame extends GAlignFrame 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) - // && - services != null && (services.size() > 0)) + // && + Discoverer.services != null && (Discoverer.services.size() > 0)) { // TODO: refactor to allow list of AbstractName/Handler bindings to // be @@ -4213,7 +4157,8 @@ public class AlignFrame extends GAlignFrame // No MSAWS used any more: // Vector msaws = null; // (Vector) // Discoverer.services.get("MsaWS"); - Vector secstrpr = services.get("SecStrPred"); + Vector secstrpr = Discoverer.services + .get("SecStrPred"); if (secstrpr != null) { // Add any secondary structure prediction services @@ -4264,10 +4209,10 @@ public class AlignFrame extends GAlignFrame 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.getInstance(); + Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer(); if (jws2servs != null) { if (jws2servs.hasServices()) @@ -4454,7 +4399,7 @@ public class AlignFrame extends GAlignFrame final String errorTitle = MessageManager .getString("label.implementation_error") + MessageManager.getString("label.translation_failed"); - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle, + JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, JvOptionPane.ERROR_MESSAGE); return; } @@ -4464,7 +4409,7 @@ public class AlignFrame extends GAlignFrame "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.getDesktopPane(), msg, errorTitle, + JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, JvOptionPane.WARNING_MESSAGE); } else @@ -4478,7 +4423,7 @@ public class AlignFrame extends GAlignFrame if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); - AlignViewport.openSplitFrame(this, af, new Alignment(seqs)); + viewport.openSplitFrame(af, new Alignment(seqs)); } else { @@ -4511,7 +4456,7 @@ public class AlignFrame extends GAlignFrame { // BH 2018 return avc.parseFeaturesFile(file, sourceType, - Cache.getDefault(Preferences.RELAXEDSEQIDMATCHING, false)); + Cache.getDefault("RELAXEDSEQIDMATCHING", false)); } @@ -4525,7 +4470,6 @@ public class AlignFrame extends GAlignFrame { viewport.setShowSequenceFeatures(true); showSeqFeatures.setSelected(true); - alignPanel.getAlignment().resetColors(); } } @@ -4655,7 +4599,7 @@ public class AlignFrame extends GAlignFrame if (filesmatched.size() > 0) { boolean autoAssociate = Cache - .getDefault(Preferences.AUTOASSOCIATE_PDBANDSEQS, false); + .getDefault("AUTOASSOCIATE_PDBANDSEQS", false); if (!autoAssociate) { String msg = MessageManager.formatMessage( @@ -4678,9 +4622,10 @@ public class AlignFrame extends GAlignFrame // associating PDB files which have no IDs. for (SequenceI toassoc : (SequenceI[]) fm[2]) { - PDBEntry pe = AssociatePdbFileWithSeq + PDBEntry pe = new AssociatePdbFileWithSeq() .associatePdbWithSeq(fm[0].toString(), - (DataSourceType) fm[1], toassoc, false); + (DataSourceType) fm[1], toassoc, false, + Desktop.instance); if (pe != null) { System.err.println("Associated file : " @@ -4791,7 +4736,7 @@ public class AlignFrame extends GAlignFrame { // some problem - if no warning its probable that the ID matching // process didn't work - JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), + JvOptionPane.showMessageDialog(Desktop.desktop, tcf.getWarningMessage() == null ? MessageManager.getString( "label.check_file_matches_sequence_ids_alignment") @@ -4850,13 +4795,17 @@ public class AlignFrame extends GAlignFrame } else { - new FileLoader().loadFile(viewport, file, sourceType, format); + new FileLoader().LoadFile(viewport, file, sourceType, format); } } } if (isAnnotation) { - updateForAnnotations(); + + alignPanel.adjustAnnotationHeight(); + viewport.updateSequenceIdColours(); + buildSortByAnnotationScoresMenu(); + alignPanel.paintAlignment(true, true); } } catch (Exception ex) { @@ -4880,23 +4829,11 @@ public class AlignFrame extends GAlignFrame + (format != null ? "(parsing as '" + format + "' file)" : ""), - oom, Desktop.getDesktopPane()); + oom, Desktop.desktop); } } /** - * 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. */ @@ -4979,32 +4916,6 @@ public class AlignFrame extends GAlignFrame } /** - * 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 @@ -5148,13 +5059,14 @@ public class AlignFrame extends GAlignFrame @Override public void run() { + final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher + .getSequenceFetcherSingleton(); javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - String[] dbclasses = jalview.ws.SequenceFetcher.getInstance() - .getNonAlignmentSources(); + String[] dbclasses = sf.getNonAlignmentSources(); List otherdb; JMenu dfetch = new JMenu(); JMenu ifetch = new JMenu(); @@ -5164,8 +5076,7 @@ public class AlignFrame extends GAlignFrame int dbi = 0; for (String dbclass : dbclasses) { - otherdb = jalview.ws.SequenceFetcher.getInstance() - .getSourceProxy(dbclass); + otherdb = sf.getSourceProxy(dbclass); // add a single entry for this class, or submenu allowing 'fetch // all' or pick one if (otherdb == null || otherdb.size() < 1) @@ -5178,9 +5089,9 @@ public class AlignFrame extends GAlignFrame } 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() { @@ -5727,7 +5638,7 @@ public class AlignFrame extends GAlignFrame } catch (Exception ex) { System.err.println((ex.toString())); - JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.getString("label.couldnt_run_groovy_script"), MessageManager.getString("label.groovy_support_failed"), JvOptionPane.ERROR_MESSAGE); @@ -5838,67 +5749,6 @@ public class AlignFrame extends GAlignFrame } - /** - * 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 @@ -5937,5 +5787,4 @@ class PrintThread extends Thread } } } - }