X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAppletJmol.java;h=7bf21a8d91abffd2e7128ef5da500b05f5f2a05c;hb=ec4ef38882bce0469ce7c65cd70ceb85421cfbd2;hp=42e6f56cfdfccf4378446f0de5ad2b5615f21efd;hpb=8a6fa9ea9900d0f106529c3f6283e7f9d76dd2cb;p=jalview.git diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 42e6f56..7bf21a8 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -52,6 +52,8 @@ public class AppletJmol extends EmbmenuFrame implements CheckboxMenuItem seqColour = new CheckboxMenuItem("By Sequence", true); + CheckboxMenuItem jmolColour = new CheckboxMenuItem("Using Jmol", false); + MenuItem chain = new MenuItem("By Chain"); MenuItem charge = new MenuItem("Charge & Cysteine"); @@ -83,6 +85,7 @@ public class AppletJmol extends EmbmenuFrame implements RenderPanel renderPanel; AlignmentPanel ap; + ArrayList _aps = new ArrayList(); String fileLoadingError; @@ -129,7 +132,7 @@ public class AppletJmol extends EmbmenuFrame implements AlignmentPanel ap, String protocol) { this.ap = ap; - jmb = new AppletJmolBinding(this, new PDBEntry[] + jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[] { pdbentry }, new SequenceI[][] { seq }, new String[][] { chains }, protocol); @@ -154,12 +157,12 @@ public class AppletJmol extends EmbmenuFrame implements } String alreadyMapped = StructureSelectionManager - .getStructureSelectionManager().alreadyMappedToFile( + .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile( pdbentry.getId()); MCview.PDBfile reader = null; if (alreadyMapped != null) { - reader = StructureSelectionManager.getStructureSelectionManager() + reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet) .setMapping(seq, chains, pdbentry.getFile(), protocol); // PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW? // FOR NOW, LETS JUST OPEN A NEW WINDOW @@ -177,6 +180,7 @@ public class AppletJmol extends EmbmenuFrame implements hydro.addActionListener(this); chain.addActionListener(this); seqColour.addItemListener(this); + jmolColour.addItemListener(this); zappo.addActionListener(this); taylor.addActionListener(this); helix.addActionListener(this); @@ -184,7 +188,7 @@ public class AppletJmol extends EmbmenuFrame implements turn.addActionListener(this); buried.addActionListener(this); user.addActionListener(this); - + jmolHelp.addActionListener(this); coloursMenu.add(seqColour); @@ -198,7 +202,7 @@ public class AppletJmol extends EmbmenuFrame implements coloursMenu.add(turn); coloursMenu.add(buried); coloursMenu.add(user); - + coloursMenu.add(jmolColour); helpMenu.add(jmolHelp); this.setLayout(new BorderLayout()); @@ -379,8 +383,7 @@ public class AppletJmol extends EmbmenuFrame implements { for (int s = 0; s < jmb.pdbentry.length; s++) { - sb.append(StructureSelectionManager - .getStructureSelectionManager().printMapping( + sb.append(jmb.printMapping( jmb.pdbentry[s].getFile())); sb.append("\n"); } @@ -473,23 +476,29 @@ public class AppletJmol extends EmbmenuFrame implements } /** - * tick or untick the seqColour menu entry depending upon if it was selected + * tick or untick the seqColour menu entry or jmoColour entry depending upon if it was selected * or not. * * @param itm */ private void setEnabled(MenuItem itm) { + jmolColour.setState(itm == jmolColour); seqColour.setState(itm == seqColour); jmb.setColourBySequence(itm == seqColour); } public void itemStateChanged(ItemEvent evt) { + if (evt.getSource() == jmolColour) + { + setEnabled(jmolColour); + jmb.setColourBySequence(false); + } else if (evt.getSource() == seqColour) { setEnabled(seqColour); - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment); + jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); } else if (!allChainsSelected) centerViewer(); @@ -517,7 +526,7 @@ public class AppletJmol extends EmbmenuFrame implements public void updateColours(Object source) { AlignmentPanel ap = (AlignmentPanel) source; - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment); + jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); } public void updateTitleAndMenus() @@ -528,7 +537,7 @@ public class AppletJmol extends EmbmenuFrame implements return; } setChainMenuItems(jmb.chainNames); - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment); + jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); setTitle(jmb.getViewerTitle()); } @@ -632,4 +641,16 @@ public class AppletJmol extends EmbmenuFrame implements { jmb.setJalviewColourScheme(ucs); } + + public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment) + { + for (int i=0;i<_aps.size();i++) + { + if (((AlignmentPanel)_aps.get(i)).av.getAlignment()==alignment) + { + return ((AlignmentPanel)_aps.get(i)); + } + } + return ap; + } }