}
private void addParsedSheet(final Iterator it, final boolean asResolver) {
while (it.hasNext()) {
RuleSet rs = (RuleSet)it.next();
MutableAttributeSet attrs = new SimpleAttributeSet();
Iterator pi = rs.getProperties();
while (pi.hasNext()) {
Property property = (Property)pi.next();
addCSSAttribute(attrs, CSS.getAttribute(property.getName()),
property.getValue());
}
if (attrs.getAttributeCount() == 0) {
continue;
}
Iterator si = rs.getSelectors();
while (si.hasNext()) {
String selector = new Selector((String)si.next()).toString();
Style rr = getStyle(selector);
if (rr == null) {
rr = addStyle(selector, null);
addStyleToCascadedStyles(selector);
}
if (asResolver) {
final AttributeSet resolver = rr.getResolveParent();
final MutableAttributeSet importedAttrs =
resolver instanceof MutableAttributeSet
? (MutableAttributeSet)resolver
: addStyle(null, null);
importedAttrs.addAttributes(attrs);
rr.setResolveParent(importedAttrs);
} else {
rr.addAttributes(attrs);
}
}