Merge pull request #2089 from SiboVG/issue-2084

[#2084] Include parts details for pods and boosters
This commit is contained in:
Sibo Van Gool 2023-03-02 12:08:45 +01:00 committed by GitHub
commit f7792e5222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import java.util.Set;
import javax.swing.ImageIcon;
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -150,18 +151,20 @@ public class PartsDetailVisitorStrategy {
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
//using the Visitor pattern. Unfortunately, it was misunderstood and was removed.
if (component instanceof AxialStage) {
if (component instanceof ComponentAssembly) {
try {
if (grid != null) {
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.setWidthPercentage(100);
grid.setHorizontalAlignment(Element.ALIGN_LEFT);
}
catch (DocumentException e) {
}
} catch (DocumentException ignored) { }
List<RocketComponent> rc = component.getChildren();
goDeep(rc);