KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > externalizer > StyleSheetExternalizer


1 /*
2  * $Id: StyleSheetExternalizer.java,v 1.3 2004/12/01 07:54:08 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.externalizer;
15
16 import org.wings.Renderable;
17 import org.wings.io.Device;
18 import org.wings.style.StyleSheet;
19
20 import java.util.Collection JavaDoc;
21
22 /**
23  * @author <a HREF="mailto:engels@mercatis.de">Holger Engels</a>
24  * @version $Revision: 1.3 $
25  */

26 public class StyleSheetExternalizer implements Externalizer {
27
28     public static final StyleSheetExternalizer SHARED_INSTANCE = new StyleSheetExternalizer();
29
30     private static final Class JavaDoc[] SUPPORTED_CLASSES = {StyleSheet.class};
31     private static final String JavaDoc[] SUPPORTED_MIME_TYPES = {"text/css"};
32
33     public String JavaDoc getExtension(Object JavaDoc obj) {
34         return "css";
35     }
36
37     public String JavaDoc getMimeType(Object JavaDoc obj) {
38         return "text/css";
39     }
40
41     public boolean isFinal(Object JavaDoc obj) {
42         return ((StyleSheet) obj).isFinal();
43     }
44
45     public int getLength(Object JavaDoc obj) {
46         return -1;
47     }
48
49     public void write(Object JavaDoc obj, Device out)
50             throws java.io.IOException JavaDoc {
51         ((Renderable) obj).write(out);
52     }
53
54     public Class JavaDoc[] getSupportedClasses() {
55         return SUPPORTED_CLASSES;
56     }
57
58     public String JavaDoc[] getSupportedMimeTypes() {
59         return SUPPORTED_MIME_TYPES;
60     }
61
62     public Collection JavaDoc getHeaders(Object JavaDoc obj) {
63         return null;
64     }
65 }
66
67
68
Popular Tags