Skip to content

Package: PrintOp

PrintOp

nameinstructionbranchcomplexitylinemethod
PrintOp()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
PrintOp(PrinterJob)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
PrintOp(PrinterJob, PrintRequestAttributeSet)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
PrintOp(PrinterJob, PrintRequestAttributeSet, boolean)
M: 28 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
confirmPrint()
M: 23 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getPrintRequestAttributeSet()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPrinterJob()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * *********************************************************************************************************************
3: *
4: * Mistral: open source imaging engine
5: * http://tidalwave.it/projects/mistral
6: *
7: * Copyright (C) 2003 - 2023 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/mistral-src
23: * git clone https://github.com/tidalwave-it/mistral-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.image.op;
28:
29: import java.awt.print.PrinterJob;
30: import javax.print.attribute.HashPrintRequestAttributeSet;
31: import javax.print.attribute.PrintRequestAttributeSet;
32:
33: /***********************************************************************************************************************
34: *
35: * @author Fabrizio Giudici
36: *
37: **********************************************************************************************************************/
38: public class PrintOp extends Operation
39: {
40: private final PrinterJob printerJob;
41: private final PrintRequestAttributeSet attributeSet;
42: private boolean printDialogDone = false;
43: private boolean printDialogResult = false;
44: private final boolean suppressDialog;
45:
46: public PrintOp()
47: {
48: this(null);
49: }
50:
51: public PrintOp (final PrinterJob printerJob)
52: {
53: this(printerJob, null);
54: }
55:
56: public PrintOp (final PrinterJob printerJob, final PrintRequestAttributeSet attributeSet)
57: {
58: this(printerJob, attributeSet, false);
59: }
60:
61: public PrintOp (final PrinterJob printerJob,
62: final PrintRequestAttributeSet attributeSet,
63: final boolean suppressDialog)
64: {
65:• this.printerJob = (printerJob != null) ? printerJob : PrinterJob.getPrinterJob();
66:• this.attributeSet = (attributeSet != null) ? attributeSet : new HashPrintRequestAttributeSet();
67: this.suppressDialog = suppressDialog;
68: }
69:
70: public PrinterJob getPrinterJob()
71: {
72: return printerJob;
73: }
74:
75: public PrintRequestAttributeSet getPrintRequestAttributeSet()
76: {
77: return attributeSet;
78: }
79:
80: /**
81: * Internal use only, don't call!
82: */
83: public boolean confirmPrint()
84: {
85:• if (!printDialogDone)
86: {
87:• if (!suppressDialog)
88: {
89: printDialogResult = printerJob.printDialog(attributeSet);
90: }
91: else
92: {
93: printDialogResult = true;
94: }
95:
96: printDialogDone = true;
97: }
98:
99: return printDialogResult;
100: }
101:
102: @Override
103: public String toString()
104: {
105: return "PrintOp[printerJob: " + printerJob +
106: ", attributeSet: " + attributeSet +
107: ", printDialogDone: " + printDialogDone +
108: ", printDialogResult: " + printDialogResult + "]";
109: }
110: }