}
return height;
}
@Override protected void layoutChildren() {
Side tabPosition = getSkinnable().getSide();
double x = 0.0F;
//padding.left;
double y = snappedTopInset();
double h = snapSize(getHeight()) - y + snappedBottomInset();
// when on the left or bottom, we need to position the tabs controls
// button such that it is the furtherest button away from the tabs.
if (tabPosition.equals(Side.BOTTOM) || tabPosition.equals(Side.LEFT)) {
x += positionTabsMenu(x, y, h, true);
} else {
x += positionTabsMenu(x, y, h, false);
}
}
private double positionTabsMenu(double x, double y, double h, boolean showSep) {
double newX = x;
if (isShowTabsMenu()) {
// DOWN ARROW BUTTON
positionArrow(downArrowBtn, downArrow, newX, y, maxArrowWidth, h);
newX += maxArrowWidth;
}
return newX;
}
private void positionArrow(Pane btn, StackPane arrow, double x, double y, double width, double height) {
btn.resize(width, height);
positionInArea(btn, x, y, width, height, /*baseline ignored*/0,
HPos.CENTER, VPos.CENTER);
// center arrow region within arrow button
double arrowWidth = snapSize(arrow.prefWidth(-1));
double arrowHeight = snapSize(arrow.prefHeight(-1));
arrow.resize(arrowWidth, arrowHeight);
positionInArea(arrow, btn.snappedLeftInset(), btn.snappedTopInset(),
width - btn.snappedLeftInset() - btn.snappedRightInset(),
height - btn.snappedTopInset() - btn.snappedBottomInset(),
/*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
}
};
inner.getStyleClass().add("container");
inner.getChildren().add(downArrowBtn);
getChildren().add(inner);
tabPane.sideProperty().addListener(new InvalidationListener() {
@Override public void invalidated(Observable valueModel) {
Side tabPosition = getSkinnable().getSide();
downArrow.setRotate(tabPosition.equals(Side.BOTTOM)? 180.0F : 0.0F);
}
});
tabPane.getTabs().addListener(new ListChangeListener<Tab>() {
@Override public void onChanged(Change<? extends Tab> c) {
setupPopupMenu();