2 * OpenRocketPrintable.java
4 package net.sf.openrocket.gui.print;
5 import net.sf.openrocket.l10n.Translator;
6 import net.sf.openrocket.startup.Application;
9 * This enumeration identifies the various types of information that may be printed.
12 public enum OpenRocketPrintable {
13 //PARTS_LIST("Parts list", true, 0),
15 PARTS_DETAIL("OpenRocketPrintable.Partsdetail", true, 1),
17 FIN_TEMPLATE("OpenRocketPrintable.Fintemplates", true, 2),
19 DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3);
22 * The description - will be displayed in the JTree.
24 private String description;
27 * Flag that indicates if the enum value is different depending upon stage.
29 private boolean stageSpecific;
32 * The order of the item as it appears in the printed document.
39 * @param s the displayable description
40 * @param staged indicates if the printable is stage dependent
41 * @param idx the relative print order
43 OpenRocketPrintable (String s, boolean staged, int idx) {
45 stageSpecific = staged;
50 * Get the description of this printable.
52 * @return a displayable string
54 public String getDescription () {
55 final Translator trans = Application.getTranslator();
56 return trans.get(description);
60 * Answers if this enum value has different meaning depending upon the stage.
62 * @return true if the printable is stage dependent
64 public boolean isStageSpecific () {
69 * Answer the print order. This is relative to other enum values. No two enum values will have the same print
72 * @return a 0 based order (0 being first, or highest)
74 public int getPrintOrder () {
79 * Look up an enum value based on the description.
81 * @param target the description
83 * @return an instance of this enum class or null if not found
85 public static OpenRocketPrintable findByDescription (String target) {
86 OpenRocketPrintable[] values = values();
87 for (OpenRocketPrintable value : values) {
88 if (value.getDescription().equalsIgnoreCase(target)) {