]> source.dussan.org Git - poi.git/commitdiff
dashed borders
authorAndrew C. Oliver <acoliver@apache.org>
Thu, 4 Jul 2002 14:08:40 +0000 (14:08 +0000)
committerAndrew C. Oliver <acoliver@apache.org>
Thu, 4 Jul 2002 14:08:40 +0000 (14:08 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352752 13f79535-47bb-0310-9956-ffa450edef68

src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java

index 124f937a1b46cd0b83347affaad1e7b6a8d1c51e..ec1df74eb15ba481bd620f46fbff96f9a032bc72 100644 (file)
@@ -55,6 +55,8 @@ public class SVBorder extends AbstractBorder {
 
      paintNormalBorders(g, x, y, width, height); 
      paintDottedBorders(g, x, y, width, height); 
+     paintDashedBorders(g, x, y, width, height);
+    
 
 
      g.setColor(oldColor);    
@@ -88,6 +90,9 @@ public class SVBorder extends AbstractBorder {
 
         int thickness = getThickness(eastBorderType);
 
+        if (eastBorderType == HSSFCellStyle.BORDER_HAIR) 
+             thickness++;   
+
        g.setColor(eastColor); 
 
         for (int k=0; k < thickness; k++) {
@@ -104,6 +109,9 @@ public class SVBorder extends AbstractBorder {
 
         int thickness = getThickness(southBorderType);
 
+        if (southBorderType == HSSFCellStyle.BORDER_HAIR) 
+             thickness++;   
+
        g.setColor(southColor); 
         for (int k=0; k < thickness; k++) {
            g.drawLine(x,height - k,width,height - k);
@@ -189,6 +197,69 @@ public class SVBorder extends AbstractBorder {
       }
    }
 
+
+   private void paintDashedBorders(Graphics g, int x, int y, int width, 
+                                  int height) {
+      if (northBorder && 
+             northBorderType == HSSFCellStyle.BORDER_DASHED) {
+        int thickness = getThickness(northBorderType);
+
+       g.setColor(northColor); 
+
+        for (int k=0; k < thickness; k++) {
+           for (int xc = x; xc < width; xc=xc+5) {
+             g.drawLine(xc,y+k,xc+2,y+k);
+           }
+        }
+      }
+
+      if (eastBorder && 
+              eastBorderType == HSSFCellStyle.BORDER_DASHED
+         ) {
+
+        int thickness = getThickness(eastBorderType);
+        thickness++; //need for dotted borders to show up east
+
+       g.setColor(eastColor); 
+
+        for (int k=0; k < thickness; k++) {
+           for (int yc=y;yc < height; yc=yc+5) {
+                g.drawLine(width-k,yc,width-k,yc+2);
+           }
+        }
+      }
+
+      if (southBorder && 
+              southBorderType == HSSFCellStyle.BORDER_DASHED
+         ) {
+
+        int thickness = getThickness(southBorderType);
+        thickness++;
+       g.setColor(southColor); 
+        for (int k=0; k < thickness; k++) {
+           for (int xc = x; xc < width; xc=xc+5) {
+             g.drawLine(xc,height-k,xc+2,height-k);
+           }
+        }
+      }
+
+      if (westBorder && 
+            westBorderType == HSSFCellStyle.BORDER_DASHED
+         ) {
+
+        int thickness = getThickness(westBorderType);
+//        thickness++;
+
+       g.setColor(westColor); 
+
+        for (int k=0; k < thickness; k++) {
+           for (int yc=y;yc < height; yc=yc+5) {
+                g.drawLine(x+k,yc,x+k,yc+2);
+           }
+        }
+      }
+   }
+
    private int getThickness(int thickness) {
        int retval=1;
        switch (thickness) {