Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable spacing/padding in multiple column layout #36

Open
aalmiray opened this issue Aug 26, 2018 · 1 comment
Open

Configurable spacing/padding in multiple column layout #36

aalmiray opened this issue Aug 26, 2018 · 1 comment

Comments

@aalmiray
Copy link
Contributor

When a multiple column layout is used (by setting span() on Fields) the labels are placed too close to the previous value. This behavior is accentuated when short labels are used. The following screenshots show this behavior with a 2 and a 4 column layout.

formfx-spacing

formsfx-spacing2

The code used for these examples is

import com.dlsc.formsfx.model.structure.Field;
import com.dlsc.formsfx.model.structure.Form;
import com.dlsc.formsfx.model.structure.Group;
import com.dlsc.formsfx.view.renderer.FormRenderer;
import com.dlsc.formsfx.view.util.ColSpan;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Sample extends Application {
   @Override
   public void start(Stage stage) throws Exception {
      StringProperty p1 = new SimpleStringProperty("p1");
      StringProperty p2 = new SimpleStringProperty("p2");
      StringProperty p3 = new SimpleStringProperty("p3");
      StringProperty p4 = new SimpleStringProperty("p4");

      Form form = Form.of(
            Group.of(
                  Field.ofStringType(p1)
                        .label("P1")
                        .required(true).span(ColSpan.QUARTER),
                  Field.ofStringType(p2)
                        .label("P2")
                        .required(true).span(ColSpan.QUARTER),
                  Field.ofStringType(p3)
                        .label("P3")
                        .required(true).span(ColSpan.QUARTER),
                  Field.ofStringType(p4)
                        .label("P4")
                        .required(true).span(ColSpan.QUARTER)
            )
      );
      stage.setScene(new Scene(new FormRenderer(form)));
      stage.sizeToScene();
      stage.show();
   }
}

It would be great to have an option to specify padding/spacing without having to override the default renderers nor providing a custom renderer.

@MarekKristof
Copy link

Hello, can i take it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants