*/
package jalview.api.structures;
+import java.io.File;
+
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.StructureViewer;
import jalview.structures.models.AAStructureBindingModel;
public interface JalviewStructureDisplayI
*/
boolean hasViewerActionsMenu();
+ String getViewId();
+
+ StructureViewer.ViewerType getViewerType();
+
+ boolean isUsedforaligment(AlignmentViewPanel ap);
+
+ boolean isColouredByViewer();
+
+ int getHeight();
+
+ int getWidth();
+
+ int getY();
+
+ File saveSession();
+
}
import javax.swing.event.MenuListener;
import jalview.api.AlignmentViewPanel;
+import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.datamodel.AlignmentI;
BySequence, ByChain, ChargeCysteine, ByViewer
}
- private static List<StructureViewerBase> svbs = new ArrayList<>();
+ /**
+ * Singleton list of all (open) instances of structureViewerBase
+ * TODO: JAL-3362 - review and adopt the swingJS-safe singleton pattern so each structure viewer base instance is kept to its own JalviewJS parent
+ */
+ private static List<JalviewStructureDisplayI> svbs = new ArrayList<>();
- public static List<StructureViewerBase> getAllStructureViewerBases()
+ /**
+ *
+ * @return list with all existing StructureViewers instance
+ */
+ public static List<JalviewStructureDisplayI> getAllStructureViewerBases()
{
- List<StructureViewerBase> goodSvbs = new ArrayList<>();
- for (StructureViewerBase s : svbs)
+ List<JalviewStructureDisplayI> goodSvbs = new ArrayList<>();
+ for (JalviewStructureDisplayI s : svbs)
{
if (s != null && !goodSvbs.contains(s))
{
return _aps.contains(ap2.av.getSequenceSetId());
}
+ @Override
public boolean isUsedforaligment(AlignmentViewPanel ap2)
{
* only view *should* be coped with sensibly.
*/
// This must have been loaded, is it still visible?
- List<StructureViewerBase> viewFrames = new ArrayList<>();
+ List<JalviewStructureDisplayI> viewFrames = new ArrayList<>();
if (Desktop.desktop != null)
{
JInternalFrame[] jifs = Desktop.desktop.getAllFrames();
{
for (JInternalFrame jif : jifs)
{
- if (jif instanceof StructureViewerBase)
+ if (jif instanceof JalviewStructureDisplayI)
{
- viewFrames.add((StructureViewerBase) jif);
+ viewFrames.add((JalviewStructureDisplayI) jif);
}
}
}
}
String matchedFile = null;
- for (StructureViewerBase viewFrame : viewFrames)
+ for (JalviewStructureDisplayI viewFrame : viewFrames)
{
matchedFile = saveStructureViewer(ap, jds, pdb, entry, viewIds,
matchedFile, viewFrame);
*/
protected String saveStructureViewer(AlignmentPanel ap, SequenceI jds,
Pdbids pdb, PDBEntry entry, List<String> viewIds,
- String matchedFile, StructureViewerBase viewFrame)
+ String matchedFile, JalviewStructureDisplayI viewFrame)
{
final AAStructureBindingModel bindingModel = viewFrame.getBinding();
{
StructureState state = new StructureState();
state.setVisible(true);
- state.setXpos(viewFrame.getX());
+ state.setXpos(viewFrame.getY());
state.setYpos(viewFrame.getY());
state.setWidth(viewFrame.getWidth());
state.setHeight(viewFrame.getHeight());