aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/settings
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2014-10-10 13:22:16 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2014-10-10 13:22:16 +0200
commite145523a2ae686dd2a2ae7996639e6e8d14d992a (patch)
tree3ffaa3c13fc48f3c58b72a53bb6a6ca41bcf96da /src/jcgp/gui/settings
parent952b6d502da5896b59ffecdb5fa6f9c56458a02c (diff)
Moved constants to a separate file, added a formal README
Diffstat (limited to 'src/jcgp/gui/settings')
-rw-r--r--src/jcgp/gui/settings/SettingsPane.java9
-rw-r--r--src/jcgp/gui/settings/parameters/GUIBooleanParameter.java7
-rw-r--r--src/jcgp/gui/settings/parameters/GUIDoubleParameter.java9
-rw-r--r--src/jcgp/gui/settings/parameters/GUIIntegerParameter.java9
-rw-r--r--src/jcgp/gui/settings/parameters/GUIParameter.java8
5 files changed, 19 insertions, 23 deletions
diff --git a/src/jcgp/gui/settings/SettingsPane.java b/src/jcgp/gui/settings/SettingsPane.java
index c59244b..bad42cd 100644
--- a/src/jcgp/gui/settings/SettingsPane.java
+++ b/src/jcgp/gui/settings/SettingsPane.java
@@ -26,6 +26,7 @@ import jcgp.backend.modules.problem.Problem;
import jcgp.backend.modules.problem.TestCaseProblem;
import jcgp.backend.parameters.Parameter;
import jcgp.gui.GUI;
+import jcgp.gui.constants.Constants;
import jcgp.gui.settings.parameters.GUIParameter;
import jcgp.gui.settings.testcase.TestCaseTable;
@@ -79,10 +80,10 @@ public class SettingsPane extends AnchorPane {
// make the overarching container
mainContainer = new VBox(8);
- mainContainer.setPadding(new Insets(5, GUI.RESIZE_MARGIN, 0, 2));
+ mainContainer.setPadding(new Insets(5, Constants.RESIZE_MARGIN, 0, 2));
- setMinWidth(GUI.SETTINGS_MIN_WIDTH);
- setPrefWidth(GUI.SETTINGS_MIN_WIDTH);
+ setMinWidth(Constants.SETTINGS_MIN_WIDTH);
+ setPrefWidth(Constants.SETTINGS_MIN_WIDTH);
// initialise all sub-divisions
initialiseBaseParameters(jcgp);
@@ -105,7 +106,7 @@ public class SettingsPane extends AnchorPane {
AnchorPane.setTopAnchor(scroll, 0.0);
AnchorPane.setBottomAnchor(scroll, 0.0);
AnchorPane.setRightAnchor(scroll, 0.0);
- AnchorPane.setLeftAnchor(scroll, GUI.RESIZE_MARGIN);
+ AnchorPane.setLeftAnchor(scroll, Constants.RESIZE_MARGIN);
// add the scroll pane, all done!
getChildren().add(scroll);
diff --git a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
index a13a52b..a1f03fe 100644
--- a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
@@ -6,6 +6,7 @@ import javafx.scene.control.CheckBox;
import javafx.scene.control.Control;
import jcgp.backend.parameters.BooleanParameter;
import jcgp.backend.parameters.ParameterStatus;
+import jcgp.gui.constants.Constants;
import jcgp.gui.settings.SettingsPane;
/**
@@ -59,16 +60,16 @@ public class GUIBooleanParameter extends GUIParameter<Boolean> {
protected void setValidityStyle() {
// update the Control's style and tooltip based on the status of the parameter
if (parameter.getStatus() == ParameterStatus.INVALID) {
- checkBox.setStyle(BASE_CHECKBOX_STYLE + INVALID_PARAMETER_STYLE);
+ checkBox.setStyle(Constants.BASE_CHECKBOX_STYLE + Constants.INVALID_PARAMETER_STYLE);
checkBox.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else if (parameter.getStatus() == ParameterStatus.WARNING
|| parameter.getStatus() == ParameterStatus.WARNING_RESET) {
- checkBox.setStyle(BASE_CHECKBOX_STYLE + WARNING_PARAMETER_STYLE);
+ checkBox.setStyle(Constants.BASE_CHECKBOX_STYLE + Constants.WARNING_PARAMETER_STYLE);
checkBox.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else {
- checkBox.setStyle(BASE_CHECKBOX_STYLE + VALID_PARAMETER_STYLE);
+ checkBox.setStyle(Constants.BASE_CHECKBOX_STYLE + Constants.VALID_PARAMETER_STYLE);
checkBox.setTooltip(null);
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
index 9f4ea28..feee34c 100644
--- a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
@@ -9,6 +9,7 @@ import javafx.scene.control.Control;
import javafx.scene.control.TextField;
import jcgp.backend.parameters.DoubleParameter;
import jcgp.backend.parameters.ParameterStatus;
+import jcgp.gui.constants.Constants;
import jcgp.gui.settings.SettingsPane;
/**
@@ -40,7 +41,7 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(10);
textField = new TextField(decimalFormat.format(parameter.get().doubleValue()));
- textField.setStyle(VALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.VALID_PARAMETER_STYLE);
textField.setAlignment(Pos.CENTER_RIGHT);
textField.prefWidthProperty().bind(widthProperty().divide(2));
return textField;
@@ -87,15 +88,15 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
protected void setValidityStyle() {
// update the Control's style and tooltip based on the status of the parameter
if (parameter.getStatus() == ParameterStatus.INVALID) {
- textField.setStyle(BASE_TEXT_STYLE + INVALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.INVALID_PARAMETER_STYLE);
textField.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else if (parameter.getStatus() == ParameterStatus.WARNING || parameter.getStatus() == ParameterStatus.WARNING_RESET) {
- textField.setStyle(BASE_TEXT_STYLE + WARNING_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.WARNING_PARAMETER_STYLE);
textField.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else {
- textField.setStyle(BASE_TEXT_STYLE + VALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.VALID_PARAMETER_STYLE);
textField.setTooltip(null);
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
index d36c1b3..bcfbe50 100644
--- a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
@@ -7,6 +7,7 @@ import javafx.scene.control.Control;
import javafx.scene.control.TextField;
import jcgp.backend.parameters.IntegerParameter;
import jcgp.backend.parameters.ParameterStatus;
+import jcgp.gui.constants.Constants;
import jcgp.gui.settings.SettingsPane;
/**
@@ -35,7 +36,7 @@ public class GUIIntegerParameter extends GUIParameter<Number> {
protected Control makeControl() {
// this uses a text field
textField = new TextField(String.valueOf(parameter.get()));
- textField.setStyle(VALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.VALID_PARAMETER_STYLE);
textField.setAlignment(Pos.CENTER_RIGHT);
textField.prefWidthProperty().bind(widthProperty().divide(2));
@@ -83,16 +84,16 @@ public class GUIIntegerParameter extends GUIParameter<Number> {
protected void setValidityStyle() {
// update the Control's style and tooltip based on the status of the parameter
if (parameter.getStatus() == ParameterStatus.INVALID) {
- textField.setStyle(BASE_TEXT_STYLE + INVALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.INVALID_PARAMETER_STYLE);
textField.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else if (parameter.getStatus() == ParameterStatus.WARNING
|| parameter.getStatus() == ParameterStatus.WARNING_RESET) {
- textField.setStyle(BASE_TEXT_STYLE + WARNING_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.WARNING_PARAMETER_STYLE);
textField.setTooltip(tooltip);
tooltip.setText(parameter.getStatus().getDetails());
} else {
- textField.setStyle(BASE_TEXT_STYLE + VALID_PARAMETER_STYLE);
+ textField.setStyle(Constants.BASE_TEXT_STYLE + Constants.VALID_PARAMETER_STYLE);
textField.setTooltip(null);
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIParameter.java b/src/jcgp/gui/settings/parameters/GUIParameter.java
index 9188aec..59aecf6 100644
--- a/src/jcgp/gui/settings/parameters/GUIParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIParameter.java
@@ -15,7 +15,6 @@ import jcgp.backend.parameters.DoubleParameter;
import jcgp.backend.parameters.IntegerParameter;
import jcgp.backend.parameters.Parameter;
import jcgp.backend.parameters.ParameterStatus;
-import jcgp.gui.GUI;
import jcgp.gui.settings.SettingsPane;
/**
@@ -39,13 +38,6 @@ import jcgp.gui.settings.SettingsPane;
*/
public abstract class GUIParameter<T> extends HBox {
- public static final String BASE_TEXT_STYLE = "-fx-border-color: #C9C9C9; -fx-border-radius: 2; -fx-padding: 0; ";
- public static final String BASE_CHECKBOX_STYLE = "-fx-padding: 0; ";
-
- public static final String INVALID_PARAMETER_STYLE = "-fx-background-color: " + GUI.BAD_SELECTION_COLOUR;
- public static final String WARNING_PARAMETER_STYLE = "-fx-background-color: " + GUI.NEUTRAL_SELECTION_COLOUR;
- public static final String VALID_PARAMETER_STYLE = "-fx-background-color: " + GUI.NEUTRAL_COLOUR;
-
private Label name;
private Control valueControl;