java.lang.Object
es.upm.fi.cig.multictbnc.util.ControllerUtil
Utility class with methods related to controlling the UI behaviour.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleextractDecimal(String text, double defaultValue) Receives anStringand tries to convert it to adouble.static intextractInteger(String text, int defaultValue) Receives anStringand tries to convert it to anInteger.static voidonlyPositiveDouble(javafx.scene.control.TextField textField) Checks that the text field only contains positive decimals.static voidonlyPositiveInteger(javafx.scene.control.TextField textField) Checks that the text field only contains positive integers.static voidonlyZeroOrGreaterInteger(javafx.scene.control.TextField textField) Checks that the text field only contains integers greater than zero.static voidshowNode(javafx.scene.Node node, boolean show) Changes the visibility of a node.
-
Method Details
-
extractDecimal
Receives anStringand tries to convert it to adouble. If it is not possible, the provided default value is returned.- Parameters:
text-Stringfrom which thedoubleis extracteddefaultValue- default value- Returns:
- extracted
double
-
extractInteger
Receives anStringand tries to convert it to anInteger. If it is not possible, the provided default value is returned.- Parameters:
text-Stringfrom which theIntegeris extracteddefaultValue- default value- Returns:
- extracted
Integer
-
onlyPositiveDouble
public static void onlyPositiveDouble(javafx.scene.control.TextField textField) Checks that the text field only contains positive decimals.- Parameters:
textField- text field
-
onlyPositiveInteger
public static void onlyPositiveInteger(javafx.scene.control.TextField textField) Checks that the text field only contains positive integers.- Parameters:
textField- text field
-
onlyZeroOrGreaterInteger
public static void onlyZeroOrGreaterInteger(javafx.scene.control.TextField textField) Checks that the text field only contains integers greater than zero.- Parameters:
textField- text field
-
showNode
public static void showNode(javafx.scene.Node node, boolean show) Changes the visibility of a node.- Parameters:
node- node whose status is changedshow- true to show the node, otherwise false
-