< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 824,863 **** @Override protected void layoutChildren() { if (tabsFit()) { setScrollOffset(0.0); } else { - if (!removeTab.isEmpty()) { - double offset = 0; - double w = tabHeaderArea.getWidth() - snapSize(controlButtons.prefWidth(-1)) - firstTabIndent() - SPACER; - Iterator<Node> i = getChildren().iterator(); - while (i.hasNext()) { - TabHeaderSkin tabHeader = (TabHeaderSkin)i.next(); - double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1)); - if (removeTab.contains(tabHeader)) { - if (offset < w) { - isSelectingTab = true; - } - i.remove(); - removeTab.remove(tabHeader); - if (removeTab.isEmpty()) { - break; - } - } - offset += tabHeaderPrefWidth; - } - // } else { - // isSelectingTab = true; - } - } - if (isSelectingTab) { ensureSelectedTabIsVisible(); - isSelectingTab = false; } else { validateScrollOffset(); } Side tabPosition = getSkinnable().getSide(); double tabBackgroundHeight = snapSize(prefHeight(-1)); double tabX = (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) ? snapSize(getWidth()) - getScrollOffset() : getScrollOffset(); --- 824,840 ---- @Override protected void layoutChildren() { if (tabsFit()) { setScrollOffset(0.0); } else { if (isSelectingTab) { ensureSelectedTabIsVisible(); } else { validateScrollOffset(); } + } + isSelectingTab = false; Side tabPosition = getSkinnable().getSide(); double tabBackgroundHeight = snapSize(prefHeight(-1)); double tabX = (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) ? snapSize(getWidth()) - getScrollOffset() : getScrollOffset();
*** 988,1009 **** private void addTab(Tab tab, int addToIndex) { TabHeaderSkin tabHeaderSkin = new TabHeaderSkin(tab); headersRegion.getChildren().add(addToIndex, tabHeaderSkin); } - private List<TabHeaderSkin> removeTab = new ArrayList<>(); private void removeTab(Tab tab) { TabHeaderSkin tabHeaderSkin = getTabHeaderSkin(tab); if (tabHeaderSkin != null) { - if (tabsFit()) { headersRegion.getChildren().remove(tabHeaderSkin); - } else { - // The tab will be removed during layout because - // we need its width to compute the scroll offset. - removeTab.add(tabHeaderSkin); - tabHeaderSkin.removeListeners(tab); - } } } private TabHeaderSkin getTabHeaderSkin(Tab tab) { for (Node child: headersRegion.getChildren()) { --- 965,978 ----
< prev index next >