User b6c0b36627
18-04-2013 22:05:52
Dear all,
I've been trying to generate the window that show the tautomers without any success.
I cannot understand what I'm doing wrong... I keep obtaining a nullpointer exception, and using the debugger seems that the field resultmolecules of the display is empty;
I honestly cannot find a way to load the molecules and finally obtain a display;
here's the code I'm using:
private void spawnTautomerSelection(){
TautomerizationPluginDisplay dsp=new TautomerizationPluginDisplay();
TautomerizationPlugin tauplugin=new TautomerizationPlugin();
dsp.setPlugin(tauplugin);
JSplitPane tautdisplay = new JSplitPane();
try {
tauplugin.setMolecule(jcpPanel.getMol());
} catch (PluginException e1) {
e1.printStackTrace();
}
int count = tauplugin.getStructureCount();
Molecule[] mollist={};
tauplugin.setDominantTautomerDistributionCalculation(true);
try {
tauplugin.run();
} catch (PluginException e) {
e.printStackTrace();
}
for (int i=0; i < count; ++i) {
Molecule tautomer = tauplugin.getStructure(i);
double distribution = tauplugin.getDominantTautomerDistribution(i);
System.out.println(tautomer.toFormat("smiles") + " " + distribution);
}
dsp.setTitle("Conformers");
Component comp = null;
Component comp1 = null;
try {
dsp.setCellIndex(0);
dsp.setParent(tautdisplay);
ParameterPanelHandler pn = dsp.getParameterPanel();
comp= pn.getComponent();//dsp.getResultComponent();
comp1=dsp.getResultComponent();
System.out.println ("done");
} catch (PluginException e2) {
e2.printStackTrace();
}
tautdisplay.setTopComponent(comp);
tautdisplay.setBottomComponent(comp1);
tautdisplay.setVisible(true);
}