JAL-2422 general pull-up/removal of common or unused fields and methods
[jalview.git] / src / jalview / gui / JalviewChimeraBindingModel.java
index c9b35d8..f6cfb59 100644 (file)
@@ -28,31 +28,17 @@ import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
 import jalview.io.DataSourceType;
 import jalview.structure.StructureSelectionManager;
 
+import javax.swing.JComponent;
 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
@@ -70,42 +56,13 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
       @Override
       public void run()
       {
-        cvf.updateTitleAndMenus();
-        cvf.revalidate();
+        JalviewStructureDisplayI theViewer = getViewer();
+        theViewer.updateTitleAndMenus();
+        ((JComponent) theViewer).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
@@ -114,8 +71,9 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
   protected void sendAsynchronousCommand(final String command,
           final String progressMsg)
   {
-    final long handle = progressMsg == null ? 0 : cvf
-            .startProgressBar(progressMsg);
+    final JalviewStructureDisplayI theViewer = getViewer();
+    final long handle = progressMsg == null ? 0
+            : theViewer.startProgressBar(progressMsg);
     SwingUtilities.invokeLater(new Runnable()
     {
       @Override
@@ -123,21 +81,15 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
       {
         try
         {
-          sendChimeraCommand(command, false);
+          executeCommand(command, false);
         } finally
         {
           if (progressMsg != null)
           {
-            cvf.stopProgressBar(null, handle);
+            theViewer.stopProgressBar(null, handle);
           }
         }
       }
     });
   }
-
-  @Override
-  public JalviewStructureDisplayI getViewer()
-  {
-    return cvf;
-  }
 }