this(new String[]
{ file }, new String[]
{ id }, new SequenceI[][]
- { seq }, ap, true,true, loadStatus, bounds, viewid);
+ { seq }, ap, true, true, 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 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,
+ String loadStatus, Rectangle bounds, String viewid)
{
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
if (usetoColour)
{
useAlignmentPanelForColourbyseq(ap);
+ jmb.setColourBySequence(true);
+ seqColour.setSelected(true);
+ } else {
+ jmb.setColourBySequence(false);
+ seqColour.setSelected(false);
+ jmolColour.setSelected(true);
}
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());
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
+
+ }
+ });
+ 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,
{ 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() + "\"");
jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
null);
jmb.newJmolPopup(true, "Jmol", true);
+ if (command==null)
+ {
+ command="";
+ }
jmb.evalStateCommand(command);
jmb.setFinishedInit(true);
}
*/
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;
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)
+ {
+ _colourwith = new ArrayList<AlignmentPanel>();
+ }
+ if (jmb.isColourBySequence())
{
- jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ if (!jmb.isLoadingFromArchive() && handlingGuiEvents)
+ {
+ if (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 ArrayList<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()];
backGround_actionPerformed(actionEvent);
}
});
- seqColour.setSelected(true);
+ seqColour.setSelected(false);
seqColour.setText("By Sequence");
seqColour.addActionListener(new ActionListener()
{
userColour_actionPerformed(actionEvent);
}
});
+ jmolColour.setSelected(false);
+ jmolColour.setText("Colour with Jmol");
+ jmolColour.setToolTipText("Let Jmol manage structure colours.");
+ jmolColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ jmolColour_actionPerformed(actionEvent);
+ }
+ }
+ );
helpMenu.setText("Help");
jmolHelp.setText("Jmol Help");
jmolHelp.addActionListener(new ActionListener()
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(userColour);
+ colourMenu.add(jmolColour);
colourMenu.add(backGround);
colourButtons.add(seqColour);
colourButtons.add(turnColour);
colourButtons.add(buriedColour);
colourButtons.add(userColour);
+ colourButtons.add(jmolColour);
helpMenu.add(jmolHelp);
jmolActionMenu.add(alignStructs);
}
+ protected void jmolColour_actionPerformed(ActionEvent actionEvent)
+ {
+ }
+
protected void alignStructs_actionPerformed(ActionEvent actionEvent)
{
}
JMenu jMenu1 = new JMenu();
- JMenu colourMenu = new JMenu();
+ protected JMenu colourMenu = new JMenu();
protected JMenu jmolActionMenu = new JMenu();
protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem jmolColour = new JRadioButtonMenuItem();
+
protected ButtonGroup colourButtons = new ButtonGroup();
JMenu helpMenu = new JMenu();