@Override public void initialize(URL arg0, ResourceBundle arg1) { loadScenarios(); carlfxHyperlink.setTooltip(TooltipBuilder.create() .text("mars-sim.sourceforge.net \n https://www.facebook.com/groups/125541663548/") .build() ); carlfxHyperlink.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent evt) { //webEngine.load(rssFeed.link); } }); createColumns(recipeTableView1); recipeTableView1.setItems(getChapterRecipes("1")); createLaunchAppEvent(recipeTableView1); createColumns(recipeTableView2); recipeTableView2.setItems(getChapterRecipes("2")); createLaunchAppEvent(recipeTableView2); /* createColumns(chap3RecipeTableView); chap3RecipeTableView.setItems(getChapterRecipes("3")); createLaunchAppEvent(chap3RecipeTableView); createColumns(chap4RecipeTableView); chap4RecipeTableView.setItems(getChapterRecipes("4")); createLaunchAppEvent(chap4RecipeTableView); */ }
public void showTemplateAddDialog() { showInputDialog("templateDialog.templateTitle", "templateDialog.templateLabel", new Callback() { @Override public void onInput(final InputDialogController controller, final String input) { try { controller.input.getStyleClass().remove("input-invalid"); final Gson gson = new Gson(); final Template template = gson.fromJson(gson.toJson(ViewController.standardTemplate), Template.class); template.setName(input); template.setDefaultdir(new File(template.getDefaultdir().getPath())); templateService.insert(template); controller.closeDialog(null); } catch (final IllegalArgumentException e) { switch (e.getMessage()) { case Template.Validation.NAME: controller.input.getStyleClass().add("input-invalid"); controller.input .setTooltip(TooltipBuilder.create() .autoHide(true) .text(resources.getString("validation.name")) .build()); controller.input .getTooltip() .show(controller.input, getTooltipX(controller.input), getTooltipY(controller.input)); break; } } } }); }
public static <T> void validateTextField (final TextField field, ObjectProperty<Either<String, T>> property, StringConverter<Either<String, T>> converter) { Bindings.bindBidirectional (field.textProperty (), property, converter); property.addListener (new ChangeListener<Either<String, T>> () { @Override public void changed (ObservableValue<? extends Either<String, T>> observableValue, Either<String, T> old, Either<String, T> current) { if (current != null && current.isLeft ()) { field.getStyleClass ().add ("validation_error"); field.setTooltip (TooltipBuilder.create () .text (current.left ().get ()) .build ()); } else { field.getStyleClass ().remove ("validation_error"); field.setTooltip (null); } } }); }