/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
-import jalview.gui.ViewSelectionMenu.ViewSetProvider;
import jalview.io.AppletFormatAdapter;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
-import jalview.jbgui.GStructureViewer;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.HelixColourScheme;
import java.awt.BorderLayout;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
-public class AppJmol extends GStructureViewer implements Runnable,
- ViewSetProvider
-
+public class AppJmol extends StructureViewerBase
{
AppJmolBinding jmb;
RenderPanel renderPanel;
- AlignmentPanel ap;
-
Vector atomsPicked = new Vector();
private boolean addingStructures = false;
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
{
- PDBEntry pdbentry = new PDBEntry();
- pdbentry.setFile(files[i]);
- pdbentry.setId(ids[i]);
+ PDBEntry pdbentry = new PDBEntry(files[i], ids[i]);
pdbentrys[i] = pdbentry;
}
// / TODO: check if protocol is needed to be set, and if chains are
seqColour.setSelected(false);
viewerColour.setSelected(true);
}
- if (usetoColour)
+ else if (usetoColour)
{
useAlignmentPanelForColourbyseq(ap);
jmb.setColourBySequence(true);
topJmol.addAlignmentPanel(ap);
// add it to the set used for colouring
topJmol.useAlignmentPanelForColourbyseq(ap);
- topJmol.buildJmolActionMenu();
+ topJmol.buildActionMenu();
ap.getStructureSelectionManager()
.sequenceColoursChanged(ap);
break;
openNewJmol(ap, pe, seqs);
}
- public AlignmentPanel[] getAllAlignmentPanels()
- {
- AlignmentPanel[] t, list = new AlignmentPanel[0];
- for (String setid : _aps)
- {
- AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid);
- if (panels != null)
- {
- t = new AlignmentPanel[list.length + panels.length];
- System.arraycopy(list, 0, t, 0, list.length);
- System.arraycopy(panels, 0, t, list.length, panels.length);
- list = t;
- }
- }
-
- return list;
- }
-
- /**
- * set the primary alignmentPanel reference and add another alignPanel to the
- * list of ones to use for colouring and aligning
- *
- * @param nap
- */
- public void addAlignmentPanel(AlignmentPanel nap)
- {
- if (ap == null)
- {
- ap = nap;
- }
- if (!_aps.contains(nap.av.getSequenceSetId()))
- {
- _aps.add(nap.av.getSequenceSetId());
- }
- }
-
- /**
- * remove any references held to the given alignment panel
- *
- * @param nap
- */
- public void removeAlignmentPanel(AlignmentPanel nap)
- {
- try
- {
- _alignwith.remove(nap);
- _colourwith.remove(nap);
- if (ap == nap)
- {
- ap = null;
- for (AlignmentPanel aps : getAllAlignmentPanels())
- {
- if (aps != nap)
- {
- ap = aps;
- break;
- }
- }
- }
- } catch (Exception ex)
- {
- }
- if (ap != null)
- {
- buildJmolActionMenu();
- }
- }
-
- public void useAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_alignwith.contains(nap))
- {
- _alignwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- if (_alignwith.contains(nap))
- {
- _alignwith.remove(nap);
- }
- }
-
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap,
- boolean enableColourBySeq)
- {
- useAlignmentPanelForColourbyseq(nap);
- jmb.setColourBySequence(enableColourBySeq);
- seqColour.setSelected(enableColourBySeq);
- viewerColour.setSelected(!enableColourBySeq);
- }
-
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_colourwith.contains(nap))
- {
- _colourwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- if (_colourwith.contains(nap))
- {
- _colourwith.remove(nap);
- }
- }
-
/**
* pdb retrieval thread.
*/
{
if (frame instanceof AppJmol)
{
- if (((GStructureViewer) frame).isLinkedWith(apanel))
+ if (((StructureViewerBase) frame).isLinkedWith(apanel))
{
result.addElement(frame);
}
public void closeViewer()
{
jmb.closeViewer();
- ap = null;
+ setAlignmentPanel(null);
_aps.clear();
_alignwith.clear();
_colourwith.clear();
{
if (!jmb.isLoadingFromArchive())
{
- if (_colourwith.size() == 0 && ap != null)
+ if (_colourwith.size() == 0 && getAlignmentPanel() != null)
{
// Make the currently displayed alignment panel the associated view
- _colourwith.add(ap.alignFrame.alignPanel);
+ _colourwith.add(getAlignmentPanel().alignFrame.alignPanel);
}
}
// Set the colour using the current view for the associated alignframe
for (AlignmentPanel ap : _colourwith)
{
- jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap);
}
}
}
}
}
- protected void buildJmolActionMenu()
- {
- if (_alignwith == null)
- {
- _alignwith = new Vector<AlignmentPanel>();
- }
- if (_alignwith.size() == 0 && ap != null)
- {
- _alignwith.add(ap);
- }
- ;
- for (Component c : viewerActionMenu.getMenuComponents())
- {
- if (c != alignStructs)
- {
- viewerActionMenu.remove((JMenuItem) c);
- }
- }
- final ItemListener handler;
- }
-
/*
* (non-Javadoc)
*
private void alignStructs_withAllAlignPanels()
{
- if (ap == null)
+ if (getAlignmentPanel() == null)
{
return;
}
;
if (_alignwith.size() == 0)
{
- _alignwith.add(ap);
+ _alignwith.add(getAlignmentPanel());
}
;
try
return ap;
}
}
- return ap;
+ return getAlignmentPanel();
}
@Override