for (int i = 0; i < n.getLength(); i++) {
String name = n.item(i);
if (n.getPropertyCSSValue(name) instanceof CSSPrimitiveValue) {
CSSPrimitiveValue value = (CSSPrimitiveValue) n.getPropertyCSSValue(name);
if (name.equalsIgnoreCase("color")) {
model.setColor(getColor(value));
}
if (name.equalsIgnoreCase("border-color")) {
model.getBorder().setColor(getColor(value));
}
if (name.equalsIgnoreCase("border-width")) {
model.getBorder().setWidth(getSize(value));
}
if (name.equalsIgnoreCase("width")) {
model.setWidth(getSize(value));
}
if (name.equalsIgnoreCase("height")) {
model.setHeight(getSize(value));
}
if (name.equalsIgnoreCase("border")) {
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setBorder(getBorder(list));
}
if (name.equalsIgnoreCase("margin")) {
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setMargings(getMargins(list));
}
if (name.equalsIgnoreCase("border-style")) {
model.getBorder().setStyle(value.getStringValue());
}
if (name.equalsIgnoreCase("background")) {
model.setBackground(getColor(value));
}
if (name.equalsIgnoreCase("background-color")) {
model.setBackground(getColor(value));
}
if (name.equalsIgnoreCase("font")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());
CSSValueList list = (CSSValueList) n.getPropertyCSSValue(name);
model.setFont(getFont(model, list));
}
if (name.equalsIgnoreCase("font-family")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());
model.getFont().setName(value.getCssText());
}
if (name.equalsIgnoreCase("font-style")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());
String stringFontStyleValue = value.getStringValue();
int fontStyleValue = 0;
if (stringFontStyleValue.equalsIgnoreCase("italic")) {
fontStyleValue = Font.ITALIC;
isItalic = true;
}
model.getFont().setStyle(fontStyleValue);
}
if (name.equalsIgnoreCase("font-weight")) {
if (model.getFont() == null) model.setFont(new StyleFontModel());
String stringFontWeightValue = value.getStringValue();
int fontStyleValue = 0;
if (stringFontWeightValue.equalsIgnoreCase("bold")) {
fontStyleValue = Font.BOLD;
isBold = true;
}