// Parameter parsing goes here
loadModelFromParam();
JChemPaintRendererModel rendererModel = theJcpp.get2DHub().getRenderer()
.getRenderer2DModel();
IChemModel chemModel = theJcpp.getChemModel();
IControllerModel controllerModel = theJcpp.get2DHub()
.getController2DModel();
String atomNumbers = getParameter("atomNumbersVisible");
if (atomNumbers != null) {
if (atomNumbers.equals("true"))
rendererModel.setDrawNumbers(true);
}
String background = getParameter("background");
if (background != null) {
if (background.indexOf("#") == 0)
rendererModel.setBackColor(Color.decode(background));
else
rendererModel.setBackColor(new Color(Integer
.parseInt(background)));
theJcpp.getRenderPanel()
.setBackground(rendererModel.getBackColor());
}
if (getParameter("compact") != null
&& getParameter("compact").equals("true")) {
rendererModel.setIsCompact(true);
}
if (getParameter("tooltips") != null) {
StringTokenizer st = new StringTokenizer(getParameter("tooltips"),
"|");
IAtomContainer container = theJcpp.getChemModel().getBuilder()
.newInstance(IAtomContainer.class);
Iterator<IAtomContainer> containers = ChemModelManipulator
.getAllAtomContainers(chemModel).iterator();
while (containers.hasNext()) {
IAtomContainer ac=containers.next();
container.add(ac);
}
while (st.hasMoreTokens()) {
IAtom atom = container
.getAtom(Integer.parseInt(st.nextToken()) - 1);
rendererModel.getToolTipTextMap().put(atom, st.nextToken());
}
rendererModel.setShowTooltip(true);
}
if (getParameter("dotranslate") != null
&& getParameter("dotranslate").equals("false")) {
GT.setDoTranslate(false);
}
if (getParameter("language") != null) {
GT.setLanguage(getParameter("language"));
theJcpp.updateMenusWithLanguage();
}
if (getParameter("debug") != null
&& getParameter("debug").equals("true")) {
this.debug = true;
}
if ( (getParameter("impliciths") == null) ||
(getParameter("impliciths") != null && getParameter("impliciths").equals("true"))
) {
controllerModel.setAutoUpdateImplicitHydrogens(true);
rendererModel.setShowImplicitHydrogens(true);
rendererModel.setShowEndCarbons(true);
} else {
controllerModel.setAutoUpdateImplicitHydrogens(false);
rendererModel.setShowImplicitHydrogens(false);
rendererModel.setShowEndCarbons(false);
if (chemModel != null) {
List<IAtomContainer> atomContainers = ChemModelManipulator