From 4f24ef0848cf3c43ba0467f31fce1baa5c57aad5 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 19 Jul 2006 15:22:07 +0000 Subject: [PATCH] Merge new frame buttons added --- src/jalview/gui/WebserviceInfo.java | 17 +++++- src/jalview/jbgui/GWebserviceInfo.java | 64 +++++++++++----------- src/jalview/ws/MsaWSClient.java | 91 +++++++++++++++++++++----------- 3 files changed, 110 insertions(+), 62 deletions(-) diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 7c5c5e3..9dadee7 100755 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -58,6 +58,7 @@ public class WebserviceInfo extends GWebserviceInfo String title = ""; jalview.ws.WSClientI thisService; boolean serviceIsCancellable; + JInternalFrame frame; /** * Creates a new WebserviceInfo object. @@ -114,9 +115,10 @@ public class WebserviceInfo extends GWebserviceInfo */ void init(String title, String info, int width, int height) { - JInternalFrame frame = new JInternalFrame(); + frame = new JInternalFrame(); frame.setContentPane(this); Desktop.addInternalFrame(frame, title, width, height); + frame.setClosable(false); this.title = title; setInfoText(info); @@ -227,10 +229,23 @@ public class WebserviceInfo extends GWebserviceInfo } else { + frame.setClosable(true); thisService.cancelJob(); } } + public void setResultsReady() + { + frame.setClosable(true); + buttonPanel.remove(cancel); + buttonPanel.add(showResultsNewFrame); + buttonPanel.add(mergeResults); + buttonPanel.setLayout(new GridLayout(2,1,5,5)); + buttonPanel.validate(); + validate(); + } + + class AnimatedPanel extends JPanel implements Runnable { long startTime = 0; diff --git a/src/jalview/jbgui/GWebserviceInfo.java b/src/jalview/jbgui/GWebserviceInfo.java index 6f8bbd7..e5a163c 100755 --- a/src/jalview/jbgui/GWebserviceInfo.java +++ b/src/jalview/jbgui/GWebserviceInfo.java @@ -1,20 +1,20 @@ -/* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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. -* -* 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 - A Sequence Alignment Editor and Viewer +* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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. +* +* 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 */ package jalview.jbgui; @@ -23,7 +23,6 @@ import java.awt.event.*; import javax.swing.*; - /** * DOCUMENT ME! * @@ -41,11 +40,12 @@ public class GWebserviceInfo extends JPanel BorderLayout borderLayout2 = new BorderLayout(); protected JPanel titlePanel = new JPanel(); BorderLayout borderLayout3 = new BorderLayout(); - JPanel jPanel2 = new JPanel(); - protected JButton cancel = new JButton(); + protected JPanel buttonPanel = new JPanel(); + public JButton cancel = new JButton(); + public JButton showResultsNewFrame = new JButton(); + public JButton mergeResults = new JButton(); GridBagLayout gridBagLayout1 = new GridBagLayout(); - - /** + /** * Creates a new GWebserviceInfo object. */ public GWebserviceInfo() @@ -96,20 +96,22 @@ public class GWebserviceInfo extends JPanel cancel_actionPerformed(e); } }); - jPanel2.setLayout(gridBagLayout1); - jPanel2.setOpaque(false); - this.add(jScrollPane2, BorderLayout.CENTER); + buttonPanel.setLayout(gridBagLayout1); + buttonPanel.setOpaque(false); + showResultsNewFrame.setText("New Frame"); + mergeResults.setText("Merge Results"); + this.add(jScrollPane2, BorderLayout.CENTER); this.add(jPanel1, BorderLayout.NORTH); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(infoText, null); jScrollPane2.getViewport().add(progressText, null); jPanel1.add(titlePanel, BorderLayout.NORTH); - titlePanel.add(jPanel2, BorderLayout.EAST); - jPanel2.add(cancel, - new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, - GridBagConstraints.SOUTH, GridBagConstraints.NONE, - new Insets(24, 5, 21, 5), 0, 0)); - } + titlePanel.add(buttonPanel, BorderLayout.EAST); + buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + , GridBagConstraints.CENTER, + GridBagConstraints.NONE, + new Insets(19, 6, 16, 4), 0, 0)); + } /** * DOCUMENT ME! diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 7d65ceb..999fc96 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -279,6 +279,21 @@ public class MsaWSClient if (result.isFinished()) { wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); + wsInfo.showResultsNewFrame.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(java.awt.event.ActionEvent evt) + { + displayResults(true); + } + }); + wsInfo.mergeResults.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(java.awt.event.ActionEvent evt) + { + displayResults(false); + } + }); + wsInfo.setResultsReady(); parseResult(); jobComplete = true; jobsRunning--; @@ -430,7 +445,6 @@ public class MsaWSClient void parseResult() { - SequenceI[] seqs = null; try { @@ -456,45 +470,62 @@ public class MsaWSClient OutputHeader += (lines[line] + "\n"); } - // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data - seqs = getVamsasAlignment(result.getMsa()); + // JBPNote The returned files from a webservice could be + // hidden behind icons in the monitor window that, + // when clicked, pop up their corresponding data } wsInfo.setProgressText(OutputHeader); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } - if (seqs != null) - { - AlignmentOrder msaorder = new AlignmentOrder(seqs); + void displayResults(boolean newFrame) + { + SequenceI [] seqs = getVamsasAlignment(result.getMsa()); - if (preserveOrder) - { - jalview.analysis.AlignmentSorter.recoverOrder(seqs); - } + if (seqs != null) + { + AlignmentOrder msaorder = new AlignmentOrder(seqs); - jalview.analysis.SeqsetUtils.deuniquify(SeqNames, seqs); + if (preserveOrder) + { + jalview.analysis.AlignmentSorter.recoverOrder(seqs); + } - Alignment al = new Alignment(seqs); - if (dataset!=null) { - al.setDataset(dataset); - } - // TODO: JBPNote Should also rename the query sequence sometime... - AlignFrame af = new AlignFrame(al); + jalview.analysis.SeqsetUtils.deuniquify(SeqNames, seqs); - //>>>This is a fix for the moment, until a better solution is found!!<<< - af.getFeatureRenderer().transferSettings(alignFrame.getFeatureRenderer()); + Alignment al = new Alignment(seqs); + if (dataset!=null) + { + al.setDataset(dataset); + } - af.addSortByOrderMenuItem(ServiceName + " Ordering", - msaorder); + if(newFrame) + { + // TODO: JBPNote Should also rename the query sequence sometime... + AlignFrame af = new AlignFrame(al); - Desktop.addInternalFrame(af, alTitle, - AlignFrame.NEW_WINDOW_WIDTH, - AlignFrame.NEW_WINDOW_HEIGHT); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } + //>>>This is a fix for the moment, until a better solution is found!!<<< + af.getFeatureRenderer().transferSettings(alignFrame.getFeatureRenderer()); + + af.addSortByOrderMenuItem(ServiceName + " Ordering", + msaorder); + + Desktop.addInternalFrame(af, alTitle, + AlignFrame.NEW_WINDOW_WIDTH, + AlignFrame.NEW_WINDOW_HEIGHT); + + } + else + { + System.out.println("MERGE WITH OLD FRAME"); + + } + } } } } -- 1.7.10.2