[#2084] Include parts details for pods and boosters

This commit is contained in:
SiboVG 2023-02-28 02:50:17 +01:00
parent 022a986130
commit 95a18f4cd3

View File

@ -8,6 +8,7 @@ import java.util.Set;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -150,18 +151,20 @@ public class PartsDetailVisitorStrategy {
private void handle (RocketComponent component) { private void handle (RocketComponent component) {
//This ugly if-then-else construct is not object oriented. Originally it was an elegant, and very OO savy, design //This ugly if-then-else construct is not object oriented. Originally it was an elegant, and very OO savy, design
//using the Visitor pattern. Unfortunately, it was misunderstood and was removed. //using the Visitor pattern. Unfortunately, it was misunderstood and was removed.
if (component instanceof AxialStage) { if (component instanceof ComponentAssembly) {
try { try {
if (grid != null) { if (grid != null) {
document.add(grid); document.add(grid);
} }
document.add(ITextHelper.createPhrase(component.getName())); if (level > 1) {
Chunk tab = new Chunk(new VerticalPositionMark(), (level - 1) * 10, false);
document.add(tab);
}
document.add(ITextHelper.createPhrase(component.getComponentName() + ": " + component.getName()));
grid = new PdfPTable(TABLE_COLUMNS); grid = new PdfPTable(TABLE_COLUMNS);
grid.setWidthPercentage(100); grid.setWidthPercentage(100);
grid.setHorizontalAlignment(Element.ALIGN_LEFT); grid.setHorizontalAlignment(Element.ALIGN_LEFT);
} } catch (DocumentException ignored) { }
catch (DocumentException e) {
}
List<RocketComponent> rc = component.getChildren(); List<RocketComponent> rc = component.getChildren();
goDeep(rc); goDeep(rc);