| 1 |
/* ===================================================================== |
| 2 |
* JFreePDF : a fast, light-weight PDF library for the Java(tm) platform |
| 3 |
* ===================================================================== |
| 4 |
* |
| 5 |
* (C)opyright 2013-2022, by David Gilbert. All rights reserved. |
| 6 |
* |
| 7 |
* https://github.com/jfree/orsonpdf |
| 8 |
* |
| 9 |
* This program is free software: you can redistribute it and/or modify |
| 10 |
* it under the terms of the GNU General Public License as published by |
| 11 |
* the Free Software Foundation, either version 3 of the License, or |
| 12 |
* (at your option) any later version. |
| 13 |
* |
| 14 |
* This program is distributed in the hope that it will be useful, |
| 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
* GNU General Public License for more details. |
| 18 |
* |
| 19 |
* You should have received a copy of the GNU General Public License |
| 20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 |
* |
| 22 |
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates. |
| 23 |
* Other names may be trademarks of their respective owners.] |
| 24 |
* |
| 25 |
* If you do not wish to be bound by the terms of the GPL, an alternative |
| 26 |
* runtime license is available to JFree sponsors: |
| 27 |
* |
| 28 |
* https://github.com/sponsors/jfree |
| 29 |
* |
| 30 |
*/ |
| 31 |
|
| 32 |
package org.jfree.pdf; |
| 33 |
|
| 34 |
import java.awt.GraphicsConfiguration; |
| 35 |
import java.awt.GraphicsDevice; |
| 36 |
|
| 37 |
/** |
| 38 |
* A graphics device for use in the {@link PDFGraphicsConfiguration} class. |
| 39 |
*/ |
| 40 |
public class PDFGraphicsDevice extends GraphicsDevice { |
| 41 |
|
| 42 |
private final String id; |
| 43 |
|
| 44 |
GraphicsConfiguration defaultConfig; |
| 45 |
|
| 46 |
/** |
| 47 |
* Creates a new instance. |
| 48 |
* |
| 49 |
* @param id the id. |
| 50 |
* @param defaultConfig the default configuration. |
| 51 |
*/ |
| 52 |
public PDFGraphicsDevice(String id, GraphicsConfiguration defaultConfig) { |
| 53 |
this.id = id; |
| 54 |
this.defaultConfig = defaultConfig; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Returns the device type. |
| 59 |
* |
| 60 |
* @return The device type. |
| 61 |
*/ |
| 62 |
@Override |
| 63 |
public int getType() { |
| 64 |
return GraphicsDevice.TYPE_PRINTER; |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Returns the id string. |
| 69 |
* |
| 70 |
* @return The id string. |
| 71 |
*/ |
| 72 |
@Override |
| 73 |
public String getIDstring() { |
| 74 |
return this.id; |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Returns all configurations for this device. |
| 79 |
* |
| 80 |
* @return All configurations for this device. |
| 81 |
*/ |
| 82 |
@Override |
| 83 |
public GraphicsConfiguration[] getConfigurations() { |
| 84 |
return new GraphicsConfiguration[] { getDefaultConfiguration() }; |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Returns the default configuration for this device. |
| 89 |
* |
| 90 |
* @return The default configuration for this device. |
| 91 |
*/ |
| 92 |
@Override |
| 93 |
public GraphicsConfiguration getDefaultConfiguration() { |
| 94 |
return this.defaultConfig; |
| 95 |
} |
| 96 |
|
| 97 |
} |
| 98 |
|