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 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,
+ AlignmentPanel ap, boolean usetoColour, boolean useToAlign, boolean leaveColouringToJmol,
String loadStatus, Rectangle bounds, String viewid)
{
PDBEntry[] pdbentrys = new PDBEntry[files.length];
}
// / 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);
- } else {
- jmb.setColourBySequence(false);
- seqColour.setSelected(false);
- jmolColour.setSelected(true);
+ jmolColour.setSelected(false);
}
this.setBounds(bounds);
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()
{
}
});
- colourMenu.addMenuListener(new MenuListener()
- {
-
- @Override
- public void menuSelected(MenuEvent arg0)
- {
-
- handlingGuiEvents=true;
- }
-
- @Override
- public void menuDeselected(MenuEvent arg0)
- {
- handlingGuiEvents=false;
- }
-
- @Override
- public void menuCanceled(MenuEvent arg0)
- {
- handlingGuiEvents=false;
- }
- });
}
-
IProgressIndicator progressBar = null;
public AppJmol(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
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);
/**
* 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);
*/
private boolean _started = false;
- /**
- * state flag indicating if the GUI is active when a particular button event
- * takes place (e.g. when a stateChange occurs on a checkbox - this could be
- * programmatic or due to the user doing something)
- */
- private boolean handlingGuiEvents=false;
-
public void run()
{
_started = 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");
}
jmb.setColourBySequence(seqColour.isSelected());
if (_colourwith == null)
{
- _colourwith = new ArrayList<AlignmentPanel>();
+ _colourwith = new Vector<AlignmentPanel>();
}
if (jmb.isColourBySequence())
{
- if (!jmb.isLoadingFromArchive() && handlingGuiEvents)
+ if (!jmb.isLoadingFromArchive())
{
- if (ap!=null) {
- // Make the currently displayed alignment panel the associated view
- _colourwith.add(ap.alignFrame.alignPanel);
+ 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
{
if (_alignwith == null)
{
- _alignwith = new ArrayList<AlignmentPanel>();
+ _alignwith = new Vector<AlignmentPanel>();
}
if (_alignwith.size() == 0 && ap != null)
{
return (_colourwith != null) && _colourwith.contains(ap2);
}
+ /**
+ *
+ * @return TRUE if the view is NOT being coloured by sequence associations.
+ */
+ public boolean isColouredByJmol()
+ {
+ return !jmb.isColourBySequence();
+ }
+
+
}