238 239 if (spinner != null) { 240 spinner = null; 241 } 242 243 control = null; 244 } 245 246 /** {@inheritDoc} */ 247 @Override protected void layoutChildren(final double x, final double y, 248 final double w, final double h) { 249 if (spinner != null && control.isIndeterminate()) { 250 spinner.layoutChildren(); 251 spinner.resizeRelocate(0, 0, w, h); 252 } else if (determinateIndicator != null) { 253 determinateIndicator.layoutChildren(); 254 determinateIndicator.resizeRelocate(0, 0, w, h); 255 } 256 } 257 258 259 260 /*************************************************************************** 261 * * 262 * Private implementation * 263 * * 264 **************************************************************************/ 265 266 void initialize() { 267 boolean isIndeterminate = control.isIndeterminate(); 268 if (isIndeterminate) { 269 // clean up determinateIndicator 270 determinateIndicator = null; 271 272 // create spinner 273 spinner = new IndeterminateSpinner(spinEnabled.get(), progressColor.get()); 274 getChildren().setAll(spinner); 275 if (NodeHelper.isTreeShowing(control)) { 276 if (indeterminateTransition != null) { 277 indeterminateTransition.play(); | 238 239 if (spinner != null) { 240 spinner = null; 241 } 242 243 control = null; 244 } 245 246 /** {@inheritDoc} */ 247 @Override protected void layoutChildren(final double x, final double y, 248 final double w, final double h) { 249 if (spinner != null && control.isIndeterminate()) { 250 spinner.layoutChildren(); 251 spinner.resizeRelocate(0, 0, w, h); 252 } else if (determinateIndicator != null) { 253 determinateIndicator.layoutChildren(); 254 determinateIndicator.resizeRelocate(0, 0, w, h); 255 } 256 } 257 258 /** {@inheritDoc} */ 259 @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { 260 double minWidth = 0.0; 261 262 if (spinner != null && control.isIndeterminate()) { 263 minWidth = spinner.minWidth(-1); 264 } else if (determinateIndicator != null) { 265 minWidth = determinateIndicator.minWidth(-1); 266 } 267 return minWidth; 268 } 269 270 /** {@inheritDoc} */ 271 @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { 272 double minHeight = 0.0; 273 274 if (spinner != null && control.isIndeterminate()) { 275 minHeight = spinner.minHeight(-1); 276 } else if (determinateIndicator != null) { 277 minHeight = determinateIndicator.minHeight(-1); 278 } 279 return minHeight; 280 } 281 282 /** {@inheritDoc} */ 283 @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { 284 double prefWidth = 0.0; 285 286 if (spinner != null && control.isIndeterminate()) { 287 prefWidth = spinner.prefWidth(height); 288 } else if (determinateIndicator != null) { 289 prefWidth = determinateIndicator.prefWidth(height); 290 } 291 return prefWidth; 292 } 293 294 /** {@inheritDoc} */ 295 @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { 296 double prefHeight = 0.0; 297 298 if (spinner != null && control.isIndeterminate()) { 299 prefHeight = spinner.prefHeight(width); 300 } else if (determinateIndicator != null) { 301 prefHeight = determinateIndicator.prefHeight(width); 302 } 303 return prefHeight; 304 } 305 306 /** {@inheritDoc} */ 307 @Override protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { 308 return computePrefWidth(height, topInset, rightInset, bottomInset, leftInset); 309 } 310 311 /** {@inheritDoc} */ 312 @Override protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { 313 return computePrefHeight(width, topInset, rightInset, bottomInset, leftInset); 314 } 315 316 317 /*************************************************************************** 318 * * 319 * Private implementation * 320 * * 321 **************************************************************************/ 322 323 void initialize() { 324 boolean isIndeterminate = control.isIndeterminate(); 325 if (isIndeterminate) { 326 // clean up determinateIndicator 327 determinateIndicator = null; 328 329 // create spinner 330 spinner = new IndeterminateSpinner(spinEnabled.get(), progressColor.get()); 331 getChildren().setAll(spinner); 332 if (NodeHelper.isTreeShowing(control)) { 333 if (indeterminateTransition != null) { 334 indeterminateTransition.play(); |