GemDateInput
The component is an input field that shows with an date/time selection overlay that opens on click. It is used whenever a user date/time input is required.
Usage Example
/* (c) https://github.com/MontiCore/monticore */
package example_input;
import Domain.Stock;
import mc.fenix.input.GemDateInput;
import common.ExamplePage;
import mc.fenix.arrange.GemColumn;
import mc.fenix.input.GemTextInputTypes.GemTextInputValidity;
page GemDateInputExample(List<Stock> stocks) {
@ExamplePage(
component = @GemColumn(components = [
@iterate(Stock s : stocks) {
@GemDateInput(
labelText = "Date only:",
entry = s.date
);
@GemDateInput(
labelText = "Time only:",
showTimeOnly = true,
entry = s.date
);
@GemDateInput(
labelText = "Date and Time:",
showDateTime = true,
entry = s.date
);
@GemDateInput(
labelText = "Date (disabled)",
entry = s.date,
disabled = true
);
@GemDateInput(
labelText = "Date (Error)",
entry = s.date,
validity = GemTextInputValidity("Error", "Not Working")
);
}
]),
basePath = "example_input",
componentName = "GemDateInputExample"
);
}
GUI Model
component GemDateInput(
String id,
String labelText = "",
?LocalDateTime entry,
boolean showDateTime = false,
boolean showTimeOnly = false,
boolean disabled = false,
String width = "100%",
String height = "100%",
GemTextInputValidity validity
)
| Name |
Type |
Description |
Default value |
id |
String |
The component's id; used to configure the styles. |
|
labelText |
String |
Text describing the input field. |
"" |
entry |
?LocalDateTime |
The input field's value. If it is linked to a variable, the value of the variable will change when the user enters a new value. |
|
showDateTime |
boolean |
Whether both date and time selection is shown in one overlay. |
false |
showTimeOnly |
boolean |
Whether only time selection overlay is shown (no matter if showDateTime is enabled). |
false |
disabled |
boolean |
Whether the input field is disabled. |
false |
width |
String |
Width of the input field. |
"100%" |
height |
String |
Height of the input field. |
"100%" |
validity |
GemTextInputValidity |
An object representing the validation status of the field. |
|
Types
GemTextInputTypes
package mc.fenix.input;
classdiagram GemTextInputTypes {
public class GemTextInputValidity {
String status;
String message;
+GemTextInputValidity(String status);
+GemTextInputValidity(String status, String message);
}
}
GemTextInputValidity
| Name |
Type |
Description |
Default value |
status |
String |
The validation status. Possible values: "Error": There is a problem or issue that needs attention. "Unchecked": The input has not been inspected. "Success": Positive validation result. "Warning": There is a potential issue that should be noted. |
|
message |
String |
A message to be displayed as a tooltip with the status |
|