JAL-1834 removed quotes around truncated strings with ellipsis
[jalview.git] / src / jalview / gui / JalviewChimeraBindingModel.java
1 package jalview.gui;
2
3 import jalview.api.AlignmentViewPanel;
4 import jalview.datamodel.PDBEntry;
5 import jalview.datamodel.SequenceI;
6 import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
7 import jalview.structure.StructureSelectionManager;
8
9 public class JalviewChimeraBindingModel extends JalviewChimeraBinding
10 {
11   private ChimeraViewFrame cvf;
12
13   private FeatureRenderer fr = null;
14
15   public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame,
16           StructureSelectionManager ssm, PDBEntry[] pdbentry,
17           SequenceI[][] sequenceIs, String[][] chains, String protocol)
18   {
19     super(ssm, pdbentry, sequenceIs, chains, protocol);
20     cvf = chimeraViewFrame;
21   }
22
23   @Override
24   public FeatureRenderer getFeatureRenderer(
25           AlignmentViewPanel alignment)
26   {
27     AlignmentPanel ap = (alignment == null) ? cvf.getAlignmentPanel()
28             : (AlignmentPanel) alignment;
29     if (ap.av.isShowSequenceFeatures())
30     {
31       if (fr == null)
32       {
33         fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
34       }
35       else
36       {
37         ap.updateFeatureRenderer(fr);
38       }
39     }
40
41     return fr;
42   }
43
44   @Override
45   public jalview.api.SequenceRenderer getSequenceRenderer(
46           AlignmentViewPanel alignment)
47   {
48     return new SequenceRenderer(((AlignmentPanel) alignment).av);
49   }
50
51   @Override
52   public void refreshGUI()
53   {
54     javax.swing.SwingUtilities.invokeLater(new Runnable()
55     {
56       public void run()
57       {
58         cvf.updateTitleAndMenus();
59         cvf.revalidate();
60       }
61     });
62   }
63
64   public void updateColours(Object source)
65   {
66     AlignmentPanel ap = (AlignmentPanel) source;
67     // ignore events from panels not used to colour this view
68     if (!cvf.isUsedforcolourby(ap))
69     {
70       return;
71     }
72     if (!isLoadingFromArchive())
73     {
74       colourBySequence(ap.av.isShowSequenceFeatures(), ap);
75     }
76   }
77
78   @Override
79   public void releaseReferences(Object svl)
80   {
81   }
82
83   @Override
84   protected void releaseUIResources()
85   {
86   }
87
88   @Override
89   public void refreshPdbEntries()
90   {
91   }
92
93   /**
94    * Send an asynchronous command to Chimera, in a new thread, optionally with
95    * an 'in progress' message in a progress bar somewhere
96    */
97   protected void sendAsynchronousCommand(final String command,
98           final String progressMsg)
99   {
100     Thread thread = new Thread(new Runnable()
101     {
102
103       @Override
104       public void run()
105       {
106     long stm = cvf.startProgressBar(progressMsg);
107     try
108     {
109       sendChimeraCommand(command, false);
110     } finally
111     {
112       cvf.stopProgressBar(null, stm);
113     }
114       }
115     });
116   thread.start();
117
118   }
119 }