|
|
@ -47,12 +47,12 @@ |
|
|
|
* http://www.lowagie.com/iText/
|
|
|
|
* http://www.lowagie.com/iText/
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package com.third.v2.lowagie.text; |
|
|
|
package com.fr.third.v2.lowagie.text; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Iterator; |
|
|
|
|
|
|
|
|
|
|
|
import com.third.v2.lowagie.text.pdf.PdfPCell; |
|
|
|
import com.fr.third.v2.lowagie.text.pdf.PdfPCell; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A <CODE>Cell</CODE> is a <CODE>Rectangle</CODE> containing other |
|
|
|
* A <CODE>Cell</CODE> is a <CODE>Rectangle</CODE> containing other |
|
|
@ -100,10 +100,10 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
protected ArrayList arrayList = null; |
|
|
|
protected ArrayList arrayList = null; |
|
|
|
|
|
|
|
|
|
|
|
/** The horizontal alignment of the cell content. */ |
|
|
|
/** The horizontal alignment of the cell content. */ |
|
|
|
protected int horizontalAlignment = Element.ALIGN_UNDEFINED; |
|
|
|
protected int horizontalAlignment = ALIGN_UNDEFINED; |
|
|
|
|
|
|
|
|
|
|
|
/** The vertical alignment of the cell content. */ |
|
|
|
/** The vertical alignment of the cell content. */ |
|
|
|
protected int verticalAlignment = Element.ALIGN_UNDEFINED; |
|
|
|
protected int verticalAlignment = ALIGN_UNDEFINED; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The width of the cell as a String. |
|
|
|
* The width of the cell as a String. |
|
|
@ -239,7 +239,7 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
* @return a type |
|
|
|
* @return a type |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int type() { |
|
|
|
public int type() { |
|
|
|
return Element.CELL; |
|
|
|
return CELL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -560,13 +560,13 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
Element element = (Element) arrayList.get(0); |
|
|
|
Element element = (Element) arrayList.get(0); |
|
|
|
switch (element.type()) { |
|
|
|
switch (element.type()) { |
|
|
|
case Element.CHUNK: |
|
|
|
case CHUNK: |
|
|
|
return ((Chunk) element).isEmpty(); |
|
|
|
return ((Chunk) element).isEmpty(); |
|
|
|
case Element.ANCHOR: |
|
|
|
case ANCHOR: |
|
|
|
case Element.PHRASE: |
|
|
|
case PHRASE: |
|
|
|
case Element.PARAGRAPH: |
|
|
|
case PARAGRAPH: |
|
|
|
return ((Phrase) element).isEmpty(); |
|
|
|
return ((Phrase) element).isEmpty(); |
|
|
|
case Element.LIST: |
|
|
|
case LIST: |
|
|
|
return ((List) element).isEmpty(); |
|
|
|
return ((List) element).isEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -591,7 +591,7 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isTable() { |
|
|
|
public boolean isTable() { |
|
|
|
return (size() == 1) |
|
|
|
return (size() == 1) |
|
|
|
&& (((Element)arrayList.get(0)).type() == Element.TABLE); |
|
|
|
&& (((Element)arrayList.get(0)).type() == TABLE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -613,11 +613,11 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
switch(element.type()) { |
|
|
|
switch(element.type()) { |
|
|
|
case Element.LISTITEM: |
|
|
|
case LISTITEM: |
|
|
|
case Element.ROW: |
|
|
|
case ROW: |
|
|
|
case Element.CELL: |
|
|
|
case CELL: |
|
|
|
throw new BadElementException("You can't add listitems, rows or cells to a cell."); |
|
|
|
throw new BadElementException("You can't add listitems, rows or cells to a cell."); |
|
|
|
case Element.LIST: |
|
|
|
case LIST: |
|
|
|
List list = (List)element; |
|
|
|
List list = (List)element; |
|
|
|
if (Float.isNaN(leading)) { |
|
|
|
if (Float.isNaN(leading)) { |
|
|
|
setLeading(list.getTotalLeading()); |
|
|
|
setLeading(list.getTotalLeading()); |
|
|
@ -625,9 +625,9 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
if (list.isEmpty()) return; |
|
|
|
if (list.isEmpty()) return; |
|
|
|
arrayList.add(element); |
|
|
|
arrayList.add(element); |
|
|
|
return; |
|
|
|
return; |
|
|
|
case Element.ANCHOR: |
|
|
|
case ANCHOR: |
|
|
|
case Element.PARAGRAPH: |
|
|
|
case PARAGRAPH: |
|
|
|
case Element.PHRASE: |
|
|
|
case PHRASE: |
|
|
|
Phrase p = (Phrase)element; |
|
|
|
Phrase p = (Phrase)element; |
|
|
|
if (Float.isNaN(leading)) { |
|
|
|
if (Float.isNaN(leading)) { |
|
|
|
setLeading(p.getLeading()); |
|
|
|
setLeading(p.getLeading()); |
|
|
@ -635,24 +635,24 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
if (p.isEmpty()) return; |
|
|
|
if (p.isEmpty()) return; |
|
|
|
arrayList.add(element); |
|
|
|
arrayList.add(element); |
|
|
|
return; |
|
|
|
return; |
|
|
|
case Element.CHUNK: |
|
|
|
case CHUNK: |
|
|
|
if (((Chunk) element).isEmpty()) return; |
|
|
|
if (((Chunk) element).isEmpty()) return; |
|
|
|
arrayList.add(element); |
|
|
|
arrayList.add(element); |
|
|
|
return; |
|
|
|
return; |
|
|
|
case Element.TABLE: |
|
|
|
case TABLE: |
|
|
|
Table table = new Table(3); |
|
|
|
Table table = new Table(3); |
|
|
|
float[] widths = new float[3]; |
|
|
|
float[] widths = new float[3]; |
|
|
|
widths[1] = ((Table)element).getWidth(); |
|
|
|
widths[1] = ((Table)element).getWidth(); |
|
|
|
switch(((Table)element).getAlignment()) { |
|
|
|
switch(((Table)element).getAlignment()) { |
|
|
|
case Element.ALIGN_LEFT: |
|
|
|
case ALIGN_LEFT: |
|
|
|
widths[0] = 0f; |
|
|
|
widths[0] = 0f; |
|
|
|
widths[2] = 100f - widths[1]; |
|
|
|
widths[2] = 100f - widths[1]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Element.ALIGN_CENTER: |
|
|
|
case ALIGN_CENTER: |
|
|
|
widths[0] = (100f - widths[1]) / 2f; |
|
|
|
widths[0] = (100f - widths[1]) / 2f; |
|
|
|
widths[2] = widths[0]; |
|
|
|
widths[2] = widths[0]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Element.ALIGN_RIGHT: |
|
|
|
case ALIGN_RIGHT: |
|
|
|
widths[0] = 100f - widths[1]; |
|
|
|
widths[0] = 100f - widths[1]; |
|
|
|
widths[2] = 0f; |
|
|
|
widths[2] = 0f; |
|
|
|
} |
|
|
|
} |
|
|
@ -737,7 +737,7 @@ public class Cell extends Rectangle implements TextElementArray { |
|
|
|
cell.setNoWrap(getMaxLines() == 1); |
|
|
|
cell.setNoWrap(getMaxLines() == 1); |
|
|
|
for (Iterator i = getElements(); i.hasNext(); ) { |
|
|
|
for (Iterator i = getElements(); i.hasNext(); ) { |
|
|
|
Element e = (Element)i.next(); |
|
|
|
Element e = (Element)i.next(); |
|
|
|
if (e.type() == Element.PHRASE || e.type() == Element.PARAGRAPH) { |
|
|
|
if (e.type() == PHRASE || e.type() == PARAGRAPH) { |
|
|
|
Paragraph p = new Paragraph((Phrase)e); |
|
|
|
Paragraph p = new Paragraph((Phrase)e); |
|
|
|
p.setAlignment(horizontalAlignment); |
|
|
|
p.setAlignment(horizontalAlignment); |
|
|
|
e = p; |
|
|
|
e = p; |