292 * {@inheritDoc} 293 */ 294 @Override 295 protected void interpolate(double frac) { 296 final Color newColor = start.interpolate(end, frac); 297 cachedShape.setStroke(newColor); 298 } 299 300 private Shape getTargetShape() { 301 Shape shape = getShape(); 302 if (shape == null) { 303 final Node node = getParentTargetNode(); 304 if (node instanceof Shape) { 305 shape = (Shape) node; 306 } 307 } 308 return shape; 309 } 310 311 @Override 312 boolean impl_startable(boolean forceSync) { 313 if (!super.impl_startable(forceSync)) { 314 return false; 315 } 316 // check if synchronization is not forced and cached values are valid 317 if (!forceSync && (cachedShape != null)) { 318 return true; 319 } 320 321 // we have to synchronize 322 final Shape shape = getTargetShape(); 323 return ((shape != null) // shape is defined? 324 && ((getFromValue() != null) || (shape.getStroke() instanceof Color)) // fromValue 325 // defined 326 // or 327 // current 328 // stroke 329 // paint 330 // is 331 // Color? 332 && (getToValue() != null)); // toValue defined? 333 } 334 335 @Override 336 void impl_sync(boolean forceSync) { 337 super.impl_sync(forceSync); 338 if (forceSync || (cachedShape == null)) { 339 cachedShape = getTargetShape(); 340 final Color _fromValue = getFromValue(); 341 start = (_fromValue != null) ? _fromValue : (Color) cachedShape 342 .getStroke(); 343 end = getToValue(); 344 } 345 } 346 } | 292 * {@inheritDoc} 293 */ 294 @Override 295 protected void interpolate(double frac) { 296 final Color newColor = start.interpolate(end, frac); 297 cachedShape.setStroke(newColor); 298 } 299 300 private Shape getTargetShape() { 301 Shape shape = getShape(); 302 if (shape == null) { 303 final Node node = getParentTargetNode(); 304 if (node instanceof Shape) { 305 shape = (Shape) node; 306 } 307 } 308 return shape; 309 } 310 311 @Override 312 boolean startable(boolean forceSync) { 313 if (!super.startable(forceSync)) { 314 return false; 315 } 316 // check if synchronization is not forced and cached values are valid 317 if (!forceSync && (cachedShape != null)) { 318 return true; 319 } 320 321 // we have to synchronize 322 final Shape shape = getTargetShape(); 323 return ((shape != null) // shape is defined? 324 && ((getFromValue() != null) || (shape.getStroke() instanceof Color)) // fromValue 325 // defined 326 // or 327 // current 328 // stroke 329 // paint 330 // is 331 // Color? 332 && (getToValue() != null)); // toValue defined? 333 } 334 335 @Override 336 void sync(boolean forceSync) { 337 super.sync(forceSync); 338 if (forceSync || (cachedShape == null)) { 339 cachedShape = getTargetShape(); 340 final Color _fromValue = getFromValue(); 341 start = (_fromValue != null) ? _fromValue : (Color) cachedShape 342 .getStroke(); 343 end = getToValue(); 344 } 345 } 346 } |