code
stringlengths
3
1.18M
language
stringclasses
1 value
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.event; import java.util.List; import javax.print.PrintService; import javax.print.attribute.AttributeSetUtilities; import javax.print.attribute.PrintServiceAttributeSet; /** {@collect.stats} * * Class PrintServiceAttributeEvent encapsulates an event a * Print Service instance reports to let the client know of * changes in the print service state. */ public class PrintServiceAttributeEvent extends PrintEvent { private static final long serialVersionUID = -7565987018140326600L; private PrintServiceAttributeSet attributes; /** {@collect.stats} * Constructs a PrintServiceAttributeEvent object. * * @param source the print job generating this event * @param attributes the attribute changes being reported * @throws IllegalArgumentException if <code>source</code> is * <code>null</code>. */ public PrintServiceAttributeEvent(PrintService source, PrintServiceAttributeSet attributes) { super(source); this.attributes = AttributeSetUtilities.unmodifiableView(attributes); } /** {@collect.stats} * Returns the print service. * @return Print Service object. */ public PrintService getPrintService() { return (PrintService) getSource(); } /** {@collect.stats} * Determine the printing service attributes that changed and their new * values. * * @return Attributes containing the new values for the service * attributes that changed. The returned set may be unmodifiable. */ public PrintServiceAttributeSet getAttributes() { return attributes; } }
Java
/* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.event; /** {@collect.stats} * An abstract adapter class for receiving print job events. * The methods in this class are empty. * This class exists as a convenience for creating listener objects. * Extend this class to create a {@link PrintJobEvent} listener and override * the methods for the events of interest. Unlike the * {@link java.awt.event.ComponentListener ComponentListener} * interface, this abstract interface provides null methods so that you * only need to define the methods you need, rather than all of the methods. * */ public abstract class PrintJobAdapter implements PrintJobListener { /** {@collect.stats} * Called to notify the client that data has been successfully * transferred to the print service, and the client may free * local resources allocated for that data. The client should * not assume that the data has been completely printed after * receiving this event. * * @param pje the event being notified */ public void printDataTransferCompleted(PrintJobEvent pje) { } /** {@collect.stats} * Called to notify the client that the job completed successfully. * * @param pje the event being notified */ public void printJobCompleted(PrintJobEvent pje) { } /** {@collect.stats} * Called to notify the client that the job failed to complete * successfully and will have to be resubmitted. * * @param pje the event being notified */ public void printJobFailed(PrintJobEvent pje) { } /** {@collect.stats} * Called to notify the client that the job was canceled * by user or program. * * @param pje the event being notified */ public void printJobCanceled(PrintJobEvent pje) { } /** {@collect.stats} * Called to notify the client that no more events will be delivered. * One cause of this event being generated is if the job * has successfully completed, but the printing system * is limited in capability and cannot verify this. * This event is required to be delivered if none of the other * terminal events (completed/failed/canceled) are delivered. * * @param pje the event being notified */ public void printJobNoMoreEvents(PrintJobEvent pje) { } /** {@collect.stats} * Called to notify the client that some possibly user rectifiable * problem occurs (eg printer out of paper). * * @param pje the event being notified */ public void printJobRequiresAttention(PrintJobEvent pje) { } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print; import javax.print.attribute.PrintRequestAttributeSet; /** {@collect.stats} * * Obtained from a MultiDocPrintService, a MultiDocPrintJob can print a * specified collection of documents as a single print job with a set of * job attributes. * <P> */ public interface MultiDocPrintJob extends DocPrintJob { /** {@collect.stats} * Print a MultiDoc with the specified job attributes. * This method should only be called once for a given print job. * Calling it again will not result in a new job being spooled to * the printer. The service implementation will define policy * for service interruption and recovery. Application clients which * want to monitor the success or failure should register a * PrintJobListener. * * @param multiDoc The documents to be printed. ALL must be a flavor * supported by the PrintJob & PrintService. * * @param attributes The job attributes to be applied to this print job. * If this parameter is null then the default attributes are used. * * @throws PrintException The exception additionally may implement * an interfaces which more precisely describes the cause of the exception * <ul> * <li>FlavorException. * If the document has a flavor not supported by this print job. * <li>AttributeException. * If one or more of the attributes are not valid for this print job. * </ul> */ public void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes) throws PrintException; }
Java
/* * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Dialog; import java.awt.Frame; import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; import java.awt.KeyboardFocusManager; import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.Fidelity; import sun.print.ServiceDialog; import sun.print.SunAlternateMedia; /** {@collect.stats} This class is a collection of UI convenience methods which provide a * graphical user dialog for browsing print services looked up through the Java * Print Service API. * <p> * The dialogs follow a standard pattern of acting as a continue/cancel option *for a user as well as allowing the user to select the print service to use *and specify choices such as paper size and number of copies. * <p> * <p> * The dialogs are designed to work with pluggable print services though the * public APIs of those print services. * <p> * If a print service provides any vendor extensions these may be made * accessible to the user through a vendor supplied tab panel Component. * Such a vendor extension is encouraged to use Swing! and to support its * accessibility APIs. * The vendor extensions should return the settings as part of the * AttributeSet. * Applications which want to preserve the user settings should use those * settings to specify the print job. * Note that this class is not referenced by any other part of the Java * Print Service and may not be included in profiles which cannot depend * on the presence of the AWT packages. */ public class ServiceUI { /** {@collect.stats} * Presents a dialog to the user for selecting a print service (printer). * It is displayed at the location specified by the application and * is modal. * If the specification is invalid or would make the dialog not visible it * will be displayed at a location determined by the implementation. * The dialog blocks its calling thread and is application modal. * <p> * The dialog may include a tab panel with custom UI lazily obtained from * the PrintService's ServiceUIFactory when the PrintService is browsed. * The dialog will attempt to locate a MAIN_UIROLE first as a JComponent, * then as a Panel. If there is no ServiceUIFactory or no matching role * the custom tab will be empty or not visible. * <p> * The dialog returns the print service selected by the user if the user * OK's the dialog and null if the user cancels the dialog. * <p> * An application must pass in an array of print services to browse. * The array must be non-null and non-empty. * Typically an application will pass in only PrintServices capable * of printing a particular document flavor. * <p> * An application may pass in a PrintService to be initially displayed. * A non-null parameter must be included in the array of browsable * services. * If this parameter is null a service is chosen by the implementation. * <p> * An application may optionally pass in the flavor to be printed. * If this is non-null choices presented to the user can be better * validated against those supported by the services. * An application must pass in a PrintRequestAttributeSet for returning * user choices. * On calling the PrintRequestAttributeSet may be empty, or may contain * application-specified values. * <p> * These are used to set the initial settings for the initially * displayed print service. Values which are not supported by the print * service are ignored. As the user browses print services, attributes * and values are copied to the new display. If a user browses a * print service which does not support a particular attribute-value, the * default for that service is used as the new value to be copied. * <p> * If the user cancels the dialog, the returned attributes will not reflect * any changes made by the user. * * A typical basic usage of this method may be : * <pre> * PrintService[] services = PrintServiceLookup.lookupPrintServices( * DocFlavor.INPUT_STREAM.JPEG, null); * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); * if (services.length > 0) { * PrintService service = ServiceUI.printDialog(null, 50, 50, * services, services[0], * null, * attributes); * if (service != null) { * ... print ... * } * } * </pre> * <p> * @param gc used to select screen. null means primary or default screen. * @param x location of dialog including border in screen coordinates * @param y location of dialog including border in screen coordinates * @param services to be browsable, must be non-null. * @param defaultService - initial PrintService to display. * @param flavor - the flavor to be printed, or null. * @param attributes on input is the initial application supplied * preferences. This cannot be null but may be empty. * On output the attributes reflect changes made by the user. * @return print service selected by the user, or null if the user * cancelled the dialog. * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @throws IllegalArgumentException if services is null or empty, * or attributes is null, or the initial PrintService is not in the * list of browsable services. */ public static PrintService printDialog(GraphicsConfiguration gc, int x, int y, PrintService[] services, PrintService defaultService, DocFlavor flavor, PrintRequestAttributeSet attributes) throws HeadlessException { int defaultIndex = -1; if (GraphicsEnvironment.isHeadless()) { throw new HeadlessException(); } else if ((services == null) || (services.length == 0)) { throw new IllegalArgumentException("services must be non-null " + "and non-empty"); } else if (attributes == null) { throw new IllegalArgumentException("attributes must be non-null"); } if (defaultService != null) { for (int i = 0; i < services.length; i++) { if (services[i].equals(defaultService)) { defaultIndex = i; break; } } if (defaultIndex < 0) { throw new IllegalArgumentException("services must contain " + "defaultService"); } } else { defaultIndex = 0; } // For now we set owner to null. In the future, it may be passed // as an argument. Window owner = null; Rectangle gcBounds = (gc == null) ? GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(). getDefaultConfiguration().getBounds() : gc.getBounds(); ServiceDialog dialog; if (owner instanceof Frame) { dialog = new ServiceDialog(gc, x + gcBounds.x, y + gcBounds.y, services, defaultIndex, flavor, attributes, (Frame)owner); } else { dialog = new ServiceDialog(gc, x + gcBounds.x, y + gcBounds.y, services, defaultIndex, flavor, attributes, (Dialog)owner); } Rectangle dlgBounds = dialog.getBounds(); // get union of all GC bounds GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j=0; j<gs.length; j++) { gcBounds = gcBounds.union(gs[j].getDefaultConfiguration().getBounds()); } // if portion of dialog is not within the gc boundary if (!gcBounds.contains(dlgBounds)) { // put in the center relative to parent frame/dialog dialog.setLocationRelativeTo(owner); } dialog.show(); if (dialog.getStatus() == ServiceDialog.APPROVE) { PrintRequestAttributeSet newas = dialog.getAttributes(); Class dstCategory = Destination.class; Class amCategory = SunAlternateMedia.class; Class fdCategory = Fidelity.class; if (attributes.containsKey(dstCategory) && !newas.containsKey(dstCategory)) { attributes.remove(dstCategory); } if (attributes.containsKey(amCategory) && !newas.containsKey(amCategory)) { attributes.remove(amCategory); } attributes.addAll(newas); Fidelity fd = (Fidelity)attributes.get(fdCategory); if (fd != null) { if (fd == Fidelity.FIDELITY_TRUE) { removeUnsupportedAttributes(dialog.getPrintService(), flavor, attributes); } } } return dialog.getPrintService(); } /** {@collect.stats} * POSSIBLE FUTURE API: This method may be used down the road if we * decide to allow developers to explicitly display a "page setup" dialog. * Currently we use that functionality internally for the AWT print model. */ /* public static void pageDialog(GraphicsConfiguration gc, int x, int y, PrintService service, DocFlavor flavor, PrintRequestAttributeSet attributes) throws HeadlessException { if (GraphicsEnvironment.isHeadless()) { throw new HeadlessException(); } else if (service == null) { throw new IllegalArgumentException("service must be non-null"); } else if (attributes == null) { throw new IllegalArgumentException("attributes must be non-null"); } ServiceDialog dialog = new ServiceDialog(gc, x, y, service, flavor, attributes); dialog.show(); if (dialog.getStatus() == ServiceDialog.APPROVE) { PrintRequestAttributeSet newas = dialog.getAttributes(); Class amCategory = SunAlternateMedia.class; if (attributes.containsKey(amCategory) && !newas.containsKey(amCategory)) { attributes.remove(amCategory); } attributes.addAll(newas.values()); } dialog.getOwner().dispose(); } */ /** {@collect.stats} * Removes any attributes from the given AttributeSet that are * unsupported by the given PrintService/DocFlavor combination. */ private static void removeUnsupportedAttributes(PrintService ps, DocFlavor flavor, AttributeSet aset) { AttributeSet asUnsupported = ps.getUnsupportedAttributes(flavor, aset); if (asUnsupported != null) { Attribute[] usAttrs = asUnsupported.toArray(); for (int i=0; i<usAttrs.length; i++) { Class category = usAttrs[i].getCategory(); if (ps.isAttributeCategorySupported(category)) { Attribute attr = (Attribute)ps.getDefaultAttributeValue(category); if (attr != null) { aset.add(attr); } else { aset.remove(category); } } else { aset.remove(category); } } } } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print; import javax.print.DocFlavor; /** {@collect.stats} * Interface FlavorException is a mixin interface which a subclass of {@link * PrintException PrintException} can implement to report an error condition * involving a doc flavor or flavors (class {@link javax.print.DocFlavor * DocFlavor}). The Print Service API does not define any print exception * classes that implement interface FlavorException, that being left to the * Print Service implementor's discretion. * */ public interface FlavorException { /** {@collect.stats} * Returns the unsupported flavors. * @return the unsupported doc flavors. */ public DocFlavor[] getUnsupportedFlavors(); }
Java
/* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print; /** {@collect.stats} * This interface is used by a printing application to cancel a * print job. This interface extends {@link DocPrintJob}. A * <code>DocPrintJob</code> implementation returned from a print * service implements this interface if the print job can be * cancelled. Before trying to cancel * a print job, the client needs to test if the * <code>DocPrintJob</code> object returned from the print service * actually implements this interface. Clients should never assume * that a <code>DocPrintJob</code> implements this interface. A * print service might support cancellation only for certain types * of print data and representation class names. This means that * only some of the <code>DocPrintJob</code> objects returned from * a service will implement this interface. * <p> * Service implementors are encouraged to implement this optional interface * and to deliver a javax.print.event.PrintJobEvent.JOB_CANCELLED event * to any listeners if a job is successfully cancelled with an * implementation of this interface. Services should also note that an * implementation of this method may be made from a separate client thread * than that which made the print request. Thus the implementation of * this interface must be made thread safe. */ public interface CancelablePrintJob extends DocPrintJob { /** {@collect.stats} * Stops further processing of a print job. * <p> * If a service supports this method it cannot be concluded that * job cancellation will always suceeed. A job may not be able to be * cancelled once it has reached and passed some point in its processing. * A successful cancellation means only that the entire job was not * printed, some portion may already have printed when cancel returns. * <p> * The service will throw a PrintException if the cancellation did not * succeed. A job which has not yet been submitted for printing should * throw this exception. * Cancelling an already successfully cancelled Print Job is not * considered an error and will always succeed. * <p> * Cancellation in some services may be a lengthy process, involving * requests to a server and processing of its print queue. Clients * may wish to execute cancel in a thread which does not affect * application execution. * @throws PrintException if the job could not be successfully cancelled. */ public void cancel() throws PrintException; }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.event.PrintServiceAttributeListener; /** {@collect.stats} * Interface PrintService is the factory for a DocPrintJob. A PrintService * describes the capabilities of a Printer and can be queried regarding * a printer's supported attributes. * <P> * Example: * <PRE> * DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT; * PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); * aset.add(MediaSizeName.ISO_A4); * PrintService[] pservices = * PrintServiceLookup.lookupPrintServices(flavor, aset); * if (pservices.length > 0) { * DocPrintJob pj = pservices[0].createPrintJob(); * try { * FileInputStream fis = new FileInputStream("test.ps"); * Doc doc = new SimpleDoc(fis, flavor, null); * pj.print(doc, aset); * } catch (FileNotFoundException fe) { * } catch (PrintException e) { * } * } * </PRE> */ public interface PrintService { /** {@collect.stats} Returns a String name for this print service which may be used * by applications to request a particular print service. * In a suitable context, such as a name service, this name must be * unique. * In some environments this unique name may be the same as the user * friendly printer name defined as the * {@link javax.print.attribute.standard.PrinterName PrinterName} * attribute. * @return name of the service. */ public String getName(); /** {@collect.stats} * Creates and returns a PrintJob capable of handling data from * any of the supported document flavors. * @return a DocPrintJob object */ public DocPrintJob createPrintJob(); /** {@collect.stats} * Registers a listener for events on this PrintService. * @param listener a PrintServiceAttributeListener, which * monitors the status of a print service * @see #removePrintServiceAttributeListener */ public void addPrintServiceAttributeListener( PrintServiceAttributeListener listener); /** {@collect.stats} * Removes the print-service listener from this print service. * This means the listener is no longer interested in * <code>PrintService</code> events. * @param listener a PrintServiceAttributeListener object * @see #addPrintServiceAttributeListener */ public void removePrintServiceAttributeListener( PrintServiceAttributeListener listener); /** {@collect.stats} * Obtains this print service's set of printer description attributes * giving this Print Service's status. The returned attribute set object * is unmodifiable. The returned attribute set object is a "snapshot" of * this Print Service's attribute set at the time of the * <CODE>getAttributes()</CODE> method call: that is, the returned * attribute set's contents will <I>not</I> be updated if this print * service's attribute set's contents change in the future. To detect * changes in attribute values, call <CODE>getAttributes()</CODE> again * and compare the new attribute set to the previous attribute set; * alternatively, register a listener for print service events. * * @return Unmodifiable snapshot of this Print Service's attribute set. * May be empty, but not null. */ public PrintServiceAttributeSet getAttributes(); /** {@collect.stats} * Gets the value of the single specified service attribute. * This may be useful to clients which only need the value of one * attribute and want to minimise overhead. * @param category the category of a PrintServiceAttribute supported * by this service - may not be null. * @return the value of the supported attribute or null if the * attribute is not supported by this service. * @exception NullPointerException if the category is null. * @exception IllegalArgumentException * (unchecked exception) if <CODE>category</CODE> is not a * <code>Class</code> that implements interface *{@link javax.print.attribute.PrintServiceAttribute PrintServiceAttribute}. */ public <T extends PrintServiceAttribute> T getAttribute(Class<T> category); /** {@collect.stats} * Determines the print data formats a client can specify when setting * up a job for this <code>PrintService</code>. A print data format is * designated by a "doc * flavor" (class {@link javax.print.DocFlavor DocFlavor}) * consisting of a MIME type plus a print data representation class. * <P> * Note that some doc flavors may not be supported in combination * with all attributes. Use <code>getUnsupportedAttributes(..)</code> * to validate specific combinations. * * @return Array of supported doc flavors, should have at least * one element. * */ public DocFlavor[] getSupportedDocFlavors(); /** {@collect.stats} * Determines if this print service supports a specific * <code>DocFlavor</code>. This is a convenience method to determine * if the <code>DocFlavor</code> would be a member of the result of * <code>getSupportedDocFlavors()</code>. * <p> * Note that some doc flavors may not be supported in combination * with all attributes. Use <code>getUnsupportedAttributes(..)</code> * to validate specific combinations. * * @param flavor the <code>DocFlavor</code>to query for support. * @return <code>true</code> if this print service supports the * specified <code>DocFlavor</code>; <code>false</code> otherwise. * @exception NullPointerException * (unchecked exception) Thrown if <CODE>flavor</CODE> is null. */ public boolean isDocFlavorSupported(DocFlavor flavor); /** {@collect.stats} * Determines the printing attribute categories a client can specify * when setting up a job for this print service. * A printing attribute category is * designated by a <code>Class</code> that implements interface * {@link javax.print.attribute.Attribute Attribute}. This method returns * just the attribute <I>categories</I> that are supported; it does not * return the particular attribute <I>values</I> that are supported. * <P> * This method returns all the printing attribute * categories this print service supports for any possible job. * Some categories may not be supported in a particular context (ie * for a particular <code>DocFlavor</code>). * Use one of the methods that include a <code>DocFlavor</code> to * validate the request before submitting it, such as * <code>getSupportedAttributeValues(..)</code>. * * @return Array of printing attribute categories that the client can * specify as a doc-level or job-level attribute in a Print * Request. Each element in the array is a {@link java.lang.Class * Class} that implements interface {@link * javax.print.attribute.Attribute Attribute}. * The array is empty if no categories are supported. */ public Class<?>[] getSupportedAttributeCategories(); /** {@collect.stats} * Determines whether a client can specify the given printing * attribute category when setting up a job for this print service. A * printing attribute category is designated by a <code>Class</code> * that implements interface {@link javax.print.attribute.Attribute * Attribute}. This method tells whether the attribute <I>category</I> is * supported; it does not tell whether a particular attribute <I>value</I> * is supported. * <p> * Some categories may not be supported in a particular context (ie * for a particular <code>DocFlavor</code>). * Use one of the methods which include a <code>DocFlavor</code> to * validate the request before submitting it, such as * <code>getSupportedAttributeValues(..)</code>. * <P> * This is a convenience method to determine if the category * would be a member of the result of * <code>getSupportedAttributeCategories()</code>. * * @param category Printing attribute category to test. It must be a * <code>Class</code> that implements * interface * {@link javax.print.attribute.Attribute Attribute}. * * @return <code>true</code> if this print service supports * specifying a doc-level or * job-level attribute in <CODE>category</CODE> in a Print * Request; <code>false</code> if it doesn't. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>category</CODE> is null. * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>category</CODE> is not a * <code>Class</code> that implements interface * {@link javax.print.attribute.Attribute Attribute}. */ public boolean isAttributeCategorySupported(Class<? extends Attribute> category); /** {@collect.stats} * Determines this print service's default printing attribute value in * the given category. A printing attribute value is an instance of * a class that implements interface * {@link javax.print.attribute.Attribute Attribute}. If a client sets * up a print job and does not specify any attribute value in the * given category, this Print Service will use the * default attribute value instead. * <p> * Some attributes may not be supported in a particular context (ie * for a particular <code>DocFlavor</code>). * Use one of the methods that include a <code>DocFlavor</code> to * validate the request before submitting it, such as * <code>getSupportedAttributeValues(..)</code>. * <P> * Not all attributes have a default value. For example the * service will not have a defaultvalue for <code>RequestingUser</code> * i.e. a null return for a supported category means there is no * service default value for that category. Use the * <code>isAttributeCategorySupported(Class)</code> method to * distinguish these cases. * * @param category Printing attribute category for which the default * attribute value is requested. It must be a {@link * java.lang.Class Class} that implements interface * {@link javax.print.attribute.Attribute * Attribute}. * * @return Default attribute value for <CODE>category</CODE>, or null * if this Print Service does not support specifying a doc-level or * job-level attribute in <CODE>category</CODE> in a Print * Request, or the service does not have a default value * for this attribute. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>category</CODE> is null. * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>category</CODE> is not a * {@link java.lang.Class Class} that implements interface {@link * javax.print.attribute.Attribute Attribute}. */ public Object getDefaultAttributeValue(Class<? extends Attribute> category); /** {@collect.stats} * Determines the printing attribute values a client can specify in * the given category when setting up a job for this print service. A * printing * attribute value is an instance of a class that implements interface * {@link javax.print.attribute.Attribute Attribute}. * <P> * If <CODE>flavor</CODE> is null and <CODE>attributes</CODE> is null * or is an empty set, this method returns all the printing attribute * values this Print Service supports for any possible job. If * <CODE>flavor</CODE> is not null or <CODE>attributes</CODE> is not * an empty set, this method returns just the printing attribute values * that are compatible with the given doc flavor and/or set of attributes. * That is, a null return value may indicate that specifying this attribute * is incompatible with the specified DocFlavor. * Also if DocFlavor is not null it must be a flavor supported by this * PrintService, else IllegalArgumentException will be thrown. * <P> * If the <code>attributes</code> parameter contains an Attribute whose * category is the same as the <code>category</code> parameter, the service * must ignore this attribute in the AttributeSet. * <p> * <code>DocAttribute</code>s which are to be specified on the * <code>Doc</code> must be included in this set to accurately * represent the context. * <p> * This method returns an Object because different printing attribute * categories indicate the supported attribute values in different ways. * The documentation for each printing attribute in package {@link * javax.print.attribute.standard javax.print.attribute.standard} * describes how each attribute indicates its supported values. Possible * ways of indicating support include: * <UL> * <LI> * Return a single instance of the attribute category to indicate that any * value is legal -- used, for example, by an attribute whose value is an * arbitrary text string. (The value of the returned attribute object is * irrelevant.) * <LI> * Return an array of one or more instances of the attribute category, * containing the legal values -- used, for example, by an attribute with * a list of enumerated values. The type of the array is an array of the * specified attribute category type as returned by its * <code>getCategory(Class)</code>. * <LI> * Return a single object (of some class other than the attribute category) * that indicates bounds on the legal values -- used, for example, by an * integer-valued attribute that must lie within a certain range. * </UL> * <P> * * @param category Printing attribute category to test. It must be a * {@link java.lang.Class Class} that implements * interface {@link * javax.print.attribute.Attribute Attribute}. * @param flavor Doc flavor for a supposed job, or null. * @param attributes Set of printing attributes for a supposed job * (both job-level attributes and document-level * attributes), or null. * * @return Object indicating supported values for <CODE>category</CODE>, * or null if this Print Service does not support specifying a * doc-level or job-level attribute in <CODE>category</CODE> in * a Print Request. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>category</CODE> is null. * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>category</CODE> is not a * {@link java.lang.Class Class} that implements interface {@link * javax.print.attribute.Attribute Attribute}, or * <code>DocFlavor</code> is not supported by this service. */ public Object getSupportedAttributeValues(Class<? extends Attribute> category, DocFlavor flavor, AttributeSet attributes); /** {@collect.stats} * Determines whether a client can specify the given printing * attribute * value when setting up a job for this Print Service. A printing * attribute value is an instance of a class that implements interface * {@link javax.print.attribute.Attribute Attribute}. * <P> * If <CODE>flavor</CODE> is null and <CODE>attributes</CODE> is null or * is an empty set, this method tells whether this Print Service supports * the given printing attribute value for some possible combination of doc * flavor and set of attributes. If <CODE>flavor</CODE> is not null or * <CODE>attributes</CODE> is not an empty set, this method tells whether * this Print Service supports the given printing attribute value in * combination with the given doc flavor and/or set of attributes. * <p> * Also if DocFlavor is not null it must be a flavor supported by this * PrintService, else IllegalArgumentException will be thrown. * <p> * <code>DocAttribute</code>s which are to be specified on the * <code>Doc</code> must be included in this set to accurately * represent the context. * <p> * This is a convenience method to determine if the value * would be a member of the result of * <code>getSupportedAttributeValues(...)</code>. * * @param attrval Printing attribute value to test. * @param flavor Doc flavor for a supposed job, or null. * @param attributes Set of printing attributes for a supposed job * (both job-level attributes and document-level * attributes), or null. * * @return True if this Print Service supports specifying * <CODE>attrval</CODE> as a doc-level or job-level attribute in a * Print Request, false if it doesn't. * * @exception NullPointerException * (unchecked exception) if <CODE>attrval</CODE> is null. * @exception IllegalArgumentException if flavor is not supported by * this PrintService. */ public boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes); /** {@collect.stats} * Identifies the attributes that are unsupported for a print request * in the context of a particular DocFlavor. * This method is useful for validating a potential print job and * identifying the specific attributes which cannot be supported. * It is important to supply only a supported DocFlavor or an * IllegalArgumentException will be thrown. If the * return value from this method is null, all attributes are supported. * <p> * <code>DocAttribute</code>s which are to be specified on the * <code>Doc</code> must be included in this set to accurately * represent the context. * <p> * If the return value is non-null, all attributes in the returned * set are unsupported with this DocFlavor. The returned set does not * distinguish attribute categories that are unsupported from * unsupported attribute values. * <p> * A supported print request can then be created by removing * all unsupported attributes from the original attribute set, * except in the case that the DocFlavor is unsupported. * <p> * If any attributes are unsupported only because they are in conflict * with other attributes then it is at the discretion of the service * to select the attribute(s) to be identified as the cause of the * conflict. * <p> * Use <code>isDocFlavorSupported()</code> to verify that a DocFlavor * is supported before calling this method. * * @param flavor Doc flavor to test, or null * @param attributes Set of printing attributes for a supposed job * (both job-level attributes and document-level * attributes), or null. * * @return null if this Print Service supports the print request * specification, else the unsupported attributes. * * @exception IllegalArgumentException if<CODE>flavor</CODE> is * not supported by this PrintService. */ public AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes); /** {@collect.stats} * Returns a factory for UI components which allow users to interact * with the service in various roles. * Services which do not provide any UI should return null. * Print Services which do provide UI but want to be supported in * an environment with no UI support should ensure that the factory * is not initialised unless the application calls this method to * obtain the factory. * See <code>ServiceUIFactory</code> for more information. * @return null or a factory for UI components. */ public ServiceUIFactory getServiceUIFactory(); /** {@collect.stats} * Determines if two services are referring to the same underlying * service. Objects encapsulating a print service may not exhibit * equality of reference even though they refer to the same underlying * service. * <p> * Clients should call this method to determine if two services are * referring to the same underlying service. * <p> * Services must implement this method and return true only if the * service objects being compared may be used interchangeably by the * client. * Services are free to return the same object reference to an underlying * service if that, but clients must not depend on equality of reference. * @param obj the reference object with which to compare. * @return true if this service is the same as the obj argument, * false otherwise. */ public boolean equals(Object obj); /** {@collect.stats} * This method should be implemented consistently with * <code>equals(Object)</code>. * @return hash code of this object. */ public int hashCode(); }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Interface Attribute is the base interface implemented by any and every * printing attribute class to indicate that the class represents a * printing attribute. All printing attributes are serializable. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public interface Attribute extends Serializable { /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value when it is added to an attribute set. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public Class<? extends Attribute> getCategory(); /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * <I>Note:</I> This method is intended to provide a default, nonlocalized * string for the attribute's category. If two attribute objects return the * same category from the <CODE>getCategory()</CODE> method, they should * return the same name from the <CODE>getName()</CODE> method. * * @return Attribute category name. */ public String getName(); }
Java
/* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface PrintServiceAttributeSet specifies the interface for a set of * print job attributes, i.e. printing attributes that implement interface * {@link * PrintServiceAttribute PrintServiceAttribute}. In the Print Service API, * the Print Service instance uses a PrintServiceAttributeSet to report the * status of the print service. * <P> * A PrintServiceAttributeSet is just an {@link AttributeSet AttributeSet} * whose constructors and mutating operations guarantee an additional * invariant, * namely that all attribute values in the PrintServiceAttributeSet must be * instances of interface {@link PrintServiceAttribute PrintServiceAttribute}. * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations * are respecified below to guarantee this additional invariant. * <P> * * @author Alan Kaminsky */ public interface PrintServiceAttributeSet extends AttributeSet { /** {@collect.stats} * Adds the specified attribute value to this attribute set if it is not * already present, first removing any existing value in the same * attribute category as the specified attribute value (optional * operation). * * @param attribute Attribute value to be added to this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call, i.e., the given attribute value was not already a * member of this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not * support the <CODE>add()</CODE> operation. * @throws ClassCastException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is * not an instance of interface * {@link PrintServiceAttribute PrintServiceAttribute}. * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. */ public boolean add(Attribute attribute); /** {@collect.stats} * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the * {@link #add(Attribute) <CODE>add(Attribute)</CODE>} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, * the <tt>addAll()</tt> operation effectively modifies this attribute * set so that its value is the <i>union</i> of the two sets. * <P> * The behavior of the <CODE>addAll()</CODE> operation is unspecified if * the specified set is modified while the operation is in progress. * <P> * If the <CODE>addAll()</CODE> operation throws an exception, the effect * on this attribute set's state is implementation dependent; elements * from the specified set before the point of the exception may or * may not have been added to this attribute set. * * @param attributes whose elements are to be added to this attribute * set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call. * * @throws UnmodifiableSetException * (Unchecked exception) Thrown if this attribute set does not * support the <tt>addAll()</tt> method. * @throws ClassCastException * (Unchecked exception) Thrown if some element in the specified * set is not an instance of interface {@link PrintServiceAttribute * PrintServiceAttribute}. * @throws NullPointerException * (Unchecked exception) Thrown if the specified set is null. * * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class IntegerSyntax is an abstract base class providing the common * implementation of all attributes with integer values. * <P> * Under the hood, an integer attribute is just an integer. You can get an * integer attribute's integer value by calling {@link #getValue() * <CODE>getValue()</CODE>}. An integer attribute's integer value is * established when it is constructed (see {@link #IntegerSyntax(int) * <CODE>IntegerSyntax(int)</CODE>}). Once constructed, an integer attribute's * value is immutable. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public abstract class IntegerSyntax implements Serializable, Cloneable { private static final long serialVersionUID = 3644574816328081943L; /** {@collect.stats} * This integer attribute's integer value. * @serial */ private int value; /** {@collect.stats} * Construct a new integer attribute with the given integer value. * * @param value Integer value. */ protected IntegerSyntax(int value) { this.value = value; } /** {@collect.stats} * Construct a new integer attribute with the given integer value, which * must lie within the given range. * * @param value Integer value. * @param lowerBound Lower bound. * @param upperBound Upper bound. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than * <CODE>lowerBound</CODE> or greater than * <CODE>upperBound</CODE>. */ protected IntegerSyntax(int value, int lowerBound, int upperBound) { if (lowerBound > value || value > upperBound) { throw new IllegalArgumentException("Value " + value + " not in range " + lowerBound + ".." + upperBound); } this.value = value; } /** {@collect.stats} * Returns this integer attribute's integer value. * @return the integer value */ public int getValue() { return value; } /** {@collect.stats} * Returns whether this integer attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class IntegerSyntax. * <LI> * This integer attribute's value and <CODE>object</CODE>'s value are * equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this integer * attribute, false otherwise. */ public boolean equals(Object object) { return (object != null && object instanceof IntegerSyntax && value == ((IntegerSyntax) object).value); } /** {@collect.stats} * Returns a hash code value for this integer attribute. The hash code is * just this integer attribute's integer value. */ public int hashCode() { return value; } /** {@collect.stats} * Returns a string value corresponding to this integer attribute. The * string value is just this integer attribute's integer value converted to * a string. */ public String toString() { return "" + value; } }
Java
/* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface PrintJobAttributeSet specifies the interface for a set of print * job attributes, i.e. printing attributes that implement interface {@link * PrintJobAttribute PrintJobAttribute}. In the Print Service API, a * service uses a PrintJobAttributeSet to report the status of a print job. * <P> * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose * constructors and mutating operations guarantee an additional invariant, * namely that all attribute values in the PrintJobAttributeSet must be * instances of interface {@link PrintJobAttribute PrintJobAttribute}. * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations * are respecified below to guarantee this additional invariant. * <P> * * @author Alan Kaminsky */ public interface PrintJobAttributeSet extends AttributeSet { /** {@collect.stats} * Adds the specified attribute value to this attribute set if it is not * already present, first removing any existing value in the same * attribute category as the specified attribute value (optional * operation). * * @param attribute Attribute value to be added to this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call, i.e., the given attribute value was not already a * member of this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not * support the <CODE>add()</CODE> operation. * @throws ClassCastException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is * not an instance of interface * {@link PrintJobAttribute PrintJobAttribute}. * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. */ public boolean add(Attribute attribute); /** {@collect.stats} * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the * {@link #add(Attribute) <CODE>add(Attribute)</CODE>} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, * the <tt>addAll()</tt> operation effectively modifies this attribute * set so that its value is the <i>union</i> of the two sets. * <P> * The behavior of the <CODE>addAll()</CODE> operation is unspecified if * the specified set is modified while the operation is in progress. * <P> * If the <CODE>addAll()</CODE> operation throws an exception, the effect * on this attribute set's state is implementation dependent; elements * from the specified set before the point of the exception may or * may not have been added to this attribute set. * * @param attributes whose elements are to be added to this attribute * set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call. * * @throws UnmodifiableSetException * (Unchecked exception) Thrown if this attribute set does not * support the <tt>addAll()</tt> method. * @throws ClassCastException * (Unchecked exception) Thrown if some element in the specified * set is not an instance of interface {@link PrintJobAttribute * PrintJobAttribute}. * @throws NullPointerException * (Unchecked exception) Thrown if the specified set is null. * * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); }
Java
/* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface PrintRequestAttribute is a tagging interface which a printing * attribute class implements to indicate the attribute denotes a * requested setting for a print job. * <p> * Attributes which are tagged with PrintRequestAttribute and are also tagged * as PrintJobAttribute, represent the subset of job attributes which * can be part of the specification of a job request. * <p> * If an attribute implements {@link DocAttribute DocAttribute} * as well as PrintRequestAttribute, the client may include the * attribute in a <code>Doc</code>}'s attribute set to specify * a job setting which pertains just to that doc. * <P> * * @see DocAttributeSet * @see PrintRequestAttributeSet * * @author Alan Kaminsky */ public interface PrintRequestAttribute extends Attribute { }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class Size2DSyntax is an abstract base class providing the common * implementation of all attributes denoting a size in two dimensions. * <P> * A two-dimensional size attribute's value consists of two items, the X * dimension and the Y dimension. A two-dimensional size attribute may be * constructed by supplying the two values and indicating the units in which the * values are measured. Methods are provided to return a two-dimensional size * attribute's values, indicating the units in which the values are to be * returned. The two most common size units are inches (in) and millimeters * (mm), and exported constants {@link #INCH <CODE>INCH</CODE>} and {@link #MM * <CODE>MM</CODE>} are provided for indicating those units. * <P> * Once constructed, a two-dimensional size attribute's value is immutable. * <P> * <B>Design</B> * <P> * A two-dimensional size attribute's X and Y dimension values are stored * internally as integers in units of micrometers (&#181;m), where 1 micrometer * = 10<SUP>-6</SUP> meter = 1/1000 millimeter = 1/25400 inch. This permits * dimensions to be represented exactly to a precision of 1/1000 mm (= 1 * &#181;m) or 1/100 inch (= 254 &#181;m). If fractional inches are expressed in * negative powers of two, this permits dimensions to be represented exactly to * a precision of 1/8 inch (= 3175 &#181;m) but not 1/16 inch (because 1/16 inch * does not equal an integral number of &#181;m). * <P> * Storing the dimensions internally in common units of &#181;m lets two size * attributes be compared without regard to the units in which they were * created; for example, 8.5 in will compare equal to 215.9 mm, as they both are * stored as 215900 &#181;m. For example, a lookup service can * match resolution attributes based on equality of their serialized * representations regardless of the units in which they were created. Using * integers for internal storage allows precise equality comparisons to be done, * which would not be guaranteed if an internal floating point representation * were used. Note that if you're looking for U.S. letter sized media in metric * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off * to an integral 216 x 279 mm will not match. * <P> * The exported constant {@link #INCH <CODE>INCH</CODE>} is actually the * conversion factor by which to multiply a value in inches to get the value in * &#181;m. Likewise, the exported constant {@link #MM <CODE>MM</CODE>} is the * conversion factor by which to multiply a value in mm to get the value in * &#181;m. A client can specify a resolution value in units other than inches * or mm by supplying its own conversion factor. However, since the internal * units of &#181;m was chosen with supporting only the external units of inch * and mm in mind, there is no guarantee that the conversion factor for the * client's units will be an exact integer. If the conversion factor isn't an * exact integer, resolution values in the client's units won't be stored * precisely. * <P> * * @author Alan Kaminsky */ public abstract class Size2DSyntax implements Serializable, Cloneable { private static final long serialVersionUID = 5584439964938660530L; /** {@collect.stats} * X dimension in units of micrometers (&#181;m). * @serial */ private int x; /** {@collect.stats} * Y dimension in units of micrometers (&#181;m). * @serial */ private int y; /** {@collect.stats} * Value to indicate units of inches (in). It is actually the conversion * factor by which to multiply inches to yield &#181;m (25400). */ public static final int INCH = 25400; /** {@collect.stats} * Value to indicate units of millimeters (mm). It is actually the * conversion factor by which to multiply mm to yield &#181;m (1000). */ public static final int MM = 1000; /** {@collect.stats} * Construct a new two-dimensional size attribute from the given * floating-point values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1. */ protected Size2DSyntax(float x, float y, int units) { if (x < 0.0f) { throw new IllegalArgumentException("x < 0"); } if (y < 0.0f) { throw new IllegalArgumentException("y < 0"); } if (units < 1) { throw new IllegalArgumentException("units < 1"); } this.x = (int) (x * units + 0.5f); this.y = (int) (y * units + 0.5f); } /** {@collect.stats} * Construct a new two-dimensional size attribute from the given integer * values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1. */ protected Size2DSyntax(int x, int y, int units) { if (x < 0) { throw new IllegalArgumentException("x < 0"); } if (y < 0) { throw new IllegalArgumentException("y < 0"); } if (units < 1) { throw new IllegalArgumentException("units < 1"); } this.x = x * units; this.y = y * units; } /** {@collect.stats} * Convert a value from micrometers to some other units. The result is * returned as a floating-point number. * * @param x * Value (micrometers) to convert. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return The value of <CODE>x</CODE> converted to the desired units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ private static float convertFromMicrometers(int x, int units) { if (units < 1) { throw new IllegalArgumentException("units is < 1"); } return ((float)x) / ((float)units); } /** {@collect.stats} * Get this two-dimensional size attribute's dimensions in the given units * as floating-point values. * * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return A two-element array with the X dimension at index 0 and the Y * dimension at index 1. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float[] getSize(int units) { return new float[] {getX(units), getY(units)}; } /** {@collect.stats} * Returns this two-dimensional size attribute's X dimension in the given * units as a floating-point value. * * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return X dimension. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getX(int units) { return convertFromMicrometers(x, units); } /** {@collect.stats} * Returns this two-dimensional size attribute's Y dimension in the given * units as a floating-point value. * * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return Y dimension. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getY(int units) { return convertFromMicrometers(y, units); } /** {@collect.stats} * Returns a string version of this two-dimensional size attribute in the * given units. The string takes the form <CODE>"<I>X</I>x<I>Y</I> * <I>U</I>"</CODE>, where <I>X</I> is the X dimension, <I>Y</I> is the Y * dimension, and <I>U</I> is the units name. The values are displayed in * floating point. * * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * @param unitsName * Units name string, e.g. <CODE>"in"</CODE> or <CODE>"mm"</CODE>. If * null, no units name is appended to the result. * * @return String version of this two-dimensional size attribute. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public String toString(int units, String unitsName) { StringBuffer result = new StringBuffer(); result.append(getX (units)); result.append('x'); result.append(getY (units)); if (unitsName != null) { result.append(' '); result.append(unitsName); } return result.toString(); } /** {@collect.stats} * Returns whether this two-dimensional size attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class Size2DSyntax. * <LI> * This attribute's X dimension is equal to <CODE>object</CODE>'s X * dimension. * <LI> * This attribute's Y dimension is equal to <CODE>object</CODE>'s Y * dimension. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this * two-dimensional size attribute, false otherwise. */ public boolean equals(Object object) { return(object != null && object instanceof Size2DSyntax && this.x == ((Size2DSyntax) object).x && this.y == ((Size2DSyntax) object).y); } /** {@collect.stats} * Returns a hash code value for this two-dimensional size attribute. */ public int hashCode() { return (((x & 0x0000FFFF) ) | ((y & 0x0000FFFF) << 16)); } /** {@collect.stats} * Returns a string version of this two-dimensional size attribute. The * string takes the form <CODE>"<I>X</I>x<I>Y</I> um"</CODE>, where * <I>X</I> is the X dimension and <I>Y</I> is the Y dimension. * The values are reported in the internal units of micrometers. */ public String toString() { StringBuffer result = new StringBuffer(); result.append(x); result.append('x'); result.append(y); result.append(" um"); return result.toString(); } /** {@collect.stats} * Returns this two-dimensional size attribute's X dimension in units of * micrometers (&#181;m). (For use in a subclass.) * * @return X dimension (&#181;m). */ protected int getXMicrometers(){ return x; } /** {@collect.stats} * Returns this two-dimensional size attribute's Y dimension in units of * micrometers (&#181;m). (For use in a subclass.) * * @return Y dimension (&#181;m). */ protected int getYMicrometers() { return y; } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface DocAttribute is a tagging interface which a printing attribute * class implements to indicate the attribute denotes a setting for a doc. * ("Doc" is a short, easy-to-pronounce term that means "a piece of print * data.") The client may include a DocAttribute in a <code>Doc</code>'s * attribute set to specify a characteristic of * that doc. If an attribute implements {@link PrintRequestAttribute * PrintRequestAttribute} as well as DocAttribute, the client may include the * attribute in a attribute set which specifies a print job * to specify a characteristic for all the docs in that job. * <P> * * @see DocAttributeSet * @see PrintRequestAttributeSet * * @author Alan Kaminsky */ public interface DocAttribute extends Attribute { }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface AttributeSet specifies the interface for a set of printing * attributes. A printing attribute is an object whose class implements * interface {@link Attribute Attribute}. * <P> * An attribute set contains a group of <I>attribute values,</I> * where duplicate values are not allowed in the set. * Furthermore, each value in an attribute set is * a member of some <I>category,</I> and at most one value in any particular * category is allowed in the set. For an attribute set, the values are {@link * Attribute Attribute} objects, and the categories are {@link java.lang.Class * Class} objects. An attribute's category is the class (or interface) at the * root of the class hierarchy for that kind of attribute. Note that an * attribute object's category may be a superclass of the attribute object's * class rather than the attribute object's class itself. An attribute * object's * category is determined by calling the {@link Attribute#getCategory() * <CODE>getCategory()</CODE>} method defined in interface {@link Attribute * Attribute}. * <P> * The interfaces of an AttributeSet resemble those of the Java Collections * API's java.util.Map interface, but is more restrictive in the types * it will accept, and combines keys and values into an Attribute. * <P> * Attribute sets are used in several places in the Print Service API. In * each context, only certain kinds of attributes are allowed to appear in the * attribute set, as determined by the tagging interfaces which the attribute * class implements -- {@link DocAttribute DocAttribute}, {@link * PrintRequestAttribute PrintRequestAttribute}, {@link PrintJobAttribute * PrintJobAttribute}, and {@link PrintServiceAttribute * PrintServiceAttribute}. * There are four specializations of an attribute set that are restricted to * contain just one of the four kinds of attribute -- {@link DocAttributeSet * DocAttributeSet}, {@link PrintRequestAttributeSet * PrintRequestAttributeSet}, * {@link PrintJobAttributeSet PrintJobAttributeSet}, and {@link * PrintServiceAttributeSet PrintServiceAttributeSet}, respectively. Note that * many attribute classes implement more than one tagging interface and so may * appear in more than one context. * <UL> * <LI> * A {@link DocAttributeSet DocAttributeSet}, containing {@link DocAttribute * DocAttribute}s, specifies the characteristics of an individual doc and the * print job settings to be applied to an individual doc. * <P> * <LI> * A {@link PrintRequestAttributeSet PrintRequestAttributeSet}, containing * {@link PrintRequestAttribute PrintRequestAttribute}s, specifies the * settings * to be applied to a whole print job and to all the docs in the print job. * <P> * <LI> * A {@link PrintJobAttributeSet PrintJobAttributeSet}, containing {@link * PrintJobAttribute PrintJobAttribute}s, reports the status of a print job. * <P> * <LI> * A {@link PrintServiceAttributeSet PrintServiceAttributeSet}, containing * {@link PrintServiceAttribute PrintServiceAttribute}s, reports the status of * a Print Service instance. * </UL> * <P> * In some contexts, the client is only allowed to examine an attribute set's * contents but not change them (the set is read-only). In other places, the * client is allowed both to examine and to change an attribute set's contents * (the set is read-write). For a read-only attribute set, calling a mutating * operation throws an UnmodifiableSetException. * <P> * The Print Service API provides one implementation of interface * AttributeSet, class {@link HashAttributeSet HashAttributeSet}. * A client can use class {@link * HashAttributeSet HashAttributeSet} or provide its own implementation of * interface AttributeSet. The Print Service API also provides * implementations of interface AttributeSet's subinterfaces -- classes {@link * HashDocAttributeSet HashDocAttributeSet}, * {@link HashPrintRequestAttributeSet * HashPrintRequestAttributeSet}, {@link HashPrintJobAttributeSet * HashPrintJobAttributeSet}, and {@link HashPrintServiceAttributeSet * HashPrintServiceAttributeSet}. * <P> * * @author Alan Kaminsky */ public interface AttributeSet { /** {@collect.stats} * Returns the attribute value which this attribute set contains in the * given attribute category. Returns <tt>null</tt> if this attribute set * does not contain any attribute value in the given attribute category. * * @param category Attribute category whose associated attribute value * is to be returned. It must be a * {@link java.lang.Class Class} * that implements interface {@link Attribute * Attribute}. * * @return The attribute value in the given attribute category contained * in this attribute set, or <tt>null</tt> if this attribute set * does not contain any attribute value in the given attribute * category. * * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>category</CODE> is null. * @throws ClassCastException * (unchecked exception) Thrown if the <CODE>category</CODE> is not a * {@link java.lang.Class Class} that implements interface {@link * Attribute Attribute}. */ public Attribute get(Class<?> category); /** {@collect.stats} * Adds the specified attribute to this attribute set if it is not * already present, first removing any existing value in the same * attribute category as the specified attribute value. * * @param attribute Attribute value to be added to this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute value was not already a member * of this attribute set. * * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>add()</CODE> operation. */ public boolean add(Attribute attribute); /** {@collect.stats} * Removes any attribute for this category from this attribute set if * present. If <CODE>category</CODE> is null, then * <CODE>remove()</CODE> does nothing and returns <tt>false</tt>. * * @param category Attribute category to be removed from this * attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute value had been a member of this * attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>remove()</CODE> operation. */ public boolean remove(Class<?> category); /** {@collect.stats} * Removes the specified attribute from this attribute set if * present. If <CODE>attribute</CODE> is null, then * <CODE>remove()</CODE> does nothing and returns <tt>false</tt>. * * @param attribute Attribute value to be removed from this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute value had been a member of this * attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>remove()</CODE> operation. */ public boolean remove(Attribute attribute); /** {@collect.stats} * Returns <tt>true</tt> if this attribute set contains an * attribute for the specified category. * * @param category whose presence in this attribute set is * to be tested. * * @return <tt>true</tt> if this attribute set contains an attribute * value for the specified category. */ public boolean containsKey(Class<?> category); /** {@collect.stats} * Returns <tt>true</tt> if this attribute set contains the given * attribute value. * * @param attribute Attribute value whose presence in this * attribute set is to be tested. * * @return <tt>true</tt> if this attribute set contains the given * attribute value. */ public boolean containsValue(Attribute attribute); /** {@collect.stats} * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the = * {@link #add(Attribute) <CODE>add(Attribute)</CODE>} * operation had been applied to this attribute set successively with each * element from the specified set. * The behavior of the <CODE>addAll(AttributeSet)</CODE> * operation is unspecified if the specified set is modified while * the operation is in progress. * <P> * If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception, * the effect on this attribute set's state is implementation dependent; * elements from the specified set before the point of the exception may * or may not have been added to this attribute set. * * @param attributes whose elements are to be added to this attribute * set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call. * * @throws UnmodifiableSetException * (Unchecked exception) Thrown if this attribute set does not support * the <tt>addAll(AttributeSet)</tt> method. * @throws NullPointerException * (Unchecked exception) Thrown if some element in the specified * set is null. * * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); /** {@collect.stats} * Returns the number of attributes in this attribute set. If this * attribute set contains more than <tt>Integer.MAX_VALUE</tt> elements, * returns <tt>Integer.MAX_VALUE</tt>. * * @return The number of attributes in this attribute set. */ public int size(); /** {@collect.stats} * Returns an array of the attributes contained in this set. * @return the Attributes contained in this set as an array, zero length * if the AttributeSet is empty. */ public Attribute[] toArray(); /** {@collect.stats} * Removes all attributes from this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>clear()</CODE> operation. */ public void clear(); /** {@collect.stats} * Returns true if this attribute set contains no attributes. * * @return true if this attribute set contains no attributes. */ public boolean isEmpty(); /** {@collect.stats} * Compares the specified object with this attribute set for equality. * Returns <tt>true</tt> if the given object is also an attribute set and * the two attribute sets contain the same attribute category-attribute * value mappings. This ensures that the * <tt>equals()</tt> method works properly across different * implementations of the AttributeSet interface. * * @param object to be compared for equality with this attribute set. * * @return <tt>true</tt> if the specified object is equal to this * attribute set. */ public boolean equals(Object object); /** {@collect.stats} * Returns the hash code value for this attribute set. The hash code of an * attribute set is defined to be the sum of the hash codes of each entry * in the AttributeSet. * This ensures that <tt>t1.equals(t2)</tt> implies that * <tt>t1.hashCode()==t2.hashCode()</tt> for any two attribute sets * <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of * {@link java.lang.Object#hashCode() <CODE>Object.hashCode()</CODE>}. * * @return The hash code value for this attribute set. */ public int hashCode(); }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class HashPrintJobAttributeSet provides an attribute set * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintJobAttributeSet PrintJobAttributeSet}. * <P> * * @author Alan Kaminsky */ public class HashPrintJobAttributeSet extends HashAttributeSet implements PrintJobAttributeSet, Serializable { private static final long serialVersionUID = -4204473656070350348L; /** {@collect.stats} * Construct a new, empty hash print job attribute set. */ public HashPrintJobAttributeSet() { super(PrintJobAttribute.class); } /** {@collect.stats} * Construct a new hash print job attribute set, * initially populated with the given value. * * @param attribute Attribute value to add to the set. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. */ public HashPrintJobAttributeSet(PrintJobAttribute attribute) { super(attribute, PrintJobAttribute.class); } /** {@collect.stats} * Construct a new hash print job attribute set, * initially populated with the values from the given array. * The new attribute set is populated * by adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. * If null, an empty attribute set is constructed. * * @exception NullPointerException (unchecked exception) * Thrown if any element of <CODE>attributes</CODE> is null. */ public HashPrintJobAttributeSet(PrintJobAttribute[] attributes) { super (attributes, PrintJobAttribute.class); } /** {@collect.stats} * Construct a new attribute set, initially populated with the * values from the given set where the members of the attribute set * are restricted to the <code>PrintJobAttribute</code> interface. * * @param attributes set of attribute values to initialise the set. If * null, an empty attribute set is constructed. * * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>PrintJobAttribute</CODE>. */ public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) { super(attributes, PrintJobAttribute.class); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; import java.util.Locale; /** {@collect.stats} * Class TextSyntax is an abstract base class providing the common * implementation of all attributes whose value is a string. The text attribute * includes a locale to indicate the natural language. Thus, a text attribute * always represents a localized string. Once constructed, a text attribute's * value is immutable. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public abstract class TextSyntax implements Serializable, Cloneable { private static final long serialVersionUID = -8130648736378144102L; /** {@collect.stats} * String value of this text attribute. * @serial */ private String value; /** {@collect.stats} * Locale of this text attribute. * @serial */ private Locale locale; /** {@collect.stats} * Constructs a TextAttribute with the specified string and locale. * * @param value Text string. * @param locale Natural language of the text string. null * is interpreted to mean the default locale for as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>value</CODE> is null. */ protected TextSyntax(String value, Locale locale) { this.value = verify (value); this.locale = verify (locale); } private static String verify(String value) { if (value == null) { throw new NullPointerException(" value is null"); } return value; } private static Locale verify(Locale locale) { if (locale == null) { return Locale.getDefault(); } return locale; } /** {@collect.stats} * Returns this text attribute's text string. * @return the text string. */ public String getValue() { return value; } /** {@collect.stats} * Returns this text attribute's text string's natural language (locale). * @return the locale */ public Locale getLocale() { return locale; } /** {@collect.stats} * Returns a hashcode for this text attribute. * * @return A hashcode value for this object. */ public int hashCode() { return value.hashCode() ^ locale.hashCode(); } /** {@collect.stats} * Returns whether this text attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class TextSyntax. * <LI> * This text attribute's underlying string and <CODE>object</CODE>'s * underlying string are equal. * <LI> * This text attribute's locale and <CODE>object</CODE>'s locale are * equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this text * attribute, false otherwise. */ public boolean equals(Object object) { return(object != null && object instanceof TextSyntax && this.value.equals (((TextSyntax) object).value) && this.locale.equals (((TextSyntax) object).locale)); } /** {@collect.stats} * Returns a String identifying this text attribute. The String is * the attribute's underlying text string. * * @return A String identifying this object. */ public String toString(){ return value; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.InvalidObjectException; import java.io.ObjectStreamException; import java.io.Serializable; /** {@collect.stats} * Class EnumSyntax is an abstract base class providing the common * implementation of all "type safe enumeration" objects. An enumeration class * (which extends class EnumSyntax) provides a group of enumeration values * (objects) that are singleton instances of the enumeration class; for example: * <PRE> * public class Bach extends EnumSyntax { * public static final Bach JOHANN_SEBASTIAN = new Bach(0); * public static final Bach WILHELM_FRIEDEMANN = new Bach(1); * public static final Bach CARL_PHILIP_EMMANUEL = new Bach(2); * public static final Bach JOHANN_CHRISTIAN = new Bach(3); * public static final Bach P_D_Q = new Bach(4); * * private static final String[] stringTable = { * "Johann Sebastian Bach", * "Wilhelm Friedemann Bach", * "Carl Philip Emmanuel Bach", * "Johann Christian Bach", * "P.D.Q. Bach" * }; * * protected String[] getStringTable() { * return stringTable; * } * * private static final Bach[] enumValueTable = { * JOHANN_SEBASTIAN, * WILHELM_FRIEDEMANN, * CARL_PHILIP_EMMANUEL, * JOHANN_CHRISTIAN, * P_D_Q * }; * * protected EnumSyntax[] getEnumValueTable() { * return enumValueTable; * } * } * </PRE> * You can then write code that uses the <CODE>==</CODE> and <CODE>!=</CODE> * operators to test enumeration values; for example: * <PRE> * Bach theComposer; * . . . * if (theComposer == Bach.JOHANN_SEBASTIAN) { * System.out.println ("The greatest composer of all time!"); * } * </PRE> * The <CODE>equals()</CODE> method for an enumeration class just does a test * for identical objects (<CODE>==</CODE>). * <P> * You can convert an enumeration value to a string by calling {@link * #toString() <CODE>toString()</CODE>}. The string is obtained from a table * supplied by the enumeration class. * <P> * Under the hood, an enumeration value is just an integer, a different integer * for each enumeration value within an enumeration class. You can get an * enumeration value's integer value by calling {@link #getValue() * <CODE>getValue()</CODE>}. An enumeration value's integer value is established * when it is constructed (see {@link #EnumSyntax(int) * <CODE>EnumSyntax(int)</CODE>}). Since the constructor is protected, the only * possible enumeration values are the singleton objects declared in the * enumeration class; additional enumeration values cannot be created at run * time. * <P> * You can define a subclass of an enumeration class that extends it with * additional enumeration values. The subclass's enumeration values' integer * values need not be distinct from the superclass's enumeration values' integer * values; the <CODE>==</CODE>, <CODE>!=</CODE>, <CODE>equals()</CODE>, and * <CODE>toString()</CODE> methods will still work properly even if the subclass * uses some of the same integer values as the superclass. However, the * application in which the enumeration class and subclass are used may need to * have distinct integer values in the superclass and subclass. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public abstract class EnumSyntax implements Serializable, Cloneable { private static final long serialVersionUID = -2739521845085831642L; /** {@collect.stats} * This enumeration value's integer value. * @serial */ private int value; /** {@collect.stats} * Construct a new enumeration value with the given integer value. * * @param value Integer value. */ protected EnumSyntax(int value) { this.value = value; } /** {@collect.stats} * Returns this enumeration value's integer value. * @return the value */ public int getValue() { return value; } /** {@collect.stats} * Returns a clone of this enumeration value, which to preserve the * semantics of enumeration values is the same object as this enumeration * value. */ public Object clone() { return this; } /** {@collect.stats} * Returns a hash code value for this enumeration value. The hash code is * just this enumeration value's integer value. */ public int hashCode() { return value; } /** {@collect.stats} * Returns a string value corresponding to this enumeration value. */ public String toString() { String[] theTable = getStringTable(); int theIndex = value - getOffset(); return theTable != null && theIndex >= 0 && theIndex < theTable.length ? theTable[theIndex] : Integer.toString (value); } /** {@collect.stats} * During object input, convert this deserialized enumeration instance to * the proper enumeration value defined in the enumeration attribute class. * * @return The enumeration singleton value stored at index * <I>i</I>-<I>L</I> in the enumeration value table returned by * {@link #getEnumValueTable() <CODE>getEnumValueTable()</CODE>}, * where <I>i</I> is this enumeration value's integer value and * <I>L</I> is the value returned by {@link #getOffset() * <CODE>getOffset()</CODE>}. * * @throws ObjectStreamException if the stream can't be deserialised * @throws InvalidObjectException * Thrown if the enumeration value table is null, this enumeration * value's integer value does not correspond to an element in the * enumeration value table, or the corresponding element in the * enumeration value table is null. (Note: {@link * java.io.InvalidObjectException InvalidObjectException} is a subclass * of {@link java.io.ObjectStreamException ObjectStreamException}, which * <CODE>readResolve()</CODE> is declared to throw.) */ protected Object readResolve() throws ObjectStreamException { EnumSyntax[] theTable = getEnumValueTable(); if (theTable == null) { throw new InvalidObjectException( "Null enumeration value table for class " + getClass()); } int theOffset = getOffset(); int theIndex = value - theOffset; if (0 > theIndex || theIndex >= theTable.length) { throw new InvalidObjectException ("Integer value = " + value + " not in valid range " + theOffset + ".." + (theOffset + theTable.length - 1) + "for class " + getClass()); } EnumSyntax result = theTable[theIndex]; if (result == null) { throw new InvalidObjectException ("No enumeration value for integer value = " + value + "for class " + getClass()); } return result; } // Hidden operations to be implemented in a subclass. /** {@collect.stats} * Returns the string table for this enumeration value's enumeration class. * The enumeration class's integer values are assumed to lie in the range * <I>L</I>..<I>L</I>+<I>N</I>-1, where <I>L</I> is the value returned by * {@link #getOffset() <CODE>getOffset()</CODE>} and <I>N</I> is the length * of the string table. The element in the string table at index * <I>i</I>-<I>L</I> is the value returned by {@link #toString() * <CODE>toString()</CODE>} for the enumeration value whose integer value * is <I>i</I>. If an integer within the above range is not used by any * enumeration value, leave the corresponding table element null. * <P> * The default implementation returns null. If the enumeration class (a * subclass of class EnumSyntax) does not override this method to return a * non-null string table, and the subclass does not override the {@link * #toString() <CODE>toString()</CODE>} method, the base class {@link * #toString() <CODE>toString()</CODE>} method will return just a string * representation of this enumeration value's integer value. * @return the string table */ protected String[] getStringTable() { return null; } /** {@collect.stats} * Returns the enumeration value table for this enumeration value's * enumeration class. The enumeration class's integer values are assumed to * lie in the range <I>L</I>..<I>L</I>+<I>N</I>-1, where <I>L</I> is the * value returned by {@link #getOffset() <CODE>getOffset()</CODE>} and * <I>N</I> is the length of the enumeration value table. The element in the * enumeration value table at index <I>i</I>-<I>L</I> is the enumeration * value object whose integer value is <I>i</I>; the {@link #readResolve() * <CODE>readResolve()</CODE>} method needs this to preserve singleton * semantics during deserialization of an enumeration instance. If an * integer within the above range is not used by any enumeration value, * leave the corresponding table element null. * <P> * The default implementation returns null. If the enumeration class (a * subclass of class EnumSyntax) does not override this method to return * a non-null enumeration value table, and the subclass does not override * the {@link #readResolve() <CODE>readResolve()</CODE>} method, the base * class {@link #readResolve() <CODE>readResolve()</CODE>} method will throw * an exception whenever an enumeration instance is deserialized from an * object input stream. * @return the value table */ protected EnumSyntax[] getEnumValueTable() { return null; } /** {@collect.stats} * Returns the lowest integer value used by this enumeration value's * enumeration class. * <P> * The default implementation returns 0. If the enumeration class (a * subclass of class EnumSyntax) uses integer values starting at other than * 0, override this method in the subclass. * @return the offset of the lowest enumeration value. */ protected int getOffset() { return 0; } }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; import java.util.Date; /** {@collect.stats} * Class DateTimeSyntax is an abstract base class providing the common * implementation of all attributes whose value is a date and time. * <P> * Under the hood, a date-time attribute is stored as a value of class <code> * java.util.Date</code>. You can get a date-time attribute's Date value by * calling {@link #getValue() <CODE>getValue()</CODE>}. A date-time attribute's * Date value is established when it is constructed (see {@link * #DateTimeSyntax(Date) <CODE>DateTimeSyntax(Date)</CODE>}). Once * constructed, a date-time attribute's value is immutable. * <P> * To construct a date-time attribute from separate values of the year, month, * day, hour, minute, and so on, use a <code>java.util.Calendar</code> * object to construct a <code>java.util.Date</code> object, then use the * <code>java.util.Date</code> object to construct the date-time attribute. * To convert * a date-time attribute to separate values of the year, month, day, hour, * minute, and so on, create a <code>java.util.Calendar</code> object and * set it to the <code>java.util.Date</code> from the date-time attribute. Class * DateTimeSyntax stores its value in the form of a <code>java.util.Date * </code> * rather than a <code>java.util.Calendar</code> because it typically takes * less memory to store and less time to compare a <code>java.util.Date</code> * than a <code>java.util.Calendar</code>. * <P> * * @author Alan Kaminsky */ public abstract class DateTimeSyntax implements Serializable, Cloneable { private static final long serialVersionUID = -1400819079791208582L; // Hidden data members. /** {@collect.stats} * This date-time attribute's<code>java.util.Date</code> value. * @serial */ private Date value; // Hidden constructors. /** {@collect.stats} * Construct a new date-time attribute with the given * <code>java.util.Date </code> value. * * @param value <code>java.util.Date</code> value. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>theValue</CODE> is null. */ protected DateTimeSyntax(Date value) { if (value == null) { throw new NullPointerException("value is null"); } this.value = value; } // Exported operations. /** {@collect.stats} * Returns this date-time attribute's <code>java.util.Date</code> * value. * @return the Date. */ public Date getValue() { return new Date (value.getTime()); } // Exported operations inherited and overridden from class Object. /** {@collect.stats} * Returns whether this date-time attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class DateTimeSyntax. * <LI> * This date-time attribute's <code>java.util.Date</code> value and * <CODE>object</CODE>'s <code>java.util.Date</code> value are * equal. </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this date-time * attribute, false otherwise. */ public boolean equals(Object object) { return (object != null && object instanceof DateTimeSyntax && value.equals(((DateTimeSyntax) object).value)); } /** {@collect.stats} * Returns a hash code value for this date-time attribute. The hashcode is * that of this attribute's <code>java.util.Date</code> value. */ public int hashCode() { return value.hashCode(); } /** {@collect.stats} * Returns a string value corresponding to this date-time attribute. * The string value is just this attribute's * <code>java.util.Date</code> value * converted to a string. */ public String toString() { return "" + value; } }
Java
/* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface DocAttributeSet specifies the interface for a set of doc * attributes, i.e. printing attributes that implement interface {@link * DocAttribute DocAttribute}. In the Print Service API, the client uses a * DocAttributeSet to specify the characteristics of an individual doc and * the print job settings to be applied to an individual doc. * <P> * A DocAttributeSet is just an {@link AttributeSet AttributeSet} whose * constructors and mutating operations guarantee an additional invariant, * namely that all attribute values in the DocAttributeSet must be instances * of interface {@link DocAttribute DocAttribute}. * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations * are respecified below to guarantee this additional invariant. * <P> * * @author Alan Kaminsky */ public interface DocAttributeSet extends AttributeSet { /** {@collect.stats} * Adds the specified attribute value to this attribute set if it is not * already present, first removing any existing value in the same * attribute category as the specified attribute value (optional * operation). * * @param attribute Attribute value to be added to this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call, i.e., the given attribute value was not already a * member of this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not * support the <CODE>add()</CODE> operation. * @throws ClassCastException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is * not an instance of interface * {@link DocAttribute DocAttribute}. * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. */ public boolean add(Attribute attribute); /** {@collect.stats} * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the * {@link #add(Attribute) <CODE>add(Attribute)</CODE>} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, * the <tt>addAll()</tt> operation effectively modifies this attribute * set so that its value is the <i>union</i> of the two sets. * <P> * The behavior of the <CODE>addAll()</CODE> operation is unspecified if * the specified set is modified while the operation is in progress. * <P> * If the <CODE>addAll()</CODE> operation throws an exception, the effect * on this attribute set's state is implementation dependent; elements * from the specified set before the point of the exception may or * may not have been added to this attribute set. * * @param attributes whose elements are to be added to this attribute * set. * * @return <tt>true</tt> if this attribute set changed as a result of * the call. * * @throws UnmodifiableSetException * (Unchecked exception) Thrown if this attribute set does not * support the <tt>addAll()</tt> method. * @throws ClassCastException * (Unchecked exception) Thrown if some element in the specified * set is not an instance of interface {@link DocAttribute * DocAttribute}. * @throws NullPointerException * (Unchecked exception) Thrown if the specified set is null. * * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class HashDocAttributeSet provides an attribute set which * inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface {@link * DocAttributeSet DocAttributeSet}. * <P> * * @author Alan Kaminsky */ public class HashDocAttributeSet extends HashAttributeSet implements DocAttributeSet, Serializable { private static final long serialVersionUID = -1128534486061432528L; /** {@collect.stats} * Construct a new, empty hash doc attribute set. */ public HashDocAttributeSet() { super (DocAttribute.class); } /** {@collect.stats} * Construct a new hash doc attribute set, * initially populated with the given value. * * @param attribute Attribute value to add to the set. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. */ public HashDocAttributeSet(DocAttribute attribute) { super (attribute, DocAttribute.class); } /** {@collect.stats} * Construct a new hash doc attribute set, * initially populated with the values from the given array. * The new attribute set is populated by * adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. * If null, an empty attribute set is constructed. * * @exception NullPointerException * (unchecked exception) * Thrown if any element of <CODE>attributes</CODE> is null. */ public HashDocAttributeSet(DocAttribute[] attributes) { super (attributes, DocAttribute.class); } /** {@collect.stats} * Construct a new attribute set, initially populated with the * values from the given set where the members of the attribute set * are restricted to the <code>DocAttribute</code> interface. * * @param attributes set of attribute values to initialise the set. If * null, an empty attribute set is constructed. * * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>DocAttribute</CODE>. */ public HashDocAttributeSet(DocAttributeSet attributes) { super(attributes, DocAttribute.class); } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface SupportedValuesAttribute is a tagging interface which a printing * attribute class implements to indicate the attribute describes the supported * values for another attribute. For example, if a Print Service instance * supports the {@link javax.print.attribute.standard.Copies Copies} * attribute, the Print Service instance will have a {@link * javax.print.attribute.standard.CopiesSupported CopiesSupported} attribute, * which is a SupportedValuesAttribute giving the legal values a client may * specify for the {@link javax.print.attribute.standard.Copies Copies} * attribute. * <P> * * @author Alan Kaminsky */ public interface SupportedValuesAttribute extends Attribute { }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; import java.net.URI; import java.net.URISyntaxException; /** {@collect.stats} * Class URISyntax is an abstract base class providing the common * implementation of all attributes whose value is a Uniform Resource * Identifier (URI). Once constructed, a URI attribute's value is immutable. * <P> * * @author Alan Kaminsky */ public abstract class URISyntax implements Serializable, Cloneable { private static final long serialVersionUID = -7842661210486401678L; /** {@collect.stats} * URI value of this URI attribute. * @serial */ private URI uri; /** {@collect.stats} * Constructs a URI attribute with the specified URI. * * @param uri URI. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>uri</CODE> is null. */ protected URISyntax(URI uri) { this.uri = verify (uri); } private static URI verify(URI uri) { if (uri == null) { throw new NullPointerException(" uri is null"); } return uri; } /** {@collect.stats} * Returns this URI attribute's URI value. * @return the URI. */ public URI getURI() { return uri; } /** {@collect.stats} * Returns a hashcode for this URI attribute. * * @return A hashcode value for this object. */ public int hashCode() { return uri.hashCode(); } /** {@collect.stats} * Returns whether this URI attribute is equivalent to the passed in * object. * To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class URISyntax. * <LI> * This URI attribute's underlying URI and <CODE>object</CODE>'s * underlying URI are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this URI * attribute, false otherwise. */ public boolean equals(Object object) { return(object != null && object instanceof URISyntax && this.uri.equals (((URISyntax) object).uri)); } /** {@collect.stats} * Returns a String identifying this URI attribute. The String is the * string representation of the attribute's underlying URI. * * @return A String identifying this object. */ public String toString() { return uri.toString(); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.HashMap; /** {@collect.stats} * Class HashAttributeSet provides an <code>AttributeSet</code> * implementation with characteristics of a hash map. * <P> * * @author Alan Kaminsky */ public class HashAttributeSet implements AttributeSet, Serializable { private static final long serialVersionUID = 5311560590283707917L; /** {@collect.stats} * The interface of which all members of this attribute set must be an * instance. It is assumed to be interface {@link Attribute Attribute} * or a subinterface thereof. * @serial */ private Class myInterface; /* * A HashMap used by the implementation. * The serialised form doesn't include this instance variable. */ private transient HashMap attrMap = new HashMap(); /** {@collect.stats} * Write the instance to a stream (ie serialize the object) * * @serialData * The serialized form of an attribute set explicitly writes the * number of attributes in the set, and each of the attributes. * This does not guarantee equality of serialized forms since * the order in which the attributes are written is not defined. */ private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); Attribute [] attrs = toArray(); s.writeInt(attrs.length); for (int i = 0; i < attrs.length; i++) { s.writeObject(attrs[i]); } } /** {@collect.stats} * Reconstitute an instance from a stream that is, deserialize it). */ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject(); attrMap = new HashMap(); int count = s.readInt(); Attribute attr; for (int i = 0; i < count; i++) { attr = (Attribute)s.readObject(); add(attr); } } /** {@collect.stats} * Construct a new, empty attribute set. */ public HashAttributeSet() { this(Attribute.class); } /** {@collect.stats} * Construct a new attribute set, * initially populated with the given attribute. * * @param attribute Attribute value to add to the set. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. */ public HashAttributeSet(Attribute attribute) { this (attribute, Attribute.class); } /** {@collect.stats} * Construct a new attribute set, * initially populated with the values from the * given array. The new attribute set is populated by * adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. * If null, an empty attribute set is constructed. * * @exception NullPointerException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is null. */ public HashAttributeSet(Attribute[] attributes) { this (attributes, Attribute.class); } /** {@collect.stats} * Construct a new attribute set, * initially populated with the values from the given set. * * @param attributes Set of attributes from which to initialise this set. * If null, an empty attribute set is constructed. * */ public HashAttributeSet(AttributeSet attributes) { this (attributes, Attribute.class); } /** {@collect.stats} * Construct a new, empty attribute set, where the members of * the attribute set are restricted to the given interface. * * @param interfaceName The interface of which all members of this * attribute set must be an instance. It is assumed to * be interface {@link Attribute Attribute} or a * subinterface thereof. * @exception NullPointerException if interfaceName is null. */ protected HashAttributeSet(Class<?> interfaceName) { if (interfaceName == null) { throw new NullPointerException("null interface"); } myInterface = interfaceName; } /** {@collect.stats} * Construct a new attribute set, initially populated with the given * attribute, where the members of the attribute set are restricted to the * given interface. * * @param attribute Attribute value to add to the set. * @param interfaceName The interface of which all members of this * attribute set must be an instance. It is assumed to * be interface {@link Attribute Attribute} or a * subinterface thereof. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. * @exception NullPointerException if interfaceName is null. * @exception ClassCastException * (unchecked exception) Thrown if <CODE>attribute</CODE> is not an * instance of <CODE>interfaceName</CODE>. */ protected HashAttributeSet(Attribute attribute, Class<?> interfaceName) { if (interfaceName == null) { throw new NullPointerException("null interface"); } myInterface = interfaceName; add (attribute); } /** {@collect.stats} * Construct a new attribute set, where the members of the attribute * set are restricted to the given interface. * The new attribute set is populated * by adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. If * null, an empty attribute set is constructed. * @param interfaceName The interface of which all members of this * attribute set must be an instance. It is assumed to * be interface {@link Attribute Attribute} or a * subinterface thereof. * * @exception NullPointerException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is null. * @exception NullPointerException if interfaceName is null. * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>interfaceName</CODE>. */ protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName) { if (interfaceName == null) { throw new NullPointerException("null interface"); } myInterface = interfaceName; int n = attributes == null ? 0 : attributes.length; for (int i = 0; i < n; ++ i) { add (attributes[i]); } } /** {@collect.stats} * Construct a new attribute set, initially populated with the * values from the given set where the members of the attribute * set are restricted to the given interface. * * @param attributes set of attribute values to initialise the set. If * null, an empty attribute set is constructed. * @param interfaceName The interface of which all members of this * attribute set must be an instance. It is assumed to * be interface {@link Attribute Attribute} or a * subinterface thereof. * * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>interfaceName</CODE>. */ protected HashAttributeSet(AttributeSet attributes, Class<?> interfaceName) { myInterface = interfaceName; if (attributes != null) { Attribute[] attribArray = attributes.toArray(); int n = attribArray == null ? 0 : attribArray.length; for (int i = 0; i < n; ++ i) { add (attribArray[i]); } } } /** {@collect.stats} * Returns the attribute value which this attribute set contains in the * given attribute category. Returns <tt>null</tt> if this attribute set * does not contain any attribute value in the given attribute category. * * @param category Attribute category whose associated attribute value * is to be returned. It must be a * {@link java.lang.Class Class} * that implements interface {@link Attribute * Attribute}. * * @return The attribute value in the given attribute category contained * in this attribute set, or <tt>null</tt> if this attribute set * does not contain any attribute value in the given attribute * category. * * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>category</CODE> is null. * @throws ClassCastException * (unchecked exception) Thrown if the <CODE>category</CODE> is not a * {@link java.lang.Class Class} that implements interface {@link * Attribute Attribute}. */ public Attribute get(Class<?> category) { return (Attribute) attrMap.get(AttributeSetUtilities. verifyAttributeCategory(category, Attribute.class)); } /** {@collect.stats} * Adds the specified attribute to this attribute set if it is not * already present, first removing any existing in the same * attribute category as the specified attribute value. * * @param attribute Attribute value to be added to this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute value was not already a * member of this attribute set. * * @throws NullPointerException * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>add()</CODE> operation. */ public boolean add(Attribute attribute) { Object oldAttribute = attrMap.put(attribute.getCategory(), AttributeSetUtilities. verifyAttributeValue(attribute, myInterface)); return (!attribute.equals(oldAttribute)); } /** {@collect.stats} * Removes any attribute for this category from this attribute set if * present. If <CODE>category</CODE> is null, then * <CODE>remove()</CODE> does nothing and returns <tt>false</tt>. * * @param category Attribute category to be removed from this * attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute category had been a member of * this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not * support the <CODE>remove()</CODE> operation. */ public boolean remove(Class<?> category) { return category != null && AttributeSetUtilities. verifyAttributeCategory(category, Attribute.class) != null && attrMap.remove(category) != null; } /** {@collect.stats} * Removes the specified attribute from this attribute set if * present. If <CODE>attribute</CODE> is null, then * <CODE>remove()</CODE> does nothing and returns <tt>false</tt>. * * @param attribute Attribute value to be removed from this attribute set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call, i.e., the given attribute value had been a member of * this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not * support the <CODE>remove()</CODE> operation. */ public boolean remove(Attribute attribute) { return attribute != null && attrMap.remove(attribute.getCategory()) != null; } /** {@collect.stats} * Returns <tt>true</tt> if this attribute set contains an * attribute for the specified category. * * @param category whose presence in this attribute set is * to be tested. * * @return <tt>true</tt> if this attribute set contains an attribute * value for the specified category. */ public boolean containsKey(Class<?> category) { return category != null && AttributeSetUtilities. verifyAttributeCategory(category, Attribute.class) != null && attrMap.get(category) != null; } /** {@collect.stats} * Returns <tt>true</tt> if this attribute set contains the given * attribute. * * @param attribute value whose presence in this attribute set is * to be tested. * * @return <tt>true</tt> if this attribute set contains the given * attribute value. */ public boolean containsValue(Attribute attribute) { return attribute != null && attribute instanceof Attribute && attribute.equals(attrMap.get(((Attribute)attribute).getCategory())); } /** {@collect.stats} * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the * {@link #add(Attribute) <CODE>add(Attribute)</CODE>} * operation had been applied to this attribute set successively with * each element from the specified set. * The behavior of the <CODE>addAll(AttributeSet)</CODE> * operation is unspecified if the specified set is modified while * the operation is in progress. * <P> * If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception, * the effect on this attribute set's state is implementation dependent; * elements from the specified set before the point of the exception may * or may not have been added to this attribute set. * * @param attributes whose elements are to be added to this attribute * set. * * @return <tt>true</tt> if this attribute set changed as a result of the * call. * * @throws UnmodifiableSetException * (Unchecked exception) Thrown if this attribute set does not * support the <tt>addAll(AttributeSet)</tt> method. * @throws NullPointerException * (Unchecked exception) Thrown if some element in the specified * set is null, or the set is null. * * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes) { Attribute []attrs = attributes.toArray(); boolean result = false; for (int i=0; i<attrs.length; i++) { Attribute newValue = AttributeSetUtilities.verifyAttributeValue(attrs[i], myInterface); Object oldValue = attrMap.put(newValue.getCategory(), newValue); result = (! newValue.equals(oldValue)) || result; } return result; } /** {@collect.stats} * Returns the number of attributes in this attribute set. If this * attribute set contains more than <tt>Integer.MAX_VALUE</tt> elements, * returns <tt>Integer.MAX_VALUE</tt>. * * @return The number of attributes in this attribute set. */ public int size() { return attrMap.size(); } /** {@collect.stats} * * @return the Attributes contained in this set as an array, zero length * if the AttributeSet is empty. */ public Attribute[] toArray() { Attribute []attrs = new Attribute[size()]; attrMap.values().toArray(attrs); return attrs; } /** {@collect.stats} * Removes all attributes from this attribute set. * * @throws UnmodifiableSetException * (unchecked exception) Thrown if this attribute set does not support * the <CODE>clear()</CODE> operation. */ public void clear() { attrMap.clear(); } /** {@collect.stats} * Returns true if this attribute set contains no attributes. * * @return true if this attribute set contains no attributes. */ public boolean isEmpty() { return attrMap.isEmpty(); } /** {@collect.stats} * Compares the specified object with this attribute set for equality. * Returns <tt>true</tt> if the given object is also an attribute set and * the two attribute sets contain the same attribute category-attribute * value mappings. This ensures that the * <tt>equals()</tt> method works properly across different * implementations of the AttributeSet interface. * * @param object to be compared for equality with this attribute set. * * @return <tt>true</tt> if the specified object is equal to this * attribute set. */ public boolean equals(Object object) { if (object == null || !(object instanceof AttributeSet)) { return false; } AttributeSet aset = (AttributeSet)object; if (aset.size() != size()) { return false; } Attribute[] attrs = toArray(); for (int i=0;i<attrs.length; i++) { if (!aset.containsValue(attrs[i])) { return false; } } return true; } /** {@collect.stats} * Returns the hash code value for this attribute set. * The hash code of an attribute set is defined to be the sum * of the hash codes of each entry in the AttributeSet. * This ensures that <tt>t1.equals(t2)</tt> implies that * <tt>t1.hashCode()==t2.hashCode()</tt> for any two attribute sets * <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of * {@link java.lang.Object#hashCode() <CODE>Object.hashCode()</CODE>}. * * @return The hash code value for this attribute set. */ public int hashCode() { int hcode = 0; Attribute[] attrs = toArray(); for (int i=0;i<attrs.length; i++) { hcode += attrs[i].hashCode(); } return hcode; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class ResolutionSyntax is an abstract base class providing the common * implementation of all attributes denoting a printer resolution. * <P> * A resolution attribute's value consists of two items, the cross feed * direction resolution and the feed direction resolution. A resolution * attribute may be constructed by supplying the two values and indicating the * units in which the values are measured. Methods are provided to return a * resolution attribute's values, indicating the units in which the values are * to be returned. The two most common resolution units are dots per inch (dpi) * and dots per centimeter (dpcm), and exported constants {@link #DPI * <CODE>DPI</CODE>} and {@link #DPCM <CODE>DPCM</CODE>} are provided for * indicating those units. * <P> * Once constructed, a resolution attribute's value is immutable. * <P> * <B>Design</B> * <P> * A resolution attribute's cross feed direction resolution and feed direction * resolution values are stored internally using units of dots per 100 inches * (dphi). Storing the values in dphi rather than, say, metric units allows * precise integer arithmetic conversions between dpi and dphi and between dpcm * and dphi: 1 dpi = 100 dphi, 1 dpcm = 254 dphi. Thus, the values can be stored * into and retrieved back from a resolution attribute in either units with no * loss of precision. This would not be guaranteed if a floating point * representation were used. However, roundoff error will in general occur if a * resolution attribute's values are created in one units and retrieved in * different units; for example, 600 dpi will be rounded to 236 dpcm, whereas * the true value (to five figures) is 236.22 dpcm. * <P> * Storing the values internally in common units of dphi lets two resolution * attributes be compared without regard to the units in which they were * created; for example, 300 dpcm will compare equal to 762 dpi, as they both * are stored as 76200 dphi. In particular, a lookup service can * match resolution attributes based on equality of their serialized * representations regardless of the units in which they were created. Again, * using integers for internal storage allows precise equality comparisons to be * done, which would not be guaranteed if a floating point representation were * used. * <P> * The exported constant {@link #DPI <CODE>DPI</CODE>} is actually the * conversion factor by which to multiply a value in dpi to get the value in * dphi. Likewise, the exported constant {@link #DPCM <CODE>DPCM</CODE>} is the * conversion factor by which to multiply a value in dpcm to get the value in * dphi. A client can specify a resolution value in units other than dpi or dpcm * by supplying its own conversion factor. However, since the internal units of * dphi was chosen with supporting only the external units of dpi and dpcm in * mind, there is no guarantee that the conversion factor for the client's units * will be an exact integer. If the conversion factor isn't an exact integer, * resolution values in the client's units won't be stored precisely. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public abstract class ResolutionSyntax implements Serializable, Cloneable { private static final long serialVersionUID = 2706743076526672017L; /** {@collect.stats} * Cross feed direction resolution in units of dots per 100 inches (dphi). * @serial */ private int crossFeedResolution; /** {@collect.stats} * Feed direction resolution in units of dots per 100 inches (dphi). * @serial */ private int feedResolution; /** {@collect.stats} * Value to indicate units of dots per inch (dpi). It is actually the * conversion factor by which to multiply dpi to yield dphi (100). */ public static final int DPI = 100; /** {@collect.stats} * Value to indicate units of dots per centimeter (dpcm). It is actually * the conversion factor by which to multiply dpcm to yield dphi (254). */ public static final int DPCM = 254; /** {@collect.stats} * Construct a new resolution attribute from the given items. * * @param crossFeedResolution * Cross feed direction resolution. * @param feedResolution * Feed direction resolution. * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or * {@link #DPCM <CODE>DPCM</CODE>}. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>crossFeedResolution</CODE> < * 1 or <CODE>feedResolution</CODE> < 1 or <CODE>units</CODE> < 1. */ public ResolutionSyntax(int crossFeedResolution, int feedResolution, int units) { if (crossFeedResolution < 1) { throw new IllegalArgumentException("crossFeedResolution is < 1"); } if (feedResolution < 1) { throw new IllegalArgumentException("feedResolution is < 1"); } if (units < 1) { throw new IllegalArgumentException("units is < 1"); } this.crossFeedResolution = crossFeedResolution * units; this.feedResolution = feedResolution * units; } /** {@collect.stats} * Convert a value from dphi to some other units. The result is rounded to * the nearest integer. * * @param dphi * Value (dphi) to convert. * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or * {@link #DPCM <CODE>DPCM</CODE>}. * * @return The value of <CODE>dphi</CODE> converted to the desired units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ private static int convertFromDphi(int dphi, int units) { if (units < 1) { throw new IllegalArgumentException(": units is < 1"); } int round = units / 2; return (dphi + round) / units; } /** {@collect.stats} * Get this resolution attribute's resolution values in the given units. * The values are rounded to the nearest integer. * * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or * {@link #DPCM <CODE>DPCM</CODE>}. * * @return A two-element array with the cross feed direction resolution * at index 0 and the feed direction resolution at index 1. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public int[] getResolution(int units) { return new int[] { getCrossFeedResolution(units), getFeedResolution(units) }; } /** {@collect.stats} * Returns this resolution attribute's cross feed direction resolution in * the given units. The value is rounded to the nearest integer. * * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or * {@link #DPCM <CODE>DPCM</CODE>}. * * @return Cross feed direction resolution. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public int getCrossFeedResolution(int units) { return convertFromDphi (crossFeedResolution, units); } /** {@collect.stats} * Returns this resolution attribute's feed direction resolution in the * given units. The value is rounded to the nearest integer. * * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or {@link * #DPCM <CODE>DPCM</CODE>}. * * @return Feed direction resolution. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public int getFeedResolution(int units) { return convertFromDphi (feedResolution, units); } /** {@collect.stats} * Returns a string version of this resolution attribute in the given units. * The string takes the form <CODE>"<I>C</I>x<I>F</I> <I>U</I>"</CODE>, * where <I>C</I> is the cross feed direction resolution, <I>F</I> is the * feed direction resolution, and <I>U</I> is the units name. The values are * rounded to the nearest integer. * * @param units * Unit conversion factor, e.g. {@link #DPI <CODE>DPI</CODE>} or {@link * #DPCM <CODE>DPCM</CODE>}. * @param unitsName * Units name string, e.g. <CODE>"dpi"</CODE> or <CODE>"dpcm"</CODE>. If * null, no units name is appended to the result. * * @return String version of this resolution attribute. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public String toString(int units, String unitsName) { StringBuffer result = new StringBuffer(); result.append(getCrossFeedResolution (units)); result.append('x'); result.append(getFeedResolution (units)); if (unitsName != null) { result.append (' '); result.append (unitsName); } return result.toString(); } /** {@collect.stats} * Determine whether this resolution attribute's value is less than or * equal to the given resolution attribute's value. This is true if all * of the following conditions are true: * <UL> * <LI> * This attribute's cross feed direction resolution is less than or equal to * the <CODE>other</CODE> attribute's cross feed direction resolution. * <LI> * This attribute's feed direction resolution is less than or equal to the * <CODE>other</CODE> attribute's feed direction resolution. * </UL> * * @param other Resolution attribute to compare with. * * @return True if this resolution attribute is less than or equal to the * <CODE>other</CODE> resolution attribute, false otherwise. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>other</CODE> is null. */ public boolean lessThanOrEquals(ResolutionSyntax other) { return (this.crossFeedResolution <= other.crossFeedResolution && this.feedResolution <= other.feedResolution); } /** {@collect.stats} * Returns whether this resolution attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class ResolutionSyntax. * <LI> * This attribute's cross feed direction resolution is equal to * <CODE>object</CODE>'s cross feed direction resolution. * <LI> * This attribute's feed direction resolution is equal to * <CODE>object</CODE>'s feed direction resolution. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this resolution * attribute, false otherwise. */ public boolean equals(Object object) { return(object != null && object instanceof ResolutionSyntax && this.crossFeedResolution == ((ResolutionSyntax) object).crossFeedResolution && this.feedResolution == ((ResolutionSyntax) object).feedResolution); } /** {@collect.stats} * Returns a hash code value for this resolution attribute. */ public int hashCode() { return(((crossFeedResolution & 0x0000FFFF)) | ((feedResolution & 0x0000FFFF) << 16)); } /** {@collect.stats} * Returns a string version of this resolution attribute. The string takes * the form <CODE>"<I>C</I>x<I>F</I> dphi"</CODE>, where <I>C</I> is the * cross feed direction resolution and <I>F</I> is the feed direction * resolution. The values are reported in the internal units of dphi. */ public String toString() { StringBuffer result = new StringBuffer(); result.append(crossFeedResolution); result.append('x'); result.append(feedResolution); result.append(" dphi"); return result.toString(); } /** {@collect.stats} * Returns this resolution attribute's cross feed direction resolution in * units of dphi. (For use in a subclass.) * * @return Cross feed direction resolution. */ protected int getCrossFeedResolutionDphi() { return crossFeedResolution; } /** {@collect.stats} * Returns this resolution attribute's feed direction resolution in units * of dphi. (For use in a subclass.) * * @return Feed direction resolution. */ protected int getFeedResolutionDphi() { return feedResolution; } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * PrintJobAttribute is a tagging interface which a printing attribute * class implements to indicate the attribute describes the status of a Print * Job or some other characteristic of a Print Job. A Print Service * instance adds a number of PrintJobAttributes to a Print Job's attribute set * to report the Print Job's status. If an attribute implements {@link * PrintRequestAttribute PrintRequestAttribute} as well as PrintJobAttribute, * the client may include the attribute in a attribute set to * specify the attribute's value for the Print Job. * <P> * * @see PrintRequestAttributeSet * @see PrintJobAttributeSet * * @author Alan Kaminsky */ public interface PrintJobAttribute extends Attribute { }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobMediaSheetsCompleted is an integer valued printing attribute class * that specifies the number of media sheets which have completed marking and * stacking for the entire job so far, whether those sheets have been processed * on one side or on both. * <P> * The JobMediaSheetsCompleted attribute describes the progress of the job. This * attribute is intended to be a counter. That is, the JobMediaSheetsCompleted * value for a job that has not started processing must be 0. When the job's * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the * JobMediaSheetsCompleted value is intended to increase as the job is * processed; it indicates the amount of the job that has been processed at the * time the Print Job's attribute set is queried or at the time a print job * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED * states, the JobMediaSheetsCompleted value is the final value for the job. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobMediaSheets * @see JobMediaSheetsSupported * @see JobKOctetsProcessed * @see JobImpressionsCompleted * * @author Alan Kaminsky */ public final class JobMediaSheetsCompleted extends IntegerSyntax implements PrintJobAttribute { private static final long serialVersionUID = 1739595973810840475L; /** {@collect.stats} * Construct a new job media sheets completed attribute with the given * integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobMediaSheetsCompleted(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job media sheets completed attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobMediaSheetsCompleted. * <LI> * This job media sheets completed attribute's value and * <CODE>object</CODE>'s value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job media * sheets completed attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobMediaSheetsCompleted); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobMediaSheetsCompleted, the category is class * JobMediaSheetsCompleted itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobMediaSheetsCompleted.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobMediaSheetsCompleted, the category name is * <CODE>"job-media-sheets-completed"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-media-sheets-completed"; } }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; /** {@collect.stats} * Class MediaTray is a subclass of Media. * Class MediaTray is a printing attribute class, an enumeration, that * specifies the media tray or bin for the job. * This attribute can be used instead of specifying MediaSize or MediaName. * <p> * Class MediaTray declares keywords for standard media kind values. * Implementation- or site-defined names for a media kind attribute may also * be created by defining a subclass of class MediaTray. * <P> * <B>IPP Compatibility:</B> MediaTray is a representation class for * values of the IPP "media" attribute which name paper trays. * <P> * */ public class MediaTray extends Media implements Attribute { private static final long serialVersionUID = -982503611095214703L; /** {@collect.stats} * The top input tray in the printer. */ public static final MediaTray TOP = new MediaTray(0); /** {@collect.stats} * The middle input tray in the printe. */ public static final MediaTray MIDDLE = new MediaTray(1); /** {@collect.stats} * The bottom input tray in the printer. */ public static final MediaTray BOTTOM = new MediaTray(2); /** {@collect.stats} * The envelope input tray in the printer. */ public static final MediaTray ENVELOPE = new MediaTray(3); /** {@collect.stats} * The manual feed input tray in the printer. */ public static final MediaTray MANUAL = new MediaTray(4); /** {@collect.stats} * The large capacity input tray in the printer. */ public static final MediaTray LARGE_CAPACITY = new MediaTray(5); /** {@collect.stats} * The main input tray in the printer. */ public static final MediaTray MAIN = new MediaTray(6); /** {@collect.stats} * The side input tray. */ public static final MediaTray SIDE = new MediaTray(7); /** {@collect.stats} * Construct a new media tray enumeration value with the given integer * value. * * @param value Integer value. */ protected MediaTray(int value) { super (value); } private static final String[] myStringTable ={ "top", "middle", "bottom", "envelope", "manual", "large-capacity", "main", "side" }; private static final MediaTray[] myEnumValueTable = { TOP, MIDDLE, BOTTOM, ENVELOPE, MANUAL, LARGE_CAPACITY, MAIN, SIDE }; /** {@collect.stats} * Returns the string table for class MediaTray. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class MediaTray. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PagesPerMinute is an integer valued printing attribute that indicates * the nominal number of pages per minute to the nearest whole number which may * be generated by this printer (e.g., simplex, black-and-white). This attribute * is informative, not a service guarantee. Generally, it is the value used in * the marketing literature to describe the device. A value of 0 indicates a * device that takes more than two minutes to process a page. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class PagesPerMinute extends IntegerSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -6366403993072862015L; /** {@collect.stats} * Construct a new pages per minute attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public PagesPerMinute(int value) { super(value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this pages per minute attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PagesPerMinute. * <LI> * This pages per minute attribute's value and <CODE>object</CODE>'s * value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this pages per * minute attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof PagesPerMinute); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PagesPerMinute, the category is class PagesPerMinute itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PagesPerMinute.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PagesPerMinute, the * category name is <CODE>"pages-per-minute"</CODE>. * * @return Attribute category name. */ public final String getName() { return "pages-per-minute"; } }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Collection; import java.util.HashSet; import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobStateReasons is a printing attribute class, a set of enumeration * values, that provides additional information about the job's current state, * i.e., information that augments the value of the job's {@link JobState * JobState} attribute. * <P> * Instances of {@link JobStateReason JobStateReason} do not appear in a Print * Job's attribute set directly. Rather, a JobStateReasons attribute appears in * the Print Job's attribute set. The JobStateReasons attribute contains zero, * one, or more than one {@link JobStateReason JobStateReason} objects which * pertain to the Print Job's status. The printer adds a {@link JobStateReason * JobStateReason} object to the Print Job's JobStateReasons attribute when the * corresponding condition becomes true of the Print Job, and the printer * removes the {@link JobStateReason JobStateReason} object again when the * corresponding condition becomes false, regardless of whether the Print Job's * overall {@link JobState JobState} also changed. * <P> * Class JobStateReasons inherits its implementation from class {@link * java.util.HashSet java.util.HashSet}. Unlike most printing attributes which * are immutable once constructed, class JobStateReasons is designed to be * mutable; you can add {@link JobStateReason JobStateReason} objects to an * existing JobStateReasons object and remove them again. However, like class * {@link java.util.HashSet java.util.HashSet}, class JobStateReasons is not * multiple thread safe. If a JobStateReasons object will be used by multiple * threads, be sure to synchronize its operations (e.g., using a synchronized * set view obtained from class {@link java.util.Collections * java.util.Collections}). * <P> * <B>IPP Compatibility:</B> The string value returned by each individual {@link * JobStateReason JobStateReason} object's <CODE>toString()</CODE> method gives * the IPP keyword value. The category name returned by <CODE>getName()</CODE> * gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobStateReasons extends HashSet<JobStateReason> implements PrintJobAttribute { private static final long serialVersionUID = 8849088261264331812L; /** {@collect.stats} * Construct a new, empty job state reasons attribute; the underlying hash * set has the default initial capacity and load factor. */ public JobStateReasons() { super(); } /** {@collect.stats} * Construct a new, empty job state reasons attribute; the underlying hash * set has the given initial capacity and the default load factor. * * @param initialCapacity Initial capacity. * @throws IllegalArgumentException if the initial capacity is less * than zero. */ public JobStateReasons(int initialCapacity) { super (initialCapacity); } /** {@collect.stats} * Construct a new, empty job state reasons attribute; the underlying hash * set has the given initial capacity and load factor. * * @param initialCapacity Initial capacity. * @param loadFactor Load factor. * @throws IllegalArgumentException if the initial capacity is less * than zero. */ public JobStateReasons(int initialCapacity, float loadFactor) { super (initialCapacity, loadFactor); } /** {@collect.stats} * Construct a new job state reasons attribute that contains the same * {@link JobStateReason JobStateReason} objects as the given collection. * The underlying hash set's initial capacity and load factor are as * specified in the superclass constructor {@link * java.util.HashSet#HashSet(java.util.Collection) * <CODE>HashSet(Collection)</CODE>}. * * @param collection Collection to copy. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>collection</CODE> is null or * if any element in <CODE>collection</CODE> is null. * @throws ClassCastException * (unchecked exception) Thrown if any element in * <CODE>collection</CODE> is not an instance of class {@link * JobStateReason JobStateReason}. */ public JobStateReasons(Collection<JobStateReason> collection) { super (collection); } /** {@collect.stats} * Adds the specified element to this job state reasons attribute if it is * not already present. The element to be added must be an instance of class * {@link JobStateReason JobStateReason}. If this job state reasons * attribute already contains the specified element, the call leaves this * job state reasons attribute unchanged and returns <tt>false</tt>. * * @param o Element to be added to this job state reasons attribute. * * @return <tt>true</tt> if this job state reasons attribute did not * already contain the specified element. * * @throws NullPointerException * (unchecked exception) Thrown if the specified element is null. * @throws ClassCastException * (unchecked exception) Thrown if the specified element is not an * instance of class {@link JobStateReason JobStateReason}. * @since 1.5 */ public boolean add(JobStateReason o) { if (o == null) { throw new NullPointerException(); } return super.add ((JobStateReason) o); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobStateReasons, the category is class JobStateReasons itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobStateReasons.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobStateReasons, the category * name is <CODE>"job-state-reasons"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-state-reasons"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Media is a printing attribute class that specifies the * medium on which to print. * <p> * Media may be specified in different ways. * <ul> * <li> it may be specified by paper source - eg paper tray * <li> it may be specified by a standard size - eg "A4" * <li> it may be specified by a name - eg "letterhead" * </ul> * Each of these corresponds to the IPP "media" attribute. * The current API does not support describing media by characteristics * (eg colour, opacity). * This may be supported in a later revision of the specification. * <p> * A Media object is constructed with a value which represents * one of the ways in which the Media attribute can be specified. * <p> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Phil Race */ public abstract class Media extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -2823970704630722439L; /** {@collect.stats} * Constructs a new media attribute specified by name. * * @param value a value */ protected Media(int value) { super (value); } /** {@collect.stats} * Returns whether this media attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is of the same subclass of Media as this object. * <LI> * The values are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this media * attribute, false otherwise. */ public boolean equals(Object object) { return(object != null && object instanceof Media && object.getClass() == this.getClass() && ((Media)object).getValue() == this.getValue()); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Media and any vendor-defined subclasses, the category is * class Media itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Media.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Media and any vendor-defined subclasses, the category name is * <CODE>"media"</CODE>. * * @return Attribute category name. */ public final String getName() { return "media"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class MultipleDocumentHandling is a printing attribute class, an enumeration, * that controls finishing operations and the placement of one or more * print-stream pages into impressions and onto media sheets. When the value of * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also * controls the order in which the copies that result from processing the * documents are produced. This attribute is relevant only for a multidoc print * job consisting of two or more individual docs. * <P> * Briefly, MultipleDocumentHandling determines the relationship between the * multiple input (electronic) documents fed into a multidoc print job and the * output (physical) document or documents produced by the multidoc print job. * There are two possibilities: * <UL> * <LI> * The multiple input documents are combined into a single output document. * Finishing operations ({@link Finishings Finishings}), * are performed on this single output * document. The {@link Copies Copies} attribute tells how many copies of this * single output document to produce. The MultipleDocumentHandling values * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of * this possibility. * <P> * <LI> * The multiple input documents remain separate output documents. Finishing * operations ({@link Finishings Finishings}), * are performed on each output document * separately. The {@link Copies Copies} attribute tells how many copies of each * separate output document to produce. The MultipleDocumentHandling values * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES * specify two variations of this possibility. * </UL> * <P> * In the detailed explanations below, if "<CODE>a</CODE>" represents an * instance of document data, then the result of processing the data in * document "<CODE>a</CODE>" is a sequence of media sheets represented by * "<CODE>a(*)</CODE>". * <P> * The standard MultipleDocumentHandling values are: * <UL> * <LI> * <A NAME="sdfi">{@link #SINGLE_DOCUMENT * <B><CODE>SINGLE_DOCUMENT</CODE></B>}</A>. If a print job has multiple * documents -- say, the document data is called <CODE>a</CODE> and * <CODE>b</CODE> -- then the result of processing all the document data * (<CODE>a</CODE> and then <CODE>b</CODE>) must be treated as a single sequence * of media sheets for finishing operations; that is, finishing would be * performed on the concatenation of the sequences <CODE>a(*),b(*)</CODE>. The * printer must not force the data in each document instance to be formatted * onto a new print-stream page, nor to start a new impression on a new media * sheet. If more than one copy is made, the ordering of the sets of media * sheets resulting from processing the document data must be * <CODE>a(*),b(*),a(*),b(*),...</CODE>, and the printer object must force * each copy (<CODE>a(*),b(*)</CODE>) to start on a new media sheet. * <P> * <LI> * <A NAME="sducfi">{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES * <B><CODE>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</CODE></B>}</A>. If a print job * has multiple documents -- say, the document data is called <CODE>a</CODE> and * <CODE>b</CODE> -- then the result of processing the data in each document * instance must be treated as a single sequence of media sheets for finishing * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would * each be finished separately. The printer must force each copy of the result * of processing the data in a single document to start on a new media sheet. * If more than one copy is made, the ordering of the sets of media sheets * resulting from processing the document data must be * <CODE>a(*),a(*),...,b(*),b(*)...</CODE>. * <P> * <LI> * <A NAME="sdccfi">{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES * <B><CODE>SEPARATE_DOCUMENTS_COLLATED_COPIES</CODE></B>}</A>. If a print job * has multiple documents -- say, the document data is called <CODE>a</CODE> and * <CODE>b</CODE> -- then the result of processing the data in each document * instance must be treated as a single sequence of media sheets for finishing * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would * each be finished separately. The printer must force each copy of the result * of processing the data in a single document to start on a new media sheet. * If more than one copy is made, the ordering of the sets of media sheets * resulting from processing the document data must be * <CODE>a(*),b(*),a(*),b(*),...</CODE>. * <P> * <LI> * <A NAME="sdnsfi">{@link #SINGLE_DOCUMENT_NEW_SHEET * <B><CODE>SINGLE_DOCUMENT_NEW_SHEET</CODE></B>}</A>. Same as SINGLE_DOCUMENT, * except that the printer must ensure that the first impression of each * document instance in the job is placed on a new media sheet. This value * allows multiple documents to be stapled together with a single staple where * each document starts on a new sheet. * </UL> * <P> * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with * respect to ordering of print-stream pages, but not media sheet generation, * since SINGLE_DOCUMENT will put the first page of the next document on the * back side of a sheet if an odd number of pages have been produced so far * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the * next document or document copy on to a new sheet. * <P> * In addition, if a {@link Finishings Finishings} attribute of * {@link Finishings#STAPLE <CODE>STAPLE</CODE>} is specified, then: * <UL> * <LI> * With SINGLE_DOCUMENT, documents <CODE>a</CODE> and <CODE>b</CODE> are * stapled together as a single document with no regard to new sheets. * <P> * <LI> * With SINGLE_DOCUMENT_NEW_SHEET, documents <CODE>a</CODE> and <CODE>b</CODE> * are stapled together as a single document, but document <CODE>b</CODE> * starts on a new sheet. * <P> * <LI> * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents <CODE>a</CODE> and * <CODE>b</CODE> are stapled separately. * </UL> * <P> * <I>Note:</I> None of these values provide means to produce uncollated * sheets within a document, i.e., where multiple copies of sheet <I>n</I> * are produced before sheet <I>n</I>+1 of the same document. * To specify that, see the {@link SheetCollate SheetCollate} attribute. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @see Copies * @see Finishings * @see NumberUp * @see PageRanges * @see SheetCollate * @see Sides * * @author David Mendenhall * @author Alan Kaminsky */ public class MultipleDocumentHandling extends EnumSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 8098326460746413466L; /** {@collect.stats} * Single document -- see above for <A HREF="#sdfi">further * information</A>. */ public static final MultipleDocumentHandling SINGLE_DOCUMENT = new MultipleDocumentHandling (0); /** {@collect.stats} * Separate documents uncollated copies -- see above for * <A HREF="#sducfi">further information</A>. */ public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1); /** {@collect.stats} * Separate documents collated copies -- see above for * <A HREF="#sdccfi">further information</A>. */ public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2); /** {@collect.stats} * Single document new sheet -- see above for * <A HREF="#sdnsfi">further information</A>. */ public static final MultipleDocumentHandling SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3); /** {@collect.stats} * Construct a new multiple document handling enumeration value with the * given integer value. * * @param value Integer value. */ protected MultipleDocumentHandling(int value) { super (value); } private static final String[] myStringTable = { "single-document", "separate-documents-uncollated-copies", "separate-documents-collated-copies", "single-document-new-sheet" }; private static final MultipleDocumentHandling[] myEnumValueTable = { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, SEPARATE_DOCUMENTS_COLLATED_COPIES, SINGLE_DOCUMENT_NEW_SHEET }; /** {@collect.stats} * Returns the string table for class MultipleDocumentHandling. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class MultipleDocumentHandling. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class MultipleDocumentHandling and any vendor-defined subclasses, * the category is class MultipleDocumentHandling itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return MultipleDocumentHandling.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class MultipleDocumentHandling and any vendor-defined subclasses, * the category name is <CODE>"multiple-document-handling"</CODE>. * * @return Attribute category name. */ public final String getName() { return "multiple-document-handling"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobKOctets is an integer valued printing attribute class that specifies * the total size of the document(s) in K octets, i.e., in units of 1024 octets * requested to be processed in the job. The value must be rounded up, so that a * job between 1 and 1024 octets must be indicated as being 1K octets, 1025 to * 2048 must be 2K octets, etc. For a multidoc print job (a job with multiple * documents), the JobKOctets value is computed by adding up the individual * documents' sizes in octets, then rounding up to the next K octets value. * <P> * The JobKOctets attribute describes the size of the job. This attribute is not * intended to be a counter; it is intended to be useful routing and scheduling * information if known. The printer may try to compute the JobKOctets * attribute's value if it is not supplied in the Print Request. Even if the * client does supply a value for the JobKOctets attribute in the Print Request, * the printer may choose to change the value if the printer is able to compute * a value which is more accurate than the client supplied value. The printer * may be able to determine the correct value for the JobKOctets attribute * either right at job submission time or at any later point in time. * <P> * The JobKOctets value must not include the multiplicative factors contributed * by the number of copies specified by the {@link Copies Copies} attribute, * independent of whether the device can process multiple copies without making * multiple passes over the job or document data and independent of whether the * output is collated or not. Thus the value is independent of the * implementation and indicates the size of the document(s) measured in K octets * independent of the number of copies. * <P> * The JobKOctets value must also not include the multiplicative factor due to a * copies instruction embedded in the document data. If the document data * actually includes replications of the document data, this value will include * such replication. In other words, this value is always the size of the source * document data, rather than a measure of the hardcopy output to be produced. * <P> * The size of a doc is computed based on the print data representation class as * specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as * shown in the table below. * <P> * <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Table showing computation of doc sizes"> * <TR BGCOLOR="#E5E5E5"> * <TH>Representation Class</TH> * <TH>Document Size</TH> * </TR> * <TR> * <TD>byte[]</TD> * <TD>Length of the byte array</TD> * </TR> * <TR> * <TD>java.io.InputStream</TD> * <TD>Number of bytes read from the stream</TD> * </TR> * <TR> * <TD>char[]</TD> * <TD>Length of the character array x 2</TD> * </TR> * <TR> * <TD>java.lang.String</TD> * <TD>Length of the string x 2</TD> * </TR> * <TR> * <TD>java.io.Reader</TD> * <TD>Number of characters read from the stream x 2</TD> * </TR> * <TR> * <TD>java.net.URL</TD> * <TD>Number of bytes read from the file at the given URL address</TD> * </TR> * <TR> * <TD>java.awt.image.renderable.RenderableImage</TD> * <TD>Implementation dependent&#42;</TD> * </TR> * <TR> * <TD>java.awt.print.Printable</TD> * <TD>Implementation dependent&#42;</TD> * </TR> * <TR> * <TD>java.awt.print.Pageable</TD> * <TD>Implementation dependent&#42;</TD> * </TR> * </TABLE> * <P> * &#42; In these cases the Print Service itself generates the print data sent * to the printer. If the Print Service supports the JobKOctets attribute, for * these cases the Print Service itself must calculate the size of the print * data, replacing any JobKOctets value the client specified. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobKOctetsSupported * @see JobKOctetsProcessed * @see JobImpressions * @see JobMediaSheets * * @author Alan Kaminsky */ public final class JobKOctets extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -8959710146498202869L; /** {@collect.stats} * Construct a new job K octets attribute with the given integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobKOctets(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job K octets attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobKOctets. * <LI> * This job K octets attribute's value and <CODE>object</CODE>'s value * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job K * octets attribute, false otherwise. */ public boolean equals(Object object) { return super.equals(object) && object instanceof JobKOctets; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobKOctets, the category is class JobKOctets itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobKOctets.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobKOctets, the category name is <CODE>"job-k-octets"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-k-octets"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Date; import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class DateTimeAtCreation is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job was * created. * <P> * To construct a DateTimeAtCreation attribute from separate values of the year, * month, day, hour, minute, and so on, use a {@link java.util.Calendar * Calendar} object to construct a {@link java.util.Date Date} object, then use * the {@link java.util.Date Date} object to construct the DateTimeAtCreation * attribute. To convert a DateTimeAtCreation attribute to separate values of * the year, month, day, hour, minute, and so on, create a {@link * java.util.Calendar Calendar} object and set it to the {@link java.util.Date * Date} from the DateTimeAtCreation attribute. * <P> * <B>IPP Compatibility:</B> The information needed to construct an IPP * "date-time-at-creation" attribute can be obtained as described above. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class DateTimeAtCreation extends DateTimeSyntax implements PrintJobAttribute { private static final long serialVersionUID = -2923732231056647903L; /** {@collect.stats} * Construct a new date-time at creation attribute with the given {@link * java.util.Date Date} value. * * @param dateTime {@link java.util.Date Date} value. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null. */ public DateTimeAtCreation(Date dateTime) { super (dateTime); } /** {@collect.stats} * Returns whether this date-time at creation attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class DateTimeAtCreation. * <LI> * This date-time at creation attribute's {@link java.util.Date Date} value * and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this date-time * at creation attribute, false otherwise. */ public boolean equals(Object object) { return(super.equals (object) && object instanceof DateTimeAtCreation); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class DateTimeAtCreation, the category is class * DateTimeAtCreation itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return DateTimeAtCreation.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class DateTimeAtCreation, the category name is * <CODE>"date-time-at-creation"</CODE>. * * @return Attribute category name. */ public final String getName() { return "date-time-at-creation"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobImpressionsCompleted is an integer valued printing attribute class * that specifies the number of impressions completed for the job so far. For * printing devices, the impressions completed includes interpreting, marking, * and stacking the output. * <P> * The JobImpressionsCompleted attribute describes the progress of the job. This * attribute is intended to be a counter. That is, the JobImpressionsCompleted * value for a job that has not started processing must be 0. When the job's * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the * JobImpressionsCompleted value is intended to increase as the job is * processed; it indicates the amount of the job that has been processed at the * time the Print Job's attribute set is queried or at the time a print job * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED * states, the JobImpressionsCompleted value is the final value for the job. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobImpressions * @see JobImpressionsSupported * @see JobKOctetsProcessed * @see JobMediaSheetsCompleted * * @author Alan Kaminsky */ public final class JobImpressionsCompleted extends IntegerSyntax implements PrintJobAttribute { private static final long serialVersionUID = 6722648442432393294L; /** {@collect.stats} * Construct a new job impressions completed attribute with the given * integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobImpressionsCompleted(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job impressions completed attribute is equivalent * tp the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobImpressionsCompleted. * <LI> * This job impressions completed attribute's value and * <CODE>object</CODE>'s value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * impressions completed attribute, false otherwise. */ public boolean equals(Object object) { return(super.equals (object) && object instanceof JobImpressionsCompleted); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobImpressionsCompleted, the category is class * JobImpressionsCompleted itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobImpressionsCompleted.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobImpressionsCompleted, the category name is * <CODE>"job-impressions-completed"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-impressions-completed"; } }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.HashMap; import java.util.Vector; import javax.print.attribute.Size2DSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class MediaSize is a two-dimensional size valued printing attribute class * that indicates the dimensions of the medium in a portrait orientation, with * the X dimension running along the bottom edge and the Y dimension running * along the left edge. Thus, the Y dimension must be greater than or equal to * the X dimension. Class MediaSize declares many standard media size * values, organized into nested classes for ISO, JIS, North American, * engineering, and other media. * <P> * MediaSize is not yet used to specify media. Its current role is * as a mapping for named media (see {@link MediaSizeName MediaSizeName}). * Clients can use the mapping method * <code>MediaSize.getMediaSizeForName(MediaSizeName)</code> * to find the physical dimensions of the MediaSizeName instances * enumerated in this API. This is useful for clients which need this * information to format & paginate printing. * <P> * * @author Phil Race, Alan Kaminsky */ public class MediaSize extends Size2DSyntax implements Attribute { private static final long serialVersionUID = -1967958664615414771L; private MediaSizeName mediaName; private static HashMap mediaMap = new HashMap(100, 10); private static Vector sizeVector = new Vector(100, 10); /** {@collect.stats} * Construct a new media size attribute from the given floating-point * values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or * <CODE>Size2DSyntax.MM</CODE>. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. */ public MediaSize(float x, float y,int units) { super (x, y, units); if (x > y) { throw new IllegalArgumentException("X dimension > Y dimension"); } sizeVector.add(this); } /** {@collect.stats} * Construct a new media size attribute from the given integer values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or * <CODE>Size2DSyntax.MM</CODE>. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. */ public MediaSize(int x, int y,int units) { super (x, y, units); if (x > y) { throw new IllegalArgumentException("X dimension > Y dimension"); } sizeVector.add(this); } /** {@collect.stats} * Construct a new media size attribute from the given floating-point * values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or * <CODE>Size2DSyntax.MM</CODE>. * @param media a media name to associate with this MediaSize * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. */ public MediaSize(float x, float y,int units, MediaSizeName media) { super (x, y, units); if (x > y) { throw new IllegalArgumentException("X dimension > Y dimension"); } if (media != null && mediaMap.get(media) == null) { mediaName = media; mediaMap.put(mediaName, this); } sizeVector.add(this); } /** {@collect.stats} * Construct a new media size attribute from the given integer values. * * @param x X dimension. * @param y Y dimension. * @param units * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or * <CODE>Size2DSyntax.MM</CODE>. * @param media a media name to associate with this MediaSize * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. */ public MediaSize(int x, int y,int units, MediaSizeName media) { super (x, y, units); if (x > y) { throw new IllegalArgumentException("X dimension > Y dimension"); } if (media != null && mediaMap.get(media) == null) { mediaName = media; mediaMap.put(mediaName, this); } sizeVector.add(this); } /** {@collect.stats} * Get the media name, if any, for this size. * * @return the name for this media size, or null if no name was * associated with this size (an anonymous size). */ public MediaSizeName getMediaSizeName() { return mediaName; } /** {@collect.stats} * Get the MediaSize for the specified named media. * * @param media - the name of the media for which the size is sought * @return size of the media, or null if this media is not associated * with any size. */ public static MediaSize getMediaSizeForName(MediaSizeName media) { return (MediaSize)mediaMap.get(media); } /** {@collect.stats} * The specified dimensions are used to locate a matching MediaSize * instance from amongst all the standard MediaSize instances. * If there is no exact match, the closest match is used. * <p> * The MediaSize is in turn used to locate the MediaSizeName object. * This method may return null if the closest matching MediaSize * has no corresponding Media instance. * <p> * This method is useful for clients which have only dimensions and * want to find a Media which corresponds to the dimensions. * @param x - X dimension * @param y - Y dimension. * @param units * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or * <CODE>Size2DSyntax.MM</CODE> * @return MediaSizeName matching these dimensions, or null. * @exception IllegalArgumentException if x <= 0, y <= 0, or units < 1 * */ public static MediaSizeName findMedia(float x, float y, int units) { MediaSize match = MediaSize.ISO.A4; if (x <= 0.0f || y <= 0.0f || units < 1) { throw new IllegalArgumentException("args must be +ve values"); } double ls = x * x + y * y; double tmp_ls; float []dim; float diffx = x; float diffy = y; for (int i=0; i < sizeVector.size() ; i++) { MediaSize mediaSize = (MediaSize)sizeVector.elementAt(i); dim = mediaSize.getSize(units); if (x == dim[0] && y == dim[1]) { match = mediaSize; break; } else { diffx = x - dim[0]; diffy = y - dim[1]; tmp_ls = diffx * diffx + diffy * diffy; if (tmp_ls < ls) { ls = tmp_ls; match = mediaSize; } } } return match.getMediaSizeName(); } /** {@collect.stats} * Returns whether this media size attribute is equivalent to the passed * in object. * To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class MediaSize. * <LI> * This media size attribute's X dimension is equal to * <CODE>object</CODE>'s X dimension. * <LI> * This media size attribute's Y dimension is equal to * <CODE>object</CODE>'s Y dimension. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this media size * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof MediaSize); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class MediaSize and any vendor-defined subclasses, the category is * class MediaSize itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return MediaSize.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class MediaSize and any vendor-defined subclasses, the category * name is <CODE>"media-size"</CODE>. * * @return Attribute category name. */ public final String getName() { return "media-size"; } /** {@collect.stats} * Class MediaSize.ISO includes {@link MediaSize MediaSize} values for ISO * media. * <P> */ public final static class ISO { /** {@collect.stats} * Specifies the ISO A0 size, 841 mm by 1189 mm. */ public static final MediaSize A0 = new MediaSize(841, 1189, Size2DSyntax.MM, MediaSizeName.ISO_A0); /** {@collect.stats} * Specifies the ISO A1 size, 594 mm by 841 mm. */ public static final MediaSize A1 = new MediaSize(594, 841, Size2DSyntax.MM, MediaSizeName.ISO_A1); /** {@collect.stats} * Specifies the ISO A2 size, 420 mm by 594 mm. */ public static final MediaSize A2 = new MediaSize(420, 594, Size2DSyntax.MM, MediaSizeName.ISO_A2); /** {@collect.stats} * Specifies the ISO A3 size, 297 mm by 420 mm. */ public static final MediaSize A3 = new MediaSize(297, 420, Size2DSyntax.MM, MediaSizeName.ISO_A3); /** {@collect.stats} * Specifies the ISO A4 size, 210 mm by 297 mm. */ public static final MediaSize A4 = new MediaSize(210, 297, Size2DSyntax.MM, MediaSizeName.ISO_A4); /** {@collect.stats} * Specifies the ISO A5 size, 148 mm by 210 mm. */ public static final MediaSize A5 = new MediaSize(148, 210, Size2DSyntax.MM, MediaSizeName.ISO_A5); /** {@collect.stats} * Specifies the ISO A6 size, 105 mm by 148 mm. */ public static final MediaSize A6 = new MediaSize(105, 148, Size2DSyntax.MM, MediaSizeName.ISO_A6); /** {@collect.stats} * Specifies the ISO A7 size, 74 mm by 105 mm. */ public static final MediaSize A7 = new MediaSize(74, 105, Size2DSyntax.MM, MediaSizeName.ISO_A7); /** {@collect.stats} * Specifies the ISO A8 size, 52 mm by 74 mm. */ public static final MediaSize A8 = new MediaSize(52, 74, Size2DSyntax.MM, MediaSizeName.ISO_A8); /** {@collect.stats} * Specifies the ISO A9 size, 37 mm by 52 mm. */ public static final MediaSize A9 = new MediaSize(37, 52, Size2DSyntax.MM, MediaSizeName.ISO_A9); /** {@collect.stats} * Specifies the ISO A10 size, 26 mm by 37 mm. */ public static final MediaSize A10 = new MediaSize(26, 37, Size2DSyntax.MM, MediaSizeName.ISO_A10); /** {@collect.stats} * Specifies the ISO B0 size, 1000 mm by 1414 mm. */ public static final MediaSize B0 = new MediaSize(1000, 1414, Size2DSyntax.MM, MediaSizeName.ISO_B0); /** {@collect.stats} * Specifies the ISO B1 size, 707 mm by 1000 mm. */ public static final MediaSize B1 = new MediaSize(707, 1000, Size2DSyntax.MM, MediaSizeName.ISO_B1); /** {@collect.stats} * Specifies the ISO B2 size, 500 mm by 707 mm. */ public static final MediaSize B2 = new MediaSize(500, 707, Size2DSyntax.MM, MediaSizeName.ISO_B2); /** {@collect.stats} * Specifies the ISO B3 size, 353 mm by 500 mm. */ public static final MediaSize B3 = new MediaSize(353, 500, Size2DSyntax.MM, MediaSizeName.ISO_B3); /** {@collect.stats} * Specifies the ISO B4 size, 250 mm by 353 mm. */ public static final MediaSize B4 = new MediaSize(250, 353, Size2DSyntax.MM, MediaSizeName.ISO_B4); /** {@collect.stats} * Specifies the ISO B5 size, 176 mm by 250 mm. */ public static final MediaSize B5 = new MediaSize(176, 250, Size2DSyntax.MM, MediaSizeName.ISO_B5); /** {@collect.stats} * Specifies the ISO B6 size, 125 mm by 176 mm. */ public static final MediaSize B6 = new MediaSize(125, 176, Size2DSyntax.MM, MediaSizeName.ISO_B6); /** {@collect.stats} * Specifies the ISO B7 size, 88 mm by 125 mm. */ public static final MediaSize B7 = new MediaSize(88, 125, Size2DSyntax.MM, MediaSizeName.ISO_B7); /** {@collect.stats} * Specifies the ISO B8 size, 62 mm by 88 mm. */ public static final MediaSize B8 = new MediaSize(62, 88, Size2DSyntax.MM, MediaSizeName.ISO_B8); /** {@collect.stats} * Specifies the ISO B9 size, 44 mm by 62 mm. */ public static final MediaSize B9 = new MediaSize(44, 62, Size2DSyntax.MM, MediaSizeName.ISO_B9); /** {@collect.stats} * Specifies the ISO B10 size, 31 mm by 44 mm. */ public static final MediaSize B10 = new MediaSize(31, 44, Size2DSyntax.MM, MediaSizeName.ISO_B10); /** {@collect.stats} * Specifies the ISO C3 size, 324 mm by 458 mm. */ public static final MediaSize C3 = new MediaSize(324, 458, Size2DSyntax.MM, MediaSizeName.ISO_C3); /** {@collect.stats} * Specifies the ISO C4 size, 229 mm by 324 mm. */ public static final MediaSize C4 = new MediaSize(229, 324, Size2DSyntax.MM, MediaSizeName.ISO_C4); /** {@collect.stats} * Specifies the ISO C5 size, 162 mm by 229 mm. */ public static final MediaSize C5 = new MediaSize(162, 229, Size2DSyntax.MM, MediaSizeName.ISO_C5); /** {@collect.stats} * Specifies the ISO C6 size, 114 mm by 162 mm. */ public static final MediaSize C6 = new MediaSize(114, 162, Size2DSyntax.MM, MediaSizeName.ISO_C6); /** {@collect.stats} * Specifies the ISO Designated Long size, 110 mm by 220 mm. */ public static final MediaSize DESIGNATED_LONG = new MediaSize(110, 220, Size2DSyntax.MM, MediaSizeName.ISO_DESIGNATED_LONG); /** {@collect.stats} * Hide all constructors. */ private ISO() { } } /** {@collect.stats} * Class MediaSize.JIS includes {@link MediaSize MediaSize} values for JIS * (Japanese) media. * */ public final static class JIS { /** {@collect.stats} * Specifies the JIS B0 size, 1030 mm by 1456 mm. */ public static final MediaSize B0 = new MediaSize(1030, 1456, Size2DSyntax.MM, MediaSizeName.JIS_B0); /** {@collect.stats} * Specifies the JIS B1 size, 728 mm by 1030 mm. */ public static final MediaSize B1 = new MediaSize(728, 1030, Size2DSyntax.MM, MediaSizeName.JIS_B1); /** {@collect.stats} * Specifies the JIS B2 size, 515 mm by 728 mm. */ public static final MediaSize B2 = new MediaSize(515, 728, Size2DSyntax.MM, MediaSizeName.JIS_B2); /** {@collect.stats} * Specifies the JIS B3 size, 364 mm by 515 mm. */ public static final MediaSize B3 = new MediaSize(364, 515, Size2DSyntax.MM, MediaSizeName.JIS_B3); /** {@collect.stats} * Specifies the JIS B4 size, 257 mm by 364 mm. */ public static final MediaSize B4 = new MediaSize(257, 364, Size2DSyntax.MM, MediaSizeName.JIS_B4); /** {@collect.stats} * Specifies the JIS B5 size, 182 mm by 257 mm. */ public static final MediaSize B5 = new MediaSize(182, 257, Size2DSyntax.MM, MediaSizeName.JIS_B5); /** {@collect.stats} * Specifies the JIS B6 size, 128 mm by 182 mm. */ public static final MediaSize B6 = new MediaSize(128, 182, Size2DSyntax.MM, MediaSizeName.JIS_B6); /** {@collect.stats} * Specifies the JIS B7 size, 91 mm by 128 mm. */ public static final MediaSize B7 = new MediaSize(91, 128, Size2DSyntax.MM, MediaSizeName.JIS_B7); /** {@collect.stats} * Specifies the JIS B8 size, 64 mm by 91 mm. */ public static final MediaSize B8 = new MediaSize(64, 91, Size2DSyntax.MM, MediaSizeName.JIS_B8); /** {@collect.stats} * Specifies the JIS B9 size, 45 mm by 64 mm. */ public static final MediaSize B9 = new MediaSize(45, 64, Size2DSyntax.MM, MediaSizeName.JIS_B9); /** {@collect.stats} * Specifies the JIS B10 size, 32 mm by 45 mm. */ public static final MediaSize B10 = new MediaSize(32, 45, Size2DSyntax.MM, MediaSizeName.JIS_B10); /** {@collect.stats} * Specifies the JIS Chou ("long") #1 envelope size, 142 mm by 332 mm. */ public static final MediaSize CHOU_1 = new MediaSize(142, 332, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Chou ("long") #2 envelope size, 119 mm by 277 mm. */ public static final MediaSize CHOU_2 = new MediaSize(119, 277, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Chou ("long") #3 envelope size, 120 mm by 235 mm. */ public static final MediaSize CHOU_3 = new MediaSize(120, 235, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Chou ("long") #4 envelope size, 90 mm by 205 mm. */ public static final MediaSize CHOU_4 = new MediaSize(90, 205, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Chou ("long") #30 envelope size, 92 mm by 235 mm. */ public static final MediaSize CHOU_30 = new MediaSize(92, 235, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Chou ("long") #40 envelope size, 90 mm by 225 mm. */ public static final MediaSize CHOU_40 = new MediaSize(90, 225, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #0 envelope size, 287 mm by 382 mm. */ public static final MediaSize KAKU_0 = new MediaSize(287, 382, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #1 envelope size, 270 mm by 382 mm. */ public static final MediaSize KAKU_1 = new MediaSize(270, 382, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #2 envelope size, 240 mm by 332 mm. */ public static final MediaSize KAKU_2 = new MediaSize(240, 332, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #3 envelope size, 216 mm by 277 mm. */ public static final MediaSize KAKU_3 = new MediaSize(216, 277, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #4 envelope size, 197 mm by 267 mm. */ public static final MediaSize KAKU_4 = new MediaSize(197, 267, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #5 envelope size, 190 mm by 240 mm. */ public static final MediaSize KAKU_5 = new MediaSize(190, 240, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #6 envelope size, 162 mm by 229 mm. */ public static final MediaSize KAKU_6 = new MediaSize(162, 229, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #7 envelope size, 142 mm by 205 mm. */ public static final MediaSize KAKU_7 = new MediaSize(142, 205, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #8 envelope size, 119 mm by 197 mm. */ public static final MediaSize KAKU_8 = new MediaSize(119, 197, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 mm. */ public static final MediaSize KAKU_20 = new MediaSize(229, 324, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS Kaku ("square") A4 envelope size, 228 mm by 312 mm. */ public static final MediaSize KAKU_A4 = new MediaSize(228, 312, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #1 envelope size, 120 mm by 176 mm. */ public static final MediaSize YOU_1 = new MediaSize(120, 176, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #2 envelope size, 114 mm by 162 mm. */ public static final MediaSize YOU_2 = new MediaSize(114, 162, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #3 envelope size, 98 mm by 148 mm. */ public static final MediaSize YOU_3 = new MediaSize(98, 148, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #4 envelope size, 105 mm by 235 mm. */ public static final MediaSize YOU_4 = new MediaSize(105, 235, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #5 envelope size, 95 mm by 217 mm. */ public static final MediaSize YOU_5 = new MediaSize(95, 217, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #6 envelope size, 98 mm by 190 mm. */ public static final MediaSize YOU_6 = new MediaSize(98, 190, Size2DSyntax.MM); /** {@collect.stats} * Specifies the JIS You ("Western") #7 envelope size, 92 mm by 165 mm. */ public static final MediaSize YOU_7 = new MediaSize(92, 165, Size2DSyntax.MM); /** {@collect.stats} * Hide all constructors. */ private JIS() { } } /** {@collect.stats} * Class MediaSize.NA includes {@link MediaSize MediaSize} values for North * American media. */ public final static class NA { /** {@collect.stats} * Specifies the North American letter size, 8.5 inches by 11 inches. */ public static final MediaSize LETTER = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_LETTER); /** {@collect.stats} * Specifies the North American legal size, 8.5 inches by 14 inches. */ public static final MediaSize LEGAL = new MediaSize(8.5f, 14.0f, Size2DSyntax.INCH, MediaSizeName.NA_LEGAL); /** {@collect.stats} * Specifies the North American 5 inch by 7 inch paper. */ public static final MediaSize NA_5X7 = new MediaSize(5, 7, Size2DSyntax.INCH, MediaSizeName.NA_5X7); /** {@collect.stats} * Specifies the North American 8 inch by 10 inch paper. */ public static final MediaSize NA_8X10 = new MediaSize(8, 10, Size2DSyntax.INCH, MediaSizeName.NA_8X10); /** {@collect.stats} * Specifies the North American Number 9 business envelope size, * 3.875 inches by 8.875 inches. */ public static final MediaSize NA_NUMBER_9_ENVELOPE = new MediaSize(3.875f, 8.875f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_9_ENVELOPE); /** {@collect.stats} * Specifies the North American Number 10 business envelope size, * 4.125 inches by 9.5 inches. */ public static final MediaSize NA_NUMBER_10_ENVELOPE = new MediaSize(4.125f, 9.5f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_10_ENVELOPE); /** {@collect.stats} * Specifies the North American Number 11 business envelope size, * 4.5 inches by 10.375 inches. */ public static final MediaSize NA_NUMBER_11_ENVELOPE = new MediaSize(4.5f, 10.375f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_11_ENVELOPE); /** {@collect.stats} * Specifies the North American Number 12 business envelope size, * 4.75 inches by 11 inches. */ public static final MediaSize NA_NUMBER_12_ENVELOPE = new MediaSize(4.75f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_12_ENVELOPE); /** {@collect.stats} * Specifies the North American Number 14 business envelope size, * 5 inches by 11.5 inches. */ public static final MediaSize NA_NUMBER_14_ENVELOPE = new MediaSize(5.0f, 11.5f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_14_ENVELOPE); /** {@collect.stats} * Specifies the North American 6 inch by 9 inch envelope size. */ public static final MediaSize NA_6X9_ENVELOPE = new MediaSize(6.0f, 9.0f, Size2DSyntax.INCH, MediaSizeName.NA_6X9_ENVELOPE); /** {@collect.stats} * Specifies the North American 7 inch by 9 inch envelope size. */ public static final MediaSize NA_7X9_ENVELOPE = new MediaSize(7.0f, 9.0f, Size2DSyntax.INCH, MediaSizeName.NA_7X9_ENVELOPE); /** {@collect.stats} * Specifies the North American 9 inch by 11 inch envelope size. */ public static final MediaSize NA_9x11_ENVELOPE = new MediaSize(9.0f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_9X11_ENVELOPE); /** {@collect.stats} * Specifies the North American 9 inch by 12 inch envelope size. */ public static final MediaSize NA_9x12_ENVELOPE = new MediaSize(9.0f, 12.0f, Size2DSyntax.INCH, MediaSizeName.NA_9X12_ENVELOPE); /** {@collect.stats} * Specifies the North American 10 inch by 13 inch envelope size. */ public static final MediaSize NA_10x13_ENVELOPE = new MediaSize(10.0f, 13.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X13_ENVELOPE); /** {@collect.stats} * Specifies the North American 10 inch by 14 inch envelope size. */ public static final MediaSize NA_10x14_ENVELOPE = new MediaSize(10.0f, 14.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X14_ENVELOPE); /** {@collect.stats} * Specifies the North American 10 inch by 15 inch envelope size. */ public static final MediaSize NA_10X15_ENVELOPE = new MediaSize(10.0f, 15.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X15_ENVELOPE); /** {@collect.stats} * Hide all constructors. */ private NA() { } } /** {@collect.stats} * Class MediaSize.Engineering includes {@link MediaSize MediaSize} values * for engineering media. */ public final static class Engineering { /** {@collect.stats} * Specifies the engineering A size, 8.5 inch by 11 inch. */ public static final MediaSize A = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH, MediaSizeName.A); /** {@collect.stats} * Specifies the engineering B size, 11 inch by 17 inch. */ public static final MediaSize B = new MediaSize(11.0f, 17.0f, Size2DSyntax.INCH, MediaSizeName.B); /** {@collect.stats} * Specifies the engineering C size, 17 inch by 22 inch. */ public static final MediaSize C = new MediaSize(17.0f, 22.0f, Size2DSyntax.INCH, MediaSizeName.C); /** {@collect.stats} * Specifies the engineering D size, 22 inch by 34 inch. */ public static final MediaSize D = new MediaSize(22.0f, 34.0f, Size2DSyntax.INCH, MediaSizeName.D); /** {@collect.stats} * Specifies the engineering E size, 34 inch by 44 inch. */ public static final MediaSize E = new MediaSize(34.0f, 44.0f, Size2DSyntax.INCH, MediaSizeName.E); /** {@collect.stats} * Hide all constructors. */ private Engineering() { } } /** {@collect.stats} * Class MediaSize.Other includes {@link MediaSize MediaSize} values for * miscellaneous media. */ public final static class Other { /** {@collect.stats} * Specifies the executive size, 7.25 inches by 10.5 inches. */ public static final MediaSize EXECUTIVE = new MediaSize(7.25f, 10.5f, Size2DSyntax.INCH, MediaSizeName.EXECUTIVE); /** {@collect.stats} * Specifies the ledger size, 11 inches by 17 inches. */ public static final MediaSize LEDGER = new MediaSize(11.0f, 17.0f, Size2DSyntax.INCH, MediaSizeName.LEDGER); /** {@collect.stats} * Specifies the tabloid size, 11 inches by 17 inches. * @since 1.5 */ public static final MediaSize TABLOID = new MediaSize(11.0f, 17.0f, Size2DSyntax.INCH, MediaSizeName.TABLOID); /** {@collect.stats} * Specifies the invoice size, 5.5 inches by 8.5 inches. */ public static final MediaSize INVOICE = new MediaSize(5.5f, 8.5f, Size2DSyntax.INCH, MediaSizeName.INVOICE); /** {@collect.stats} * Specifies the folio size, 8.5 inches by 13 inches. */ public static final MediaSize FOLIO = new MediaSize(8.5f, 13.0f, Size2DSyntax.INCH, MediaSizeName.FOLIO); /** {@collect.stats} * Specifies the quarto size, 8.5 inches by 10.83 inches. */ public static final MediaSize QUARTO = new MediaSize(8.5f, 10.83f, Size2DSyntax.INCH, MediaSizeName.QUARTO); /** {@collect.stats} * Specifies the Italy envelope size, 110 mm by 230 mm. */ public static final MediaSize ITALY_ENVELOPE = new MediaSize(110, 230, Size2DSyntax.MM, MediaSizeName.ITALY_ENVELOPE); /** {@collect.stats} * Specifies the Monarch envelope size, 3.87 inch by 7.5 inch. */ public static final MediaSize MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f, Size2DSyntax.INCH, MediaSizeName.MONARCH_ENVELOPE); /** {@collect.stats} * Specifies the Personal envelope size, 3.625 inch by 6.5 inch. */ public static final MediaSize PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f, Size2DSyntax.INCH, MediaSizeName.PERSONAL_ENVELOPE); /** {@collect.stats} * Specifies the Japanese postcard size, 100 mm by 148 mm. */ public static final MediaSize JAPANESE_POSTCARD = new MediaSize(100, 148, Size2DSyntax.MM, MediaSizeName.JAPANESE_POSTCARD); /** {@collect.stats} * Specifies the Japanese Double postcard size, 148 mm by 200 mm. */ public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200, Size2DSyntax.MM, MediaSizeName.JAPANESE_DOUBLE_POSTCARD); /** {@collect.stats} * Hide all constructors. */ private Other() { } } /* force loading of all the subclasses so that the instances * are created and inserted into the hashmap. */ static { MediaSize ISOA4 = ISO.A4; MediaSize JISB5 = JIS.B5; MediaSize NALETTER = NA.LETTER; MediaSize EngineeringC = Engineering.C; MediaSize OtherEXECUTIVE = Other.EXECUTIVE; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobOriginatingUserName is a printing attribute class, a text * attribute, that contains the name of the end user that submitted the * print job. If possible, the printer sets this attribute to the most * authenticated printable user name that it can obtain from the * authentication service that authenticated the submitted Print Request. * If such is not available, the printer uses the value of the * {@link RequestingUserName RequestingUserName} * attribute supplied by the client in the Print Request's attribute set. * If no authentication service is available, and the client did not supply * a {@link RequestingUserName RequestingUserName} attribute, * the printer sets the JobOriginatingUserName attribute to an empty * (zero-length) string. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobOriginatingUserName extends TextSyntax implements PrintJobAttribute { private static final long serialVersionUID = -8052537926362933477L; /** {@collect.stats} * Constructs a new job originating user name attribute with the given * user name and locale. * * @param userName User name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>userName</CODE> is null. */ public JobOriginatingUserName(String userName, Locale locale) { super (userName, locale); } /** {@collect.stats} * Returns whether this job originating user name attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobOriginatingUserName. * <LI> * This job originating user name attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This job originating user name attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * originating user name attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobOriginatingUserName); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobOriginatingUserName, the * category is class JobOriginatingUserName itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobOriginatingUserName.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobOriginatingUserName, the * category name is <CODE>"job-originating-user-name"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-originating-user-name"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class NumberUp is an integer valued printing attribute class that specifies * the number of print-stream pages to impose upon a single side of an * instance of a selected medium. That is, if the NumberUp value is <I>n,</I> * the printer must place <I>n</I> print-stream pages on a single side of * an instance of the * selected medium. To accomplish this, the printer may add some sort of * translation, scaling, or rotation. This attribute primarily controls the * translation, scaling and rotation of print-stream pages. * <P> * The effect of a NumberUp attribute on a multidoc print job (a job with * multiple documents) depends on whether all the docs have the same number up * values specified or whether different docs have different number up values * specified, and on the (perhaps defaulted) value of the {@link * MultipleDocumentHandling MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same number up value <I>n</I> specified, then any * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes * sense, and the printer's processing depends on the {@link * MultipleDocumentHandling MultipleDocumentHandling} value: * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media impression will consist of <I>n</I>m * print-stream pages from the output document. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media impression will consist of <I>n</I> * print-stream pages from the output document. However, the first impression of * each input doc will always start on a new media sheet; this means the last * impression of an input doc may have fewer than <I>n</I> print-stream pages * on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * Each media impression will consist of <I>n</I> print-stream pages from the * input doc. Since the input docs are separate, the first impression of each * input doc will always start on a new media sheet; this means the last * impression of an input doc may have fewer than <I>n</I> print-stream pages on * it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * Each media impression will consist of <I>n</I> print-stream pages from the * input doc. Since the input docs are separate, the first impression of each * input doc will always start on a new media sheet; this means the last * impression of an input doc may have fewer than <I>n</I> print-stream pages * on it. * </UL> * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media impression will consist of <I>n<SUB>i</SUB></I> * print-stream pages from the output document, where <I>i</I> is the number of * the input doc corresponding to that point in the output document. When the * next input doc has a different number up value from the previous input doc, * the first print-stream page of the next input doc goes at the start of the * next media impression, possibly leaving fewer than the full number of * print-stream pages on the previous media impression. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media impression will consist of <I>n</I> * print-stream pages from the output document. However, the first impression of * each input doc will always start on a new media sheet; this means the last * impression of an input doc may have fewer than <I>n</I> print-stream pages * on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media impression will consist of * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input * docs are separate, the first impression of each input doc will always start * on a new media sheet; this means the last impression of an input doc may have * fewer than <I>n<SUB>i</SUB></I> print-stream pages on it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media impression will consist of * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input * docs are separate, the first impression of each input doc will always start * on a new media sheet; this means the last impression of an input doc may * have fewer than <I>n<SUB>i</SUB></I> print-stream pages on it. * </UL> * </UL> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class NumberUp extends IntegerSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -3040436486786527811L; /** {@collect.stats} * Construct a new number up attribute with the given integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1. */ public NumberUp(int value) { super (value, 1, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this number up attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class NumberUp. * <LI> * This number up attribute's value and <CODE>object</CODE>'s value are * equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this number up * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof NumberUp); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class NumberUp, the category is class NumberUp itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return NumberUp.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class NumberUp, the category name is <CODE>"number-up"</CODE>. * * @return Attribute category name. */ public final String getName() { return "number-up"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class PageRanges is a printing attribute class, a set of integers, that * identifies the range(s) of print-stream pages that the Printer object uses * for each copy of each document which are to be printed. Nothing is printed * for any pages identified that do not exist in the document(s). The attribute * is associated with <I>print-stream</I> pages, not application-numbered pages * (for example, the page numbers found in the headers and or footers for * certain word processing applications). * <P> * In most cases, the exact pages to be printed will be generated by a device * driver and this attribute would not be required. However, when printing an * archived document which has already been formatted, the end user may elect to * print just a subset of the pages contained in the document. In this case, if * a page range of <CODE>"<I>n</I>-<I>m</I>"</CODE> is specified, the first page * to be printed will be page <I>n.</I> All subsequent pages of the document * will be printed through and including page <I>m.</I> * <P> * If a PageRanges attribute is not specified for a print job, all pages of * the document will be printed. In other words, the default value for the * PageRanges attribute is always <CODE>{{1, Integer.MAX_VALUE}}</CODE>. * <P> * The effect of a PageRanges attribute on a multidoc print job (a job with * multiple documents) depends on whether all the docs have the same page ranges * specified or whether different docs have different page ranges specified, and * on the (perhaps defaulted) value of the {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same page ranges specified, then any value of {@link * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the * printer's processing depends on the {@link MultipleDocumentHandling * MultipleDocumentHandling} value: * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. The specified page ranges of that output document will be * printed. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document, and the first impression of each input doc will * always start on a new media sheet. The specified page ranges of that output * document will be printed. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, the * specified page ranges will be printed. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, the * specified page ranges will be printed. * </UL> * <UL> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, its own * specified page ranges will be printed.. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, its own * specified page ranges will be printed.. * </UL> * </UL> * <P> * <B>IPP Compatibility:</B> The PageRanges attribute's canonical array form * gives the lower and upper bound for each range of pages to be included in * and IPP "page-ranges" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public final class PageRanges extends SetOfIntegerSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 8639895197656148392L; /** {@collect.stats} * Construct a new page ranges attribute with the given members. The * members are specified in "array form;" see class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of array form. * * @param members Set members in array form. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>members</CODE> is null or * any element of <CODE>members</CODE> is null. * @exception IllegalArgumentException * (unchecked exception) Thrown if any element of * <CODE>members</CODE> is not a length-one or length-two array. Also * thrown if <CODE>members</CODE> is a zero-length array or if any * member of the set is less than 1. */ public PageRanges(int[][] members) { super (members); if (members == null) { throw new NullPointerException("members is null"); } myPageRanges(); } /** {@collect.stats} * Construct a new page ranges attribute with the given members in * string form. * See class {@link javax.print.attribute.SetOfIntegerSyntax * SetOfIntegerSyntax} * for explanation of the syntax. * * @param members Set members in string form. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>members</CODE> is null or * any element of <CODE>members</CODE> is null. * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>members</CODE> does not * obey the proper syntax. Also * thrown if the constructed set-of-integer is a * zero-length array or if any * member of the set is less than 1. */ public PageRanges(String members) { super(members); if (members == null) { throw new NullPointerException("members is null"); } myPageRanges(); } private void myPageRanges() { int[][] myMembers = getMembers(); int n = myMembers.length; if (n == 0) { throw new IllegalArgumentException("members is zero-length"); } int i; for (i = 0; i < n; ++ i) { if (myMembers[i][0] < 1) { throw new IllegalArgumentException("Page value < 1 specified"); } } } /** {@collect.stats} * Construct a new page ranges attribute containing a single integer. That * is, only the one page is to be printed. * * @param member Set member. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>member</CODE> is less than * 1. */ public PageRanges(int member) { super (member); if (member < 1) { throw new IllegalArgumentException("Page value < 1 specified"); } } /** {@collect.stats} * Construct a new page ranges attribute containing a single range of * integers. That is, only those pages in the one range are to be printed. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 1. */ public PageRanges(int lowerBound, int upperBound) { super (lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 1) { throw new IllegalArgumentException("Page value < 1 specified"); } } /** {@collect.stats} * Returns whether this page ranges attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PageRanges. * <LI> * This page ranges attribute's members and <CODE>object</CODE>'s members * are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this page ranges * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PageRanges); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PageRanges, the category is class PageRanges itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PageRanges.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PageRanges, the category name is <CODE>"page-ranges"</CODE>. * * @return Attribute category name. */ public final String getName() { return "page-ranges"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobName is a printing attribute class, a text attribute, that specifies * the name of a print job. A job's name is an arbitrary string defined by the * client. It does not need to be unique between different jobs. A Print Job's * JobName attribute is set to the value supplied by the client in the Print * Request's attribute set. If, however, the client does not supply a JobName * attribute in the Print Request, the printer, when it creates the Print Job, * must generate a JobName. The printer should generate the value of the Print * Job's JobName attribute from the first of the following sources that produces * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or * only) doc in the job, (2) the URL of the first (or only) doc in the job, if * the doc's print data representation object is a URL, or (3) any other piece * of Print Job specific and/or document content information. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobName extends TextSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 4660359192078689545L; /** {@collect.stats} * Constructs a new job name attribute with the given job name and locale. * * @param jobName Job name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>jobName</CODE> is null. */ public JobName(String jobName, Locale locale) { super (jobName, locale); } /** {@collect.stats} * Returns whether this job name attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobName. * <LI> * This job name attribute's underlying string and <CODE>object</CODE>'s * underlying string are equal. * <LI> * This job name attribute's locale and <CODE>object</CODE>'s locale are * equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job name * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof JobName); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobName, the category is class JobName itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobName.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobName, the category name is <CODE>"job-name"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-name"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterIsAcceptingJobs is a printing attribute class, an enumeration, * that indicates whether the printer is currently able to accept jobs. This * value is independent of the {@link PrinterState PrinterState} and {@link * PrinterStateReasons PrinterStateReasons} attributes because its value does * not affect the current job; rather it affects future jobs. If the value is * NOT_ACCEPTING_JOBS, the printer will reject jobs even when the {@link * PrinterState PrinterState} is IDLE. If value is ACCEPTING_JOBS, the Printer * will accept jobs even when the {@link PrinterState PrinterState} is STOPPED. * <P> * <B>IPP Compatibility:</B> The IPP boolean value is "true" for ACCEPTING_JOBS * and "false" for NOT_ACCEPTING_JOBS. TThe category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class PrinterIsAcceptingJobs extends EnumSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -5052010680537678061L; /** {@collect.stats} * The printer is currently rejecting any jobs sent to it. */ public static final PrinterIsAcceptingJobs NOT_ACCEPTING_JOBS = new PrinterIsAcceptingJobs(0); /** {@collect.stats} * The printer is currently acccepting jobs. */ public static final PrinterIsAcceptingJobs ACCEPTING_JOBS = new PrinterIsAcceptingJobs(1); /** {@collect.stats} * Construct a new printer is accepting jobs enumeration value with the * given integer value. * * @param value Integer value. */ protected PrinterIsAcceptingJobs(int value) { super (value); } private static final String[] myStringTable = { "not-accepting-jobs", "accepting-jobs" }; private static final PrinterIsAcceptingJobs[] myEnumValueTable = { NOT_ACCEPTING_JOBS, ACCEPTING_JOBS }; /** {@collect.stats} * Returns the string table for class PrinterIsAcceptingJobs. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class PrinterIsAcceptingJobs. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterIsAcceptingJobs, the * category is class PrinterIsAcceptingJobs itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterIsAcceptingJobs.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterIsAcceptingJobs, the * category name is <CODE>"printer-is-accepting-jobs"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-is-accepting-jobs"; } }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; /** {@collect.stats} * Class Fidelity is a printing attribute class, an enumeration, * that indicates whether total fidelity to client supplied print request * attributes is required. * If FIDELITY_TRUE is specified and a service cannot print the job exactly * as specified it must reject the job. * If FIDELITY_FALSE is specified a reasonable attempt to print the job is * acceptable. If not supplied the default is FIDELITY_FALSE. * * <P> * <B>IPP Compatibility:</B> The IPP boolean value is "true" for FIDELITY_TRUE * and "false" for FIDELITY_FALSE. The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * See <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> Section 15.1 for * a fuller description of the IPP fidelity attribute. * <P> * */ public final class Fidelity extends EnumSyntax implements PrintJobAttribute, PrintRequestAttribute { private static final long serialVersionUID = 6320827847329172308L; /** {@collect.stats} * The job must be printed exactly as specified. or else rejected. */ public static final Fidelity FIDELITY_TRUE = new Fidelity(0); /** {@collect.stats} * The printer should make reasonable attempts to print the job, * even if it cannot print it exactly as specified. */ public static final Fidelity FIDELITY_FALSE = new Fidelity(1); /** {@collect.stats} * Construct a new fidelity enumeration value with the * given integer value. * * @param value Integer value. */ protected Fidelity(int value) { super (value); } private static final String[] myStringTable = { "true", "false" }; private static final Fidelity[] myEnumValueTable = { FIDELITY_TRUE, FIDELITY_FALSE }; /** {@collect.stats} * Returns the string table for class Fidelity. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class Fidelity. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Fidelity the category is class Fidelity itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Fidelity.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Fidelity the category name is * <CODE>"ipp-attribute-fidelity"</CODE>. * * @return Attribute category name. */ public final String getName() { return "ipp-attribute-fidelity"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.net.URI; import javax.print.attribute.Attribute; import javax.print.attribute.URISyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterMoreInfoManufacturer is a printing attribute class, a URI, * that is used to obtain more information about this type of device. * The information obtained from this URI is intended for end user * consumption. Features outside the scope of the Print Service API * can be accessed from this URI (e.g., * latest firmware, upgrades, service proxies, optional features available, * details on color support). The information is intended to be germane to * this kind of printer without regard to site specific modifications or * services. * <P * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used * to find out more information about this specific printer rather than this * general kind of printer. * <P> * <P> * <B>IPP Compatibility:</B> The string form returned by * <CODE>toString()</CODE> gives the IPP uri value. * The category name returned by <CODE>getName()</CODE> * gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterMoreInfoManufacturer extends URISyntax implements PrintServiceAttribute { private static final long serialVersionUID = 3323271346485076608L; /** {@collect.stats} * Constructs a new printer more info manufacturer attribute with the * specified URI. * * @param uri URI. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>uri</CODE> is null. */ public PrinterMoreInfoManufacturer(URI uri) { super (uri); } /** {@collect.stats} * Returns whether this printer more info manufacturer attribute is * equivalent to the passed in object. To be equivalent, all of the * following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class * PrinterMoreInfoManufacturer. * <LI> * This printer more info manufacturer attribute's URI and * <CODE>object</CODE>'s URI are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * more info manufacturer attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterMoreInfoManufacturer); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterMoreInfoManufacturer, the category is * class PrinterMoreInfoManufacturer itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterMoreInfoManufacturer.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterMoreInfoManufacturer, the category name is * <CODE>"printer-more-info-manufacturer"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-more-info-manufacturer"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterName is a printing attribute class, a text attribute, that * specifies the name of a printer. It is a name that is more end-user friendly * than a URI. An administrator determines a printer's name and sets this * attribute to that name. This name may be the last part of the printer's URI * or it may be unrelated. In non-US-English locales, a name may contain * characters that are not allowed in a URI. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterName extends TextSyntax implements PrintServiceAttribute { private static final long serialVersionUID = 299740639137803127L; /** {@collect.stats} * Constructs a new printer name attribute with the given name and locale. * * @param printerName Printer name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>printerName</CODE> is null. */ public PrinterName(String printerName, Locale locale) { super (printerName, locale); } /** {@collect.stats} * Returns whether this printer name attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterName. * <LI> * This printer name attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This printer name attribute's locale and <CODE>object</CODE>'s locale * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * name attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterName); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterName, the category is * class PrinterName itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterName.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterName, the category * name is <CODE>"printer-name"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-name"; } }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; /** {@collect.stats} * Class MediaName is a subclass of Media, a printing attribute class (an * enumeration) that specifies the media for a print job as a name. * <P> * This attribute can be used instead of specifying MediaSize or MediaTray. * <p> * Class MediaName currently declares a few standard media names. * Implementation- or site-defined names for a media name attribute may also * be created by defining a subclass of class MediaName. * <P> * <B>IPP Compatibility:</B> MediaName is a representation class for * values of the IPP "media" attribute which names media. * <P> * */ public class MediaName extends Media implements Attribute { private static final long serialVersionUID = 4653117714524155448L; /** {@collect.stats} * white letter paper. */ public static final MediaName NA_LETTER_WHITE = new MediaName(0); /** {@collect.stats} * letter transparency. */ public static final MediaName NA_LETTER_TRANSPARENT = new MediaName(1); /** {@collect.stats} * white A4 paper. */ public static final MediaName ISO_A4_WHITE = new MediaName(2); /** {@collect.stats} * A4 transparency. */ public static final MediaName ISO_A4_TRANSPARENT= new MediaName(3); /** {@collect.stats} * Constructs a new media name enumeration value with the given integer * value. * * @param value Integer value. */ protected MediaName(int value) { super (value); } private static final String[] myStringTable = { "na-letter-white", "na-letter-transparent", "iso-a4-white", "iso-a4-transparent" }; private static final MediaName[] myEnumValueTable = { NA_LETTER_WHITE, NA_LETTER_TRANSPARENT, ISO_A4_WHITE, ISO_A4_TRANSPARENT }; /** {@collect.stats} * Returns the string table for class MediaTray. * @return the String table. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class MediaTray. * @return the enumeration value table. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PagesPerMinuteColor is an integer valued printing attribute that * indicates the nominal number of pages per minute to the nearest whole number * which may be generated by this printer when printing color (e.g., simplex, * color). For purposes of this attribute, "color" means the same as for the * {@link ColorSupported ColorSupported} attribute, namely, the device is * capable of any type of color printing at all, including highlight color as * well as full process color. This attribute is informative, not a service * guarantee. Generally, it is the value used in the marketing literature to * describe the color capabilities of this device. A value of 0 indicates a * device that takes more than two minutes to process a page. If a color device * has several color modes, it may use the pages-per- minute value for this * attribute that corresponds to the mode that produces the highest number. * <P> * A black and white only printer must not include the PagesPerMinuteColor * attribute in its attribute set or service registration. If this attribute is * present, then the {@link ColorSupported ColorSupported} printer description * attribute must also be present and have a value of SUPPORTED. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class PagesPerMinuteColor extends IntegerSyntax implements PrintServiceAttribute { static final long serialVersionUID = 1684993151687470944L; /** {@collect.stats} * Construct a new pages per minute color attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public PagesPerMinuteColor(int value) { super(value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this pages per minute color attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PagesPerMinuteColor. * <LI> * This pages per minute attribute's value and <CODE>object</CODE>'s * value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this pages per * minute color attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PagesPerMinuteColor); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PagesPerMinuteColor, the * category is class PagesPerMinuteColor itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PagesPerMinuteColor.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PagesPerMinuteColor, the * category name is <CODE>"pages-per-minute-color"</CODE>. * * @return Attribute category name. */ public final String getName() { return "pages-per-minute-color"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobPriority is an integer valued printing attribute class that * specifies a print job's priority. * <P> * If a JobPriority attribute is specified for a Print Job, it specifies a * priority for scheduling the job. A higher value specifies a higher priority. * The value 1 indicates the lowest possible priority. The value 100 indicates * the highest possible priority. Among those jobs that are ready to print, a * printer must print all jobs with a priority value of <I>n</I> before printing * those with a priority value of <I>n</I>-1 for all <I>n.</I> * <P> * If the client does not specify a JobPriority attribute for a Print Job and * the printer does support the JobPriority attribute, the printer must use an * implementation-defined default JobPriority value. * <P> * The client can always specify any job priority value from 1 to 100 for a job. * However, a Print Service instance may support fewer than 100 different * job priority levels. If this is the case, the Print Service instance * automatically maps the client-specified job priority value to one of the * supported job priority levels, dividing the 100 job priority values equally * among the available job priority levels. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class JobPriority extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -4599900369040602769L; /** {@collect.stats} * Construct a new job priority attribute with the given integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1 * or greater than 100. */ public JobPriority(int value) { super (value, 1, 100); } /** {@collect.stats} * Returns whether this job priority attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobPriority. * <LI> * This job priority attribute's value and <CODE>object</CODE>'s value * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * priority attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobPriority); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobPriority, the category is class JobPriority itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobPriority.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobPriority, the category name is <CODE>"job-priority"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-priority"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class JobKOctetsSupported is a printing attribute class, a set of integers, * that gives the supported values for a {@link JobKOctets JobKOctets} * attribute. It is restricted to a single contiguous range of integers; * multiple non-overlapping ranges are not allowed. This gives the lower and * upper bounds of the total sizes of print jobs in units of K octets (1024 * octets) that the printer will accept. * <P> * <B>IPP Compatibility:</B> The JobKOctetsSupported attribute's canonical array * form gives the lower and upper bound for the range of values to be included * in an IPP "job-k-octets-supported" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobKOctetsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = -2867871140549897443L; /** {@collect.stats} * Construct a new job K octets supported attribute containing a single * range of integers. That is, only those values of JobKOctets in the one * range are supported. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 0. */ public JobKOctetsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 0) { throw new IllegalArgumentException ("Job K octets value < 0 specified"); } } /** {@collect.stats} * Returns whether this job K octets supported attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobKOctetsSupported. * <LI> * This job K octets supported attribute's members and * <CODE>object</CODE>'s members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job K * octets supported attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobKOctetsSupported); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobKOctetsSupported, the category is class * JobKOctetsSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobKOctetsSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobKOctetsSupported, the category name is * <CODE>"job-k-octets-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-k-octets-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Chromaticity is a printing attribute class, an enumeration, that * specifies monochrome or color printing. This is used by a print client * to specify how the print data should be generated or processed. It is not * descriptive of the color capabilities of the device. Query the service's * {@link ColorSupported ColorSupported} attribute to determine if the device * can be verified to support color printing. * <P> * The table below shows the effects of specifying a Chromaticity attribute of * {@link #MONOCHROME <CODE>MONOCHROME</CODE>} or {@link #COLOR * <CODE>COLOR</CODE>} for a monochrome or color document. * <P> * <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Shows effects of specifying MONOCHROME or COLOR Chromaticity attributes"> * <TR BGCOLOR="#E5E5E5"> * <TH> * Chromaticity<BR>Attribute * </TH> * <TH> * Effect on<BR>Monochrome Document * </TH> * <TH> * Effect on<BR>Color Document * </TH> * </TR> * <TR> * <TD> * {@link #MONOCHROME <CODE>MONOCHROME</CODE>} * </TD> * <TD> * Printed as is, in monochrome * </TD> * <TD> * Printed in monochrome, with colors converted to shades of gray * </TD> * </TR> * <TR> * <TD> * {@link #COLOR <CODE>COLOR</CODE>} * </TD> * <TD> * Printed as is, in monochrome * </TD> * <TD> * Printed as is, in color * </TD> * </TR> * </TABLE> * <P> * <P> * <B>IPP Compatibility:</B> Chromaticity is not an IPP attribute at present. * <P> * * @author Alan Kaminsky */ public final class Chromaticity extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 4660543931355214012L; /** {@collect.stats} * Monochrome printing. */ public static final Chromaticity MONOCHROME = new Chromaticity(0); /** {@collect.stats} * Color printing. */ public static final Chromaticity COLOR = new Chromaticity(1); /** {@collect.stats} * Construct a new chromaticity enumeration value with the given integer * value. * * @param value Integer value. */ protected Chromaticity(int value) { super(value); } private static final String[] myStringTable = {"monochrome", "color"}; private static final Chromaticity[] myEnumValueTable = {MONOCHROME, COLOR}; /** {@collect.stats} * Returns the string table for class Chromaticity. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class Chromaticity. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Chromaticity, the category is the class Chromaticity itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Chromaticity.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Chromaticity, the category name is <CODE>"chromaticity"</CODE>. * * @return Attribute category name. */ public final String getName() { return "chromaticity"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobMediaSheets is an integer valued printing attribute class that * specifies the total number of media sheets to be produced for this job. * <P> * The JobMediaSheets attribute describes the size of the job. This attribute is * not intended to be a counter; it is intended to be useful routing and * scheduling information if known. The printer may try to compute the * JobMediaSheets attribute's value if it is not supplied in the Print Request. * Even if the client does supply a value for the JobMediaSheets attribute in * the Print Request, the printer may choose to change the value if the printer * is able to compute a value which is more accurate than the client supplied * value. The printer may be able to determine the correct value for the * JobMediaSheets attribute either right at job submission time or at any later * point in time. * <P> * Unlike the {@link JobKOctets JobKOctets} and {@link JobImpressions * JobImpressions} attributes, the JobMediaSheets value must include the * multiplicative factors contributed by the number of copies specified by the * {@link Copies Copies} attribute and a "number of copies" instruction embedded * in the document data, if any. This difference allows the system administrator * to control the lower and upper bounds of both (1) the size of the document(s) * with {@link JobKOctetsSupported JobKOctetsSupported} and {@link * JobImpressionsSupported JobImpressionsSupported} and (2) the size of the job * with {@link JobMediaSheetsSupported JobMediaSheetsSupported}. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobMediaSheetsSupported * @see JobMediaSheetsCompleted * @see JobKOctets * @see JobImpressions * * @author Alan Kaminsky */ public class JobMediaSheets extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 408871131531979741L; /** {@collect.stats} * Construct a new job media sheets attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobMediaSheets(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job media sheets attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobMediaSheets. * <LI> * This job media sheets attribute's value and <CODE>object</CODE>'s * value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job media * sheets attribute, false otherwise. */ public boolean equals(Object object) { return super.equals(object) && object instanceof JobMediaSheets; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobMediaSheets and any vendor-defined subclasses, the category * is class JobMediaSheets itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobMediaSheets.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobMediaSheets and any vendor-defined subclasses, the * category name is <CODE>"job-media-sheets"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-media-sheets"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class OutputDeviceAssigned is a printing attribute class, a text attribute, * that identifies the output device to which the service has assigned this * job. If an output device implements an embedded Print Service instance, the * printer need not set this attribute. If a print server implements a * Print Service instance, the value may be empty (zero- length string) or not * returned until the service assigns an output device to the job. This * attribute is particularly useful when a single service supports multiple * devices (so called "fan-out"). * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class OutputDeviceAssigned extends TextSyntax implements PrintJobAttribute { private static final long serialVersionUID = 5486733778854271081L; /** {@collect.stats} * Constructs a new output device assigned attribute with the given device * name and locale. * * @param deviceName Device name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>deviceName</CODE> is null. */ public OutputDeviceAssigned(String deviceName, Locale locale) { super (deviceName, locale); } // Exported operations inherited and overridden from class Object. /** {@collect.stats} * Returns whether this output device assigned attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class OutputDeviceAssigned. * <LI> * This output device assigned attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This output device assigned attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this output * device assigned attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof OutputDeviceAssigned); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class OutputDeviceAssigned, the * category is class OutputDeviceAssigned itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return OutputDeviceAssigned.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class OutputDeviceAssigned, the * category name is <CODE>"output-device-assigned"</CODE>. * * @return Attribute category name. */ public final String getName() { return "output-device-assigned"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobMessageFromOperator is a printing attribute class, a text attribute, * that provides a message from an operator, system administrator, or * "intelligent" process to indicate to the end user the reasons for * modification or other management action taken on a job. * <P> * A Print Job's attribute set includes zero instances or one instance of a * JobMessageFromOperator attribute, not more than one instance. A new * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator * attribute, if any. In other words, JobMessageFromOperator is not intended to * be a history log. If it wishes, the client can detect changes to a Print * Job's JobMessageFromOperator attribute and maintain the client's own history * log of the JobMessageFromOperator attribute values. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobMessageFromOperator extends TextSyntax implements PrintJobAttribute { private static final long serialVersionUID = -4620751846003142047L; /** {@collect.stats} * Constructs a new job message from operator attribute with the given * message and locale. * * @param message Message. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>message</CODE> is null. */ public JobMessageFromOperator(String message, Locale locale) { super (message, locale); } /** {@collect.stats} * Returns whether this job message from operator attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobMessageFromOperator. * <LI> * This job message from operator attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This job message from operator attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * message from operator attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobMessageFromOperator); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobMessageFromOperator, the * category is class JobMessageFromOperator itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobMessageFromOperator.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobMessageFromOperator, the * category name is <CODE>"job-message-from-operator"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-message-from-operator"; } }
Java
/* * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.AbstractSet; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import java.util.HashMap; import java.util.Set; import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterStateReasons is a printing attribute class, a set of * enumeration values, that provides additional information about the * printer's current state, i.e., information that augments the value of the * printer's {@link PrinterState PrinterState} attribute. * <P> * Instances of {@link PrinterStateReason PrinterStateReason} do not appear in * a Print Service's attribute set directly. Rather, a PrinterStateReasons * attribute appears in the Print Service's attribute set. The * PrinterStateReasons attribute contains zero, one, or more than one {@link * PrinterStateReason PrinterStateReason} objects which pertain to the Print * Service's status, and each {@link PrinterStateReason PrinterStateReason} * object is associated with a {@link Severity Severity} level of REPORT * (least severe), WARNING, or ERROR (most severe). The printer adds a {@link * PrinterStateReason PrinterStateReason} object to the Print Service's * PrinterStateReasons attribute when the corresponding condition becomes true * of the printer, and the printer removes the {@link PrinterStateReason * PrinterStateReason} object again when the corresponding condition becomes * false, regardless of whether the Print Service's overall * {@link PrinterState PrinterState} also changed. * <P> * Class PrinterStateReasons inherits its implementation from class {@link * java.util.HashMap java.util.HashMap}. Each entry in the map consists of a * {@link PrinterStateReason PrinterStateReason} object (key) mapping to a * {@link Severity Severity} object (value): * <P> * Unlike most printing attributes which are immutable once constructed, class * PrinterStateReasons is designed to be mutable; you can add {@link * PrinterStateReason PrinterStateReason} objects to an existing * PrinterStateReasons object and remove them again. However, like class * {@link java.util.HashMap java.util.HashMap}, class PrinterStateReasons is * bot multiple thread safe. If a PrinterStateReasons object will be used by * multiple threads, be sure to synchronize its operations (e.g., using a * synchronized map view obtained from class {@link java.util.Collections * java.util.Collections}). * <P> * <B>IPP Compatibility:</B> The string values returned by each individual * {@link PrinterStateReason PrinterStateReason} object's and the associated * {@link Severity Severity} object's <CODE>toString()</CODE> methods, * concatenated * together with a hyphen (<CODE>"-"</CODE>) in between, gives the IPP keyword * value. The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterStateReasons extends HashMap<PrinterStateReason,Severity> implements PrintServiceAttribute { private static final long serialVersionUID = -3731791085163619457L; /** {@collect.stats} * Construct a new, empty printer state reasons attribute; the underlying * hash map has the default initial capacity and load factor. */ public PrinterStateReasons() { super(); } /** {@collect.stats} * super a new, empty printer state reasons attribute; the underlying * hash map has the given initial capacity and the default load factor. * * @param initialCapacity Initial capacity. * * @throws IllegalArgumentException if the initial capacity is less * than zero. */ public PrinterStateReasons(int initialCapacity) { super (initialCapacity); } /** {@collect.stats} * Construct a new, empty printer state reasons attribute; the underlying * hash map has the given initial capacity and load factor. * * @param initialCapacity Initial capacity. * @param loadFactor Load factor. * * @throws IllegalArgumentException if the initial capacity is less * than zero. */ public PrinterStateReasons(int initialCapacity, float loadFactor) { super (initialCapacity, loadFactor); } /** {@collect.stats} * Construct a new printer state reasons attribute that contains the same * {@link PrinterStateReason PrinterStateReason}-to-{@link Severity * Severity} mappings as the given map. The underlying hash map's initial * capacity and load factor are as specified in the superclass constructor * {@link java.util.HashMap#HashMap(java.util.Map) * <CODE>HashMap(Map)</CODE>}. * * @param map Map to copy. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>map</CODE> is null or if any * key or value in <CODE>map</CODE> is null. * @throws ClassCastException * (unchecked exception) Thrown if any key in <CODE>map</CODE> is not * an instance of class {@link PrinterStateReason PrinterStateReason} or * if any value in <CODE>map</CODE> is not an instance of class * {@link Severity Severity}. */ public PrinterStateReasons(Map<PrinterStateReason,Severity> map) { this(); for (Map.Entry<PrinterStateReason,Severity> e : map.entrySet()) put(e.getKey(), e.getValue()); } /** {@collect.stats} * Adds the given printer state reason to this printer state reasons * attribute, associating it with the given severity level. If this * printer state reasons attribute previously contained a mapping for the * given printer state reason, the old value is replaced. * * @param reason Printer state reason. This must be an instance of * class {@link PrinterStateReason PrinterStateReason}. * @param severity Severity of the printer state reason. This must be * an instance of class {@link Severity Severity}. * * @return Previous severity associated with the given printer state * reason, or <tt>null</tt> if the given printer state reason was * not present. * * @throws NullPointerException * (unchecked exception) Thrown if <CODE>reason</CODE> is null or * <CODE>severity</CODE> is null. * @throws ClassCastException * (unchecked exception) Thrown if <CODE>reason</CODE> is not an * instance of class {@link PrinterStateReason PrinterStateReason} or if * <CODE>severity</CODE> is not an instance of class {@link Severity * Severity}. * @since 1.5 */ public Severity put(PrinterStateReason reason, Severity severity) { if (reason == null) { throw new NullPointerException("reason is null"); } if (severity == null) { throw new NullPointerException("severity is null"); } return super.put((PrinterStateReason) reason, (Severity) severity); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterStateReasons, the * category is class PrinterStateReasons itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterStateReasons.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterStateReasons, the * category name is <CODE>"printer-state-reasons"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-state-reasons"; } /** {@collect.stats} * Obtain an unmodifiable set view of the individual printer state reason * attributes at the given severity level in this PrinterStateReasons * attribute. Each element in the set view is a {@link PrinterStateReason * PrinterStateReason} object. The only elements in the set view are the * {@link PrinterStateReason PrinterStateReason} objects that map to the * given severity value. The set view is backed by this * PrinterStateReasons attribute, so changes to this PrinterStateReasons * attribute are reflected in the set view. * The set view does not support element insertion or * removal. The set view's iterator does not support element removal. * * @param severity Severity level. * * @return Set view of the individual {@link PrinterStateReason * PrinterStateReason} attributes at the given {@link Severity * Severity} level. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>severity</CODE> is null. */ public Set<PrinterStateReason> printerStateReasonSet(Severity severity) { if (severity == null) { throw new NullPointerException("severity is null"); } return new PrinterStateReasonSet (severity, entrySet()); } private class PrinterStateReasonSet extends AbstractSet<PrinterStateReason> { private Severity mySeverity; private Set myEntrySet; public PrinterStateReasonSet(Severity severity, Set entrySet) { mySeverity = severity; myEntrySet = entrySet; } public int size() { int result = 0; Iterator iter = iterator(); while (iter.hasNext()) { iter.next(); ++ result; } return result; } public Iterator iterator() { return new PrinterStateReasonSetIterator(mySeverity, myEntrySet.iterator()); } } private class PrinterStateReasonSetIterator implements Iterator { private Severity mySeverity; private Iterator myIterator; private Map.Entry myEntry; public PrinterStateReasonSetIterator(Severity severity, Iterator iterator) { mySeverity = severity; myIterator = iterator; goToNext(); } private void goToNext() { myEntry = null; while (myEntry == null && myIterator.hasNext()) { myEntry = (Map.Entry) myIterator.next(); if ((Severity) myEntry.getValue() != mySeverity) { myEntry = null; } } } public boolean hasNext() { return myEntry != null; } public Object next() { if (myEntry == null) { throw new NoSuchElementException(); } Object result = myEntry.getKey(); goToNext(); return result; } public void remove() { throw new UnsupportedOperationException(); } } }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class MediaSizeName is a subclass of Media. * <P> * This attribute can be used instead of specifying MediaName or MediaTray. * <p> * Class MediaSizeName currently declares a few standard media * name values. * <P> * <B>IPP Compatibility:</B> MediaSizeName is a representation class for * values of the IPP "media" attribute which names media sizes. * The names of the media sizes correspond to those in the IPP 1.1 RFC * <a HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> * <P> * */ public class MediaSizeName extends Media { private static final long serialVersionUID = 2778798329756942747L; /** {@collect.stats} * A0 size. */ public static final MediaSizeName ISO_A0 = new MediaSizeName(0); /** {@collect.stats} * A1 size. */ public static final MediaSizeName ISO_A1 = new MediaSizeName(1); /** {@collect.stats} * A2 size. */ public static final MediaSizeName ISO_A2 = new MediaSizeName(2); /** {@collect.stats} * A3 size. */ public static final MediaSizeName ISO_A3 = new MediaSizeName(3); /** {@collect.stats} * A4 size. */ public static final MediaSizeName ISO_A4 = new MediaSizeName(4); /** {@collect.stats} * A5 size. */ public static final MediaSizeName ISO_A5 = new MediaSizeName(5); /** {@collect.stats} * A6 size. */ public static final MediaSizeName ISO_A6 = new MediaSizeName(6); /** {@collect.stats} * A7 size. */ public static final MediaSizeName ISO_A7 = new MediaSizeName(7); /** {@collect.stats} * A8 size. */ public static final MediaSizeName ISO_A8 = new MediaSizeName(8); /** {@collect.stats} * A9 size. */ public static final MediaSizeName ISO_A9 = new MediaSizeName(9); /** {@collect.stats} * A10 size. */ public static final MediaSizeName ISO_A10 = new MediaSizeName(10); /** {@collect.stats} * ISO B0 size. */ public static final MediaSizeName ISO_B0 = new MediaSizeName(11); /** {@collect.stats} * ISO B1 size. */ public static final MediaSizeName ISO_B1 = new MediaSizeName(12); /** {@collect.stats} * ISO B2 size. */ public static final MediaSizeName ISO_B2 = new MediaSizeName(13); /** {@collect.stats} * ISO B3 size. */ public static final MediaSizeName ISO_B3 = new MediaSizeName(14); /** {@collect.stats} * ISO B4 size. */ public static final MediaSizeName ISO_B4 = new MediaSizeName(15); /** {@collect.stats} * ISO B5 size. */ public static final MediaSizeName ISO_B5 = new MediaSizeName(16); /** {@collect.stats} * ISO B6 size. */ public static final MediaSizeName ISO_B6 = new MediaSizeName(17); /** {@collect.stats} * ISO B7 size. */ public static final MediaSizeName ISO_B7 = new MediaSizeName(18); /** {@collect.stats} * ISO B8 size. */ public static final MediaSizeName ISO_B8 = new MediaSizeName(19); /** {@collect.stats} * ISO B9 size. */ public static final MediaSizeName ISO_B9 = new MediaSizeName(20); /** {@collect.stats} * ISO B10 size. */ public static final MediaSizeName ISO_B10 = new MediaSizeName(21); /** {@collect.stats} * JIS B0 size. */ public static final MediaSizeName JIS_B0 = new MediaSizeName(22); /** {@collect.stats} * JIS B1 size. */ public static final MediaSizeName JIS_B1 = new MediaSizeName(23); /** {@collect.stats} * JIS B2 size. */ public static final MediaSizeName JIS_B2 = new MediaSizeName(24); /** {@collect.stats} * JIS B3 size. */ public static final MediaSizeName JIS_B3 = new MediaSizeName(25); /** {@collect.stats} * JIS B4 size. */ public static final MediaSizeName JIS_B4 = new MediaSizeName(26); /** {@collect.stats} * JIS B5 size. */ public static final MediaSizeName JIS_B5 = new MediaSizeName(27); /** {@collect.stats} * JIS B6 size. */ public static final MediaSizeName JIS_B6 = new MediaSizeName(28); /** {@collect.stats} * JIS B7 size. */ public static final MediaSizeName JIS_B7 = new MediaSizeName(29); /** {@collect.stats} * JIS B8 size. */ public static final MediaSizeName JIS_B8 = new MediaSizeName(30); /** {@collect.stats} * JIS B9 size. */ public static final MediaSizeName JIS_B9 = new MediaSizeName(31); /** {@collect.stats} * JIS B10 size. */ public static final MediaSizeName JIS_B10 = new MediaSizeName(32); /** {@collect.stats} * ISO C0 size. */ public static final MediaSizeName ISO_C0 = new MediaSizeName(33); /** {@collect.stats} * ISO C1 size. */ public static final MediaSizeName ISO_C1 = new MediaSizeName(34); /** {@collect.stats} * ISO C2 size. */ public static final MediaSizeName ISO_C2 = new MediaSizeName(35); /** {@collect.stats} * ISO C3 size. */ public static final MediaSizeName ISO_C3 = new MediaSizeName(36); /** {@collect.stats} * ISO C4 size. */ public static final MediaSizeName ISO_C4 = new MediaSizeName(37); /** {@collect.stats} * ISO C5 size. */ public static final MediaSizeName ISO_C5 = new MediaSizeName(38); /** {@collect.stats} * letter size. */ public static final MediaSizeName ISO_C6 = new MediaSizeName(39); /** {@collect.stats} * letter size. */ public static final MediaSizeName NA_LETTER = new MediaSizeName(40); /** {@collect.stats} * legal size . */ public static final MediaSizeName NA_LEGAL = new MediaSizeName(41); /** {@collect.stats} * executive size . */ public static final MediaSizeName EXECUTIVE = new MediaSizeName(42); /** {@collect.stats} * ledger size . */ public static final MediaSizeName LEDGER = new MediaSizeName(43); /** {@collect.stats} * tabloid size . */ public static final MediaSizeName TABLOID = new MediaSizeName(44); /** {@collect.stats} * invoice size . */ public static final MediaSizeName INVOICE = new MediaSizeName(45); /** {@collect.stats} * folio size . */ public static final MediaSizeName FOLIO = new MediaSizeName(46); /** {@collect.stats} * quarto size . */ public static final MediaSizeName QUARTO = new MediaSizeName(47); /** {@collect.stats} * Japanese Postcard size. */ public static final MediaSizeName JAPANESE_POSTCARD = new MediaSizeName(48); /** {@collect.stats} * Japanese Double Postcard size. */ public static final MediaSizeName JAPANESE_DOUBLE_POSTCARD = new MediaSizeName(49); /** {@collect.stats} * A size . */ public static final MediaSizeName A = new MediaSizeName(50); /** {@collect.stats} * B size . */ public static final MediaSizeName B = new MediaSizeName(51); /** {@collect.stats} * C size . */ public static final MediaSizeName C = new MediaSizeName(52); /** {@collect.stats} * D size . */ public static final MediaSizeName D = new MediaSizeName(53); /** {@collect.stats} * E size . */ public static final MediaSizeName E = new MediaSizeName(54); /** {@collect.stats} * ISO designated long size . */ public static final MediaSizeName ISO_DESIGNATED_LONG = new MediaSizeName(55); /** {@collect.stats} * Italy envelope size . */ public static final MediaSizeName ITALY_ENVELOPE = new MediaSizeName(56); // DESIGNATED_LONG? /** {@collect.stats} * monarch envelope size . */ public static final MediaSizeName MONARCH_ENVELOPE = new MediaSizeName(57); /** {@collect.stats} * personal envelope size . */ public static final MediaSizeName PERSONAL_ENVELOPE = new MediaSizeName(58); /** {@collect.stats} * number 9 envelope size . */ public static final MediaSizeName NA_NUMBER_9_ENVELOPE = new MediaSizeName(59); /** {@collect.stats} * number 10 envelope size . */ public static final MediaSizeName NA_NUMBER_10_ENVELOPE = new MediaSizeName(60); /** {@collect.stats} * number 11 envelope size . */ public static final MediaSizeName NA_NUMBER_11_ENVELOPE = new MediaSizeName(61); /** {@collect.stats} * number 12 envelope size . */ public static final MediaSizeName NA_NUMBER_12_ENVELOPE = new MediaSizeName(62); /** {@collect.stats} * number 14 envelope size . */ public static final MediaSizeName NA_NUMBER_14_ENVELOPE = new MediaSizeName(63); /** {@collect.stats} * 6x9 North American envelope size. */ public static final MediaSizeName NA_6X9_ENVELOPE = new MediaSizeName(64); /** {@collect.stats} * 7x9 North American envelope size. */ public static final MediaSizeName NA_7X9_ENVELOPE = new MediaSizeName(65); /** {@collect.stats} * 9x11 North American envelope size. */ public static final MediaSizeName NA_9X11_ENVELOPE = new MediaSizeName(66); /** {@collect.stats} * 9x12 North American envelope size. */ public static final MediaSizeName NA_9X12_ENVELOPE = new MediaSizeName(67); /** {@collect.stats} * 10x13 North American envelope size . */ public static final MediaSizeName NA_10X13_ENVELOPE = new MediaSizeName(68); /** {@collect.stats} * 10x14North American envelope size . */ public static final MediaSizeName NA_10X14_ENVELOPE = new MediaSizeName(69); /** {@collect.stats} * 10x15 North American envelope size. */ public static final MediaSizeName NA_10X15_ENVELOPE = new MediaSizeName(70); /** {@collect.stats} * 5x7 North American paper. */ public static final MediaSizeName NA_5X7 = new MediaSizeName(71); /** {@collect.stats} * 8x10 North American paper. */ public static final MediaSizeName NA_8X10 = new MediaSizeName(72); /** {@collect.stats} * Construct a new media size enumeration value with the given integer * value. * * @param value Integer value. */ protected MediaSizeName(int value) { super (value); } private static final String[] myStringTable = { "iso-a0", "iso-a1", "iso-a2", "iso-a3", "iso-a4", "iso-a5", "iso-a6", "iso-a7", "iso-a8", "iso-a9", "iso-a10", "iso-b0", "iso-b1", "iso-b2", "iso-b3", "iso-b4", "iso-b5", "iso-b6", "iso-b7", "iso-b8", "iso-b9", "iso-b10", "jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5", "jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0", "iso-c1", "iso-c2", "iso-c3", "iso-c4", "iso-c5", "iso-c6", "na-letter", "na-legal", "executive", "ledger", "tabloid", "invoice", "folio", "quarto", "japanese-postcard", "oufuko-postcard", "a", "b", "c", "d", "e", "iso-designated-long", "italian-envelope", "monarch-envelope", "personal-envelope", "na-number-9-envelope", "na-number-10-envelope", "na-number-11-envelope", "na-number-12-envelope", "na-number-14-envelope", "na-6x9-envelope", "na-7x9-envelope", "na-9x11-envelope", "na-9x12-envelope", "na-10x13-envelope", "na-10x14-envelope", "na-10x15-envelope", "na-5x7", "na-8x10", }; private static final MediaSizeName[] myEnumValueTable = { ISO_A0, ISO_A1, ISO_A2, ISO_A3, ISO_A4, ISO_A5, ISO_A6, ISO_A7, ISO_A8, ISO_A9, ISO_A10, ISO_B0, ISO_B1, ISO_B2, ISO_B3, ISO_B4, ISO_B5, ISO_B6, ISO_B7, ISO_B8, ISO_B9, ISO_B10, JIS_B0, JIS_B1, JIS_B2, JIS_B3, JIS_B4, JIS_B5, JIS_B6, JIS_B7, JIS_B8, JIS_B9, JIS_B10, ISO_C0, ISO_C1, ISO_C2, ISO_C3, ISO_C4, ISO_C5, ISO_C6, NA_LETTER, NA_LEGAL, EXECUTIVE, LEDGER, TABLOID, INVOICE, FOLIO, QUARTO, JAPANESE_POSTCARD, JAPANESE_DOUBLE_POSTCARD, A, B, C, D, E, ISO_DESIGNATED_LONG, ITALY_ENVELOPE, MONARCH_ENVELOPE, PERSONAL_ENVELOPE, NA_NUMBER_9_ENVELOPE, NA_NUMBER_10_ENVELOPE, NA_NUMBER_11_ENVELOPE, NA_NUMBER_12_ENVELOPE, NA_NUMBER_14_ENVELOPE, NA_6X9_ENVELOPE, NA_7X9_ENVELOPE, NA_9X11_ENVELOPE, NA_9X12_ENVELOPE, NA_10X13_ENVELOPE, NA_10X14_ENVELOPE, NA_10X15_ENVELOPE, NA_5X7, NA_8X10, }; /** {@collect.stats} * Returns the string table for class MediaSizeName. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class MediaSizeName. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; /** {@collect.stats} * Class Compression is a printing attribute class, an enumeration, that * specifies how print data is compressed. Compression is an attribute of the * print data (the doc), not of the Print Job. If a Compression attribute is not * specified for a doc, the printer assumes the doc's print data is uncompressed * (i.e., the default Compression value is always {@link #NONE * <CODE>NONE</CODE>}). * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public class Compression extends EnumSyntax implements DocAttribute { private static final long serialVersionUID = -5716748913324997674L; /** {@collect.stats} * No compression is used. */ public static final Compression NONE = new Compression(0); /** {@collect.stats} * ZIP public domain inflate/deflate compression technology. */ public static final Compression DEFLATE = new Compression(1); /** {@collect.stats} * GNU zip compression technology described in * <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>. */ public static final Compression GZIP = new Compression(2); /** {@collect.stats} * UNIX compression technology. */ public static final Compression COMPRESS = new Compression(3); /** {@collect.stats} * Construct a new compression enumeration value with the given integer * value. * * @param value Integer value. */ protected Compression(int value) { super(value); } private static final String[] myStringTable = {"none", "deflate", "gzip", "compress"}; private static final Compression[] myEnumValueTable = {NONE, DEFLATE, GZIP, COMPRESS}; /** {@collect.stats} * Returns the string table for class Compression. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class Compression. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Compression and any vendor-defined subclasses, the category is * class Compression itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Compression.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Compression and any vendor-defined subclasses, the category * name is <CODE>"compression"</CODE>. * * @return Attribute category name. */ public final String getName() { return "compression"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterMakeAndModel is a printing attribute class, a text attribute, * that the make and model of the printer. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterMakeAndModel extends TextSyntax implements PrintServiceAttribute { private static final long serialVersionUID = 4580461489499351411L; /** {@collect.stats} * Constructs a new printer make and model attribute with the given make * and model string and locale. * * @param makeAndModel Printer make and model string. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>makeAndModel</CODE> is null. */ public PrinterMakeAndModel(String makeAndModel, Locale locale) { super (makeAndModel, locale); } /** {@collect.stats} * Returns whether this printer make and model attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterMakeAndModel. * <LI> * This printer make and model attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This printer make and model attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * make and model attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterMakeAndModel); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterMakeAndModel, the * category is class PrinterMakeAndModel itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterMakeAndModel.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterMakeAndModel, the * category name is <CODE>"printer-make-and-model"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-make-and-model"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.net.URI; import javax.print.attribute.Attribute; import javax.print.attribute.URISyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterMoreInfo is a printing attribute class, a URI, that is used to * obtain more information about this specific printer. For example, this * could be an HTTP type URI referencing an HTML page accessible to a web * browser. The information obtained from this URI is intended for end user * consumption. Features outside the scope of the Print Service API can be * accessed from this URI. * The information is intended to be specific to this printer instance and * site specific services (e.g. job pricing, services offered, end user * assistance). * <P> * In contrast, the {@link PrinterMoreInfoManufacturer * PrinterMoreInfoManufacturer} attribute is used to find out more information * about this general kind of printer rather than this specific printer. * <P> * <B>IPP Compatibility:</B> The string form returned by * <CODE>toString()</CODE> gives the IPP uri value. * The category name returned by <CODE>getName()</CODE> * gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterMoreInfo extends URISyntax implements PrintServiceAttribute { private static final long serialVersionUID = 4555850007675338574L; /** {@collect.stats} * Constructs a new printer more info attribute with the specified URI. * * @param uri URI. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>uri</CODE> is null. */ public PrinterMoreInfo(URI uri) { super (uri); } /** {@collect.stats} * Returns whether this printer more info attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterMoreInfo. * <LI> * This printer more info attribute's URI and <CODE>object</CODE>'s URI * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * more info attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterMoreInfo); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterMoreInfo, the category is class PrinterMoreInfo itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterMoreInfo.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterMoreInfo, the * category name is <CODE>"printer-more-info"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-more-info"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class NumberUpSupported is a printing attribute class, a set of integers, * that gives the supported values for a {@link NumberUp NumberUp} attribute. * <P> * <B>IPP Compatibility:</B> The NumberUpSupported attribute's canonical array * form gives the lower and upper bound for each range of number-up to be * included in an IPP "number-up-supported" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class NumberUpSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = -1041573395759141805L; /** {@collect.stats} * Construct a new number up supported attribute with the given members. * The supported values for NumberUp are specified in "array form;" see * class * {@link javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} * for an explanation of array form. * * @param members Set members in array form. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>members</CODE> is null or * any element of <CODE>members</CODE> is null. * @exception IllegalArgumentException * (unchecked exception) Thrown if any element of * <CODE>members</CODE> is not a length-one or length-two array. Also * thrown if <CODE>members</CODE> is a zero-length array or if any * member of the set is less than 1. */ public NumberUpSupported(int[][] members) { super (members); if (members == null) { throw new NullPointerException("members is null"); } int[][] myMembers = getMembers(); int n = myMembers.length; if (n == 0) { throw new IllegalArgumentException("members is zero-length"); } int i; for (i = 0; i < n; ++ i) { if (myMembers[i][0] < 1) { throw new IllegalArgumentException ("Number up value must be > 0"); } } } /** {@collect.stats} * Construct a new number up supported attribute containing a single * integer. That is, only the one value of NumberUp is supported. * * @param member Set member. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>member</CODE> is less than * 1. */ public NumberUpSupported(int member) { super (member); if (member < 1) { throw new IllegalArgumentException("Number up value must be > 0"); } } /** {@collect.stats} * Construct a new number up supported attribute containing a single range * of integers. That is, only those values of NumberUp in the one range are * supported. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 1. */ public NumberUpSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 1) { throw new IllegalArgumentException ("Number up value must be > 0"); } } /** {@collect.stats} * Returns whether this number up supported attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class NumberUpSupported. * <LI> * This number up supported attribute's members and <CODE>object</CODE>'s * members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this number up * supported attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof NumberUpSupported); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class NumberUpSupported, the * category is class NumberUpSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return NumberUpSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class NumberUpSupported, the * category name is <CODE>"number-up-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "number-up-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class JobPrioritySupported is an integer valued printing attribute class * that specifies whether a Print Service instance supports the {@link * JobPriority JobPriority} attribute and the number of different job priority * levels supported. * <P> * The client can always specify any {@link JobPriority JobPriority} value * from 1 to 100 for a job. However, the Print Service instance may support * fewer than 100 different job priority levels. If this is the case, the * Print Service instance automatically maps the client-specified job priority * value to one of the supported job priority levels, dividing the 100 job * priority values equally among the available job priority levels. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class JobPrioritySupported extends IntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = 2564840378013555894L; /** {@collect.stats} * Construct a new job priority supported attribute with the given integer * value. * * @param value Number of different job priority levels supported. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1 * or greater than 100. */ public JobPrioritySupported(int value) { super (value, 1, 100); } /** {@collect.stats} * Returns whether this job priority supported attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobPrioritySupported. * <LI> * This job priority supported attribute's value and * <CODE>object</CODE>'s value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * priority supported attribute, false otherwise. */ public boolean equals (Object object) { return (super.equals(object) && object instanceof JobPrioritySupported); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobPrioritySupported, the * category is class JobPrioritySupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobPrioritySupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobPrioritySupported, the * category name is <CODE>"job-priority-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-priority-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class NumberOfDocuments is an integer valued printing attribute that * indicates the number of individual docs the printer has accepted for this * job, regardless of whether the docs' print data has reached the printer or * not. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class NumberOfDocuments extends IntegerSyntax implements PrintJobAttribute { private static final long serialVersionUID = 7891881310684461097L; /** {@collect.stats} * Construct a new number of documents attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public NumberOfDocuments(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this number of documents attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class NumberOfDocuments. * <LI> * This number of documents attribute's value and <CODE>object</CODE>'s * value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this number of * documents attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof NumberOfDocuments); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class NumberOfDocuments, the * category is class NumberOfDocuments itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return NumberOfDocuments.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class NumberOfDocuments, the * category name is <CODE>"number-of-documents"</CODE>. * * @return Attribute category name. */ public final String getName() { return "number-of-documents"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Sides is a printing attribute class, an enumeration, that specifies * how print-stream pages are to be imposed upon the sides of an instance of a * selected medium, i.e., an impression. * <P> * The effect of a Sides attribute on a multidoc print job (a job with multiple * documents) depends on whether all the docs have the same sides values * specified or whether different docs have different sides values specified, * and on the (perhaps defaulted) value of the {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same sides value <I>n</I> specified, then any value * of {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, * and the printer's processing depends on the {@link MultipleDocumentHandling * MultipleDocumentHandling} value: * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media sheet will consist of <I>n</I> impressions from * the output document. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media sheet will consist of <I>n</I> * impressions from the output document. However, the first impression of each * input doc will always start on a new media sheet; this means the last media * sheet of an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * Each media sheet will consist of <I>n</I> impressions from the input doc. * Since the input docs are separate, the first impression of each input doc * will always start on a new media sheet; this means the last media sheet of * an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * Each media sheet will consist of <I>n</I> impressions from the input doc. * Since the input docs are separate, the first impression of each input doc * will always start on a new media sheet; this means the last media sheet of * an input doc may have only one impression on it. * </UL> * <P> * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the output document, where <I>i</I> is the number of the * input doc corresponding to that point in the output document. When the next * input doc has a different sides value from the previous input doc, the first * print-stream page of the next input doc goes at the start of the next media * sheet, possibly leaving only one impression on the previous media sheet. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media sheet will consist of <I>n</I> * impressions from the output document. However, the first impression of each * input doc will always start on a new media sheet; this means the last * impression of an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the input doc. Since the input docs are separate, the first * impression of each input doc will always start on a new media sheet; this * means the last media sheet of an input doc may have only one impression on * it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the input doc. Since the input docs are separate, the first * impression of each input doc will always start on a new media sheet; this * means the last media sheet of an input doc may have only one impression on * it. * </UL> * </UL> * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class Sides extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -6890309414893262822L; /** {@collect.stats} * Imposes each consecutive print-stream page upon the same side of * consecutive media sheets. */ public static final Sides ONE_SIDED = new Sides(0); /** {@collect.stats} * Imposes each consecutive pair of print-stream pages upon front and back * sides of consecutive media sheets, such that the orientation of each * pair of print-stream pages on the medium would be correct for the * reader as if for binding on the long edge. This imposition is also * known as "duplex" (see {@link #DUPLEX <CODE>DUPLEX</CODE>}). */ public static final Sides TWO_SIDED_LONG_EDGE = new Sides(1); /** {@collect.stats} * Imposes each consecutive pair of print-stream pages upon front and back * sides of consecutive media sheets, such that the orientation of each * pair of print-stream pages on the medium would be correct for the * reader as if for binding on the short edge. This imposition is also * known as "tumble" (see {@link #TUMBLE <CODE>TUMBLE</CODE>}). */ public static final Sides TWO_SIDED_SHORT_EDGE = new Sides(2); /** {@collect.stats} * An alias for "two sided long edge" (see {@link #TWO_SIDED_LONG_EDGE * <CODE>TWO_SIDED_LONG_EDGE</CODE>}). */ public static final Sides DUPLEX = TWO_SIDED_LONG_EDGE; /** {@collect.stats} * An alias for "two sided short edge" (see {@link #TWO_SIDED_SHORT_EDGE * <CODE>TWO_SIDED_SHORT_EDGE</CODE>}). */ public static final Sides TUMBLE = TWO_SIDED_SHORT_EDGE; /** {@collect.stats} * Construct a new sides enumeration value with the given integer value. * * @param value Integer value. */ protected Sides(int value) { super (value); } private static final String[] myStringTable = { "one-sided", "two-sided-long-edge", "two-sided-short-edge" }; private static final Sides[] myEnumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, TWO_SIDED_SHORT_EDGE }; /** {@collect.stats} * Returns the string table for class Sides. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class Sides. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Sides, the category is class Sides itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Sides.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Sides, the category name is <CODE>"sides"</CODE>. * * @return Attribute category name. */ public final String getName() { return "sides"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class CopiesSupported is a printing attribute class, a set of integers, that * gives the supported values for a {@link Copies Copies} attribute. It is * restricted to a single contiguous range of integers; multiple non-overlapping * ranges are not allowed. * <P> * <B>IPP Compatibility:</B> The CopiesSupported attribute's canonical array * form gives the lower and upper bound for the range of copies to be included * in an IPP "copies-supported" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class CopiesSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = 6927711687034846001L; /** {@collect.stats} * Construct a new copies supported attribute containing a single integer. * That is, only the one value of Copies is supported. * * @param member Set member. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>member</CODE> is less than 1. */ public CopiesSupported(int member) { super (member); if (member < 1) { throw new IllegalArgumentException("Copies value < 1 specified"); } } /** {@collect.stats} * Construct a new copies supported attribute containing a single range of * integers. That is, only those values of Copies in the one range are * supported. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 1. */ public CopiesSupported(int lowerBound, int upperBound) { super(lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 1) { throw new IllegalArgumentException("Copies value < 1 specified"); } } /** {@collect.stats} * Returns whether this copies supported attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class CopiesSupported. * <LI> * This copies supported attribute's members and <CODE>object</CODE>'s * members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this copies * supported attribute, false otherwise. */ public boolean equals(Object object) { return super.equals (object) && object instanceof CopiesSupported; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class CopiesSupported, the category * is class CopiesSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return CopiesSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class CopiesSupported, the category * name is <CODE>"copies-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "copies-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterInfo is a printing attribute class, a text attribute, that * provides descriptive information about a printer. This could include things * like: <CODE>"This printer can be used for printing color transparencies for * HR presentations"</CODE>, or <CODE>"Out of courtesy for others, please * print only small (1-5 page) jobs at this printer"</CODE>, or even \ * <CODE>"This printer is going away on July 1, 1997, please find a new * printer"</CODE>. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterInfo extends TextSyntax implements PrintServiceAttribute { private static final long serialVersionUID = 7765280618777599727L; /** {@collect.stats} * Constructs a new printer info attribute with the given information * string and locale. * * @param info Printer information string. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>info</CODE> is null. */ public PrinterInfo(String info, Locale locale) { super (info, locale); } /** {@collect.stats} * Returns whether this printer info attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterInfo. * <LI> * This printer info attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This printer info attribute's locale and <CODE>object</CODE>'s * locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * info attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterInfo); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterInfo, the category is class PrinterInfo itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterInfo.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterInfo, the category name is <CODE>"printer-info"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-info"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class QueuedJobCount is an integer valued printing attribute that indicates * the number of jobs in the printer whose {@link JobState JobState} is either * PENDING, PENDING_HELD, PROCESSING, or PROCESSING_STOPPED. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class QueuedJobCount extends IntegerSyntax implements PrintServiceAttribute { private static final long serialVersionUID = 7499723077864047742L; /** {@collect.stats} * Construct a new queued job count attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public QueuedJobCount(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this queued job count attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * mus be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class QueuedJobCount. * <LI> * This queued job count attribute's value and <CODE>object</CODE>'s * value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this queued job * count attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof QueuedJobCount); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class QueuedJobCount, the category is class QueuedJobCount itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return QueuedJobCount.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class QueuedJobCount, the * category name is <CODE>"queued-job-count"</CODE>. * * @return Attribute category name. */ public final String getName() { return "queued-job-count"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Copies is an integer valued printing attribute class that specifies the * number of copies to be printed. * <P> * On many devices the supported number of collated copies will be limited by * the number of physical output bins on the device, and may be different from * the number of uncollated copies which can be supported. * <P> * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print * job (a job with multiple documents) depends on the (perhaps defaulted) value * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute: * <UL> * <LI> * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output * document comprising all the input docs. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single * output document comprising all the input docs, and the first impression of * each input doc will always start on a new media sheet. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of * the first input document, followed by <I>n</I> copies of the second input * document, . . . followed by <I>n</I> copies of the last input document. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input * document, the second input document, . . . the last input document, the group * of documents being repeated <I>n</I> times. * </UL> * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author David Mendenhall * @author Alan Kamihensky */ public final class Copies extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -6426631521680023833L; /** {@collect.stats} * Construct a new copies attribute with the given integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1. */ public Copies(int value) { super (value, 1, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this copies attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class Copies. * <LI> * This copies attribute's value and <CODE>object</CODE>'s value are * equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this copies * attribute, false otherwise. */ public boolean equals(Object object) { return super.equals (object) && object instanceof Copies; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Copies, the category is class Copies itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Copies.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Copies, the category name is <CODE>"copies"</CODE>. * * @return Attribute category name. */ public final String getName() { return "copies"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterLocation is a printing attribute class, a text attribute, that * identifies the location of the device. This could include things like: * <CODE>"in Room 123A, second floor of building XYZ"</CODE>. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterLocation extends TextSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -1598610039865566337L; /** {@collect.stats} * Constructs a new printer location attribute with the given location and * locale. * * @param location Printer location. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>location</CODE> is null. */ public PrinterLocation(String location, Locale locale) { super (location, locale); } /** {@collect.stats} * Returns whether this printer location attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterLocation. * <LI> * This printer location attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This printer location attribute's locale and <CODE>object</CODE>'s * locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * location attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterLocation); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterLocation, the * category is class PrinterLocation itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterLocation.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterLocation, the * category name is <CODE>"printer-location"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-location"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; /** {@collect.stats} * Class MediaPrintableArea is a printing attribute used to distinguish * the printable and non-printable areas of media. * <p> * The printable area is specified to be a rectangle, within the overall * dimensions of a media. * <p> * Most printers cannot print on the entire surface of the media, due * to printer hardware limitations. This class can be used to query * the acceptable values for a supposed print job, and to request an area * within the constraints of the printable area to be used in a print job. * <p> * To query for the printable area, a client must supply a suitable context. * Without specifying at the very least the size of the media being used * no meaningful value for printable area can be obtained. * <p> * The attribute is not described in terms of the distance from the edge * of the paper, in part to emphasise that this attribute is not independent * of a particular media, but must be described within the context of a * choice of other attributes. Additionally it is usually more convenient * for a client to use the printable area. * <p> * The hardware's minimum margins is not just a property of the printer, * but may be a function of the media size, orientation, media type, and * any specified finishings. * <code>PrintService</code> provides the method to query the supported * values of an attribute in a suitable context : * See {@link javax.print.PrintService#getSupportedAttributeValues(Class,DocFlavor, AttributeSet) <code>PrintService.getSupportedAttributeValues()</code>} * <p> * The rectangular printable area is defined thus: * The (x,y) origin is positioned at the top-left of the paper in portrait * mode regardless of the orientation specified in the requesting context. * For example a printable area for A4 paper in portrait or landscape * orientation will have height > width. * <p> * A printable area attribute's values are stored * internally as integers in units of micrometers (&#181;m), where 1 micrometer * = 10<SUP>-6</SUP> meter = 1/1000 millimeter = 1/25400 inch. This permits * dimensions to be represented exactly to a precision of 1/1000 mm (= 1 * &#181;m) or 1/100 inch (= 254 &#181;m). If fractional inches are expressed in * negative powers of two, this permits dimensions to be represented exactly to * a precision of 1/8 inch (= 3175 &#181;m) but not 1/16 inch (because 1/16 inch * does not equal an integral number of &#181;m). * <p> * <B>IPP Compatibility:</B> MediaPrintableArea is not an IPP attribute. */ public final class MediaPrintableArea implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private int x, y, w, h; private int units; private static final long serialVersionUID = -1597171464050795793L; /** {@collect.stats} * Value to indicate units of inches (in). It is actually the conversion * factor by which to multiply inches to yield &#181;m (25400). */ public static final int INCH = 25400; /** {@collect.stats} * Value to indicate units of millimeters (mm). It is actually the * conversion factor by which to multiply mm to yield &#181;m (1000). */ public static final int MM = 1000; /** {@collect.stats} * Constructs a MediaPrintableArea object from floating point values. * @param x printable x * @param y printable y * @param w printable width * @param h printable height * @param units in which the values are expressed. * * @exception IllegalArgumentException * Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> < 0 * or <CODE>w</CODE> <= 0 or <CODE>h</CODE> <= 0 or * <CODE>units</CODE> < 1. */ public MediaPrintableArea(float x, float y, float w, float h, int units) { if ((x < 0.0) || (y < 0.0) || (w <= 0.0) || (h <= 0.0) || (units < 1)) { throw new IllegalArgumentException("0 or negative value argument"); } this.x = (int) (x * units + 0.5f); this.y = (int) (y * units + 0.5f); this.w = (int) (w * units + 0.5f); this.h = (int) (h * units + 0.5f); } /** {@collect.stats} * Constructs a MediaPrintableArea object from integer values. * @param x printable x * @param y printable y * @param w printable width * @param h printable height * @param units in which the values are expressed. * * @exception IllegalArgumentException * Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> < 0 * or <CODE>w</CODE> <= 0 or <CODE>h</CODE> <= 0 or * <CODE>units</CODE> < 1. */ public MediaPrintableArea(int x, int y, int w, int h, int units) { if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (units < 1)) { throw new IllegalArgumentException("0 or negative value argument"); } this.x = x * units; this.y = y * units; this.w = w * units; this.h = h * units; } /** {@collect.stats} * Get the printable area as an array of 4 values in the order * x, y, w, h. The values returned are in the given units. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return printable area as array of x, y, w, h in the specified units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float[] getPrintableArea(int units) { return new float[] { getX(units), getY(units), getWidth(units), getHeight(units) }; } /** {@collect.stats} * Get the x location of the origin of the printable area in the * specified units. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return x location of the origin of the printable area in the * specified units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getX(int units) { return convertFromMicrometers(x, units); } /** {@collect.stats} * Get the y location of the origin of the printable area in the * specified units. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return y location of the origin of the printable area in the * specified units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getY(int units) { return convertFromMicrometers(y, units); } /** {@collect.stats} * Get the width of the printable area in the specified units. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return width of the printable area in the specified units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getWidth(int units) { return convertFromMicrometers(w, units); } /** {@collect.stats} * Get the height of the printable area in the specified units. * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * * @return height of the printable area in the specified units. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public float getHeight(int units) { return convertFromMicrometers(h, units); } /** {@collect.stats} * Returns whether this media margins attribute is equivalent to the passed * in object. * To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class MediaPrintableArea. * <LI> * The origin and dimensions are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this media margins * attribute, false otherwise. */ public boolean equals(Object object) { boolean ret = false; if (object instanceof MediaPrintableArea) { MediaPrintableArea mm = (MediaPrintableArea)object; if (x == mm.x && y == mm.y && w == mm.w && h == mm.h) { ret = true; } } return ret; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class MediaPrintableArea, the category is * class MediaPrintableArea itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return MediaPrintableArea.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class MediaPrintableArea, * the category name is <CODE>"media-printable-area"</CODE>. * <p>This is not an IPP V1.1 attribute. * * @return Attribute category name. */ public final String getName() { return "media-printable-area"; } /** {@collect.stats} * Returns a string version of this rectangular size attribute in the * given units. * * @param units * Unit conversion factor, e.g. {@link #INCH <CODE>INCH</CODE>} or * {@link #MM <CODE>MM</CODE>}. * @param unitsName * Units name string, e.g. <CODE>"in"</CODE> or <CODE>"mm"</CODE>. If * null, no units name is appended to the result. * * @return String version of this two-dimensional size attribute. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>units</CODE> < 1. */ public String toString(int units, String unitsName) { if (unitsName == null) { unitsName = ""; } float []vals = getPrintableArea(units); String str = "("+vals[0]+","+vals[1]+")->("+vals[2]+","+vals[3]+")"; return str + unitsName; } /** {@collect.stats} * Returns a string version of this rectangular size attribute in mm. */ public String toString() { return(toString(MM, "mm")); } /** {@collect.stats} * Returns a hash code value for this attribute. */ public int hashCode() { return x + 37*y + 43*w + 47*h; } private static float convertFromMicrometers(int x, int units) { if (units < 1) { throw new IllegalArgumentException("units is < 1"); } return ((float)x) / ((float)units); } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * JobState is a printing attribute class, an enumeration, that identifies * the current state of a print job. Class JobState defines standard job state * values. A Print Service implementation only needs to report those job * states which are appropriate for the particular implementation; it does not * have to report every defined job state. The {@link JobStateReasons * JobStateReasons} attribute augments the JobState attribute to give more * detailed information about the job in the given job state. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public class JobState extends EnumSyntax implements PrintJobAttribute { private static final long serialVersionUID = 400465010094018920L; /** {@collect.stats} * The job state is unknown. */ public static final JobState UNKNOWN = new JobState(0); /** {@collect.stats} * The job is a candidate to start processing, but is not yet processing. */ public static final JobState PENDING = new JobState(3); /** {@collect.stats} * The job is not a candidate for processing for any number of reasons but * will return to the PENDING state as soon as the reasons are no longer * present. The job's {@link JobStateReasons JobStateReasons} attribute must * indicate why the job is no longer a candidate for processing. */ public static final JobState PENDING_HELD = new JobState(4); /** {@collect.stats} * The job is processing. One or more of the following activities is * occurring: * <OL TYPE=1> * <LI> * The job is using, or is attempting to use, one or more purely software * processes that are analyzing, creating, or interpreting a PDL, etc. * <P> * <LI> * The job is using, or is attempting to use, one or more hardware * devices that are interpreting a PDL, making marks on a medium, and/or * performing finishing, such as stapling, etc. * <P> * <LI> * The printer has made the job ready for printing, but the output * device is not yet printing it, either because the job hasn't reached the * output device or because the job is queued in the output device or some * other spooler, awaiting the output device to print it. * </OL> * <P> * When the job is in the PROCESSING state, the entire job state includes * the detailed status represented in the printer's {@link PrinterState * PrinterState} and {@link PrinterStateReasons PrinterStateReasons} * attributes. * <P> * Implementations may, though they need not, include additional values in * the job's {@link JobStateReasons JobStateReasons} attribute to indicate * the progress of the job, such as adding the JOB_PRINTING value to * indicate when the output device is actually making marks on paper and/or * the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the * process of canceling or aborting the job. */ public static final JobState PROCESSING = new JobState (5); /** {@collect.stats} * The job has stopped while processing for any number of reasons and will * return to the PROCESSING state as soon as the reasons are no longer * present. * <P> * The job's {@link JobStateReasons JobStateReasons} attribute may indicate * why the job has stopped processing. For example, if the output device is * stopped, the PRINTER_STOPPED value may be included in the job's {@link * JobStateReasons JobStateReasons} attribute. * <P> * <I>Note:</I> When an output device is stopped, the device usually * indicates its condition in human readable form locally at the device. A * client can obtain more complete device status remotely by querying the * printer's {@link PrinterState PrinterState} and {@link * PrinterStateReasons PrinterStateReasons} attributes. */ public static final JobState PROCESSING_STOPPED = new JobState (6); /** {@collect.stats} * The job has been canceled by some human agency, the printer has completed * canceling the job, and all job status attributes have reached their final * values for the job. While the printer is canceling the job, the job * remains in its current state, but the job's {@link JobStateReasons * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT * value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or * CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the * PROCESSING_TO_STOP_POINT value, if present, must be removed, but the * CANCELED_BY_<I>xxx</I> value, if present, must remain. */ public static final JobState CANCELED = new JobState (7); /** {@collect.stats} * The job has been aborted by the system (usually while the job was in the * PROCESSING or PROCESSING_STOPPED state), the printer has completed * aborting the job, and all job status attributes have reached their final * values for the job. While the printer is aborting the job, the job * remains in its current state, but the job's {@link JobStateReasons * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT * and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state, * the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the * ABORTED_BY_SYSTEM value, if present, must remain. */ public static final JobState ABORTED = new JobState (8); /** {@collect.stats} * The job has completed successfully or with warnings or errors after * processing, all of the job media sheets have been successfully stacked in * the appropriate output bin(s), and all job status attributes have reached * their final values for the job. The job's {@link JobStateReasons * JobStateReasons} attribute should contain one of these values: * COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or * COMPLETED_WITH_ERRORS. */ public static final JobState COMPLETED = new JobState (9); // Hidden constructors. /** {@collect.stats} * Construct a new job state enumeration value with the given integer value. * * @param value Integer value. */ protected JobState(int value) { super (value); } private static final String[] myStringTable = {"unknown", null, null, "pending", "pending-held", "processing", "processing-stopped", "canceled", "aborted", "completed"}; private static final JobState[] myEnumValueTable = {UNKNOWN, null, null, PENDING, PENDING_HELD, PROCESSING, PROCESSING_STOPPED, CANCELED, ABORTED, COMPLETED}; /** {@collect.stats} * Returns the string table for class JobState. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class JobState. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobState and any vendor-defined subclasses, the category is * class JobState itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobState.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobState and any vendor-defined subclasses, the category * name is <CODE>"job-state"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-state"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterState is a printing attribute class, an enumeration, that * identifies the current state of a printer. Class PrinterState defines * standard printer state values. A Print Service implementation only needs * to report those printer states which are appropriate for the particular * implementation; it does not have to report every defined printer state. The * {@link PrinterStateReasons PrinterStateReasons} attribute augments the * PrinterState attribute to give more detailed information about the printer * in given printer state. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class PrinterState extends EnumSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -649578618346507718L; /** {@collect.stats} * The printer state is unknown. */ public static final PrinterState UNKNOWN = new PrinterState(0); /** {@collect.stats} * Indicates that new jobs can start processing without waiting. */ public static final PrinterState IDLE = new PrinterState(3); /** {@collect.stats} * Indicates that jobs are processing; * new jobs will wait before processing. */ public static final PrinterState PROCESSING = new PrinterState(4); /** {@collect.stats} * Indicates that no jobs can be processed and intervention is required. */ public static final PrinterState STOPPED = new PrinterState(5); /** {@collect.stats} * Construct a new printer state enumeration value with the given integer * value. * * @param value Integer value. */ protected PrinterState(int value) { super (value); } private static final String[] myStringTable = { "unknown", null, null, "idle", "processing", "stopped" }; private static final PrinterState[] myEnumValueTable = { UNKNOWN, null, null, IDLE, PROCESSING, STOPPED }; /** {@collect.stats} * Returns the string table for class PrinterState. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class PrinterState. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterState, the category is class PrinterState itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterState.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterState, the category name is <CODE>"printer-state"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-state"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Date; import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class DateTimeAtCompleted is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job completed * (or was canceled or aborted). * <P> * To construct a DateTimeAtCompleted attribute from separate values of the * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar * Calendar} object to construct a {@link java.util.Date Date} object, then use * the {@link java.util.Date Date} object to construct the DateTimeAtCompleted * attribute. To convert a DateTimeAtCompleted attribute to separate values of * the year, month, day, hour, minute, and so on, create a {@link * java.util.Calendar Calendar} object and set it to the {@link java.util.Date * Date} from the DateTimeAtCompleted attribute. * <P> * <B>IPP Compatibility:</B> The information needed to construct an IPP * "date-time-at-completed" attribute can be obtained as described above. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class DateTimeAtCompleted extends DateTimeSyntax implements PrintJobAttribute { private static final long serialVersionUID = 6497399708058490000L; /** {@collect.stats} * Construct a new date-time at completed attribute with the given {@link * java.util.Date Date} value. * * @param dateTime {@link java.util.Date Date} value. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null. */ public DateTimeAtCompleted(Date dateTime) { super (dateTime); } /** {@collect.stats} * Returns whether this date-time at completed attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class DateTimeAtCompleted. * <LI> * This date-time at completed attribute's {@link java.util.Date Date} value * and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this date-time * at completed attribute, false otherwise. */ public boolean equals(Object object) { return(super.equals (object) && object instanceof DateTimeAtCompleted); } // Exported operations inherited and implemented from interface Attribute. /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class DateTimeAtCompleted, the category is class * DateTimeAtCompleted itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return DateTimeAtCompleted.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class DateTimeAtCompleted, the category name is * <CODE>"date-time-at-completed"</CODE>. * * @return Attribute category name. */ public final String getName() { return "date-time-at-completed"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class PrintQuality is a printing attribute class, an enumeration, * that specifies the print quality that the printer uses for the job. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public class PrintQuality extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -3072341285225858365L; /** {@collect.stats} * Lowest quality available on the printer. */ public static final PrintQuality DRAFT = new PrintQuality(3); /** {@collect.stats} * Normal or intermediate quality on the printer. */ public static final PrintQuality NORMAL = new PrintQuality(4); /** {@collect.stats} * Highest quality available on the printer. */ public static final PrintQuality HIGH = new PrintQuality(5); /** {@collect.stats} * Construct a new print quality enumeration value with the given integer * value. * * @param value Integer value. */ protected PrintQuality(int value) { super (value); } private static final String[] myStringTable = { "draft", "normal", "high" }; private static final PrintQuality[] myEnumValueTable = { DRAFT, NORMAL, HIGH }; /** {@collect.stats} * Returns the string table for class PrintQuality. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class PrintQuality. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Returns the lowest integer value used by class PrintQuality. */ protected int getOffset() { return 3; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrintQuality and any vendor-defined subclasses, the category is * class PrintQuality itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrintQuality.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrintQuality and any vendor-defined subclasses, the category * name is <CODE>"print-quality"</CODE>. * * @return Attribute category name. */ public final String getName() { return "print-quality"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Date; import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class DateTimeAtProcessing is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job first * began processing. * <P> * To construct a DateTimeAtProcessing attribute from separate values of the * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar * Calendar} object to construct a {@link java.util.Date Date} object, then use * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing * attribute. To convert a DateTimeAtProcessing attribute to separate values of * the year, month, day, hour, minute, and so on, create a {@link * java.util.Calendar Calendar} object and set it to the {@link java.util.Date * Date} from the DateTimeAtProcessing attribute. * <P> * <B>IPP Compatibility:</B> The information needed to construct an IPP * "date-time-at-processing" attribute can be obtained as described above. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @author Alan Kaminsky */ public final class DateTimeAtProcessing extends DateTimeSyntax implements PrintJobAttribute { private static final long serialVersionUID = -3710068197278263244L; /** {@collect.stats} * Construct a new date-time at processing attribute with the given {@link * java.util.Date Date} value. * * @param dateTime {@link java.util.Date Date} value. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null. */ public DateTimeAtProcessing(Date dateTime) { super (dateTime); } /** {@collect.stats} * Returns whether this date-time at processing attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class DateTimeAtProcessing. * <LI> * This date-time at processing attribute's {@link java.util.Date Date} * value and <CODE>object</CODE>'s {@link java.util.Date Date} value * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this date-time * at processing attribute, false otherwise. */ public boolean equals(Object object) { return(super.equals (object) && object instanceof DateTimeAtProcessing); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class DateTimeAtProcessing, the category is class * DateTimeAtProcessing itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return DateTimeAtProcessing.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class DateTimeAtProcessing, the category name is * <CODE>"date-time-at-processing"</CODE>. * * @return Attribute category name. */ public final String getName() { return "date-time-at-processing"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class ColorSupported is a printing attribute class, an enumeration, that * identifies whether the device is capable of any type of color printing at * all, including highlight color as well as full process color. All document * instructions having to do with color are embedded within the print data (none * are attributes attached to the job outside the print data). * <P> * Note: End users are able to determine the nature and details of the color * support by querying the {@link PrinterMoreInfoManufacturer * PrinterMoreInfoManufacturer} attribute. * <P> * Don't confuse the ColorSupported attribute with the {@link Chromaticity * Chromaticity} attribute. {@link Chromaticity Chromaticity} is an attribute * the client can specify for a job to tell the printer whether to print a * document in monochrome or color, possibly causing the printer to print a * color document in monochrome. ColorSupported is a printer description * attribute that tells whether the printer can print in color regardless of how * the client specifies to print any particular document. * <P> * <B>IPP Compatibility:</B> The IPP boolean value is "true" for SUPPORTED and * "false" for NOT_SUPPORTED. The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class ColorSupported extends EnumSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -2700555589688535545L; /** {@collect.stats} * The printer is not capable of any type of color printing. */ public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0); /** {@collect.stats} * The printer is capable of some type of color printing, such as * highlight color or full process color. */ public static final ColorSupported SUPPORTED = new ColorSupported(1); /** {@collect.stats} * Construct a new color supported enumeration value with the given * integer value. * * @param value Integer value. */ protected ColorSupported(int value) { super (value); } private static final String[] myStringTable = {"not-supported", "supported"}; private static final ColorSupported[] myEnumValueTable = {NOT_SUPPORTED, SUPPORTED}; /** {@collect.stats} * Returns the string table for class ColorSupported. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class ColorSupported. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class ColorSupported, the category is class ColorSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return ColorSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class ColorSupported, the category name is <CODE>"color-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "color-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobKOctetsProcessed is an integer valued printing attribute class that * specifies the total number of print data octets processed so far in K octets, * i.e., in units of 1024 octets. The value must be rounded up, so that a job * between 1 and 1024 octets inclusive must be indicated as being 1K octets, * 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with * multiple documents), the JobKOctetsProcessed value is computed by adding up * the individual documents' number of octets processed so far, then rounding up * to the next K octets value. * <P> * The JobKOctetsProcessed attribute describes the progress of the job. This * attribute is intended to be a counter. That is, the JobKOctetsProcessed value * for a job that has not started processing must be 0. When the job's {@link * JobState JobState} is PROCESSING or PROCESSING_STOPPED, the * JobKOctetsProcessed value is intended to increase as the job is processed; it * indicates the amount of the job that has been processed at the time the Print * Job's attribute set is queried or at the time a print job event is reported. * When the job enters the COMPLETED, CANCELED, or ABORTED states, the * JobKOctetsProcessed value is the final value for the job. * <P> * For implementations where multiple copies are produced by the interpreter * with only a single pass over the data, the final value of the * JobKOctetsProcessed attribute must be equal to the value of the {@link * JobKOctets JobKOctets} attribute. For implementations where multiple copies * are produced by the interpreter by processing the data for each copy, the * final value must be a multiple of the value of the {@link JobKOctets * JobKOctets} attribute. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobKOctets * @see JobKOctetsSupported * @see JobImpressionsCompleted * @see JobMediaSheetsCompleted * * @author Alan Kaminsky */ public final class JobKOctetsProcessed extends IntegerSyntax implements PrintJobAttribute { private static final long serialVersionUID = -6265238509657881806L; /** {@collect.stats} * Construct a new job K octets processed attribute with the given integer * value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobKOctetsProcessed(int value) { super (value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job K octets processed attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobKOctetsProcessed. * <LI> * This job K octets processed attribute's value and * <CODE>object</CODE>'s value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job K * octets processed attribute, false otherwise. */ public boolean equals(Object object) { return(super.equals (object) && object instanceof JobKOctetsProcessed); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobKOctetsProcessed, the category is class * JobKOctetsProcessed itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobKOctetsProcessed.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobKOctetsProcessed, the category name is * <CODE>"job-k-octets-processed"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-k-octets-processed"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobSheets is a printing attribute class, an enumeration, that * determines which job start and end sheets, if any, must be printed with a * job. Class JobSheets declares keywords for standard job sheets values. * Implementation- or site-defined names for a job sheets attribute may also be * created by defining a subclass of class JobSheets. * <P> * The effect of a JobSheets attribute on multidoc print jobs (jobs with * multiple documents) may be affected by the {@link MultipleDocumentHandling * MultipleDocumentHandling} job attribute, depending on the meaning of the * particular JobSheets value. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The * enumeration's integer value is the IPP enum value. The * <code>toString()</code> method returns the IPP string representation of * the attribute value. For a subclass, the attribute value must be * localized to give the IPP name and natural language values. * <P> * * @author Alan Kaminsky */ public class JobSheets extends EnumSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -4735258056132519759L; /** {@collect.stats} * No job sheets are printed. */ public static final JobSheets NONE = new JobSheets(0); /** {@collect.stats} * One or more site specific standard job sheets are printed. e.g. a * single start sheet is printed, or both start and end sheets are * printed. */ public static final JobSheets STANDARD = new JobSheets(1); /** {@collect.stats} * Construct a new job sheets enumeration value with the given integer * value. * * @param value Integer value. */ protected JobSheets(int value) { super (value); } private static final String[] myStringTable = { "none", "standard" }; private static final JobSheets[] myEnumValueTable = { NONE, STANDARD }; /** {@collect.stats} * Returns the string table for class JobSheets. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class JobSheets. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobSheets and any vendor-defined subclasses, the category is * class JobSheets itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobSheets.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobSheets and any vendor-defined subclasses, the category * name is <CODE>"job-sheets"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-sheets"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class JobStateReason is a printing attribute class, an enumeration, that * provides additional information about the job's current state, i.e., * information that augments the value of the job's {@link JobState JobState} * attribute. Class JobStateReason defines standard job state reason values. A * Print Service implementation only needs to report those job state * reasons which are appropriate for the particular implementation; it does not * have to report every defined job state reason. * <P> * Instances of JobStateReason do not appear in a Print Job's attribute set * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons} * attribute contains zero, one, or more than one JobStateReason objects which * pertain to the Print Job's status. The printer adds a JobStateReason object * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the * corresponding condition becomes true of the Print Job, and the printer * removes the JobStateReason object again when the corresponding condition * becomes false, regardless of whether the Print Job's overall {@link JobState * JobState} also changed. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public class JobStateReason extends EnumSyntax implements Attribute { private static final long serialVersionUID = -8765894420449009168L; /** {@collect.stats} * The printer has created the Print Job, but the printer has not finished * accessing or accepting all the print data yet. */ public static final JobStateReason JOB_INCOMING = new JobStateReason(0); /** {@collect.stats} * The printer has created the Print Job, but the printer is expecting * additional print data before it can move the job into the PROCESSING * state. If a printer starts processing before it has received all data, * the printer removes the JOB_DATA_INSUFFICIENT reason, but the * JOB_INCOMING reason remains. If a printer starts processing after it * has received all data, the printer removes the JOB_DATA_INSUFFICIENT * and JOB_INCOMING reasons at the same time. */ public static final JobStateReason JOB_DATA_INSUFFICIENT = new JobStateReason(1); /** {@collect.stats} * The Printer could not access one or more documents passed by reference * (i.e., the print data representation object is a URL). This reason is * intended to cover any file access problem,including file does not exist * and access denied because of an access control problem. Whether the * printer aborts the job and moves the job to the ABORTED job state or * prints all documents that are accessible and moves the job to the * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the * job's {@link JobStateReasons JobStateReasons} attribute depends on * implementation and/or site policy. This value should be supported if * the printer supports doc flavors with URL print data representation * objects. */ public static final JobStateReason DOCUMENT_ACCESS_ERROR = new JobStateReason(2); /** {@collect.stats} * The job was not completely submitted for some unforeseen reason. * Possibilities include (1) the printer has crashed before the job was * fully submitted by the client, (2) the printer or the document transfer * method has crashed in some non-recoverable way before the document data * was entirely transferred to the printer, (3) the client crashed before * the job was fully submitted. */ public static final JobStateReason SUBMISSION_INTERRUPTED = new JobStateReason(3); /** {@collect.stats} * The printer is transmitting the job to the output device. */ public static final JobStateReason JOB_OUTGOING = new JobStateReason(4); /** {@collect.stats} * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was * specified with a date-time that is still in the future. The job must * not be a candidate for processing until this reason is removed and * there are * no other reasons to hold the job. This value should be supported if the * {@link JobHoldUntil JobHoldUntil} job template attribute is supported. */ public static final JobStateReason JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5); /** {@collect.stats} * At least one of the resources needed by the job, such as media, fonts, * resource objects, etc., is not ready on any of the physical printers * for which the job is a candidate. This condition may be detected * when the job is accepted, or subsequently while the job is pending * or processing, depending on implementation. * The job may remain in its current state or * be moved to the PENDING_HELD state, depending on implementation and/or * job scheduling policy. */ public static final JobStateReason RESOURCES_ARE_NOT_READY = new JobStateReason(6); /** {@collect.stats} * The value of the printer's {@link PrinterStateReasons * PrinterStateReasons} attribute contains a {@link PrinterStateReason * PrinterStateReason} value of STOPPED_PARTLY. */ public static final JobStateReason PRINTER_STOPPED_PARTLY = new JobStateReason(7); /** {@collect.stats} * The value of the printer's {@link PrinterState PrinterState} attribute * ia STOPPED. */ public static final JobStateReason PRINTER_STOPPED = new JobStateReason(8); /** {@collect.stats} * The job is in the PROCESSING state, but more specifically, the printer * ia interpreting the document data. */ public static final JobStateReason JOB_INTERPRETING = new JobStateReason(9); /** {@collect.stats} * The job is in the PROCESSING state, but more specifically, the printer * has queued the document data. */ public static final JobStateReason JOB_QUEUED = new JobStateReason(10); /** {@collect.stats} * The job is in the PROCESSING state, but more specifically, the printer * is interpreting document data and producing another electronic * representation. */ public static final JobStateReason JOB_TRANSFORMING = new JobStateReason(11); /** {@collect.stats} * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more * specifically, the printer has completed enough processing of the document * to be able to start marking and the job is waiting for the marker. * Systems that require human intervention to release jobs put the job into * the PENDING_HELD job state. Systems that automatically select a job to * use the marker put the job into the PENDING job state or keep the job * in the PROCESSING job state while waiting for the marker, depending on * implementation. All implementations put the job into (or back into) the * PROCESSING state when marking does begin. */ public static final JobStateReason JOB_QUEUED_FOR_MARKER = new JobStateReason(12); /** {@collect.stats} * The output device is marking media. This value is useful for printers * which spend a great deal of time processing (1) when no marking is * happening and then want to show that marking is now happening or (2) when * the job is in the process of being canceled or aborted while the job * remains in the PROCESSING state, but the marking has not yet stopped so * that impression or sheet counts are still increasing for the job. */ public static final JobStateReason JOB_PRINTING = new JobStateReason(13); /** {@collect.stats} * The job was canceled by the owner of the job, i.e., by a user whose * authenticated identity is the same as the value of the originating user * that created the Print Job, or by some other authorized end-user, such as * a member of the job owner's security group. This value should be * supported. */ public static final JobStateReason JOB_CANCELED_BY_USER = new JobStateReason(14); /** {@collect.stats} * The job was canceled by the operator, i.e., by a user who has been * authenticated as having operator privileges (whether local or remote). If * the security policy is to allow anyone to cancel anyone's job, then this * value may be used when the job is canceled by someone other than the * owner of the job. For such a security policy, in effect, everyone is an * operator as far as canceling jobs is concerned. This value should be * supported if the implementation permits canceling by someone other than * the owner of the job. */ public static final JobStateReason JOB_CANCELED_BY_OPERATOR = new JobStateReason(15); /** {@collect.stats} * The job was canceled by an unidentified local user, i.e., a user at a * console at the device. This value should be supported if the * implementation supports canceling jobs at the console. */ public static final JobStateReason JOB_CANCELED_AT_DEVICE = new JobStateReason(16); /** {@collect.stats} * The job was aborted by the system. Either the job (1) is in the process * of being aborted, (2) has been aborted by the system and placed in the * ABORTED state, or (3) has been aborted by the system and placed in the * PENDING_HELD state, so that a user or operator can manually try the job * again. This value should be supported. */ public static final JobStateReason ABORTED_BY_SYSTEM = new JobStateReason(17); /** {@collect.stats} * The job was aborted by the system because the printer determined while * attempting to decompress the document's data that the compression is * actually not among those supported by the printer. This value must be * supported, since {@link Compression Compression} is a required doc * description attribute. */ public static final JobStateReason UNSUPPORTED_COMPRESSION = new JobStateReason(18); /** {@collect.stats} * The job was aborted by the system because the printer encountered an * error in the document data while decompressing it. If the printer posts * this reason, the document data has already passed any tests that would * have led to the UNSUPPORTED_COMPRESSION job state reason. */ public static final JobStateReason COMPRESSION_ERROR = new JobStateReason(19); /** {@collect.stats} * The job was aborted by the system because the document data's document * format (doc flavor) is not among those supported by the printer. If the * client specifies a doc flavor with a MIME type of * <CODE>"application/octet-stream"</CODE>, the printer may abort the job if * the printer cannot determine the document data's actual format through * auto-sensing (even if the printer supports the document format if * specified explicitly). This value must be supported, since a doc flavor * is required to be specified for each doc. */ public static final JobStateReason UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20); /** {@collect.stats} * The job was aborted by the system because the printer encountered an * error in the document data while processing it. If the printer posts this * reason, the document data has already passed any tests that would have * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason. */ public static final JobStateReason DOCUMENT_FORMAT_ERROR = new JobStateReason(21); /** {@collect.stats} * The requester has canceled the job or the printer has aborted the job, * but the printer is still performing some actions on the job until a * specified stop point occurs or job termination/cleanup is completed. * <P> * If the implementation requires some measurable time to cancel the job in * the PROCESSING or PROCESSING_STOPPED job states, the printer must use * this reason to indicate that the printer is still performing some actions * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED * state. After all the job's job description attributes have stopped * incrementing, the printer moves the job from the PROCESSING state to the * CANCELED or ABORTED job states. */ public static final JobStateReason PROCESSING_TO_STOP_POINT = new JobStateReason(22); /** {@collect.stats} * The printer is off-line and accepting no jobs. All PENDING jobs are put * into the PENDING_HELD state. This situation could be true if the * service's or document transform's input is impaired or broken. */ public static final JobStateReason SERVICE_OFF_LINE = new JobStateReason(23); /** {@collect.stats} * The job completed successfully. This value should be supported. */ public static final JobStateReason JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24); /** {@collect.stats} * The job completed with warnings. This value should be supported if the * implementation detects warnings. */ public static final JobStateReason JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25); /** {@collect.stats} * The job completed with errors (and possibly warnings too). This value * should be supported if the implementation detects errors. */ public static final JobStateReason JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26); /** {@collect.stats} * This job is retained and is currently able to be restarted. If * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons * JobStateReasons} attribute, then the printer must accept a request to * restart that job. This value should be supported if restarting jobs is * supported. <I>[The capability for restarting jobs is not in the Java * Print Service API at present.]</I> */ public static final JobStateReason JOB_RESTARTABLE = new JobStateReason(27); /** {@collect.stats} * The job has been forwarded to a device or print system that is unable to * send back status. The printer sets the job's {@link JobState JobState} * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's * {@link JobStateReasons JobStateReasons} attribute to indicate that the * printer has no additional information about the job and never will have * any better information. */ public static final JobStateReason QUEUED_IN_DEVICE = new JobStateReason(28); /** {@collect.stats} * Construct a new job state reason enumeration value with the given * integer value. * * @param value Integer value. */ protected JobStateReason(int value) { super (value); } private static final String[] myStringTable = { "job-incoming", "job-data-insufficient", "document-access-error", "submission-interrupted", "job-outgoing", "job-hold-until-specified", "resources-are-not-ready", "printer-stopped-partly", "printer-stopped", "job-interpreting", "job-queued", "job-transforming", "job-queued-for-marker", "job-printing", "job-canceled-by-user", "job-canceled-by-operator", "job-canceled-at-device", "aborted-by-system", "unsupported-compression", "compression-error", "unsupported-document-format", "document-format-error", "processing-to-stop-point", "service-off-line", "job-completed-successfully", "job-completed-with-warnings", "job-completed-with-errors", "job-restartable", "queued-in-device"}; private static final JobStateReason[] myEnumValueTable = { JOB_INCOMING, JOB_DATA_INSUFFICIENT, DOCUMENT_ACCESS_ERROR, SUBMISSION_INTERRUPTED, JOB_OUTGOING, JOB_HOLD_UNTIL_SPECIFIED, RESOURCES_ARE_NOT_READY, PRINTER_STOPPED_PARTLY, PRINTER_STOPPED, JOB_INTERPRETING, JOB_QUEUED, JOB_TRANSFORMING, JOB_QUEUED_FOR_MARKER, JOB_PRINTING, JOB_CANCELED_BY_USER, JOB_CANCELED_BY_OPERATOR, JOB_CANCELED_AT_DEVICE, ABORTED_BY_SYSTEM, UNSUPPORTED_COMPRESSION, COMPRESSION_ERROR, UNSUPPORTED_DOCUMENT_FORMAT, DOCUMENT_FORMAT_ERROR, PROCESSING_TO_STOP_POINT, SERVICE_OFF_LINE, JOB_COMPLETED_SUCCESSFULLY, JOB_COMPLETED_WITH_WARNINGS, JOB_COMPLETED_WITH_ERRORS, JOB_RESTARTABLE, QUEUED_IN_DEVICE}; /** {@collect.stats} * Returns the string table for class JobStateReason. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class JobStateReason. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobStateReason and any vendor-defined subclasses, the * category is class JobStateReason itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobStateReason.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobStateReason and any vendor-defined subclasses, the * category name is <CODE>"job-state-reason"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-state-reason"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterMessageFromOperator is a printing attribute class, a text * attribute, that provides a message from an operator, system administrator, * or "intelligent" process to indicate to the end user information about or * status of the printer, such as why it is unavailable or when it is * expected to be available. * <P> * A Print Service's attribute set includes zero instances or one instance of * a * PrinterMessageFromOperator attribute, not more than one instance. A new * PrinterMessageFromOperator attribute replaces an existing * PrinterMessageFromOperator attribute, if any. In other words, * PrinterMessageFromOperator is not intended to be a history log. * If it wishes, the client can detect changes to a Print Service's * PrinterMessageFromOperator * attribute and maintain the client's own history log of the * PrinterMessageFromOperator attribute values. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class PrinterMessageFromOperator extends TextSyntax implements PrintServiceAttribute { static final long serialVersionUID = -4486871203218629318L; /** {@collect.stats} * Constructs a new printer message from operator attribute with the * given message and locale. * * @param message Message. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>message</CODE> is null. */ public PrinterMessageFromOperator(String message, Locale locale) { super (message, locale); } /** {@collect.stats} * Returns whether this printer message from operator attribute is * equivalent to the passed in object. To be equivalent, all of the * following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class * PrinterMessageFromOperator. * <LI> * This printer message from operator attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This printer message from operator attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * message from operator attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterMessageFromOperator); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterMessageFromOperator, * the category is class PrinterMessageFromOperator itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterMessageFromOperator.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterMessageFromOperator, * the category name is <CODE>"printer-message-from-operator"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-message-from-operator"; } }
Java
/* * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.net.URI; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.URISyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PrinterURI is a printing attribute class, a URI, that specifies the * globally unique name of a printer. If it has such a name, an administrator * determines a printer's URI and sets this attribute to that name. * <P> * <B>IPP Compatibility:</B> This implements the * IPP printer-uri attribute. The string form returned by * <CODE>toString()</CODE> gives the IPP printer-uri value. * The category name returned by <CODE>getName()</CODE> * gives the IPP attribute name. * <P> * * @author Robert Herriot */ public final class PrinterURI extends URISyntax implements PrintServiceAttribute { private static final long serialVersionUID = 7923912792485606497L; /** {@collect.stats} * Constructs a new PrinterURI attribute with the specified URI. * * @param uri URI of the printer * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>uri</CODE> is null. */ public PrinterURI(URI uri) { super (uri); } /** {@collect.stats} * Returns whether this printer name attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterURI. * <LI> * This PrinterURI attribute's underlying URI and * <CODE>object</CODE>'s underlying URI are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this PrinterURI * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterURI); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterURI and any vendor-defined subclasses, the category is * class PrinterURI itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterURI.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterURI and any vendor-defined subclasses, the category * name is <CODE>"printer-uri"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-uri"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobImpressions is an integer valued printing attribute class that * specifies the total size in number of impressions of the document(s) being * submitted. An "impression" is the image (possibly many print-stream pages in * different configurations) imposed onto a single media page. * <P> * The JobImpressions attribute describes the size of the job. This attribute is * not intended to be a counter; it is intended to be useful routing and * scheduling information if known. The printer may try to compute the * JobImpressions attribute's value if it is not supplied in the Print Request. * Even if the client does supply a value for the JobImpressions attribute in * the Print Request, the printer may choose to change the value if the printer * is able to compute a value which is more accurate than the client supplied * value. The printer may be able to determine the correct value for the * JobImpressions attribute either right at job submission time or at any later * point in time. * <P> * As with {@link JobKOctets JobKOctets}, the JobImpressions value must not * include the multiplicative factors contributed by the number of copies * specified by the {@link Copies Copies} attribute, independent of whether the * device can process multiple copies without making multiple passes over the * job or document data and independent of whether the output is collated or * not. Thus the value is independent of the implementation and reflects the * size of the document(s) measured in impressions independent of the number of * copies. * <P> * As with {@link JobKOctets JobKOctets}, the JobImpressions value must also not * include the multiplicative factor due to a copies instruction embedded in the * document data. If the document data actually includes replications of the * document data, this value will include such replication. In other words, this * value is always the number of impressions in the source document data, rather * than a measure of the number of impressions to be produced by the job. * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The * category name returned by <CODE>getName()</CODE> gives the IPP attribute * name. * <P> * * @see JobImpressionsSupported * @see JobImpressionsCompleted * @see JobKOctets * @see JobMediaSheets * * @author Alan Kaminsky */ public final class JobImpressions extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 8225537206784322464L; /** {@collect.stats} * Construct a new job impressions attribute with the given integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public JobImpressions(int value) { super(value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this job impressions attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobImpressions. * <LI> * This job impressions attribute's value and <CODE>object</CODE>'s value * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * impressions attribute, false otherwise. */ public boolean equals(Object object) { return super.equals (object) && object instanceof JobImpressions; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobImpressions, the category is class JobImpressions itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobImpressions.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobImpressions, the category name is * <CODE>"job-impressions"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-impressions"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class PrinterStateReason is a printing attribute class, an enumeration, * that provides additional information about the printer's current state, * i.e., information that augments the value of the printer's * {@link PrinterState PrinterState} attribute. * Class PrinterStateReason defines standard printer * state reason values. A Print Service implementation only needs to report * those printer state reasons which are appropriate for the particular * implementation; it does not have to report every defined printer state * reason. * <P> * Instances of PrinterStateReason do not appear in a Print Service's * attribute set directly. * Rather, a {@link PrinterStateReasons PrinterStateReasons} * attribute appears in the Print Service's attribute set. The {@link * PrinterStateReasons PrinterStateReasons} attribute contains zero, one, or * more than one PrinterStateReason objects which pertain to the * Print Service's status, and each PrinterStateReason object is * associated with a {@link Severity Severity} level of REPORT (least severe), * WARNING, or ERROR (most severe). The printer adds a PrinterStateReason * object to the Print Service's * {@link PrinterStateReasons PrinterStateReasons} attribute when the * corresponding condition becomes true of the printer, and the printer * removesthe PrinterStateReason object again when the corresponding * condition becomes false, regardless of whether the Print Service's overall * {@link PrinterState PrinterState} also changed. * <P> * <B>IPP Compatibility:</B> * The string values returned by each individual {@link PrinterStateReason} and * associated {@link Severity} object's <CODE>toString()</CODE> * methods, concatenated together with a hyphen (<CODE>"-"</CODE>) in * between, gives the IPP keyword value for a {@link PrinterStateReasons}. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public class PrinterStateReason extends EnumSyntax implements Attribute { private static final long serialVersionUID = -1623720656201472593L; /** {@collect.stats} * The printer has detected an error other than ones listed below. */ public static final PrinterStateReason OTHER = new PrinterStateReason(0); /** {@collect.stats} * A tray has run out of media. */ public static final PrinterStateReason MEDIA_NEEDED = new PrinterStateReason(1); /** {@collect.stats} * The device has a media jam. */ public static final PrinterStateReason MEDIA_JAM = new PrinterStateReason(2); /** {@collect.stats} * Someone has paused the printer, but the device(s) are taking an * appreciable time to stop. Later, when all output has stopped, * the {@link PrinterState PrinterState} becomes STOPPED, * and the PAUSED value replaces * the MOVING_TO_PAUSED value in the {@link PrinterStateReasons * PrinterStateReasons} attribute. This value must be supported if the * printer can be paused and the implementation takes significant time to * pause a device in certain circumstances. */ public static final PrinterStateReason MOVING_TO_PAUSED = new PrinterStateReason(3); /** {@collect.stats} * Someone has paused the printer and the printer's {@link PrinterState * PrinterState} is STOPPED. In this state, a printer must not produce * printed output, but it must perform other operations requested by a * client. If a printer had been printing a job when the printer was * paused, * the Printer must resume printing that job when the printer is no longer * paused and leave no evidence in the printed output of such a pause. * This value must be supported if the printer can be paused. */ public static final PrinterStateReason PAUSED = new PrinterStateReason(4); /** {@collect.stats} * Someone has removed a printer from service, and the device may be * powered down or physically removed. * In this state, a printer must not produce * printed output, and unless the printer is realized by a print server * that is still active, the printer must perform no other operations * requested by a client. * If a printer had been printing a job when it was shut down, * the printer need not resume printing that job when the printer is no * longer shut down. If the printer resumes printing such a job, it may * leave evidence in the printed output of such a shutdown, e.g. the part * printed before the shutdown may be printed a second time after the * shutdown. */ public static final PrinterStateReason SHUTDOWN = new PrinterStateReason(5); /** {@collect.stats} * The printer has scheduled a job on the output device and is in the * process of connecting to a shared network output device (and might not * be able to actually start printing the job for an arbitrarily long time * depending on the usage of the output device by other servers on the * network). */ public static final PrinterStateReason CONNECTING_TO_DEVICE = new PrinterStateReason(6); /** {@collect.stats} * The server was able to connect to the output device (or is always * connected), but was unable to get a response from the output device. */ public static final PrinterStateReason TIMED_OUT = new PrinterStateReason(7); /** {@collect.stats} * The printer is in the process of stopping the device and will be * stopped in a while. * When the device is stopped, the printer will change the * {@link PrinterState PrinterState} to STOPPED. The STOPPING reason is * never an error, even for a printer with a single output device. When an * output device ceases accepting jobs, the printer's {@link * PrinterStateReasons PrinterStateReasons} will have this reason while * the output device completes printing. */ public static final PrinterStateReason STOPPING = new PrinterStateReason(8); /** {@collect.stats} * When a printer controls more than one output device, this reason * indicates that one or more output devices are stopped. If the reason's * severity is a report, fewer than half of the output devices are * stopped. * If the reason's severity is a warning, half or more but fewer than * all of the output devices are stopped. */ public static final PrinterStateReason STOPPED_PARTLY = new PrinterStateReason(9); /** {@collect.stats} * The device is low on toner. */ public static final PrinterStateReason TONER_LOW = new PrinterStateReason(10); /** {@collect.stats} * The device is out of toner. */ public static final PrinterStateReason TONER_EMPTY = new PrinterStateReason(11); /** {@collect.stats} * The limit of persistent storage allocated for spooling has been * reached. * The printer is temporarily unable to accept more jobs. The printer will * remove this reason when it is able to accept more jobs. * This value should be used by a non-spooling printer that only * accepts one or a small number * jobs at a time or a spooling printer that has filled the spool space. */ public static final PrinterStateReason SPOOL_AREA_FULL = new PrinterStateReason(12); /** {@collect.stats} * One or more covers on the device are open. */ public static final PrinterStateReason COVER_OPEN = new PrinterStateReason(13); /** {@collect.stats} * One or more interlock devices on the printer are unlocked. */ public static final PrinterStateReason INTERLOCK_OPEN = new PrinterStateReason(14); /** {@collect.stats} * One or more doors on the device are open. */ public static final PrinterStateReason DOOR_OPEN = new PrinterStateReason(15); /** {@collect.stats} * One or more input trays are not in the device. */ public static final PrinterStateReason INPUT_TRAY_MISSING = new PrinterStateReason(16); /** {@collect.stats} * At least one input tray is low on media. */ public static final PrinterStateReason MEDIA_LOW = new PrinterStateReason(17); /** {@collect.stats} * At least one input tray is empty. */ public static final PrinterStateReason MEDIA_EMPTY = new PrinterStateReason(18); /** {@collect.stats} * One or more output trays are not in the device. */ public static final PrinterStateReason OUTPUT_TRAY_MISSING = new PrinterStateReason(19); /** {@collect.stats} * One or more output areas are almost full * (e.g. tray, stacker, collator). */ public static final PrinterStateReason OUTPUT_AREA_ALMOST_FULL = new PrinterStateReason(20); /** {@collect.stats} * One or more output areas are full (e.g. tray, stacker, collator). */ public static final PrinterStateReason OUTPUT_AREA_FULL = new PrinterStateReason(21); /** {@collect.stats} * The device is low on at least one marker supply (e.g. toner, ink, * ribbon). */ public static final PrinterStateReason MARKER_SUPPLY_LOW = new PrinterStateReason(22); /** {@collect.stats} * The device is out of at least one marker supply (e.g. toner, ink, * ribbon). */ public static final PrinterStateReason MARKER_SUPPLY_EMPTY = new PrinterStateReason(23); /** {@collect.stats} * The device marker supply waste receptacle is almost full. */ public static final PrinterStateReason MARKER_WASTE_ALMOST_FULL = new PrinterStateReason(24); /** {@collect.stats} * The device marker supply waste receptacle is full. */ public static final PrinterStateReason MARKER_WASTE_FULL = new PrinterStateReason(25); /** {@collect.stats} * The fuser temperature is above normal. */ public static final PrinterStateReason FUSER_OVER_TEMP = new PrinterStateReason(26); /** {@collect.stats} * The fuser temperature is below normal. */ public static final PrinterStateReason FUSER_UNDER_TEMP = new PrinterStateReason(27); /** {@collect.stats} * The optical photo conductor is near end of life. */ public static final PrinterStateReason OPC_NEAR_EOL = new PrinterStateReason(28); /** {@collect.stats} * The optical photo conductor is no longer functioning. */ public static final PrinterStateReason OPC_LIFE_OVER = new PrinterStateReason(29); /** {@collect.stats} * The device is low on developer. */ public static final PrinterStateReason DEVELOPER_LOW = new PrinterStateReason(30); /** {@collect.stats} * The device is out of developer. */ public static final PrinterStateReason DEVELOPER_EMPTY = new PrinterStateReason(31); /** {@collect.stats} * An interpreter resource is unavailable (e.g., font, form). */ public static final PrinterStateReason INTERPRETER_RESOURCE_UNAVAILABLE = new PrinterStateReason(32); /** {@collect.stats} * Construct a new printer state reason enumeration value with * the given integer value. * * @param value Integer value. */ protected PrinterStateReason(int value) { super (value); } private static final String[] myStringTable = { "other", "media-needed", "media-jam", "moving-to-paused", "paused", "shutdown", "connecting-to-device", "timed-out", "stopping", "stopped-partly", "toner-low", "toner-empty", "spool-area-full", "cover-open", "interlock-open", "door-open", "input-tray-missing", "media-low", "media-empty", "output-tray-missing", "output-area-almost-full", "output-area-full", "marker-supply-low", "marker-supply-empty", "marker-waste-almost-full", "marker-waste-full", "fuser-over-temp", "fuser-under-temp", "opc-near-eol", "opc-life-over", "developer-low", "developer-empty", "interpreter-resource-unavailable" }; private static final PrinterStateReason[] myEnumValueTable = { OTHER, MEDIA_NEEDED, MEDIA_JAM, MOVING_TO_PAUSED, PAUSED, SHUTDOWN, CONNECTING_TO_DEVICE, TIMED_OUT, STOPPING, STOPPED_PARTLY, TONER_LOW, TONER_EMPTY, SPOOL_AREA_FULL, COVER_OPEN, INTERLOCK_OPEN, DOOR_OPEN, INPUT_TRAY_MISSING, MEDIA_LOW, MEDIA_EMPTY, OUTPUT_TRAY_MISSING, OUTPUT_AREA_ALMOST_FULL, OUTPUT_AREA_FULL, MARKER_SUPPLY_LOW, MARKER_SUPPLY_EMPTY, MARKER_WASTE_ALMOST_FULL, MARKER_WASTE_FULL, FUSER_OVER_TEMP, FUSER_UNDER_TEMP, OPC_NEAR_EOL, OPC_LIFE_OVER, DEVELOPER_LOW, DEVELOPER_EMPTY, INTERPRETER_RESOURCE_UNAVAILABLE }; /** {@collect.stats} * Returns the string table for class PrinterStateReason. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class PrinterStateReason. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterStateReason and any vendor-defined subclasses, the * category is class PrinterStateReason itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterStateReason.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterStateReason and any vendor-defined subclasses, the * category name is <CODE>"printer-state-reason"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-state-reason"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.net.URI; import javax.print.attribute.Attribute; import javax.print.attribute.URISyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Destination is a printing attribute class, a URI, that is used to * indicate an alternate destination for the spooled printer formatted * data. Many PrintServices will not support the notion of a destination * other than the printer device, and so will not support this attribute. * <p> * A common use for this attribute will be applications which want * to redirect output to a local disk file : eg."file:out.prn". * Note that proper construction of "file:" scheme URI instances should * be performed using the <code>toURI()</code> method of class * {@link java.io.File File}. * See the documentation on that class for more information. * <p> * If a destination URI is specified in a PrintRequest and it is not * accessible for output by the PrintService, a PrintException will be thrown. * The PrintException may implement URIException to provide a more specific * cause. * <P> * <B>IPP Compatibility:</B> Destination is not an IPP attribute. * <P> * * @author Phil Race. */ public final class Destination extends URISyntax implements PrintJobAttribute, PrintRequestAttribute { private static final long serialVersionUID = 6776739171700415321L; /** {@collect.stats} * Constructs a new destination attribute with the specified URI. * * @param uri URI. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>uri</CODE> is null. */ public Destination(URI uri) { super (uri); } /** {@collect.stats} * Returns whether this destination attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class Destination. * <LI> * This destination attribute's URI and <CODE>object</CODE>'s URI * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this destination * attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof Destination); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Destination, the category is class Destination itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Destination.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Destination, the category name is <CODE>"spool-data-destination"</CODE>. * * @return Attribute category name. */ public final String getName() { return "spool-data-destination"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.DocAttribute; /** {@collect.stats} * Class DocumentName is a printing attribute class, a text attribute, that * specifies the name of a document. DocumentName is an attribute of the print * data (the doc), not of the Print Job. A document's name is an arbitrary * string defined by the client. * However if a JobName is not specified, the DocumentName should be used * instead, which implies that supporting specification of DocumentName * requires reporting of JobName and vice versa. * See {@link JobName JobName} for more information. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class DocumentName extends TextSyntax implements DocAttribute { private static final long serialVersionUID = 7883105848533280430L; /** {@collect.stats} * Constructs a new document name attribute with the given document name * and locale. * * @param documentName Document name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>documentName</CODE> is null. */ public DocumentName(String documentName, Locale locale) { super (documentName, locale); } /** {@collect.stats} * Returns whether this document name attribute is equivalent to the * passed in object. * To be equivalent, all of the following conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class DocumentName. * <LI> * This document name attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This document name attribute's locale and <CODE>object</CODE>'s locale * are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this document * name attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof DocumentName); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class DocumentName, the category is class DocumentName itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return DocumentName.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class DocumentName, the category name is <CODE>"document-name"</CODE>. * * @return Attribute category name. */ public final String getName() { return "document-name"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class NumberOfInterveningJobs is an integer valued printing attribute that * indicates the number of jobs that are ahead of this job in the relative * chronological order of expected time to complete (i.e., the current * scheduled order). * <P> * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class NumberOfInterveningJobs extends IntegerSyntax implements PrintJobAttribute { private static final long serialVersionUID = 2568141124844982746L; /** {@collect.stats} * Construct a new number of intervening jobs attribute with the given * integer value. * * @param value Integer value. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0. */ public NumberOfInterveningJobs(int value) { super(value, 0, Integer.MAX_VALUE); } /** {@collect.stats} * Returns whether this number of intervening jobs attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class NumberOfInterveningJobs. * <LI> * This number of intervening jobs attribute's value and * <CODE>object</CODE>'s value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this number of * intervening jobs attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof NumberOfInterveningJobs); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class NumberOfInterveningJobs, the * category is class NumberOfInterveningJobs itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return NumberOfInterveningJobs.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class NumberOfInterveningJobs, the * category name is <CODE>"number-of-intervening-jobs"</CODE>. * * @return Attribute category name. */ public final String getName() { return "number-of-intervening-jobs"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; /** {@collect.stats} * Class PDLOverrideSupported is a printing attribute class, an enumeration, * that expresses the printer's ability to attempt to override processing * instructions embedded in documents' print data with processing instructions * specified as attributes outside the print data. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public class PDLOverrideSupported extends EnumSyntax implements PrintServiceAttribute { private static final long serialVersionUID = -4393264467928463934L; /** {@collect.stats} * The printer makes no attempt to make the external job attribute values * take precedence over embedded instructions in the documents' print * data. */ public static final PDLOverrideSupported NOT_ATTEMPTED = new PDLOverrideSupported(0); /** {@collect.stats} * The printer attempts to make the external job attribute values take * precedence over embedded instructions in the documents' print data, * however there is no guarantee. */ public static final PDLOverrideSupported ATTEMPTED = new PDLOverrideSupported(1); /** {@collect.stats} * Construct a new PDL override supported enumeration value with the given * integer value. * * @param value Integer value. */ protected PDLOverrideSupported(int value) { super (value); } private static final String[] myStringTable = { "not-attempted", "attempted" }; private static final PDLOverrideSupported[] myEnumValueTable = { NOT_ATTEMPTED, ATTEMPTED }; /** {@collect.stats} * Returns the string table for class PDLOverrideSupported. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class PDLOverrideSupported. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PDLOverrideSupported and any vendor-defined subclasses, the * category is class PDLOverrideSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PDLOverrideSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PDLOverrideSupported and any vendor-defined subclasses, the * category name is <CODE>"pdl-override-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "pdl-override-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Date; import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class JobHoldUntil is a printing attribute class, a date-time attribute, that * specifies the exact date and time at which the job must become a candidate * for printing. * <P> * If the value of this attribute specifies a date-time that is in the future, * the printer should add the {@link JobStateReason JobStateReason} value of * JOB_HOLD_UNTIL_SPECIFIED to the job's {@link JobStateReasons JobStateReasons} * attribute, must move the job to the PENDING_HELD state, and must not schedule * the job for printing until the specified date-time arrives. * <P> * When the specified date-time arrives, the printer must remove the {@link * JobStateReason JobStateReason} value of JOB_HOLD_UNTIL_SPECIFIED from the * job's {@link JobStateReasons JobStateReasons} attribute, if present. If there * are no other job state reasons that keep the job in the PENDING_HELD state, * the printer must consider the job as a candidate for processing by moving the * job to the PENDING state. * <P> * If the specified date-time has already passed, the job must be a candidate * for processing immediately. Thus, one way to make the job immediately become * a candidate for processing is to specify a JobHoldUntil attribute constructed * like this (denoting a date-time of January 1, 1970, 00:00:00 GMT): * <PRE> * JobHoldUntil immediately = new JobHoldUntil (new Date (0L)); * </PRE> * <P> * If the client does not supply this attribute in a Print Request and the * printer supports this attribute, the printer must use its * (implementation-dependent) default JobHoldUntil value at job submission time * (unlike most job template attributes that are used if necessary at job * processing time). * <P> * To construct a JobHoldUntil attribute from separate values of the year, * month, day, hour, minute, and so on, use a {@link java.util.Calendar * Calendar} object to construct a {@link java.util.Date Date} object, then use * the {@link java.util.Date Date} object to construct the JobHoldUntil * attribute. To convert a JobHoldUntil attribute to separate values of the * year, month, day, hour, minute, and so on, create a {@link java.util.Calendar * Calendar} object and set it to the {@link java.util.Date Date} from the * JobHoldUntil attribute. * <P> * <B>IPP Compatibility:</B> Although IPP supports a "job-hold-until" attribute * specified as a keyword, IPP does not at this time support a "job-hold-until" * attribute specified as a date and time. However, the date and time can be * converted to one of the standard IPP keywords with some loss of precision; * for example, a JobHoldUntil value with today's date and 9:00pm local time * might be converted to the standard IPP keyword "night". The category name * returned by <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobHoldUntil extends DateTimeSyntax implements PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -1664471048860415024L; /** {@collect.stats} * Construct a new job hold until date-time attribute with the given * {@link java.util.Date Date} value. * * @param dateTime {@link java.util.Date Date} value. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null. */ public JobHoldUntil(Date dateTime) { super (dateTime); } /** {@collect.stats} * Returns whether this job hold until attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobHoldUntil. * <LI> * This job hold until attribute's {@link java.util.Date Date} value and * <CODE>object</CODE>'s {@link java.util.Date Date} value are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job hold * until attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof JobHoldUntil); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobHoldUntil, the category is class JobHoldUntil itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobHoldUntil.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobHoldUntil, the category name is <CODE>"job-hold-until"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-hold-until"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.ResolutionSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class PrinterResolution is a printing attribute class that specifies an * exact resolution supported by a printer or to be used for a print job. * This attribute assumes that printers have a small set of device resolutions * at which they can operate rather than a continuum. * <p> * PrinterResolution is used in multiple ways: * <OL TYPE=1> * <LI> * When a client searches looking for a printer that supports the client's * desired resolution exactly (no more, no less), the client specifies * an instance of class PrinterResolution indicating the exact resolution the * client wants. Only printers supporting that exact resolution will match the * search. * <P> * <LI> * When a client needs to print a job using the client's desired resolution * exactly (no more, no less), the client specifies an instance of class * PrinterResolution as an attribute of the Print Job. This will fail if the * Print Job doesn't support that exact resolution, and Fidelity is set to * true. * </OL> * If a client wants to locate a printer supporting a resolution * greater than some required minimum, then it may be necessary to exclude * this attribute from a lookup request and to directly query the set of * supported resolutions, and specify the one that most closely meets * the client's requirements. * In some cases this may be more simply achieved by specifying a * PrintQuality attribute which often controls resolution. * <P> * <P> * <B>IPP Compatibility:</B> The information needed to construct an IPP * <CODE>"printer-resolution"</CODE> attribute can be obtained by calling * methods on the PrinterResolution object. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public final class PrinterResolution extends ResolutionSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 13090306561090558L; /** {@collect.stats} * Construct a new printer resolution attribute from the given items. * * @param crossFeedResolution * Cross feed direction resolution. * @param feedResolution * Feed direction resolution. * @param units * Unit conversion factor, e.g. <code>ResolutionSyntax.DPI</CODE> * or <code>ResolutionSyntax.>DPCM</CODE>. * * @exception IllegalArgumentException * (unchecked exception) Thrown if <CODE>crossFeedResolution</CODE> < * 1 or <CODE>feedResolution</CODE> < 1 or <CODE>units</CODE> < 1. */ public PrinterResolution(int crossFeedResolution, int feedResolution, int units) { super (crossFeedResolution, feedResolution, units); } /** {@collect.stats} * Returns whether this printer resolution attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions * must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class PrinterResolution. * <LI> * This attribute's cross feed direction resolution is equal to * <CODE>object</CODE>'s cross feed direction resolution. * <LI> * This attribute's feed direction resolution is equal to * <CODE>object</CODE>'s feed direction resolution. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this printer * resolution attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof PrinterResolution); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PrinterResolution, the category is class PrinterResolution itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PrinterResolution.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PrinterResolution, the * category name is <CODE>"printer-resolution"</CODE>. * * @return Attribute category name. */ public final String getName() { return "printer-resolution"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class Severity is a printing attribute class, an enumeration, that denotes * the severity of a {@link PrinterStateReason PrinterStateReason} attribute. * <P> * Instances of Severity do not appear in a Print Service's attribute set * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons} * attribute appears in the Print Service's attribute set. * The {@link PrinterStateReasons * PrinterStateReasons} attribute contains zero, one, or more than one {@link * PrinterStateReason PrinterStateReason} objects which pertain to the Print * Service's status, and each {@link PrinterStateReason PrinterStateReason} * object is associated with a Severity level of REPORT (least severe), * WARNING, or ERROR (most severe). * The printer adds a {@link PrinterStateReason * PrinterStateReason} object to the Print Service's * {@link PrinterStateReasons PrinterStateReasons} attribute when the * corresponding condition becomes true * of the printer, and the printer removes the {@link PrinterStateReason * PrinterStateReason} object again when the corresponding condition becomes * false, regardless of whether the Print Service's overall * {@link PrinterState PrinterState} also changed. * <P> * <B>IPP Compatibility:</B> * <code>Severity.toString()</code> returns either "error", "warning", or * "report". The string values returned by * each individual {@link PrinterStateReason} and * associated {@link Severity} object's <CODE>toString()</CODE> * methods, concatenated together with a hyphen (<CODE>"-"</CODE>) in * between, gives the IPP keyword value for a {@link PrinterStateReasons}. * The category name returned by <CODE>getName()</CODE> gives the IPP * attribute name. * <P> * * @author Alan Kaminsky */ public final class Severity extends EnumSyntax implements Attribute { private static final long serialVersionUID = 8781881462717925380L; /** {@collect.stats} * Indicates that the {@link PrinterStateReason PrinterStateReason} is a * "report" (least severe). An implementation may choose to omit some or * all reports. * Some reports specify finer granularity about the printer state; * others serve as a precursor to a warning. A report must contain nothing * that could affect the printed output. */ public static final Severity REPORT = new Severity (0); /** {@collect.stats} * Indicates that the {@link PrinterStateReason PrinterStateReason} is a * "warning." An implementation may choose to omit some or all warnings. * Warnings serve as a precursor to an error. A warning must contain * nothing that prevents a job from completing, though in some cases the * output may be of lower quality. */ public static final Severity WARNING = new Severity (1); /** {@collect.stats} * Indicates that the {@link PrinterStateReason PrinterStateReason} is an * "error" (most severe). An implementation must include all errors. * If this attribute contains one or more errors, the printer's * {@link PrinterState PrinterState} must be STOPPED. */ public static final Severity ERROR = new Severity (2); /** {@collect.stats} * Construct a new severity enumeration value with the given integer * value. * * @param value Integer value. */ protected Severity(int value) { super (value); } private static final String[] myStringTable = { "report", "warning", "error" }; private static final Severity[] myEnumValueTable = { REPORT, WARNING, ERROR }; /** {@collect.stats} * Returns the string table for class Severity. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class Severity. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Severity, the category is class Severity itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Severity.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Severit, the category name is <CODE>"severity"</CODE>. * * @return Attribute category name. */ public final String getName() { return "severity"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.PrintRequestAttribute; /** {@collect.stats} * Class RequestingUserName is a printing attribute class, a text attribute, * that specifies the name of the end user that submitted the print job. A * requesting user name is an arbitrary string defined by the client. The * printer does not put the client-specified RequestingUserName attribute into * the Print Job's attribute set; rather, the printer puts in a {@link * JobOriginatingUserName JobOriginatingUserName} attribute. * This means that services which support specifying a username with this * attribute should also report a JobOriginatingUserName in the job's * attribute set. Note that many print services may have a way to independently * authenticate the user name, and so may state support for a * requesting user name, but in practice will then report the user name * authenticated by the service rather than that specified via this * attribute. * <P> * <B>IPP Compatibility:</B> The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class RequestingUserName extends TextSyntax implements PrintRequestAttribute { private static final long serialVersionUID = -2683049894310331454L; /** {@collect.stats} * Constructs a new requesting user name attribute with the given user * name and locale. * * @param userName User name. * @param locale Natural language of the text string. null * is interpreted to mean the default locale as returned * by <code>Locale.getDefault()</code> * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>userName</CODE> is null. */ public RequestingUserName(String userName, Locale locale) { super (userName, locale); } /** {@collect.stats} * Returns whether this requesting user name attribute is equivalent to * the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class RequestingUserName. * <LI> * This requesting user name attribute's underlying string and * <CODE>object</CODE>'s underlying string are equal. * <LI> * This requesting user name attribute's locale and * <CODE>object</CODE>'s locale are equal. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this requesting * user name attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals(object) && object instanceof RequestingUserName); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class RequestingUserName, the * category is class RequestingUserName itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return RequestingUserName.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class RequestingUserName, the * category name is <CODE>"requesting-user-name"</CODE>. * * @return Attribute category name. */ public final String getName() { return "requesting-user-name"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class Finishings is a printing attribute class, an enumeration, that * identifies whether the printer applies a finishing operation of some kind * of binding to each copy of each printed document in the job. For multidoc * print jobs (jobs with multiple documents), the * {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute determines what constitutes a "copy" * for purposes of finishing. * <P> * Standard Finishings values are: * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout"> * <TR> * <TD WIDTH=10%> * &nbsp; * </TD> * <TD WIDTH=27%> * {@link #NONE <CODE>NONE</CODE>} * </TD> * <TD WIDTH=27%> * {@link #STAPLE <CODE>STAPLE</CODE>} * </TD> * <TD WIDTH=36%> * {@link #EDGE_STITCH <CODE>EDGE_STITCH</CODE>} * </TD> * </TR> * <TR> * <TD> * &nbsp; * </TD> * <TD> * {@link #BIND <CODE>BIND</CODE>} * </TD> * <TD> * {@link #SADDLE_STITCH <CODE>SADDLE_STITCH</CODE>} * </TD> * <TD> * {@link #COVER <CODE>COVER</CODE>} * </TD> * <TD> * &nbsp; * </TD> * </TR> * </TABLE> * <P> * The following Finishings values are more specific; they indicate a * corner or an edge as if the document were a portrait document: * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout"> * <TR> * <TD WIDTH=10%> * &nbsp; * </TD> * <TD WIDTH=27%> * {@link #STAPLE_TOP_LEFT <CODE>STAPLE_TOP_LEFT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #EDGE_STITCH_LEFT <CODE>EDGE_STITCH_LEFT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #STAPLE_DUAL_LEFT <CODE>STAPLE_DUAL_LEFT</CODE>} * </TD> * <TD WIDTH=9%> * &nbsp; * </TD> * </TR> * <TR> * <TD WIDTH=10%> * &nbsp; * </TD> * <TD WIDTH=27%> * {@link #STAPLE_BOTTOM_LEFT <CODE>STAPLE_BOTTOM_LEFT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #EDGE_STITCH_TOP <CODE>EDGE_STITCH_TOP</CODE>} * </TD> * <TD WIDTH=27%> * {@link #STAPLE_DUAL_TOP <CODE>STAPLE_DUAL_TOP</CODE>} * </TD> * <TD WIDTH=9%> * &nbsp; * </TD> * </TR> * <TR> * <TD WIDTH=10%> * &nbsp; * </TD> * <TD WIDTH=27%> * {@link #STAPLE_TOP_RIGHT <CODE>STAPLE_TOP_RIGHT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #EDGE_STITCH_RIGHT <CODE>EDGE_STITCH_RIGHT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #STAPLE_DUAL_RIGHT <CODE>STAPLE_DUAL_RIGHT</CODE>} * </TD> * <TD WIDTH=9%> * &nbsp; * </TD> * </TR> * <TR> * <TD WIDTH=10%> * &nbsp; * </TD> * <TD WIDTH=27%> * {@link #STAPLE_BOTTOM_RIGHT <CODE>STAPLE_BOTTOM_RIGHT</CODE>} * </TD> * <TD WIDTH=27%> * {@link #EDGE_STITCH_BOTTOM <CODE>EDGE_STITCH_BOTTOM</CODE>} * </TD> * <TD WIDTH=27%> * {@link #STAPLE_DUAL_BOTTOM <CODE>STAPLE_DUAL_BOTTOM</CODE>} * </TD> * <TD WIDTH=9%> * &nbsp; * </TD> * </TR> * </TABLE> * <P> * The <CODE>STAPLE_<I>XXX</I></CODE> values are specified with respect to the * document as if the document were a portrait document. If the document is * actually a landscape or a reverse-landscape document, the client supplies the * appropriate transformed value. For example, to position a staple in the upper * left hand corner of a landscape document when held for reading, the client * supplies the <CODE>STAPLE_BOTTOM_LEFT</CODE> value (since landscape is * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the * other hand, to position a staple in the upper left hand corner of a * reverse-landscape document when held for reading, the client supplies the * <CODE>STAPLE_TOP_RIGHT</CODE> value (since reverse-landscape is defined as a * -90 degree rotation from portrait, i.e., clockwise). * <P> * The angle (vertical, horizontal, angled) of each staple with respect to the * document depends on the implementation which may in turn depend on the value * of the attribute. * <P> * The effect of a Finishings attribute on a multidoc print job (a job * with multiple documents) depends on whether all the docs have the same * binding specified or whether different docs have different bindings * specified, and on the (perhaps defaulted) value of the {@link * MultipleDocumentHandling MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same binding specified, then any value of {@link * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the * printer's processing depends on the {@link MultipleDocumentHandling * MultipleDocumentHandling} value: * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be bound together as one output * document with the specified binding. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one * output document with the specified binding, and the first impression of each * input doc will always start on a new media sheet. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound * separately with the specified binding. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately * with the specified binding. * </UL> * <P> * <LI> * If different docs have different bindings specified, then only two values of * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the * printer reports an error when the job is submitted if any other value is * specified: * <UL> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound * separately with its own specified binding. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately * with its own specified binding. * </UL> * </UL> * <P> * <B>IPP Compatibility:</B> Class Finishings encapsulates some of the * IPP enum values that can be included in an IPP "finishings" attribute, which * is a set of enums. The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * In IPP Finishings is a multi-value attribute, this API currently allows * only one binding to be specified. * * @author Alan Kaminsky */ public class Finishings extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -627840419548391754L; /** {@collect.stats} * Perform no binding. */ public static final Finishings NONE = new Finishings(3); /** {@collect.stats} * Bind the document(s) with one or more staples. The exact number and * placement of the staples is site-defined. */ public static final Finishings STAPLE = new Finishings(4); /** {@collect.stats} * This value is specified when it is desired to select a non-printed (or * pre-printed) cover for the document. This does not supplant the * specification of a printed cover (on cover stock medium) by the * document itself. */ public static final Finishings COVER = new Finishings(6); /** {@collect.stats} * 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 Finishings BIND = new Finishings(7); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along the * middle fold. The exact number and placement of the staples and the * middle fold is implementation- and/or site-defined. */ public static final Finishings SADDLE_STITCH = new Finishings(8); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along one * edge. The exact number and placement of the staples is implementation- * and/or site- defined. */ public static final Finishings EDGE_STITCH = new Finishings(9); /** {@collect.stats} * Bind the document(s) with one or more staples in the top left corner. */ public static final Finishings STAPLE_TOP_LEFT = new Finishings(20); /** {@collect.stats} * Bind the document(s) with one or more staples in the bottom left * corner. */ public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21); /** {@collect.stats} * Bind the document(s) with one or more staples in the top right corner. */ public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22); /** {@collect.stats} * Bind the document(s) with one or more staples in the bottom right * corner. */ public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along the * left edge. The exact number and placement of the staples is * implementation- and/or site-defined. */ public static final Finishings EDGE_STITCH_LEFT = new Finishings(24); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along the * top edge. The exact number and placement of the staples is * implementation- and/or site-defined. */ public static final Finishings EDGE_STITCH_TOP = new Finishings(25); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along the * right edge. The exact number and placement of the staples is * implementation- and/or site-defined. */ public static final Finishings EDGE_STITCH_RIGHT = new Finishings(26); /** {@collect.stats} * Bind the document(s) with one or more staples (wire stitches) along the * bottom edge. The exact number and placement of the staples is * implementation- and/or site-defined. */ public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(27); /** {@collect.stats} * Bind the document(s) with two staples (wire stitches) along the left * edge assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28); /** {@collect.stats} * Bind the document(s) with two staples (wire stitches) along the top * edge assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_TOP = new Finishings(29); /** {@collect.stats} * Bind the document(s) with two staples (wire stitches) along the right * edge assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(30); /** {@collect.stats} * Bind the document(s) with two staples (wire stitches) along the bottom * edge assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(31); /** {@collect.stats} * Construct a new finishings binding enumeration value with the given * integer value. * * @param value Integer value. */ protected Finishings(int value) { super(value); } private static final String[] myStringTable = {"none", "staple", null, "cover", "bind", "saddle-stitch", "edge-stitch", null, // The next ten enum values are reserved. 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 Finishings[] myEnumValueTable = {NONE, STAPLE, null, COVER, BIND, SADDLE_STITCH, EDGE_STITCH, null, // The next ten enum values are reserved. 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 }; /** {@collect.stats} * Returns the string table for class Finishings. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class Finishings. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Returns the lowest integer value used by class Finishings. */ protected int getOffset() { return 3; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Finishings and any vendor-defined subclasses, the * category is class Finishings itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Finishings.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class Finishings and any vendor-defined subclasses, the * category name is <CODE>"finishings"</CODE>. * * @return Attribute category name. */ public final String getName() { return "finishings"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class JobMediaSheetsSupported is a printing attribute class, a set of * integers, that gives the supported values for a {@link JobMediaSheets * JobMediaSheets} attribute. It is restricted to a single contiguous range of * integers; multiple non-overlapping ranges are not allowed. This gives the * lower and upper bounds of the total sizes of print jobs in number of media * sheets that the printer will accept. * <P> * <B>IPP Compatibility:</B> The JobMediaSheetsSupported attribute's canonical * array form gives the lower and upper bound for the range of values to be * included in an IPP "job-media-sheets-supported" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobMediaSheetsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = 2953685470388672940L; /** {@collect.stats} * Construct a new job media sheets supported attribute containing a single * range of integers. That is, only those values of JobMediaSheets in the * one range are supported. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 0. */ public JobMediaSheetsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 0) { throw new IllegalArgumentException ("Job K octets value < 0 specified"); } } /** {@collect.stats} * Returns whether this job media sheets supported attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobMediaSheetsSupported. * <LI> * This job media sheets supported attribute's members and * <CODE>object</CODE>'s members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job media * sheets supported attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobMediaSheetsSupported); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobMediaSheetsSupported, the * category is class JobMediaSheetsSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobMediaSheetsSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobMediaSheetsSupported, the * category name is <CODE>"job-media-sheets-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-media-sheets-supported"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class SheetCollate is a printing attribute class, an enumeration, that * specifies whether or not the media sheets of each copy of each printed * document in a job are to be in sequence, when multiple copies of the document * are specified by the {@link Copies Copies} attribute. When SheetCollate is * COLLATED, each copy of each document is printed with the print-stream sheets * in sequence. When SheetCollate is UNCOLLATED, each print-stream sheet is * printed a number of times equal to the value of the {@link Copies Copies} * attribute in succession. For example, suppose a document produces two media * sheets as output, {@link Copies Copies} is 6, and SheetCollate is UNCOLLATED; * in this case six copies of the first media sheet are printed followed by * six copies of the second media sheet. * <P> * Whether the effect of sheet collation is achieved by placing copies of a * document in multiple output bins or in the same output bin with * implementation defined document separation is implementation dependent. * Also whether it is achieved by making multiple passes over the job or by * using an output sorter is implementation dependent. * <P> * If a printer does not support the SheetCollate attribute (meaning the client * cannot specify any particular sheet collation), the printer must behave as * though SheetCollate were always set to COLLATED. * <P> * The SheetCollate attribute interacts with the {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute. The {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute describes the collation of entire * documents, and the SheetCollate attribute describes the semantics of * collating individual pages within a document. * <P> * The effect of a SheetCollate attribute on a multidoc print job (a job with * multiple documents) depends on whether all the docs have the same sheet * collation specified or whether different docs have different sheet * collations specified, and on the (perhaps defaulted) value of the {@link * MultipleDocumentHandling MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same sheet collation specified, then the following * combinations of SheetCollate and {@link MultipleDocumentHandling * MultipleDocumentHandling} are permitted, and the printer reports an error * when the job is submitted if any other combination is specified: * <UL> * <LI> * SheetCollate = COLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be * combined into one output document. Multiple copies of the output document * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . ., * 1, 2, 3, . . . * <P> * <LI> * SheetCollate = COLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs * will be combined into one output document, and the first impression of each * input doc will always start on a new media sheet. Multiple copies of the * output document will be produced with pages in collated order, i.e. pages * 1, 2, 3, . . ., 1, 2, 3, . . . * <P> * <LI> * SheetCollate = COLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each * input doc will remain a separate output document. Multiple copies of each * output document (call them A, B, . . .) will be produced with each document's * pages in collated order, but the documents themselves in uncollated order, * i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, B2, B3, . . ., B1, B2, * B3, . . . * <P> * <LI> * SheetCollate = COLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input * doc will remain a separate output document. Multiple copies of each output * document (call them A, B, . . .) will be produced with each document's pages * in collated order, with the documents themselves also in collated order, i.e. * pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, A3, . . ., B1, B2, B3, * . . . * <P> * <LI> * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be * combined into one output document. Multiple copies of the output document * will be produced with pages in uncollated order, i.e. pages 1, 1, . . ., * 2, 2, . . ., 3, 3, . . . * <P> * <LI> * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs * will be combined into one output document, and the first impression of each * input doc will always start on a new media sheet. Multiple copies of the * output document will be produced with pages in uncollated order, i.e. pages * 1, 1, . . ., 2, 2, . . ., 3, 3, . . . * <P> * <LI> * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each * input doc will remain a separate output document. Multiple copies of each * output document (call them A, B, . . .) will be produced with each document's * pages in uncollated order, with the documents themselves also in uncollated * order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . ., B1, B1, . . ., * B2, B2, . . ., B3, B3, . . . * </UL> * <P> * <LI> * If different docs have different sheet collations specified, then only one * value of {@link MultipleDocumentHandling MultipleDocumentHandling} is * permitted, and the printer reports an error when the job is submitted if any * other value is specified: * <UL> * <LI> * {@link MultipleDocumentHandling MultipleDocumentHandling} = * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a separate * output document. Multiple copies of each output document (call them A, B, * . . .) will be produced with each document's pages in collated or uncollated * order as the corresponding input doc's SheetCollate attribute specifies, and * with the documents themselves in uncollated order. If document A had * SheetCollate = UNCOLLATED and document B had SheetCollate = COLLATED, the * following pages would be produced: A1, A1, . . ., A2, A2, . . ., A3, A3, * . . ., B1, B2, B3, . . ., B1, B2, B3, . . . * </UL> * </UL> * <P> * <B>IPP Compatibility:</B> SheetCollate is not an IPP attribute at present. * <P> * * @see MultipleDocumentHandling * * @author Alan Kaminsky */ public final class SheetCollate extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = 7080587914259873003L; /** {@collect.stats} * Sheets within a document appear in uncollated order when multiple * copies are printed. */ public static final SheetCollate UNCOLLATED = new SheetCollate(0); /** {@collect.stats} * Sheets within a document appear in collated order when multiple copies * are printed. */ public static final SheetCollate COLLATED = new SheetCollate(1); /** {@collect.stats} * Construct a new sheet collate enumeration value with the given integer * value. * * @param value Integer value. */ protected SheetCollate(int value) { super (value); } private static final String[] myStringTable = { "uncollated", "collated" }; private static final SheetCollate[] myEnumValueTable = { UNCOLLATED, COLLATED }; /** {@collect.stats} * Returns the string table for class SheetCollate. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class SheetCollate. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class SheetCollate, the category is class SheetCollate itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return SheetCollate.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class SheetCollate, the category name is <CODE>"sheet-collate"</CODE>. * * @return Attribute category name. */ public final String getName() { return "sheet-collate"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Attribute; /** {@collect.stats} * Class ReferenceUriSchemesSupported is a printing attribute class * an enumeration, that indicates a "URI scheme," such as "http:" or "ftp:", * that a printer can use to retrieve print data stored at a URI location. * If a printer supports doc flavors with a print data representation class of * <CODE>"java.net.URL"</CODE>, the printer uses instances of class * ReferenceUriSchemesSupported to advertise the URI schemes it can accept. * The acceptable URI schemes are included as service attributes in the * lookup service; this lets clients search the * for printers that can get print data using a certain URI scheme. The * acceptable URI schemes can also be queried using the capability methods in * interface <code>PrintService</code>. However, * ReferenceUriSchemesSupported attributes are used solely for determining * acceptable URI schemes, they are never included in a doc's, * print request's, print job's, or print service's attribute set. * <P> * The Internet Assigned Numbers Authority maintains the * <A HREF="http://www.isi.edu/in-notes/iana/assignments/url-schemes">official * list of URI schemes</A>. * <p> * Class ReferenceUriSchemesSupported defines enumeration values for widely * used URI schemes. A printer that supports additional URI schemes * can define them in a subclass of class ReferenceUriSchemesSupported. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public class ReferenceUriSchemesSupported extends EnumSyntax implements Attribute { private static final long serialVersionUID = -8989076942813442805L; /** {@collect.stats} * File Transfer Protocol (FTP). */ public static final ReferenceUriSchemesSupported FTP = new ReferenceUriSchemesSupported(0); /** {@collect.stats} * HyperText Transfer Protocol (HTTP). */ public static final ReferenceUriSchemesSupported HTTP = new ReferenceUriSchemesSupported(1); /** {@collect.stats} * Secure HyperText Transfer Protocol (HTTPS). */ public static final ReferenceUriSchemesSupported HTTPS = new ReferenceUriSchemesSupported(2); /** {@collect.stats} * Gopher Protocol. */ public static final ReferenceUriSchemesSupported GOPHER = new ReferenceUriSchemesSupported(3); /** {@collect.stats} * USENET news. */ public static final ReferenceUriSchemesSupported NEWS = new ReferenceUriSchemesSupported(4); /** {@collect.stats} * USENET news using Network News Transfer Protocol (NNTP). */ public static final ReferenceUriSchemesSupported NNTP = new ReferenceUriSchemesSupported(5); /** {@collect.stats} * Wide Area Information Server (WAIS) protocol. */ public static final ReferenceUriSchemesSupported WAIS = new ReferenceUriSchemesSupported(6); /** {@collect.stats} * Host-specific file names. */ public static final ReferenceUriSchemesSupported FILE = new ReferenceUriSchemesSupported(7); /** {@collect.stats} * Construct a new reference URI scheme enumeration value with the given * integer value. * * @param value Integer value. */ protected ReferenceUriSchemesSupported(int value) { super (value); } private static final String[] myStringTable = { "ftp", "http", "https", "gopher", "news", "nntp", "wais", "file", }; private static final ReferenceUriSchemesSupported[] myEnumValueTable = { FTP, HTTP, HTTPS, GOPHER, NEWS, NNTP, WAIS, FILE, }; /** {@collect.stats} * Returns the string table for class ReferenceUriSchemesSupported. */ protected String[] getStringTable() { return (String[])myStringTable.clone(); } /** {@collect.stats} * Returns the enumeration value table for class * ReferenceUriSchemesSupported. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class ReferenceUriSchemesSupported and any vendor-defined * subclasses, the category is class ReferenceUriSchemesSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return ReferenceUriSchemesSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class ReferenceUriSchemesSupported and any vendor-defined * subclasses, the category name is * <CODE>"reference-uri-schemes-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "reference-uri-schemes-supported"; } }
Java
/* * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; /** {@collect.stats} * Class PresentationDirection is a printing attribute class, an enumeration, * that is used in conjunction with the {@link NumberUp NumberUp} attribute to * indicate the layout of multiple print-stream pages to impose upon a * single side of an instance of a selected medium. * This is useful to mirror the text layout conventions of different scripts. * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom" * and Japanese is usually "tobottom-toleft". * <P> * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1 * attribute; it is an attribute in the Production Printing Extension * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>) * of IPP 1.1. The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Phil Race. */ public final class PresentationDirection extends EnumSyntax implements PrintJobAttribute, PrintRequestAttribute { private static final long serialVersionUID = 8294728067230931780L; /** {@collect.stats} * Pages are laid out in columns starting at the top left, * proceeeding towards the bottom & right. */ public static final PresentationDirection TOBOTTOM_TORIGHT = new PresentationDirection(0); /** {@collect.stats} * Pages are laid out in columns starting at the top right, * proceeeding towards the bottom & left. */ public static final PresentationDirection TOBOTTOM_TOLEFT = new PresentationDirection(1); /** {@collect.stats} * Pages are laid out in columns starting at the bottom left, * proceeeding towards the top & right. */ public static final PresentationDirection TOTOP_TORIGHT = new PresentationDirection(2); /** {@collect.stats} * Pages are laid out in columns starting at the bottom right, * proceeeding towards the top & left. */ public static final PresentationDirection TOTOP_TOLEFT = new PresentationDirection(3); /** {@collect.stats} * Pages are laid out in rows starting at the top left, * proceeeding towards the right & bottom. */ public static final PresentationDirection TORIGHT_TOBOTTOM = new PresentationDirection(4); /** {@collect.stats} * Pages are laid out in rows starting at the bottom left, * proceeeding towards the right & top. */ public static final PresentationDirection TORIGHT_TOTOP = new PresentationDirection(5); /** {@collect.stats} * Pages are laid out in rows starting at the top right, * proceeeding towards the left & bottom. */ public static final PresentationDirection TOLEFT_TOBOTTOM = new PresentationDirection(6); /** {@collect.stats} * Pages are laid out in rows starting at the bottom right, * proceeeding towards the left & top. */ public static final PresentationDirection TOLEFT_TOTOP = new PresentationDirection(7); /** {@collect.stats} * Construct a new presentation direction enumeration value with the given * integer value. * * @param value Integer value. */ private PresentationDirection(int value) { super (value); } private static final String[] myStringTable = { "tobottom-toright", "tobottom-toleft", "totop-toright", "totop-toleft", "toright-tobottom", "toright-totop", "toleft-tobottom", "toleft-totop", }; private static final PresentationDirection[] myEnumValueTable = { TOBOTTOM_TORIGHT, TOBOTTOM_TOLEFT, TOTOP_TORIGHT, TOTOP_TOLEFT, TORIGHT_TOBOTTOM, TORIGHT_TOTOP, TOLEFT_TOBOTTOM, TOLEFT_TOTOP, }; /** {@collect.stats} * Returns the string table for class PresentationDirection. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class PresentationDirection. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class PresentationDirection * the category is class PresentationDirection itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return PresentationDirection.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class PresentationDirection * the category name is <CODE>"presentation-direction"</CODE>. * * @return Attribute category name. */ public final String getName() { return "presentation-direction"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** {@collect.stats} * Class OrientationRequested is a printing attribute class, an enumeration, * that indicates the desired orientation for printed print-stream pages; it * does not describe the orientation of the client-supplied print-stream * pages. * <P> * For some document formats (such as <CODE>"application/postscript"</CODE>), * the desired orientation of the print-stream pages is specified within the * document data. This information is generated by a device driver prior to * the submission of the print job. Other document formats (such as * <CODE>"text/plain"</CODE>) do not include the notion of desired orientation * within the document data. In the latter case it is possible for the printer * to bind the desired orientation to the document data after it has been * submitted. It is expected that a printer would only support the * OrientationRequested attribute for some document formats (e.g., * <CODE>"text/plain"</CODE> or <CODE>"text/html"</CODE>) but not others (e.g. * <CODE>"application/postscript"</CODE>). This is no different from any other * job template attribute, since a print job can always impose constraints * among the values of different job template attributes. * However, a special mention * is made here since it is very likely that a printer will support the * OrientationRequested attribute for only a subset of the supported document * formats. * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class OrientationRequested extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -4447437289862822276L; /** {@collect.stats} * The content will be imaged across the short edge of the medium. */ public static final OrientationRequested PORTRAIT = new OrientationRequested(3); /** {@collect.stats} * The content will be imaged across the long edge of the medium. * Landscape is defined to be a rotation of the print-stream page to be * imaged by +90 degrees with respect to the medium * (i.e. anti-clockwise) from the * portrait orientation. <I>Note:</I> The +90 direction was chosen because * simple finishing on the long edge is the same edge whether portrait or * landscape. */ public static final OrientationRequested LANDSCAPE = new OrientationRequested(4); /** {@collect.stats} * The content will be imaged across the long edge of the medium, but in * the opposite manner from landscape. Reverse-landscape is defined to be * a rotation of the print-stream page to be imaged by -90 degrees with * respect to the medium (i.e. clockwise) from the portrait orientation. * <I>Note:</I> The REVERSE_LANDSCAPE value was added because some * applications rotate landscape -90 degrees from portrait, rather than * +90 degrees. */ public static final OrientationRequested REVERSE_LANDSCAPE = new OrientationRequested(5); /** {@collect.stats} * The content will be imaged across the short edge of the medium, but in * the opposite manner from portrait. Reverse-portrait is defined to be a * rotation of the print-stream page to be imaged by 180 degrees with * respect to the medium from the portrait orientation. <I>Note:</I> The * REVERSE_PORTRAIT value was added for use with the {@link * Finishings Finishings} attribute in cases where the * opposite edge is desired for finishing a portrait document on simple * finishing devices that have only one finishing position. Thus a * <CODE>"text/plain"</CODE> portrait document can be stapled "on the * right" by a simple finishing device as is common use with some * Middle Eastern languages such as Hebrew. */ public static final OrientationRequested REVERSE_PORTRAIT = new OrientationRequested(6); /** {@collect.stats} * Construct a new orientation requested enumeration value with the given * integer value. * * @param value Integer value. */ protected OrientationRequested(int value) { super(value); } private static final String[] myStringTable = { "portrait", "landscape", "reverse-landscape", "reverse-portrait" }; private static final OrientationRequested[] myEnumValueTable = { PORTRAIT, LANDSCAPE, REVERSE_LANDSCAPE, REVERSE_PORTRAIT }; /** {@collect.stats} * Returns the string table for class OrientationRequested. */ protected String[] getStringTable() { return myStringTable; } /** {@collect.stats} * Returns the enumeration value table for class OrientationRequested. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** {@collect.stats} * Returns the lowest integer value used by class OrientationRequested. */ protected int getOffset() { return 3; } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class OrientationRequested, the * category is class OrientationRequested itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return OrientationRequested.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class OrientationRequested, the * category name is <CODE>"orientation-requested"</CODE>. * * @return Attribute category name. */ public final String getName() { return "orientation-requested"; } }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; /** {@collect.stats} * Class JobImpressionsSupported is a printing attribute class, a set of * integers, that gives the supported values for a {@link JobImpressions * JobImpressions} attribute. It is restricted to a single contiguous range of * integers; multiple non-overlapping ranges are not allowed. This gives the * lower and upper bounds of the total sizes of print jobs in number of * impressions that the printer will accept. * <P> * <B>IPP Compatibility:</B> The JobImpressionsSupported attribute's canonical * array form gives the lower and upper bound for the range of values to be * included in an IPP "job-impressions-supported" attribute. See class {@link * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an * explanation of canonical array form. The category name returned by * <CODE>getName()</CODE> gives the IPP attribute name. * <P> * * @author Alan Kaminsky */ public final class JobImpressionsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { private static final long serialVersionUID = -4887354803843173692L; /** {@collect.stats} * Construct a new job impressions supported attribute containing a single * range of integers. That is, only those values of JobImpressions in the * one range are supported. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if a null range is specified or if a * non-null range is specified with <CODE>lowerBound</CODE> less than * 0. */ public JobImpressionsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); if (lowerBound > upperBound) { throw new IllegalArgumentException("Null range specified"); } else if (lowerBound < 0) { throw new IllegalArgumentException( "Job K octets value < 0 specified"); } } /** {@collect.stats} * Returns whether this job impressions supported attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class JobImpressionsSupported. * <LI> * This job impressions supported attribute's members and * <CODE>object</CODE>'s members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this job * impressions supported attribute, false otherwise. */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobImpressionsSupported); } /** {@collect.stats} * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class JobImpressionsSupported, the category is class * JobImpressionsSupported itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return JobImpressionsSupported.class; } /** {@collect.stats} * Get the name of the category of which this attribute value is an * instance. * <P> * For class JobImpressionsSupported, the category name is * <CODE>"job-impressions-supported"</CODE>. * * @return Attribute category name. */ public final String getName() { return "job-impressions-supported"; } }
Java
/* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Interface PrintServiceAttribute is a tagging interface which a printing * attribute class implements to indicate the attribute describes the status * of a Print Service or some other characteristic of a Print Service. A Print * Service instance adds a number of PrintServiceAttributes to a Print * service's attribute set to report the Print Service's status. * <P> * * @see PrintServiceAttributeSet * * @author Alan Kaminsky */ public interface PrintServiceAttribute extends Attribute { }
Java
/* * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; import java.util.Vector; /** {@collect.stats} * Class SetOfIntegerSyntax is an abstract base class providing the common * implementation of all attributes whose value is a set of nonnegative * integers. This includes attributes whose value is a single range of integers * and attributes whose value is a set of ranges of integers. * <P> * You can construct an instance of SetOfIntegerSyntax by giving it in "string * form." The string consists of zero or more comma-separated integer groups. * Each integer group consists of either one integer, two integers separated by * a hyphen (<CODE>-</CODE>), or two integers separated by a colon * (<CODE>:</CODE>). Each integer consists of one or more decimal digits * (<CODE>0</CODE> through <CODE>9</CODE>). Whitespace characters cannot * appear within an integer but are otherwise ignored. For example: * <CODE>""</CODE>, <CODE>"1"</CODE>, <CODE>"5-10"</CODE>, <CODE>"1:2, * 4"</CODE>. * <P> * You can also construct an instance of SetOfIntegerSyntax by giving it in * "array form." Array form consists of an array of zero or more integer groups * where each integer group is a length-1 or length-2 array of * <CODE>int</CODE>s; for example, <CODE>int[0][]</CODE>, * <CODE>int[][]{{1}}</CODE>, <CODE>int[][]{{5,10}}</CODE>, * <CODE>int[][]{{1,2},{4}}</CODE>. * <P> * In both string form and array form, each successive integer group gives a * range of integers to be included in the set. The first integer in each group * gives the lower bound of the range; the second integer in each group gives * the upper bound of the range; if there is only one integer in the group, the * upper bound is the same as the lower bound. If the upper bound is less than * the lower bound, it denotes a null range (no values). If the upper bound is * equal to the lower bound, it denotes a range consisting of a single value. If * the upper bound is greater than the lower bound, it denotes a range * consisting of more than one value. The ranges may appear in any order and are * allowed to overlap. The union of all the ranges gives the set's contents. * Once a SetOfIntegerSyntax instance is constructed, its value is immutable. * <P> * The SetOfIntegerSyntax object's value is actually stored in "<I>canonical</I> * array form." This is the same as array form, except there are no null ranges; * the members of the set are represented in as few ranges as possible (i.e., * overlapping ranges are coalesced); the ranges appear in ascending order; and * each range is always represented as a length-two array of <CODE>int</CODE>s * in the form {lower bound, upper bound}. An empty set is represented as a * zero-length array. * <P> * Class SetOfIntegerSyntax has operations to return the set's members in * canonical array form, to test whether a given integer is a member of the * set, and to iterate through the members of the set. * <P> * * @author David Mendenhall * @author Alan Kaminsky */ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable { private static final long serialVersionUID = 3666874174847632203L; /** {@collect.stats} * This set's members in canonical array form. * @serial */ private int[][] members; /** {@collect.stats} * Construct a new set-of-integer attribute with the given members in * string form. * * @param members Set members in string form. If null, an empty set is * constructed. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>members</CODE> does not * obey the proper syntax. */ protected SetOfIntegerSyntax(String members) { this.members = parse (members); } /** {@collect.stats} * Parse the given string, returning canonical array form. */ private static int[][] parse(String members) { // Create vector to hold int[] elements, each element being one range // parsed out of members. Vector theRanges = new Vector(); // Run state machine over members. int n = (members == null ? 0 : members.length()); int i = 0; int state = 0; int lb = 0; int ub = 0; char c; int digit; while (i < n) { c = members.charAt(i ++); switch (state) { case 0: // Before first integer in first group if (Character.isWhitespace(c)) { state = 0; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; case 1: // In first integer in a group if (Character.isWhitespace(c)){ state = 2; } else if ((digit = Character.digit(c, 10)) != -1) { lb = 10 * lb + digit; state = 1; } else if (c == '-' || c == ':') { state = 3; } else if (c == ',') { accumulate (theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 2: // After first integer in a group if (Character.isWhitespace(c)) { state = 2; } else if (c == '-' || c == ':') { state = 3; } else if (c == ',') { accumulate(theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 3: // Before second integer in a group if (Character.isWhitespace(c)) { state = 3; } else if ((digit = Character.digit(c, 10)) != -1) { ub = digit; state = 4; } else { throw new IllegalArgumentException(); } break; case 4: // In second integer in a group if (Character.isWhitespace(c)) { state = 5; } else if ((digit = Character.digit(c, 10)) != -1) { ub = 10 * ub + digit; state = 4; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 5: // After second integer in a group if (Character.isWhitespace(c)) { state = 5; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 6: // Before first integer in second or later group if (Character.isWhitespace(c)) { state = 6; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; } } // Finish off the state machine. switch (state) { case 0: // Before first integer in first group break; case 1: // In first integer in a group case 2: // After first integer in a group accumulate(theRanges, lb, lb); break; case 4: // In second integer in a group case 5: // After second integer in a group accumulate(theRanges, lb, ub); break; case 3: // Before second integer in a group case 6: // Before first integer in second or later group throw new IllegalArgumentException(); } // Return canonical array form. return canonicalArrayForm (theRanges); } /** {@collect.stats} * Accumulate the given range (lb .. ub) into the canonical array form * into the given vector of int[] objects. */ private static void accumulate(Vector ranges, int lb,int ub) { // Make sure range is non-null. if (lb <= ub) { // Stick range at the back of the vector. ranges.add(new int[] {lb, ub}); // Work towards the front of the vector to integrate the new range // with the existing ranges. for (int j = ranges.size()-2; j >= 0; -- j) { // Get lower and upper bounds of the two ranges being compared. int[] rangea = (int[]) ranges.elementAt (j); int lba = rangea[0]; int uba = rangea[1]; int[] rangeb = (int[]) ranges.elementAt (j+1); int lbb = rangeb[0]; int ubb = rangeb[1]; /* If the two ranges overlap or are adjacent, coalesce them. * The two ranges overlap if the larger lower bound is less * than or equal to the smaller upper bound. The two ranges * are adjacent if the larger lower bound is one greater * than the smaller upper bound. */ if (Math.max(lba, lbb) - Math.min(uba, ubb) <= 1) { // The coalesced range is from the smaller lower bound to // the larger upper bound. ranges.setElementAt(new int[] {Math.min(lba, lbb), Math.max(uba, ubb)}, j); ranges.remove (j+1); } else if (lba > lbb) { /* If the two ranges don't overlap and aren't adjacent but * are out of order, swap them. */ ranges.setElementAt (rangeb, j); ranges.setElementAt (rangea, j+1); } else { /* If the two ranges don't overlap and aren't adjacent and * aren't out of order, we're done early. */ break; } } } } /** {@collect.stats} * Convert the given vector of int[] objects to canonical array form. */ private static int[][] canonicalArrayForm(Vector ranges) { return (int[][]) ranges.toArray (new int[ranges.size()][]); } /** {@collect.stats} * Construct a new set-of-integer attribute with the given members in * array form. * * @param members Set members in array form. If null, an empty set is * constructed. * * @exception NullPointerException * (Unchecked exception) Thrown if any element of * <CODE>members</CODE> is null. * @exception IllegalArgumentException * (Unchecked exception) Thrown if any element of * <CODE>members</CODE> is not a length-one or length-two array or if * any non-null range in <CODE>members</CODE> has a lower bound less * than zero. */ protected SetOfIntegerSyntax(int[][] members) { this.members = parse (members); } /** {@collect.stats} * Parse the given array form, returning canonical array form. */ private static int[][] parse(int[][] members) { // Create vector to hold int[] elements, each element being one range // parsed out of members. Vector ranges = new Vector(); // Process all integer groups in members. int n = (members == null ? 0 : members.length); for (int i = 0; i < n; ++ i) { // Get lower and upper bounds of the range. int lb, ub; if (members[i].length == 1) { lb = ub = members[i][0]; } else if (members[i].length == 2) { lb = members[i][0]; ub = members[i][1]; } else { throw new IllegalArgumentException(); } // Verify valid bounds. if (lb <= ub && lb < 0) { throw new IllegalArgumentException(); } // Accumulate the range. accumulate(ranges, lb, ub); } // Return canonical array form. return canonicalArrayForm (ranges); } /** {@collect.stats} * Construct a new set-of-integer attribute containing a single integer. * * @param member Set member. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if <CODE>member</CODE> is less than * zero. */ protected SetOfIntegerSyntax(int member) { if (member < 0) { throw new IllegalArgumentException(); } members = new int[][] {{member, member}}; } /** {@collect.stats} * Construct a new set-of-integer attribute containing a single range of * integers. If the lower bound is greater than the upper bound (a null * range), an empty set is constructed. * * @param lowerBound Lower bound of the range. * @param upperBound Upper bound of the range. * * @exception IllegalArgumentException * (Unchecked exception) Thrown if the range is non-null and * <CODE>lowerBound</CODE> is less than zero. */ protected SetOfIntegerSyntax(int lowerBound, int upperBound) { if (lowerBound <= upperBound && lowerBound < 0) { throw new IllegalArgumentException(); } members = lowerBound <=upperBound ? new int[][] {{lowerBound, upperBound}} : new int[0][]; } /** {@collect.stats} * Obtain this set-of-integer attribute's members in canonical array form. * The returned array is "safe;" the client may alter it without affecting * this set-of-integer attribute. * * @return This set-of-integer attribute's members in canonical array form. */ public int[][] getMembers() { int n = members.length; int[][] result = new int[n][]; for (int i = 0; i < n; ++ i) { result[i] = new int[] {members[i][0], members[i][1]}; } return result; } /** {@collect.stats} * Determine if this set-of-integer attribute contains the given value. * * @param x Integer value. * * @return True if this set-of-integer attribute contains the value * <CODE>x</CODE>, false otherwise. */ public boolean contains(int x) { // Do a linear search to find the range that contains x, if any. int n = members.length; for (int i = 0; i < n; ++ i) { if (x < members[i][0]) { return false; } else if (x <= members[i][1]) { return true; } } return false; } /** {@collect.stats} * Determine if this set-of-integer attribute contains the given integer * attribute's value. * * @param attribute Integer attribute. * * @return True if this set-of-integer attribute contains * <CODE>theAttribute</CODE>'s value, false otherwise. */ public boolean contains(IntegerSyntax attribute) { return contains (attribute.getValue()); } /** {@collect.stats} * Determine the smallest integer in this set-of-integer attribute that is * greater than the given value. If there are no integers in this * set-of-integer attribute greater than the given value, <CODE>-1</CODE> is * returned. (Since a set-of-integer attribute can only contain nonnegative * values, <CODE>-1</CODE> will never appear in the set.) You can use the * <CODE>next()</CODE> method to iterate through the integer values in a * set-of-integer attribute in ascending order, like this: * <PRE> * SetOfIntegerSyntax attribute = . . .; * int i = -1; * while ((i = attribute.next (i)) != -1) * { * foo (i); * } * </PRE> * * @param x Integer value. * * @return The smallest integer in this set-of-integer attribute that is * greater than <CODE>x</CODE>, or <CODE>-1</CODE> if no integer in * this set-of-integer attribute is greater than <CODE>x</CODE>. */ public int next(int x) { // Do a linear search to find the range that contains x, if any. int n = members.length; for (int i = 0; i < n; ++ i) { if (x < members[i][0]) { return members[i][0]; } else if (x < members[i][1]) { return x + 1; } } return -1; } /** {@collect.stats} * Returns whether this set-of-integer attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: * <OL TYPE=1> * <LI> * <CODE>object</CODE> is not null. * <LI> * <CODE>object</CODE> is an instance of class SetOfIntegerSyntax. * <LI> * This set-of-integer attribute's members and <CODE>object</CODE>'s * members are the same. * </OL> * * @param object Object to compare to. * * @return True if <CODE>object</CODE> is equivalent to this * set-of-integer attribute, false otherwise. */ public boolean equals(Object object) { if (object != null && object instanceof SetOfIntegerSyntax) { int[][] myMembers = this.members; int[][] otherMembers = ((SetOfIntegerSyntax) object).members; int m = myMembers.length; int n = otherMembers.length; if (m == n) { for (int i = 0; i < m; ++ i) { if (myMembers[i][0] != otherMembers[i][0] || myMembers[i][1] != otherMembers[i][1]) { return false; } } return true; } else { return false; } } else { return false; } } /** {@collect.stats} * Returns a hash code value for this set-of-integer attribute. The hash * code is the sum of the lower and upper bounds of the ranges in the * canonical array form, or 0 for an empty set. */ public int hashCode() { int result = 0; int n = members.length; for (int i = 0; i < n; ++ i) { result += members[i][0] + members[i][1]; } return result; } /** {@collect.stats} * Returns a string value corresponding to this set-of-integer attribute. * The string value is a zero-length string if this set is empty. Otherwise, * the string value is a comma-separated list of the ranges in the canonical * array form, where each range is represented as <CODE>"<I>i</I>"</CODE> if * the lower bound equals the upper bound or * <CODE>"<I>i</I>-<I>j</I>"</CODE> otherwise. */ public String toString() { StringBuffer result = new StringBuffer(); int n = members.length; for (int i = 0; i < n; i++) { if (i > 0) { result.append (','); } result.append (members[i][0]); if (members[i][0] != members[i][1]) { result.append ('-'); result.append (members[i][1]); } } return result.toString(); } }
Java
/* * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; /** {@collect.stats} * Thrown to indicate that the requested operation cannot be performed * because the set is unmodifiable. * * @author Phil Race * @since 1.4 */ public class UnmodifiableSetException extends RuntimeException { /** {@collect.stats} * Constructs an UnsupportedOperationException with no detail message. */ public UnmodifiableSetException() { } /** {@collect.stats} * Constructs an UnmodifiableSetException with the specified * detail message. * * @param message the detail message */ public UnmodifiableSetException(String message) { super(message); } }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class HashPrintServiceAttributeSet provides an attribute set * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintServiceAttributeSet PrintServiceAttributeSet}. * <P> * * @author Alan Kaminsky */ public class HashPrintServiceAttributeSet extends HashAttributeSet implements PrintServiceAttributeSet, Serializable { private static final long serialVersionUID = 6642904616179203070L; /** {@collect.stats} * Construct a new, empty hash print service attribute set. */ public HashPrintServiceAttributeSet() { super (PrintServiceAttribute.class); } /** {@collect.stats} * Construct a new hash print service attribute set, * initially populated with the given value. * * @param attribute Attribute value to add to the set. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. */ public HashPrintServiceAttributeSet(PrintServiceAttribute attribute) { super (attribute, PrintServiceAttribute.class); } /** {@collect.stats} * Construct a new print service attribute set, initially populated with * the values from the given array. The new attribute set is populated * by adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. * If null, an empty attribute set is constructed. * * @exception NullPointerException * (unchecked exception) * Thrown if any element of <CODE>attributes</CODE> is null. */ public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes) { super (attributes, PrintServiceAttribute.class); } /** {@collect.stats} * Construct a new attribute set, initially populated with the * values from the given set where the members of the attribute set * are restricted to the <code>PrintServiceAttribute</code> interface. * * @param attributes set of attribute values to initialise the set. If * null, an empty attribute set is constructed. * * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>PrintServiceAttribute</CODE>. */ public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes) { super(attributes, PrintServiceAttribute.class); } }
Java
/* * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.print.attribute; import java.io.Serializable; /** {@collect.stats} * Class HashPrintRequestAttributeSet inherits its implementation from * class {@link HashAttributeSet HashAttributeSet} and enforces the * semantic restrictions of interface * {@link PrintRequestAttributeSet PrintRequestAttributeSet}. * <P> * * @author Alan Kaminsky */ public class HashPrintRequestAttributeSet extends HashAttributeSet implements PrintRequestAttributeSet, Serializable { private static final long serialVersionUID = 2364756266107751933L; /** {@collect.stats} * Construct a new, empty print request attribute set. */ public HashPrintRequestAttributeSet() { super (PrintRequestAttribute.class); } /** {@collect.stats} * Construct a new print request attribute set, * initially populated with the given value. * * @param attribute Attribute value to add to the set. * * @exception NullPointerException * (unchecked exception) Thrown if <CODE>attribute</CODE> is null. */ public HashPrintRequestAttributeSet(PrintRequestAttribute attribute) { super (attribute, PrintRequestAttribute.class); } /** {@collect.stats} * Construct a new print request attribute set, initially populated with * the values from the given array. The new attribute set is populated * by adding the elements of <CODE>attributes</CODE> array to the set in * sequence, starting at index 0. Thus, later array elements may replace * earlier array elements if the array contains duplicate attribute * values or attribute categories. * * @param attributes Array of attribute values to add to the set. * If null, an empty attribute set is constructed. * * @exception NullPointerException * (unchecked exception) * Thrown if any element of <CODE>attributes</CODE> is null. */ public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes) { super (attributes, PrintRequestAttribute.class); } /** {@collect.stats} * Construct a new attribute set, initially populated with the * values from the given set where the members of the attribute set * are restricted to the <code>(PrintRequestAttributeSe</code> interface. * * @param attributes set of attribute values to initialise the set. If * null, an empty attribute set is constructed. * * @exception ClassCastException * (unchecked exception) Thrown if any element of * <CODE>attributes</CODE> is not an instance of * <CODE>(PrintRequestAttributeSe</CODE>. */ public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes) { super(attributes, PrintRequestAttribute.class); } }
Java