*/
package jalview.gui;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+
import jalview.api.AlignmentViewPanel;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.datamodel.PDBEntry;
import jalview.io.DataSourceType;
import jalview.structure.StructureSelectionManager;
-import javax.swing.SwingUtilities;
-
public class JalviewChimeraBindingModel extends JalviewChimeraBinding
{
- private ChimeraViewFrame cvf;
-
public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame,
StructureSelectionManager ssm, PDBEntry[] pdbentry,
SequenceI[][] sequenceIs, DataSourceType protocol)
{
super(ssm, pdbentry, sequenceIs, protocol);
- cvf = chimeraViewFrame;
- }
-
- @Override
- public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
- {
- AlignmentPanel ap = (alignment == null) ? cvf.getAlignmentPanel()
- : (AlignmentPanel) alignment;
- if (ap.av.isShowSequenceFeatures())
- {
- return ap.getSeqPanel().seqCanvas.fr;
- }
-
- return null;
+ setViewer(chimeraViewFrame);
}
@Override
@Override
public void refreshGUI()
{
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- cvf.updateTitleAndMenus();
- cvf.revalidate();
- }
- });
- }
-
- @Override
- public void updateColours(Object source)
- {
- AlignmentPanel ap = (AlignmentPanel) source;
- // ignore events from panels not used to colour this view
- if (!cvf.isUsedforcolourby(ap))
- {
- return;
- }
- if (!isLoadingFromArchive())
- {
- colourBySequence(ap);
- }
- }
-
- @Override
- public void releaseReferences(Object svl)
- {
- }
-
- @Override
- protected void releaseUIResources()
- {
- }
-
- @Override
- public void refreshPdbEntries()
- {
- }
-
- /**
- * Send an asynchronous command to Chimera, in a new thread, optionally with
- * an 'in progress' message in a progress bar somewhere
- */
- @Override
- protected void sendAsynchronousCommand(final String command,
- final String progressMsg)
- {
- final long handle = progressMsg == null ? 0
- : cvf.startProgressBar(progressMsg);
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
- try
- {
- sendChimeraCommand(command, false);
- } finally
- {
- if (progressMsg != null)
- {
- cvf.stopProgressBar(null, handle);
- }
- }
+ JalviewStructureDisplayI theViewer = getViewer();
+ theViewer.updateTitleAndMenus();
+ ((JComponent) theViewer).revalidate();
}
});
}
-
- @Override
- public JalviewStructureDisplayI getViewer()
- {
- return cvf;
- }
}