create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / gui / print / PrintSettings.java
1 package net.sf.openrocket.gui.print;
2
3 import java.awt.Color;
4
5 import net.sf.openrocket.util.AbstractChangeSource;
6
7 /**
8  * A class containing all printing settings.
9  */
10 public class PrintSettings extends AbstractChangeSource {
11         
12         private Color templateFillColor = Color.LIGHT_GRAY;
13         private Color templateBorderColor = Color.DARK_GRAY;
14         
15         private PaperSize paperSize = PaperSize.getDefault();
16         private PaperOrientation paperOrientation = PaperOrientation.PORTRAIT;
17         
18         
19         public Color getTemplateFillColor() {
20                 return templateFillColor;
21         }
22         
23         public void setTemplateFillColor(Color templateFillColor) {
24                 // Implicitly tests against setting null
25                 if (templateFillColor.equals(this.templateFillColor)) {
26                         return;
27                 }
28                 this.templateFillColor = templateFillColor;
29                 fireChangeEvent();
30         }
31         
32         public Color getTemplateBorderColor() {
33                 return templateBorderColor;
34         }
35         
36         public void setTemplateBorderColor(Color templateBorderColor) {
37                 // Implicitly tests against setting null
38                 if (templateBorderColor.equals(this.templateBorderColor)) {
39                         return;
40                 }
41                 this.templateBorderColor = templateBorderColor;
42                 fireChangeEvent();
43         }
44         
45         public PaperSize getPaperSize() {
46                 return paperSize;
47         }
48         
49         public void setPaperSize(PaperSize paperSize) {
50                 if (paperSize.equals(this.paperSize)) {
51                         return;
52                 }
53                 this.paperSize = paperSize;
54                 fireChangeEvent();
55         }
56         
57         public PaperOrientation getPaperOrientation() {
58                 return paperOrientation;
59         }
60         
61         public void setPaperOrientation(PaperOrientation orientation) {
62                 if (orientation.equals(paperOrientation)) {
63                         return;
64                 }
65                 this.paperOrientation = orientation;
66                 fireChangeEvent();
67         }
68         
69         
70
71         /**
72          * Load settings from the specified print settings.
73          * @param settings      the settings to load
74          */
75         public void loadFrom(PrintSettings settings) {
76                 this.templateFillColor = settings.templateFillColor;
77                 this.templateBorderColor = settings.templateBorderColor;
78                 this.paperSize = settings.paperSize;
79                 this.paperOrientation = settings.paperOrientation;
80                 fireChangeEvent();
81         }
82         
83         
84         @Override
85         public String toString() {
86                 return "PrintSettings [templateFillColor=" + templateFillColor + ", templateBorderColor=" + templateBorderColor + ", paperSize=" + paperSize + ", paperOrientation=" + paperOrientation + "]";
87         }
88         
89 }