com.dooapp.fxform.samples.FXMLSkin Maven / Gradle / Ivy
package com.dooapp.fxform.samples;
import com.dooapp.fxform.FXForm;
import com.dooapp.fxform.FXFormSample;
import com.dooapp.fxform.Utils;
import com.dooapp.fxform.annotation.Accessor;
import com.dooapp.fxform.builder.FXFormBuilder;
import com.dooapp.fxform.model.Movies;
import javafx.beans.property.*;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
/**
* @author Bastien
*/
public class FXMLSkin extends FXFormSample {
@Override
public String getSampleName() {
return "FXML Skin";
}
@Accessor(value = Accessor.AccessType.FIELD)
public class User {
public StringProperty firstName = new SimpleStringProperty();
public StringProperty lastName = new SimpleStringProperty();
public IntegerProperty age = new SimpleIntegerProperty(10);
public ObjectProperty favoriteMovie = new SimpleObjectProperty<>();
public BooleanProperty coolDeveloper = new SimpleBooleanProperty();
}
@Override
public Node getPanel(Stage stage) {
Pane root = new Pane();
FXForm form = new FXFormBuilder<>().include("lastName", "firstName", "age").resourceBundle(Utils.SAMPLE).build();
form.setSkin(new com.dooapp.fxform.view.skin.FXMLSkin(form, getClass().getResource("/fxmlSkin.fxml")));
User user = new User();
form.setSource(user);
root.getChildren().add(form);
return root;
}
@Override
public String getSampleDescription() {
return "This is an example of how to use FXForm with FXML";
}
}