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 viewport.historyList.clear();
577 viewport.redoList.clear();
581 FileLoader loader = new FileLoader();
582 loader.LoadFile(viewport, fileName, "File", currentFileFormat);
588 public void addFromText_actionPerformed(ActionEvent e)
590 Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
593 public void addFromURL_actionPerformed(ActionEvent e)
595 Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
599 public void save_actionPerformed(ActionEvent e)
601 if(fileName==null || currentFileFormat==null)
602 saveAs_actionPerformed(null);
604 saveAlignment(fileName, currentFileFormat);
610 * @param e DOCUMENT ME!
612 public void saveAs_actionPerformed(ActionEvent e)
614 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
615 getProperty( "LAST_DIRECTORY"),
617 { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","jar" },
619 { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
624 chooser.setFileView(new JalviewFileView());
625 chooser.setDialogTitle("Save Alignment to file");
626 chooser.setToolTipText("Save");
628 int value = chooser.showSaveDialog(this);
630 if (value == JalviewFileChooser.APPROVE_OPTION)
632 currentFileFormat = chooser.getSelectedFormat();
633 if (currentFileFormat == null)
635 JOptionPane.showInternalMessageDialog(Desktop.desktop,
636 "You must select a file format before saving!",
637 "File format not specified",
638 JOptionPane.WARNING_MESSAGE);
639 value = chooser.showSaveDialog(this);
643 fileName = chooser.getSelectedFile().getPath();
645 jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",
648 jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName);
650 saveAlignment(fileName, currentFileFormat);
654 public boolean saveAlignment(String file, String format)
656 if (format.equalsIgnoreCase("Jalview"))
658 String shortName = title;
660 if (shortName.indexOf(java.io.File.separatorChar) > -1)
662 shortName = shortName.substring(shortName.lastIndexOf(
663 java.io.File.separatorChar) + 1);
666 new Jalview2XML().SaveAlignment(this, file, shortName);
668 statusBar.setText("Successfully saved to file: "
670 +format +" format.");
673 // USE Jalview2XML to save this file
679 String[] omitHidden = null;
681 if (viewport.hasHiddenColumns)
683 int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
684 "The Alignment contains hidden columns."
685 + "\nDo you want to save only the visible alignment?",
686 "Save / Omit Hidden Columns",
687 JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
689 if (reply == JOptionPane.YES_OPTION)
690 omitHidden = viewport.getViewAsString(false);
693 String output = new FormatAdapter().formatSequences(
695 viewport.alignment.getSequencesArray(),
705 java.io.PrintWriter out = new java.io.PrintWriter(
706 new java.io.FileWriter(file));
711 statusBar.setText("Successfully saved to file: "
713 +format +" format.");
718 ex.printStackTrace();
727 * @param e DOCUMENT ME!
729 protected void outputText_actionPerformed(ActionEvent e)
731 String [] omitHidden = null;
733 if(viewport.hasHiddenColumns)
735 int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
736 "The Alignment contains hidden columns."
737 +"\nDo you want to output only the visible alignment?",
738 "Save / Omit Hidden Columns",
739 JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
741 if(reply==JOptionPane.YES_OPTION)
743 omitHidden = viewport.getViewAsString(false);
747 CutAndPasteTransfer cap = new CutAndPasteTransfer();
748 Desktop.addInternalFrame(cap,
749 "Alignment output - " + e.getActionCommand(), 600,
753 cap.setText(new FormatAdapter().formatSequences(
754 e.getActionCommand(),
755 viewport.alignment.getSequencesArray(),
762 * @param e DOCUMENT ME!
764 protected void htmlMenuItem_actionPerformed(ActionEvent e)
766 new HTMLOutput(viewport,
767 alignPanel.seqPanel.seqCanvas.getSequenceRenderer(),
768 alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
771 public void createImageMap(File file, String image)
773 alignPanel.makePNGImageMap(file, image);
779 * @param e DOCUMENT ME!
781 public void createPNG(File f)
783 alignPanel.makePNG(f);
789 * @param e DOCUMENT ME!
791 public void createEPS(File f)
793 alignPanel.makeEPS(f);
799 * @param e DOCUMENT ME!
801 public void printMenuItem_actionPerformed(ActionEvent e)
803 //Putting in a thread avoids Swing painting problems
804 PrintThread thread = new PrintThread();
808 public void exportFeatures_actionPerformed(ActionEvent e)
810 new AnnotationExporter().exportFeatures(alignPanel);
814 public void exportAnnotations_actionPerformed(ActionEvent e)
816 new AnnotationExporter().exportAnnotations(
818 viewport.alignment.getAlignmentAnnotation()
823 public void associatedData_actionPerformed(ActionEvent e)
825 // Pick the tree file
826 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
829 chooser.setFileView(new JalviewFileView());
830 chooser.setDialogTitle("Load Jalview Annotations or Features File");
831 chooser.setToolTipText("Load Jalview Annotations / Features file");
833 int value = chooser.showOpenDialog(null);
835 if (value == JalviewFileChooser.APPROVE_OPTION)
837 String choice = chooser.getSelectedFile().getPath();
838 jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
839 loadJalviewDataFile(choice);
848 * @param e DOCUMENT ME!
850 public void closeMenuItem_actionPerformed(ActionEvent e)
854 if(alignPanels!=null)
856 for (int i = 0; i < alignPanels.size(); i++)
858 AlignmentPanel ap = (AlignmentPanel) alignPanels.elementAt(i);
859 PaintRefresher.RemoveComponent(ap.seqPanel.seqCanvas);
860 PaintRefresher.RemoveComponent(ap.idPanel.idCanvas);
861 PaintRefresher.RemoveComponent(ap);
863 // alignPanels = null;
866 // System.out.println("null one here");
868 // alignPanel = null;
871 this.setClosed(true);
875 ex.printStackTrace();
883 void updateEditMenuBar()
886 if (viewport.historyList.size() > 0)
888 undoMenuItem.setEnabled(true);
889 CommandI command = (CommandI) viewport.historyList.peek();
890 undoMenuItem.setText("Undo " + command.getDescription());
894 undoMenuItem.setEnabled(false);
895 undoMenuItem.setText("Undo");
898 if (viewport.redoList.size() > 0)
900 redoMenuItem.setEnabled(true);
902 CommandI command = (CommandI) viewport.redoList.peek();
903 redoMenuItem.setText("Redo " + command.getDescription());
907 redoMenuItem.setEnabled(false);
908 redoMenuItem.setText("Redo");
913 public void addHistoryItem(CommandI command)
915 if(command.getSize()>0)
917 viewport.historyList.push(command);
918 viewport.redoList.clear();
920 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
929 * @param e DOCUMENT ME!
931 protected void undoMenuItem_actionPerformed(ActionEvent e)
933 CommandI command = (CommandI)viewport.historyList.pop();
934 viewport.redoList.push(command);
935 command.undoCommand();
937 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
939 viewport.firePropertyChange("alignment", null,
940 viewport.getAlignment().getSequences());
946 * @param e DOCUMENT ME!
948 protected void redoMenuItem_actionPerformed(ActionEvent e)
950 CommandI command = (CommandI) viewport.redoList.pop();
951 viewport.historyList.push(command);
953 viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null;
956 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
963 * @param up DOCUMENT ME!
965 public void moveSelectedSequences(boolean up)
967 SequenceGroup sg = viewport.getSelectionGroup();
976 for (int i = 1; i < viewport.alignment.getHeight(); i++)
978 SequenceI seq = viewport.alignment.getSequenceAt(i);
980 if (!sg.getSequences(false).contains(seq))
985 SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
987 if (sg.getSequences(false).contains(temp))
992 viewport.alignment.getSequences().setElementAt(temp, i);
993 viewport.alignment.getSequences().setElementAt(seq, i - 1);
998 for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
1000 SequenceI seq = viewport.alignment.getSequenceAt(i);
1002 if (!sg.getSequences(false).contains(seq))
1007 SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
1009 if (sg.getSequences(false).contains(temp))
1014 viewport.alignment.getSequences().setElementAt(temp, i);
1015 viewport.alignment.getSequences().setElementAt(seq, i + 1);
1019 alignPanel.repaint();
1027 * @param e DOCUMENT ME!
1029 protected void copy_actionPerformed(ActionEvent e)
1032 if (viewport.getSelectionGroup() == null)
1037 SequenceI [] seqs = viewport.getSelectionAsNewSequence();
1038 String[] omitHidden = null;
1040 if (viewport.hasHiddenColumns)
1042 omitHidden = viewport.getViewAsString(true);
1045 String output = new FormatAdapter().formatSequences(
1050 StringSelection ss = new StringSelection(output);
1054 //Its really worth setting the clipboard contents
1055 //to empty before setting the large StringSelection!!
1056 Toolkit.getDefaultToolkit().getSystemClipboard()
1057 .setContents(new StringSelection(""), null);
1059 Toolkit.getDefaultToolkit().getSystemClipboard()
1060 .setContents(ss, Desktop.instance);
1062 catch (OutOfMemoryError er)
1064 er.printStackTrace();
1065 javax.swing.SwingUtilities.invokeLater(new Runnable()
1069 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
1070 "Out of memory copying region!!"
1072 "\nSee help files for increasing Java Virtual Machine memory."
1074 javax.swing.JOptionPane.WARNING_MESSAGE);
1081 Vector hiddenColumns = null;
1082 if(viewport.hasHiddenColumns)
1084 hiddenColumns =new Vector();
1085 int hiddenOffset = viewport.getSelectionGroup().getStartRes();
1086 for(int i=0; i<viewport.getColumnSelection().getHiddenColumns().size(); i++)
1088 int[] region = (int[])
1089 viewport.getColumnSelection().getHiddenColumns().elementAt(i);
1091 hiddenColumns.addElement(new int[]{region[0]-hiddenOffset,
1092 region[1]-hiddenOffset});
1098 Desktop.jalviewClipboard = new Object[]{ seqs,
1099 viewport.alignment.getDataset(),
1101 statusBar.setText("Copied "+seqs.length+" sequences to clipboard.");
1107 * @param e DOCUMENT ME!
1109 protected void pasteNew_actionPerformed(ActionEvent e)
1117 * @param e DOCUMENT ME!
1119 protected void pasteThis_actionPerformed(ActionEvent e)
1127 * @param newAlignment DOCUMENT ME!
1129 void paste(boolean newAlignment)
1133 Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
1134 Transferable contents = c.getContents(this);
1136 if (contents == null)
1144 str = (String) contents.getTransferData(DataFlavor.stringFlavor);
1145 if (str.length() < 1)
1148 format = new IdentifyFile().Identify(str, "Paste");
1151 catch (OutOfMemoryError er)
1153 er.printStackTrace();
1154 javax.swing.SwingUtilities.invokeLater(new Runnable()
1158 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
1159 "Out of memory pasting sequences!!"
1161 "\nSee help files for increasing Java Virtual Machine memory."
1163 javax.swing.JOptionPane.WARNING_MESSAGE);
1170 SequenceI[] sequences;
1173 if(Desktop.jalviewClipboard!=null)
1175 // The clipboard was filled from within Jalview, we must use the sequences
1176 // And dataset from the copied alignment
1177 sequences = (SequenceI[])Desktop.jalviewClipboard[0];
1181 sequences = new FormatAdapter().readFile(str, "Paste", format);
1184 AlignmentI alignment = null;
1188 alignment = new Alignment(sequences);
1190 if (Desktop.jalviewClipboard != null)
1191 alignment.setDataset( (Alignment) Desktop.jalviewClipboard[1]);
1193 alignment.setDataset(null);
1197 alignment = viewport.getAlignment();
1200 SequenceI [] newseqs = new SequenceI[sequences.length];
1201 for (int i = 0; i < sequences.length; i++)
1203 newseqs[i] = new Sequence(sequences[i].getName(),
1204 sequences[i].getSequence(), sequences[i].getStart(),
1205 sequences[i].getEnd());
1207 alignment.addSequence(newseqs[i]);
1213 addHistoryItem(new EditCommand(
1218 alignment.getWidth(),
1223 viewport.setEndSeq(alignment.getHeight());
1224 alignment.getWidth();
1225 viewport.firePropertyChange("alignment", null, alignment.getSequences());
1230 // Add any annotations attached to sequences
1231 for (int i = 0; i < sequences.length; i++)
1233 if (sequences[i].getAnnotation() != null)
1235 for (int a = 0; a < sequences[i].getAnnotation().length; a++)
1237 AlignmentAnnotation newAnnot =
1238 new AlignmentAnnotation(
1239 sequences[i].getAnnotation()[a].label,
1240 sequences[i].getAnnotation()[a].description,
1241 sequences[i].getAnnotation()[a].annotations,
1242 sequences[i].getAnnotation()[a].graphMin,
1243 sequences[i].getAnnotation()[a].graphMax,
1244 sequences[i].getAnnotation()[a].graph);
1246 sequences[i].getAnnotation()[a] = newAnnot;
1247 newAnnot.sequenceMapping = sequences[i].getAnnotation()[a].
1249 newAnnot.sequenceRef = sequences[i];
1250 newAnnot.adjustForAlignment();
1251 alignment.addAnnotation(newAnnot);
1252 alignment.setAnnotationIndex(newAnnot, a);
1255 alignPanel.annotationPanel.adjustPanelHeight();
1261 AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT);
1262 String newtitle = new String("Copied sequences");
1264 if(Desktop.jalviewClipboard!=null && Desktop.jalviewClipboard[2]!=null)
1266 Vector hc = (Vector)Desktop.jalviewClipboard[2];
1267 for(int i=0; i<hc.size(); i++)
1269 int [] region = (int[]) hc.elementAt(i);
1270 af.viewport.hideColumns(region[0], region[1]);
1275 //>>>This is a fix for the moment, until a better solution is found!!<<<
1276 af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(
1277 alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
1280 if (title.startsWith("Copied sequences"))
1286 newtitle = newtitle.concat("- from " + title);
1289 Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH,
1296 catch (Exception ex)
1298 ex.printStackTrace();
1299 System.out.println("Exception whilst pasting: "+ex);
1300 // could be anything being pasted in here
1309 * @param e DOCUMENT ME!
1311 protected void cut_actionPerformed(ActionEvent e)
1313 copy_actionPerformed(null);
1314 delete_actionPerformed(null);
1320 * @param e DOCUMENT ME!
1322 protected void delete_actionPerformed(ActionEvent evt)
1325 SequenceGroup sg = viewport.getSelectionGroup();
1331 Vector seqs = new Vector();
1332 int cutLength = sg.getEndRes()-sg.getStartRes()+1;
1333 boolean seqsCut = false;
1335 for (int i = 0; i < sg.getSize(false); i++)
1337 seq = sg.getSequenceAt(i);
1338 seqs.addElement(seq);
1339 if(seq.getLength()<=cutLength)
1344 // If the cut affects all sequences, remove highlighted columns
1345 if (sg.getSize(false) == viewport.alignment.getHeight())
1347 viewport.getColumnSelection().removeElements(sg.getStartRes(),
1348 sg.getEndRes() + 1);
1352 SequenceI [] cut = new SequenceI[seqs.size()];
1353 for(int i=0; i<seqs.size(); i++)
1354 cut[i] = (SequenceI)seqs.elementAt(i);
1360 addHistoryItem(new EditCommand("Cut Sequences",
1364 sg.getEndRes()-sg.getStartRes()+1,
1365 viewport.alignment));
1368 viewport.setSelectionGroup(null);
1369 viewport.alignment.deleteGroup(sg);
1371 viewport.firePropertyChange("alignment", null,
1372 viewport.getAlignment().getSequences());
1374 if (viewport.getAlignment().getHeight() < 1)
1378 this.setClosed(true);
1380 catch (Exception ex)
1389 * @param e DOCUMENT ME!
1391 protected void deleteGroups_actionPerformed(ActionEvent e)
1393 viewport.alignment.deleteAllGroups();
1394 viewport.setSelectionGroup(null);
1395 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1396 alignPanel.repaint();
1402 * @param e DOCUMENT ME!
1404 public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
1406 SequenceGroup sg = new SequenceGroup();
1408 for (int i = 0; i < viewport.getAlignment().getSequences().size();
1411 sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
1414 sg.setEndRes(viewport.alignment.getWidth() - 1);
1415 viewport.setSelectionGroup(sg);
1416 alignPanel.repaint();
1417 PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
1423 * @param e DOCUMENT ME!
1425 public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
1427 if(viewport.cursorMode)
1429 alignPanel.seqPanel.keyboardNo1 = null;
1430 alignPanel.seqPanel.keyboardNo2 = null;
1432 viewport.setSelectionGroup(null);
1433 viewport.getColumnSelection().clear();
1434 viewport.setSelectionGroup(null);
1435 alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
1436 alignPanel.idPanel.idCanvas.searchResults = null;
1437 alignPanel.repaint();
1438 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1444 * @param e DOCUMENT ME!
1446 public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
1448 SequenceGroup sg = viewport.getSelectionGroup();
1452 selectAllSequenceMenuItem_actionPerformed(null);
1457 for (int i = 0; i < viewport.getAlignment().getSequences().size();
1460 sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
1463 PaintRefresher.Refresh(this, viewport.getSequenceSetId());
1466 public void invertColSel_actionPerformed(ActionEvent e)
1468 viewport.invertColumnSelection();
1469 alignPanel.repaint();
1476 * @param e DOCUMENT ME!
1478 public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
1480 trimAlignment(true);
1486 * @param e DOCUMENT ME!
1488 public void remove2RightMenuItem_actionPerformed(ActionEvent e)
1490 trimAlignment(false);
1493 void trimAlignment(boolean trimLeft)
1495 ColumnSelection colSel = viewport.getColumnSelection();
1498 if (colSel.size() > 0)
1501 column = colSel.getMin();
1503 column = colSel.getMax();
1506 if(viewport.getSelectionGroup()!=null)
1507 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1509 seqs = viewport.alignment.getSequencesArray();
1512 TrimRegionCommand trimRegion;
1515 trimRegion = new TrimRegionCommand("Remove Left",
1516 TrimRegionCommand.TRIM_LEFT,
1521 viewport.selectionGroup);
1525 trimRegion = new TrimRegionCommand("Remove Right",
1526 TrimRegionCommand.TRIM_RIGHT,
1531 viewport.selectionGroup);
1534 statusBar.setText("Removed "+trimRegion.getSize()+" columns.");
1537 addHistoryItem(trimRegion);
1539 Vector groups = viewport.alignment.getGroups();
1541 for (int i = 0; i < groups.size(); i++)
1543 SequenceGroup sg = (SequenceGroup) groups.get(i);
1545 if ( (trimLeft && !sg.adjustForRemoveLeft(column))
1546 || (!trimLeft && !sg.adjustForRemoveRight(column)))
1548 viewport.alignment.deleteGroup(sg);
1552 viewport.firePropertyChange("alignment", null,
1553 viewport.getAlignment().getSequences());
1560 * @param e DOCUMENT ME!
1562 public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
1564 int start = 0, end = viewport.alignment.getWidth()-1;
1567 if (viewport.getSelectionGroup() != null)
1569 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1570 start = viewport.getSelectionGroup().getStartRes();
1571 end = viewport.getSelectionGroup().getEndRes();
1574 seqs = viewport.alignment.getSequencesArray();
1577 RemoveGapColCommand removeGapCols =
1578 new RemoveGapColCommand("Remove Gapped Columns",
1581 viewport.getGapCharacter());
1583 addHistoryItem(removeGapCols);
1585 statusBar.setText("Removed "+removeGapCols.getSize()+" empty columns.");
1587 //This is to maintain viewport position on first residue
1589 SequenceI seq = viewport.alignment.getSequenceAt(0);
1590 int startRes = seq.findPosition(viewport.startRes);
1591 // ShiftList shifts;
1592 // viewport.getAlignment().removeGaps(shifts=new ShiftList());
1593 // edit.alColumnChanges=shifts.getInverse();
1594 // if (viewport.hasHiddenColumns)
1595 // viewport.getColumnSelection().compensateForEdits(shifts);
1596 viewport.setStartRes(seq.findIndex(startRes)-1);
1597 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
1604 * @param e DOCUMENT ME!
1606 public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
1608 int start = 0, end = viewport.alignment.getWidth()-1;
1611 if (viewport.getSelectionGroup() != null)
1613 seqs = viewport.getSelectionGroup().getSequencesAsArray(true);
1614 start = viewport.getSelectionGroup().getStartRes();
1615 end = viewport.getSelectionGroup().getEndRes();
1618 seqs = viewport.alignment.getSequencesArray();
1620 //This is to maintain viewport position on first residue
1622 SequenceI seq = viewport.alignment.getSequenceAt(0);
1623 int startRes = seq.findPosition(viewport.startRes);
1625 addHistoryItem(new RemoveGapsCommand("Remove Gaps",
1628 viewport.getGapCharacter()));
1630 viewport.setStartRes(seq.findIndex(startRes)-1);
1632 viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
1639 * @param e DOCUMENT ME!
1641 public void padGapsMenuitem_actionPerformed(ActionEvent e)
1643 viewport.padGaps = padGapsMenuitem.isSelected();
1645 viewport.firePropertyChange("alignment",
1647 viewport.getAlignment().getSequences());
1653 * @param e DOCUMENT ME!
1655 public void findMenuItem_actionPerformed(ActionEvent e)
1657 JInternalFrame frame = new JInternalFrame();
1658 Finder finder = new Finder(viewport, alignPanel, frame);
1659 frame.setContentPane(finder);
1660 frame.setLayer(JLayeredPane.PALETTE_LAYER);
1661 Desktop.addInternalFrame(frame, "Find", 340, 110);
1667 * @param e DOCUMENT ME!
1669 public void font_actionPerformed(ActionEvent e)
1671 new FontChooser(alignPanel);
1674 public void smoothFont_actionPerformed(ActionEvent e)
1676 viewport.antiAlias = smoothFont.isSelected();
1677 alignPanel.annotationPanel.image = null;
1678 alignPanel.repaint();
1685 * @param e DOCUMENT ME!
1687 protected void seqLimit_actionPerformed(ActionEvent e)
1689 viewport.setShowJVSuffix(seqLimits.isSelected());
1691 alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());
1692 alignPanel.repaint();
1699 * @param e DOCUMENT ME!
1701 protected void colourTextMenuItem_actionPerformed(ActionEvent e)
1703 viewport.setColourText(colourTextMenuItem.isSelected());
1704 alignPanel.repaint();
1710 * @param e DOCUMENT ME!
1712 public void wrapMenuItem_actionPerformed(ActionEvent e)
1714 scaleAbove.setVisible(wrapMenuItem.isSelected());
1715 scaleLeft.setVisible(wrapMenuItem.isSelected());
1716 scaleRight.setVisible(wrapMenuItem.isSelected());
1717 viewport.setWrapAlignment(wrapMenuItem.isSelected());
1718 alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
1721 public void showAllSeqs_actionPerformed(ActionEvent e)
1723 viewport.showAllHiddenSeqs();
1726 public void showAllColumns_actionPerformed(ActionEvent e)
1728 viewport.showAllHiddenColumns();
1732 public void hideSelSequences_actionPerformed(ActionEvent e)
1734 viewport.hideAllSelectedSeqs();
1735 alignPanel.repaint();
1738 public void hideSelColumns_actionPerformed(ActionEvent e)
1740 viewport.hideSelectedColumns();
1741 alignPanel.repaint();
1744 public void hiddenMarkers_actionPerformed(ActionEvent e)
1746 viewport.setShowHiddenMarkers(hiddenMarkers.isSelected());
1753 * @param e DOCUMENT ME!
1755 protected void scaleAbove_actionPerformed(ActionEvent e)
1757 viewport.setScaleAboveWrapped(scaleAbove.isSelected());
1758 alignPanel.repaint();
1764 * @param e DOCUMENT ME!
1766 protected void scaleLeft_actionPerformed(ActionEvent e)
1768 viewport.setScaleLeftWrapped(scaleLeft.isSelected());
1769 alignPanel.repaint();
1775 * @param e DOCUMENT ME!
1777 protected void scaleRight_actionPerformed(ActionEvent e)
1779 viewport.setScaleRightWrapped(scaleRight.isSelected());
1780 alignPanel.repaint();
1786 * @param e DOCUMENT ME!
1788 public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
1790 viewport.setShowBoxes(viewBoxesMenuItem.isSelected());
1791 alignPanel.repaint();
1797 * @param e DOCUMENT ME!
1799 public void viewTextMenuItem_actionPerformed(ActionEvent e)
1801 viewport.setShowText(viewTextMenuItem.isSelected());
1802 alignPanel.repaint();
1808 * @param e DOCUMENT ME!
1810 protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
1812 viewport.setRenderGaps(renderGapsMenuItem.isSelected());
1813 alignPanel.repaint();
1817 public FeatureSettings featureSettings;
1818 public void featureSettings_actionPerformed(ActionEvent e)
1820 if(featureSettings !=null )
1822 featureSettings.close();
1823 featureSettings = null;
1825 featureSettings = new FeatureSettings(this);
1831 * @param evt DOCUMENT ME!
1833 public void showSeqFeatures_actionPerformed(ActionEvent evt)
1835 viewport.setShowSequenceFeatures(showSeqFeatures.isSelected());
1836 alignPanel.repaint();
1837 if (alignPanel.getOverviewPanel() != null)
1839 alignPanel.getOverviewPanel().updateOverviewImage();
1846 * @param e DOCUMENT ME!
1848 public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
1850 viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());
1851 alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
1857 * @param e DOCUMENT ME!
1859 public void overviewMenuItem_actionPerformed(ActionEvent e)
1861 if (alignPanel.overviewPanel != null)
1866 JInternalFrame frame = new JInternalFrame();
1867 OverviewPanel overview = new OverviewPanel(alignPanel);
1868 frame.setContentPane(overview);
1869 Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),
1870 frame.getWidth(), frame.getHeight());
1872 frame.setLayer(JLayeredPane.PALETTE_LAYER);
1873 frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
1875 public void internalFrameClosed(
1876 javax.swing.event.InternalFrameEvent evt)
1878 alignPanel.setOverviewPanel(null);
1883 alignPanel.setOverviewPanel(overview);
1889 * @param e DOCUMENT ME!
1891 protected void noColourmenuItem_actionPerformed(ActionEvent e)
1899 * @param e DOCUMENT ME!
1901 public void clustalColour_actionPerformed(ActionEvent e)
1903 changeColour(new ClustalxColourScheme(
1904 viewport.alignment.getSequences(), viewport.alignment.getWidth()));
1910 * @param e DOCUMENT ME!
1912 public void zappoColour_actionPerformed(ActionEvent e)
1914 changeColour(new ZappoColourScheme());
1920 * @param e DOCUMENT ME!
1922 public void taylorColour_actionPerformed(ActionEvent e)
1924 changeColour(new TaylorColourScheme());
1930 * @param e DOCUMENT ME!
1932 public void hydrophobicityColour_actionPerformed(ActionEvent e)
1934 changeColour(new HydrophobicColourScheme());
1940 * @param e DOCUMENT ME!
1942 public void helixColour_actionPerformed(ActionEvent e)
1944 changeColour(new HelixColourScheme());
1950 * @param e DOCUMENT ME!
1952 public void strandColour_actionPerformed(ActionEvent e)
1954 changeColour(new StrandColourScheme());
1960 * @param e DOCUMENT ME!
1962 public void turnColour_actionPerformed(ActionEvent e)
1964 changeColour(new TurnColourScheme());
1970 * @param e DOCUMENT ME!
1972 public void buriedColour_actionPerformed(ActionEvent e)
1974 changeColour(new BuriedColourScheme());
1980 * @param e DOCUMENT ME!
1982 public void nucleotideColour_actionPerformed(ActionEvent e)
1984 changeColour(new NucleotideColourScheme());
1987 public void annotationColour_actionPerformed(ActionEvent e)
1989 new AnnotationColourChooser(viewport, alignPanel);
1996 * @param e DOCUMENT ME!
1998 protected void applyToAllGroups_actionPerformed(ActionEvent e)
2000 viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
2006 * @param cs DOCUMENT ME!
2008 public void changeColour(ColourSchemeI cs)
2014 if (viewport.getAbovePIDThreshold())
2016 threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
2019 cs.setThreshold(threshold,
2020 viewport.getIgnoreGapsConsensus());
2022 viewport.setGlobalColourScheme(cs);
2026 cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
2029 if (viewport.getConservationSelected())
2032 Alignment al = (Alignment) viewport.alignment;
2033 Conservation c = new Conservation("All",
2034 ResidueProperties.propHash, 3,
2035 al.getSequences(), 0,
2039 c.verdict(false, viewport.ConsPercGaps);
2041 cs.setConservation(c);
2043 cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel, cs,
2048 cs.setConservation(null);
2051 cs.setConsensus(viewport.hconsensus);
2054 viewport.setGlobalColourScheme(cs);
2056 if (viewport.getColourAppliesToAllGroups())
2058 Vector groups = viewport.alignment.getGroups();
2060 for (int i = 0; i < groups.size(); i++)
2062 SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
2070 if (cs instanceof ClustalxColourScheme)
2072 sg.cs = new ClustalxColourScheme(
2073 sg.getSequences(true), sg.getWidth());
2075 else if (cs instanceof UserColourScheme)
2077 sg.cs = new UserColourScheme( ( (UserColourScheme) cs).getColours());
2083 sg.cs = (ColourSchemeI) cs.getClass().newInstance();
2085 catch (Exception ex)
2090 if (viewport.getAbovePIDThreshold()
2091 || cs instanceof PIDColourScheme
2092 || cs instanceof Blosum62ColourScheme)
2094 sg.cs.setThreshold(threshold,
2095 viewport.getIgnoreGapsConsensus());
2097 sg.cs.setConsensus(AAFrequency.calculate(
2098 sg.getSequences(true), sg.getStartRes(),
2102 sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
2105 if (viewport.getConservationSelected())
2107 Conservation c = new Conservation("Group",
2108 ResidueProperties.propHash, 3,
2109 sg.getSequences(true),
2113 c.verdict(false, viewport.ConsPercGaps);
2114 sg.cs.setConservation(c);
2117 sg.cs.setConservation(null);
2121 if (alignPanel.getOverviewPanel() != null)
2123 alignPanel.getOverviewPanel().updateOverviewImage();
2126 alignPanel.repaint();
2132 * @param e DOCUMENT ME!
2134 protected void modifyPID_actionPerformed(ActionEvent e)
2136 if (viewport.getAbovePIDThreshold() && viewport.globalColourScheme!=null)
2138 SliderPanel.setPIDSliderSource(alignPanel,
2139 viewport.getGlobalColourScheme(),
2141 SliderPanel.showPIDSlider();
2148 * @param e DOCUMENT ME!
2150 protected void modifyConservation_actionPerformed(ActionEvent e)
2152 if (viewport.getConservationSelected() && viewport.globalColourScheme!=null)
2154 SliderPanel.setConservationSlider(alignPanel,
2155 viewport.globalColourScheme,
2157 SliderPanel.showConservationSlider();
2164 * @param e DOCUMENT ME!
2166 protected void conservationMenuItem_actionPerformed(ActionEvent e)
2168 viewport.setConservationSelected(conservationMenuItem.isSelected());
2170 viewport.setAbovePIDThreshold(false);
2171 abovePIDThreshold.setSelected(false);
2173 changeColour(viewport.getGlobalColourScheme());
2175 modifyConservation_actionPerformed(null);
2181 * @param e DOCUMENT ME!
2183 public void abovePIDThreshold_actionPerformed(ActionEvent e)
2185 viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
2187 conservationMenuItem.setSelected(false);
2188 viewport.setConservationSelected(false);
2190 changeColour(viewport.getGlobalColourScheme());
2192 modifyPID_actionPerformed(null);
2198 * @param e DOCUMENT ME!
2200 public void userDefinedColour_actionPerformed(ActionEvent e)
2202 if (e.getActionCommand().equals("User Defined..."))
2204 new UserDefinedColours(alignPanel, null);
2208 UserColourScheme udc = (UserColourScheme) UserDefinedColours.
2209 getUserColourSchemes().get(e.getActionCommand());
2215 public void updateUserColourMenu()
2218 Component[] menuItems = colourMenu.getMenuComponents();
2219 int i, iSize = menuItems.length;
2220 for (i = 0; i < iSize; i++)
2222 if (menuItems[i].getName() != null &&
2223 menuItems[i].getName().equals("USER_DEFINED"))
2225 colourMenu.remove(menuItems[i]);
2229 if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
2231 java.util.Enumeration userColours = jalview.gui.UserDefinedColours.
2232 getUserColourSchemes().keys();
2234 while (userColours.hasMoreElements())
2236 final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(userColours.
2237 nextElement().toString());
2238 radioItem.setName("USER_DEFINED");
2239 radioItem.addMouseListener(new MouseAdapter()
2241 public void mousePressed(MouseEvent evt)
2243 if(evt.isControlDown() || SwingUtilities.isRightMouseButton(evt))
2245 radioItem.removeActionListener(radioItem.getActionListeners()[0]);
2247 int option = JOptionPane.showInternalConfirmDialog(jalview.gui.Desktop.desktop,
2248 "Remove from default list?",
2249 "Remove user defined colour",
2250 JOptionPane.YES_NO_OPTION);
2251 if(option == JOptionPane.YES_OPTION)
2253 jalview.gui.UserDefinedColours.removeColourFromDefaults(radioItem.getText());
2254 colourMenu.remove(radioItem);
2257 radioItem.addActionListener(new ActionListener()
2259 public void actionPerformed(ActionEvent evt)
2261 userDefinedColour_actionPerformed(evt);
2267 radioItem.addActionListener(new ActionListener()
2269 public void actionPerformed(ActionEvent evt)
2271 userDefinedColour_actionPerformed(evt);
2275 colourMenu.insert(radioItem, 15);
2276 colours.add(radioItem);
2284 * @param e DOCUMENT ME!
2286 public void PIDColour_actionPerformed(ActionEvent e)
2288 changeColour(new PIDColourScheme());
2294 * @param e DOCUMENT ME!
2296 public void BLOSUM62Colour_actionPerformed(ActionEvent e)
2298 changeColour(new Blosum62ColourScheme());
2304 * @param e DOCUMENT ME!
2306 public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
2308 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2309 AlignmentSorter.sortByPID(viewport.getAlignment(),
2310 viewport.getAlignment().getSequenceAt(0));
2311 addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.alignment));
2312 alignPanel.repaint();
2318 * @param e DOCUMENT ME!
2320 public void sortIDMenuItem_actionPerformed(ActionEvent e)
2322 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2323 AlignmentSorter.sortByID(viewport.getAlignment());
2324 addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
2325 alignPanel.repaint();
2331 * @param e DOCUMENT ME!
2333 public void sortGroupMenuItem_actionPerformed(ActionEvent e)
2335 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2336 AlignmentSorter.sortByGroup(viewport.getAlignment());
2337 addHistoryItem(new OrderCommand("Group Sort", oldOrder, viewport.alignment));
2339 alignPanel.repaint();
2345 * @param e DOCUMENT ME!
2347 public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
2349 new RedundancyPanel(alignPanel, this);
2356 * @param e DOCUMENT ME!
2358 public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
2360 if ( (viewport.getSelectionGroup() == null) ||
2361 (viewport.getSelectionGroup().getSize(false) < 2))
2363 JOptionPane.showInternalMessageDialog(this,
2364 "You must select at least 2 sequences.",
2365 "Invalid Selection",
2366 JOptionPane.WARNING_MESSAGE);
2370 JInternalFrame frame = new JInternalFrame();
2371 frame.setContentPane(new PairwiseAlignPanel(viewport));
2372 Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);
2379 * @param e DOCUMENT ME!
2381 public void PCAMenuItem_actionPerformed(ActionEvent e)
2383 if ( ( (viewport.getSelectionGroup() != null) &&
2384 (viewport.getSelectionGroup().getSize(false) < 4) &&
2385 (viewport.getSelectionGroup().getSize(false) > 0)) ||
2386 (viewport.getAlignment().getHeight() < 4))
2388 JOptionPane.showInternalMessageDialog(this,
2389 "Principal component analysis must take\n" +
2390 "at least 4 input sequences.",
2391 "Sequence selection insufficient",
2392 JOptionPane.WARNING_MESSAGE);
2397 new PCAPanel(viewport);
2401 public void autoCalculate_actionPerformed(ActionEvent e)
2403 viewport.autoCalculateConsensus = autoCalculate.isSelected();
2404 if(viewport.autoCalculateConsensus)
2406 viewport.firePropertyChange("alignment",
2408 viewport.getAlignment().getSequences());
2416 * @param e DOCUMENT ME!
2418 public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
2420 NewTreePanel("AV", "PID", "Average distance tree using PID");
2426 * @param e DOCUMENT ME!
2428 public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
2430 NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
2436 * @param e DOCUMENT ME!
2438 protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
2440 NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
2446 * @param e DOCUMENT ME!
2448 protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
2450 NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
2456 * @param type DOCUMENT ME!
2457 * @param pwType DOCUMENT ME!
2458 * @param title DOCUMENT ME!
2460 void NewTreePanel(String type, String pwType, String title)
2464 if (viewport.getSelectionGroup() != null) {
2465 if (viewport.getSelectionGroup().getSize(false) < 3) {
2466 JOptionPane.showMessageDialog(Desktop.desktop,
2467 "You need to have more than two sequences selected to build a tree!",
2468 "Not enough sequences",
2469 JOptionPane.WARNING_MESSAGE);
2474 SequenceGroup sg = viewport.getSelectionGroup();
2476 /* Decide if the selection is a column region */
2477 while (s < sg.getSize(false))
2479 if ( ( (SequenceI) sg.getSequences(false).elementAt(s++)).getLength() <
2482 JOptionPane.showMessageDialog(Desktop.desktop,
2483 "The selected region to create a tree may\nonly contain residues or gaps.\n" +
2484 "Try using the Pad function in the edit menu,\n" +
2485 "or one of the multiple sequence alignment web services.",
2486 "Sequences in selection are not aligned",
2487 JOptionPane.WARNING_MESSAGE);
2493 title = title + " on region";
2494 tp = new TreePanel(alignPanel, type, pwType);
2498 //are the sequences aligned?
2499 if (!viewport.alignment.isAligned())
2501 JOptionPane.showMessageDialog(Desktop.desktop,
2502 "The sequences must be aligned before creating a tree.\n" +
2503 "Try using the Pad function in the edit menu,\n" +
2504 "or one of the multiple sequence alignment web services.",
2505 "Sequences not aligned",
2506 JOptionPane.WARNING_MESSAGE);
2511 if(viewport.alignment.getHeight()<2)
2514 tp = new TreePanel(alignPanel, type, pwType);
2517 addTreeMenuItem(tp, title);
2519 Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500);
2525 * @param title DOCUMENT ME!
2526 * @param order DOCUMENT ME!
2528 public void addSortByOrderMenuItem(String title, final AlignmentOrder order)
2530 final JMenuItem item = new JMenuItem("by " + title);
2532 item.addActionListener(new java.awt.event.ActionListener()
2534 public void actionPerformed(ActionEvent e)
2536 SequenceI [] oldOrder = viewport.getAlignment().getSequencesArray();
2538 // TODO: JBPNote - have to map order entries to curent SequenceI pointers
2539 AlignmentSorter.sortBy(viewport.getAlignment(), order);
2541 addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport.alignment));
2543 alignPanel.repaint();
2549 * Maintain the Order by->Displayed Tree menu.
2550 * Creates a new menu item for a TreePanel with an appropriate
2551 * <code>jalview.analysis.AlignmentSorter</code> call. Listeners are added
2552 * to remove the menu item when the treePanel is closed, and adjust
2553 * the tree leaf to sequence mapping when the alignment is modified.
2554 * @param treePanel Displayed tree window.
2555 * @param title SortBy menu item title.
2557 void addTreeMenuItem(final TreePanel treePanel, String title)
2559 final JMenuItem item = new JMenuItem(title);
2565 sort.add(sortByTreeMenu);
2568 sortByTreeMenu.add(item);
2569 item.addActionListener(new java.awt.event.ActionListener()
2571 public void actionPerformed(ActionEvent e)
2573 SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
2574 AlignmentSorter.sortByTree(viewport.getAlignment(),
2575 treePanel.getTree());
2577 addHistoryItem(new OrderCommand("Tree Sort",
2579 viewport.alignment));
2582 alignPanel.repaint();
2586 treePanel.addInternalFrameListener(new javax.swing.event.
2587 InternalFrameAdapter()
2589 public void internalFrameClosed(
2590 javax.swing.event.InternalFrameEvent evt)
2593 sortByTreeMenu.remove(item);
2597 sort.remove(sortByTreeMenu);
2605 * Work out whether the whole set of sequences
2606 * or just the selected set will be submitted for multiple alignment.
2609 private jalview.datamodel.AlignmentView gatherSequencesForAlignment()
2611 // Now, check we have enough sequences
2612 AlignmentView msa = null;
2614 if ( (viewport.getSelectionGroup() != null) &&
2615 (viewport.getSelectionGroup().getSize(false) > 1))
2617 // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
2618 /*SequenceGroup seqs = viewport.getSelectionGroup();
2620 msa = new SequenceI[sz = seqs.getSize(false)];
2622 for (int i = 0; i < sz; i++)
2624 msa[i] = (SequenceI) seqs.getSequenceAt(i);
2626 msa = viewport.getAlignmentView(true);
2630 /*Vector seqs = viewport.getAlignment().getSequences();
2632 if (seqs.size() > 1)
2634 msa = new SequenceI[seqs.size()];
2636 for (int i = 0; i < seqs.size(); i++)
2638 msa[i] = (SequenceI) seqs.elementAt(i);
2641 msa = viewport.getAlignmentView(false);
2647 * Decides what is submitted to a secondary structure prediction service,
2648 * the currently selected sequence, or the currently selected alignment
2649 * (where the first sequence in the set is the one that the prediction
2652 AlignmentView gatherSeqOrMsaForSecStrPrediction()
2654 AlignmentView seqs = null;
2656 if ( (viewport.getSelectionGroup() != null) &&
2657 (viewport.getSelectionGroup().getSize(false) > 0))
2659 seqs = viewport.getAlignmentView(true);
2663 seqs = viewport.getAlignmentView(false);
2665 // limit sequences - JBPNote in future - could spawn multiple prediction jobs
2666 // TODO: viewport.alignment.isAligned is a global state - the local selection may well be aligned - we preserve 2.0.8 behaviour for moment.
2667 if (!viewport.alignment.isAligned())
2669 seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] } );
2676 * @param e DOCUMENT ME!
2678 protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
2680 // Pick the tree file
2681 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
2684 chooser.setFileView(new JalviewFileView());
2685 chooser.setDialogTitle("Select a newick-like tree file");
2686 chooser.setToolTipText("Load a tree file");
2688 int value = chooser.showOpenDialog(null);
2690 if (value == JalviewFileChooser.APPROVE_OPTION)
2692 String choice = chooser.getSelectedFile().getPath();
2693 jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
2697 jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,
2699 viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree());
2701 catch (Exception ex)
2703 JOptionPane.showMessageDialog(Desktop.desktop,
2704 "Problem reading tree file",
2706 JOptionPane.WARNING_MESSAGE);
2707 ex.printStackTrace();
2713 public TreePanel ShowNewickTree(NewickFile nf, String title)
2715 return ShowNewickTree(nf,title,600,500,4,5);
2717 public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input)
2719 return ShowNewickTree(nf,title, input, 600,500,4,5);
2721 public TreePanel ShowNewickTree(NewickFile nf, String title, int w,int h,int x, int y) {
2722 return ShowNewickTree(nf, title, null, w, h, x, y);
2725 * Add a treeviewer for the tree extracted from a newick file object to the current alignment view
2727 * @param nf the tree
2728 * @param title tree viewer title
2729 * @param input Associated alignment input data (or null)
2734 * @return TreePanel handle
2736 public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input, int w,int h,int x, int y) {
2737 TreePanel tp = null;
2743 if (nf.getTree() != null)
2745 tp = new TreePanel(alignPanel,
2753 tp.setLocation(x,y);
2756 Desktop.addInternalFrame(tp, title, w, h);
2757 addTreeMenuItem(tp, title);
2760 catch (Exception ex)
2762 ex.printStackTrace();
2773 PrinterJob printJob = PrinterJob.getPrinterJob();
2774 PageFormat pf = printJob.pageDialog(printJob.defaultPage());
2775 printJob.setPrintable(alignPanel, pf);
2777 if (printJob.printDialog())
2783 catch (Exception PrintException)
2785 PrintException.printStackTrace();
2792 * Generates menu items and listener event actions for web service clients
2795 public void BuildWebServiceMenu()
2797 if ( (Discoverer.services != null)
2798 && (Discoverer.services.size() > 0))
2800 Vector msaws = (Vector) Discoverer.services.get("MsaWS");
2801 Vector secstrpr = (Vector) Discoverer.services.get("SecStrPred");
2802 Vector wsmenu = new Vector();
2803 final AlignFrame af = this;
2806 // Add any Multiple Sequence Alignment Services
2807 final JMenu msawsmenu = new JMenu("Alignment");
2808 for (int i = 0, j = msaws.size(); i < j; i++)
2810 final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws.
2812 final JMenuItem method = new JMenuItem(sh.getName());
2813 method.addActionListener(new ActionListener()
2815 public void actionPerformed(ActionEvent e)
2817 AlignmentView msa = gatherSequencesForAlignment();
2818 new jalview.ws.MsaWSClient(sh, title, msa,
2819 false, true, viewport.getAlignment().getDataset(), af);
2824 msawsmenu.add(method);
2825 // Deal with services that we know accept partial alignments.
2826 if (sh.getName().indexOf("lustal") > -1)
2828 // We know that ClustalWS can accept partial alignments for refinement.
2829 final JMenuItem methodR = new JMenuItem(sh.getName()+" Realign");
2830 methodR.addActionListener(new ActionListener()
2832 public void actionPerformed(ActionEvent e)
2834 AlignmentView msa = gatherSequencesForAlignment();
2835 new jalview.ws.MsaWSClient(sh, title, msa,
2836 true, true, viewport.getAlignment().getDataset(), af);
2841 msawsmenu.add(methodR);
2845 wsmenu.add(msawsmenu);
2847 if (secstrpr != null)
2849 // Add any secondary structure prediction services
2850 final JMenu secstrmenu = new JMenu("Secondary Structure Prediction");
2851 for (int i = 0, j = secstrpr.size(); i < j; i++)
2853 final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle)
2855 final JMenuItem method = new JMenuItem(sh.getName());
2856 method.addActionListener(new ActionListener()
2858 public void actionPerformed(ActionEvent e)
2860 AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
2861 if (msa.getSequences().length == 1)
2863 // Single Sequence prediction
2864 new jalview.ws.JPredClient(sh, title, false, msa, af, true);
2868 if (msa.getSequences().length > 1)
2870 // Sequence profile based prediction
2871 new jalview.ws.JPredClient(sh,
2872 title, true, msa, af, true);
2877 secstrmenu.add(method);
2879 wsmenu.add(secstrmenu);
2881 this.webService.removeAll();
2882 for (int i = 0, j = wsmenu.size(); i < j; i++)
2884 webService.add( (JMenu) wsmenu.get(i));
2889 this.webService.removeAll();
2890 this.webService.add(this.webServiceNoServices);
2892 // TODO: add in rediscovery function
2893 // TODO: reduce code redundancy.
2894 // TODO: group services by location as well as function.
2897 /* public void vamsasStore_actionPerformed(ActionEvent e)
2899 JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
2900 getProperty("LAST_DIRECTORY"));
2902 chooser.setFileView(new JalviewFileView());
2903 chooser.setDialogTitle("Export to Vamsas file");
2904 chooser.setToolTipText("Export");
2906 int value = chooser.showSaveDialog(this);
2908 if (value == JalviewFileChooser.APPROVE_OPTION)
2910 jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(viewport);
2911 //vs.store(chooser.getSelectedFile().getAbsolutePath() );
2912 vs.storeJalview( chooser.getSelectedFile().getAbsolutePath(), this);
2919 public void showTranslation_actionPerformed(ActionEvent e)
2921 SequenceI [] selection = viewport.getSelectionAsNewSequence();
2922 String [] seqstring = viewport.getViewAsString(true);
2924 int s, sSize = selection.length;
2925 SequenceI [] newSeq = new SequenceI[sSize];
2928 StringBuffer protein;
2930 for(s=0; s<sSize; s++)
2932 protein = new StringBuffer();
2933 seq = AlignSeq.extractGaps("-. ", seqstring[s]);
2934 resSize = seq.length();
2935 resSize -= resSize%3;
2937 for(res = 0; res < resSize; res+=3)
2939 String codon = seq.substring(res, res+3);
2940 codon = codon.replace('U', 'T');
2941 String aa = ResidueProperties.codonTranslate(codon);
2943 protein.append(viewport.getGapCharacter());
2944 else if(aa.equals("STOP"))
2945 protein.append("X");
2947 protein.append( aa );
2949 newSeq[s] = new Sequence(selection[s].getName(),
2950 protein.toString());
2954 AlignmentI al = new Alignment(newSeq);
2955 al.setDataset(null);
2958 ////////////////////////////////
2959 // Copy annotations across
2960 jalview.datamodel.AlignmentAnnotation[] annotations
2961 = viewport.alignment.getAlignmentAnnotation();
2963 if(annotations!=null)
2965 for (int i = 0; i < annotations.length; i++)
2967 if (annotations[i].label.equals("Quality") ||
2968 annotations[i].label.equals("Conservation") ||
2969 annotations[i].label.equals("Consensus"))
2974 aSize = viewport.alignment.getWidth() / 3;
2975 jalview.datamodel.Annotation[] anots =
2976 new jalview.datamodel.Annotation[aSize];
2978 for (a = 0; a < viewport.alignment.getWidth(); a++)
2980 if (annotations[i].annotations[a] == null
2981 || annotations[i].annotations[a] == null)
2984 anots[a / 3] = new Annotation(
2985 annotations[i].annotations[a].displayCharacter,
2986 annotations[i].annotations[a].description,
2987 annotations[i].annotations[a].secondaryStructure,
2988 annotations[i].annotations[a].value,
2989 annotations[i].annotations[a].colour);
2992 jalview.datamodel.AlignmentAnnotation aa
2993 = new jalview.datamodel.AlignmentAnnotation(annotations[i].label,
2994 annotations[i].description, anots);
2995 al.addAnnotation(aa);
2999 AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT);
3000 Desktop.addInternalFrame(af, "Translation of "+this.getTitle(),
3012 * @param String DOCUMENT ME!
3014 public boolean parseFeaturesFile(String file, String type)
3016 boolean featuresFile = false;
3018 featuresFile = new FeaturesFile(file, type).parse(viewport.alignment.getDataset(),
3019 alignPanel.seqPanel.seqCanvas.
3020 getFeatureRenderer().featureColours,
3025 ex.printStackTrace();
3030 viewport.showSequenceFeatures = true;
3031 showSeqFeatures.setSelected(true);
3032 alignPanel.repaint();
3035 return featuresFile;
3038 public void dragEnter(DropTargetDragEvent evt)
3041 public void dragExit(DropTargetEvent evt)
3044 public void dragOver(DropTargetDragEvent evt)
3047 public void dropActionChanged(DropTargetDragEvent evt)
3050 public void drop(DropTargetDropEvent evt)
3052 Transferable t = evt.getTransferable();
3053 java.util.List files = null;
3057 DataFlavor uriListFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
3058 if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
3060 //Works on Windows and MacOSX
3061 evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
3062 files = (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor);
3064 else if (t.isDataFlavorSupported(uriListFlavor))
3066 // This is used by Unix drag system
3067 evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
3068 String data = (String) t.getTransferData(uriListFlavor);
3069 files = new java.util.ArrayList(1);
3070 for (java.util.StringTokenizer st = new java.util.StringTokenizer(
3073 st.hasMoreTokens(); )
3075 String s = st.nextToken();
3076 if (s.startsWith("#"))
3078 // the line is a comment (as per the RFC 2483)
3082 java.net.URI uri = new java.net.URI(s);
3083 java.io.File file = new java.io.File(uri);
3090 e.printStackTrace();
3097 for (int i = 0; i < files.size(); i++)
3099 loadJalviewDataFile(files.get(i).toString());
3102 catch (Exception ex)
3104 ex.printStackTrace();
3109 // This method will attempt to load a "dropped" file first by testing
3110 // whether its and Annotation file, then features file. If both are
3111 // false then the user may have dropped an alignment file onto this
3113 public void loadJalviewDataFile(String file)
3116 String protocol = "File";
3118 if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1)
3123 boolean isAnnotation = new AnnotationFile().readAnnotationFile(viewport.
3128 boolean isGroupsFile = parseFeaturesFile(file,protocol);
3131 String format = new IdentifyFile().Identify(file, protocol);
3133 if(format.equalsIgnoreCase("JnetFile"))
3135 jalview.io.JPredFile predictions = new jalview.io.JPredFile(
3137 new JnetAnnotationMaker().add_annotation(predictions,
3138 viewport.getAlignment(),
3140 alignPanel.adjustAnnotationHeight();
3141 alignPanel.repaint();
3144 new FileLoader().LoadFile(viewport, file, protocol, format);
3150 alignPanel.adjustAnnotationHeight();
3153 }catch(Exception ex)
3155 ex.printStackTrace();
3159 public void tabSelectionChanged(int index)
3163 alignPanel = (AlignmentPanel) alignPanels.elementAt(index);
3164 viewport = alignPanel.av;
3165 setMenusFromViewport(viewport);
3169 public void tabbedPane_mousePressed(MouseEvent e)
3171 if(SwingUtilities.isRightMouseButton(e))
3173 String reply = JOptionPane.showInternalInputDialog(this,
3176 JOptionPane.QUESTION_MESSAGE);
3180 viewport.viewName = reply;
3181 tabbedPane.setTitleAt( tabbedPane.getSelectedIndex() ,reply);
3187 public AlignViewport getCurrentView()