/******************************************************************************************************************* * ******************************************************************************************************************/ @Test(dependsOnMethods = "must_properly_initialize_resources") public void must_properly_set_value_to_bound_property() throws NotFoundException, IOException { // given final BoundProperty<String> boundProperty = new BoundProperty<>(); // when underTest.bind(PROPERTY_2, boundProperty, callback); // then assertThat(boundProperty.get(), is(ORIGINAL_PROPERTY_2_VALUE)); verifyZeroInteractions(callback); }
private void askForOpeningSite() throws IOException { presentation.notifyInvitationToSelectAFolder(notificationWithFeedback() .withCaption("Select the site to open") .withFeedback(feedback() .withOnConfirm(() -> messageBus.publish(OpenSiteEvent.of(bindings.folderToOpen.get()))))); }
/******************************************************************************************************************* * * This method demonstrates how to pick a directory name by using the proper UI dialog. * ******************************************************************************************************************/ private void onButtonPickDirectoryPressed() { final BoundProperty<Path> selectedFolder = new BoundProperty<>(USER_HOME); presentation.pickDirectory(selectedFolder, notificationWithFeedback() .withCaption("Pick a directory") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Selected folder: " + selectedFolder.get())) .withOnCancel(() -> presentation.notify("Selection cancelled")))); }
/******************************************************************************************************************* * * This method demonstrates how to pick a file name by using the proper UI dialog. * ******************************************************************************************************************/ private void onButtonPickFilePressed() { final BoundProperty<Path> selectedFile = new BoundProperty<>(USER_HOME); presentation.pickFile(selectedFile, notificationWithFeedback() .withCaption("Pick a file") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Selected file: " + selectedFile.get())) .withOnCancel(() -> presentation.notify("Selection cancelled")))); }
@Override public void onConfirm() { // TODO: warn for overwriting data, ask for confirmation // FIXME: this gets executed in JavaFX thread try { presentation.lock(); final IBizImporter accounting = importerBuilderFactory.newBuilder() .withPath(iBizFolder.get()) .create(); accounting.importAll(); accounting.as(Saveable).save(); messageBus.publish(new AccountingOpenRequest()); // TODO: use a progress bar during the import process } catch (Exception e) { log.error("", e); presentation.notifyError(); } finally { presentation.unlock(); } } }));