diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/gnu/javax/print/ipp/attribute/defaults | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/classpath/gnu/javax/print/ipp/attribute/defaults')
13 files changed, 1811 insertions, 0 deletions
diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java new file mode 100644 index 000000000..39d8fe1c0 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java @@ -0,0 +1,118 @@ +/* CopiesDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.Copies; + +/** + * <code>CopiesDefault</code> provides the default value + * for the copies attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class CopiesDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>CopiesDefault</code> object. + * + * @param value the number of copies + * + * @exception IllegalArgumentException if value < 1 + */ + public CopiesDefault(int value) + { + super(value); + + if (value < 1) + throw new IllegalArgumentException("value may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return <code>true</code> if both objects are equal, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof CopiesDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>CopiesDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return CopiesDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "copies-default". + */ + public String getName() + { + return "copies-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new Copies(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java new file mode 100644 index 000000000..5eff91498 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java @@ -0,0 +1,106 @@ +/* DocumentFormatDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; +import gnu.javax.print.ipp.attribute.printer.DocumentFormat; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * <code>DocumentFormatDefault</code> specifies the default document + * format of a printer. + * + * @author Wolfgang Baer (WBaer@gmx.de) + * + */ +public final class DocumentFormatDefault extends TextSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>DocumentFormatDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DocumentFormatDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentFormatDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DocumentFormatDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "document-format-default". + */ + public String getName() + { + return "document-format-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new DocumentFormat(getValue(), getLocale()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java new file mode 100644 index 000000000..9d4a06002 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java @@ -0,0 +1,263 @@ +/* FinishingsDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The <code>FinishingsDefault</code> attribute provides the supported + * values for finishings of a job. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class FinishingsDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** No finishing. */ + public static final FinishingsDefault NONE = new FinishingsDefault(3); + + /** Staple the document(s) */ + public static final FinishingsDefault STAPLE = new FinishingsDefault(4); + + /** Cover a document */ + public static final FinishingsDefault COVER = new FinishingsDefault(6); + + /** + * This value indicates that a binding is to be applied to the document. + * The type and placement of the binding is site-defined. + */ + public static final FinishingsDefault BIND = new FinishingsDefault(7); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along the middle fold. + */ + public static final FinishingsDefault SADDLE_STITCH = new FinishingsDefault(8); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along one edge. + */ + public static final FinishingsDefault EDGE_STITCH = new FinishingsDefault(9); + + /** + * Bind the document(s) with one or more staples in the top left + * corner. + */ + public static final FinishingsDefault STAPLE_TOP_LEFT = new FinishingsDefault(20); + + /** + * Bind the document(s) with one or more staples in the bottom + * left corner. + */ + public static final FinishingsDefault STAPLE_BOTTOM_LEFT = new FinishingsDefault(21); + + /** + * Bind the document(s) with one or more staples in the top right corner. + */ + public static final FinishingsDefault STAPLE_TOP_RIGHT = new FinishingsDefault(22); + + /** + * Bind the document(s) with one or more staples in the bottom right corner. + */ + public static final FinishingsDefault STAPLE_BOTTOM_RIGHT = new FinishingsDefault(23); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along the left edge. + */ + public static final FinishingsDefault EDGE_STITCH_LEFT = new FinishingsDefault(24); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the top edge. + */ + public static final FinishingsDefault EDGE_STITCH_TOP = new FinishingsDefault(25); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the right edge. + */ + public static final FinishingsDefault EDGE_STITCH_RIGHT = new FinishingsDefault(26); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the bottom edge. + */ + public static final FinishingsDefault EDGE_STITCH_BOTTOM = new FinishingsDefault(27); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * left edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_LEFT = new FinishingsDefault(28); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * top edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_TOP = new FinishingsDefault(29); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * right edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_RIGHT = new FinishingsDefault(30); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * bottom edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_BOTTOM = new FinishingsDefault(31); + + private static final String[] stringTable = { "none", "staple", null, + "cover", "bind", "saddle-stitch", + "edge-stitch", null, null, null, + null, null, null, null, null, + null, null, "staple-top-left", + "staple-bottom-left", + "staple-top-right", + "staple-bottom-right", + "edge-stitch-left", + "edge-stitch-top", + "edge-stitch-right", + "edge-stitch-bottom", + "staple-dual-left", + "staple-dual-top", + "staple-dual-right", + "staple-dual-bottom" }; + + private static final FinishingsDefault[] enumValueTable = { NONE, STAPLE, null, + COVER, BIND, + SADDLE_STITCH, + EDGE_STITCH, null, + null, null, null, + null, null, null, + null, null, null, + STAPLE_TOP_LEFT, + STAPLE_BOTTOM_LEFT, + STAPLE_TOP_RIGHT, + STAPLE_BOTTOM_RIGHT, + EDGE_STITCH_LEFT, + EDGE_STITCH_TOP, + EDGE_STITCH_RIGHT, + EDGE_STITCH_BOTTOM, + STAPLE_DUAL_LEFT, + STAPLE_DUAL_TOP, + STAPLE_DUAL_RIGHT, + STAPLE_DUAL_BOTTOM }; + + /** + * Constructs a <code>FinishingsDefault</code> object. + * + * @param value the value + */ + protected FinishingsDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return the class <code>FinishingsDefault</code> itself + */ + public Class<? extends Attribute> getCategory() + { + return FinishingsDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "finishings-default". + */ + public String getName() + { + return "finishings-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("finishings", new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java new file mode 100644 index 000000000..7c29f231c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java @@ -0,0 +1,149 @@ +/* JobHoldUntilDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Date; +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; +import javax.print.attribute.standard.JobHoldUntil; + +/** + * JobHoldUntilDefault attribute provides the default value + * for the attribute type job-hold-until. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobHoldUntilDefault extends TextSyntax + implements DefaultValueAttribute +{ + + // a keyword/name based attribute in IPP + // can be extended by administrators + // standard values are predefined + + /** Job should be printed immediately. */ + public static final JobHoldUntilDefault NO_HOLD = + new JobHoldUntilDefault("no-hold", null); + + /** Job should be hold indefinitely. */ + public static final JobHoldUntilDefault INDEFINITE = + new JobHoldUntilDefault("indefinite", null); + + /** Job should be processed during the day. */ + public static final JobHoldUntilDefault DAY_TIME = + new JobHoldUntilDefault("day-time", null); + + /** Job should be processed in the evening. */ + public static final JobHoldUntilDefault EVENING = + new JobHoldUntilDefault("evening", null); + + /** Job should be processed during night. */ + public static final JobHoldUntilDefault NIGHT = + new JobHoldUntilDefault("night", null); + + /** Job should be processed during the weekend. */ + public static final JobHoldUntilDefault WEEKEND = + new JobHoldUntilDefault("weekend", null); + + /** + * Job should be processed as second-shift + * (after close of business). + */ + public static final JobHoldUntilDefault SECOND_SHIFT = + new JobHoldUntilDefault("second-shift", null); + + /** + * Job should be processed as third-shift + * (after midnight). + */ + public static final JobHoldUntilDefault THIRD_SHIFT = + new JobHoldUntilDefault("third-shift", null); + + /** + * Creates a <code>JobHoldUntilDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobHoldUntilDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobHoldUntilDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobHoldUntilDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-hold-until-default". + */ + public String getName() + { + return "job-hold-until-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + // FIXME Same Mapping problem as in IppPrintService + return new JobHoldUntil(new Date()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java new file mode 100644 index 000000000..9430250ae --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java @@ -0,0 +1,118 @@ +/* JobPriorityDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.JobPriority; + + +/** + * JobPriorityDefault attribute provides the default value of + * the printer object for the job-priority attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobPriorityDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>JobPriorityDefault</code> object. + * + * @param value the priority + * + * @exception IllegalArgumentException if value < 1 or value > 100 + */ + public JobPriorityDefault(int value) + { + super(value); + + if (value < 1 || value > 100) + throw new IllegalArgumentException("value out of range"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return <code>true</code> if both objects are equal, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobPriorityDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobPriorityDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobPriorityDefault.class; + } + + /** + * Returns name of this class. + * + * @return The anme "job-priority-default". + */ + public String getName() + { + return "job-priority-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new JobPriority(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java new file mode 100644 index 000000000..6bf027eda --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java @@ -0,0 +1,122 @@ +/* JobSheetsDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; +import javax.print.attribute.standard.JobSheets; + +/** + * JobSheetsDefault attribute provides the default value of + * the printer object for the job-sheets attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobSheetsDefault extends TextSyntax + implements DefaultValueAttribute +{ + //a keyword/name based attribute in IPP + // can be extended by administrators + // standard values are predefined + + /** No job sheet is the default */ + public static final JobSheetsDefault NONE = + new JobSheetsDefault("none", Locale.getDefault()); + + /** A job sheet is the default */ + public static final JobSheetsDefault STANDARD = + new JobSheetsDefault("standard", Locale.getDefault()); + + /** + * Creates a <code>JobSheetsDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobSheetsDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobSheetsDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobSheetsDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-sheets-default". + */ + public String getName() + { + return "job-sheets-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + if (this.equals(JobSheetsDefault.NONE)) + return JobSheets.NONE; + if (this.equals(JobSheetsDefault.STANDARD)) + return JobSheets.STANDARD; + + return null; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java new file mode 100644 index 000000000..5945d0b9b --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java @@ -0,0 +1,105 @@ +/* MediaDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * MediaDefault attribute provides the default value of + * the printer object for the media attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MediaDefault extends TextSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>MediaDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public MediaDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>MediaDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MediaDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media-default". + */ + public String getName() + { + return "media-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("media" , getValue()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java new file mode 100644 index 000000000..1563db82c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java @@ -0,0 +1,152 @@ +/* MultipleDocumentHandlingDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>MultipleDocumentHandlingDefault</code> provides the + * default value for the MultipleDocumentHandling attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MultipleDocumentHandlingDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + //a keyword based attribute in IPP - int values just starting at 0 + + /** + * Supports only multiple documents treated as a single document. This + * applies to attributes which specify treatment of multiple document jobs. + */ + public static final MultipleDocumentHandlingDefault SINGLE_DOCUMENT = + new MultipleDocumentHandlingDefault(0); + + /** Supports multiple documents as uncollated copies */ + public static final MultipleDocumentHandlingDefault SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = + new MultipleDocumentHandlingDefault(1); + + /** Supports multiple documents as collated copies */ + public static final MultipleDocumentHandlingDefault SEPARATE_DOCUMENTS_COLLATED_COPIES = + new MultipleDocumentHandlingDefault(2); + + /** + * Supports multiple documents where every single document starts + * with a new sheet. + */ + public static final MultipleDocumentHandlingDefault SINGLE_DOCUMENT_NEW_SHEET = + new MultipleDocumentHandlingDefault(3); + + private static final String[] stringTable = { "single-document", + "separate-documents-uncollated-copies", + "separate-documents-collated-copies", + "single-document-new-sheet" }; + + private static final MultipleDocumentHandlingDefault[] enumValueTable = + { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, + SEPARATE_DOCUMENTS_COLLATED_COPIES, SINGLE_DOCUMENT_NEW_SHEET}; + + /** + * Constructs a <code>MultipleDocumentHandlingDefault</code> object. + * + * @param value the enum value + */ + protected MultipleDocumentHandlingDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>MultipleDocumentHandlingDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MultipleDocumentHandlingDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-document-handling-default". + */ + public String getName() + { + return "multiple-document-handling-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("multiple-document-handling", + new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java new file mode 100644 index 000000000..8e2d076d5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java @@ -0,0 +1,114 @@ +/* NumberUpDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.NumberUp; + +/** + * NumberUpDefault attribute provides the default value of + * the numper up attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class NumberUpDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>NumberUpDefault</code> object. + * + * @param value the value + * @throws IllegalArgumentException if value < 1 + */ + public NumberUpDefault(int value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return <code>true</code> if both objects are equal, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof NumberUpDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>NumberUpDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return NumberUpDefault.class; + } + + /** + * Returns name of this class. + * + * @return The name "number-up-default". + */ + public String getName() + { + return "number-up-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new NumberUp(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java new file mode 100644 index 000000000..4563ec525 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java @@ -0,0 +1,154 @@ +/* OrientationRequestedDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The <code>OrientationRequestedDefault</code> attribute provides + * the default value for the job attribute orientation-requested. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class OrientationRequestedDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** Orientation as portrait. */ + public static final OrientationRequestedDefault PORTRAIT = + new OrientationRequestedDefault(3); + + /** Orientation as landscape. */ + public static final OrientationRequestedDefault LANDSCAPE = + new OrientationRequestedDefault(4); + + /** Orientation as reversed landscape. */ + public static final OrientationRequestedDefault REVERSE_LANDSCAPE = + new OrientationRequestedDefault(5); + + /** Orientation as reversed portrait. */ + public static final OrientationRequestedDefault REVERSE_PORTRAIT = + new OrientationRequestedDefault(6); + + + private static final String[] stringTable = { "portrait", "landscape", + "reverse-landscape", + "reverse-portrait" }; + + private static final OrientationRequestedDefault[] + enumValueTable = { PORTRAIT, LANDSCAPE, + REVERSE_LANDSCAPE, REVERSE_PORTRAIT }; + + /** + * Constructs a <code>OrientationRequestedDefault</code> object. + * + * @param value the value + */ + protected OrientationRequestedDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>OrientationRequestedDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return OrientationRequestedDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "orientation-requested-default". + */ + public String getName() + { + return "orientation-requested-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("orientation-requested", + new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java new file mode 100644 index 000000000..7b123eeb4 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java @@ -0,0 +1,141 @@ +/* PrintQualityDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>PrintQualityDefault</code> provides the + * default value for the print-quality attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrintQualityDefault extends EnumSyntax + implements DefaultValueAttribute +{ + /** Draft quality of the printer. */ + public static final PrintQualityDefault DRAFT = new PrintQualityDefault(3); + + /** Normal quality of the printer. */ + public static final PrintQualityDefault NORMAL = new PrintQualityDefault(4); + + /** High quality of the printer. */ + public static final PrintQualityDefault HIGH = new PrintQualityDefault(5); + + private static final String[] stringTable = { "draft", "normal", "high" }; + + private static final PrintQualityDefault[] enumValueTable = { DRAFT, NORMAL, HIGH }; + + /** + * Constructs a <code>PrintQualityDefault</code> object. + * + * @param value the value of the enum + */ + protected PrintQualityDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrintQualityDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrintQualityDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "print-quality-default". + */ + public String getName() + { + return "print-quality-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute( + "print-quality", new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java new file mode 100644 index 000000000..2c84b99ba --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java @@ -0,0 +1,119 @@ +/* PrinterResolutionDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.ResolutionSyntax; +import javax.print.attribute.standard.PrinterResolution; + + +/** + * The <code>PrinterResolutionDefault</code> attribute provides + * the default value for the job attribute printer-resolution. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterResolutionDefault extends ResolutionSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>ResolutionSyntax</code> object with the given arguments. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * + * @exception IllegalArgumentException if preconditions fail + */ + public PrinterResolutionDefault(int crossFeedResolution, int feedResolution, + int units) + { + super(crossFeedResolution, feedResolution, units); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return <code>true</code> if both objects are equal, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterResolutionDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterResolutionDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterResolutionDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-resolution-default". + */ + public String getName() + { + return "printer-resolution-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new PrinterResolution(getCrossFeedResolutionDphi(), + getFeedResolutionDphi(), 1); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java new file mode 100644 index 000000000..a50560ae9 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java @@ -0,0 +1,150 @@ +/* SidesDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>SidesDefault</code> provides the + * default for the sides attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class SidesDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** Specifies that each page should be printed on one sheet. */ + public static final SidesDefault ONE_SIDED = new SidesDefault(0); + + /** + * Specifies that two following pages should be printed on the + * front and back of one sheet for binding on the long edge. + */ + public static final SidesDefault TWO_SIDED_LONG_EDGE = + new SidesDefault(1); + + /** + * Specifies that two following pages should be printed on the + * front and back of one sheet for binding on the short edge. + */ + public static final SidesDefault TWO_SIDED_SHORT_EDGE = + new SidesDefault(2); + + /** An alias constant for "two sided long edge". */ + public static final SidesDefault DUPLEX = new SidesDefault(1); + + /** An alias constant for "two sided short edge". */ + public static final SidesDefault TUMBLE = new SidesDefault(2); + + private static final String[] stringTable = { "one-sided", + "two-sided-long-edge", + "two-sided-short-edge" }; + + private static final SidesDefault[] enumValueTable = { ONE_SIDED, + TWO_SIDED_LONG_EDGE, + TWO_SIDED_SHORT_EDGE }; + + + /** + * Creates a <code>SidesDefault</code> object. + * + * @param value the value of the enum + */ + protected SidesDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>SidesDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return SidesDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "sides-default". + */ + public String getName() + { + return "sides-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("sides", new Integer(getValue())); + } +} |