1 16 17 package org.apache.poi.hssf.usermodel; 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 29 public class HSSFPatriarch 30 implements HSSFShapeContainer 31 { 32 List shapes = new ArrayList (); 33 HSSFSheet sheet; 34 int x1 = 0; 35 int y1 = 0 ; 36 int x2 = 1023; 37 int y2 = 255; 38 39 44 HSSFPatriarch(HSSFSheet sheet) 45 { 46 this.sheet = sheet; 47 } 48 49 56 public HSSFShapeGroup createGroup(HSSFClientAnchor anchor) 57 { 58 HSSFShapeGroup group = new HSSFShapeGroup(null, anchor); 59 group.anchor = anchor; 60 shapes.add(group); 61 return group; 62 } 63 64 72 public HSSFSimpleShape createSimpleShape(HSSFClientAnchor anchor) 73 { 74 HSSFSimpleShape shape = new HSSFSimpleShape(null, anchor); 75 shape.anchor = anchor; 76 shapes.add(shape); 77 return shape; 78 } 79 80 87 public HSSFPolygon createPolygon(HSSFClientAnchor anchor) 88 { 89 HSSFPolygon shape = new HSSFPolygon(null, anchor); 90 shape.anchor = anchor; 91 shapes.add(shape); 92 return shape; 93 } 94 95 102 public HSSFTextbox createTextbox(HSSFClientAnchor anchor) 103 { 104 HSSFTextbox shape = new HSSFTextbox(null, anchor); 105 shape.anchor = anchor; 106 shapes.add(shape); 107 return shape; 108 } 109 110 113 public List getChildren() 114 { 115 return shapes; 116 } 117 118 121 public int countOfAllChildren() 122 { 123 int count = shapes.size(); 124 for ( Iterator iterator = shapes.iterator(); iterator.hasNext(); ) 125 { 126 HSSFShape shape = (HSSFShape) iterator.next(); 127 count += shape.countOfAllChildren(); 128 } 129 return count; 130 } 131 135 public void setCoordinates( int x1, int y1, int x2, int y2 ) 136 { 137 this.x1 = x1; 138 this.y1 = y1; 139 this.x2 = x2; 140 this.y2 = y2; 141 } 142 143 146 public int getX1() 147 { 148 return x1; 149 } 150 151 154 public int getY1() 155 { 156 return y1; 157 } 158 159 162 public int getX2() 163 { 164 return x2; 165 } 166 167 170 public int getY2() 171 { 172 return y2; 173 } 174 175 } 176 | Popular Tags |