21import java.awt.Component;
22import java.awt.Dimension;
23import java.awt.FlowLayout;
24import java.awt.event.ActionEvent;
25import java.awt.event.ActionListener;
26import java.util.Arrays;
28import javax.swing.BoxLayout;
29import javax.swing.GroupLayout;
30import javax.swing.JButton;
31import javax.swing.JComboBox;
32import javax.swing.JLabel;
33import javax.swing.JOptionPane;
34import javax.swing.JPanel;
35import javax.swing.JRadioButton;
36import javax.swing.JScrollPane;
37import javax.swing.JSeparator;
38import javax.swing.JTable;
39import javax.swing.JTextField;
40import javax.swing.SwingConstants;
41import javax.swing.UIManager;
42import javax.swing.table.DefaultTableModel;
44import denoptim.exception.DENOPTIMException;
45import denoptim.files.FileUtils;
46import denoptim.gui.GUIPreferences.SMITo3DEngine;
65 (int) (
new JTextField()).getPreferredSize().getHeight();
123 @SuppressWarnings(
"serial")
126 super(refForPlacement);
127 setTitle(
"Preferences");
129 JScrollPane scrollablePane =
new JScrollPane(
centralPanel);
133 JPanel titleGeneral =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
134 titleGeneral.add(
new JLabel(
"<html><b>General</b></html>"));
137 pnlTmpSpace =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
148 JPanel titleFragments =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
149 titleFragments.add(
new JLabel(
"<html><b>Handling of fragments</b></html>"));
158 public void actionPerformed(ActionEvent e) {
171 JPanel titleGraphViewer =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
172 titleGraphViewer.add(
new JLabel(
"<html><b>Graph visualization</b></html>"));
195 JPanel titleMolViewer =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
196 titleMolViewer.add(
new JLabel(
"<html><b>Candidate item visualization</b></html>"));
199 String toolTipPropTags =
"</html>Customizes the list of properties displayed togetther with the chemical representation of an item.</html>";
200 linePropTags =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
201 lblPropTags =
new JLabel(
"Additional properties to display:", SwingConstants.LEFT);
206 public boolean isCellEditable(
int row,
int column) {
216 tabPropTags.putClientProperty(
"terminateEditOnFocusLost", Boolean.TRUE);
218 btnPropTagsInsert.setToolTipText(
"Click to add the reference name or SDF tag of the desired property.");
220 public void actionPerformed(ActionEvent e){
221 String propName = (String)JOptionPane.showInputDialog(
223 "Specify the reference name or SDF tag of the "
224 +
"desired property",
225 "Specify Property Name",
226 JOptionPane.PLAIN_MESSAGE);
228 if ((propName !=
null) && (propName.length() > 0)
239 public void actionPerformed(ActionEvent e){
244 int selectedRowIds[] =
tabPropTags.getSelectedRows();
245 Arrays.sort(selectedRowIds);
246 for (
int i=(selectedRowIds.length-1); i>-1; i--)
249 selectedRowIds[i], 0).toString();
257 GroupLayout grpLyoPropTags =
new GroupLayout(
linePropTags);
259 grpLyoPropTags.setAutoCreateGaps(
true);
260 grpLyoPropTags.setAutoCreateContainerGaps(
true);
261 grpLyoPropTags.setHorizontalGroup(grpLyoPropTags.createSequentialGroup()
263 .addGroup(grpLyoPropTags.createParallelGroup()
264 .addGroup(grpLyoPropTags.createSequentialGroup()
269 grpLyoPropTags.setVerticalGroup(grpLyoPropTags.createParallelGroup(
270 GroupLayout.Alignment.LEADING)
272 .addGroup(grpLyoPropTags.createSequentialGroup()
273 .addGroup(grpLyoPropTags.createParallelGroup()
282 JPanel titleEvolutionPlots =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
283 titleEvolutionPlots.add(
new JLabel(
"<html><b>Evolution run plots</b></html>"));
309 this.
btnDone.setToolTipText(
"Save the values and close dialog");
310 this.
btnDone.addActionListener(
new ActionListener() {
313 public void actionPerformed(ActionEvent e) {
323 this.
btnCanc.setEnabled(
false);
324 this.
btnCanc.setVisible(
false);
326 super.addToCentralPane(scrollablePane);
345 Integer.parseInt(field.getText());
346 }
catch (Exception e) {
348 JOptionPane.showMessageDialog(
this,
349 "<html>Unacceptable value for '" + name +
"'<br>"
350 +
"<br>The value should be an integer.</html>",
352 JOptionPane.ERROR_MESSAGE,
353 UIManager.getIcon(
"OptionPane.errorIcon"));
361 String testFileName = field.getText()
362 + System.getProperty(
"file.separator")
367 JOptionPane.showMessageDialog(
this,
368 "<html>Unacceptable value for '" + name +
"'<br>"
369 +
"<br>The pathname should be readable and writable.</html>",
371 JOptionPane.ERROR_MESSAGE,
372 UIManager.getIcon(
"OptionPane.errorIcon"));
385 GUIPreferences.graphLabelFontSize =
387 GUIPreferences.graphNodeSize =
389 GUIPreferences.chartPointSize =
static boolean canWriteAndReadTo(String pathName)
Check whether we can write and read to a given pathname.
static void deleteFile(String fileName)
Delete the file.
JButton btnCanc
The button that is used to close the dialog without processing any input.
JButton btnDone
The button that is used to launch the processing of the data given to the open dialog,...
void close()
Closes the dialog window.
static final long serialVersionUID
Version UID.
JTextField txtChartPointSize
DefaultTableModel tabModPropTags
final Dimension fileLabelSize
Default sizes for file pathname labels.
void mustParseToInt(JTextField field, String name)
void pathMustBeReadableWritable(JTextField field, String name)
JRadioButton rcbEvoChartLegend
JRadioButton rcbMntChartLegend
JButton btnPropTagsCleanup
final Dimension strFieldSize
Default sizes for short pathname fields (i.e., string or number)
JTextField txtGraphTxtSize
final int preferredHeight
Default text field height.
JButton btnPropTagsInsert
JComboBox< SMITo3DEngine > cmbSMILESTo3D
JTextField txtGraphNodeSize
The collection of tunable preferences.
static String tmpSpace
Readable/writable space for tmp files.
static boolean showLegenInMonitorPlot
Choice of displaying legend in monitor plot.
static int graphNodeSize
Graph visualization: size of nodes.
static boolean showLegenInEvolutionPlot
Choice of displaying legend in evolution plot.
static int graphLabelFontSize
Graph visualization: font size of labels.
static TreeSet< String > chosenSDFTags
MolecularViewer: list of SDF tags specifying which properties to display.
static int chartPointSize
Evolutionary Inspector: size of points.
static SMITo3DEngine smiTo3dResolver
Selects the engine used to do SMILES-to-3D conversion.
Available engines used to do SMILES-to-3D conversion.