
com.actelion.research.gui.JBondQueryFeatureDialog Maven / Gradle / Ivy
/*
* Copyright (c) 1997 - 2016
* Actelion Pharmaceuticals Ltd.
* Gewerbestrasse 16
* CH-4123 Allschwil, Switzerland
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package com.actelion.research.gui;
import com.actelion.research.chem.ExtendedMolecule;
import com.actelion.research.chem.Molecule;
import info.clearthought.layout.TableLayout;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@Deprecated
public class JBondQueryFeatureDialog extends JDialog implements ActionListener {
static final long serialVersionUID = 0x20070822;
private ExtendedMolecule mMol;
private int mBond,mFirstSpanItem;
private JCheckBox mCBSingle,mCBDouble,mCBTriple,mCBDelocalized,mCBMetalLigand,mCBIsBridge,mCBMatchStereo;
private JComboBox mComboBoxRing,mComboBoxRingSize,mComboBoxMinAtoms,mComboBoxMaxAtoms;
protected JBondQueryFeatureDialog(Dialog parent, ExtendedMolecule mol, int bond) {
super(parent, (mol.isSelectedAtom(mol.getBondAtom(0, bond))
&& mol.isSelectedAtom(mol.getBondAtom(1, bond))) ?
"Multiple Bond Properties" : "Bond Properties", true);
init(parent, mol, bond);
}
protected JBondQueryFeatureDialog(Frame parent, ExtendedMolecule mol, int bond) {
super(parent, (mol.isSelectedAtom(mol.getBondAtom(0, bond))
&& mol.isSelectedAtom(mol.getBondAtom(1, bond))) ?
"Multiple Bond Properties" : "Bond Properties", true);
init(parent, mol, bond);
}
private void init(Component parent, ExtendedMolecule mol, int bond) {
mMol = mol;
mBond = bond;
JPanel p1 = new JPanel();
double[][] size = { {8, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, 8},
{8, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED, TableLayout.PREFERRED, 8,
TableLayout.PREFERRED, 8, TableLayout.PREFERRED, 8, TableLayout.PREFERRED, 16,
TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 16} };
p1.setLayout(new TableLayout(size));
mCBSingle = new JCheckBox("Single");
p1.add(mCBSingle,"1,1,3,1");
mCBDouble = new JCheckBox("Double");
p1.add(mCBDouble,"1,2,3,2");
mCBTriple = new JCheckBox("Triple");
p1.add(mCBTriple,"1,3,3,3");
mCBDelocalized = new JCheckBox("Delocalized");
p1.add(mCBDelocalized,"1,4,3,4");
mCBMetalLigand = new JCheckBox("Coordinate (0-order)");
p1.add(mCBMetalLigand,"1,5,3,5");
mComboBoxRing = new JComboBox();
mComboBoxRing.addItem("any ring state");
mComboBoxRing.addItem("is not in a ring");
mComboBoxRing.addItem("is any ring bond");
mComboBoxRing.addItem("is non-aromatic ring bond");
mComboBoxRing.addItem("is aromatic bond");
mComboBoxRing.addActionListener(this);
p1.add(mComboBoxRing,"1,7,3,7");
mComboBoxRingSize = new JComboBox();
mComboBoxRingSize.addItem("any ring size");
mComboBoxRingSize.addItem("is in 3-membered ring");
mComboBoxRingSize.addItem("is in 4-membered ring");
mComboBoxRingSize.addItem("is in 5-membered ring");
mComboBoxRingSize.addItem("is in 6-membered ring");
mComboBoxRingSize.addItem("is in 7-membered ring");
p1.add(mComboBoxRingSize, "1,9,3,9");
mCBMatchStereo = new JCheckBox("Match Stereo Configuration", (mol.getBondQueryFeatures(bond) & Molecule.cBondQFMatchStereo) != 0);
mCBMatchStereo.addActionListener(this);
p1.add(mCBMatchStereo, "1,11,3,11");
mCBIsBridge = new JCheckBox("Is atom bridge between");
mCBIsBridge.addActionListener(this);
p1.add(mCBIsBridge,"1,13,3,13");
mComboBoxMinAtoms = new JComboBox();
int itemCount = (1 << Molecule.cBondQFBridgeMinBits);
for (int i=0; i> Molecule.cBondQFRingSizeShift;
mComboBoxRingSize.setSelectedIndex((ringSize == 0) ? 0 : ringSize-2);
if ((queryFeatures & Molecule.cBondQFBridge) != 0) {
mCBIsBridge.setSelected(true);
int minAtoms = (queryFeatures & Molecule.cBondQFBridgeMin) >> Molecule.cBondQFBridgeMinShift;
int atomSpan = (queryFeatures & Molecule.cBondQFBridgeSpan) >> Molecule.cBondQFBridgeSpanShift;
mComboBoxMinAtoms.setSelectedIndex(minAtoms);
populateComboBoxMaxAtoms(minAtoms);
mComboBoxMaxAtoms.setSelectedIndex(atomSpan);
}
enableItems();
}
private int populateComboBoxMaxAtoms(int minAtoms) {
mComboBoxMaxAtoms.removeAllItems();
int itemCount = (1 << Molecule.cBondQFBridgeSpanBits);
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy