View Javadoc

1   /***********************************************************************************************************************
2   Copyright (c) 2003, International Barcode Consortium
3   All rights reserved.
4   
5   Redistribution and use in source and binary forms, with or without modification,
6   are permitted provided that the following conditions are met:
7   
8       * Redistributions of source code must retain the above copyright notice, this list of
9         conditions and the following disclaimer.
10      * Redistributions in binary form must reproduce the above copyright notice, this list of
11        conditions and the following disclaimer in the documentation and/or other materials
12        provided with the distribution.
13      * Neither the name of the International Barcode Consortium nor the names of any contributors may be used to endorse
14        or promote products derived from this software without specific prior written permission.
15  
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
17  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  POSSIBILITY OF SUCH DAMAGE.
25  ***********************************************************************************************************************/
26  
27  package net.sourceforge.barbecue.env;
28  
29  import java.awt.*;
30  
31  /**
32   * An environment used when absolutely no AWT activity is desired when
33   * handling barcodes.
34   *
35   * @author <a href="mailto:opensource@ianbourke.com">Ian Bourke</a>
36   */
37  public class NonAWTEnvironment implements Environment {
38  	private final int resolution;
39  
40      /**
41       * Constructs the environment with the mandatory output resolution.
42       * The resolution must be specified because this environment cannot
43       * look it up anywhere.
44       * @param resolution The output resolution
45       */
46  	public NonAWTEnvironment(int resolution) {
47  		this.resolution = resolution;
48  	}
49  
50      /**
51  	 * Returns the specified resolution for
52  	 * outputting barcodes.
53  	 * @return The resolution for the environment
54  	 */
55  	public int getResolution() {
56  		return resolution;
57  	}
58  
59      /**
60       * Returns the default font for the environment.
61       * @return null
62       */
63  	public Font getDefaultFont() {
64  		return null;
65  	}
66  }