2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.api.AlignmentViewPanel;
24 import jalview.datamodel.PDBEntry;
25 import jalview.datamodel.SequenceI;
26 import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
27 import jalview.structure.StructureSelectionManager;
29 public class JalviewChimeraBindingModel extends JalviewChimeraBinding
31 private ChimeraViewFrame cvf;
33 private FeatureRenderer fr = null;
35 public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame,
36 StructureSelectionManager ssm, PDBEntry[] pdbentry,
37 SequenceI[][] sequenceIs, String[][] chains, String protocol)
39 super(ssm, pdbentry, sequenceIs, chains, protocol);
40 cvf = chimeraViewFrame;
44 public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
46 AlignmentPanel ap = (alignment == null) ? cvf.getAlignmentPanel()
47 : (AlignmentPanel) alignment;
48 if (ap.av.isShowSequenceFeatures())
52 fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
56 ap.updateFeatureRenderer(fr);
64 public jalview.api.SequenceRenderer getSequenceRenderer(
65 AlignmentViewPanel alignment)
67 return new SequenceRenderer(((AlignmentPanel) alignment).av);
71 public void refreshGUI()
73 javax.swing.SwingUtilities.invokeLater(new Runnable()
77 cvf.updateTitleAndMenus();
83 public void updateColours(Object source)
85 AlignmentPanel ap = (AlignmentPanel) source;
86 // ignore events from panels not used to colour this view
87 if (!cvf.isUsedforcolourby(ap))
91 if (!isLoadingFromArchive())
93 colourBySequence(ap.av.isShowSequenceFeatures(), ap);
98 public void releaseReferences(Object svl)
103 protected void releaseUIResources()
108 public void refreshPdbEntries()
113 * Send an asynchronous command to Chimera, in a new thread, optionally with
114 * an 'in progress' message in a progress bar somewhere
116 protected void sendAsynchronousCommand(final String command,
117 final String progressMsg)
119 Thread thread = new Thread(new Runnable()
125 long stm = cvf.startProgressBar(progressMsg);
128 sendChimeraCommand(command, false);
131 cvf.stopProgressBar(null, stm);