KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > svg > PDFGraphicsDevice


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id: PDFGraphicsDevice.java 426576 2006-07-28 15:44:37Z jeremias $ */
19  
20 package org.apache.fop.svg;
21
22 import java.awt.GraphicsDevice JavaDoc;
23 import java.awt.GraphicsConfiguration JavaDoc;
24 import java.awt.GraphicsConfigTemplate JavaDoc;
25
26 /**
27  * This implements the GraphicsDevice interface as appropriate for
28  * a PDFGraphics2D. This is quite simple since we only have one
29  * GraphicsConfiguration for now (this might change in the future
30  * I suppose).
31  */

32 class PDFGraphicsDevice extends GraphicsDevice JavaDoc {
33
34     /**
35      * The Graphics Config that created us...
36      */

37     protected GraphicsConfiguration gc;
38
39     /**
40      * Create a new PDF graphics device.
41      *
42      * @param The gc we should reference
43      */

44     PDFGraphicsDevice(PDFGraphicsConfiguration gc) {
45         this.gc = gc;
46     }
47
48     /**
49      * Ignore template and return the only config we have
50      *
51      * @param gct the template configuration
52      * @return the best configuration which is the only one
53      */

54     public GraphicsConfiguration getBestConfiguration(
55       GraphicsConfigTemplate JavaDoc gct) {
56         return gc;
57     }
58
59     /**
60      * Return an array of our one GraphicsConfig
61      *
62      * @return an array containing the one graphics configuration
63      */

64     public GraphicsConfiguration[] getConfigurations() {
65         return new GraphicsConfiguration[]{ gc };
66     }
67
68     /**
69      * Return out sole GraphicsConfig.
70      *
71      * @return the grpahics configuration that created this object
72      */

73     public GraphicsConfiguration getDefaultConfiguration() {
74         return gc;
75     }
76
77     /**
78      * Generate an IdString..
79      *
80      * @return the ID string for this device, uses toString
81      */

82     public String JavaDoc getIDstring() {
83         return toString();
84     }
85
86     /**
87      * Let the caller know that we are "a printer"
88      *
89      * @return the type which is always printer
90      */

91     public int getType() {
92         return GraphicsDevice.TYPE_PRINTER;
93     }
94
95 }
96
97
Popular Tags