/******************************************************************************************************************* * * At {@link PostConstruct} time the control just performs the binding to the presentation. * ******************************************************************************************************************/ @PostConstruct private void initialize() { presentation.bind(bindings); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void action2 (final @Nonnull Object object) { presentation.notify("Action 2 on " + object); }
/******************************************************************************************************************* * * {@inheritDoc} * * This method demonstrates the typical idiom for populating data: * * 1. A dao is called to provide raw data - let's say in form of collections; * 2. Objects in the collection are transformed into PresentationModels. * 3. The PresentationModels are then passed to the presentation. * ******************************************************************************************************************/ @Override public void start() { presentation.showUp(); final Collection<SimpleEntity> entities1 = dao.getSimpleEntities(); final Collection<SimpleDciEntity> entities2 = dao.getDciEntities(); final PresentationModel pm1 = entities1.stream().map(e -> pmFor(e)).collect(toCompositePresentationModel()); final PresentationModel pm2 = entities2.stream().map(e -> pmFor(e)).collect(toCompositePresentationModel()); presentation.populate(pm1, pm2); }
/******************************************************************************************************************* * * 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")))); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void onSelected (final @Nonnull Object object) { presentation.notify("Selected " + object); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void action3 (final @Nonnull Object object) { presentation.notify("Action 3 on " + object); } }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void action1 (final @Nonnull Object object) { presentation.notify("Action 1 on " + object); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void onButtonPressed() { presentation.notify("Button pressed"); status++; bindings.textProperty.set(Integer.toString(status)); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void onButtonDialogOkCancelPressed() { presentation.notify(notificationWithFeedback() .withCaption("Notification") .withText("Now press the button") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Pressed ok")) .withOnCancel(() -> presentation.notify("Pressed cancel")))); }
/******************************************************************************************************************* * ******************************************************************************************************************/ private void onButtonDialogOkPressed() { presentation.notify(notificationWithFeedback() .withCaption("Notification") .withText("Now press the button") .withFeedback(feedback().withOnConfirm(() -> presentation.notify("Pressed ok")))); }