|
|
@ -1,6 +1,5 @@ |
|
|
|
package com.fr.third.v2.lowagie.text.pdf; |
|
|
|
package com.fr.third.v2.lowagie.text.pdf; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.third.v2.lowagie.text.DocumentException; |
|
|
|
|
|
|
|
import com.fr.third.v2.lowagie.text.html.CSSUtils; |
|
|
|
import com.fr.third.v2.lowagie.text.html.CSSUtils; |
|
|
|
import com.fr.third.v2.lowagie.text.html.Markup; |
|
|
|
import com.fr.third.v2.lowagie.text.html.Markup; |
|
|
|
|
|
|
|
|
|
|
@ -10,6 +9,10 @@ public class BorderStyle { |
|
|
|
private float borderWidth = 0.0f; |
|
|
|
private float borderWidth = 0.0f; |
|
|
|
private Color borderColor = Color.black; |
|
|
|
private Color borderColor = Color.black; |
|
|
|
private String borderPattern = "solid"; |
|
|
|
private String borderPattern = "solid"; |
|
|
|
|
|
|
|
//形如 border:1px
|
|
|
|
|
|
|
|
private static final int BORDER_WIDTH = 1; |
|
|
|
|
|
|
|
//形如 border:1px solid black
|
|
|
|
|
|
|
|
private static final int BORDER_PROPERTY = 3; |
|
|
|
|
|
|
|
|
|
|
|
public float getBorderWidth() { |
|
|
|
public float getBorderWidth() { |
|
|
|
return borderWidth; |
|
|
|
return borderWidth; |
|
|
@ -42,17 +45,26 @@ public class BorderStyle { |
|
|
|
public BorderStyle(int borderWidth, String borderPattern, Color borderColor) { |
|
|
|
public BorderStyle(int borderWidth, String borderPattern, Color borderColor) { |
|
|
|
this.borderWidth = borderWidth; |
|
|
|
this.borderWidth = borderWidth; |
|
|
|
this.borderPattern = borderPattern; |
|
|
|
this.borderPattern = borderPattern; |
|
|
|
this.borderWidth = borderWidth; |
|
|
|
this.borderColor = borderColor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static BorderStyle parseBorderStyle(String borderString) throws DocumentException { |
|
|
|
public void parseBorderStyle(String borderString) { |
|
|
|
BorderStyle borderStyle = new BorderStyle(); |
|
|
|
|
|
|
|
String[] borderPros = borderString.split(" "); |
|
|
|
String[] borderPros = borderString.split(" "); |
|
|
|
borderStyle.setBorderWidth(CSSUtils.parseFloat(borderPros[0])); |
|
|
|
switch (borderPros.length) { |
|
|
|
borderStyle.setBorderPattern(borderPros[1]); |
|
|
|
case BORDER_WIDTH: |
|
|
|
borderStyle.setBorderColor(Markup.decodeColor(borderPros[2])); |
|
|
|
this.setBorderWidth(CSSUtils.parseFloat(borderPros[0])); |
|
|
|
return borderStyle; |
|
|
|
break; |
|
|
|
|
|
|
|
case BORDER_PROPERTY: |
|
|
|
|
|
|
|
this.setBorderWidth(CSSUtils.parseFloat(borderPros[0])); |
|
|
|
|
|
|
|
this.setBorderPattern(borderPros[1]); |
|
|
|
|
|
|
|
this.setBorderColor(Markup.decodeColor(borderPros[2])); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|