X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAppletJmol.java;h=4b014d1868ff644863e1ce70116d8099b9ad6514;hb=ab43013b7e357b84b4abade0dba949668dfb2a0e;hp=0ff246761aef8f07927e6dfed4e837e25784fafd;hpb=362f2db1b01f3562784864a1d6ac5f7b9be0a18a;p=jalview.git diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 0ff2467..4b014d1 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -1,19 +1,22 @@ /* - * 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.8.2b1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.appletgui; @@ -26,55 +29,65 @@ import jalview.datamodel.*; import jalview.structure.*; import jalview.io.*; -import org.jmol.api.*; - -import org.jmol.popup.*; -import org.jmol.viewer.JmolConstants; - import jalview.schemes.*; +import jalview.util.MessageManager; public class AppletJmol extends EmbmenuFrame implements // StructureListener, - KeyListener, ActionListener, ItemListener, SequenceStructureBinding + KeyListener, ActionListener, ItemListener { - Menu fileMenu = new Menu("File"); + Menu fileMenu = new Menu(MessageManager.getString("action.file")); + + Menu viewMenu = new Menu(MessageManager.getString("action.view")); + + Menu coloursMenu = new Menu(MessageManager.getString("action.colour")); - Menu viewMenu = new Menu("View"); + Menu chainMenu = new Menu(MessageManager.getString("action.show_chain")); - Menu coloursMenu = new Menu("Colours"); + Menu helpMenu = new Menu(MessageManager.getString("action.help")); - Menu chainMenu = new Menu("Show Chain"); + MenuItem mappingMenuItem = new MenuItem( + MessageManager.getString("label.view_mapping")); - Menu helpMenu = new Menu("Help"); + CheckboxMenuItem seqColour = new CheckboxMenuItem( + MessageManager.getString("action.by_sequence"), true); - MenuItem mappingMenuItem = new MenuItem("View Mapping"); + CheckboxMenuItem jmolColour = new CheckboxMenuItem( + MessageManager.getString("action.using_jmol"), false); - CheckboxMenuItem seqColour = new CheckboxMenuItem("By Sequence", true); + MenuItem chain = new MenuItem(MessageManager.getString("action.by_chain")); - CheckboxMenuItem jmolColour = new CheckboxMenuItem("Using Jmol", false); - - MenuItem chain = new MenuItem("By Chain"); + MenuItem charge = new MenuItem( + MessageManager.getString("label.charge_cysteine")); - MenuItem charge = new MenuItem("Charge & Cysteine"); + MenuItem zappo = new MenuItem(MessageManager.getString("label.zappo")); - MenuItem zappo = new MenuItem("Zappo"); + MenuItem taylor = new MenuItem(MessageManager.getString("label.taylor")); - MenuItem taylor = new MenuItem("Taylor"); + MenuItem hydro = new MenuItem( + MessageManager.getString("label.hydrophobicity")); - MenuItem hydro = new MenuItem("Hydrophobicity"); + MenuItem helix = new MenuItem( + MessageManager.getString("label.helix_propensity")); - MenuItem helix = new MenuItem("Helix Propensity"); + MenuItem strand = new MenuItem( + MessageManager.getString("label.strand_propensity")); - MenuItem strand = new MenuItem("Strand Propensity"); + MenuItem turn = new MenuItem( + MessageManager.getString("label.turn_propensity")); - MenuItem turn = new MenuItem("Turn Propensity"); + MenuItem buried = new MenuItem( + MessageManager.getString("label.buried_index")); - MenuItem buried = new MenuItem("Buried Index"); + MenuItem purinepyrimidine = new MenuItem( + MessageManager.getString("label.purine_pyrimidine")); - MenuItem user = new MenuItem("User Defined Colours"); + MenuItem user = new MenuItem( + MessageManager.getString("label.user_defined_colours")); - MenuItem jmolHelp = new MenuItem("Jmol Help"); + MenuItem jmolHelp = new MenuItem( + MessageManager.getString("label.jmol_help")); Panel scriptWindow; @@ -85,6 +98,7 @@ public class AppletJmol extends EmbmenuFrame implements RenderPanel renderPanel; AlignmentPanel ap; + ArrayList _aps = new ArrayList(); String fileLoadingError; @@ -125,17 +139,18 @@ public class AppletJmol extends EmbmenuFrame implements String[][] boundchains, boolean align, AlignmentPanel ap, String protocol) { - throw new Error("Not yet implemented."); + throw new Error(MessageManager.getString("error.not_yet_implemented")); } public AppletJmol(PDBEntry pdbentry, SequenceI[] seq, String[] chains, AlignmentPanel ap, String protocol) { this.ap = ap; - jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[] - { pdbentry }, new SequenceI[][] - { seq }, new String[][] - { chains }, protocol); + jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), + new PDBEntry[] + { pdbentry }, new SequenceI[][] + { seq }, new String[][] + { chains }, protocol); jmb.setColourBySequence(true); if (pdbentry.getId() == null || pdbentry.getId().length() < 1) { @@ -157,13 +172,14 @@ public class AppletJmol extends EmbmenuFrame implements } String alreadyMapped = StructureSelectionManager - .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile( - pdbentry.getId()); + .getStructureSelectionManager(ap.av.applet) + .alreadyMappedToFile(pdbentry.getId()); MCview.PDBfile reader = null; if (alreadyMapped != null) { - reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet) - .setMapping(seq, chains, pdbentry.getFile(), protocol); + 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 } @@ -187,8 +203,9 @@ public class AppletJmol extends EmbmenuFrame implements strand.addActionListener(this); turn.addActionListener(this); buried.addActionListener(this); + purinepyrimidine.addActionListener(this); user.addActionListener(this); - + jmolHelp.addActionListener(this); coloursMenu.add(seqColour); @@ -201,6 +218,7 @@ public class AppletJmol extends EmbmenuFrame implements coloursMenu.add(strand); coloursMenu.add(turn); coloursMenu.add(buried); + coloursMenu.add(purinepyrimidine); coloursMenu.add(user); coloursMenu.add(jmolColour); helpMenu.add(jmolHelp); @@ -297,8 +315,7 @@ public class AppletJmol extends EmbmenuFrame implements } if (freader == null) { - throw new Exception( - "Invalid datasource. Could not obtain Reader."); + throw new Exception(MessageManager.getString("exception.invalid_datasource_couldnt_obtain_reader")); } jmb.viewer.openReader(pdbentry.getFile(), pdbentry.getId(), freader); @@ -326,7 +343,7 @@ public class AppletJmol extends EmbmenuFrame implements { chainMenu.removeAll(); - MenuItem menuItem = new MenuItem("All"); + MenuItem menuItem = new MenuItem(MessageManager.getString("label.all")); menuItem.addActionListener(this); chainMenu.add(menuItem); @@ -383,8 +400,7 @@ public class AppletJmol extends EmbmenuFrame implements { for (int s = 0; s < jmb.pdbentry.length; s++) { - sb.append(jmb.printMapping( - jmb.pdbentry[s].getFile())); + sb.append(jmb.printMapping(jmb.pdbentry[s].getFile())); sb.append("\n"); } cap.setText(sb.toString()); @@ -395,8 +411,9 @@ public class AppletJmol extends EmbmenuFrame implements .println("Out of memory when trying to create dialog box with sequence-structure mapping."); return; } - jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping", - 550, 600); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.pdb_sequence_mapping"), 550, + 600); } else if (evt.getSource() == charge) { @@ -444,6 +461,10 @@ public class AppletJmol extends EmbmenuFrame implements setEnabled(buried); jmb.setJalviewColourScheme(new BuriedColourScheme()); } + else if (evt.getSource() == purinepyrimidine) + { + jmb.setJalviewColourScheme(new PurinePyrimidineColourScheme()); + } else if (evt.getSource() == user) { setEnabled(user); @@ -476,8 +497,8 @@ public class AppletJmol extends EmbmenuFrame implements } /** - * tick or untick the seqColour menu entry or jmoColour entry depending upon if it was selected - * or not. + * tick or untick the seqColour menu entry or jmoColour entry depending upon + * if it was selected or not. * * @param itm */ @@ -494,8 +515,8 @@ public class AppletJmol extends EmbmenuFrame implements { setEnabled(jmolColour); jmb.setColourBySequence(false); - } else - if (evt.getSource() == seqColour) + } + else if (evt.getSource() == seqColour) { setEnabled(seqColour); jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); @@ -610,7 +631,8 @@ public class AppletJmol extends EmbmenuFrame implements g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString("Retrieving PDB data....", 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.retrieving_pdb_data"), + 20, currentSize.height / 2); } else { @@ -644,11 +666,11 @@ public class AppletJmol extends EmbmenuFrame implements public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment) { - for (int i=0;i<_aps.size();i++) + for (int i = 0; i < _aps.size(); i++) { - if (((AlignmentPanel)_aps.get(i)).av.getAlignment()==alignment) + if (((AlignmentPanel) _aps.get(i)).av.getAlignment() == alignment) { - return ((AlignmentPanel)_aps.get(i)); + return ((AlignmentPanel) _aps.get(i)); } } return ap;