Skip to content

Commit

Permalink
Fix text wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
oowekyala committed Mar 5, 2019
1 parent 965637d commit 8f8b11a
Showing 1 changed file with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
import java.util.Objects;

import org.kordamp.ikonli.javafx.FontIcon;
import org.reactfx.value.Val;
import org.reactfx.value.Var;

import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;

/**
* Placeholder for an empty control. Can suggest actions to take to make the area non-empty.
Expand All @@ -36,32 +34,22 @@ public HelpfulPlaceholder(String initialMessage,

VBox messageVBox = new VBox();

Text messageLabel = new Text();
Label messageLabel = new Label();
messageLabel.textProperty().bind(message);

Val<Number> messageWidthProp = Val.wrap(
leftColumn == null
? Val.wrap(widthProperty())
: Bindings.createDoubleBinding(() -> getWidth() - messageVBox.getPrefWidth(),
messageVBox.prefWidthProperty(),
widthProperty()
)
);

messageLabel.wrappingWidthProperty().bind(messageVBox.widthProperty());
messageLabel.setWrapText(true);

messageVBox.getChildren().addAll(messageLabel);
messageVBox.getChildren().addAll(actions);


if (leftColumn != null) {
getChildren().add(leftColumn);
}

getChildren().add(messageVBox);

// TODO move to css
setSpacing(10);
setSpacing(15);
setFillHeight(true);
setAlignment(CENTER);
messageVBox.setAlignment(CENTER);
}
Expand Down

0 comments on commit 8f8b11a

Please sign in to comment.