$darkmode
DENOPTIM
denoptim.gui.ParametersForm Class Reference

General structure of a form for collecting input parameters of various nature. More...

Inheritance diagram for denoptim.gui.ParametersForm:
[legend]
Collaboration diagram for denoptim.gui.ParametersForm:
[legend]

Classes

class  CmbFieldChange
 
class  FieldListener
 
class  RdbFieldChange
 
class  TabFieldChange
 

Public Member Functions

 ParametersForm ()
 Empty constructor. More...
 
void importParametersFromDenoptimParamsFile (String fileName) throws Exception
 
void importSingleParameter (String key, String value) throws Exception
 
void putParametersToString (StringBuilder sb) throws Exception
 
boolean hasUnsavedChanges ()
 Returns the flag signaling unsaved changes. More...
 
void setUnsavedChanges (boolean val)
 Set the status of the flag signaling unsaved changes. More...
 
void showUnknownKeyWarning (Component parent, String paramType)
 Shown a warning dialog that informs the user about having found text that is not present in the ParametersForm implementation and is treated as free text. More...
 
void importParametersFromDenoptimParamsFile (String fileName) throws Exception
 
void importSingleParameter (String key, String value) throws Exception
 
void putParametersToString (StringBuilder sb) throws Exception
 
boolean hasUnsavedChanges ()
 
void setUnsavedChanges (boolean val)
 

Protected Member Functions

String getStringIfNotEmpty (String key, JTextField field, String prefix, String suffix)
 Produced the KEY:VALUE string for a general text field. More...
 
String getStringIfNotEmpty (String key, JEditorPane field, boolean multipleLines)
 Produced the KEY:VALUE string for a general text editor pane The text can include numbers, characters, or both. More...
 
String getStringIfNotEmpty (String key, JTextField field)
 Produced the KEY:VALUE string for a general text field. More...
 
String getStringForKVLine (String key, JSpinner spinner)
 Produced the KEY:VALUE string for a general spinner. More...
 
String getStringIfSelected (String key, JRadioButton btn)
 Produced the KEY:VALUE string for a on/off button. More...
 
String getStringFromTable (String key, JTable tab)
 Produced an overall string including one or more KEY:VALUE strings taken from a table. More...
 
String getStringFromTable (String key, JTable tab, boolean skipHeader)
 Produced an overall string including one or more KEY:VALUE strings taken from a table. More...
 
String getStringFromTable (String key, JTable tab, int[] fields, boolean skipHeader)
 Produced an overall string including one or more KEY:VALUE strings taken from a table. More...
 
String getStringFromTable (String key, JTable tab, int[] fields, String sep, boolean skipHeader)
 Produced an overall string including one or more KEY:VALUE strings taken from a table. More...
 
void importParametersFromDenoptimParamsFile (String fileName, String keyRoot) throws Exception
 Reads in the parameters from a text file collecting
DENOPTIM parameters in the form of KEY=VALUE lines. More...
 
void preliminatyTasksUponImportingParams ()
 Overwritten by subclasses. More...
 
void adaptVisibility ()
 Overwritten by subclasses. More...
 
void importParameterFromLine (String line) throws Exception
 
void addToUnformattedTxt (String key, String value)
 
JPanel getPanelForUnformattedInput ()
 
String getTextForUnformattedSettings ()
 
void clearUnformattedTxtArea ()
 

Protected Attributes

boolean unsavedChanges = false
 Flag notifying that some data was not saved. More...
 
FieldListener fieldListener
 Listener for changes in parameters of this form. More...
 
RdbFieldChange rdbFieldChange
 Listener for changes in radio button-bound parameters. More...
 
TabFieldChange tabFieldChange
 Listener for changes in table-bound parameters. More...
 
CmbFieldChange cmbFieldChange
 Listener for changes in combo box-bound parameters. More...
 
Map< String, Boolean > checkedFlags = new HashMap<String,Boolean>()
 Map of keyword to search for when reading a parameters file. More...
 
JTextArea txtUnformattedInput = new JTextArea(5,20)
 Storage of unformatted text for input files. More...
 
boolean foundCLIOnlyContent = false
 Flag recording we have imported text containing a line that is not interpreted as a GUI-controllable parameter. More...
 

Package Attributes

final Dimension fileLabelSize = new Dimension(250,28)
 Default sizes for file pathname labels. More...
 
final int preferredHeight
 Default text field height. More...
 
final Dimension fileFieldSize = new Dimension(350,preferredHeight)
 Default sizes for file pathname fields. More...
 
final Dimension strFieldSize = new Dimension(75,preferredHeight)
 Default sizes for short pathname fields (i.e., string or number) More...
 

Private Member Functions

void showPromptIfEmpty ()
 

Private Attributes

final String NL = System.getProperty("line.separator")
 The newline character. More...
 
final String UNSETUNFORMATTEDINPUTTXT
 
final Color UNSETUNFORMATTEDINPUTTXTCOLOR = Color.GRAY
 
final Color SETUNFORMATTEDINPUTTXTCOLOR = Color.BLACK
 

Static Private Attributes

static final long serialVersionUID = 3787855399355076733L
 Version. More...
 

Detailed Description

General structure of a form for collecting input parameters of various nature.

Author
Marco Foscato

Definition at line 67 of file ParametersForm.java.

Constructor & Destructor Documentation

◆ ParametersForm()

Member Function Documentation

◆ adaptVisibility()

void denoptim.gui.ParametersForm.adaptVisibility ( )
protected

Overwritten by subclasses.

Sets visibility of panels according to the current selections and field content.

Reimplemented in denoptim.gui.FitnessParametersForm.

Definition at line 490 of file ParametersForm.java.

Referenced by denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile().

Here is the caller graph for this function:

◆ addToUnformattedTxt()

◆ clearUnformattedTxtArea()

◆ getPanelForUnformattedInput()

JPanel denoptim.gui.ParametersForm.getPanelForUnformattedInput ( )
protected

Definition at line 657 of file ParametersForm.java.

References denoptim.gui.ParametersForm.showPromptIfEmpty(), denoptim.gui.ParametersForm.txtUnformattedInput, denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXT, and denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXTCOLOR.

Here is the call graph for this function:

◆ getStringForKVLine()

String denoptim.gui.ParametersForm.getStringForKVLine ( String  key,
JSpinner  spinner 
)
protected

Produced the KEY:VALUE string for a general spinner.

The text can include numbers, characters, or both.

Parameters
keythe keyword
fieldthe txt field
Returns
the KEY:VALUE string including newline character at the end.

Definition at line 250 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

Referenced by denoptim.gui.GAParametersForm.putParametersToString().

Here is the caller graph for this function:

◆ getStringFromTable() [1/4]

String denoptim.gui.ParametersForm.getStringFromTable ( String  key,
JTable  tab 
)
protected

Produced an overall string including one or more KEY:VALUE strings taken from a table.

By default this method takes as VALUE only the first field of the table.

Parameters
keythe keyword
tabthe table
Returns
the overall string including one or more KEY:VALUE string, and newline character at the end.

Definition at line 293 of file ParametersForm.java.

References denoptim.gui.ParametersForm.getStringFromTable().

Referenced by denoptim.gui.ParametersForm.getStringFromTable(), and denoptim.gui.FSParametersForm.putParametersToString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStringFromTable() [2/4]

String denoptim.gui.ParametersForm.getStringFromTable ( String  key,
JTable  tab,
boolean  skipHeader 
)
protected

Produced an overall string including one or more KEY:VALUE strings taken from a table.

By default this method takes as VALUE only the first field of the table.

Parameters
keythe keyword
tabthe table
skipHeaderuse true to ignore first row
Returns
the overall string including one or more KEY:VALUE string, and newline character at the end.

Definition at line 311 of file ParametersForm.java.

References denoptim.gui.ParametersForm.getStringFromTable().

Here is the call graph for this function:

◆ getStringFromTable() [3/4]

String denoptim.gui.ParametersForm.getStringFromTable ( String  key,
JTable  tab,
int[]  fields,
boolean  skipHeader 
)
protected

Produced an overall string including one or more KEY:VALUE strings taken from a table.

Parameters
keythe keyword
tabthe table
fieldsthe id (0, n-1) of the fields to use as space-separated values
skipHeaderuse true to ignore first row
Returns
the overall string including one or more KEY:VALUE string, and newline character at the end.

Definition at line 331 of file ParametersForm.java.

References denoptim.gui.ParametersForm.getStringFromTable().

Here is the call graph for this function:

◆ getStringFromTable() [4/4]

String denoptim.gui.ParametersForm.getStringFromTable ( String  key,
JTable  tab,
int[]  fields,
String  sep,
boolean  skipHeader 
)
protected

Produced an overall string including one or more KEY:VALUE strings taken from a table.

Parameters
keythe keyword
tabthe table
fieldsthe indexes (0, n-1) of the fields to use as separated VALUEs
sepstring separator for fields of a single VALUE
skipHeaderuse true to ignore first row
Returns
the overall string including one or more KEY:VALUE string, and newline character at the end.

Definition at line 352 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

◆ getStringIfNotEmpty() [1/3]

String denoptim.gui.ParametersForm.getStringIfNotEmpty ( String  key,
JEditorPane  field,
boolean  multipleLines 
)
protected

Produced the KEY:VALUE string for a general text editor pane The text can include numbers, characters, or both.

Parameters
keythe keyword
fieldthe txt editor
multipleLinesset to true to split the text into multiple KEY:VALUE lines (all with same KEY)
Returns
the KEY:VALUE string including newline character at the end.

Definition at line 199 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

◆ getStringIfNotEmpty() [2/3]

String denoptim.gui.ParametersForm.getStringIfNotEmpty ( String  key,
JTextField  field 
)
protected

Produced the KEY:VALUE string for a general text field.

The text can include numbers, characters, or both.

Parameters
keythe keyword
fieldthe txt field
Returns
the KEY:VALUE string including newline character at the end.

Definition at line 230 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

◆ getStringIfNotEmpty() [3/3]

String denoptim.gui.ParametersForm.getStringIfNotEmpty ( String  key,
JTextField  field,
String  prefix,
String  suffix 
)
protected

Produced the KEY:VALUE string for a general text field.

The text can include numbers, characters, or both.

Parameters
keythe keyword.
fieldthe txt field.
prefixstring to be put before the VALUE.
suffixstring to be put after the VALUE.
Returns
the KEY:VALUE string including newline character at the end.

Definition at line 175 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

Referenced by denoptim.gui.FitnessParametersForm.putParametersToString(), denoptim.gui.FSEParametersForm.putParametersToString(), denoptim.gui.FSParametersForm.putParametersToString(), denoptim.gui.GAParametersForm.putParametersToString(), and denoptim.gui.GUIPrepareFitnessRunner.InputForm.putParametersToString().

Here is the caller graph for this function:

◆ getStringIfSelected()

String denoptim.gui.ParametersForm.getStringIfSelected ( String  key,
JRadioButton  btn 
)
protected

Produced the KEY:VALUE string for a on/off button.

Parameters
keythe keyword
btnthe on/off button
Returns
the KEY:VALUE string including newline character at the end.

Definition at line 270 of file ParametersForm.java.

References denoptim.gui.ParametersForm.NL.

Referenced by denoptim.gui.FSParametersForm.putParametersToString(), and denoptim.gui.GAParametersForm.putParametersToString().

Here is the caller graph for this function:

◆ getTextForUnformattedSettings()

String denoptim.gui.ParametersForm.getTextForUnformattedSettings ( )
protected

◆ hasUnsavedChanges()

boolean denoptim.gui.ParametersForm.hasUnsavedChanges ( )

Returns the flag signaling unsaved changes.

Returns
the flag signaling unsaved changes

Implements denoptim.gui.IParametersForm.

Definition at line 535 of file ParametersForm.java.

References denoptim.gui.ParametersForm.unsavedChanges.

◆ importParameterFromLine()

void denoptim.gui.ParametersForm.importParameterFromLine ( String  line) throws Exception
protected

Definition at line 496 of file ParametersForm.java.

References denoptim.gui.ParametersForm.importSingleParameter().

Referenced by denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importParametersFromDenoptimParamsFile() [1/2]

void denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile ( String  fileName) throws Exception

◆ importParametersFromDenoptimParamsFile() [2/2]

void denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile ( String  fileName,
String  keyRoot 
) throws Exception
protected

Reads in the parameters from a text file collecting
DENOPTIM parameters in the form of KEY=VALUE lines.

Parameters
fileNamepathname to the parameters file
keyRootinitial part of keyword to select lines pertaining the present parameters set. For instance "GA-", "FSE-", etc.

Definition at line 401 of file ParametersForm.java.

References denoptim.gui.ParametersForm.adaptVisibility(), denoptim.gui.ParametersForm.checkedFlags, denoptim.files.FileUtils.checkExists(), denoptim.gui.ParametersForm.importParameterFromLine(), and denoptim.gui.ParametersForm.preliminatyTasksUponImportingParams().

Here is the call graph for this function:

◆ importSingleParameter()

void denoptim.gui.ParametersForm.importSingleParameter ( String  key,
String  value 
) throws Exception

Implements denoptim.gui.IParametersForm.

Reimplemented in denoptim.gui.FitnessParametersForm, denoptim.gui.FSEParametersForm, denoptim.gui.FSParametersForm, denoptim.gui.GAParametersForm, and denoptim.gui.GUIPrepareFitnessRunner.InputForm.

Definition at line 511 of file ParametersForm.java.

Referenced by denoptim.gui.ParametersForm.importParameterFromLine().

Here is the caller graph for this function:

◆ preliminatyTasksUponImportingParams()

void denoptim.gui.ParametersForm.preliminatyTasksUponImportingParams ( )
protected

Overwritten by subclasses.

Does any preliminary tasks, such as cleaning

Reimplemented in denoptim.gui.FitnessParametersForm.

Definition at line 480 of file ParametersForm.java.

Referenced by denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile().

Here is the caller graph for this function:

◆ putParametersToString()

void denoptim.gui.ParametersForm.putParametersToString ( StringBuilder  sb) throws Exception

◆ setUnsavedChanges()

void denoptim.gui.ParametersForm.setUnsavedChanges ( boolean  val)

Set the status of the flag signaling unsaved changes.

Parameters
valthe new status of the flag signaling unsaved changes

Implements denoptim.gui.IParametersForm.

Definition at line 548 of file ParametersForm.java.

References denoptim.gui.ParametersForm.unsavedChanges.

◆ showPromptIfEmpty()

void denoptim.gui.ParametersForm.showPromptIfEmpty ( )
private

Definition at line 709 of file ParametersForm.java.

References denoptim.gui.ParametersForm.SETUNFORMATTEDINPUTTXTCOLOR, denoptim.gui.ParametersForm.txtUnformattedInput, denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXT, and denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXTCOLOR.

Referenced by denoptim.gui.ParametersForm.getPanelForUnformattedInput().

Here is the caller graph for this function:

◆ showUnknownKeyWarning()

void denoptim.gui.ParametersForm.showUnknownKeyWarning ( Component  parent,
String  paramType 
)

Shown a warning dialog that informs the user about having found text that is not present in the ParametersForm implementation and is treated as free text.

Parameters
parentcomponent used to place the dialog on screen.
paramTypethe kind of parameter collector.

Definition at line 618 of file ParametersForm.java.

References denoptim.constants.DENOPTIMConstants.EOL, denoptim.gui.ParametersForm.foundCLIOnlyContent, and denoptim.gui.ParametersForm.txtUnformattedInput.

Referenced by denoptim.gui.FitnessParametersForm.importParametersFromDenoptimParamsFile(), denoptim.gui.FSEParametersForm.importParametersFromDenoptimParamsFile(), denoptim.gui.FSParametersForm.importParametersFromDenoptimParamsFile(), denoptim.gui.GAParametersForm.importParametersFromDenoptimParamsFile(), and denoptim.gui.GUIPrepareFitnessRunner.InputForm.importParametersFromDenoptimParamsFile().

Here is the caller graph for this function:

Member Data Documentation

◆ checkedFlags

Map<String,Boolean> denoptim.gui.ParametersForm.checkedFlags = new HashMap<String,Boolean>()
protected

Map of keyword to search for when reading a parameters file.

This is NOT a list of what will be read, but map of whether each given keyword is found (at the beginning of a line) in the parameters file, or not.

Definition at line 131 of file ParametersForm.java.

Referenced by denoptim.gui.GAParametersForm.importParametersFromDenoptimParamsFile(), and denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile().

◆ cmbFieldChange

CmbFieldChange denoptim.gui.ParametersForm.cmbFieldChange
protected

◆ fieldListener

◆ fileFieldSize

◆ fileLabelSize

final Dimension denoptim.gui.ParametersForm.fileLabelSize = new Dimension(250,28)
package

◆ foundCLIOnlyContent

boolean denoptim.gui.ParametersForm.foundCLIOnlyContent = false
protected

Flag recording we have imported text containing a line that is not interpreted as a GUI-controllable parameter.

Definition at line 142 of file ParametersForm.java.

Referenced by denoptim.gui.ParametersForm.addToUnformattedTxt(), and denoptim.gui.ParametersForm.showUnknownKeyWarning().

◆ NL

final String denoptim.gui.ParametersForm.NL = System.getProperty("line.separator")
private

◆ preferredHeight

◆ rdbFieldChange

RdbFieldChange denoptim.gui.ParametersForm.rdbFieldChange
protected

Listener for changes in radio button-bound parameters.

Definition at line 114 of file ParametersForm.java.

Referenced by denoptim.gui.FSParametersForm.FSParametersForm(), denoptim.gui.GAParametersForm.GAParametersForm(), and denoptim.gui.ParametersForm.ParametersForm().

◆ serialVersionUID

final long denoptim.gui.ParametersForm.serialVersionUID = 3787855399355076733L
staticprivate

Version.

Definition at line 73 of file ParametersForm.java.

◆ SETUNFORMATTEDINPUTTXTCOLOR

final Color denoptim.gui.ParametersForm.SETUNFORMATTEDINPUTTXTCOLOR = Color.BLACK
private

◆ strFieldSize

final Dimension denoptim.gui.ParametersForm.strFieldSize = new Dimension(75,preferredHeight)
package

Default sizes for short pathname fields (i.e., string or number)

Definition at line 94 of file ParametersForm.java.

Referenced by denoptim.gui.FSEParametersForm.FSEParametersForm(), denoptim.gui.FSParametersForm.FSParametersForm(), and denoptim.gui.GAParametersForm.GAParametersForm().

◆ tabFieldChange

TabFieldChange denoptim.gui.ParametersForm.tabFieldChange
protected

Listener for changes in table-bound parameters.

Definition at line 119 of file ParametersForm.java.

Referenced by denoptim.gui.FSParametersForm.FSParametersForm(), and denoptim.gui.ParametersForm.ParametersForm().

◆ txtUnformattedInput

◆ unsavedChanges

◆ UNSETUNFORMATTEDINPUTTXT

final String denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXT
private

◆ UNSETUNFORMATTEDINPUTTXTCOLOR

final Color denoptim.gui.ParametersForm.UNSETUNFORMATTEDINPUTTXTCOLOR = Color.GRAY
private

The documentation for this class was generated from the following file: