21import java.awt.BorderLayout;
22import java.awt.Dimension;
23import java.awt.FlowLayout;
24import java.awt.event.ActionEvent;
25import java.awt.event.ActionListener;
26import java.util.HashMap;
29import javax.swing.BoxLayout;
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.JTextField;
39import javax.swing.SwingConstants;
40import javax.swing.UIManager;
41import javax.swing.table.DefaultTableModel;
139 String
NL = System.getProperty(
"line.separator");
147 this.setLayout(
new BorderLayout());
149 block =
new JPanel();
150 JScrollPane scrollablePane =
new JScrollPane(
block);
151 block.setLayout(
new BoxLayout(
block, SwingConstants.VERTICAL));
165 String toolTipSrcOrNew =
"Tick here to use settings from file.";
166 lineSrcOrNew =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
167 rdbSrcOrNew =
new JRadioButton(
"Use parameters from existing file");
169 rdbSrcOrNew.addActionListener(
new ActionListener(){
170 public void actionPerformed(ActionEvent e){
188 String toolTipFSESource =
"<html>Pathname of a DENOPTIM's parameter file with FSE settings.</html>";
190 lblFSESource =
new JLabel(
"Use parameters from file:", SwingConstants.LEFT);
197 public void actionPerformed(ActionEvent e) {
203 txtFSESource.setToolTipText(
"<html>Specify the file containing the "
204 +
"parameters to be loaded in this form.</html>");
206 public void actionPerformed(ActionEvent e) {
213 if (e1.getMessage().equals(
"") || e1.getMessage() ==
null)
215 e1.printStackTrace();
217 "<html>Exception occurred while importing parameters.<br>Please, report this to the DENOPTIM team.</html>",
219 JOptionPane.ERROR_MESSAGE,
220 UIManager.getIcon(
"OptionPane.errorIcon"));
227 JOptionPane.ERROR_MESSAGE,
228 UIManager.getIcon(
"OptionPane.errorIcon"));
240 String toolTipPar2 =
"<html>Specifies up to which level we'll add layers of fragments.<br>Note that the root (i.e., scaffold or root graph) is assigned <code>level = -1</code>.<br>Therefore, if the maximum level permitted is 3, then we will try to append <br>up to 4 layers of fragments (levels = 0, 1, 2, and 3).</html>";
241 linePar2 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
242 lblPar2 =
new JLabel(
"Maximum level number to consider:", SwingConstants.LEFT);
244 lblPar2.setToolTipText(toolTipPar2);
246 txtPar2.setToolTipText(toolTipPar2);
254 String toolTipPar7 =
"<html>Specifies the number of asynchronous processes that can be <br>run in parallel. Usually this number corresponds to the number of slave cores,<br>i.e., one slave core corresponds to 1 external task.</html>";
255 linePar7 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
256 lblPar7 =
new JLabel(
"Mas. number parallel tasks:", SwingConstants.LEFT);
258 lblPar7.setToolTipText(toolTipPar7);
260 txtPar7.setToolTipText(toolTipPar7);
268 String toolTipPar3 =
"Specifies the pathname of the file with unique chemical entity ID.";
269 linePar3 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
270 lblPar3 =
new JLabel(
"File with known UIDs:", SwingConstants.LEFT);
272 lblPar3.setToolTipText(toolTipPar3);
274 txtPar3.setToolTipText(toolTipPar3);
278 btnPar3 =
new JButton(
"Browse");
279 btnPar3.addActionListener(
new ActionListener() {
280 public void actionPerformed(ActionEvent e) {
289 String toolTipPar9 =
"Specifies the pathname of a file containing the list of graphs that will be expanded.";
290 linePar9 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
291 lblPar9 =
new JLabel(
"Library of root graphs:", SwingConstants.LEFT);
293 lblPar9.setToolTipText(toolTipPar9);
295 txtPar9.setToolTipText(toolTipPar9);
299 btnPar9 =
new JButton(
"Browse");
300 btnPar9.addActionListener(
new ActionListener() {
301 public void actionPerformed(ActionEvent e) {
315 String toolTipPar8 =
"Specifies the verbosity level.";
316 linePar8 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
317 lblPar8 =
new JLabel(
"Logging level:", SwingConstants.LEFT);
319 lblPar8.setToolTipText(toolTipPar8);
321 txtPar8.setToolTipText(toolTipPar8);
329 String toolTipPar1 =
"Specifies the pathname of the directory where files will be created";
330 linePar1 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
331 lblPar1 =
new JLabel(
"Work space:", SwingConstants.LEFT);
333 lblPar1.setToolTipText(toolTipPar1);
335 txtPar1.setToolTipText(toolTipPar1);
339 btnPar1 =
new JButton(
"Browse");
340 btnPar1.addActionListener(
new ActionListener() {
341 public void actionPerformed(ActionEvent e) {
350 String toolTipPar4 =
"Specifies the pathname to the root of the folder tree of generated graphs.";
351 linePar4 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
352 lblPar4 =
new JLabel(
"Location of DENOPTIMGraph database:", SwingConstants.LEFT);
354 lblPar4.setToolTipText(toolTipPar4);
356 txtPar4.setToolTipText(toolTipPar4);
360 btnPar4 =
new JButton(
"Browse");
361 btnPar4.addActionListener(
new ActionListener() {
362 public void actionPerformed(ActionEvent e) {
371 String toolTipPar5 =
"Specifies the wall time limit (in seconds) for completion of one or more tasks. Accepts only integer number";
372 linePar5 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
373 lblPar5 =
new JLabel(
"Max. time for fitness evaluation:", SwingConstants.LEFT);
375 lblPar5.setToolTipText(toolTipPar5);
377 txtPar5.setToolTipText(toolTipPar5);
385 String toolTipPar6 =
"<html>Specifies the sleeping time (or time step, in seconds) between <br>checks for completion of one or more tasks. Accepts only integer number<html>";
386 linePar6 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
387 lblPar6 =
new JLabel(
"Time between checks for completion:", SwingConstants.LEFT);
389 lblPar6.setToolTipText(toolTipPar6);
391 txtPar6.setToolTipText(toolTipPar6);
399 String toolTipPar11 =
"<html>Specifies to update the checkpoint information every # generated graphs.</html>";
400 linePar11 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
401 lblPar11 =
new JLabel(
"Make checkpoint every # graphs:", SwingConstants.LEFT);
403 lblPar11.setToolTipText(toolTipPar11);
405 txtPar11.setToolTipText(toolTipPar11);
413 String toolTipPar12 =
"<html>Specifies the pathname of the checkpoint file, <br> and makes FragSpaceExplorer restart from such file.</html>";
414 linePar12 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
415 lblPar12 =
new JLabel(
"Restart from checkpoint file: ", SwingConstants.LEFT);
417 lblPar12.setToolTipText(toolTipPar12);
419 txtPar12.setToolTipText(toolTipPar12);
424 btnPar12.addActionListener(
new ActionListener() {
425 public void actionPerformed(ActionEvent e) {
436 JButton advOptShow =
new JButton(
"Advanced Settings");
437 advOptShow.addActionListener(
new ActionListener(){
438 public void actionPerformed(ActionEvent e){
442 advOptShow.setText(
"Show Advanced Settings");
447 advOptShow.setText(
"Hide Advanced Settings");
448 scrollablePane.validate();
449 scrollablePane.repaint();
450 scrollablePane.getVerticalScrollBar().setValue(
451 scrollablePane.getVerticalScrollBar().getValue() + (
int)
preferredHeight*2/3);
456 JPanel advOptsController =
new JPanel();
457 advOptsController.add(advOptShow);
462 block.add(super.getPanelForUnformattedInput());
464 this.add(scrollablePane);
494 @SuppressWarnings(
"unchecked")
499 String valueFieldClass;
503 valueFieldClass = valueField.getClass().toString();
511 switch (valueFieldClass)
513 case "class javax.swing.JTextField":
514 ((JTextField) valueField).setText(value);
517 case "class javax.swing.JRadioButton":
518 ((JRadioButton) valueField).setSelected(
true);
521 case "class javax.swing.JComboBox":
522 ((JComboBox<String>) valueField).setSelectedItem(value);
525 case "class javax.swing.table.DefaultTableModel":
529 ((DefaultTableModel) valueField).addRow(value.split(
" "));
533 throw new Exception(
"<html>Unexpected type for parameter: "
534 + key +
" (" + valueFieldClass
535 +
").<br>Please report this to"
536 +
"the DEMOPTIM team.</html>");
546 sb.append(
"# FragSpaceExplorer - parameters").append(
NL);
552 throw new Exception(
"<html>No source specified for FSE parameters.<br>Please, specify the file name.</html>");
File opener for DENOPTIM GUI.
static File pickFolderForTxtField(JTextField txtField, Component parent)
static File pickFileForTxtField(JTextField txtField, Component parent)