@@ -26,13 +26,7 @@ public class RectCell implements IMergeCell {
26
26
27
27
28
28
/**
29
- * 是否为虚线
30
- */
31
- private boolean dashed ;
32
-
33
-
34
- /**
35
- * 虚线样式
29
+ * 虚线样式,指定线宽等,如 {@link CellConstants#RECT_DEFAULT_DASH}
36
30
*/
37
31
private Stroke stroke ;
38
32
@@ -45,25 +39,24 @@ public class RectCell implements IMergeCell {
45
39
public RectCell () {
46
40
}
47
41
48
- public RectCell (int x , int y , int w , int h , Color color , boolean dashed , Stroke stroke , int radius ) {
42
+ public RectCell (int x , int y , int w , int h , Color color , Stroke stroke , int radius ) {
49
43
this .x = x ;
50
44
this .y = y ;
51
45
this .w = w ;
52
46
this .h = h ;
53
47
this .color = color ;
54
- this .dashed = dashed ;
55
48
this .stroke = stroke ;
56
49
this .radius = radius ;
57
50
}
58
51
59
52
@ Override
60
53
public void draw (Graphics2D g2d ) {
61
54
g2d .setColor (color );
62
- if (! dashed ) {
55
+ if (stroke == null ) {
63
56
g2d .drawRoundRect (x , y , w , h , radius , radius );
64
57
} else {
65
58
Stroke stroke = g2d .getStroke ();
66
- g2d .setStroke (stroke );
59
+ g2d .setStroke (this . stroke );
67
60
g2d .drawRoundRect (x , y , w , h , radius , radius );
68
61
g2d .setStroke (stroke );
69
62
}
@@ -109,14 +102,6 @@ public void setColor(Color color) {
109
102
this .color = color ;
110
103
}
111
104
112
- public boolean isDashed () {
113
- return dashed ;
114
- }
115
-
116
- public void setDashed (boolean dashed ) {
117
- this .dashed = dashed ;
118
- }
119
-
120
105
public Stroke getStroke () {
121
106
return stroke ;
122
107
}
@@ -142,21 +127,20 @@ public boolean equals(Object o) {
142
127
return false ;
143
128
}
144
129
RectCell rectCell = (RectCell ) o ;
145
- return x == rectCell .x && y == rectCell .y && w == rectCell .w && h == rectCell .h && dashed == rectCell .dashed &&
146
- radius == rectCell .radius && Objects .equals (color , rectCell .color ) &&
147
- Objects .equals (stroke , rectCell .stroke );
130
+ return x == rectCell .x && y == rectCell .y && w == rectCell .w && h == rectCell .h && radius == rectCell .radius &&
131
+ Objects .equals (color , rectCell .color ) && Objects .equals (stroke , rectCell .stroke );
148
132
}
149
133
150
134
@ Override
151
135
public int hashCode () {
152
136
153
- return Objects .hash (x , y , w , h , color , dashed , stroke , radius );
137
+ return Objects .hash (x , y , w , h , color , stroke , radius );
154
138
}
155
139
156
140
@ Override
157
141
public String toString () {
158
- return "RectCell{" + "x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ", color=" + color + ", dashed =" +
159
- dashed + ", stroke=" + stroke + ", radius=" + radius + '}' ;
142
+ return "RectCell{" + "x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ", color=" + color + ", stroke =" +
143
+ stroke + ", radius=" + radius + '}' ;
160
144
}
161
145
162
146
public static Builder builder () {
@@ -180,13 +164,6 @@ public static class Builder {
180
164
*/
181
165
private Color color ;
182
166
183
-
184
- /**
185
- * 是否为虚线
186
- */
187
- private boolean dashed ;
188
-
189
-
190
167
/**
191
168
* 虚线样式
192
169
*/
@@ -223,11 +200,6 @@ public Builder color(Color color) {
223
200
return this ;
224
201
}
225
202
226
- public Builder dashed (boolean dashed ) {
227
- this .dashed = dashed ;
228
- return this ;
229
- }
230
-
231
203
public Builder stroke (Stroke stroke ) {
232
204
this .stroke = stroke ;
233
205
return this ;
@@ -239,7 +211,7 @@ public Builder radius(int radius) {
239
211
}
240
212
241
213
public RectCell build () {
242
- return new RectCell (x , y , w , h , color , dashed , stroke , radius );
214
+ return new RectCell (x , y , w , h , color , stroke , radius );
243
215
}
244
216
}
245
217
}
0 commit comments