blob: 03d256695c766f3620416bfda008da1bcba42ccf [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package sun.java2d;
27
28import java.awt.GraphicsEnvironment;
29import java.awt.GraphicsDevice;
30import java.awt.Graphics2D;
31import java.awt.HeadlessException;
32import java.awt.image.BufferedImage;
33import java.awt.Font;
34import java.text.AttributedCharacterIterator;
35import java.awt.print.PrinterJob;
36import java.util.Map;
37import java.util.Hashtable;
38import java.util.Locale;
39import java.util.Vector;
40import java.util.StringTokenizer;
41import java.util.ResourceBundle;
42import java.util.MissingResourceException;
43import java.io.IOException;
44import java.io.FilenameFilter;
45import java.io.File;
46import java.util.NoSuchElementException;
47import sun.awt.FontConfiguration;
48import java.util.TreeMap;
49import java.util.Set;
50import java.awt.font.TextAttribute;
51import java.io.InputStream;
52import java.io.FileInputStream;
53import java.io.BufferedInputStream;
54import java.util.Properties;
55import java.awt.Point;
56import java.awt.Rectangle;
57
58/**
59 * Headless decorator implementation of a SunGraphicsEnvironment
60 */
61
62public class HeadlessGraphicsEnvironment extends GraphicsEnvironment
63 implements FontSupport {
64
65 private GraphicsEnvironment ge;
66 private FontSupport fontSupport;
67
68 public HeadlessGraphicsEnvironment(GraphicsEnvironment ge) {
69 this.ge = ge;
70 if (ge instanceof FontSupport) {
71 fontSupport = (FontSupport)ge;
72 }
73 }
74
75 public GraphicsDevice[] getScreenDevices()
76 throws HeadlessException {
77 throw new HeadlessException();
78 }
79
80 public GraphicsDevice getDefaultScreenDevice()
81 throws HeadlessException {
82 throw new HeadlessException();
83 }
84
85 public Point getCenterPoint() throws HeadlessException {
86 throw new HeadlessException();
87 }
88
89 public Rectangle getMaximumWindowBounds() throws HeadlessException {
90 throw new HeadlessException();
91 }
92
93 public Graphics2D createGraphics(BufferedImage img) {
94 return ge.createGraphics(img); }
95
96 public Font[] getAllFonts() { return ge.getAllFonts(); }
97
98 public String[] getAvailableFontFamilyNames() {
99 return ge.getAvailableFontFamilyNames(); }
100
101 public String[] getAvailableFontFamilyNames(Locale l) {
102 return ge.getAvailableFontFamilyNames(l); }
103
104 public FontConfiguration getFontConfiguration() {
105 if (fontSupport != null) {
106 return fontSupport.getFontConfiguration();
107 }
108 return null;
109 }
110
111 /* Used by FontManager : internal API */
112 public GraphicsEnvironment getSunGraphicsEnvironment() {
113 return ge;
114 }
115}