21import java.awt.Component;
22import java.awt.Dimension;
23import java.awt.FlowLayout;
24import java.awt.event.ActionEvent;
25import java.awt.event.ActionListener;
27import javax.swing.BoxLayout;
28import javax.swing.JComboBox;
29import javax.swing.JLabel;
30import javax.swing.JOptionPane;
31import javax.swing.JPanel;
32import javax.swing.JTextField;
33import javax.swing.SwingConstants;
35import denoptim.constants.DENOPTIMConstants;
36import denoptim.graph.APClass;
37import denoptim.graph.Edge.BondType;
56 (int) (
new JTextField()).getPreferredSize().getHeight();
63 +
"strings is:<br><br><code>rule"
64 + DENOPTIMConstants.SEPARATORAPPROPSCL
65 +
"subClass</code><br><br> where "
66 +
"<ul><li><code>rule</code>"
67 +
" is a string with no spaces</li>"
68 +
"<li><code>subClass</code> is "
69 +
"an integer</li></ul><br>";
84 super(refForPlacement);
85 setTitle(
"APClass Definition");
90 pnlAPCName =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
100 pnlAPC2BO =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
102 String tt =
"<html>Chose a type of bond to generate from "
103 +
"<br>attachment points belonging to this APClass.</html>";
119 this.
btnDone.setToolTipText(
"Confirm the definition of the APClass");
120 this.getRootPane().setDefaultButton(
btnDone);
121 for (ActionListener al : this.
btnDone.getActionListeners())
122 this.
btnDone.removeActionListener(al);
123 this.
btnDone.addActionListener(
new ActionListener() {
126 public void actionPerformed(ActionEvent e) {
130 String msg =
"<html>'" + currApClass +
"' is not a valid "
131 +
"string for making an APClass.<br>"
133 +
"Please, provide a valid string.</html>";
135 JOptionPane.showConfirmDialog(
btnDone, msg,
"Invalid Input",
136 JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
138 Object[] choice =
new Object[2];
139 choice[0] = currApClass;
147 this.
btnCanc.setEnabled(
false);
148 this.
btnCanc.setVisible(
false);
static boolean isValidAPClassString(String s)
Evaluate is a candidate string can be used as APClass.
static final BondType DEFAULTBT
Default bond type for all but APClasses of RCVs.
static final long serialVersionUID
Version UID.
GUIAPClassDefinitionDialog(Component refForPlacement, boolean askForBO)
final int preferredHeight
Default text field height.
final Dimension fileLabelSize
Default sizes for file pathname labels.
final Dimension strFieldSize
JComboBox< BondType > cmbAPC2BO
void setPreDefinedAPClass(String text)
Sets the content of the text field with the given predefined text.
JButton btnCanc
The button that is used to close the dialog without processing any input.
void addToCentralPane(JComponent comp)
Adds a component to the central part of this dialog frame.
JButton btnDone
The button that is used to launch the processing of the data given to the open dialog,...
Object result
The result to be returned once the dialog is closed.
void close()
Closes the dialog window.
Possible chemical bond types an edge can represent.