public void cache ( ) { if ( ! isCached . getAndSet ( true ) ) { this . cache = node . isCache ( ) ; this . cacheHint = node . getCacheHint ( ) ; node . setCache ( true ) ; node . setCacheHint ( CacheHint . SPEED ) ; if ( node instanceof Region ) { this . cacheShape = ( ( Region ) node ) . isCacheShape ( ) ; this . snapToPixel = ( ( Region ) node ) . isSnapToPixel ( ) ; ( ( Region ) node ) . setCacheShape ( true ) ; ( ( Region ) node ) . setSnapToPixel ( true ) ; } } }
this method will cache the node only if it wasn t cached before