X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppJmol.java;h=bab8a2d7fc145b9a577425674a6d5f0c6933746b;hb=58afea88095280d807e5c2ac8b9155de5ba3503c;hp=eab3580ee021b85a0452888dc26fe6384f5f006d;hpb=47168f025aefdaa044802bd5f8f510ffe43a4808;p=jalview.git diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index eab3580..bab8a2d 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -22,6 +22,7 @@ package jalview.gui; import java.util.*; import java.awt.*; + import javax.swing.*; import javax.swing.event.*; @@ -30,17 +31,19 @@ import java.io.*; import jalview.jbgui.GStructureViewer; import jalview.api.SequenceStructureBinding; +import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.*; import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.datamodel.PDBEntry; +import jalview.ext.jmol.JalviewJmolBinding; import jalview.io.*; import jalview.schemes.*; import jalview.util.MessageManager; import jalview.util.Platform; public class AppJmol extends GStructureViewer implements Runnable, - SequenceStructureBinding, ViewSetProvider + ViewSetProvider, JalviewStructureDisplayI { AppJmolBinding jmb; @@ -174,7 +177,7 @@ public class AppJmol extends GStructureViewer implements Runnable, _alignwith = new Vector(); } - seqColourBy = new ViewSelectionMenu("Colour by ..", this, _colourwith, + seqColourBy = new ViewSelectionMenu(MessageManager.getString("label.colour_by"), this, _colourwith, new ItemListener() { @@ -194,7 +197,7 @@ public class AppJmol extends GStructureViewer implements Runnable, }); viewMenu.add(seqColourBy); final ItemListener handler; - JMenu alpanels = new ViewSelectionMenu("Superpose with ..", this, + JMenu alpanels = new ViewSelectionMenu(MessageManager.getString("label.superpose_with"), this, _alignwith, handler = new ItemListener() { @@ -202,7 +205,11 @@ public class AppJmol extends GStructureViewer implements Runnable, public void itemStateChanged(ItemEvent e) { alignStructs.setEnabled(_alignwith.size() > 0); - alignStructs.setToolTipText(MessageManager.formatMessage("label.align_structures_using_linked_alignment_views", new String[] {new Integer(_alignwith.size()).toString()})); + alignStructs.setToolTipText(MessageManager + .formatMessage( + "label.align_structures_using_linked_alignment_views", + new String[] + { new Integer(_alignwith.size()).toString() })); } }); handler.itemStateChanged(null); @@ -254,9 +261,11 @@ public class AppJmol extends GStructureViewer implements Runnable, if (alreadyMapped != null) { int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.formatMessage("label.pdb_entry_is_already_displayed", new String[]{pdbentry.getId()}), - MessageManager.formatMessage("label.map_sequences_to_visible_window", new String[]{pdbentry.getId()}), - JOptionPane.YES_NO_OPTION); + MessageManager.formatMessage( + "label.pdb_entry_is_already_displayed", new String[] + { pdbentry.getId() }), MessageManager.formatMessage( + "label.map_sequences_to_visible_window", new String[] + { pdbentry.getId() }), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { @@ -311,10 +320,15 @@ public class AppJmol extends GStructureViewer implements Runnable, { AppJmol topJmol = (AppJmol) jm.nextElement(); // TODO: highlight topJmol in view somehow - int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.formatMessage("label.add_pdbentry_to_view", new String[]{pdbentry.getId(),topJmol.getTitle()}), - MessageManager.getString("label.align_to_existing_structure_view"), - JOptionPane.YES_NO_OPTION); + int option = JOptionPane + .showInternalConfirmDialog( + Desktop.desktop, + MessageManager.formatMessage( + "label.add_pdbentry_to_view", new String[] + { pdbentry.getId(), topJmol.getTitle() }), + MessageManager + .getString("label.align_to_existing_structure_view"), + JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { topJmol.useAlignmentPanelForSuperposition(ap); @@ -619,7 +633,8 @@ public class AppJmol extends GStructureViewer implements Runnable, { return; } - JMenuItem menuItem = new JMenuItem(MessageManager.getString("label.all")); + JMenuItem menuItem = new JMenuItem( + MessageManager.getString("label.all")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) @@ -676,7 +691,7 @@ public class AppJmol extends GStructureViewer implements Runnable, jmb.centerViewer(toshow); } - void closeViewer() + public void closeViewer() { jmb.closeViewer(); ap = null; @@ -781,9 +796,12 @@ public class AppJmol extends GStructureViewer implements Runnable, if (errormsgs.length() > 0) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.pdb_entries_couldnt_be_retrieved", new String[]{errormsgs.toString()}), - MessageManager.getString("label.couldnt_load_file"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.pdb_entries_couldnt_be_retrieved", + new String[] + { errormsgs.toString() }), MessageManager + .getString("label.couldnt_load_file"), + JOptionPane.ERROR_MESSAGE); } long lastnotify = jmb.getLoadNotifiesHandled(); @@ -831,7 +849,8 @@ public class AppJmol extends GStructureViewer implements Runnable, // need to wait around until script has finished while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() - : (jmb.isFinishedInit() && jmb.getPdbFile()!=null && jmb.getPdbFile().length != jmb.pdbentry.length)) + : (jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb + .getPdbFile().length != jmb.pdbentry.length)) { try { @@ -921,8 +940,9 @@ public class AppJmol extends GStructureViewer implements Runnable, cap.dispose(); return; } - jalview.gui.Desktop.addInternalFrame(cap, MessageManager.getString("label.pdb_sequence_mapping"), - 550, 600); + jalview.gui.Desktop.addInternalFrame(cap, + MessageManager.getString("label.pdb_sequence_mapping"), 550, + 600); } /** @@ -1144,7 +1164,8 @@ public class AppJmol extends GStructureViewer implements Runnable, g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.error_loading_file") + "...", 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.error_loading_file") + + "...", 20, currentSize.height / 2); StringBuffer sb = new StringBuffer(); int lines = 0; for (int e = 0; e < jmb.pdbentry.length; e++) @@ -1169,7 +1190,8 @@ public class AppJmol extends GStructureViewer implements Runnable, g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.retrieving_pdb_data"), 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.retrieving_pdb_data"), + 20, currentSize.height / 2); } else { @@ -1337,4 +1359,9 @@ public class AppJmol extends GStructureViewer implements Runnable, return !jmb.isColourBySequence(); } + public JalviewJmolBinding getBinding() + { + return jmb; + } + }