Java 类javax.print.attribute.standard.JobName 实例源码

项目:javify    文件:IppRequest.java   
/**
 * Writes an attribute in TextSyntax into the stream.
 * <p>
 * By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
 * As some attributes in the JPS are TextSyntax attributes but actually
 * of NAME value-tag in IPP this method checks for these attributes and
 * writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
 * </p>
 *
 * @param attribute the attribute
 * @param out the stream to write to
 * @throws IOException if thrown by the stream
 */
private void write(TextSyntax attribute) throws IOException
{
  // We only use *WithoutLanguage, correct according to spec.
  String name = ((Attribute) attribute).getName();

  if (attribute instanceof RequestingUserName
      || attribute instanceof JobName
      || attribute instanceof DocumentName
      || attribute instanceof JobOriginatingUserName)
    out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
  else if (attribute instanceof DocumentFormat)
    out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
  else
    out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);

  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(attribute.getValue().length());
  out.write(attribute.getValue().getBytes());
}
项目:jvm-stm    文件:IppRequest.java   
/**
 * Writes an attribute in TextSyntax into the stream.
 * <p>
 * By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
 * As some attributes in the JPS are TextSyntax attributes but actually
 * of NAME value-tag in IPP this method checks for these attributes and
 * writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
 * </p>
 * 
 * @param attribute the attribute
 * @param out the stream to write to
 * @throws IOException if thrown by the stream
 */
private void write(TextSyntax attribute) throws IOException
{
  // We only use *WithoutLanguage, correct according to spec.
  String name = ((Attribute) attribute).getName();

  if (attribute instanceof RequestingUserName
      || attribute instanceof JobName
      || attribute instanceof DocumentName
      || attribute instanceof JobOriginatingUserName)
    out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
  else if (attribute instanceof DocumentFormat)
    out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
  else
    out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);

  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(attribute.getValue().length());
  out.write(attribute.getValue().getBytes());     
}
项目:metasfresh    文件:PrintUtil.java   
/**
 *  Print (async)
 *  @param printerName optional printer name
 *  @param jobName optional printer job name
 *  @param pageable pageable
 *  @param copies number of copies
 *  @param withDialog if true, shows printer dialog
 */
static public void print (Pageable pageable, String printerName, String jobName,
    int copies, boolean withDialog)
{
    if (pageable == null)
        return;
    String name = "Adempiere_";
    if (jobName != null)
        name += jobName;
    //
    PrinterJob job = CPrinter.getPrinterJob(printerName);
    job.setJobName (name);
    job.setPageable (pageable);
    //  Attributes
    HashPrintRequestAttributeSet prats = new HashPrintRequestAttributeSet();
    prats.add(new Copies(copies));
    //  Set Orientation
    if (pageable.getPageFormat(0).getOrientation() == PageFormat.PORTRAIT)
        prats.add(OrientationRequested.PORTRAIT);
    else
        prats.add(OrientationRequested.LANDSCAPE);
    prats.add(new JobName(name, Language.getLoginLanguage().getLocale()));
    prats.add(getJobPriority(pageable.getNumberOfPages(), copies, withDialog));
    //
    print (job, prats, withDialog, false);
}
项目:RipplePower    文件:PrintImageOutput.java   
public static boolean out(BufferedImage image) {
    try {
        DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
        PrintRequestAttributeSet requestAttributeSet = new HashPrintRequestAttributeSet();
        requestAttributeSet.add(MediaSizeName.ISO_A4);
        requestAttributeSet.add(new JobName(LSystem.applicationName + LSystem.getTime(), Locale.ENGLISH));
        PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, requestAttributeSet);
        PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
        PrintService service = ServiceUI.printDialog(null, 100, 100, services, defaultService, flavor,
                requestAttributeSet);
        if (service != null) {
            DocPrintJob job = service.createPrintJob();
            SimpleDoc doc = new SimpleDoc(new BufferedImagePrintable(image), flavor, null);
            job.print(doc, requestAttributeSet);
        }
    } catch (Exception e) {
        return false;
    }
    return true;
}
项目:cn1    文件:WinPrintJob.java   
private String getDocName(final Object doc,
                final AttributeSet... attrSets) {
    Attribute name = getAttribute(DocumentName.class, attrSets);

    if (name == null) {
        name = getAttribute(JobName.class, attrSets);
    }

    if ((name == null) && (doc instanceof Component)) {
        Component c = (Component) doc;

        while (c != null) {
            if (c instanceof Frame) {
                if (((Frame) c).getTitle().length() > 0) {
                    return ((Frame) c).getTitle();
                }
            }
            c = c.getParent();
        }
    }

    return name != null ? ((TextSyntax) name).getValue()
                    : WinPrintService.DEFAULT_JOB_NAME.getValue();
}
项目:cn1    文件:GDIClient.java   
public Object getDefaultAttributeValue(Class category) {
    if (category.equals(JobName.class)) {
        return new JobName("Java GDI client print job", Locale.US);
    } else if (category.equals(RequestingUserName.class)) {
        return new RequestingUserName(System.getProperty("user.name"),
                Locale.US);
    } else if (category.equals(Destination.class)) {
        File file = new File(System.getProperty("user.dir") +
                File.separator + "output.prn");
        return new Destination(file.toURI());
    } else if (category.equals(SheetCollate.class)) {
        return SheetCollate.COLLATED;
    } else if (category.equals(Copies.class)) {
        return new Copies(1);
    }
    return null;
}
项目:cn1    文件:CUPSClient.java   
private Object[] getDefaultAttributeValueEx(Class category) {
    if (Destination.class.isAssignableFrom(category)) {
        return new Object[0];
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName(
                (String) AccessController
                        .doPrivileged(new PrivilegedAction() {
                            public Object run() {
                                return System.getProperty("user.name");
                            }
                        }), Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Java print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Java print document",
                Locale.US) };
    }
    return null;
}
项目:cn1    文件:CUPSClient.java   
private Object[] getSupportedAttributeValuesEx(Class category,
        DocFlavor flavor) {
    if (Destination.class.isAssignableFrom(category)) {
        String ms = flavor.getMediaSubtype();

        if (ms.equalsIgnoreCase("gif") || ms.equalsIgnoreCase("jpeg")
                || ms.equalsIgnoreCase("png")
                || ms.equalsIgnoreCase("postscript")
                || flavor.getClass() == DocFlavor.SERVICE_FORMATTED.class) {
            try {
                return new Object[] { new Destination(new URI(
                        "file:///foo/bar")) };
            } catch (URISyntaxException e) {
                // return empty array - values are not supported
                return new Object[0];
            }
        }
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName("I.A.Muser", Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Foo print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Foo document", Locale.US) };
    }
    return null;
}
项目:JamVM-PH    文件:IppRequest.java   
/**
 * Writes an attribute in TextSyntax into the stream.
 * <p>
 * By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
 * As some attributes in the JPS are TextSyntax attributes but actually
 * of NAME value-tag in IPP this method checks for these attributes and
 * writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
 * </p>
 * 
 * @param attribute the attribute
 * @param out the stream to write to
 * @throws IOException if thrown by the stream
 */
private void write(TextSyntax attribute) throws IOException
{
  // We only use *WithoutLanguage, correct according to spec.
  String name = ((Attribute) attribute).getName();

  if (attribute instanceof RequestingUserName
      || attribute instanceof JobName
      || attribute instanceof DocumentName
      || attribute instanceof JobOriginatingUserName)
    out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
  else if (attribute instanceof DocumentFormat)
    out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
  else
    out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);

  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(attribute.getValue().length());
  out.write(attribute.getValue().getBytes());     
}
项目:classpath    文件:IppRequest.java   
/**
 * Writes an attribute in TextSyntax into the stream.
 * <p>
 * By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
 * As some attributes in the JPS are TextSyntax attributes but actually
 * of NAME value-tag in IPP this method checks for these attributes and
 * writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
 * </p>
 *
 * @param attribute the attribute
 * @param out the stream to write to
 * @throws IOException if thrown by the stream
 */
private void write(TextSyntax attribute) throws IOException
{
  // We only use *WithoutLanguage, correct according to spec.
  String name = ((Attribute) attribute).getName();

  if (attribute instanceof RequestingUserName
      || attribute instanceof JobName
      || attribute instanceof DocumentName
      || attribute instanceof JobOriginatingUserName)
    out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
  else if (attribute instanceof DocumentFormat)
    out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
  else
    out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);

  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(attribute.getValue().length());
  out.write(attribute.getValue().getBytes());
}
项目:freeVM    文件:GDIClient.java   
public Object getDefaultAttributeValue(Class category) {
    if (category.equals(JobName.class)) {
        return new JobName("Java GDI client print job", Locale.US);
    } else if (category.equals(RequestingUserName.class)) {
        return new RequestingUserName(System.getProperty("user.name"),
                Locale.US);
    } else if (category.equals(Destination.class)) {
        File file = new File(System.getProperty("user.dir") +
                File.separator + "output.prn");
        return new Destination(file.toURI());
    } else if (category.equals(SheetCollate.class)) {
        return SheetCollate.COLLATED;
    } else if (category.equals(Copies.class)) {
        return new Copies(1);
    }
    return null;
}
项目:freeVM    文件:CUPSClient.java   
private Object[] getDefaultAttributeValueEx(Class category) {
    if (Destination.class.isAssignableFrom(category)) {
        return new Object[0];
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName(
                (String) AccessController
                        .doPrivileged(new PrivilegedAction() {
                            public Object run() {
                                return System.getProperty("user.name");
                            }
                        }), Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Java print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Java print document",
                Locale.US) };
    }
    return null;
}
项目:freeVM    文件:CUPSClient.java   
private Object[] getSupportedAttributeValuesEx(Class category,
        DocFlavor flavor) {
    if (Destination.class.isAssignableFrom(category)) {
        String ms = flavor.getMediaSubtype();

        if (ms.equalsIgnoreCase("gif") || ms.equalsIgnoreCase("jpeg")
                || ms.equalsIgnoreCase("png")
                || ms.equalsIgnoreCase("postscript")
                || flavor.getClass() == DocFlavor.SERVICE_FORMATTED.class) {
            try {
                return new Object[] { new Destination(new URI(
                        "file:///foo/bar")) };
            } catch (URISyntaxException e) {
                // return empty array - values are not supported
                return new Object[0];
            }
        }
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName("I.A.Muser", Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Foo print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Foo document", Locale.US) };
    }
    return null;
}
项目:freeVM    文件:WinPrintJob.java   
private String getDocName(final Object doc,
                final AttributeSet... attrSets) {
    Attribute name = getAttribute(DocumentName.class, attrSets);

    if (name == null) {
        name = getAttribute(JobName.class, attrSets);
    }

    if ((name == null) && (doc instanceof Component)) {
        Component c = (Component) doc;

        while (c != null) {
            if (c instanceof Frame) {
                if (((Frame) c).getTitle().length() > 0) {
                    return ((Frame) c).getTitle();
                }
            }
            c = c.getParent();
        }
    }

    return name != null ? ((TextSyntax) name).getValue()
                    : WinPrintService.DEFAULT_JOB_NAME.getValue();
}
项目:freeVM    文件:GDIClient.java   
public Object getDefaultAttributeValue(Class category) {
    if (category.equals(JobName.class)) {
        return new JobName("Java GDI client print job", Locale.US);
    } else if (category.equals(RequestingUserName.class)) {
        return new RequestingUserName(System.getProperty("user.name"),
                Locale.US);
    } else if (category.equals(Destination.class)) {
        File file = new File(System.getProperty("user.dir") +
                File.separator + "output.prn");
        return new Destination(file.toURI());
    } else if (category.equals(SheetCollate.class)) {
        return SheetCollate.COLLATED;
    } else if (category.equals(Copies.class)) {
        return new Copies(1);
    }
    return null;
}
项目:freeVM    文件:CUPSClient.java   
private Object[] getDefaultAttributeValueEx(Class category) {
    if (Destination.class.isAssignableFrom(category)) {
        return new Object[0];
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName(
                (String) AccessController
                        .doPrivileged(new PrivilegedAction() {
                            public Object run() {
                                return System.getProperty("user.name");
                            }
                        }), Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Java print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Java print document",
                Locale.US) };
    }
    return null;
}
项目:freeVM    文件:CUPSClient.java   
private Object[] getSupportedAttributeValuesEx(Class category,
        DocFlavor flavor) {
    if (Destination.class.isAssignableFrom(category)) {
        String ms = flavor.getMediaSubtype();

        if (ms.equalsIgnoreCase("gif") || ms.equalsIgnoreCase("jpeg")
                || ms.equalsIgnoreCase("png")
                || ms.equalsIgnoreCase("postscript")
                || flavor.getClass() == DocFlavor.SERVICE_FORMATTED.class) {
            try {
                return new Object[] { new Destination(new URI(
                        "file:///foo/bar")) };
            } catch (URISyntaxException e) {
                // return empty array - values are not supported
                return new Object[0];
            }
        }
    } else if (RequestingUserName.class.isAssignableFrom(category)) {
        return new Object[] { new RequestingUserName("I.A.Muser", Locale.US) };
    } else if (JobName.class.isAssignableFrom(category)) {
        return new Object[] { new JobName("Foo print job", Locale.US) };
    } else if (DocumentName.class.isAssignableFrom(category)) {
        return new Object[] { new DocumentName("Foo document", Locale.US) };
    }
    return null;
}
项目:monsiaj    文件:PDFPrint.java   
public static void print(File file, int copies, PrintService ps) {
    logger.debug("print start - " + file);
    try {
        try (PDDocument document = PDDocument.load(file)) {
            MediaSizeName size = getMediaSizeName(document);

            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPrintService(ps);
            job.setPageable(new PDFPageable(document));
            PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
            attr.add(size);
            attr.add(new Copies(copies));
            attr.add(new JobName(file.getName(), null));

            PageFormat pf = job.getPageFormat(attr);
            Paper paper = pf.getPaper();
            paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
            pf.setPaper(paper);

            job.print(attr);
        }
    } catch (IOException | PrinterException ex) {
        logger.warn(ex, ex);
    }
    logger.debug("print end - " + file);
}
项目:JuggleMasterPro    文件:PrintJobAttributesSubJPanel.java   
final public void focusLost(FocusEvent objPfocusEvent) {
    final Object objLsourceObject = objPfocusEvent.getSource();

    if (objLsourceObject == this.objGjobNameJTextField) {
        this.objGprintJDialog.getAttributes().add(new JobName(this.objGjobNameJTextField.getText(), Locale.getDefault()));
    } else if (objLsourceObject == this.objGuserNameJTextField) {
        this.objGprintJDialog.getAttributes().add(new RequestingUserName(this.objGuserNameJTextField.getText(), Locale.getDefault()));
    }
}
项目:openjdk-jdk10    文件:DummyPrintTest.java   
@Override
public void print(Doc doc,
                  PrintRequestAttributeSet printRequestAttributeSet)
      throws PrintException {
    System.out.println("job name: " + printRequestAttributeSet.get(JobName.class));
    System.out.println("copies: " + printRequestAttributeSet.get(Copies.class));
    if(printRequestAttributeSet.get(JobName.class) == null ||
        printRequestAttributeSet.get(Copies.class) == null) {
        throw new RuntimeException("Copies and JobName is not passed correctly");
    }
}
项目:openjdk9    文件:DummyPrintTest.java   
@Override
public void print(Doc doc,
                  PrintRequestAttributeSet printRequestAttributeSet)
      throws PrintException {
    System.out.println("job name: " + printRequestAttributeSet.get(JobName.class));
    System.out.println("copies: " + printRequestAttributeSet.get(Copies.class));
    if(printRequestAttributeSet.get(JobName.class) == null ||
        printRequestAttributeSet.get(Copies.class) == null) {
        throw new RuntimeException("Copies and JobName is not passed correctly");
    }
}
项目:javify    文件:PrinterDialog.java   
private void updateTextfields(FocusEvent event)
{
  if (event.getSource() == jobname_tf)
      atts.add(new JobName(jobname_tf.getText(), null));
  else
      atts.add(new RequestingUserName(username_tf.getText(), null));
}
项目:code-similarity    文件:PrintPostScript.java   
public void print() throws IOException, PrintException {

    DocFlavor inputFlavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8;

    // Lookup a print factory to convert from desired input to output.
    StreamPrintServiceFactory[] psfactories =
        StreamPrintServiceFactory.lookupStreamPrintServiceFactories(
            inputFlavor, DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
    if (psfactories.length == 0) {
        System.err.println("Ack! No StreamPrintFactory found for this job!");
    }
    StreamPrintService printService = 
        psfactories[0].getPrintService(new FileOutputStream("demo.ps"));
    PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
    attrs.add(OrientationRequested.LANDSCAPE);
    attrs.add(MediaSizeName.NA_LETTER);
    attrs.add(new Copies(1));
    attrs.add(new JobName(INPUT_FILE_NAME, null));

    InputStream is = getClass().getResourceAsStream(INPUT_FILE_NAME);
    if (is == null) {
        throw new NullPointerException(
            "Input Stream is null: file not found?");
    }
    Doc doc = new SimpleDoc(is, inputFlavor, null);

    DocPrintJob printJob = printService.createPrintJob();
    printJob.print(doc, attrs);
}
项目:Camel    文件:PrinterOperations.java   
public void print(Doc doc, String jobName) throws PrintException {
    // we need create a new job for each print 
    DocPrintJob job = getPrintService().createPrintJob();
    PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet(printRequestAttributeSet);
    attrs.add(new JobName(jobName, Locale.getDefault()));
    job.print(doc, attrs);
}
项目:jvm-stm    文件:PrinterDialog.java   
private void updateTextfields(FocusEvent event)
{
  if (event.getSource() == jobname_tf)
      atts.add(new JobName(jobname_tf.getText(), null));
  else
      atts.add(new RequestingUserName(username_tf.getText(), null));
}
项目:jpexs-decompiler    文件:PDFPrinterJob.java   
@Override
public void setJobName(String jobName) {
    attributes.add(new JobName(jobName, Locale.getDefault()));

    if (info.getTitle() == null) {
        info.setTitle(jobName);
    }
}
项目:cn1    文件:WinPrintService.java   
public Object getDefaultAttributeValue(
                final Class<? extends Attribute> category) {
    checkArgs(category, null);

    final DevmodeStructWrapper dm = getDefaultPrinterProps();

    if (JobName.class.equals(category)) {
        return DEFAULT_JOB_NAME;
    } else if (RequestingUserName.class.equals(category)) {
        return new RequestingUserName(getSystemProperty("user.name"), //$NON-NLS-1$
                        null);
    } else if (Destination.class.equals(category)) {
        File file = new File(getSystemProperty("user.dir") //$NON-NLS-1$
                        + File.separator + "output.prn"); //$NON-NLS-1$
        return new Destination(file.toURI());
    } else if (OrientationRequested.class.equals(category)) {
        return dm.getOrientation();
    } else if (Paper.class.equals(category)) {
        return getDefaultPaper();
    } else if (Media.class.equals(category)) {
        return getDefaultPaper().getSize().getMediaSizeName();
    } else if (MediaSize.class.equals(category)) {
        return getDefaultPaper().getSize();
    } else if (PrintQuality.class.equals(category)) {
        return dm.getPrintQuality();
    } else if (Sides.class.equals(category)) {
        return dm.getSides();
    } else if (Copies.class.equals(category)) {
        return dm.getCopies();
    } else if (SheetCollate.class.equals(category)) {
        return dm.getCollate();
    } else if (PrinterResolution.class.equals(category)) {
        return dm.getPrinterResolution();
    } else if (Chromaticity.class.equals(category)) {
        return dm.getChromaticity();
    }

    return null;
}
项目:cn1    文件:GDIClient.java   
public Class[] getSupportedAttributeCategories() {
    ArrayList supportedCategories = new ArrayList();
    if (getCopiesSupported(serviceName) >= 1) {
        supportedCategories.add(Copies.class);
    }
    if (getSidesSupported(serviceName)) {
        supportedCategories.add(Sides.class);
    }
    if (getSupportedMediaSizeNames() != null) {
        supportedCategories.add(Media.class);
    }
    if (getResolutionsSupported(serviceName) != null) {
        supportedCategories.add(PrinterResolution.class);
    }
    if (getOrientationSupported(serviceName)) {
        supportedCategories.add(OrientationRequested.class);
    }
    if (getCollateSupported(serviceName)) {
        supportedCategories.add(SheetCollate.class);
    }
    supportedCategories.add(Chromaticity.class);
    supportedCategories.add(JobName.class);
    supportedCategories.add(RequestingUserName.class);
    supportedCategories.add(Destination.class);

    Class[] categories = new Class[supportedCategories.size()];
    supportedCategories.toArray(categories);
    return categories;
}
项目:cn1    文件:GDIClient.java   
String getJobName(PrintRequestAttributeSet attrs) {
    if (attrs != null) {
        if (attrs.containsKey(JobName.class)) {
            JobName name = (JobName)attrs.get(JobName.class);
            return name.getValue();
        }
    }
    return "Java GDI client print job";
}
项目:cn1    文件:ServiceUIDialog.java   
void fillJobNameField() {
    boolean supported = myService.isAttributeCategorySupported(JobName.class);
    jobNameTxt.setEnabled(supported);
    jobNameLabel.setEnabled(supported);

    if (firstUse && attrs.containsKey(JobName.class)) {
        jobNameTxt.setText(((TextSyntax) attrs.get(JobName.class)).getValue());
    }

    if(supported && (jobNameTxt.getText().length() <= 0)) {
        TextSyntax txt = (TextSyntax) 
                (myService.getDefaultAttributeValue(JobName.class));
        jobNameTxt.setText(txt == null ? "" : txt.getValue());
    }
}
项目:cn1    文件:ServiceUIDialog.java   
private void updateJobName() {
    if (jobNameTxt.isEnabled()) {
        String name = jobNameTxt.getText();
        if (name.length() == 0) {
            removeAttribute(JobName.class);
        } else {
            newAttrs.add(new JobName(name, Locale.getDefault()));
        }
    } else {
        removeAttribute(JobName.class);
    }
}
项目:cn1    文件:CUPSClient.java   
private void getSupportedAttributeCategoriesEx(ArrayList clazz) {
    if (!clazz.contains(Destination.class)) {
        clazz.add(Destination.class);
    }
    if (!clazz.contains(RequestingUserName.class)) {
        clazz.add(RequestingUserName.class);
    }
    if (!clazz.contains(JobName.class)) {
        clazz.add(JobName.class);
    }
    if (!clazz.contains(DocumentName.class)) {
        clazz.add(DocumentName.class);
    }
}
项目:JamVM-PH    文件:PrinterDialog.java   
private void updateTextfields(FocusEvent event)
{
  if (event.getSource() == jobname_tf)
      atts.add(new JobName(jobname_tf.getText(), null));
  else
      atts.add(new RequestingUserName(username_tf.getText(), null));
}
项目:classpath    文件:PrinterDialog.java   
private void updateTextfields(FocusEvent event)
{
  if (event.getSource() == jobname_tf)
      atts.add(new JobName(jobname_tf.getText(), null));
  else
      atts.add(new RequestingUserName(username_tf.getText(), null));
}
项目:freeVM    文件:GDIClient.java   
public Class[] getSupportedAttributeCategories() {
    ArrayList supportedCategories = new ArrayList();
    if (getCopiesSupported(serviceName) >= 1) {
        supportedCategories.add(Copies.class);
    }
    if (getSidesSupported(serviceName)) {
        supportedCategories.add(Sides.class);
    }
    if (getSupportedMediaSizeNames() != null) {
        supportedCategories.add(Media.class);
    }
    if (getResolutionsSupported(serviceName) != null) {
        supportedCategories.add(PrinterResolution.class);
    }
    if (getOrientationSupported(serviceName)) {
        supportedCategories.add(OrientationRequested.class);
    }
    if (getCollateSupported(serviceName)) {
        supportedCategories.add(SheetCollate.class);
    }
    supportedCategories.add(Chromaticity.class);
    supportedCategories.add(JobName.class);
    supportedCategories.add(RequestingUserName.class);
    supportedCategories.add(Destination.class);

    Class[] categories = new Class[supportedCategories.size()];
    supportedCategories.toArray(categories);
    return categories;
}
项目:freeVM    文件:GDIClient.java   
String getJobName(PrintRequestAttributeSet attrs) {
    if (attrs != null) {
        if (attrs.containsKey(JobName.class)) {
            JobName name = (JobName)attrs.get(JobName.class);
            return name.getValue();
        }
    }
    return "Java GDI client print job";
}
项目:freeVM    文件:ServiceUIDialog.java   
void fillJobNameField() {
    boolean supported = myService.isAttributeCategorySupported(JobName.class);
    jobNameTxt.setEnabled(supported);
    jobNameLabel.setEnabled(supported);

    if (firstUse && attrs.containsKey(JobName.class)) {
        jobNameTxt.setText(((TextSyntax) attrs.get(JobName.class)).getValue());
    }

    if(supported && (jobNameTxt.getText().length() <= 0)) {
        TextSyntax txt = (TextSyntax) 
                (myService.getDefaultAttributeValue(JobName.class));
        jobNameTxt.setText(txt == null ? "" : txt.getValue());
    }
}
项目:freeVM    文件:ServiceUIDialog.java   
private void updateJobName() {
    if (jobNameTxt.isEnabled()) {
        String name = jobNameTxt.getText();
        if (name.length() == 0) {
            removeAttribute(JobName.class);
        } else {
            newAttrs.add(new JobName(name, Locale.getDefault()));
        }
    } else {
        removeAttribute(JobName.class);
    }
}
项目:freeVM    文件:CUPSClient.java   
private void getSupportedAttributeCategoriesEx(ArrayList clazz) {
    if (!clazz.contains(Destination.class)) {
        clazz.add(Destination.class);
    }
    if (!clazz.contains(RequestingUserName.class)) {
        clazz.add(RequestingUserName.class);
    }
    if (!clazz.contains(JobName.class)) {
        clazz.add(JobName.class);
    }
    if (!clazz.contains(DocumentName.class)) {
        clazz.add(DocumentName.class);
    }
}
项目:freeVM    文件:WinPrintService.java   
public Object getDefaultAttributeValue(
                final Class<? extends Attribute> category) {
    checkArgs(category, null);

    final DevmodeStructWrapper dm = getDefaultPrinterProps();

    if (JobName.class.equals(category)) {
        return DEFAULT_JOB_NAME;
    } else if (RequestingUserName.class.equals(category)) {
        return new RequestingUserName(getSystemProperty("user.name"), //$NON-NLS-1$
                        null);
    } else if (Destination.class.equals(category)) {
        File file = new File(getSystemProperty("user.dir") //$NON-NLS-1$
                        + File.separator + "output.prn"); //$NON-NLS-1$
        return new Destination(file.toURI());
    } else if (OrientationRequested.class.equals(category)) {
        return dm.getOrientation();
    } else if (Paper.class.equals(category)) {
        return getDefaultPaper();
    } else if (Media.class.equals(category)) {
        return getDefaultPaper().getSize().getMediaSizeName();
    } else if (MediaSize.class.equals(category)) {
        return getDefaultPaper().getSize();
    } else if (PrintQuality.class.equals(category)) {
        return dm.getPrintQuality();
    } else if (Sides.class.equals(category)) {
        return dm.getSides();
    } else if (Copies.class.equals(category)) {
        return dm.getCopies();
    } else if (SheetCollate.class.equals(category)) {
        return dm.getCollate();
    } else if (PrinterResolution.class.equals(category)) {
        return dm.getPrinterResolution();
    } else if (Chromaticity.class.equals(category)) {
        return dm.getChromaticity();
    }

    return null;
}