1257 if (behavior.canCloseTab(tab)) {
1258 behavior.closeTab(tab);
1259 setOnMousePressed(null);
1260 }
1261 break;
1262 }
1263 default: super.executeAccessibleAction(action, parameters);
1264 }
1265 }
1266 };
1267 closeBtn.setAccessibleRole(AccessibleRole.BUTTON);
1268 closeBtn.setAccessibleText(getString("Accessibility.title.TabPane.CloseButton"));
1269 closeBtn.getStyleClass().setAll("tab-close-button");
1270 closeBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
1271 @Override
1272 public void handle(MouseEvent me) {
1273 Tab tab = getTab();
1274 if (behavior.canCloseTab(tab)) {
1275 behavior.closeTab(tab);
1276 setOnMousePressed(null);
1277 }
1278 }
1279 });
1280
1281 updateGraphicRotation();
1282
1283 final Region focusIndicator = new Region();
1284 focusIndicator.setMouseTransparent(true);
1285 focusIndicator.getStyleClass().add("focus-indicator");
1286
1287 inner = new StackPane() {
1288 @Override protected void layoutChildren() {
1289 final TabPane skinnable = getSkinnable();
1290
1291 final double paddingTop = snappedTopInset();
1292 final double paddingRight = snappedRightInset();
1293 final double paddingBottom = snappedBottomInset();
1294 final double paddingLeft = snappedLeftInset();
1295 final double w = getWidth() - (paddingLeft + paddingRight);
1296 final double h = getHeight() - (paddingTop + paddingBottom);
1502 (getSkinnable().getSide().equals(Side.LEFT) ? 90.0F : 0.0F)));
1503 }
1504 }
1505
1506 private boolean showCloseButton() {
1507 return tab.isClosable() &&
1508 (getSkinnable().getTabClosingPolicy().equals(TabClosingPolicy.ALL_TABS) ||
1509 getSkinnable().getTabClosingPolicy().equals(TabClosingPolicy.SELECTED_TAB) && tab.isSelected());
1510 }
1511
1512 private final DoubleProperty animationTransition = new SimpleDoubleProperty(this, "animationTransition", 1.0) {
1513 @Override protected void invalidated() {
1514 requestLayout();
1515 }
1516 };
1517
1518 private void removeListeners(Tab tab) {
1519 listener.dispose();
1520 inner.getChildren().clear();
1521 getChildren().clear();
1522 }
1523
1524 private TabAnimationState animationState = TabAnimationState.NONE;
1525 private Timeline currentAnimation;
1526
1527 @Override protected double computePrefWidth(double height) {
1528 // if (animating) {
1529 // return prefWidth.getValue();
1530 // }
1531 double minWidth = snapSize(getSkinnable().getTabMinWidth());
1532 double maxWidth = snapSize(getSkinnable().getTabMaxWidth());
1533 double paddingRight = snappedRightInset();
1534 double paddingLeft = snappedLeftInset();
1535 double tmpPrefWidth = snapSize(label.prefWidth(-1));
1536
1537 // only include the close button width if it is relevant
1538 if (showCloseButton()) {
1539 tmpPrefWidth += snapSize(closeBtn.prefWidth(-1));
1540 }
1541
|
1257 if (behavior.canCloseTab(tab)) {
1258 behavior.closeTab(tab);
1259 setOnMousePressed(null);
1260 }
1261 break;
1262 }
1263 default: super.executeAccessibleAction(action, parameters);
1264 }
1265 }
1266 };
1267 closeBtn.setAccessibleRole(AccessibleRole.BUTTON);
1268 closeBtn.setAccessibleText(getString("Accessibility.title.TabPane.CloseButton"));
1269 closeBtn.getStyleClass().setAll("tab-close-button");
1270 closeBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
1271 @Override
1272 public void handle(MouseEvent me) {
1273 Tab tab = getTab();
1274 if (behavior.canCloseTab(tab)) {
1275 behavior.closeTab(tab);
1276 setOnMousePressed(null);
1277 me.consume();
1278 }
1279 }
1280 });
1281
1282 updateGraphicRotation();
1283
1284 final Region focusIndicator = new Region();
1285 focusIndicator.setMouseTransparent(true);
1286 focusIndicator.getStyleClass().add("focus-indicator");
1287
1288 inner = new StackPane() {
1289 @Override protected void layoutChildren() {
1290 final TabPane skinnable = getSkinnable();
1291
1292 final double paddingTop = snappedTopInset();
1293 final double paddingRight = snappedRightInset();
1294 final double paddingBottom = snappedBottomInset();
1295 final double paddingLeft = snappedLeftInset();
1296 final double w = getWidth() - (paddingLeft + paddingRight);
1297 final double h = getHeight() - (paddingTop + paddingBottom);
1503 (getSkinnable().getSide().equals(Side.LEFT) ? 90.0F : 0.0F)));
1504 }
1505 }
1506
1507 private boolean showCloseButton() {
1508 return tab.isClosable() &&
1509 (getSkinnable().getTabClosingPolicy().equals(TabClosingPolicy.ALL_TABS) ||
1510 getSkinnable().getTabClosingPolicy().equals(TabClosingPolicy.SELECTED_TAB) && tab.isSelected());
1511 }
1512
1513 private final DoubleProperty animationTransition = new SimpleDoubleProperty(this, "animationTransition", 1.0) {
1514 @Override protected void invalidated() {
1515 requestLayout();
1516 }
1517 };
1518
1519 private void removeListeners(Tab tab) {
1520 listener.dispose();
1521 inner.getChildren().clear();
1522 getChildren().clear();
1523 setOnContextMenuRequested(null);
1524 setOnMousePressed(null);
1525 }
1526
1527 private TabAnimationState animationState = TabAnimationState.NONE;
1528 private Timeline currentAnimation;
1529
1530 @Override protected double computePrefWidth(double height) {
1531 // if (animating) {
1532 // return prefWidth.getValue();
1533 // }
1534 double minWidth = snapSize(getSkinnable().getTabMinWidth());
1535 double maxWidth = snapSize(getSkinnable().getTabMaxWidth());
1536 double paddingRight = snappedRightInset();
1537 double paddingLeft = snappedLeftInset();
1538 double tmpPrefWidth = snapSize(label.prefWidth(-1));
1539
1540 // only include the close button width if it is relevant
1541 if (showCloseButton()) {
1542 tmpPrefWidth += snapSize(closeBtn.prefWidth(-1));
1543 }
1544
|