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

项目:OpenJSharp    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:jdk8u-jdk    文件:CPrinterJob.java   
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
项目:jdk8u-jdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:openjdk-jdk10    文件:CPrinterJob.java   
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        } else {
            // if rangeSelect is SunPageSelection.ALL
            // then setPageRange appropriately
            setPageRange(-1, -1);
        }
    }
}
项目:openjdk-jdk10    文件:WPrinterJob.java   
private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet,
                                     int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:openjdk-jdk10    文件:PrintAttributeUpdateTest.java   
public static void main(String args[]) throws Exception {
    String[] instructions
            = {
                "Select Pages Range From instead of All in print dialog. ",
                "Then select Print"
            };
    SwingUtilities.invokeAndWait(() -> {
        JOptionPane.showMessageDialog((Component) null,
                instructions, "Instructions",
                JOptionPane.INFORMATION_MESSAGE);
    });
    HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
    PrinterJob j = PrinterJob.getPrinterJob();
    j.setPageable(new PrintAttributeUpdateTest());
    as.add(DialogTypeSelection.NATIVE);
    j.printDialog(as);
    if (as.containsKey(PageRanges.class) == false) {
        throw new RuntimeException("Print Dialog did not update "
                + " attribute set with page range");
    }
    Attribute attrs[] = as.toArray();
    for (int i = 0; i < attrs.length; i++) {
        System.out.println("attr " + attrs[i]);
    }
    j.print(as);
}
项目:openjdk-jdk10    文件:ServiceDlgPageRangeTest.java   
/**
 * Starts the application.
 */
public static void printTest() {

    System.out.println("\nDefault print service: " +
                          PrintServiceLookup.lookupDefaultPrintService());
    System.out.println("is flavor: "+flavor+" supported? "+
                                 services[0].isDocFlavorSupported(flavor));
    System.out.println("is Page Ranges category supported? "+
               services[0].isAttributeCategorySupported(PageRanges.class));
    System.out.println("is PageRanges[2] value supported ? "+
               services[0].isAttributeValueSupported(
                                         new PageRanges(2), flavor, null));

    HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet();
    //prSet.add(new PageRanges(2));
    PrintService selService = ServiceUI.printDialog(null, 200, 200,
                                      services, services[0], flavor, prSet);

    System.out.println("\nSelected Values\n");
    Attribute attr[] = prSet.toArray();
    for (int x = 0; x < attr.length; x ++) {
        System.out.println("Attribute: " + attr[x].getName() +
                                                    " Value: " + attr[x]);
    }
}
项目:brModelo    文件:PrintControler.java   
public void print() {
    getPrintJob().setPrintable(this, getPage());

    boolean res;
    PrintRequestAttributeSet attr_set
            = new HashPrintRequestAttributeSet();
    if (page_range.x == 0) {
        res = getPrintJob().printDialog();
    } else {
        PrintRequestAttributeSet attr_set2
                = new HashPrintRequestAttributeSet();
        attr_set2.add(new PageRanges(page_range.x, page_range.y));
        res = getPrintJob().printDialog(attr_set2);
    }
    if (res) {
        try {
            getPrintJob().print(attr_set);
        } catch (PrinterException pe) {
            System.out.println("Error printing: " + pe);
        }
        //page = getPrintJob().getPageFormat(null);
    }

}
项目:openjdk9    文件:WPrinterJob.java   
private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet,
                                     int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:openjdk9    文件:PrintAttributeUpdateTest.java   
public static void main(String args[]) throws Exception {
    String[] instructions
            = {
                "Select Pages Range From instead of All in print dialog. ",
                "Then select Print"
            };
    SwingUtilities.invokeAndWait(() -> {
        JOptionPane.showMessageDialog((Component) null,
                instructions, "Instructions",
                JOptionPane.INFORMATION_MESSAGE);
    });
    HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
    PrinterJob j = PrinterJob.getPrinterJob();
    j.setPageable(new PrintAttributeUpdateTest());
    as.add(DialogTypeSelection.NATIVE);
    j.printDialog(as);
    if (as.containsKey(PageRanges.class) == false) {
        throw new RuntimeException("Print Dialog did not update "
                + " attribute set with page range");
    }
    Attribute attrs[] = as.toArray();
    for (int i = 0; i < attrs.length; i++) {
        System.out.println("attr " + attrs[i]);
    }
    j.print(as);
}
项目:jdk8u_jdk    文件:CPrinterJob.java   
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
项目:jdk8u_jdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:jdk8u_jdk    文件:PrintAttributeUpdateTest.java   
public static void main(String args[]) throws Exception {
    String[] instructions
            = {
                "Select Pages Range From instead of All in print dialog. ",
                "Then select Print"
            };
    SwingUtilities.invokeAndWait(() -> {
        JOptionPane.showMessageDialog((Component) null,
                instructions, "Instructions",
                JOptionPane.INFORMATION_MESSAGE);
    });
    HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
    PrinterJob j = PrinterJob.getPrinterJob();
    j.setPageable(new PrintAttributeUpdateTest());
    as.add(DialogTypeSelection.NATIVE);
    j.printDialog(as);
    if (as.containsKey(PageRanges.class) == false) {
        throw new RuntimeException("Print Dialog did not update "
                + " attribute set with page range");
    }
    Attribute attrs[] = as.toArray();
    for (int i = 0; i < attrs.length; i++) {
        System.out.println("attr " + attrs[i]);
    }
    j.print(as);
}
项目:lookaside_java-1.8.0-openjdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:javify    文件:PrinterDialog.java   
public void actionPerformed(ActionEvent e)
{
  // if ALL is selected we must use a full-range object
  if (e.getActionCommand().equals("ALL"))
    {
      from_tf.setEnabled(false);
      to.setEnabled(false);
      to_tf.setEnabled(false);

      atts.add(new PageRanges(1, Integer.MAX_VALUE));
    }
  else
    {
      from_tf.setEnabled(true);
      to.setEnabled(true);
      to_tf.setEnabled(true);
      all_rb.setSelected(false);
    }
}
项目:jvm-stm    文件:PrinterDialog.java   
public void actionPerformed(ActionEvent e)
{ 
  // if ALL is selected we must use a full-range object
  if (e.getActionCommand().equals("ALL"))
    {
      from_tf.setEnabled(false);
      to.setEnabled(false);
      to_tf.setEnabled(false);

      atts.add(new PageRanges(1, Integer.MAX_VALUE));
    }
  else
    {
      from_tf.setEnabled(true);
      to.setEnabled(true);
      to_tf.setEnabled(true);
      all_rb.setSelected(false);
    }       
}
项目:infobip-open-jdk-8    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:jdk8u-dev-jdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:jdk7-jdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:openjdk-source-code-learn    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:OLD-OpenJDK8    文件:CPrinterJob.java   
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
项目:OLD-OpenJDK8    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:cn1    文件:ServiceUIDialog.java   
void fillPrintRangeFields() {
    if (firstUse) {
        if (attrs.containsKey(PageRanges.class)) {
            PageRanges aRange = (PageRanges) (attrs.get(PageRanges.class));
            int [][] range = aRange.getMembers();
            fromTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][0]) : "1");
            toTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][1]) : "1");
            pageRngBtn.setSelected(true);
        } else {
            allRngBtn.setSelected(true);
            fromTxt.setEnabled(false);
            toTxt.setEnabled(false);
            fromTxt.setText("1");
            toTxt.setText("1");
            toLabel.setEnabled(false);
        }
    }
}
项目:JamVM-PH    文件:PrinterDialog.java   
public void actionPerformed(ActionEvent e)
{ 
  // if ALL is selected we must use a full-range object
  if (e.getActionCommand().equals("ALL"))
    {
      from_tf.setEnabled(false);
      to.setEnabled(false);
      to_tf.setEnabled(false);

      atts.add(new PageRanges(1, Integer.MAX_VALUE));
    }
  else
    {
      from_tf.setEnabled(true);
      to.setEnabled(true);
      to_tf.setEnabled(true);
      all_rb.setSelected(false);
    }       
}
项目:toolkit    文件:PrintPanel.java   
@Override
public PrintService accept(PrintRequestAttributeSet set) {
    PrintService service = super.accept(set);
    if (mCopies != null) {
        PrintUtilities.setCopies(set, ((Integer) mCopies.getValue()).intValue());
    }
    if (mPageRangeAll != null) {
        if (mPageRangeAll.isSelected()) {
            PrintUtilities.setPageRanges(set, null);
        } else {
            int start = ((Integer) mPageRangeStart.getValue()).intValue();
            int end = ((Integer) mPageRangeEnd.getValue()).intValue();
            if (start > end) {
                int tmp = start;
                start = end;
                end = tmp;
            }
            PrintUtilities.setPageRanges(set, new PageRanges(start, end));
        }
    }
    return service;
}
项目:openjdk-jdk7u-jdk    文件:CPrinterJob.java   
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            SunPageSelection psel = (SunPageSelection)attributes.get(SunPageSelection.class);
            if (psel == null) {
                attributes.add(SunPageSelection.RANGE);
            }
        }
    }

    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }
}
项目:openjdk-jdk7u-jdk    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:classpath    文件:PrinterDialog.java   
public void actionPerformed(ActionEvent e)
{
  // if ALL is selected we must use a full-range object
  if (e.getActionCommand().equals("ALL"))
    {
      from_tf.setEnabled(false);
      to.setEnabled(false);
      to_tf.setEnabled(false);

      atts.add(new PageRanges(1, Integer.MAX_VALUE));
    }
  else
    {
      from_tf.setEnabled(true);
      to.setEnabled(true);
      to_tf.setEnabled(true);
      all_rb.setSelected(false);
    }
}
项目:freeVM    文件:ServiceUIDialog.java   
void fillPrintRangeFields() {
    if (firstUse) {
        if (attrs.containsKey(PageRanges.class)) {
            PageRanges aRange = (PageRanges) (attrs.get(PageRanges.class));
            int [][] range = aRange.getMembers();
            fromTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][0]) : "1");
            toTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][1]) : "1");
            pageRngBtn.setSelected(true);
        } else {
            allRngBtn.setSelected(true);
            fromTxt.setEnabled(false);
            toTxt.setEnabled(false);
            fromTxt.setText("1");
            toTxt.setText("1");
            toLabel.setEnabled(false);
        }
    }
}
项目:freeVM    文件:ServiceUIDialog.java   
void fillPrintRangeFields() {
    if (firstUse) {
        if (attrs.containsKey(PageRanges.class)) {
            PageRanges aRange = (PageRanges) (attrs.get(PageRanges.class));
            int [][] range = aRange.getMembers();
            fromTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][0]) : "1");
            toTxt.setText(range.length > 0 
                    ? Integer.toString(range[0][1]) : "1");
            pageRngBtn.setSelected(true);
        } else {
            allRngBtn.setSelected(true);
            fromTxt.setEnabled(false);
            toTxt.setEnabled(false);
            fromTxt.setText("1");
            toTxt.setText("1");
            toLabel.setEnabled(false);
        }
    }
}
项目:openjdk-icedtea7    文件:CPrinterJob.java   
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            SunPageSelection psel = (SunPageSelection)attributes.get(SunPageSelection.class);
            if (psel == null) {
                attributes.add(SunPageSelection.RANGE);
            }
        }
    }

    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }
}
项目:openjdk-icedtea7    文件:WPrinterJob.java   
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
项目:OpenJSharp    文件:RasterPrinterJob.java   
protected final int getFromPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[0][0];
        }
    }
    return getMinPageAttrib();
}
项目:OpenJSharp    文件:RasterPrinterJob.java   
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
项目:OpenJSharp    文件:CPrinterJob.java   
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
项目:JuggleMasterPro    文件:PrintRangeSubJPanel.java   
final public void setValues() {

        this.bolGprintRangeSupported = this.objGprintJDialog.getPrintService().isAttributeCategorySupported(PageRanges.class);

        SunPageSelection objLsunPageSelection = SunPageSelection.ALL;
        int intLmin = 1;
        int intLmax = 1;

        final PageRanges objLpageRanges = (PageRanges) this.objGprintJDialog.getAttributes().get(PageRanges.class);
        if (objLpageRanges != null) {
            if (!objLpageRanges.equals(this.objGallPageRanges)) {
                objLsunPageSelection = SunPageSelection.RANGE;

                final int[][] intLmemberAA = objLpageRanges.getMembers();
                if (intLmemberAA.length > 0 && intLmemberAA[0].length > 1) {
                    intLmin = intLmemberAA[0][0];
                    intLmax = intLmemberAA[0][1];
                }
            }
        }

        if (objLsunPageSelection == SunPageSelection.ALL) {
            this.objGallJRadioButton.setSelected(true);
        } else if (objLsunPageSelection == SunPageSelection.SELECTION) {
            // Comment this for now - objGselectJRadioButton is not initialized
            // because Selection button is not added.
            // See PrintRangeSubJPanel above.

            // objGselectJRadioButton.setSelected(true);
        } else { // RANGE
            this.objGpagesJRadioButton.setSelected(true);
        }
        this.objGrangeFromJFormattedTextField.setValue(new Integer(intLmin));
        this.objGrangeToJFormattedTextField.setValue(new Integer(intLmax));
        this.objGallJRadioButton.setEnabled(this.bolGprintRangeSupported);
        this.objGpagesJRadioButton.setEnabled(this.bolGprintRangeSupported);
        this.setupRangeWidgets();
    }
项目:jdk8u-jdk    文件:RasterPrinterJob.java   
protected final int getFromPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[0][0];
        }
    }
    return getMinPageAttrib();
}
项目:jdk8u-jdk    文件:RasterPrinterJob.java   
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
项目:openjdk-jdk10    文件:RasterPrinterJob.java   
protected final int getFromPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[0][0];
        }
    }
    return getMinPageAttrib();
}
项目:openjdk-jdk10    文件:RasterPrinterJob.java   
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}