Home » Archived » Jubula » Some controls are not mappable in Jubula for javafx
Some controls are not mappable in Jubula for javafx [message #1703840] |
Wed, 05 August 2015 10:08 |
Thomas Mortimer Messages: 18 Registered: July 2015 |
Junior Member |
|
|
Hi all,
I have two controls that I'm attempting to map in Jubula testing:
DatePicker
I currently cannot map a datepicker text field. I've seen the bug logged here and am aware there is a fix coming up, but am unsure which version of Jubula this will be available in.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429006
Do you know which version I need to be able to get access to the hot fix?
ButtonType
With JavaFX 9 there comes a new button called ButtonType:
http://download.java.net/jdk9/jfxdocs/javafx/scene/control/ButtonType.html
It deals with the creation of dialogs and allows a programmer to create a confirm and cancel button. This does not appear to be mappable in Jubula at the moment. Other controls on a dialog (Like textfield) work fine.
The code for creating such a dialog:
public void showSetDateAndTimeDialog(){
DtDateAndTime currentDateAndTime;
try {
checkConnectionOK();
currentDateAndTime = systemstateController.getServerDateTime();
/*
* Creating controls to be used in the popup dialog
*/
Dialog<DtDateAndTime> dialog = new Dialog<DtDateAndTime>();
dialog.setTitle("Set system time and date");
dialog.setResizable(false);
DatePicker dtpckr = new DatePicker();
dtpckr.setMaxWidth(100);
dtpckr.setValue(LocalDate.parse(currentDateAndTime.date.toString(), DateTimeFormatter.ofPattern("yyyy/MM/dd")));
Label lblDate = new Label("Select a date:");
Label lblTimeHour = new Label("Select an hour:");
Label lblTimeMinute = new Label("Select a minute:");
Label lblTimeSecond = new Label("Select a second:");
TextField txtfldCurrentSetSecond = new TextField();
TextField txtfldCurrentSetMinute = new TextField();
TextField txtfldCurrentSetHour = new TextField();
//ComboBox<String> cmbxHourPicker = getComboBox(100, ComboBoxType.Hour);
//ComboBox<String> cmbxMinutePicker = getComboBox(100, ComboBoxType.Minute);
Slider sldrHourPicker = getSlider(100, SliderType.Hour, txtfldCurrentSetHour, currentDateAndTime.time);
Slider sldrMinutePicker = getSlider(100, SliderType.Minute, txtfldCurrentSetMinute, currentDateAndTime.time);
Slider sldrSecondPicker = getSlider(100, SliderType.Second, txtfldCurrentSetSecond, currentDateAndTime.time);
/*
* Adding a grid pane to keep controls in correct place and aligned correctly
*/
GridPane grdpn = new GridPane();
grdpn.add(lblDate, 1, 1);
grdpn.add(dtpckr, 2, 1);
grdpn.add(lblTimeHour, 1, 2);
grdpn.add(sldrHourPicker, 2, 2);
grdpn.add(txtfldCurrentSetHour, 3, 2);
grdpn.add(lblTimeMinute, 1, 3);
grdpn.add(sldrMinutePicker, 2, 3);
grdpn.add(txtfldCurrentSetMinute, 3, 3);
grdpn.add(lblTimeSecond, 1, 4);
grdpn.add(sldrSecondPicker, 2, 4);
grdpn.add(txtfldCurrentSetSecond, 3, 4);
dialog.getDialogPane().setContent(grdpn);
/*
* Creating buttons for user to press
*/
ButtonType bttntypOK = new ButtonType("OK", ButtonData.OK_DONE);
ButtonType bttntypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().add(bttntypeCancel);
dialog.getDialogPane().getButtonTypes().add(bttntypOK);
/*
* End of creating controls to be used in the popup dialog
*/
/*
* Creating a method to convert the result from the popup box to the object DtDateAndTime
* This will be called upon the user pressing the cancel, ok or closing the popup window
*/
dialog.setResultConverter(new Callback<ButtonType, DtDateAndTime>(){
@Override
public DtDateAndTime call(ButtonType param) {
/*
* Make sure the user entered all information and pressed the OK button
*/
if(param == bttntypOK && checkIfAllDialogHasBeenFilledIn(grdpn)){
int hour = (int)Math.floor(sldrHourPicker.getValue());
int minute = (int)Math.floor(sldrMinutePicker.getValue());
int second = (int)Math.floor(sldrSecondPicker.getValue());
return ICrashUtils.setDateAndTime(dtpckr.getValue().getYear(),
dtpckr.getValue().getMonthValue(), dtpckr.getValue().getDayOfMonth(), hour,
minute, second);
}
return null;
}
});
Optional<DtDateAndTime> result = dialog.showAndWait();
/*
* If result is present, we have data to work with, otherwise the user cancelled the action in some way
*/
if(result.isPresent()){
try {
checkConnectionOK();
if (!systemstateController.oeSetClock(result.get()).getValue())
showWarningMessage("Unable to set clock", "Unable to set the system clock, please try again");
refreshData();
} catch (ServerOfflineException | ServerNotBoundException e) {
showExceptionErrorMessage(e);
serverHasGoneDown();
}
}
else
showUserCancelledActionPopup();
} catch (ServerOfflineException | ServerNotBoundException e1) {
showExceptionErrorMessage(e1);
serverHasGoneDown();
}
}
Other useful information:
The project is a JavaFx project
The project is being made with the java 1.8.0_51 library
Jubula version is 8.1.4.013
Eclipse is 4.5.0
I'm working on Windows 8.1
I've attached screenshots of the dialog where it has some mappable controls and some that are not. I've also attached the testing xml export file as well. Please let me know if you need more information.
Regards,
Tom
|
|
| | | |
Goto Forum:
Current Time: Fri Dec 13 22:04:20 GMT 2024
Powered by FUDForum. Page generated in 0.02790 seconds
|