this(new String[]
{ file }, new String[]
{ id }, new SequenceI[][]
- { seq }, ap, true,true, loadStatus, bounds, viewid);
+ { seq }, ap, true, true, false, loadStatus, bounds, viewid);
}
ViewSelectionMenu seqColourBy;
* @param ids
* @param seqs
* @param ap
- * @param usetoColour - add the alignment panel to the list used for colouring these structures
- * @param useToAlign - add the alignment panel to the list used for aligning these structures
+ * @param usetoColour
+ * - add the alignment panel to the list used for colouring these
+ * structures
+ * @param useToAlign
+ * - add the alignment panel to the list used for aligning these
+ * structures
+ * @param leaveColouringToJmol
+ * - do not update the colours from any other source. Jmol is handling them
* @param loadStatus
* @param bounds
* @param viewid
*/
public AppJmol(String[] files, String[] ids, SequenceI[][] seqs,
- AlignmentPanel ap, boolean usetoColour,boolean useToAlign, String loadStatus, Rectangle bounds,
- String viewid)
+ AlignmentPanel ap, boolean usetoColour, boolean useToAlign, boolean leaveColouringToJmol,
+ String loadStatus, Rectangle bounds, String viewid)
{
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
}
// / TODO: check if protocol is needed to be set, and if chains are
// autodiscovered.
- jmb = new AppJmolBinding(this, pdbentrys, seqs, null, null);
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
jmb.setLoadingFromArchive(true);
addAlignmentPanel(ap);
{
useAlignmentPanelForSuperposition(ap);
}
+ if (leaveColouringToJmol || !usetoColour)
+ {
+ jmb.setColourBySequence(false);
+ seqColour.setSelected(false);
+ jmolColour.setSelected(true);
+ }
if (usetoColour)
{
useAlignmentPanelForColourbyseq(ap);
+ jmb.setColourBySequence(true);
+ seqColour.setSelected(true);
+ jmolColour.setSelected(false);
}
this.setBounds(bounds);
- jmb.setColourBySequence(false);
- seqColour.setSelected(false);
initMenus();
viewId = viewid;
// jalview.gui.Desktop.addInternalFrame(this, "Loading File",
initJmol(loadStatus); // pdbentry, seq, JBPCHECK!
}
- private void initMenus() {
+
+ private void initMenus()
+ {
+ seqColour.setSelected(jmb.isColourBySequence());
+ jmolColour.setSelected(!jmb.isColourBySequence());
+ if (_colourwith==null)
+ {
+ _colourwith=new Vector<AlignmentPanel>();
+ }
+ if (_alignwith==null)
+ {
+ _alignwith=new Vector<AlignmentPanel>();
+ }
+
seqColourBy = new ViewSelectionMenu("Colour by ..", this, _colourwith,
new ItemListener()
{
viewMenu.add(seqColourBy);
final ItemListener handler;
JMenu alpanels = new ViewSelectionMenu("Superpose with ..", this,
- _alignwith, handler=new ItemListener()
+ _alignwith, handler = new ItemListener()
{
@Override
jmolActionMenu.add(alpanels);
jmolActionMenu.addMenuListener(new MenuListener()
{
-
+
@Override
public void menuSelected(MenuEvent e)
{
handler.itemStateChanged(null);
}
-
+
@Override
public void menuDeselected(MenuEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void menuCanceled(MenuEvent e)
{
// TODO Auto-generated method stub
-
+
}
});
-
}
IProgressIndicator progressBar = null;
progressBar = ap.alignFrame;
// ////////////////////////////////
// Is the pdb file already loaded?
- String alreadyMapped = StructureSelectionManager
- .getStructureSelectionManager().alreadyMappedToFile(
+ String alreadyMapped = jmb.ssm.alreadyMappedToFile(
pdbentry.getId());
if (alreadyMapped != null)
if (option == JOptionPane.YES_OPTION)
{
- StructureSelectionManager.getStructureSelectionManager()
- .setMapping(seq, chains, alreadyMapped,
+ jmb.ssm.setMapping(seq, chains, alreadyMapped,
AppletFormatAdapter.FILE);
if (ap.seqPanel.seqCanvas.fr != null)
{
}
// /////////////////////////////////
- jmb = new AppJmolBinding(this, new PDBEntry[]
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
{ pdbentry }, new SequenceI[][]
{ seq }, null, null);
addAlignmentPanel(ap);
+ useAlignmentPanelForColourbyseq(ap);
+ jmb.setColourBySequence(true);
setSize(400, 400); // probably should be a configurable/dynamic default here
initMenus();
-
+
if (pdbentry.getFile() != null)
{
initJmol("load \"" + pdbentry.getFile() + "\"");
/**
* list of alignment panels to use for superposition
*/
- ArrayList<AlignmentPanel> _alignwith = new ArrayList();
+ Vector<AlignmentPanel> _alignwith = new Vector<AlignmentPanel>();
/**
* list of alignment panels that are used for colouring structures by aligned
* sequences
*/
- ArrayList<AlignmentPanel> _colourwith = new ArrayList();
+ Vector<AlignmentPanel> _colourwith = new Vector<AlignmentPanel>();
/**
* set the primary alignmentPanel reference and add another alignPanel to the
}
}
+ public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, boolean enableColourBySeq)
+ {
+ useAlignmentPanelForColourbyseq(nap);
+ jmb.setColourBySequence(enableColourBySeq);
+ seqColour.setSelected(enableColourBySeq);
+ jmolColour.setSelected(!enableColourBySeq);
+ }
public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
{
addAlignmentPanel(nap);
jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
null);
jmb.newJmolPopup(true, "Jmol", true);
+ if (command==null)
+ {
+ command="";
+ }
jmb.evalStateCommand(command);
jmb.setFinishedInit(true);
}
{
for (int pdbe = 0; pdbe < jmb.pdbentry.length; pdbe++)
{
- cap.appendText(StructureSelectionManager
- .getStructureSelectionManager().printMapping(
+ cap.appendText(jmb.printMapping(
jmb.pdbentry[pdbe].getFile()));
cap.appendText("\n");
}
im.writeImage();
}
}
-
+ public void jmolColour_actionPerformed(ActionEvent actionEvent)
+ {
+ if (jmolColour.isSelected()) {
+ // disable automatic sequence colouring.
+ jmb.setColourBySequence(false);
+ }
+ }
public void seqColour_actionPerformed(ActionEvent actionEvent)
{
jmb.setColourBySequence(seqColour.isSelected());
- if (_colourwith==null) { _colourwith=new ArrayList<AlignmentPanel>();};
- if (_colourwith.size()==0){ _colourwith.add(ap); };
-
- // Set the colour using the current view for the associated alignframe
- for (AlignmentPanel ap : _colourwith)
+ if (_colourwith == null)
{
- jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ _colourwith = new Vector<AlignmentPanel>();
+ }
+ if (jmb.isColourBySequence())
+ {
+ if (!jmb.isLoadingFromArchive())
+ {
+ if (_colourwith.size()==0 && ap!=null) {
+ // Make the currently displayed alignment panel the associated view
+ _colourwith.add(ap.alignFrame.alignPanel);
+ }
+ }
+ // Set the colour using the current view for the associated alignframe
+ for (AlignmentPanel ap : _colourwith)
+ {
+ jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ }
}
}
{
jmolActionMenu.setVisible(true);
}
- if (!jmb.isLoadingFromArchive()) {
+ if (!jmb.isLoadingFromArchive())
+ {
seqColour_actionPerformed(null);
}
}
protected void buildJmolActionMenu()
{
- if (_alignwith==null) { _alignwith=new ArrayList<AlignmentPanel>();}
- if (_alignwith.size()==0 && ap!=null) { _alignwith.add(ap);};
+ if (_alignwith == null)
+ {
+ _alignwith = new Vector<AlignmentPanel>();
+ }
+ if (_alignwith.size() == 0 && ap != null)
+ {
+ _alignwith.add(ap);
+ }
+ ;
for (Component c : jmolActionMenu.getMenuComponents())
{
if (c != alignStructs)
private void alignStructs_withAllAlignPanels()
{
- if (ap==null) { return; };
- if (_alignwith.size()==0) { _alignwith.add(ap);};
+ if (ap == null)
+ {
+ return;
+ }
+ ;
+ if (_alignwith.size() == 0)
+ {
+ _alignwith.add(ap);
+ }
+ ;
try
{
AlignmentI[] als = new Alignment[_alignwith.size()];
return (_colourwith != null) && _colourwith.contains(ap2);
}
+ /**
+ *
+ * @return TRUE if the view is NOT being coloured by sequence associations.
+ */
+ public boolean isColouredByJmol()
+ {
+ return !jmb.isColourBySequence();
+ }
+
+
}