204 h += pane.prefHeight(width); 205 } 206 } 207 } 208 209 return h + topInset + bottomInset; 210 } 211 212 /** {@inheritDoc} */ 213 @Override protected void layoutChildren(final double x, double y, 214 final double w, final double h) { 215 final boolean rebuild = forceRelayout || (relayout && previousHeight != h); 216 forceRelayout = false; 217 previousHeight = h; 218 219 // Compute height of all the collapsed panes 220 double collapsedPanesHeight = 0; 221 for (TitledPane tp : getSkinnable().getPanes()) { 222 if (!tp.equals(expandedPane)) { 223 TitledPaneSkin childSkin = (TitledPaneSkin) ((TitledPane)tp).getSkin(); 224 collapsedPanesHeight += snapSize(childSkin.getTitleRegionSize(w)); 225 } 226 } 227 final double maxTitledPaneHeight = h - collapsedPanesHeight; 228 229 for (TitledPane tp : getSkinnable().getPanes()) { 230 Skin<?> skin = tp.getSkin(); 231 double ph; 232 if (skin instanceof TitledPaneSkin) { 233 ((TitledPaneSkin)skin).setMaxTitledPaneHeightForAccordion(maxTitledPaneHeight); 234 ph = snapSize(((TitledPaneSkin)skin).getTitledPaneHeightForAccordion()); 235 } else { 236 ph = tp.prefHeight(w); 237 } 238 tp.resize(w, ph); 239 240 boolean needsRelocate = true; 241 if (! rebuild && previousPane != null && expandedPane != null) { 242 List<TitledPane> panes = getSkinnable().getPanes(); 243 final int previousPaneIndex = panes.indexOf(previousPane); 244 final int expandedPaneIndex = panes.indexOf(expandedPane); 245 final int currentPaneIndex = panes.indexOf(tp); 246 247 if (previousPaneIndex < expandedPaneIndex) { 248 // Current expanded pane is after the previous expanded pane.. 249 // Only move the panes that are less than or equal to the current expanded. 250 if (currentPaneIndex <= expandedPaneIndex) { 251 tp.relocate(x, y); 252 y += ph; 253 needsRelocate = false; 254 } | 204 h += pane.prefHeight(width); 205 } 206 } 207 } 208 209 return h + topInset + bottomInset; 210 } 211 212 /** {@inheritDoc} */ 213 @Override protected void layoutChildren(final double x, double y, 214 final double w, final double h) { 215 final boolean rebuild = forceRelayout || (relayout && previousHeight != h); 216 forceRelayout = false; 217 previousHeight = h; 218 219 // Compute height of all the collapsed panes 220 double collapsedPanesHeight = 0; 221 for (TitledPane tp : getSkinnable().getPanes()) { 222 if (!tp.equals(expandedPane)) { 223 TitledPaneSkin childSkin = (TitledPaneSkin) ((TitledPane)tp).getSkin(); 224 collapsedPanesHeight += snapSizeY(childSkin.getTitleRegionSize(w)); 225 } 226 } 227 final double maxTitledPaneHeight = h - collapsedPanesHeight; 228 229 for (TitledPane tp : getSkinnable().getPanes()) { 230 Skin<?> skin = tp.getSkin(); 231 double ph; 232 if (skin instanceof TitledPaneSkin) { 233 ((TitledPaneSkin)skin).setMaxTitledPaneHeightForAccordion(maxTitledPaneHeight); 234 ph = snapSizeY(((TitledPaneSkin)skin).getTitledPaneHeightForAccordion()); 235 } else { 236 ph = tp.prefHeight(w); 237 } 238 tp.resize(w, ph); 239 240 boolean needsRelocate = true; 241 if (! rebuild && previousPane != null && expandedPane != null) { 242 List<TitledPane> panes = getSkinnable().getPanes(); 243 final int previousPaneIndex = panes.indexOf(previousPane); 244 final int expandedPaneIndex = panes.indexOf(expandedPane); 245 final int currentPaneIndex = panes.indexOf(tp); 246 247 if (previousPaneIndex < expandedPaneIndex) { 248 // Current expanded pane is after the previous expanded pane.. 249 // Only move the panes that are less than or equal to the current expanded. 250 if (currentPaneIndex <= expandedPaneIndex) { 251 tp.relocate(x, y); 252 y += ph; 253 needsRelocate = false; 254 } |