git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@136 180e2...
[debian/openrocket] / src / net / sf / openrocket / gui / print / TemplateProperties.java
index f98f7ea36c265c54a51414f8a4d0aacb78e49130..6f88e576bc2a1c0bc1d64b166a63a8dfd0996d6d 100644 (file)
@@ -3,47 +3,74 @@
  */
 package net.sf.openrocket.gui.print;
 
-import javax.swing.UIManager;
 import java.awt.Color;
 
+import javax.swing.UIManager;
+
 /**
  * This class is responsible for managing various properties of print templates (fin, nose cone, transitions, etc.).
+ * 
+ * TODO: HIGH:  Remove this entire class, and instead pass the PrintSettings object to the print methods.
  */
 public class TemplateProperties {
-
-    /**
-     * The property that defines the fill color.
-     */
-    public static final String TEMPLATE_FILL_COLOR_PROPERTY = "template.fill.color";
-
-    /**
-     * The property that defines the line color.
-     */
-    public static final String TEMPLATE_LINE_COLOR_PROPERTY = "template.line.color";
-
-    /**
-     * Get the current fill color.
-     * 
-     * @return  a color to be used as the fill in template shapes
-     */
-    public static Color getFillColor () {
-        Color fillColor = UIManager.getColor(TemplateProperties.TEMPLATE_FILL_COLOR_PROPERTY);
-        if (fillColor == null) {
-            fillColor = Color.lightGray;
-        }
-        return fillColor;
-    }
-
-    /**
-     * Get the current line color.
-     * 
-     * @return  a color to be used as the line in template shapes
-     */
-    public static Color getLineColor () {
-        Color lineColor = UIManager.getColor(TemplateProperties.TEMPLATE_LINE_COLOR_PROPERTY);
-        if (lineColor == null) {
-            lineColor = Color.darkGray;
-        }
-        return lineColor;
-    }
+       
+       /**
+        * The property that defines the fill color.
+        */
+       public static final String TEMPLATE_FILL_COLOR_PROPERTY = "template.fill.color";
+       
+       /**
+        * The property that defines the line color.
+        */
+       public static final String TEMPLATE_LINE_COLOR_PROPERTY = "template.line.color";
+       
+       /**
+        * Get the current fill color.
+        * 
+        * @return  a color to be used as the fill in template shapes
+        */
+       public static Color getFillColor() {
+               Color fillColor = UIManager.getColor(TemplateProperties.TEMPLATE_FILL_COLOR_PROPERTY);
+               if (fillColor == null) {
+                       fillColor = Color.lightGray;
+               }
+               return fillColor;
+       }
+       
+       
+       /**
+        * Set the template fill color.
+        */
+       public static void setFillColor(Color c) {
+               UIManager.put(TemplateProperties.TEMPLATE_FILL_COLOR_PROPERTY, c);
+       }
+       
+       
+       /**
+        * Get the current line color.
+        * 
+        * @return  a color to be used as the line in template shapes
+        */
+       public static Color getLineColor() {
+               Color lineColor = UIManager.getColor(TemplateProperties.TEMPLATE_LINE_COLOR_PROPERTY);
+               if (lineColor == null) {
+                       lineColor = Color.darkGray;
+               }
+               return lineColor;
+       }
+       
+       /**
+        * Set the template line color.
+        */
+       public static void setLineColor(Color c) {
+               UIManager.put(TemplateProperties.TEMPLATE_LINE_COLOR_PROPERTY, c);
+       }
+       
+       /**
+        * Set the template colors from the print settings.
+        */
+       public static void setColors(PrintSettings settings) {
+               setFillColor(settings.getTemplateFillColor());
+               setLineColor(settings.getTemplateBorderColor());
+       }
 }