All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdfjet.Table Maven / Gradle / Ivy

/*     */ package com.pdfjet;
/*     */ 
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Table
/*     */ {
/*     */   public static final int DATA_HAS_0_HEADER_ROWS = 0;
/*     */   public static final int DATA_HAS_1_HEADER_ROWS = 1;
/*     */   public static final int DATA_HAS_2_HEADER_ROWS = 2;
/*     */   public static final int DATA_HAS_3_HEADER_ROWS = 3;
/*     */   public static final int DATA_HAS_4_HEADER_ROWS = 4;
/*     */   public static final int DATA_HAS_5_HEADER_ROWS = 5;
/*     */   public static final int DATA_HAS_6_HEADER_ROWS = 6;
/*     */   public static final int DATA_HAS_7_HEADER_ROWS = 7;
/*     */   public static final int DATA_HAS_8_HEADER_ROWS = 8;
/*     */   public static final int DATA_HAS_9_HEADER_ROWS = 9;
/*  53 */   private int rendered = 0;
/*     */   private int numOfPages;
/*  56 */   private List> tableData = null;
/*  57 */   private int numOfHeaderRows = 0;
/*     */   private float x1;
/*     */   private float y1;
/*  62 */   private float bottom_margin = 30.0F;
/*     */ 
/*     */   public Table()
/*     */   {
/*  70 */     this.tableData = new ArrayList();
/*     */   }
/*     */ 
/*     */   public void setPosition(double paramDouble1, double paramDouble2)
/*     */   {
/*  81 */     this.x1 = ((float)paramDouble1);
/*  82 */     this.y1 = ((float)paramDouble2);
/*     */   }
/*     */ 
/*     */   public void setPosition(float paramFloat1, float paramFloat2)
/*     */   {
/*  93 */     setLocation(paramFloat1, paramFloat2);
/*     */   }
/*     */ 
/*     */   public void setLocation(float paramFloat1, float paramFloat2)
/*     */   {
/* 104 */     this.x1 = paramFloat1;
/* 105 */     this.y1 = paramFloat2;
/*     */   }
/*     */ 
/*     */   public void setBottomMargin(double paramDouble)
/*     */   {
/* 115 */     this.bottom_margin = ((float)paramDouble);
/*     */   }
/*     */ 
/*     */   public void setBottomMargin(float paramFloat)
/*     */   {
/* 125 */     this.bottom_margin = paramFloat;
/*     */   }
/*     */ 
/*     */   public void setData(List> paramList)
/*     */     throws Exception
/*     */   {
/* 140 */     this.tableData = paramList;
/* 141 */     this.numOfHeaderRows = 0;
/* 142 */     this.rendered = this.numOfHeaderRows;
/*     */   }
/*     */ 
/*     */   public void setData(List> paramList, int paramInt)
/*     */     throws Exception
/*     */   {
/* 154 */     this.tableData = paramList;
/* 155 */     this.numOfHeaderRows = paramInt;
/* 156 */     this.rendered = paramInt;
/*     */   }
/*     */ 
/*     */   public void autoAdjustColumnWidths()
/*     */   {
/* 165 */     float[] arrayOfFloat = new float[((List)this.tableData.get(0)).size()];
/*     */     List localList;
/*     */     int j;
/*     */     Cell localCell;
/* 166 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 167 */       localList = (List)this.tableData.get(i);
/* 168 */       for (j = 0; j < localList.size(); j++) {
/* 169 */         localCell = (Cell)localList.get(j);
/* 170 */         if (localCell.getColSpan() == 1) {
/* 171 */           float f = 0.0F;
/* 172 */           if (localCell.image != null) {
/* 173 */             f = localCell.image.getWidth();
/*     */           }
/* 175 */           if ((localCell.text != null) && 
/* 176 */             (localCell.font.stringWidth(localCell.fallbackFont, localCell.text) > f)) {
/* 177 */             f = localCell.font.stringWidth(localCell.fallbackFont, localCell.text);
/*     */           }
/*     */ 
/* 180 */           localCell.setWidth(f + localCell.left_padding + localCell.right_padding);
/* 181 */           if ((arrayOfFloat[j] == 0.0F) || (localCell.getWidth() > arrayOfFloat[j]))
/*     */           {
/* 183 */             arrayOfFloat[j] = localCell.getWidth();
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 189 */     for (i = 0; i < this.tableData.size(); i++) {
/* 190 */       localList = (List)this.tableData.get(i);
/* 191 */       for (j = 0; j < localList.size(); j++) {
/* 192 */         localCell = (Cell)localList.get(j);
/* 193 */         localCell.setWidth(arrayOfFloat[j]);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void rightAlignNumbers()
/*     */   {
/* 203 */     for (int i = this.numOfHeaderRows; i < this.tableData.size(); i++) {
/* 204 */       List localList = (List)this.tableData.get(i);
/* 205 */       for (int j = 0; j < localList.size(); j++) {
/* 206 */         Cell localCell = (Cell)localList.get(j);
/* 207 */         if (localCell.text != null) {
/* 208 */           String str = localCell.text;
/* 209 */           int k = str.length();
/* 210 */           int m = 1;
/* 211 */           int n = 0;
/* 212 */           while (n < k) {
/* 213 */             char c = str.charAt(n++);
/* 214 */             if ((!Character.isDigit(c)) && (c != '(') && (c != ')') && (c != '-') && (c != '.') && (c != ',') && (c != '\''))
/*     */             {
/* 221 */               m = 0;
/*     */             }
/*     */           }
/* 224 */           if (m != 0)
/* 225 */             localCell.setTextAlignment(2097152);
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void removeLineBetweenRows(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 238 */     for (int i = paramInt1; i < paramInt2; i++) {
/* 239 */       List localList = (List)this.tableData.get(i);
/*     */       Cell localCell;
/* 240 */       for (int j = 0; j < localList.size(); j++) {
/* 241 */         localCell = (Cell)localList.get(j);
/* 242 */         localCell.setBorder(131072, false);
/*     */       }
/* 244 */       localList = (List)this.tableData.get(i + 1);
/* 245 */       for (j = 0; j < localList.size(); j++) {
/* 246 */         localCell = (Cell)localList.get(j);
/* 247 */         localCell.setBorder(65536, false);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setTextAlignInColumn(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 261 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 262 */       List localList = (List)this.tableData.get(i);
/* 263 */       if (paramInt1 < localList.size())
/* 264 */         ((Cell)localList.get(paramInt1)).setTextAlignment(paramInt2);
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setTextColorInColumn(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 278 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 279 */       List localList = (List)this.tableData.get(i);
/* 280 */       if (paramInt1 < localList.size())
/* 281 */         ((Cell)localList.get(paramInt1)).setBrushColor(paramInt2);
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setFontInColumn(int paramInt, Font paramFont)
/*     */     throws Exception
/*     */   {
/* 294 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 295 */       List localList = (List)this.tableData.get(i);
/* 296 */       if (paramInt < localList.size())
/* 297 */         ((Cell)localList.get(paramInt)).font = paramFont;
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setTextColorInRow(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 311 */     List localList = (List)this.tableData.get(paramInt1);
/* 312 */     for (int i = 0; i < localList.size(); i++)
/* 313 */       ((Cell)localList.get(i)).setBrushColor(paramInt2);
/*     */   }
/*     */ 
/*     */   public void setFontInRow(int paramInt, Font paramFont)
/*     */     throws Exception
/*     */   {
/* 325 */     List localList = (List)this.tableData.get(paramInt);
/* 326 */     for (int i = 0; i < localList.size(); i++)
/* 327 */       ((Cell)localList.get(i)).font = paramFont;
/*     */   }
/*     */ 
/*     */   public void setColumnWidth(int paramInt, float paramFloat)
/*     */     throws Exception
/*     */   {
/* 340 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 341 */       List localList = (List)this.tableData.get(i);
/* 342 */       if (paramInt < localList.size())
/* 343 */         ((Cell)localList.get(paramInt)).setWidth(paramFloat);
/*     */     }
/*     */   }
/*     */ 
/*     */   public float getColumnWidth(int paramInt)
/*     */     throws Exception
/*     */   {
/* 356 */     return getCellAtRowColumn(0, paramInt).getWidth();
/*     */   }
/*     */ 
/*     */   public Cell getCellAt(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 370 */     if (paramInt1 >= 0) {
/* 371 */       return (Cell)((List)this.tableData.get(paramInt1)).get(paramInt2);
/*     */     }
/* 373 */     return (Cell)((List)this.tableData.get(this.tableData.size() + paramInt1)).get(paramInt2);
/*     */   }
/*     */ 
/*     */   public Cell getCellAtRowColumn(int paramInt1, int paramInt2)
/*     */     throws Exception
/*     */   {
/* 386 */     return getCellAt(paramInt1, paramInt2);
/*     */   }
/*     */ 
/*     */   public List getRow(int paramInt)
/*     */     throws Exception
/*     */   {
/* 398 */     return (List)this.tableData.get(paramInt);
/*     */   }
/*     */ 
/*     */   public List getRowAtIndex(int paramInt) throws Exception
/*     */   {
/* 403 */     return getRow(paramInt);
/*     */   }
/*     */ 
/*     */   public List getColumn(int paramInt)
/*     */     throws Exception
/*     */   {
/* 415 */     ArrayList localArrayList = new ArrayList();
/* 416 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 417 */       List localList = (List)this.tableData.get(i);
/* 418 */       if (paramInt < localList.size()) {
/* 419 */         localArrayList.add(localList.get(paramInt));
/*     */       }
/*     */     }
/* 422 */     return localArrayList;
/*     */   }
/*     */ 
/*     */   public List getColumnAtIndex(int paramInt) throws Exception
/*     */   {
/* 427 */     return getColumn(paramInt);
/*     */   }
/*     */ 
/*     */   public int getNumberOfPages(Page paramPage)
/*     */     throws Exception
/*     */   {
/* 439 */     this.numOfPages = 1;
/* 440 */     while (hasMoreData()) {
/* 441 */       drawOn(paramPage, false);
/*     */     }
/* 443 */     resetRenderedPagesCount();
/* 444 */     return this.numOfPages;
/*     */   }
/*     */ 
/*     */   public Point drawOn(Page paramPage)
/*     */     throws Exception
/*     */   {
/* 456 */     return drawOn(paramPage, true);
/*     */   }
/*     */ 
/*     */   private Point drawOn(Page paramPage, boolean paramBoolean)
/*     */     throws Exception
/*     */   {
/* 469 */     return drawTableRows(paramPage, paramBoolean, drawHeaderRows(paramPage, paramBoolean));
/*     */   }
/*     */ 
/*     */   private float[] drawHeaderRows(Page paramPage, boolean paramBoolean) throws Exception
/*     */   {
/* 474 */     float f1 = this.x1;
/* 475 */     float f2 = this.y1;
/* 476 */     float f3 = 0.0F;
/* 477 */     float f4 = 0.0F;
/*     */ 
/* 479 */     for (int i = 0; i < this.numOfHeaderRows; i++) {
/* 480 */       List localList = (List)this.tableData.get(i);
/* 481 */       f4 = getMaxCellHeight(localList);
/*     */ 
/* 483 */       for (int j = 0; j < localList.size(); j++) {
/* 484 */         Cell localCell = (Cell)localList.get(j);
/* 485 */         f3 = localCell.getWidth();
/* 486 */         int k = localCell.getColSpan();
/* 487 */         for (int m = 1; m < k; m++) {
/* 488 */           f3 += ((Cell)localList.get(++j)).width;
/*     */         }
/*     */ 
/* 491 */         if (paramBoolean) {
/* 492 */           paramPage.setBrushColor(localCell.getBrushColor());
/* 493 */           localCell.paint(paramPage, f1, f2, f3, f4);
/*     */         }
/*     */ 
/* 496 */         f1 += f3;
/*     */       }
/* 498 */       f1 = this.x1;
/* 499 */       f2 += f4;
/*     */     }
/*     */ 
/* 502 */     return new float[] { f1, f2, f3, f4 };
/*     */   }
/*     */ 
/*     */   private Point drawTableRows(Page paramPage, boolean paramBoolean, float[] paramArrayOfFloat) throws Exception
/*     */   {
/* 507 */     float f1 = paramArrayOfFloat[0];
/* 508 */     float f2 = paramArrayOfFloat[1];
/* 509 */     float f3 = paramArrayOfFloat[2];
/* 510 */     float f4 = paramArrayOfFloat[3];
/*     */ 
/* 512 */     for (int i = this.rendered; i < this.tableData.size(); i++) {
/* 513 */       List localList1 = (List)this.tableData.get(i);
/* 514 */       f4 = getMaxCellHeight(localList1);
/*     */ 
/* 516 */       for (int j = 0; j < localList1.size(); j++) {
/* 517 */         Cell localCell1 = (Cell)localList1.get(j);
/* 518 */         f3 = localCell1.getWidth();
/* 519 */         int m = localCell1.getColSpan();
/* 520 */         for (int n = 1; n < m; n++) {
/* 521 */           f3 += ((Cell)localList1.get(++j)).getWidth();
/*     */         }
/*     */ 
/* 524 */         if (paramBoolean) {
/* 525 */           paramPage.setBrushColor(localCell1.getBrushColor());
/* 526 */           localCell1.paint(paramPage, f1, f2, f3, f4);
/*     */         }
/*     */ 
/* 529 */         f1 += f3;
/*     */       }
/* 531 */       f1 = this.x1;
/* 532 */       f2 += f4;
/*     */ 
/* 535 */       if (i < this.tableData.size() - 1) {
/* 536 */         List localList2 = (List)this.tableData.get(i + 1);
/* 537 */         for (int k = 0; k < localList2.size(); k++) {
/* 538 */           Cell localCell2 = (Cell)localList2.get(k);
/* 539 */           float f5 = localCell2.getHeight();
/* 540 */           if (f5 > f4) {
/* 541 */             f4 = f5;
/*     */           }
/*     */         }
/*     */       }
/*     */ 
/* 546 */       if (f2 + f4 > paramPage.height - this.bottom_margin) {
/* 547 */         if (i == this.tableData.size() - 1) {
/* 548 */           this.rendered = -1;
/*     */         }
/*     */         else {
/* 551 */           this.rendered = (i + 1);
/* 552 */           this.numOfPages += 1;
/*     */         }
/* 554 */         return new Point(f1, f2);
/*     */       }
/*     */     }
/* 557 */     this.rendered = -1;
/*     */ 
/* 559 */     return new Point(f1, f2);
/*     */   }
/*     */ 
/*     */   private float getMaxCellHeight(List paramList)
/*     */   {
/* 564 */     float f = 0.0F;
/* 565 */     for (int i = 0; i < paramList.size(); i++) {
/* 566 */       Cell localCell = (Cell)paramList.get(i);
/* 567 */       if (localCell.getHeight() > f) {
/* 568 */         f = localCell.getHeight();
/*     */       }
/*     */     }
/* 571 */     return f;
/*     */   }
/*     */ 
/*     */   public boolean hasMoreData()
/*     */   {
/* 579 */     return this.rendered != -1;
/*     */   }
/*     */ 
/*     */   public float getWidth()
/*     */   {
/* 589 */     float f = 0.0F;
/* 590 */     List localList = (List)this.tableData.get(0);
/* 591 */     for (int i = 0; i < localList.size(); i++) {
/* 592 */       f += ((Cell)localList.get(i)).getWidth();
/*     */     }
/* 594 */     return f;
/*     */   }
/*     */ 
/*     */   public int getRowsRendered()
/*     */   {
/* 604 */     return this.rendered == -1 ? this.rendered : this.rendered - this.numOfHeaderRows;
/*     */   }
/*     */ 
/*     */   public void wrapAroundCellText()
/*     */   {
/* 614 */     ArrayList localArrayList = new ArrayList();
/*     */     List localList;
/*     */     int j;
/*     */     Object localObject2;
/* 616 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 617 */       localList = (List)this.tableData.get(i);
/* 618 */       j = 1;
/*     */       Object localObject1;
/*     */       int n;
/*     */       Cell localCell2;
/* 619 */       for (int k = 0; k < localList.size(); k++) {
/* 620 */         localObject1 = (Cell)localList.get(k);
/* 621 */         n = ((Cell)localObject1).getColSpan();
/* 622 */         for (int i1 = 1; i1 < n; i1++) {
/* 623 */           localCell2 = (Cell)localList.get(k + i1);
/* 624 */           ((Cell)localObject1).setWidth(((Cell)localObject1).getWidth() + localCell2.getWidth());
/* 625 */           localCell2.setWidth(0.0F);
/*     */         }
/* 627 */         i1 = ((Cell)localObject1).getNumVerCells();
/* 628 */         if (i1 > j) {
/* 629 */           j = i1;
/*     */         }
/*     */       }
/*     */ 
/* 633 */       for (k = 0; k < j; k++) {
/* 634 */         localObject1 = new ArrayList();
/* 635 */         for (n = 0; n < localList.size(); n++) {
/* 636 */           localObject2 = (Cell)localList.get(n);
/*     */ 
/* 638 */           localCell2 = new Cell(((Cell)localObject2).getFont(), "");
/* 639 */           localCell2.setFallbackFont(((Cell)localObject2).getFallbackFont());
/* 640 */           localCell2.setPoint(((Cell)localObject2).getPoint());
/* 641 */           localCell2.setWidth(((Cell)localObject2).getWidth());
/* 642 */           if (k == 0) {
/* 643 */             localCell2.setTopPadding(((Cell)localObject2).top_padding);
/*     */           }
/* 645 */           if (k == j - 1) {
/* 646 */             localCell2.setBottomPadding(((Cell)localObject2).bottom_padding);
/*     */           }
/* 648 */           localCell2.setLeftPadding(((Cell)localObject2).left_padding);
/* 649 */           localCell2.setRightPadding(((Cell)localObject2).right_padding);
/* 650 */           localCell2.setLineWidth(((Cell)localObject2).lineWidth);
/* 651 */           localCell2.setBgColor(((Cell)localObject2).getBgColor());
/* 652 */           localCell2.setPenColor(((Cell)localObject2).getPenColor());
/* 653 */           localCell2.setBrushColor(((Cell)localObject2).getBrushColor());
/* 654 */           localCell2.setProperties(((Cell)localObject2).getProperties());
/* 655 */           localCell2.setVerTextAlignment(((Cell)localObject2).getVerTextAlignment());
/*     */ 
/* 657 */           if (k == 0) {
/* 658 */             localCell2.setImage(((Cell)localObject2).getImage());
/* 659 */             if (((Cell)localObject2).getCompositeTextLine() != null) {
/* 660 */               localCell2.setCompositeTextLine(((Cell)localObject2).getCompositeTextLine());
/*     */             }
/*     */             else {
/* 663 */               localCell2.setText(((Cell)localObject2).getText());
/*     */             }
/* 665 */             if (j > 1)
/* 666 */               localCell2.setBorder(131072, false);
/*     */           }
/*     */           else
/*     */           {
/* 670 */             localCell2.setBorder(65536, false);
/* 671 */             if (k < j - 1) {
/* 672 */               localCell2.setBorder(131072, false);
/*     */             }
/*     */           }
/* 675 */           ((List)localObject1).add(localCell2);
/*     */         }
/* 677 */         localArrayList.add(localObject1);
/*     */       }
/*     */     }
/*     */ 
/* 681 */     for (i = 0; i < localArrayList.size(); i++) {
/* 682 */       localList = (List)localArrayList.get(i);
/* 683 */       for (j = 0; j < localList.size(); j++) {
/* 684 */         Cell localCell1 = (Cell)localList.get(j);
/* 685 */         if (localCell1.text != null) {
/* 686 */           int m = 0;
/* 687 */           String[] arrayOfString1 = localCell1.getText().split("\\r?\\n");
/* 688 */           for (Object localObject3 : arrayOfString1) {
/* 689 */             StringBuilder localStringBuilder = new StringBuilder();
/* 690 */             String[] arrayOfString2 = localObject3.split("\\s+");
/* 691 */             if (arrayOfString2.length == 1) {
/* 692 */               localStringBuilder.append(arrayOfString2[0]);
/*     */             }
/*     */             else {
/* 695 */               for (int i4 = 0; i4 < arrayOfString2.length; i4++) {
/* 696 */                 String str = arrayOfString2[i4];
/* 697 */                 if (localCell1.font.stringWidth(localCell1.fallbackFont, localStringBuilder.toString() + " " + str) > localCell1.getWidth() - (localCell1.left_padding + localCell1.right_padding))
/*     */                 {
/* 699 */                   ((Cell)((List)localArrayList.get(i + m)).get(j)).setText(localStringBuilder.toString());
/* 700 */                   localStringBuilder = new StringBuilder(str);
/* 701 */                   m++;
/*     */                 }
/*     */                 else {
/* 704 */                   if (i4 > 0) {
/* 705 */                     localStringBuilder.append(" ");
/*     */                   }
/* 707 */                   localStringBuilder.append(str);
/*     */                 }
/*     */               }
/*     */             }
/* 711 */             ((Cell)((List)localArrayList.get(i + m)).get(j)).setText(localStringBuilder.toString());
/* 712 */             m++;
/*     */           }
/*     */         }
/*     */         else {
/* 716 */           ((Cell)((List)localArrayList.get(i)).get(j)).setCompositeTextLine(localCell1.getCompositeTextLine());
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 721 */     this.tableData = localArrayList;
/*     */   }
/*     */ 
/*     */   public void setNoCellBorders()
/*     */   {
/* 730 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 731 */       List localList = (List)this.tableData.get(i);
/* 732 */       for (int j = 0; j < localList.size(); j++)
/* 733 */         ((Cell)((List)this.tableData.get(i)).get(j)).setNoBorders();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setCellBordersColor(int paramInt)
/*     */   {
/* 745 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 746 */       List localList = (List)this.tableData.get(i);
/* 747 */       for (int j = 0; j < localList.size(); j++)
/* 748 */         ((Cell)((List)this.tableData.get(i)).get(j)).setPenColor(paramInt);
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setCellBordersWidth(float paramFloat)
/*     */   {
/* 760 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 761 */       List localList = (List)this.tableData.get(i);
/* 762 */       for (int j = 0; j < localList.size(); j++)
/* 763 */         ((Cell)((List)this.tableData.get(i)).get(j)).setLineWidth(paramFloat);
/*     */     }
/*     */   }
/*     */ 
/*     */   public void resetRenderedPagesCount()
/*     */   {
/* 774 */     this.rendered = this.numOfHeaderRows;
/*     */   }
/*     */ 
/*     */   public void wrapAroundCellText2()
/*     */   {
/* 779 */     ArrayList localArrayList = new ArrayList();
/*     */     List localList;
/*     */     int j;
/*     */     Object localObject1;
/*     */     int m;
/*     */     Object localObject2;
/* 781 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 782 */       localList = (List)this.tableData.get(i);
/* 783 */       j = 1;
/*     */       Cell localCell2;
/* 784 */       for (int k = 0; k < localList.size(); k++) {
/* 785 */         localObject1 = (Cell)localList.get(k);
/* 786 */         m = ((Cell)localObject1).getColSpan();
/* 787 */         for (int n = 1; n < m; n++) {
/* 788 */           localCell2 = (Cell)localList.get(k + n);
/* 789 */           ((Cell)localObject1).setWidth(((Cell)localObject1).getWidth() + localCell2.getWidth());
/* 790 */           localCell2.setWidth(0.0F);
/*     */         }
/* 792 */         n = ((Cell)localObject1).getNumVerCells2();
/* 793 */         if (n > j) {
/* 794 */           j = n;
/*     */         }
/*     */       }
/*     */ 
/* 798 */       for (k = 0; k < j; k++) {
/* 799 */         localObject1 = new ArrayList();
/* 800 */         for (m = 0; m < localList.size(); m++) {
/* 801 */           localObject2 = (Cell)localList.get(m);
/*     */ 
/* 803 */           localCell2 = new Cell(((Cell)localObject2).getFont(), "");
/* 804 */           localCell2.setFallbackFont(((Cell)localObject2).getFallbackFont());
/* 805 */           localCell2.setPoint(((Cell)localObject2).getPoint());
/* 806 */           localCell2.setWidth(((Cell)localObject2).getWidth());
/* 807 */           if (k == 0) {
/* 808 */             localCell2.setTopPadding(((Cell)localObject2).top_padding);
/*     */           }
/* 810 */           if (k == j - 1) {
/* 811 */             localCell2.setBottomPadding(((Cell)localObject2).bottom_padding);
/*     */           }
/* 813 */           localCell2.setLeftPadding(((Cell)localObject2).left_padding);
/* 814 */           localCell2.setRightPadding(((Cell)localObject2).right_padding);
/* 815 */           localCell2.setLineWidth(((Cell)localObject2).lineWidth);
/* 816 */           localCell2.setBgColor(((Cell)localObject2).getBgColor());
/* 817 */           localCell2.setPenColor(((Cell)localObject2).getPenColor());
/* 818 */           localCell2.setBrushColor(((Cell)localObject2).getBrushColor());
/* 819 */           localCell2.setProperties(((Cell)localObject2).getProperties());
/* 820 */           localCell2.setVerTextAlignment(((Cell)localObject2).getVerTextAlignment());
/*     */ 
/* 822 */           if (k == 0) {
/* 823 */             localCell2.setImage(((Cell)localObject2).getImage());
/* 824 */             if (((Cell)localObject2).getCompositeTextLine() != null) {
/* 825 */               localCell2.setCompositeTextLine(((Cell)localObject2).getCompositeTextLine());
/*     */             }
/*     */             else {
/* 828 */               localCell2.setText(((Cell)localObject2).getText());
/*     */             }
/* 830 */             if (j > 1)
/* 831 */               localCell2.setBorder(131072, false);
/*     */           }
/*     */           else
/*     */           {
/* 835 */             localCell2.setBorder(65536, false);
/* 836 */             if (k < j - 1) {
/* 837 */               localCell2.setBorder(131072, false);
/*     */             }
/*     */           }
/* 840 */           ((List)localObject1).add(localCell2);
/*     */         }
/* 842 */         localArrayList.add(localObject1);
/*     */       }
/*     */     }
/*     */ 
/* 846 */     for (i = 0; i < localArrayList.size(); i++) {
/* 847 */       localList = (List)localArrayList.get(i);
/* 848 */       for (j = 0; j < localList.size(); j++) {
/* 849 */         Cell localCell1 = (Cell)localList.get(j);
/* 850 */         if (localCell1.text != null) {
/* 851 */           localObject1 = localCell1.text;
/* 852 */           m = 0;
/* 853 */           localObject2 = new StringBuilder();
/* 854 */           for (int i1 = 0; i1 < ((String)localObject1).length(); i1++) {
/* 855 */             String str = new String(new char[] { ((String)localObject1).charAt(i1) });
/*     */ 
/* 857 */             if (localCell1.font.stringWidth(localCell1.fallbackFont, ((StringBuilder)localObject2).toString() + str) > localCell1.getWidth() - (localCell1.left_padding + localCell1.right_padding))
/*     */             {
/* 859 */               ((Cell)((List)localArrayList.get(i + m)).get(j)).setText(((StringBuilder)localObject2).toString());
/* 860 */               m++;
/* 861 */               ((StringBuilder)localObject2).setLength(0);
/*     */             }
/* 863 */             ((StringBuilder)localObject2).append(str);
/*     */           }
/* 865 */           ((Cell)((List)localArrayList.get(i + m)).get(j)).setText(((StringBuilder)localObject2).toString());
/*     */         }
/*     */         else {
/* 868 */           ((Cell)((List)localArrayList.get(i)).get(j)).setCompositeTextLine(localCell1.getCompositeTextLine());
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 873 */     this.tableData = localArrayList;
/*     */   }
/*     */ 
/*     */   public void mergeOverlaidBorders()
/*     */   {
/* 882 */     for (int i = 0; i < this.tableData.size(); i++) {
/* 883 */       List localList = (List)this.tableData.get(i);
/* 884 */       for (int j = 0; j < localList.size(); j++) {
/* 885 */         Cell localCell1 = (Cell)localList.get(j);
/*     */         Object localObject;
/* 886 */         if (j < localList.size() - 1) {
/* 887 */           localObject = (Cell)localList.get(j + 1);
/* 888 */           if ((((Cell)localObject).getBorder(262144)) && (localCell1.getPenColor() == ((Cell)localObject).getPenColor()) && (localCell1.getLineWidth() == ((Cell)localObject).getLineWidth()) && (localCell1.getColSpan() + j < localList.size() - 1))
/*     */           {
/* 892 */             localCell1.setBorder(524288, false);
/*     */           }
/*     */         }
/* 895 */         if (i < this.tableData.size() - 1) {
/* 896 */           localObject = (List)this.tableData.get(i + 1);
/* 897 */           Cell localCell2 = (Cell)((List)localObject).get(j);
/* 898 */           if ((localCell2.getBorder(65536)) && (localCell1.getPenColor() == localCell2.getPenColor()) && (localCell1.getLineWidth() == localCell2.getLineWidth()))
/*     */           {
/* 901 */             localCell1.setBorder(131072, false);
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           E:\EGGWIFI\Customer\trunk\src\Workspace\Customer\Customer Maven Webapp\src\main\webapp\WEB-INF\lib\PDFjet.jar
 * Qualified Name:     com.pdfjet.Table
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy