Package javax.print.attribute

Examples of javax.print.attribute.HashPrintRequestAttributeSet


        if (GraphicsEnvironment.isHeadless()) {
            throw new HeadlessException();
        }

        if (attributes == null) {
            attributes = new HashPrintRequestAttributeSet();
        }
        attributes.add(new Copies(getCopies()));
        attributes.add(new JobName(getJobName(), null));

        boolean doPrint = false;
View Full Code Here


            throw new HeadlessException();
        }
        // current request attribute set should be reflected to the print dialog.
        // If null, create new instance of HashPrintRequestAttributeSet.
        if (attributes == null) {
            attributes = new HashPrintRequestAttributeSet();
        }

        if (getPrintService() instanceof StreamPrintService) {
            return super.printDialog(attributes);
        }
View Full Code Here

        if (servicesBox.getItemCount() <= 0) {
            for (int i = 0; i < services.length; i++) {
                servicesBox.addItem(services[i].getName());
            }
        }
        newAttrs = new HashPrintRequestAttributeSet(attrs);
   
        prepareDialog();        // Prepare dialog
        servicesBox.setSelectedIndex(defServiceIndex)
                                // Select default PrintService and
                                // initialize dialog fields
View Full Code Here

        if ((requestAttrs == null) || (aService == null)) {
            return SETUP_ERROR;
        }
       
        attrs = requestAttrs;
        newAttrs = new HashPrintRequestAttributeSet(attrs);
        myService = aService;
       
        prepareDialog();        // prepare dialog
        fillPageSetupFields()// Initialize dialog fields
        firstUse = false;
View Full Code Here

        });
    }
      
    public PSPrinterJob() {
        super();
        attrs = new HashPrintRequestAttributeSet();
        service = PrintServiceLookup.lookupDefaultPrintService();
        /* Probably need to add default attributes to attrs here */
    }
View Full Code Here

    //---------------------------------------------------------------------
    /*
     * Getting result attribute set after OK button click
    */
    protected boolean updateAttributes() {
        newAttrs = new HashPrintRequestAttributeSet(attrs);
        if (dialogType == PRINT_DIALOG) {
            updateCopies();
            updateCollate();
            if (!updatePrintRange()) {
                JOptionPane.showMessageDialog(printDialog,
View Full Code Here

            return page;
        }

        /* get attribute set which combines this job attribute set and
           attributes for the given page PageFormat */
        HashPrintRequestAttributeSet myattrs = getAttrsForPageFormat(page);
        return pageDialog(myattrs);
    }
View Full Code Here

     * attribute for the result attribute set.
     */
    protected HashPrintRequestAttributeSet
            getAttrsForPageFormat(PageFormat page) {

        HashPrintRequestAttributeSet lattrs=new HashPrintRequestAttributeSet();

        /* Add Orientation attribute */
        switch (page.getOrientation()) {
            case PageFormat.LANDSCAPE:
                lattrs.add(OrientationRequested.LANDSCAPE);
                break;
            case PageFormat.PORTRAIT:
                lattrs.add(OrientationRequested.PORTRAIT);
                break;
            case PageFormat.REVERSE_LANDSCAPE:
                lattrs.add(OrientationRequested.REVERSE_LANDSCAPE);
                break;
        }

        /* Add Media attribute */
        MediaSizeName media = MediaSize.findMedia(
                (float) (page.getWidth() / 72.0),
                (float) (page.getHeight() / 72.0),
                Size2DSyntax.INCH);
        if (media != null) {
            lattrs.add(media);
        }

        /* Add MediaMargins attribute */
        lattrs.add(new MediaMargins((float) (page.getImageableX() / 72.0),
                (float) (page.getImageableY() / 72.0),
                (float) ((page.getWidth() - page.getImageableX() -
                        page.getImageableWidth()) / 72.0),
                (float) ((page.getHeight() - page.getImageableHeight() -
                        page.getImageableY()) / 72.0),
View Full Code Here

    protected PrintRequestAttributeSet updateMediaAndMarginsIfNeeded(
            PrintRequestAttributeSet newAttrs) {

        /* create copy of this.attrs*/
        PrintRequestAttributeSet sum =
                new HashPrintRequestAttributeSet(this.attrs);

        /* remove MediaMargins and MediaPrintableArea attributes from the copy
           of job attributes if newAttrs contains  MediaMargins or
           PrintableArea */
        if (newAttrs.containsKey(MediaPrintableArea.class)
                    || attrs.containsKey(MediaMargins.class)) {
            sum.remove(MediaPrintableArea.class);
            sum.remove(MediaMargins.class);
        }

        sum.addAll(newAttrs);
        return sum;
    }
View Full Code Here

        if (servicesBox.getItemCount() <= 0) {
            for (int i = 0; i < services.length; i++) {
                servicesBox.addItem(services[i].getName());
            }
        }
        newAttrs = new HashPrintRequestAttributeSet(attrs);
   
        prepareDialog();        // Prepare dialog
        servicesBox.setSelectedIndex(defServiceIndex)
                                // Select default PrintService and
                                // initialize dialog fields
View Full Code Here

TOP

Related Classes of javax.print.attribute.HashPrintRequestAttributeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.