use of javafx.scene.layout.Region in project JFoenix by jfoenixadmin.
the class JFXTextAreaSkin method layoutChildren.
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
super.layoutChildren(x, y, w, h);
final double height = getSkinnable().getHeight();
linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
linesWrapper.layoutPrompt(x, y, w, h);
errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
linesWrapper.updateLabelFloatLayout();
if (invalid) {
invalid = false;
// set the default background of text area viewport to white
Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
// reapply css of scroll pane in case set by the user
viewPort.applyCss();
errorContainer.invalid(w);
// focus
linesWrapper.invalid();
}
}
use of javafx.scene.layout.Region in project JFoenix by jfoenixadmin.
the class JFXRippler method getMask.
// methods that can be changed by extending the rippler class
/**
* generate the clipping mask
*
* @return the mask node
*/
protected Node getMask() {
double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0;
Bounds bounds = control.getBoundsInParent();
double width = control.getLayoutBounds().getWidth();
double height = control.getLayoutBounds().getHeight();
double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX());
double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY());
double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX());
double diffMaxY = Math.abs(control.getBoundsInLocal().getMaxY() - control.getLayoutBounds().getMaxY());
Node mask;
switch(getMaskType()) {
case RECT:
mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth, // -0.1 to prevent resizing the anchor pane
height - 2 * borderWidth);
break;
case CIRCLE:
double radius = Math.min((width / 2) - 2 * borderWidth, (height / 2) - 2 * borderWidth);
mask = new Circle((bounds.getMinX() + diffMinX + bounds.getMaxX() - diffMaxX) / 2 - snappedLeftInset(), (bounds.getMinY() + diffMinY + bounds.getMaxY() - diffMaxY) / 2 - snappedTopInset(), radius, Color.BLUE);
break;
case FIT:
mask = new Region();
if (control instanceof Shape) {
((Region) mask).setShape((Shape) control);
} else if (control instanceof Region) {
((Region) mask).setShape(((Region) control).getShape());
JFXNodeUtils.updateBackground(((Region) control).getBackground(), (Region) mask);
}
mask.resize(width, height);
mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
break;
default:
mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth, // -0.1 to prevent resizing the anchor pane
height - 2 * borderWidth);
break;
}
return mask;
}
use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.
the class TabIndicatorSkin method initialise.
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
final Region circle = new Region();
circle.getStyleClass().add("indicator-circle");
final Text text = new Text();
text.getStyleClass().add("indicator-information");
text.textProperty().bind(getControl().textProperty());
final StackPane container = new StackPane(circle, text);
container.getStyleClass().add("indicator-container");
final StackPane tabIndicator = new StackPane(container);
tabIndicator.getStyleClass().add("tab-indicator");
getChildren().add(tabIndicator);
}
use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.
the class EngineInformationPanelSkin method initialise.
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
final GridPane informationContentPane = new GridPane();
informationContentPane.getStyleClass().add("grid");
engineUserData.addListener((Observable invalidation) -> updateUserData(informationContentPane));
updateUserData(informationContentPane);
final HBox buttonBox = createEngineButtons();
final Region informationContentSpacer = new Region();
informationContentSpacer.getStyleClass().add("engineSpacer");
final Region buttonBoxSpacer = new Region();
buttonBoxSpacer.getStyleClass().add("engineSpacer");
final VBox container = new VBox(informationContentPane, informationContentSpacer, buttonBox, buttonBoxSpacer);
getChildren().add(container);
}
use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.
the class CompactListElementSkin method createMiniature.
/**
* Creates a miniature icon for the item
* @return A miniature icon for the item
*/
private Region createMiniature() {
final Region icon = new Region();
icon.getStyleClass().add("compactListMiniatureImage");
icon.styleProperty().bind(Bindings.createStringBinding(() -> String.format("-fx-background-image: url(\"%s\");", getControl().getMiniatureUri().toString()), getControl().miniatureUriProperty()));
return icon;
}
Aggregations