X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fprint%2FTemplateProperties.java;h=6f88e576bc2a1c0bc1d64b166a63a8dfd0996d6d;hb=2c2648eecec15b853ff80ad040bd98f3ebde645b;hp=f98f7ea36c265c54a51414f8a4d0aacb78e49130;hpb=50f171ab51eae5c91117ebdc9b7a0d43d764ddb5;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/gui/print/TemplateProperties.java b/src/net/sf/openrocket/gui/print/TemplateProperties.java index f98f7ea3..6f88e576 100644 --- a/src/net/sf/openrocket/gui/print/TemplateProperties.java +++ b/src/net/sf/openrocket/gui/print/TemplateProperties.java @@ -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()); + } }