2 * TemplateProperties.java
4 package net.sf.openrocket.gui.print;
8 import javax.swing.UIManager;
11 * This class is responsible for managing various properties of print templates (fin, nose cone, transitions, etc.).
13 * TODO: HIGH: Remove this entire class, and instead pass the PrintSettings object to the print methods.
15 public class TemplateProperties {
18 * The property that defines the fill color.
20 public static final String TEMPLATE_FILL_COLOR_PROPERTY = "template.fill.color";
23 * The property that defines the line color.
25 public static final String TEMPLATE_LINE_COLOR_PROPERTY = "template.line.color";
28 * Get the current fill color.
30 * @return a color to be used as the fill in template shapes
32 public static Color getFillColor() {
33 Color fillColor = UIManager.getColor(TemplateProperties.TEMPLATE_FILL_COLOR_PROPERTY);
34 if (fillColor == null) {
35 fillColor = Color.lightGray;
42 * Set the template fill color.
44 public static void setFillColor(Color c) {
45 UIManager.put(TemplateProperties.TEMPLATE_FILL_COLOR_PROPERTY, c);
50 * Get the current line color.
52 * @return a color to be used as the line in template shapes
54 public static Color getLineColor() {
55 Color lineColor = UIManager.getColor(TemplateProperties.TEMPLATE_LINE_COLOR_PROPERTY);
56 if (lineColor == null) {
57 lineColor = Color.darkGray;
63 * Set the template line color.
65 public static void setLineColor(Color c) {
66 UIManager.put(TemplateProperties.TEMPLATE_LINE_COLOR_PROPERTY, c);
70 * Set the template colors from the print settings.
72 public static void setColors(PrintSettings settings) {
73 setFillColor(settings.getTemplateFillColor());
74 setLineColor(settings.getTemplateBorderColor());