All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tornadofx.control.Form Maven / Gradle / Ivy

package tornadofx.control;

import javafx.scene.layout.VBox;

import java.util.stream.Stream;

public class Form extends VBox {

	public Form() {
		getStyleClass().add("form");
	}

	public double getLabelContainerWidth() {
        return getFieldsets().flatMap(Fieldset::getFields)
                .map(Field::getLabelContainer)
                .mapToDouble(f -> f.prefWidth(-1))
                .max()
                .orElse(0);
    }

    public Stream
getFieldsets() { return getChildren().stream() .filter(c -> c instanceof Fieldset) .map(c -> (Fieldset) c); } public String getUserAgentStylesheet() { return Form.class.getResource("form.css").toExternalForm(); } public Fieldset fieldset(String text) { Fieldset fieldset = new Fieldset(text); getChildren().add(fieldset); return fieldset; } public Fieldset fieldset() { Fieldset fieldset = new Fieldset(); getChildren().add(fieldset); return fieldset; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy