OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [javax/] [print/] [attribute/] [standard/] [MediaPrintableArea.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* MediaPrintableArea.java --
2
   Copyright (C) 2005  Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package javax.print.attribute.standard;
40
 
41
import javax.print.attribute.DocAttribute;
42
import javax.print.attribute.PrintJobAttribute;
43
import javax.print.attribute.PrintRequestAttribute;
44
 
45
/**
46
 * @author Michael Koch (konqueror@gmx.de)
47
 */
48
public final class MediaPrintableArea
49
  implements DocAttribute, PrintJobAttribute, PrintRequestAttribute
50
{
51
  private static final long serialVersionUID = -1597171464050795793L;
52
 
53
  public static final int INCH = 25400;
54
  public static final int MM = 1000;
55
 
56
  private float x;
57
  private float y;
58
  private float width;
59
  private float height;
60
 
61
  /**
62
   * Creates a new <code>MediaPrintableArea</code> object.
63
   *
64
   * @throws IllegalArgumentException if x i&lt; 0 or y i&lt; 0 or w i&lt;= 0
65
   * or h i&lt;= 0 or units i&lt; 1
66
   */
67
  public MediaPrintableArea(float x, float y, float w, float h, int units)
68
  {
69
    if (x < 0.0f || y < 0.0f || w <= 0.0f || h <= 0.0f)
70
      throw new IllegalArgumentException();
71
 
72
    this.x = x;
73
    this.y = y;
74
    this.width = w;
75
    this.height = h;
76
  }
77
 
78
  /**
79
   * Creates a new <code>MediaPrintableArea</code> object.
80
   *
81
   * @throws IllegalArgumentException if x i&lt; 0 or y i&lt; 0 or w i&lt;= 0
82
   * or h i&lt;= 0 or units i&lt; 1
83
   */
84
  public MediaPrintableArea(int x, int y, int w, int h, int units)
85
  {
86
    if (x < 0 || y < 0 || w <= 0 || h <= 0)
87
      throw new IllegalArgumentException();
88
 
89
    this.x = x;
90
    this.y = y;
91
    this.width = w;
92
    this.height = h;
93
  }
94
 
95
  /**
96
   * Returns category of this class.
97
   *
98
   * @return the class <code>MediaPrintableArea</code> itself
99
   */
100
  public Class getCategory()
101
  {
102
    return MediaPrintableArea.class;
103
  }
104
 
105
  /**
106
   * Returns name of this class.
107
   *
108
   * @return the string "media-printable-area"
109
   */
110
  public String getName()
111
  {
112
    return "media-printable-area";
113
  }
114
 
115
  public float getHeight(int units)
116
  {
117
    if (units < 1)
118
      throw new IllegalArgumentException();
119
 
120
    return height * units;
121
  }
122
 
123
  public float getWidth(int units)
124
  {
125
    if (units < 1)
126
      throw new IllegalArgumentException();
127
 
128
    return width * units;
129
  }
130
 
131
  public float getX(int units)
132
  {
133
    if (units < 1)
134
      throw new IllegalArgumentException();
135
 
136
    return x * units;
137
  }
138
 
139
  public float getY(int units)
140
  {
141
    if (units < 1)
142
      throw new IllegalArgumentException();
143
 
144
    return y * units;
145
  }
146
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.