Пример #1
0
  protected void populateIntegerProperties(Rule rule, Selector selector, Style style) {
    for (PropertyValue pv : rule.getPropertyValues()) {
      for (CssIntegerProperty p : CssIntegerProperty.values()) {
        if (p.getProperty().equals(pv.getProperty())) {
          if (!pv.getValue().contains(PERCENTAGE)) {
            double value = Double.parseDouble(pv.getValue().replaceAll(PX, "").trim());

            if (value < 1) {
              value = 1;
            }

            style.addProperty(p, (int) value);
          }
        }
      }
    }
  }
Пример #2
0
 protected void populateColorProperties(Rule rule, Selector selector, Style style) {
   for (PropertyValue pv : rule.getPropertyValues()) {
     for (CssColorProperty p : CssColorProperty.values()) {
       if (p.getProperty().equals(pv.getProperty())) {
         style.addProperty(p, createColor(pv.getValue().trim()));
       }
     }
   }
 }