diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2014-10-10 13:22:16 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2014-10-10 13:22:16 +0200 |
commit | e145523a2ae686dd2a2ae7996639e6e8d14d992a (patch) | |
tree | 3ffaa3c13fc48f3c58b72a53bb6a6ca41bcf96da /src/jcgp/gui/settings/parameters | |
parent | 952b6d502da5896b59ffecdb5fa6f9c56458a02c (diff) |
Moved constants to a separate file, added a formal README
Diffstat (limited to 'src/jcgp/gui/settings/parameters')
4 files changed, 14 insertions, 19 deletions
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; |