Browse Source

Merge pull request #299 in CORE/base-third from release/10.0 to feature/10.0

* commit '9a1f0884aadc1808f956569caf10f2eeec390cd3':
  REPORT-23612 【性能插件】国际换行功能性能问题
  KERNEL-1486 新的64位linux下的动态链接库
  REPORT-22637 PDF导出时列宽有问题(以第一行为准,而不是每列的最大值为准)、解决验收问题
  REPORT-23201 【专题测试】div使用text-index属性,使用em做单位导出无效果
  REPORT-22637 HTML的<table>标签,列宽其每列的最大值
  无 jira 任务,恢复分支信息
research/11.0
Harrison 5 years ago
parent
commit
304e93e895
  1. 2
      build.third_step0.gradle
  2. 2
      build.third_step1.gradle
  3. 2
      build.third_step2.gradle
  4. 2
      build.third_step3.gradle
  5. 2
      build.third_step4.gradle
  6. 2
      build.third_step5.gradle
  7. 2
      build.third_step6.gradle
  8. 28
      fine-icu4j/src/com/fr/third/ibm/icu/text/RuleBasedBreakIterator.java
  9. 4
      fine-itext/src/com/fr/third/v2/lowagie/text/html/Markup.java
  10. 39
      fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
  11. 102
      fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java
  12. BIN
      fine-j2v8/src/libj2v8-linux-x86_64.so

2
build.third_step0.gradle

@ -44,7 +44,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf (java.io.File.separator)+
def srcDir="."
// @branch -
def maven_version="${version}-FEATURE-SNAPSHOT"
def maven_version="${version}-RELEASE-SNAPSHOT"
def jar_version = version
configurations {

2
build.third_step1.gradle

@ -65,7 +65,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-quartz/lib",include:'**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

2
build.third_step2.gradle

@ -55,7 +55,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-antlr4/lib",include: '**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

2
build.third_step3.gradle

@ -51,7 +51,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-jboss-logging/lib",include:'**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

2
build.third_step4.gradle

@ -50,7 +50,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-hibernate/lib",include:'**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

2
build.third_step5.gradle

@ -49,7 +49,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-druid/lib",include:'**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

2
build.third_step6.gradle

@ -83,7 +83,7 @@ dependencies{
compile fileTree(dir:"${srcDir}/fine-jgit/lib",include:'**/*.jar')
compile fileTree(dir:"${srcDir}/build/libs/",include:'**/*.jar')
// @branch -
compile "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT"
compile "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT"
compile fileTree(dir:"../../finereport-lib-other/${branchName}",include:'**/*.jar')
testCompile 'junit:junit:4.12'
}

28
fine-icu4j/src/com/fr/third/ibm/icu/text/RuleBasedBreakIterator.java

@ -17,6 +17,7 @@ import java.nio.ByteBuffer;
import java.text.CharacterIterator;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import com.fr.third.ibm.icu.impl.CharacterIteration;
import com.fr.third.ibm.icu.impl.ICUBinary;
@ -43,8 +44,11 @@ public class RuleBasedBreakIterator extends BreakIterator {
*/
private RuleBasedBreakIterator() {
fDictionaryCharCount = 0;
synchronized(gAllBreakEngines) {
try {
rLock.lock();
fBreakEngines = new ArrayList<LanguageBreakEngine>(gAllBreakEngines);
} finally {
rLock.unlock();
}
}
@ -131,8 +135,11 @@ public class RuleBasedBreakIterator extends BreakIterator {
if (fText != null) {
result.fText = (CharacterIterator)(fText.clone());
}
synchronized (gAllBreakEngines) {
try {
rLock.lock();
result.fBreakEngines = new ArrayList<LanguageBreakEngine>(gAllBreakEngines);
} finally {
rLock.unlock();
}
result.fLookAheadMatches = new LookAheadResults();
result.fBreakCache = result.new BreakCache(fBreakCache);
@ -294,10 +301,19 @@ public class RuleBasedBreakIterator extends BreakIterator {
*/
private static final List<LanguageBreakEngine> gAllBreakEngines;
private static final ReentrantReadWriteLock rwLock;
private static final ReentrantReadWriteLock.ReadLock rLock;
private static final ReentrantReadWriteLock.WriteLock wLock;
static {
gUnhandledBreakEngine = new UnhandledBreakEngine();
gAllBreakEngines = new ArrayList<LanguageBreakEngine>();
gAllBreakEngines.add(gUnhandledBreakEngine);
rwLock = new ReentrantReadWriteLock();
rLock = rwLock.readLock();
wLock = rwLock.writeLock();
}
/**
@ -663,7 +679,8 @@ public class RuleBasedBreakIterator extends BreakIterator {
}
}
synchronized (gAllBreakEngines) {
try {
wLock.lock();
// This break iterator's list of break engines didn't handle the character.
// Check the global list, another break iterator may have instantiated the
// desired engine.
@ -717,7 +734,10 @@ public class RuleBasedBreakIterator extends BreakIterator {
fBreakEngines.add(eng);
}
return eng;
} // end synchronized(gAllBreakEngines)
// end synchronized(gAllBreakEngines)
} finally {
wLock.unlock();
}
}
private static final int kMaxLookaheads = 8;

4
fine-itext/src/com/fr/third/v2/lowagie/text/html/Markup.java

@ -209,6 +209,8 @@ public class Markup {
/** the CSS tag for the visibility of objects */
public static final String CSS_KEY_VISIBILITY = "visibility";
public static final String CSS_KEY_TEXTINDENT = "text-indent";
// CSS values
/**
@ -341,7 +343,7 @@ public class Markup {
/**
* New method contributed by: Lubos Strapko
*
*
* @since 2.1.3
*/
public static float parseLength(String string, float actualFontSize) {

39
fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java

@ -374,14 +374,7 @@ public class FactoryProperties {
if (key.equals(Markup.CSS_KEY_FONTFAMILY)) {
h.put(ElementTags.FACE, prop.getProperty(key));
} else if (key.equals(Markup.CSS_KEY_FONTSIZE)) {
float actualFontSize = Markup.parseLength(cprops
.getProperty(ElementTags.SIZE),
Markup.DEFAULT_FONT_SIZE);
if (actualFontSize <= 0f)
actualFontSize = Markup.DEFAULT_FONT_SIZE;
h.put(ElementTags.SIZE, Float.toString(Markup.parseLength(prop
.getProperty(key), actualFontSize))
+ "pt");
dealWithFontSizeOrTextIndent(h, cprops, prop, key);
} else if (key.equals(Markup.CSS_KEY_FONTSTYLE)) {
String ss = prop.getProperty(key).trim().toLowerCase();
if (ss.equals("italic") || ss.equals("oblique"))
@ -429,14 +422,34 @@ public class FactoryProperties {
} else if (key.equals(Markup.CSS_KEY_BGCOLOR)) {
String ss = prop.getProperty(key).trim().toLowerCase();
h.put("background", ss);
}
else{
String ss = prop.getProperty(key).trim();
h.put(key, ss);
}
} else if (key.equals(Markup.CSS_KEY_TEXTINDENT)) {
dealWithFontSizeOrTextIndent(h, cprops, prop, key);
} else {
String ss = prop.getProperty(key).trim();
h.put(key, ss);
}
}
}
/**
* 处理下字号和文本缩进
*
* @param h 当前标签内的属性Map
* @param cprops 一个list 从左到右保存着父到子标签中的属性
* @param prop 当前标签内的style 属性Map
* @param key 当前 prop 中的 k
*/
private static void dealWithFontSizeOrTextIndent(HashMap h, ChainedProperties cprops, Properties prop, String key) {
float actualFontSize = Markup.parseLength(cprops
.getProperty(ElementTags.SIZE),
Markup.DEFAULT_FONT_SIZE);
if (actualFontSize <= 0f)
actualFontSize = Markup.DEFAULT_FONT_SIZE;
h.put(key.equals(Markup.CSS_KEY_FONTSIZE) ? ElementTags.SIZE : key, Float.toString(Markup.parseLength(prop
.getProperty(key), actualFontSize))
+ "pt");
}
public FontFactoryImp getFontImp() {
return fontImp;
}

102
fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java

@ -68,6 +68,7 @@ public class IncTable {
private ArrayList cols;
private ArrayList<Float> rowHeights = new ArrayList<Float>();
private ArrayList<Float> relativeColWidths = new ArrayList<Float>();
/** Creates a new instance of IncTable */
public IncTable(HashMap props) {
this.props.putAll(props);
@ -103,33 +104,30 @@ public class IncTable {
if (rows.isEmpty())
return new PdfPTable(1);
int ncol = 0;
ArrayList c0 = (ArrayList)rows.get(0);
ArrayList<Float> colWidths = new ArrayList<Float>();
float widthSum = 0;
ArrayList c0 = (ArrayList) rows.get(0);
for (int k = 0; k < c0.size(); ++k) {
PdfPCell pCell = ((PdfPCell)c0.get(k));
int cellCols = pCell.getColspan();
ncol += cellCols;
//不取 0 ,后面可能需要求比值
float styleWidth = pCell.getStyleWidth();
if(cellCols > 1){
float avgWidth = styleWidth / cellCols;
float width = 0 == avgWidth ? 1 : avgWidth;
widthSum = width * cellCols;
for(int a = 0; a < cellCols ; a++){
colWidths.add(width);
}
}else {
float width = 0 == styleWidth ? 1 : styleWidth;
widthSum += width;
colWidths.add(width);
}
ncol += ((PdfPCell) c0.get(k)).getColspan();
}
processColWidth(ncol);
PdfPTable table = new PdfPTable(ncol);
try {
TableProperties tableProperties = parseTableProperties();
table.setTableProperties(tableProperties);
//相对宽度
float[] floats = new float[relativeColWidths.size()];
for (int a = 0; a < relativeColWidths.size(); a++) {
floats[a] = relativeColWidths.get(a);
}
try {
table.setWidths(floats);
} catch (Exception e) {
e.printStackTrace();
}
String width = (String)props.get("width");
if (width == null)
table.setWidthPercentage(100);
@ -138,18 +136,7 @@ public class IncTable {
table.setWidthPercentage(CSSUtils.parseFloat(width));
else {
//解析单元格宽度
float totalWidth = CSSUtils.parseFloat(width);
float[] floats = new float[colWidths.size()];
for (int a = 0; a < colWidths.size(); a++) {
floats[a] = totalWidth * colWidths.get(a) / widthSum;
}
//解析px数值
table.setTotalWidth(totalWidth);
try {
table.setWidths(floats);
}catch (Exception e){
e.printStackTrace();
}
table.setTotalWidth(CSSUtils.parseFloat(width));
table.setLockedWidth(true);
}
}
@ -161,14 +148,61 @@ public class IncTable {
}
processRowHeight(table);
}catch (Exception e){
e.printStackTrace();
}
return table;
}
/**
* 调整列宽每列取最大值
*
* @param colCount 列数
*/
private void processColWidth(int colCount) {
if (null == rows || 0 == rows.size()) {
return;
}
//初始化一下
for (int i = 0; i < colCount; i++) {
relativeColWidths.add(0f);
}
for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {
ArrayList cols = (ArrayList) rows.get(rowIndex);
for (int colIndex = 0; colIndex < cols.size(); colIndex++) {
PdfPCell pCell = ((PdfPCell) cols.get(colIndex));
int cellCols = pCell.getColspan();
float avgWidth = pCell.getStyleWidth() / cellCols;
for (int i = 0; i < cellCols && colIndex + i < colCount; i++) {
if (relativeColWidths.get(colIndex + i) < avgWidth) {
relativeColWidths.set(colIndex + i, avgWidth);
}
}
}
}
dealRelativeColWidthsWhenAllAreZero(relativeColWidths);
}
/**
* 全部为0,则全部赋值1
*
* @param relativeColWidths 相对宽度
*/
private void dealRelativeColWidthsWhenAllAreZero(ArrayList<Float> relativeColWidths) {
if (0 == relativeColWidths.size()) {
return;
}
for (int i = 0; i < relativeColWidths.size(); i++) {
if (0 != relativeColWidths.get(i)) {
return;
}
}
for (int i = 0; i < relativeColWidths.size(); i++) {
relativeColWidths.set(i, 1f);
}
}
public void processRowHeight(PdfPTable table) {
Float height = CSSUtils.parseFloat((String) props.get("height"));
Float eachHeight = height / table.getRows().size();

BIN
fine-j2v8/src/libj2v8-linux-x86_64.so

Binary file not shown.
Loading…
Cancel
Save