+ }).start();
+ return;
+ }
+ }
+ // otherwise, start adding the structure.
+ jmb.addSequenceAndChain(new PDBEntry[]
+ { pdbentry }, new SequenceI[][]
+ { seq }, new String[][]
+ { chains });
+ addingStructures = true;
+ _started = false;
+ alignAddedStructures = b;
+ progressBar = alignFrame; // visual indication happens on caller frame.
+ (worker = new Thread(this)).start();
+ return;
+ }
+
+ private Vector getJmolsFor(AlignmentPanel ap2)
+ {
+ Vector otherJmols = new Vector();
+ // Now this AppJmol is mapped to new sequences. We must add them to
+ // the exisiting array
+ JInternalFrame[] frames = Desktop.instance.getAllFrames();
+
+ for (int i = 0; i < frames.length; i++)
+ {
+ if (frames[i] instanceof AppJmol)
+ {
+ AppJmol topJmol = ((AppJmol) frames[i]);
+ if (topJmol.isLinkedWith(ap2))
+ {
+ otherJmols.addElement(topJmol);
+ }
+ }
+ }
+ return otherJmols;
+ }
+
+ void initJmol(String command)
+ {
+ jmb.setFinishedInit(false);
+ renderPanel = new RenderPanel();
+ // TODO: consider waiting until the structure/view is fully loaded before
+ // displaying
+ this.getContentPane().add(renderPanel, java.awt.BorderLayout.CENTER);
+ jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(),
+ getBounds().width, getBounds().height);
+ if (scriptWindow == null)
+ {
+ BorderLayout bl = new BorderLayout();
+ bl.setHgap(0);
+ bl.setVgap(0);
+ scriptWindow = new JPanel(bl);
+ scriptWindow.setVisible(false);
+ }
+ ;
+ jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
+ null);
+ jmb.newJmolPopup(true, "Jmol", true);
+ if (command == null)
+ {
+ command = "";
+ }
+ jmb.evalStateCommand(command);
+ jmb.setFinishedInit(true);
+ }
+
+ void setChainMenuItems(Vector chains)
+ {
+ chainMenu.removeAll();
+ if (chains == null)
+ {
+ return;
+ }
+ JMenuItem menuItem = new JMenuItem(
+ MessageManager.getString("label.all"));
+ menuItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ allChainsSelected = true;
+ for (int i = 0; i < chainMenu.getItemCount(); i++)
+ {
+ if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ ((JCheckBoxMenuItem) chainMenu.getItem(i)).setSelected(true);
+ }
+ centerViewer();
+ allChainsSelected = false;
+ }
+ });