2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Softwarechang
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 import java.awt.datatransfer.*;
27 import java.awt.event.*;
28 import java.awt.print.*;
31 import jalview.analysis.*;
32 import jalview.datamodel.*;
34 import jalview.jbgui.*;
35 import jalview.schemes.*;
36 import jalview.commands.*;
38 import java.awt.dnd.*;
46 public class AlignFrame extends GAlignFrame implements DropTargetListener
49 public static final int DEFAULT_WIDTH = 700;
52 public static final int DEFAULT_HEIGHT = 500;
53 public AlignmentPanel alignPanel;
55 AlignViewport viewport;
57 Vector alignPanels = new Vector();
61 public String currentFileFormat = null;
63 public String fileName = null;
65 private int treeCount = 0;
68 * Creates a new AlignFrame object.
70 * @param al DOCUMENT ME!
72 public AlignFrame(AlignmentI al, int width, int height)
74 this(al, null, width, height);
79 * new alignment window with hidden columns
80 * @param al AlignmentI
81 * @param hiddenColumns ColumnSelection or null
83 public AlignFrame(AlignmentI al, ColumnSelection hiddenColumns,
84 int width, int height)
86 this.setSize(width, height);
87 viewport = new AlignViewport(al, hiddenColumns);
89 alignPanel = new AlignmentPanel(this, viewport);
91 if(al.getDataset()==null)
96 addAlignmentPanel(alignPanel, true);
101 * Make a new AlignFrame from exisiting alignmentPanels
102 * @param ap AlignmentPanel
103 * @param av AlignViewport
105 public AlignFrame(AlignmentPanel ap)
109 addAlignmentPanel(ap, false);
115 this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
117 if (viewport.conservation == null)
119 BLOSUM62Colour.setEnabled(false);
120 conservationMenuItem.setEnabled(false);
121 modifyConservation.setEnabled(false);
122 // PIDColour.setEnabled(false);
123 // abovePIDThreshold.setEnabled(false);
124 // modifyPID.setEnabled(false);
127 String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", "No sort");
129 if (sortby.equals("Id"))
130 sortIDMenuItem_actionPerformed(null);
131 else if (sortby.equals("Pairwise Identity"))
132 sortPairwiseMenuItem_actionPerformed(null);
134 if (Desktop.desktop != null)
136 addServiceListeners();
137 setGUINucleotide(viewport.alignment.isNucleotide());
140 setMenusFromViewport(viewport);
142 if (viewport.wrapAlignment)
144 wrapMenuItem_actionPerformed(null);
152 void addKeyListener()
154 final AlignFrame af = this;
155 addKeyListener(new KeyAdapter()
157 public void keyPressed(KeyEvent evt)
159 if (viewport.cursorMode
160 && evt.getKeyCode() >= KeyEvent.VK_0
161 && evt.getKeyCode() <= KeyEvent.VK_9)
163 alignPanel.seqPanel.numberPressed(evt.getKeyChar());
166 switch (evt.getKeyCode())
169 if (!evt.isControlDown())
171 AlignmentPanel newap =
172 new Jalview2XML().copyAlignPanel(alignPanel, true);
174 if(viewport.viewName==null)
175 viewport.viewName="View 1";
177 newap.av.historyList = viewport.historyList;
178 newap.av.redoList = viewport.redoList;
179 newap.av.viewName = "View " +
180 (Desktop.getViewCount(viewport.getSequenceSetId())+1);
182 addAlignmentPanel(newap, false);
184 tabbedPane.setSelectedIndex(tabbedPane.getTabCount()-1);
189 Desktop.instance.gatherViews(af);
193 if (!evt.isControlDown())
195 Desktop.instance.explodeViews(af);
200 case 27: // escape key
201 deselectAllSequenceMenuItem_actionPerformed(null);
205 case KeyEvent.VK_DOWN:
206 if (viewport.cursorMode)
208 alignPanel.seqPanel.moveCursor(0, 1);
211 moveSelectedSequences(false);
215 if (viewport.cursorMode)
217 alignPanel.seqPanel.moveCursor(0, -1);
220 moveSelectedSequences(true);
223 case KeyEvent.VK_LEFT:
224 if (viewport.cursorMode)
226 alignPanel.seqPanel.moveCursor( -1, 0);
230 case KeyEvent.VK_RIGHT:
231 if (viewport.cursorMode)
233 alignPanel.seqPanel.moveCursor(1, 0);
237 case KeyEvent.VK_SPACE:
238 if (viewport.cursorMode)
240 alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()
246 case KeyEvent.VK_DELETE:
247 case KeyEvent.VK_BACK_SPACE:
248 if (!viewport.cursorMode)
250 cut_actionPerformed(null);
253 alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()
260 if (viewport.cursorMode)
262 alignPanel.seqPanel.setCursorRow();
266 if (viewport.cursorMode && !evt.isControlDown())
268 alignPanel.seqPanel.setCursorColumn();
272 if (viewport.cursorMode)
274 alignPanel.seqPanel.setCursorPosition();
278 case KeyEvent.VK_ENTER:
279 case KeyEvent.VK_COMMA:
280 if (viewport.cursorMode)
282 alignPanel.seqPanel.setCursorRowAndColumn();
287 if (viewport.cursorMode)
289 alignPanel.seqPanel.setSelectionAreaAtCursor(true);
293 if (viewport.cursorMode)
295 alignPanel.seqPanel.setSelectionAreaAtCursor(false);
300 viewport.cursorMode = !viewport.cursorMode;
301 statusBar.setText("Keyboard editing mode is " +
302 (viewport.cursorMode ? "on" : "off"));
303 if (viewport.cursorMode)
305 alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
306 alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
308 alignPanel.seqPanel.seqCanvas.repaint();
314 ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();
315 java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");
316 javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);
318 javax.help.HelpBroker hb = hs.createHelpBroker();
319 hb.setCurrentID("home");
320 hb.setDisplayed(true);
324 ex.printStackTrace();
330 boolean toggleSeqs = !evt.isControlDown();
331 boolean toggleCols = !evt.isShiftDown();
333 boolean hide = false;
335 SequenceGroup sg = viewport.getSelectionGroup();
338 if (sg != null && sg.getSize(false) != viewport.alignment.getHeight())
340 hideSelSequences_actionPerformed(null);
343 else if (! (toggleCols && viewport.colSel.getSelected().size() > 0))
344 showAllSeqs_actionPerformed(null);
349 if (viewport.colSel.getSelected().size() > 0)
351 hideSelColumns_actionPerformed(null);
353 viewport.selectionGroup = sg;
356 showAllColumns_actionPerformed(null);
360 case KeyEvent.VK_PAGE_UP:
361 if (viewport.wrapAlignment)
362 alignPanel.scrollUp(true);
364 alignPanel.setScrollValues(viewport.startRes,
366 - viewport.endSeq + viewport.startSeq);
368 case KeyEvent.VK_PAGE_DOWN:
369 if (viewport.wrapAlignment)
370 alignPanel.scrollUp(false);
372 alignPanel.setScrollValues(viewport.startRes,
374 + viewport.endSeq - viewport.startSeq);
382 public void addAlignmentPanel(final AlignmentPanel ap,
385 ap.alignFrame = this;
387 alignPanels.addElement(ap);
389 int aSize = alignPanels.size();
391 tabbedPane.setVisible(aSize>1 || ap.av.viewName!=null);
393 if (aSize == 1 && ap.av.viewName==null)
395 this.getContentPane().add(ap, BorderLayout.CENTER);
401 AlignmentPanel first = (AlignmentPanel) alignPanels.firstElement();
402 tabbedPane.addTab(first.av.viewName==null?"Original":first.av.viewName,first);
404 this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
407 tabbedPane.addTab(ap.av.viewName==null?"Original":ap.av.viewName, ap);
409 ap.setVisible(false);
414 ap.av.updateConsensus(ap);
415 ap.av.updateConservation(ap);
420 public AlignViewport getViewport()
425 /* Set up intrinsic listeners for dynamically generated GUI bits. */
426 private void addServiceListeners()
428 final java.beans.PropertyChangeListener thisListener;
429 // Do this once to get current state
430 BuildWebServiceMenu();
431 Desktop.discoverer.addPropertyChangeListener(
432 thisListener = new java.beans.PropertyChangeListener()
434 public void propertyChange(PropertyChangeEvent evt)
436 // System.out.println("Discoverer property change.");
437 if (evt.getPropertyName().equals("services"))
439 // System.out.println("Rebuilding web service menu");
440 BuildWebServiceMenu();
445 addInternalFrameListener(new javax.swing.event.
446 InternalFrameAdapter()
448 public void internalFrameClosed(
449 javax.swing.event.InternalFrameEvent evt)
451 // System.out.println("deregistering discoverer listener");
452 Desktop.discoverer.removePropertyChangeListener(thisListener);
453 closeMenuItem_actionPerformed(null);
459 public void setGUINucleotide(boolean nucleotide)
461 showTranslation.setVisible( nucleotide );
462 conservationMenuItem.setEnabled( !nucleotide );
463 modifyConservation.setEnabled( !nucleotide );
465 //Remember AlignFrame always starts as protein
468 calculateMenu.remove(calculateMenu.getItemCount()-2);
473 * Need to call this method when tabs are selected for multiple views,
474 * or when loading from Jalview2XML.java
475 * @param av AlignViewport
477 void setMenusFromViewport(AlignViewport av)
479 colourTextMenuItem.setSelected(av.showColourText);
480 abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
481 conservationMenuItem.setSelected(av.getConservationSelected());
482 seqLimits.setSelected(av.getShowJVSuffix());
483 renderGapsMenuItem.setSelected(av.renderGaps);
484 wrapMenuItem.setSelected(av.wrapAlignment);
485 annotationPanelMenuItem.setState(av.showAnnotation);
486 viewBoxesMenuItem.setSelected(av.showBoxes);
487 viewTextMenuItem.setSelected(av.showText);
489 setColourSelected(ColourSchemeProperty.
490 getColourName(av.getGlobalColourScheme()));
492 showSeqFeatures.setSelected(av.showSequenceFeatures);
493 hiddenMarkers.setState(av.showHiddenMarkers);
494 applyToAllGroups.setState(av.colourAppliesToAllGroups);
495 smoothFont.setState(av.antiAlias);
501 Hashtable progressBars;
502 public void setProgressBar(String message, long id)
504 if(progressBars == null)
505 progressBars = new Hashtable();
507 JPanel progressPanel;
508 GridLayout layout = (GridLayout) statusPanel.getLayout();
509 if(progressBars.get( new Long(id) )!=null)
511 progressPanel = (JPanel)progressBars.get( new Long(id) );
512 statusPanel.remove(progressPanel);
513 progressBars.remove( progressPanel );
514 progressPanel = null;
516 statusBar.setText(message);
518 layout.setRows(layout.getRows() - 1);
522 progressPanel = new JPanel(new BorderLayout(10, 5));
524 JProgressBar progressBar = new JProgressBar();
525 progressBar.setIndeterminate(true);
527 progressPanel.add(new JLabel(message), BorderLayout.WEST);
528 progressPanel.add(progressBar, BorderLayout.CENTER);
530 layout.setRows(layout.getRows() + 1);
531 statusPanel.add(progressPanel);
533 progressBars.put(new Long(id), progressPanel);
543 Added so Castor Mapping file can obtain Jalview Version
545 public String getVersion()
547 return jalview.bin.Cache.getProperty("VERSION");
550 public FeatureRenderer getFeatureRenderer()
552 return alignPanel.seqPanel.seqCanvas.getFeatureRenderer();
556 public void fetchSequence_actionPerformed(ActionEvent e)
558 new SequenceFetcher(this);
561 public void addFromFile_actionPerformed(ActionEvent e)
563 Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport);
566 public void reload_actionPerformed(ActionEvent e)
570 viewport.alignment.deleteAllGroups();
571 while (viewport.alignment.getHeight() > 0)
573 viewport.alignment.deleteSequence(0);
576 FileLoader loader = new FileLoader();
577 loader.LoadFile(viewport, fileName, "File", currentFileFormat);
583 public void addFromText_actionPerformed(ActionEvent e)
585 Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
588 public void addFromURL_actionPerformed(ActionEvent e)
590 Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
594 public void save_actionPerformed(ActionEvent e)
596 if(fileName==null || currentFileFormat==null)
597 saveAs_actionPerformed(null);
599 saveAlignment(fileName, currentFileFormat);
605 * @param e DOCUMENT ME!
607 public void saveAs_actionPerformed(ActionEvent e)
609 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
610 getProperty( "LAST_DIRECTORY"),
612 { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","jar" },
614 { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
619 chooser.setFileView(new JalviewFileView());
620 chooser.setDialogTitle("Save Alignment to file");
621 chooser.setToolTipText("Save");
623 int value = chooser.showSaveDialog(this);
625 if (value == JalviewFileChooser.APPROVE_OPTION)
627 currentFileFormat = chooser.getSelectedFormat();
628 if (currentFileFormat == null)
630 JOptionPane.showInternalMessageDialog(Desktop.desktop,
631 "You must select a file format before saving!",
632 "File format not specified",
633 JOptionPane.WARNING_MESSAGE);
634 value = chooser.showSaveDialog(this);
638 fileName = chooser.getSelectedFile().getPath();
640 jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",
643 jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName);
645 saveAlignment(fileName, currentFileFormat);
649 public boolean saveAlignment(String file, String format)
651 if (format.equalsIgnoreCase("Jalview"))
653 String shortName = title;
655 if (shortName.indexOf(java.io.File.separatorChar) > -1)
657 shortName = shortName.substring(shortName.lastIndexOf(
658 java.io.File.separatorChar) + 1);
661 new Jalview2XML().SaveAlignment(this, file, shortName);
663 statusBar.setText("Successfully saved to file: "
665 +format +" format.");
668 // USE Jalview2XML to save this file
674 String[] omitHidden = null;
676 if (viewport.hasHiddenColumns)
678 int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
679 "The Alignment contains hidden columns."
680 + "\nDo you want to save only the visible alignment?",
681 "Save / Omit Hidden Columns",
682 JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
684 if (reply == JOptionPane.YES_OPTION)
685 omitHidden = viewport.getViewAsString(false);
688 String output = new FormatAdapter().formatSequences(
690 viewport.alignment.getSequencesArray(),
700 java.io.PrintWriter out = new java.io.PrintWriter(
701 new java.io.FileWriter(file));
706 statusBar.setText("Successfully saved to file: "
708 +format +" format.");
713 ex.printStackTrace();
722 * @param e DOCUMENT ME!
724 protected void outputText_actionPerformed(ActionEvent e)
726 String [] omitHidden = null;
728 if(viewport.hasHiddenColumns)
730 int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
731 "The Alignment contains hidden columns."
732 +"\nDo you want to output only the visible alignment?",
733 "Save / Omit Hidden Columns",
734 JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
736 if(reply==JOptionPane.YES_OPTION)
738 omitHidden = viewport.getViewAsString(false);
742 CutAndPasteTransfer cap = new CutAndPasteTransfer();
743 Desktop.addInternalFrame(cap,
744 "Alignment output - " + e.getActionCommand(), 600,
748 cap.setText(new FormatAdapter().formatSequences(
749 e.getActionCommand(),
750 viewport.alignment.getSequencesArray(),
757 * @param e DOCUMENT ME!
759 protected void htmlMenuItem_actionPerformed(ActionEvent e)
761 new HTMLOutput(viewport,
762 alignPanel.seqPanel.seqCanvas.getSequenceRenderer(),
763 alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
766 public void createImageMap(File file, String image)
768 alignPanel.makePNGImageMap(file, image);
774 * @param e DOCUMENT ME!
776 public void createPNG(File f)
778 alignPanel.makePNG(f);
784 * @param e DOCUMENT ME!
786 public void createEPS(File f)
788 alignPanel.makeEPS(f);
794 * @param e DOCUMENT ME!
796 public void printMenuItem_actionPerformed(ActionEvent e)
798 //Putting in a thread avoids Swing painting problems
799 PrintThread thread = new PrintThread();
803 public void exportFeatures_actionPerformed(ActionEvent e)
805 new AnnotationExporter().exportFeatures(alignPanel);
809 public void exportAnnotations_actionPerformed(ActionEvent e)
811 new AnnotationExporter().exportAnnotations(
813 viewport.alignment.getAlignmentAnnotation()
818 public void associatedData_actionPerformed(ActionEvent e)
820 // Pick the tree file
821 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
824 chooser.setFileView(new JalviewFileView());
825 chooser.setDialogTitle("Load Jalview Annotations or Features File");
826 chooser.setToolTipText("Load Jalview Annotations / Features file");
828 int value = chooser.showOpenDialog(null);
830 if (value == JalviewFileChooser.APPROVE_OPTION)
832 String choice = chooser.getSelectedFile().getPath();
833 jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
834 loadJalviewDataFile(choice);
843 * @param e DOCUMENT ME!
845 public void closeMenuItem_actionPerformed(ActionEvent e)
849 if(alignPanels!=null)
851 for (int i = 0; i < alignPanels.size(); i++)
853 AlignmentPanel ap = (AlignmentPanel) alignPanels.elementAt(i);
854 PaintRefresher.RemoveComponent(ap.seqPanel.seqCanvas);
855 PaintRefresher.RemoveComponent(ap.idPanel.idCanvas);
856 PaintRefresher.RemoveComponent(ap);
858 // alignPanels = null;
861 // System.out.println("null one here");
863 // alignPanel = null;
866 this.setClosed(true);
870 ex.printStackTrace();
878 void updateEditMenuBar()
881 if (viewport.historyList.size() > 0)
883 undoMenuItem.setEnabled(true);
884 CommandI command = (CommandI) viewport.historyList.peek();
885 undoMenuItem.setText("Undo " + command.getDescription());
889 undoMenuItem.setEnabled(false);
890 undoMenuItem.setText("Undo");
893 if (viewport.redoList.size() > 0)
895 redoMenuItem.setEnabled(true);
897 CommandI command = (CommandI) viewport.redoList.peek();
898 redoMenuItem.setText("Redo " + command.getDescription());
902 redoMenuItem.setEnabled(false);
903 redoMenuItem.setText("Redo");
908 public void addHistoryItem(CommandI command)
910 if(command.getSize()>0)
912 viewport.historyList.push(command);
913 viewport.redoList.clear();
915 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
924 * @param e DOCUMENT ME!
926 protected void undoMenuItem_actionPerformed(ActionEvent e)
928 CommandI command = (CommandI)viewport.historyList.pop();
929 viewport.redoList.push(command);
930 command.undoCommand();
932 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
934 viewport.firePropertyChange("alignment", null,
935 viewport.getAlignment().getSequences());
941 * @param e DOCUMENT ME!
943 protected void redoMenuItem_actionPerformed(ActionEvent e)
945 CommandI command = (CommandI) viewport.redoList.pop();
946 viewport.historyList.push(command);
948 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null;
951 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
958 * @param up DOCUMENT ME!
960 public void moveSelectedSequences(boolean up)
962 SequenceGroup sg = viewport.getSelectionGroup();
971 for (int i = 1; i < viewport.alignment.getHeight(); i++)
973 SequenceI seq = viewport.alignment.getSequenceAt(i);
975 if (!sg.getSequences(false).contains(seq))
980 SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
982 if (sg.getSequences(false).contains(temp))
987 viewport.alignment.getSequences().setElementAt(temp, i);
988 viewport.alignment.getSequences().setElementAt(seq, i - 1);
993 for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
995 SequenceI seq = viewport.alignment.getSequenceAt(i);
997 if (!sg.getSequences(false).contains(seq))
1002 SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
1004 if (sg.getSequences(false).contains(temp))
1009 viewport.alignment.getSequences().setElementAt(temp, i);
1010 viewport.alignment.getSequences().setElementAt(seq, i + 1);
1014 alignPanel.repaint();
1022 * @param e DOCUMENT ME!
1024 protected void copy_actionPerformed(ActionEvent e)
1027 if (viewport.getSelectionGroup() == null)
1032 SequenceI [] seqs = viewport.getSelectionAsNewSequence();
1033 String[] omitHidden = null;
1035 if (viewport.hasHiddenColumns)
1037 omitHidden = viewport.getViewAsString(true);
1040 String output = new FormatAdapter().formatSequences(
1045 StringSelection ss = new StringSelection(output);
1049 //Its really worth setting the clipboard contents
1050 //to empty before setting the large StringSelection!!
1051 Toolkit.getDefaultToolkit().getSystemClipboard()
1052 .setContents(new StringSelection(""), null);
1054 Toolkit.getDefaultToolkit().getSystemClipboard()
1055 .setContents(ss, Desktop.instance);
1057 catch (OutOfMemoryError er)
1059 er.printStackTrace();
1060 javax.swing.SwingUtilities.invokeLater(new Runnable()
1064 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
1065 "Out of memory copying region!!"
1067 "\nSee help files for increasing Java Virtual Machine memory."
1069 javax.swing.JOptionPane.WARNING_MESSAGE);
1076 Vector hiddenColumns = null;
1077 if(viewport.hasHiddenColumns)
1079 hiddenColumns =new Vector();
1080 int hiddenOffset = viewport.getSelectionGroup().getStartRes();
1081 for(int i=0; i<viewport.getColumnSelection().getHiddenColumns().size(); i++)
1083 int[] region = (int[])
1084 viewport.getColumnSelection().getHiddenColumns().elementAt(i);
1086 hiddenColumns.addElement(new int[]{region[0]-hiddenOffset,
1087 region[1]-hiddenOffset});
1093 Desktop.jalviewClipboard = new Object[]{ seqs,
1094 viewport.alignment.getDataset(),
1096 statusBar.setText("Copied "+seqs.length+" sequences to clipboard.");
1102 * @param e DOCUMENT ME!
1104 protected void pasteNew_actionPerformed(ActionEvent e)
1112 * @param e DOCUMENT ME!
1114 protected void pasteThis_actionPerformed(ActionEvent e)
1122 * @param newAlignment DOCUMENT ME!
1124 void paste(boolean newAlignment)
1128 Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
1129 Transferable contents = c.getContents(this);
1131 if (contents == null)
1139 str = (String) contents.getTransferData(DataFlavor.stringFlavor);
1140 if (str.length() < 1)
1143 format = new IdentifyFile().Identify(str, "Paste");
1146 catch (OutOfMemoryError er)
1148 er.printStackTrace();
1149 javax.swing.SwingUtilities.invokeLater(new Runnable()
1153 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
1154 "Out of memory pasting sequences!!"
1156 "\nSee help files for increasing Java Virtual Machine memory."
1158 javax.swing.JOptionPane.WARNING_MESSAGE);
1165 SequenceI[] sequences;
1168 if(Desktop.jalviewClipboard!=null)
1170 // The clipboard was filled from within Jalview, we must use the sequences
1171 // And dataset from the copied alignment
1172 sequences = (SequenceI[])Desktop.jalviewClipboard[0];
1176 sequences = new FormatAdapter().readFile(str, "Paste", format);
1179 AlignmentI alignment = null;
1183 alignment = new Alignment(sequences);
1185 if (Desktop.jalviewClipboard != null)
1186 alignment.setDataset( (Alignment) Desktop.jalviewClipboard[1]);
1188 alignment.setDataset(null);
1192 alignment = viewport.getAlignment();
1195 SequenceI [] newseqs = new SequenceI[sequences.length];
1196 for (int i = 0; i < sequences.length; i++)
1198 newseqs[i] = new Sequence(sequences[i].getName(),
1199 sequences[i].getSequence(), sequences[i].getStart(),
1200 sequences[i].getEnd());
1202 alignment.addSequence(newseqs[i]);
1208 addHistoryItem(new EditCommand(
1213 alignment.getWidth(),
1218 viewport.setEndSeq(alignment.getHeight());
1219 alignment.getWidth();
1220 viewport.firePropertyChange("alignment", null, alignment.getSequences());
1225 // Add any annotations attached to sequences
1226 for (int i = 0; i < sequences.length; i++)
1228 if (sequences[i].getAnnotation() != null)
1230 for (int a = 0; a < sequences[i].getAnnotation().length; a++)
1232 AlignmentAnnotation newAnnot =
1233 new AlignmentAnnotation(
1234 sequences[i].getAnnotation()[a].label,
1235 sequences[i].getAnnotation()[a].description,
1236 sequences[i].getAnnotation()[a].annotations,
1237 sequences[i].getAnnotation()[a].graphMin,
1238 sequences[i].getAnnotation()[a].graphMax,
1239 sequences[i].getAnnotation()[a].graph);
1241 sequences[i].getAnnotation()[a] = newAnnot;
1242 newAnnot.sequenceMapping = sequences[i].getAnnotation()[a].
1244 newAnnot.sequenceRef = sequences[i];
1245 newAnnot.adjustForAlignment();
1246 alignment.addAnnotation(newAnnot);
1247 alignment.setAnnotationIndex(newAnnot, a);
1250 alignPanel.annotationPanel.adjustPanelHeight();
1256 AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT);
1257 String newtitle = new String("Copied sequences");
1259 if(Desktop.jalviewClipboard!=null && Desktop.jalviewClipboard[2]!=null)
1261 Vector hc = (Vector)Desktop.jalviewClipboard[2];
1262 for(int i=0; i<hc.size(); i++)
1264 int [] region = (int[]) hc.elementAt(i);
1265 af.viewport.hideColumns(region[0], region[1]);
1270 //>>>This is a fix for the moment, until a better solution is found!!<<<
1271 af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(
1272 alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
1275 if (title.startsWith("Copied sequences"))
1281 newtitle = newtitle.concat("- from " + title);
1284 Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH,
1291 catch (Exception ex)
1293 ex.printStackTrace();
1294 System.out.println("Exception whilst pasting: "+ex);
1295 // could be anything being pasted in here
1304 * @param e DOCUMENT ME!
1306 protected void cut_actionPerformed(ActionEvent e)
1308 copy_actionPerformed(null);
1309 delete_actionPerformed(null);
1315 * @param e DOCUMENT ME!
1317 protected void delete_actionPerformed(ActionEvent evt)
1320 SequenceGroup sg = viewport.getSelectionGroup();
1326 Vector seqs = new Vector();
1327 int cutLength = sg.getEndRes()-sg.getStartRes()+1;
1328 boolean seqsCut = false;
1330 for (int i = 0; i < sg.getSize(false); i++)
1332 seq = sg.getSequenceAt(i);
1333 seqs.addElement(seq);
1334 if(seq.getLength()<=cutLength)
1339 // If the cut affects all sequences, remove highlighted columns
1340 if (sg.getSize(false) == viewport.alignment.getHeight())
1342 viewport.getColumnSelection().removeElements(sg.getStartRes(),
1343 sg.getEndRes() + 1);
1347 SequenceI [] cut = new SequenceI[seqs.size()];
1348 for(int i=0; i<seqs.size(); i++)
1349 cut[i] = (SequenceI)seqs.elementAt(i);
1355 addHistoryItem(new EditCommand("Cut Sequences",
1359 sg.getEndRes()-sg.getStartRes()+1,
1360 viewport.alignment));
1363 viewport.setSelectionGroup(null);
1364 viewport.alignment.deleteGroup(sg);
1366 viewport.firePropertyChange("alignment", null,
1367 viewport.getAlignment().getSequences());
1369 if (viewport.getAlignment().getHeight() < 1)
1373 this.setClosed(true);
1375 catch (Exception ex)
1384 * @param e DOCUMENT ME!
1386 protected void deleteGroups_actionPerformed(ActionEvent e)
1388 viewport.alignment.deleteAllGroups();
1389 viewport.setSelectionGroup(null);
1390 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1391 alignPanel.repaint();
1397 * @param e DOCUMENT ME!
1399 public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
1401 SequenceGroup sg = new SequenceGroup();
1403 for (int i = 0; i < viewport.getAlignment().getSequences().size();
1406 sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
1409 sg.setEndRes(viewport.alignment.getWidth() - 1);
1410 viewport.setSelectionGroup(sg);
1411 alignPanel.repaint();
1412 PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
1418 * @param e DOCUMENT ME!
1420 public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
1422 if(viewport.cursorMode)
1424 alignPanel.seqPanel.keyboardNo1 = null;
1425 alignPanel.seqPanel.keyboardNo2 = null;
1427 viewport.setSelectionGroup(null);
1428 viewport.getColumnSelection().clear();
1429 viewport.setSelectionGroup(null);
1430 alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
1431 alignPanel.idPanel.idCanvas.searchResults = null;
1432 alignPanel.repaint();
1433 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1439 * @param e DOCUMENT ME!
1441 public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
1443 SequenceGroup sg = viewport.getSelectionGroup();
1447 selectAllSequenceMenuItem_actionPerformed(null);
1452 for (int i = 0; i < viewport.getAlignment().getSequences().size();
1455 sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
1458 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1461 public void invertColSel_actionPerformed(ActionEvent e)
1463 viewport.invertColumnSelection();
1464 alignPanel.repaint();
1471 * @param e DOCUMENT ME!
1473 public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
1475 trimAlignment(true);
1481 * @param e DOCUMENT ME!
1483 public void remove2RightMenuItem_actionPerformed(ActionEvent e)
1485 trimAlignment(false);
1488 void trimAlignment(boolean trimLeft)
1490 ColumnSelection colSel = viewport.getColumnSelection();
1493 if (colSel.size() > 0)
1496 column = colSel.getMin();
1498 column = colSel.getMax();
1501 if(viewport.getSelectionGroup()!=null)
1502 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1504 seqs = viewport.alignment.getSequencesArray();
1507 TrimRegionCommand trimRegion;
1510 trimRegion = new TrimRegionCommand("Remove Left",
1511 TrimRegionCommand.TRIM_LEFT,
1516 viewport.selectionGroup);
1520 trimRegion = new TrimRegionCommand("Remove Right",
1521 TrimRegionCommand.TRIM_RIGHT,
1526 viewport.selectionGroup);
1529 statusBar.setText("Removed "+trimRegion.getSize()+" columns.");
1532 addHistoryItem(trimRegion);
1534 Vector groups = viewport.alignment.getGroups();
1536 for (int i = 0; i < groups.size(); i++)
1538 SequenceGroup sg = (SequenceGroup) groups.get(i);
1540 if ( (trimLeft && !sg.adjustForRemoveLeft(column))
1541 || (!trimLeft && !sg.adjustForRemoveRight(column)))
1543 viewport.alignment.deleteGroup(sg);
1547 viewport.firePropertyChange("alignment", null,
1548 viewport.getAlignment().getSequences());
1555 * @param e DOCUMENT ME!
1557 public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
1559 int start = 0, end = viewport.alignment.getWidth()-1;
1562 if (viewport.getSelectionGroup() != null)
1564 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1565 start = viewport.getSelectionGroup().getStartRes();
1566 end = viewport.getSelectionGroup().getEndRes();
1569 seqs = viewport.alignment.getSequencesArray();
1572 RemoveGapColCommand removeGapCols =
1573 new RemoveGapColCommand("Remove Gapped Columns",
1576 viewport.getGapCharacter());
1578 addHistoryItem(removeGapCols);
1580 statusBar.setText("Removed "+removeGapCols.getSize()+" empty columns.");
1582 //This is to maintain viewport position on first residue
1584 SequenceI seq = viewport.alignment.getSequenceAt(0);
1585 int startRes = seq.findPosition(viewport.startRes);
1586 // ShiftList shifts;
1587 // viewport.getAlignment().removeGaps(shifts=new ShiftList());
1588 // edit.alColumnChanges=shifts.getInverse();
1589 // if (viewport.hasHiddenColumns)
1590 // viewport.getColumnSelection().compensateForEdits(shifts);
1591 viewport.setStartRes(seq.findIndex(startRes)-1);
1592 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
1599 * @param e DOCUMENT ME!
1601 public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
1603 int start = 0, end = viewport.alignment.getWidth()-1;
1606 if (viewport.getSelectionGroup() != null)
1608 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1609 start = viewport.getSelectionGroup().getStartRes();
1610 end = viewport.getSelectionGroup().getEndRes();
1613 seqs = viewport.alignment.getSequencesArray();
1615 //This is to maintain viewport position on first residue
1617 SequenceI seq = viewport.alignment.getSequenceAt(0);
1618 int startRes = seq.findPosition(viewport.startRes);
1620 addHistoryItem(new RemoveGapsCommand("Remove Gaps",
1623 viewport.getGapCharacter()));
1625 viewport.setStartRes(seq.findIndex(startRes)-1);
1627 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
1634 * @param e DOCUMENT ME!
1636 public void padGapsMenuitem_actionPerformed(ActionEvent e)
1638 viewport.padGaps = padGapsMenuitem.isSelected();
1640 viewport.firePropertyChange("alignment",
1642 viewport.getAlignment().getSequences());
1648 * @param e DOCUMENT ME!
1650 public void findMenuItem_actionPerformed(ActionEvent e)
1652 JInternalFrame frame = new JInternalFrame();
1653 Finder finder = new Finder(viewport, alignPanel, frame);
1654 frame.setContentPane(finder);
1655 frame.setLayer(JLayeredPane.PALETTE_LAYER);
1656 Desktop.addInternalFrame(frame, "Find", 340, 110);
1662 * @param e DOCUMENT ME!
1664 public void font_actionPerformed(ActionEvent e)
1666 new FontChooser(alignPanel);
1669 public void smoothFont_actionPerformed(ActionEvent e)
1671 viewport.antiAlias = smoothFont.isSelected();
1672 alignPanel.annotationPanel.image = null;
1673 alignPanel.repaint();
1680 * @param e DOCUMENT ME!
1682 protected void seqLimit_actionPerformed(ActionEvent e)
1684 viewport.setShowJVSuffix(seqLimits.isSelected());
1686 alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());
1687 alignPanel.repaint();
1694 * @param e DOCUMENT ME!
1696 protected void colourTextMenuItem_actionPerformed(ActionEvent e)
1698 viewport.setColourText(colourTextMenuItem.isSelected());
1699 alignPanel.repaint();
1705 * @param e DOCUMENT ME!
1707 public void wrapMenuItem_actionPerformed(ActionEvent e)
1709 scaleAbove.setVisible(wrapMenuItem.isSelected());
1710 scaleLeft.setVisible(wrapMenuItem.isSelected());
1711 scaleRight.setVisible(wrapMenuItem.isSelected());
1712 viewport.setWrapAlignment(wrapMenuItem.isSelected());
1713 alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
1716 public void showAllSeqs_actionPerformed(ActionEvent e)
1718 viewport.showAllHiddenSeqs();
1721 public void showAllColumns_actionPerformed(ActionEvent e)
1723 viewport.showAllHiddenColumns();
1727 public void hideSelSequences_actionPerformed(ActionEvent e)
1729 viewport.hideAllSelectedSeqs();
1730 alignPanel.repaint();
1733 public void hideSelColumns_actionPerformed(ActionEvent e)
1735 viewport.hideSelectedColumns();
1736 alignPanel.repaint();
1739 public void hiddenMarkers_actionPerformed(ActionEvent e)
1741 viewport.setShowHiddenMarkers(hiddenMarkers.isSelected());
1748 * @param e DOCUMENT ME!
1750 protected void scaleAbove_actionPerformed(ActionEvent e)
1752 viewport.setScaleAboveWrapped(scaleAbove.isSelected());
1753 alignPanel.repaint();
1759 * @param e DOCUMENT ME!
1761 protected void scaleLeft_actionPerformed(ActionEvent e)
1763 viewport.setScaleLeftWrapped(scaleLeft.isSelected());
1764 alignPanel.repaint();
1770 * @param e DOCUMENT ME!
1772 protected void scaleRight_actionPerformed(ActionEvent e)
1774 viewport.setScaleRightWrapped(scaleRight.isSelected());
1775 alignPanel.repaint();
1781 * @param e DOCUMENT ME!
1783 public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
1785 viewport.setShowBoxes(viewBoxesMenuItem.isSelected());
1786 alignPanel.repaint();
1792 * @param e DOCUMENT ME!
1794 public void viewTextMenuItem_actionPerformed(ActionEvent e)
1796 viewport.setShowText(viewTextMenuItem.isSelected());
1797 alignPanel.repaint();
1803 * @param e DOCUMENT ME!
1805 protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
1807 viewport.setRenderGaps(renderGapsMenuItem.isSelected());
1808 alignPanel.repaint();
1812 public FeatureSettings featureSettings;
1813 public void featureSettings_actionPerformed(ActionEvent e)
1815 if(featureSettings !=null )
1817 featureSettings.close();
1818 featureSettings = null;
1820 featureSettings = new FeatureSettings(this);
1826 * @param evt DOCUMENT ME!
1828 public void showSeqFeatures_actionPerformed(ActionEvent evt)
1830 viewport.setShowSequenceFeatures(showSeqFeatures.isSelected());
1831 alignPanel.repaint();
1832 if (alignPanel.getOverviewPanel() != null)
1834 alignPanel.getOverviewPanel().updateOverviewImage();
1841 * @param e DOCUMENT ME!
1843 public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
1845 viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());
1846 alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
1852 * @param e DOCUMENT ME!
1854 public void overviewMenuItem_actionPerformed(ActionEvent e)
1856 if (alignPanel.overviewPanel != null)
1861 JInternalFrame frame = new JInternalFrame();
1862 OverviewPanel overview = new OverviewPanel(alignPanel);
1863 frame.setContentPane(overview);
1864 Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),
1865 frame.getWidth(), frame.getHeight());
1867 frame.setLayer(JLayeredPane.PALETTE_LAYER);
1868 frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
1870 public void internalFrameClosed(
1871 javax.swing.event.InternalFrameEvent evt)
1873 alignPanel.setOverviewPanel(null);
1878 alignPanel.setOverviewPanel(overview);
1884 * @param e DOCUMENT ME!
1886 protected void noColourmenuItem_actionPerformed(ActionEvent e)
1894 * @param e DOCUMENT ME!
1896 public void clustalColour_actionPerformed(ActionEvent e)
1898 changeColour(new ClustalxColourScheme(
1899 viewport.alignment.getSequences(), viewport.alignment.getWidth()));
1905 * @param e DOCUMENT ME!
1907 public void zappoColour_actionPerformed(ActionEvent e)
1909 changeColour(new ZappoColourScheme());
1915 * @param e DOCUMENT ME!
1917 public void taylorColour_actionPerformed(ActionEvent e)
1919 changeColour(new TaylorColourScheme());
1925 * @param e DOCUMENT ME!
1927 public void hydrophobicityColour_actionPerformed(ActionEvent e)
1929 changeColour(new HydrophobicColourScheme());
1935 * @param e DOCUMENT ME!
1937 public void helixColour_actionPerformed(ActionEvent e)
1939 changeColour(new HelixColourScheme());
1945 * @param e DOCUMENT ME!
1947 public void strandColour_actionPerformed(ActionEvent e)
1949 changeColour(new StrandColourScheme());
1955 * @param e DOCUMENT ME!
1957 public void turnColour_actionPerformed(ActionEvent e)
1959 changeColour(new TurnColourScheme());
1965 * @param e DOCUMENT ME!
1967 public void buriedColour_actionPerformed(ActionEvent e)
1969 changeColour(new BuriedColourScheme());
1975 * @param e DOCUMENT ME!
1977 public void nucleotideColour_actionPerformed(ActionEvent e)
1979 changeColour(new NucleotideColourScheme());
1982 public void annotationColour_actionPerformed(ActionEvent e)
1984 new AnnotationColourChooser(viewport, alignPanel);
1991 * @param e DOCUMENT ME!
1993 protected void applyToAllGroups_actionPerformed(ActionEvent e)
1995 viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
2001 * @param cs DOCUMENT ME!
2003 public void changeColour(ColourSchemeI cs)
2009 if (viewport.getAbovePIDThreshold())
2011 threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
2014 cs.setThreshold(threshold,
2015 viewport.getIgnoreGapsConsensus());
2017 viewport.setGlobalColourScheme(cs);
2021 cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
2024 if (viewport.getConservationSelected())
2027 Alignment al = (Alignment) viewport.alignment;
2028 Conservation c = new Conservation("All",
2029 ResidueProperties.propHash, 3,
2030 al.getSequences(), 0,
2034 c.verdict(false, viewport.ConsPercGaps);
2036 cs.setConservation(c);
2038 cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel, cs,
2043 cs.setConservation(null);
2046 cs.setConsensus(viewport.hconsensus);
2049 viewport.setGlobalColourScheme(cs);
2051 if (viewport.getColourAppliesToAllGroups())
2053 Vector groups = viewport.alignment.getGroups();
2055 for (int i = 0; i < groups.size(); i++)
2057 SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
2065 if (cs instanceof ClustalxColourScheme)
2067 sg.cs = new ClustalxColourScheme(
2068 sg.getSequences(true), sg.getWidth());
2070 else if (cs instanceof UserColourScheme)
2072 sg.cs = new UserColourScheme( ( (UserColourScheme) cs).getColours());
2078 sg.cs = (ColourSchemeI) cs.getClass().newInstance();
2080 catch (Exception ex)
2085 if (viewport.getAbovePIDThreshold()
2086 || cs instanceof PIDColourScheme
2087 || cs instanceof Blosum62ColourScheme)
2089 sg.cs.setThreshold(threshold,
2090 viewport.getIgnoreGapsConsensus());
2092 sg.cs.setConsensus(AAFrequency.calculate(
2093 sg.getSequences(true), sg.getStartRes(),
2097 sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
2100 if (viewport.getConservationSelected())
2102 Conservation c = new Conservation("Group",
2103 ResidueProperties.propHash, 3,
2104 sg.getSequences(true),
2108 c.verdict(false, viewport.ConsPercGaps);
2109 sg.cs.setConservation(c);
2112 sg.cs.setConservation(null);
2116 if (alignPanel.getOverviewPanel() != null)
2118 alignPanel.getOverviewPanel().updateOverviewImage();
2121 alignPanel.repaint();
2127 * @param e DOCUMENT ME!
2129 protected void modifyPID_actionPerformed(ActionEvent e)
2131 if (viewport.getAbovePIDThreshold() && viewport.globalColourScheme!=null)
2133 SliderPanel.setPIDSliderSource(alignPanel,
2134 viewport.getGlobalColourScheme(),
2136 SliderPanel.showPIDSlider();
2143 * @param e DOCUMENT ME!
2145 protected void modifyConservation_actionPerformed(ActionEvent e)
2147 if (viewport.getConservationSelected() && viewport.globalColourScheme!=null)
2149 SliderPanel.setConservationSlider(alignPanel,
2150 viewport.globalColourScheme,
2152 SliderPanel.showConservationSlider();
2159 * @param e DOCUMENT ME!
2161 protected void conservationMenuItem_actionPerformed(ActionEvent e)
2163 viewport.setConservationSelected(conservationMenuItem.isSelected());
2165 viewport.setAbovePIDThreshold(false);
2166 abovePIDThreshold.setSelected(false);
2168 changeColour(viewport.getGlobalColourScheme());
2170 modifyConservation_actionPerformed(null);
2176 * @param e DOCUMENT ME!
2178 public void abovePIDThreshold_actionPerformed(ActionEvent e)
2180 viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
2182 conservationMenuItem.setSelected(false);
2183 viewport.setConservationSelected(false);
2185 changeColour(viewport.getGlobalColourScheme());
2187 modifyPID_actionPerformed(null);
2193 * @param e DOCUMENT ME!
2195 public void userDefinedColour_actionPerformed(ActionEvent e)
2197 if (e.getActionCommand().equals("User Defined..."))
2199 new UserDefinedColours(alignPanel, null);
2203 UserColourScheme udc = (UserColourScheme) UserDefinedColours.
2204 getUserColourSchemes().get(e.getActionCommand());
2210 public void updateUserColourMenu()
2213 Component[] menuItems = colourMenu.getMenuComponents();
2214 int i, iSize = menuItems.length;
2215 for (i = 0; i < iSize; i++)
2217 if (menuItems[i].getName() != null &&
2218 menuItems[i].getName().equals("USER_DEFINED"))
2220 colourMenu.remove(menuItems[i]);
2224 if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
2226 java.util.Enumeration userColours = jalview.gui.UserDefinedColours.
2227 getUserColourSchemes().keys();
2229 while (userColours.hasMoreElements())
2231 final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(userColours.
2232 nextElement().toString());
2233 radioItem.setName("USER_DEFINED");
2234 radioItem.addMouseListener(new MouseAdapter()
2236 public void mousePressed(MouseEvent evt)
2238 if(evt.isControlDown() || SwingUtilities.isRightMouseButton(evt))
2240 radioItem.removeActionListener(radioItem.getActionListeners()[0]);
2242 int option = JOptionPane.showInternalConfirmDialog(jalview.gui.Desktop.desktop,
2243 "Remove from default list?",
2244 "Remove user defined colour",
2245 JOptionPane.YES_NO_OPTION);
2246 if(option == JOptionPane.YES_OPTION)
2248 jalview.gui.UserDefinedColours.removeColourFromDefaults(radioItem.getText());
2249 colourMenu.remove(radioItem);
2252 radioItem.addActionListener(new ActionListener()
2254 public void actionPerformed(ActionEvent evt)
2256 userDefinedColour_actionPerformed(evt);
2262 radioItem.addActionListener(new ActionListener()
2264 public void actionPerformed(ActionEvent evt)
2266 userDefinedColour_actionPerformed(evt);
2270 colourMenu.insert(radioItem, 15);
2271 colours.add(radioItem);
2279 * @param e DOCUMENT ME!
2281 public void PIDColour_actionPerformed(ActionEvent e)
2283 changeColour(new PIDColourScheme());
2289 * @param e DOCUMENT ME!
2291 public void BLOSUM62Colour_actionPerformed(ActionEvent e)
2293 changeColour(new Blosum62ColourScheme());
2299 * @param e DOCUMENT ME!
2301 public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2303 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2304 AlignmentSorter.sortByPID(viewport.getAlignment(),
2305 viewport.getAlignment().getSequenceAt(0));
2306 addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.alignment));
2307 alignPanel.repaint();
2313 * @param e DOCUMENT ME!
2315 public void sortIDMenuItem_actionPerformed(ActionEvent e)
2317 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2318 AlignmentSorter.sortByID(viewport.getAlignment());
2319 addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
2320 alignPanel.repaint();
2326 * @param e DOCUMENT ME!
2328 public void sortGroupMenuItem_actionPerformed(ActionEvent e)
2330 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2331 AlignmentSorter.sortByGroup(viewport.getAlignment());
2332 addHistoryItem(new OrderCommand("Group Sort", oldOrder, viewport.alignment));
2334 alignPanel.repaint();
2340 * @param e DOCUMENT ME!
2342 public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2344 new RedundancyPanel(alignPanel, this);
2351 * @param e DOCUMENT ME!
2353 public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2355 if ( (viewport.getSelectionGroup() == null) ||
2356 (viewport.getSelectionGroup().getSize(false) < 2))
2358 JOptionPane.showInternalMessageDialog(this,
2359 "You must select at least 2 sequences.",
2360 "Invalid Selection",
2361 JOptionPane.WARNING_MESSAGE);
2365 JInternalFrame frame = new JInternalFrame();
2366 frame.setContentPane(new PairwiseAlignPanel(viewport));
2367 Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);
2374 * @param e DOCUMENT ME!
2376 public void PCAMenuItem_actionPerformed(ActionEvent e)
2378 if ( ( (viewport.getSelectionGroup() != null) &&
2379 (viewport.getSelectionGroup().getSize(false) < 4) &&
2380 (viewport.getSelectionGroup().getSize(false) > 0)) ||
2381 (viewport.getAlignment().getHeight() < 4))
2383 JOptionPane.showInternalMessageDialog(this,
2384 "Principal component analysis must take\n" +
2385 "at least 4 input sequences.",
2386 "Sequence selection insufficient",
2387 JOptionPane.WARNING_MESSAGE);
2392 new PCAPanel(viewport);
2396 public void autoCalculate_actionPerformed(ActionEvent e)
2398 viewport.autoCalculateConsensus = autoCalculate.isSelected();
2399 if(viewport.autoCalculateConsensus)
2401 viewport.firePropertyChange("alignment",
2403 viewport.getAlignment().getSequences());
2411 * @param e DOCUMENT ME!
2413 public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
2415 NewTreePanel("AV", "PID", "Average distance tree using PID");
2421 * @param e DOCUMENT ME!
2423 public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2425 NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
2431 * @param e DOCUMENT ME!
2433 protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
2435 NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
2441 * @param e DOCUMENT ME!
2443 protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
2445 NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
2451 * @param type DOCUMENT ME!
2452 * @param pwType DOCUMENT ME!
2453 * @param title DOCUMENT ME!
2455 void NewTreePanel(String type, String pwType, String title)
2459 if (viewport.getSelectionGroup() != null) {
2460 if (viewport.getSelectionGroup().getSize(false) < 3) {
2461 JOptionPane.showMessageDialog(Desktop.desktop,
2462 "You need to have more than two sequences selected to build a tree!",
2463 "Not enough sequences",
2464 JOptionPane.WARNING_MESSAGE);
2469 SequenceGroup sg = viewport.getSelectionGroup();
2471 /* Decide if the selection is a column region */
2472 while (s < sg.getSize(false))
2474 if ( ( (SequenceI) sg.getSequences(false).elementAt(s++)).getLength() <
2477 JOptionPane.showMessageDialog(Desktop.desktop,
2478 "The selected region to create a tree may\nonly contain residues or gaps.\n" +
2479 "Try using the Pad function in the edit menu,\n" +
2480 "or one of the multiple sequence alignment web services.",
2481 "Sequences in selection are not aligned",
2482 JOptionPane.WARNING_MESSAGE);
2488 title = title + " on region";
2489 tp = new TreePanel(alignPanel, type, pwType);
2493 //are the sequences aligned?
2494 if (!viewport.alignment.isAligned())
2496 JOptionPane.showMessageDialog(Desktop.desktop,
2497 "The sequences must be aligned before creating a tree.\n" +
2498 "Try using the Pad function in the edit menu,\n" +
2499 "or one of the multiple sequence alignment web services.",
2500 "Sequences not aligned",
2501 JOptionPane.WARNING_MESSAGE);
2506 if(viewport.alignment.getHeight()<2)
2509 tp = new TreePanel(alignPanel, type, pwType);
2512 addTreeMenuItem(tp, title);
2514 Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500);
2520 * @param title DOCUMENT ME!
2521 * @param order DOCUMENT ME!
2523 public void addSortByOrderMenuItem(String title, final AlignmentOrder order)
2525 final JMenuItem item = new JMenuItem("by " + title);
2527 item.addActionListener(new java.awt.event.ActionListener()
2529 public void actionPerformed(ActionEvent e)
2531 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2533 // TODO: JBPNote - have to map order entries to curent SequenceI pointers
2534 AlignmentSorter.sortBy(viewport.getAlignment(), order);
2536 addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport.alignment));
2538 alignPanel.repaint();
2544 * Maintain the Order by->Displayed Tree menu.
2545 * Creates a new menu item for a TreePanel with an appropriate
2546 * <code>jalview.analysis.AlignmentSorter</code> call. Listeners are added
2547 * to remove the menu item when the treePanel is closed, and adjust
2548 * the tree leaf to sequence mapping when the alignment is modified.
2549 * @param treePanel Displayed tree window.
2550 * @param title SortBy menu item title.
2552 void addTreeMenuItem(final TreePanel treePanel, String title)
2554 final JMenuItem item = new JMenuItem(title);
2560 sort.add(sortByTreeMenu);
2563 sortByTreeMenu.add(item);
2564 item.addActionListener(new java.awt.event.ActionListener()
2566 public void actionPerformed(ActionEvent e)
2568 SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
2569 AlignmentSorter.sortByTree(viewport.getAlignment(),
2570 treePanel.getTree());
2572 addHistoryItem(new OrderCommand("Tree Sort",
2574 viewport.alignment));
2577 alignPanel.repaint();
2581 treePanel.addInternalFrameListener(new javax.swing.event.
2582 InternalFrameAdapter()
2584 public void internalFrameClosed(
2585 javax.swing.event.InternalFrameEvent evt)
2588 sortByTreeMenu.remove(item);
2592 sort.remove(sortByTreeMenu);
2600 * Work out whether the whole set of sequences
2601 * or just the selected set will be submitted for multiple alignment.
2604 private jalview.datamodel.AlignmentView gatherSequencesForAlignment()
2606 // Now, check we have enough sequences
2607 AlignmentView msa = null;
2609 if ( (viewport.getSelectionGroup() != null) &&
2610 (viewport.getSelectionGroup().getSize(false) > 1))
2612 // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
2613 /*SequenceGroup seqs = viewport.getSelectionGroup();
2615 msa = new SequenceI[sz = seqs.getSize(false)];
2617 for (int i = 0; i < sz; i++)
2619 msa[i] = (SequenceI) seqs.getSequenceAt(i);
2621 msa = viewport.getAlignmentView(true);
2625 /*Vector seqs = viewport.getAlignment().getSequences();
2627 if (seqs.size() > 1)
2629 msa = new SequenceI[seqs.size()];
2631 for (int i = 0; i < seqs.size(); i++)
2633 msa[i] = (SequenceI) seqs.elementAt(i);
2636 msa = viewport.getAlignmentView(false);
2642 * Decides what is submitted to a secondary structure prediction service,
2643 * the currently selected sequence, or the currently selected alignment
2644 * (where the first sequence in the set is the one that the prediction
2647 AlignmentView gatherSeqOrMsaForSecStrPrediction()
2649 AlignmentView seqs = null;
2651 if ( (viewport.getSelectionGroup() != null) &&
2652 (viewport.getSelectionGroup().getSize(false) > 0))
2654 seqs = viewport.getAlignmentView(true);
2658 seqs = viewport.getAlignmentView(false);
2660 // limit sequences - JBPNote in future - could spawn multiple prediction jobs
2661 // TODO: viewport.alignment.isAligned is a global state - the local selection may well be aligned - we preserve 2.0.8 behaviour for moment.
2662 if (!viewport.alignment.isAligned())
2664 seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] } );
2671 * @param e DOCUMENT ME!
2673 protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
2675 // Pick the tree file
2676 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
2679 chooser.setFileView(new JalviewFileView());
2680 chooser.setDialogTitle("Select a newick-like tree file");
2681 chooser.setToolTipText("Load a tree file");
2683 int value = chooser.showOpenDialog(null);
2685 if (value == JalviewFileChooser.APPROVE_OPTION)
2687 String choice = chooser.getSelectedFile().getPath();
2688 jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
2692 jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,
2694 viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree());
2696 catch (Exception ex)
2698 JOptionPane.showMessageDialog(Desktop.desktop,
2699 "Problem reading tree file",
2701 JOptionPane.WARNING_MESSAGE);
2702 ex.printStackTrace();
2708 public TreePanel ShowNewickTree(NewickFile nf, String title)
2710 return ShowNewickTree(nf,title,600,500,4,5);
2712 public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input)
2714 return ShowNewickTree(nf,title, input, 600,500,4,5);
2716 public TreePanel ShowNewickTree(NewickFile nf, String title, int w,int h,int x, int y) {
2717 return ShowNewickTree(nf, title, null, w, h, x, y);
2720 * Add a treeviewer for the tree extracted from a newick file object to the current alignment view
2722 * @param nf the tree
2723 * @param title tree viewer title
2724 * @param input Associated alignment input data (or null)
2729 * @return TreePanel handle
2731 public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input, int w,int h,int x, int y) {
2732 TreePanel tp = null;
2738 if (nf.getTree() != null)
2740 tp = new TreePanel(alignPanel,
2748 tp.setLocation(x,y);
2751 Desktop.addInternalFrame(tp, title, w, h);
2752 addTreeMenuItem(tp, title);
2755 catch (Exception ex)
2757 ex.printStackTrace();
2768 PrinterJob printJob = PrinterJob.getPrinterJob();
2769 PageFormat pf = printJob.pageDialog(printJob.defaultPage());
2770 printJob.setPrintable(alignPanel, pf);
2772 if (printJob.printDialog())
2778 catch (Exception PrintException)
2780 PrintException.printStackTrace();
2787 * Generates menu items and listener event actions for web service clients
2790 public void BuildWebServiceMenu()
2792 if ( (Discoverer.services != null)
2793 && (Discoverer.services.size() > 0))
2795 Vector msaws = (Vector) Discoverer.services.get("MsaWS");
2796 Vector secstrpr = (Vector) Discoverer.services.get("SecStrPred");
2797 Vector wsmenu = new Vector();
2798 final AlignFrame af = this;
2801 // Add any Multiple Sequence Alignment Services
2802 final JMenu msawsmenu = new JMenu("Alignment");
2803 for (int i = 0, j = msaws.size(); i < j; i++)
2805 final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws.
2807 final JMenuItem method = new JMenuItem(sh.getName());
2808 method.addActionListener(new ActionListener()
2810 public void actionPerformed(ActionEvent e)
2812 AlignmentView msa = gatherSequencesForAlignment();
2813 new jalview.ws.MsaWSClient(sh, title, msa,
2814 false, true, viewport.getAlignment().getDataset(), af);
2819 msawsmenu.add(method);
2820 // Deal with services that we know accept partial alignments.
2821 if (sh.getName().indexOf("lustal") > -1)
2823 // We know that ClustalWS can accept partial alignments for refinement.
2824 final JMenuItem methodR = new JMenuItem(sh.getName()+" Realign");
2825 methodR.addActionListener(new ActionListener()
2827 public void actionPerformed(ActionEvent e)
2829 AlignmentView msa = gatherSequencesForAlignment();
2830 new jalview.ws.MsaWSClient(sh, title, msa,
2831 true, true, viewport.getAlignment().getDataset(), af);
2836 msawsmenu.add(methodR);
2840 wsmenu.add(msawsmenu);
2842 if (secstrpr != null)
2844 // Add any secondary structure prediction services
2845 final JMenu secstrmenu = new JMenu("Secondary Structure Prediction");
2846 for (int i = 0, j = secstrpr.size(); i < j; i++)
2848 final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle)
2850 final JMenuItem method = new JMenuItem(sh.getName());
2851 method.addActionListener(new ActionListener()
2853 public void actionPerformed(ActionEvent e)
2855 AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
2856 if (msa.getSequences().length == 1)
2858 // Single Sequence prediction
2859 new jalview.ws.JPredClient(sh, title, false, msa, af, true);
2863 if (msa.getSequences().length > 1)
2865 // Sequence profile based prediction
2866 new jalview.ws.JPredClient(sh,
2867 title, true, msa, af, true);
2872 secstrmenu.add(method);
2874 wsmenu.add(secstrmenu);
2876 this.webService.removeAll();
2877 for (int i = 0, j = wsmenu.size(); i < j; i++)
2879 webService.add( (JMenu) wsmenu.get(i));
2884 this.webService.removeAll();
2885 this.webService.add(this.webServiceNoServices);
2887 // TODO: add in rediscovery function
2888 // TODO: reduce code redundancy.
2889 // TODO: group services by location as well as function.
2892 /* public void vamsasStore_actionPerformed(ActionEvent e)
2894 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
2895 getProperty("LAST_DIRECTORY"));
2897 chooser.setFileView(new JalviewFileView());
2898 chooser.setDialogTitle("Export to Vamsas file");
2899 chooser.setToolTipText("Export");
2901 int value = chooser.showSaveDialog(this);
2903 if (value == JalviewFileChooser.APPROVE_OPTION)
2905 jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(viewport);
2906 //vs.store(chooser.getSelectedFile().getAbsolutePath() );
2907 vs.storeJalview( chooser.getSelectedFile().getAbsolutePath(), this);
2914 public void showTranslation_actionPerformed(ActionEvent e)
2916 SequenceI [] selection = viewport.getSelectionAsNewSequence();
2917 String [] seqstring = viewport.getViewAsString(true);
2919 int s, sSize = selection.length;
2920 SequenceI [] newSeq = new SequenceI[sSize];
2923 StringBuffer protein;
2925 for(s=0; s<sSize; s++)
2927 protein = new StringBuffer();
2928 seq = AlignSeq.extractGaps("-. ", seqstring[s]);
2929 resSize = seq.length();
2930 resSize -= resSize%3;
2932 for(res = 0; res < resSize; res+=3)
2934 String codon = seq.substring(res, res+3);
2935 codon = codon.replace('U', 'T');
2936 String aa = ResidueProperties.codonTranslate(codon);
2938 protein.append(viewport.getGapCharacter());
2939 else if(aa.equals("STOP"))
2940 protein.append("X");
2942 protein.append( aa );
2944 newSeq[s] = new Sequence(selection[s].getName(),
2945 protein.toString());
2949 AlignmentI al = new Alignment(newSeq);
2950 al.setDataset(null);
2953 ////////////////////////////////
2954 // Copy annotations across
2955 jalview.datamodel.AlignmentAnnotation[] annotations
2956 = viewport.alignment.getAlignmentAnnotation();
2958 if(annotations!=null)
2960 for (int i = 0; i < annotations.length; i++)
2962 if (annotations[i].label.equals("Quality") ||
2963 annotations[i].label.equals("Conservation") ||
2964 annotations[i].label.equals("Consensus"))
2969 aSize = viewport.alignment.getWidth() / 3;
2970 jalview.datamodel.Annotation[] anots =
2971 new jalview.datamodel.Annotation[aSize];
2973 for (a = 0; a < viewport.alignment.getWidth(); a++)
2975 if (annotations[i].annotations[a] == null
2976 || annotations[i].annotations[a] == null)
2979 anots[a / 3] = new Annotation(
2980 annotations[i].annotations[a].displayCharacter,
2981 annotations[i].annotations[a].description,
2982 annotations[i].annotations[a].secondaryStructure,
2983 annotations[i].annotations[a].value,
2984 annotations[i].annotations[a].colour);
2987 jalview.datamodel.AlignmentAnnotation aa
2988 = new jalview.datamodel.AlignmentAnnotation(annotations[i].label,
2989 annotations[i].description, anots);
2990 al.addAnnotation(aa);
2994 AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT);
2995 Desktop.addInternalFrame(af, "Translation of "+this.getTitle(),
3007 * @param String DOCUMENT ME!
3009 public boolean parseFeaturesFile(String file, String type)
3011 boolean featuresFile = false;
3013 featuresFile = new FeaturesFile(file, type).parse(viewport.alignment.getDataset(),
3014 alignPanel.seqPanel.seqCanvas.
3015 getFeatureRenderer().featureColours,
3020 ex.printStackTrace();
3025 viewport.showSequenceFeatures = true;
3026 showSeqFeatures.setSelected(true);
3027 alignPanel.repaint();
3030 return featuresFile;
3033 public void dragEnter(DropTargetDragEvent evt)
3036 public void dragExit(DropTargetEvent evt)
3039 public void dragOver(DropTargetDragEvent evt)
3042 public void dropActionChanged(DropTargetDragEvent evt)
3045 public void drop(DropTargetDropEvent evt)
3047 Transferable t = evt.getTransferable();
3048 java.util.List files = null;
3052 DataFlavor uriListFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
3053 if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
3055 //Works on Windows and MacOSX
3056 evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
3057 files = (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor);
3059 else if (t.isDataFlavorSupported(uriListFlavor))
3061 // This is used by Unix drag system
3062 evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
3063 String data = (String) t.getTransferData(uriListFlavor);
3064 files = new java.util.ArrayList(1);
3065 for (java.util.StringTokenizer st = new java.util.StringTokenizer(
3068 st.hasMoreTokens(); )
3070 String s = st.nextToken();
3071 if (s.startsWith("#"))
3073 // the line is a comment (as per the RFC 2483)
3077 java.net.URI uri = new java.net.URI(s);
3078 java.io.File file = new java.io.File(uri);
3085 e.printStackTrace();
3092 for (int i = 0; i < files.size(); i++)
3094 loadJalviewDataFile(files.get(i).toString());
3097 catch (Exception ex)
3099 ex.printStackTrace();
3104 // This method will attempt to load a "dropped" file first by testing
3105 // whether its and Annotation file, then features file. If both are
3106 // false then the user may have dropped an alignment file onto this
3108 public void loadJalviewDataFile(String file)
3111 String protocol = "File";
3113 if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1)
3118 boolean isAnnotation = new AnnotationFile().readAnnotationFile(viewport.
3123 boolean isGroupsFile = parseFeaturesFile(file,protocol);
3126 String format = new IdentifyFile().Identify(file, protocol);
3128 if(format.equalsIgnoreCase("JnetFile"))
3130 jalview.io.JPredFile predictions = new jalview.io.JPredFile(
3132 new JnetAnnotationMaker().add_annotation(predictions,
3133 viewport.getAlignment(),
3135 alignPanel.adjustAnnotationHeight();
3136 alignPanel.repaint();
3139 new FileLoader().LoadFile(viewport, file, protocol, format);
3145 alignPanel.adjustAnnotationHeight();
3148 }catch(Exception ex)
3150 ex.printStackTrace();
3154 public void tabSelectionChanged(int index)
3158 alignPanel = (AlignmentPanel) alignPanels.elementAt(index);
3159 viewport = alignPanel.av;
3160 setMenusFromViewport(viewport);
3164 public void tabbedPane_mousePressed(MouseEvent e)
3166 if(SwingUtilities.isRightMouseButton(e))
3168 String reply = JOptionPane.showInternalInputDialog(this,
3171 JOptionPane.QUESTION_MESSAGE);
3175 viewport.viewName = reply;
3176 tabbedPane.setTitleAt( tabbedPane.getSelectedIndex() ,reply);
3182 public AlignViewport getCurrentView()