KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > apps > rasterizer > DefaultSVGConverterController


1 /*
2
3    Copyright 2001,2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    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 package org.apache.batik.apps.rasterizer;
19
20 import java.io.File JavaDoc;
21 import java.util.Map JavaDoc;
22 import java.util.Vector JavaDoc;
23
24 import org.apache.batik.transcoder.Transcoder;
25
26 /**
27  * Default controller for the
28  * <tt>SVGConverter</tt> operation.
29  *
30  * @author <a HREF="mailto:vhardy@apache.org">Vincent Hardy</a>
31  * @version $Id: DefaultSVGConverterController.java,v 1.5 2004/08/18 07:12:25 vhardy Exp $
32  */

33 public class DefaultSVGConverterController implements SVGConverterController {
34     /**
35      * Invoked when the rasterizer has computed the
36      * exact description of what it should do. The controller
37      * should return true if the transcoding process should
38      * proceed or false otherwise.
39      *
40      * @param transcoder Transcoder which will be used for the conversion
41      * @param hints set of hints that were set on the transcoder
42      * @param sources list of SVG sources it will convert.
43      * @param dest list of destination file it will use
44      */

45     public boolean proceedWithComputedTask(Transcoder transcoder,
46                                            Map JavaDoc hints,
47                                            Vector JavaDoc sources,
48                                            Vector JavaDoc dest){
49         return true;
50     }
51     
52     /**
53      * Invoked when the rasterizer is about to start transcoding
54      * of a given source.
55      * The controller should return true if the source should be
56      * transcoded and false otherwise.
57      */

58     public boolean proceedWithSourceTranscoding(SVGConverterSource source,
59                                                 File JavaDoc dest) {
60         System.out.println("About to transcoder source of type: " + source.getClass().getName());
61         return true;
62     }
63     
64     /**
65      * Invoked when the rasterizer got an error while
66      * transcoding the input source.
67      * The controller should return true if the transcoding process
68      * should continue on other sources and it should return false
69      * if it should not.
70      *
71      * @param errorCode see the {@link SVGConverter} error code descriptions.
72      */

73     public boolean proceedOnSourceTranscodingFailure(SVGConverterSource source,
74                                                      File JavaDoc dest,
75                                                      String JavaDoc errorCode){
76         return true;
77     }
78
79     /**
80      * Invoked when the rasterizer successfully transcoded
81      * the input source.
82      */

83     public void onSourceTranscodingSuccess(SVGConverterSource source,
84                                            File JavaDoc dest){
85     }
86 }
87
88
Popular Tags