3 import java.awt.Component;
4 import java.util.ArrayList;
6 import java.util.Vector;
8 import javax.swing.JMenuItem;
10 import jalview.gui.ViewSelectionMenu.ViewSetProvider;
11 import jalview.jbgui.GStructureViewer;
14 * Base class with common functionality for JMol, Chimera or other structure
20 public abstract class StructureViewerBase extends GStructureViewer
21 implements Runnable, ViewSetProvider
25 * list of sequenceSet ids associated with the view
27 protected List<String> _aps = new ArrayList<String>();
29 * list of alignment panels to use for superposition
31 protected Vector<AlignmentPanel> _alignwith = new Vector<AlignmentPanel>();
33 * list of alignment panels that are used for colouring structures by aligned
36 protected Vector<AlignmentPanel> _colourwith = new Vector<AlignmentPanel>();
37 private String viewId = null;
38 private AlignmentPanel ap;
43 * @return true if this Jmol instance is linked with the given alignPanel
45 public boolean isLinkedWith(AlignmentPanel ap2)
47 return _aps.contains(ap2.av.getSequenceSetId());
50 public boolean isUsedforaligment(AlignmentPanel ap2)
53 return (_alignwith != null) && _alignwith.contains(ap2);
56 public boolean isUsedforcolourby(AlignmentPanel ap2)
58 return (_colourwith != null) && _colourwith.contains(ap2);
63 * @return TRUE if the view is NOT being coloured by the alignment colours.
65 public boolean isColouredByViewer()
67 return !getBinding().isColourBySequence();
70 public String getViewId()
74 viewId = System.currentTimeMillis() + "." + this.hashCode();
79 protected void setViewId(String viewId)
84 public String getStateInfo()
89 protected void buildActionMenu()
91 if (_alignwith == null)
93 _alignwith = new Vector<AlignmentPanel>();
95 if (_alignwith.size() == 0 && ap != null)
100 for (Component c : viewerActionMenu.getMenuComponents())
102 if (c != alignStructs)
104 viewerActionMenu.remove((JMenuItem) c);
109 public AlignmentPanel getAlignmentPanel()
114 protected void setAlignmentPanel(AlignmentPanel alp)