Hugh.C
5 years ago
3 changed files with 50 additions and 53 deletions
@ -1,48 +1,48 @@
|
||||
package com.fr.third.v2.lowagie.text.html.Utils; |
||||
|
||||
import com.fr.third.v2.lowagie.text.html.CSSUtils; |
||||
import com.fr.third.v2.lowagie.text.html.simpleparser.ChainedProperties; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hugh.C |
||||
* @version 1.0 |
||||
* Created by Hugh.C on 2020/2/26 |
||||
*/ |
||||
public class BackgroundUtil { |
||||
|
||||
public static Map<String, String> parse2RulesMap(ChainedProperties props) { |
||||
Map<String, String> backgroundRules = new HashMap<String, String>(); |
||||
String value = props.getProperty("bgcolor"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-color", value); |
||||
} |
||||
value = props.getLastChainProperty("background-size"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-size", value); |
||||
} |
||||
value = props.getLastChainProperty("background"); |
||||
if (value != null) { |
||||
Map<String, String> backgroundStyles = CSSUtils.processBackground(value); |
||||
backgroundRules.putAll(backgroundStyles); |
||||
} |
||||
value = props.getLastChainProperty("background-color"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-color", value); |
||||
} |
||||
value = props.getLastChainProperty("background-position"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-position", value); |
||||
} |
||||
value = props.getLastChainProperty("background-repeat"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-repeat", value); |
||||
} |
||||
value = props.getLastChainProperty("background-image"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-image", value); |
||||
} |
||||
return backgroundRules; |
||||
} |
||||
} |
||||
package com.fr.third.v2.lowagie.text.html.utils; |
||||
|
||||
import com.fr.third.v2.lowagie.text.html.CSSUtils; |
||||
import com.fr.third.v2.lowagie.text.html.simpleparser.ChainedProperties; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hugh.C |
||||
* @version 1.0 |
||||
* Created by Hugh.C on 2020/2/26 |
||||
*/ |
||||
public class BackgroundUtil { |
||||
|
||||
public static Map<String, String> parse2RulesMap(ChainedProperties props) { |
||||
Map<String, String> backgroundRules = new HashMap<String, String>(); |
||||
String value = props.getProperty("bgcolor"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-color", value); |
||||
} |
||||
value = props.getLastChainProperty("background-size"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-size", value); |
||||
} |
||||
value = props.getLastChainProperty("background"); |
||||
if (value != null) { |
||||
Map<String, String> backgroundStyles = CSSUtils.processBackground(value); |
||||
backgroundRules.putAll(backgroundStyles); |
||||
} |
||||
value = props.getLastChainProperty("background-color"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-color", value); |
||||
} |
||||
value = props.getLastChainProperty("background-position"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-position", value); |
||||
} |
||||
value = props.getLastChainProperty("background-repeat"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-repeat", value); |
||||
} |
||||
value = props.getLastChainProperty("background-image"); |
||||
if (value != null) { |
||||
backgroundRules.put("background-image", value); |
||||
} |
||||
return backgroundRules; |
||||
} |
||||
} |
Loading…
Reference in new issue