|
Lines 63-69
Link Here
|
| 63 |
} |
63 |
} |
| 64 |
if(compartmentList.size() != 0) { |
64 |
if(compartmentList.size() != 0) { |
| 65 |
for(int i = 0; i < container.getChildren().size(); i++) { |
65 |
for(int i = 0; i < container.getChildren().size(); i++) { |
| 66 |
minimumHeight += ((IFigure)container.getChildren().get(i)).getPreferredSize().height; |
66 |
IFigure child = (IFigure)container.getChildren().get(i); |
|
|
67 |
minimumHeight += child.getPreferredSize().height; |
| 68 |
minimumWith = Math.max(minimumWith, child.getPreferredSize().width); |
| 67 |
} |
69 |
} |
| 68 |
} else { |
70 |
} else { |
| 69 |
for(int i = 0; i < notCompartmentList.size(); i++) { |
71 |
for(int i = 0; i < notCompartmentList.size(); i++) { |
|
Lines 74-79
Link Here
|
| 74 |
minimumHeight += 7; |
76 |
minimumHeight += 7; |
| 75 |
return new Dimension(minimumWith, minimumHeight); |
77 |
return new Dimension(minimumWith, minimumHeight); |
| 76 |
} |
78 |
} |
|
|
79 |
|
| 80 |
@Override |
| 81 |
public Dimension getMinimumSize(IFigure container, int wHint, int hHint) { |
| 82 |
return new Dimension(20,20); |
| 83 |
} |
| 77 |
|
84 |
|
| 78 |
/** |
85 |
/** |
| 79 |
* layout by putting label in the center of figure |
86 |
* layout by putting label in the center of figure |
|
Lines 243-250
Link Here
|
| 243 |
public Dimension getPreferedSize(IFigure figure) { |
250 |
public Dimension getPreferedSize(IFigure figure) { |
| 244 |
Dimension dim = figure.getPreferredSize(); |
251 |
Dimension dim = figure.getPreferredSize(); |
| 245 |
if(figure.getChildren().size() > 0) { |
252 |
if(figure.getChildren().size() > 0) { |
| 246 |
if(figure.getChildren().get(0) instanceof ResizableCompartmentFigure) { |
253 |
Object compartment = figure.getChildren().get(0); |
| 247 |
dim.height = ((ResizableCompartmentFigure)figure.getChildren().get(0)).getPreferredSize().height + 10; |
254 |
if(compartment instanceof ResizableCompartmentFigure) { |
|
|
255 |
dim.height = ((ResizableCompartmentFigure)compartment).getPreferredSize().height + 10; |
| 248 |
if(dim.height == 0) { |
256 |
if(dim.height == 0) { |
| 249 |
dim.height = MINIMUM_COMPARTMENT_HEIGHT; |
257 |
dim.height = MINIMUM_COMPARTMENT_HEIGHT; |
| 250 |
} |
258 |
} |