home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.print;
-
- public final class PrinterCapabilities implements Cloneable {
- public static final int COLOR = 1;
- public static final int DUPLEX = 2;
- public static final int MEDIA = 4;
- private final String printerName;
- private long capabilities;
- private int[] sizes;
- private Object userData;
-
- public PrinterCapabilities(String var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("printerName cannot be null");
- } else {
- this.printerName = var1;
- }
- }
-
- public PrinterCapabilities(String var1, long var2, int[] var4, Object var5) {
- this(var1);
- this.setCapabilities(var2);
- this.setSizes(var4);
- this.setUserData(var5);
- }
-
- public PrinterCapabilities(PrinterCapabilities var1) {
- this.printerName = var1.printerName;
- this.capabilities = var1.capabilities;
- this.sizes = var1.sizes;
- this.userData = var1.userData;
- }
-
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException var2) {
- throw new InternalError();
- }
- }
-
- public void set(PrinterCapabilities var1) {
- if (!this.printerName.equals(var1.printerName)) {
- throw new IllegalArgumentException("setting capabilities for different printers");
- } else {
- this.capabilities = var1.capabilities;
- this.sizes = var1.sizes;
- }
- }
-
- public String getPrinterName() {
- return this.printerName;
- }
-
- public long getCapabilities() {
- return this.capabilities;
- }
-
- public void setCapabilities(long var1) {
- if ((var1 & -8L) != 0L) {
- throw new IllegalArgumentException("invalid value for capabilities");
- } else {
- this.capabilities = var1;
- if ((var1 & 4L) == 0L) {
- this.sizes = null;
- }
-
- }
- }
-
- public int[] getSizes() {
- return this.sizes != null ? (int[])this.sizes.clone() : null;
- }
-
- public void setSizes(int[] var1) {
- if (var1 != null || (this.capabilities & 4L) != 0L) {
- if ((this.capabilities & 4L) == 0L) {
- throw new IllegalStateException("sizes cannot be set if printer does not enumerate media types");
- } else if (var1 == null) {
- throw new IllegalArgumentException("sizes cannot be null");
- } else {
- this.sizes = (int[])var1.clone();
- }
- }
- }
-
- public Object getUserData() {
- return this.userData;
- }
-
- public void setUserData(Object var1) {
- this.userData = var1;
- }
-
- public String toString() {
- String var1 = this.printerName + " (";
- boolean var2 = true;
- if ((this.capabilities & 1L) != 0L) {
- var2 = false;
- var1 = var1 + "COLOR";
- }
-
- if ((this.capabilities & 2L) != 0L) {
- if (var2) {
- var2 = false;
- } else {
- var1 = var1 + ",";
- }
-
- var1 = var1 + "DUPLEX";
- }
-
- if ((this.capabilities & 4L) != 0L) {
- if (var2) {
- var2 = false;
- } else {
- var1 = var1 + ",";
- }
-
- var1 = var1 + "MEDIA=[";
- boolean var3 = true;
-
- for(int var4 = 0; var4 < this.sizes.length; ++var4) {
- if (var3) {
- var3 = false;
- } else {
- var1 = var1 + ",";
- }
-
- var1 = var1 + PrintControl.SIZES[this.sizes[var4]].toString();
- }
-
- var1 = var1 + "]";
- }
-
- var1 = var1 + ")";
- return var1;
- }
- }
-