535
536 // RT-34863 - clean up CSS cache when Parent is removed from scene-graph
537 Set<Entry<Parent, CacheContainer>> entrySet = cacheContainerMap.entrySet();
538 Iterator<Entry<Parent, CacheContainer>> iterator = entrySet.iterator();
539 while (iterator.hasNext()) {
540 Entry<Parent, CacheContainer> entry = iterator.next();
541 Parent key = entry.getKey();
542 CacheContainer container = entry.getValue();
543 if (parent == key) {
544 iterator.remove();
545 container.clearCache();
546 }
547 }
548
549 final List<String> stylesheets = parent.getStylesheets();
550 if (stylesheets != null && !stylesheets.isEmpty()) {
551 for (String fname : stylesheets) {
552 stylesheetRemoved(parent, fname);
553 }
554 }
555 // Do not iterate over children since this method will be called on each from Parent#scenesChanged
556 }
557
558 /**
559 * called from Parent's stylesheets property's onChanged method
560 */
561 public void stylesheetsChanged(Parent parent, Change<String> c) {
562 c.reset();
563 while(c.next()) {
564 if (c.wasRemoved()) {
565 for (String fname : c.getRemoved()) {
566 stylesheetRemoved(parent, fname);
567
568 StylesheetContainer stylesheetContainer = stylesheetContainerMap.get(fname);
569 if (stylesheetContainer != null) {
570 stylesheetContainer.invalidateChecksum();
571 }
572 }
573 }
574 }
|
535
536 // RT-34863 - clean up CSS cache when Parent is removed from scene-graph
537 Set<Entry<Parent, CacheContainer>> entrySet = cacheContainerMap.entrySet();
538 Iterator<Entry<Parent, CacheContainer>> iterator = entrySet.iterator();
539 while (iterator.hasNext()) {
540 Entry<Parent, CacheContainer> entry = iterator.next();
541 Parent key = entry.getKey();
542 CacheContainer container = entry.getValue();
543 if (parent == key) {
544 iterator.remove();
545 container.clearCache();
546 }
547 }
548
549 final List<String> stylesheets = parent.getStylesheets();
550 if (stylesheets != null && !stylesheets.isEmpty()) {
551 for (String fname : stylesheets) {
552 stylesheetRemoved(parent, fname);
553 }
554 }
555
556 Iterator<StylesheetContainer> containerIterator = stylesheetContainerMap.values().iterator();
557 while (containerIterator.hasNext()) {
558 StylesheetContainer container = containerIterator.next();
559 container.parentUsers.remove(parent);
560 if (container.parentUsers.list.isEmpty()) {
561
562 containerIterator.remove();
563
564 if (container.selectorPartitioning != null) {
565 container.selectorPartitioning.reset();
566 }
567
568
569 // clean up image cache by removing images from the cache that
570 // might have come from this stylesheet
571 final String fname = container.fname;
572 cleanUpImageCache(fname);
573 }
574 }
575
576 // Do not iterate over children since this method will be called on each from Parent#scenesChanged
577 }
578
579 /**
580 * called from Parent's stylesheets property's onChanged method
581 */
582 public void stylesheetsChanged(Parent parent, Change<String> c) {
583 c.reset();
584 while(c.next()) {
585 if (c.wasRemoved()) {
586 for (String fname : c.getRemoved()) {
587 stylesheetRemoved(parent, fname);
588
589 StylesheetContainer stylesheetContainer = stylesheetContainerMap.get(fname);
590 if (stylesheetContainer != null) {
591 stylesheetContainer.invalidateChecksum();
592 }
593 }
594 }
595 }
|