当前位置: 首页>>代码示例>>Java>>正文


Java OrientationRequested.LANDSCAPE属性代码示例

本文整理汇总了Java中javax.print.attribute.standard.OrientationRequested.LANDSCAPE属性的典型用法代码示例。如果您正苦于以下问题:Java OrientationRequested.LANDSCAPE属性的具体用法?Java OrientationRequested.LANDSCAPE怎么用?Java OrientationRequested.LANDSCAPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.print.attribute.standard.OrientationRequested的用法示例。


在下文中一共展示了OrientationRequested.LANDSCAPE属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assignOrientation

public OrientationRequested assignOrientation(final String orientation) {
    OrientationRequested answer;

    if (orientation == null) {
        // default to portrait
        answer = OrientationRequested.PORTRAIT;
    } else if (orientation.equalsIgnoreCase("portrait")) {
        answer = OrientationRequested.PORTRAIT;
    } else if (orientation.equalsIgnoreCase("landscape")) {
        answer = OrientationRequested.LANDSCAPE;
    } else if (orientation.equalsIgnoreCase("reverse-portrait")) {
        answer = OrientationRequested.REVERSE_PORTRAIT;
    } else if (orientation.equalsIgnoreCase("reverse-landscape")) {
        answer = OrientationRequested.REVERSE_LANDSCAPE;
    } else {
        answer = OrientationRequested.PORTRAIT;
    }

    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:PrinterConfiguration.java

示例2: printableJob

public void printableJob(Printable printable,
                         PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        PageFormat pf = new PageFormat();
        if (mediaSize != null) {
            Paper p = new Paper();
            p.setSize(mediaSize.getX(MediaSize.INCH)*72.0,
                      mediaSize.getY(MediaSize.INCH)*72.0);
            p.setImageableArea(72.0, 72.0, p.getWidth()-144.0,
                               p.getHeight()-144.0);
            pf.setPaper(p);
        }
        if (orient == OrientationRequested.REVERSE_LANDSCAPE) {
            pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
        } else if (orient == OrientationRequested.LANDSCAPE) {
            pf.setOrientation(PageFormat.LANDSCAPE);
        }
        job.setPrintable(printable, pf);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:PSStreamPrintJob.java

示例3: printableJob

public void printableJob(Printable printable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        PageFormat pf = new PageFormat();
        if (mediaSize != null) {
            Paper p = new Paper();
            p.setSize(mediaSize.getX(MediaSize.INCH)*72.0,
                      mediaSize.getY(MediaSize.INCH)*72.0);
            p.setImageableArea(72.0, 72.0, p.getWidth()-144.0,
                               p.getHeight()-144.0);
            pf.setPaper(p);
        }
        if (orient == OrientationRequested.REVERSE_LANDSCAPE) {
            pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
        } else if (orient == OrientationRequested.LANDSCAPE) {
            pf.setOrientation(PageFormat.LANDSCAPE);
        }
        job.setPrintable(printable, pf);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:UnixPrintJob.java

示例4: getOrientAttrib

private final int getOrientAttrib() {
    int orient = PageFormat.PORTRAIT;
    OrientationRequested orientReq = (attributes == null) ? null :
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orientReq != null) {
        if (orientReq == OrientationRequested.REVERSE_LANDSCAPE) {
            orient = PageFormat.REVERSE_LANDSCAPE;
        } else if (orientReq == OrientationRequested.LANDSCAPE) {
            orient = PageFormat.LANDSCAPE;
        }
    }

    return orient;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:14,代码来源:WPrinterJob.java

示例5: getSupportedOrientations

public static OrientationRequested[] getSupportedOrientations(
                final long handle) throws PrintException {
    if (getLandscapeOrientationDegree(handle) == 270) {
        return new OrientationRequested[] { OrientationRequested.PORTRAIT,
                        OrientationRequested.REVERSE_LANDSCAPE };
    }
    return new OrientationRequested[] { OrientationRequested.PORTRAIT,
                    OrientationRequested.LANDSCAPE };
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:WinPrinterFactory.java

示例6: getOrient

OrientationRequested getOrient() {
    if (portraitBtn.isSelected()) {
        return OrientationRequested.PORTRAIT;
    } else if (landscapeBtn.isSelected()) {
        return OrientationRequested.LANDSCAPE;
    } else if (rvportraitBtn.isSelected()) {
        return OrientationRequested.REVERSE_PORTRAIT;
    } else if (rvlandscapeBtn.isSelected()) {
        return OrientationRequested.REVERSE_LANDSCAPE;
    } else {
        return null;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:ServiceUIDialog.java

示例7: getSupportedAttributeValues

@Override
public Object getSupportedAttributeValues(Class<? extends Attribute> category, DocFlavor flavor, AttributeSet attributes) {
	if (category == Media.class) {
		return new Media[] { MediaSizeName.NA_LETTER, MediaSizeName.NA_LEGAL, MediaSizeName.ISO_A4 };
	}
	if (category == OrientationRequested.class) {
		return new OrientationRequested[] { OrientationRequested.PORTRAIT, OrientationRequested.LANDSCAPE };
	}
	return null;
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:10,代码来源:DummyPrintService.java

示例8: setOrientation

private void setOrientation(JasperPrint jPrint,PrintRequestAttributeSet printRequestAttributeSet)
{
	if (!printRequestAttributeSet.containsKey(MediaPrintableArea.class))
	{
		int printableWidth;
		int printableHeight;
		switch (jPrint.getOrientationValue())
		{
			case LANDSCAPE:
				printableWidth = jPrint.getPageHeight();
				printableHeight = jPrint.getPageWidth();
				break;
			default:
				printableWidth = jPrint.getPageWidth();
				printableHeight = jPrint.getPageHeight();
				break;
		}
		
		printRequestAttributeSet.add(
			new MediaPrintableArea(
				0f, 
				0f, 
				printableWidth / 72f,
				printableHeight / 72f,
				MediaPrintableArea.INCH
				)
			);
	}

	if (!printRequestAttributeSet.containsKey(OrientationRequested.class))
	{
		OrientationRequested orientation;
		switch (jPrint.getOrientationValue())
		{
			case LANDSCAPE:
				orientation = OrientationRequested.LANDSCAPE;
				break;
			default:
				orientation = OrientationRequested.PORTRAIT;
				break;
		}
		printRequestAttributeSet.add(orientation);
	}
	
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:45,代码来源:JRPrintServiceExporter.java

示例9: getOrientation

public OrientationRequested getOrientation() {
    return getDmOrientation(structPtr) == DMORIENT_LANDSCAPE
                    ? OrientationRequested.LANDSCAPE
                    : OrientationRequested.PORTRAIT;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:DevmodeStructWrapper.java

示例10: getSupportedAttributeValues

public Object getSupportedAttributeValues(Class category, DocFlavor flavor,
        AttributeSet attributes) {
    if (flavor != null &&
        (flavor.equals(DocFlavor.INPUT_STREAM.AUTOSENSE) ||
         flavor.equals(DocFlavor.BYTE_ARRAY.AUTOSENSE) ||
         flavor.equals(DocFlavor.URL.AUTOSENSE) ||
         flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
         flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT) ||
         flavor.equals(DocFlavor.URL.POSTSCRIPT))) {
        return null;
    }
    if (category.equals(Copies.class)) {
        int copies = getCopiesSupported(serviceName);
        if (copies == 1) {
            return new CopiesSupported(1);
        } else if (copies > 1) {
            return new CopiesSupported(1, copies);
        }
    } else if (category.equals(Sides.class)) {
        if (getSidesSupported(serviceName)) {
            return new Sides[] {Sides.ONE_SIDED,
                                Sides.TWO_SIDED_SHORT_EDGE,
                                Sides.TWO_SIDED_LONG_EDGE,
                                Sides.DUPLEX,
                                Sides.TUMBLE};
        }
    } else if (category.equals(Media.class)) {
        return getSupportedMediaSizeNames();
    } else if (category.equals(MediaSizeName.class)) {
        return getSupportedMediaSizeNames();
    } else if (category.equals(Chromaticity.class)) {
        if (getColorSupported(serviceName)) {
            return new Chromaticity[] { Chromaticity.MONOCHROME,
                                        Chromaticity.COLOR };
        } else {
            return new Chromaticity[] { Chromaticity.MONOCHROME };
        }
    } else if (category.equals(OrientationRequested.class)) {
        if (getOrientationSupported(serviceName)) {
            return new OrientationRequested[]
                { OrientationRequested.PORTRAIT,
                  OrientationRequested.LANDSCAPE };
        }
    } else if (category.equals(PrinterResolution.class)) {
        int[] resolutions = getResolutionsSupported(serviceName);
        if (resolutions != null && resolutions.length > 1) {
            PrinterResolution[] res =
                new PrinterResolution[resolutions.length / 2];
            for (int i = 0; i < resolutions.length / 2; i++) {
                res[i] = new PrinterResolution(resolutions[i * 2],
                        resolutions[i * 2 + 1], PrinterResolution.DPI);
            }
            return res;
        }
    } else if (category.equals(SheetCollate.class)) {
        if (getCollateSupported(serviceName)) {
            return new SheetCollate[] { SheetCollate.COLLATED,
                                        SheetCollate.UNCOLLATED };
        }
    }
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:62,代码来源:GDIClient.java

示例11: testHashDocAttributeSet

public void testHashDocAttributeSet() {
    startTest("HashDocAttributeSet class testing...");

    DocAttributeSet set1 = new HashDocAttributeSet();
    DocAttributeSet set2 = 
        new HashDocAttributeSet(OrientationRequested.LANDSCAPE);
    DocAttributeSet set3 = new HashDocAttributeSet(set2);
    DocAttribute [] arr = {OrientationRequested.LANDSCAPE,
                           MediaName.NA_LETTER_WHITE};
    DocAttributeSet set4 = new HashDocAttributeSet(arr);
    Attribute [] attrArr;

    assertTrue(set1.isEmpty());
    assertFalse(set2.isEmpty());
    assertTrue(set3.equals(set2));
    assertFalse(set3.equals(set1));
    set3.clear();
    assertEquals(set3, set1);
    set3.add(OrientationRequested.LANDSCAPE);
    set3.add(MediaName.NA_LETTER_WHITE);
    assertTrue(set3.containsKey(OrientationRequested.LANDSCAPE.getClass()));
    assertFalse(set2.containsKey(MediaName.NA_LETTER_WHITE.getClass()));
    assertTrue(set3.containsValue(OrientationRequested.LANDSCAPE));
    assertFalse(set3.containsValue(OrientationRequested.PORTRAIT));
    assertFalse(set3.containsValue(PrintQuality.DRAFT));
    assertEquals(set1.size(), 0);
    assertEquals(set2.size(), 1);
    assertEquals(set3.size(), 2);
    assertTrue(set4.equals(set3));
    assertEquals(set3.get(OrientationRequested.PORTRAIT.getClass()),
                 OrientationRequested.LANDSCAPE);
    assertFalse((set3.get(OrientationRequested.PORTRAIT.getClass()))
            .equals(OrientationRequested.PORTRAIT));
    set1.addAll(set3);
    assertEquals(set3, set1);
    set1.remove(OrientationRequested.PORTRAIT.getClass());
    assertEquals(set1.size(), 1);
    attrArr = set1.toArray();
    assertEquals(attrArr.length, 1);
    assertEquals(attrArr[0], MediaName.NA_LETTER_WHITE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:41,代码来源:ValueTests.java

示例12: testHashPrintJobAttributeSet

public void testHashPrintJobAttributeSet() {
    startTest("HashPrintJobAttributeSet class testing...");

    PrintJobAttributeSet set1 = new HashPrintJobAttributeSet();
    PrintJobAttributeSet set2 = 
        new HashPrintJobAttributeSet(OrientationRequested.LANDSCAPE);
    PrintJobAttributeSet set3 = new HashPrintJobAttributeSet(set2);
    PrintJobAttribute [] arr = {OrientationRequested.LANDSCAPE,
                                MediaName.NA_LETTER_WHITE};
    PrintJobAttributeSet set4 = new HashPrintJobAttributeSet(arr);
    Attribute [] attrArr;
    
    assertTrue(set1.isEmpty());
    assertFalse(set2.isEmpty());
    assertTrue(set3.equals(set2));
    assertFalse(set3.equals(set1));
    set3.clear();
    assertEquals(set3, set1);
    set3.add(OrientationRequested.LANDSCAPE);
    set3.add(MediaName.NA_LETTER_WHITE);
    assertTrue(set3.containsKey(OrientationRequested.LANDSCAPE.getClass()));
    assertFalse(set2.containsKey(MediaName.NA_LETTER_WHITE.getClass()));
    assertTrue(set3.containsValue(OrientationRequested.LANDSCAPE));
    assertFalse(set3.containsValue(OrientationRequested.PORTRAIT));
    assertFalse(set3.containsValue(PrintQuality.DRAFT));
    assertEquals(set1.size(), 0);
    assertEquals(set2.size(), 1);
    assertEquals(set3.size(), 2);
    assertTrue(set4.equals(set3));
    assertEquals(set3.get(OrientationRequested.PORTRAIT.getClass()),
                 OrientationRequested.LANDSCAPE);
    assertFalse((set3.get(OrientationRequested.PORTRAIT.getClass()))
            .equals(OrientationRequested.PORTRAIT));
    set1.addAll(set3);
    assertEquals(set3, set1);
    set1.remove(OrientationRequested.PORTRAIT.getClass());
    assertEquals(set1.size(), 1);
    attrArr = set1.toArray();
    assertEquals(attrArr.length, 1);
    assertEquals(attrArr[0], MediaName.NA_LETTER_WHITE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:41,代码来源:ValueTests.java


注:本文中的javax.print.attribute.standard.OrientationRequested.LANDSCAPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。