modules/graphics/src/main/java/com/sun/javafx/css/StyleManager.java

Print this page

        

*** 23,32 **** --- 23,33 ---- * questions. */ package com.sun.javafx.css; + import javafx.application.Application; import javafx.css.Styleable; import java.io.FileNotFoundException; import java.io.FilePermission; import java.io.IOException; import java.io.InputStream;
*** 1270,1279 **** --- 1271,1315 ---- CssError.setCurrentScene(null); } /** + * Removes the specified stylesheet from the application default user agent + * stylesheet list. + * @param url The file URL, either relative or absolute, as a String. + */ + public void removeUserAgentStylesheet(String url) { + if (url == null ) { + throw new IllegalArgumentException("null arg url"); + } + + final String fname = url.trim(); + if (fname.isEmpty()) { + return; + } + + // if we already have this stylesheet, remove it! + boolean removed = false; + for (int n = platformUserAgentStylesheetContainers.size() - 1; n >= 0; n--) { + // don't remove the platform default user agent stylesheet + if (fname.equals(Application.getUserAgentStylesheet())) { + continue; + } + + StylesheetContainer container = platformUserAgentStylesheetContainers.get(n); + if (fname.equals(container.fname)) { + platformUserAgentStylesheetContainers.remove(n); + removed = true; + } + } + + if (removed) { + userAgentStylesheetsChanged(); + } + } + + /** * Set the user agent stylesheet. This is the base default stylesheet for * the platform */ public void setDefaultUserAgentStylesheet(Stylesheet ua_stylesheet) {