use of com.actelion.research.share.gui.editor.geom.GeomFactory in project openchemlib by Actelion.
the class AtomHighlightAction method onKeyPressed.
@Override
public boolean onKeyPressed(IKeyEvent evt) {
GeomFactory factory = model.getGeomFactory();
if (evt.getCode().equals(factory.getDeleteKey())) {
int theAtom = model.getSelectedAtom();
StereoMolecule mol = model.getMolecule();
if (theAtom != -1) {
mol.deleteAtom(theAtom);
setHighlightAtom(mol, -1);
return true;
} else {
boolean update = false;
StereoMolecule m = model.getMolecule();
if (m.deleteSelectedAtoms()) {
update = true;
}
return update;
}
} else if (handleCharacter(evt)) {
return true;
}
return false;
}
use of com.actelion.research.share.gui.editor.geom.GeomFactory in project openchemlib by Actelion.
the class AtomMapAction method onKeyPressed.
// @Override
// public boolean onMouseDown(ACTMouseEvent evt)
// {
// origin = new Point2D.Double(evt.getX(),evt.getY());
// return super.onMouseDown(evt);
// }
@Override
public boolean onKeyPressed(IKeyEvent evt) {
GeomFactory builder = model.getGeomFactory();
if (evt.getCode().equals(builder.getDeleteKey())) {
StereoMolecule mMol = model.getMolecule();
boolean found = false;
for (int atom = 0; atom < mMol.getAllAtoms(); atom++) {
if (mMol.getAtomMapNo(atom) != 0) {
mMol.setAtomMapNo(atom, 0, false);
found = true;
}
}
return found;
}
return super.onKeyPressed(evt);
}
use of com.actelion.research.share.gui.editor.geom.GeomFactory in project openchemlib by Actelion.
the class BondHighlightAction method onKeyPressed.
@Override
public boolean onKeyPressed(IKeyEvent evt) {
int theBond = model.getSelectedBond();
GeomFactory factory = model.getGeomFactory();
StereoMolecule mol = model.getMolecule();
if (mol != null) {
if (evt.getCode().equals(factory.getDeleteKey())) {
if (theBond != -1) {
mol.deleteBondAndSurrounding(theBond);
setHighlightBond(mol, -1);
return true;
}
} else {
if (handleCharacter(evt.getText())) {
return true;
}
}
}
return super.onKeyPressed(evt);
}
use of com.actelion.research.share.gui.editor.geom.GeomFactory in project openchemlib by Actelion.
the class ChangeAtomPropertiesAction method onMouseUp.
@Override
public boolean onMouseUp(IMouseEvent evt) {
model.pushUndo();
int theAtom = model.getSelectedAtom();
StereoMolecule mol = model.getMolecule();
if (mol != null && theAtom != -1) {
GeomFactory builder = model.getGeomFactory();
IAtomPropertiesDialog dlg = builder.createAtomPropertiesDialog(mol, theAtom);
if (dlg.doModalAt(evt.getX(), evt.getY()) == DialogResult.IDOK) {
return true;
}
}
return false;
}
Aggregations