// "_rtl.css");
// }
// Find existing style sheets that need to be removed
boolean styleSheetsFound = false;
final HeadElement headElem = StyleSheetLoader.getHeadElement();
final List<Element> toRemove = new ArrayList<Element>();
NodeList<Node> children = headElem.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.getItem(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element elem = Element.as(node);
if (elem.getTagName().equalsIgnoreCase("link")
&& elem.getPropertyString("rel").equalsIgnoreCase("stylesheet")) {
styleSheetsFound = true;
String href = elem.getPropertyString("href");
// If the correct style sheets are already loaded, then we
// should have nothing to remove.
// if (!href.contains(gwtStyleSheet) &&
// !href.contains(showcaseStyleSheet)) {
if (!href.contains(gwtStyleSheet)) {
toRemove.add(elem);
}
}
}
}
if (styleSheetsFound && toRemove.size() == 0) {
GenClient.showError("Return since we already have the correct style sheets");
return;
}
// Detach the app while we manipulate the styles to avoid rendering
// issues
RootPanel.get().remove(vPanel);
// Remove the old style sheets
for (Element elem : toRemove) {
headElem.removeChild(elem);
}
// Load the GWT theme style sheet
String modulePath = GWT.getModuleBaseURL();
Command callback = new Command() {