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


Java OrientationRequested类代码示例

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


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

示例1: printWorksheetLevel

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
public void printWorksheetLevel() {
	PrinterJob print = PrinterJob.getPrinterJob();
	PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
	set.add(OrientationRequested.LANDSCAPE);
	print.setPrintable(oscilloscope);
	if(print.printDialog(set))
		try { print.print(); }
	catch(PrinterException e) {}
}
 
开发者ID:kristian,项目名称:JDigitalSimulator,代码行数:10,代码来源:Application.java

示例2: actionPerformed

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
final public void actionPerformed(ActionEvent objPactionEvent) {
	final Object objLsourceObject = objPactionEvent.getSource();

	if (this.objGportraitPrintIconRadioJButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(OrientationRequested.PORTRAIT);
	} else if (this.objGlandscapePrintIconRadioJButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(OrientationRequested.LANDSCAPE);
	} else if (this.objGreversePortraitPrintIconRadioJButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(OrientationRequested.REVERSE_PORTRAIT);
	} else if (this.objGreverseLandscapePrintIconRadioJButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(OrientationRequested.REVERSE_LANDSCAPE);
	}
	// orientation affects display of margins.
	if (this.objGprintMarginsSubJPanel != null) {
		this.objGprintMarginsSubJPanel.setValues();
	}
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:18,代码来源:PrintOrientationSubJPanel.java

示例3: actionPerformed

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
    try {
        if (selectedDriver == null)
            return;

        PrintService ps = (PrintService)printers.getSelectedItem();
        PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();

        attr.add(new Copies(1));
        attr.add((Media)ps.getDefaultAttributeValue(Media.class)); // set to default paper from printer
        attr.add(OrientationRequested.LANDSCAPE);

        SimpleDoc doc = new SimpleDoc(activeLabel, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
        ps.createPrintJob().print(doc, attr);
    }  catch (PrintException ex) {
        log.log(Level.SEVERE, "\bBarcode print failed: " + ex.getMessage(), ex);
    }
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:21,代码来源:EntryPanel.java

示例4: assignOrientation

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
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,代码行数:21,代码来源:PrinterConfiguration.java

示例5: printToMiddleTray

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
@Test
public void printToMiddleTray() throws Exception {
    PrinterEndpoint endpoint = new PrinterEndpoint();
    PrinterConfiguration configuration = new PrinterConfiguration();
    configuration.setHostname("localhost");
    configuration.setPort(631);
    configuration.setPrintername("DefaultPrinter");
    configuration.setMediaSizeName(MediaSizeName.ISO_A4);
    configuration.setInternalSides(Sides.ONE_SIDED);
    configuration.setInternalOrientation(OrientationRequested.PORTRAIT);
    configuration.setMediaTray("middle");

    PrinterProducer producer = new PrinterProducer(endpoint, configuration);
    producer.start();
    PrinterOperations printerOperations = producer.getPrinterOperations();
    PrintRequestAttributeSet attributeSet = printerOperations.getPrintRequestAttributeSet();

    Attribute attribute = attributeSet.get(javax.print.attribute.standard.Media.class);
    assertNotNull(attribute);
    assertTrue(attribute instanceof MediaTray);
    MediaTray mediaTray = (MediaTray) attribute;
    assertEquals("middle", mediaTray.toString());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:PrinterPrintTest.java

示例6: printsWithLandscapeOrientation

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
@Test
public void printsWithLandscapeOrientation() throws Exception {
    PrinterEndpoint endpoint = new PrinterEndpoint();
    PrinterConfiguration configuration = new PrinterConfiguration();
    configuration.setHostname("localhost");
    configuration.setPort(631);
    configuration.setPrintername("DefaultPrinter");
    configuration.setMediaSizeName(MediaSizeName.ISO_A4);
    configuration.setInternalSides(Sides.ONE_SIDED);
    configuration.setInternalOrientation(OrientationRequested.REVERSE_LANDSCAPE);
    configuration.setMediaTray("middle");
    configuration.setSendToPrinter(false);

    PrinterProducer producer = new PrinterProducer(endpoint, configuration);
    producer.start();
    PrinterOperations printerOperations = producer.getPrinterOperations();
    PrintRequestAttributeSet attributeSet = printerOperations.getPrintRequestAttributeSet();

    Attribute attribute = attributeSet.get(OrientationRequested.class);
    assertNotNull(attribute);
    assertEquals("reverse-landscape", attribute.toString());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:PrinterPrintTest.java

示例7: getPrintRequestAttributeSet

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
/**
 *  Return Print Request Attributes
 *  @return PrintRequestAttributeSet
 */
public PrintRequestAttributeSet getPrintRequestAttributeSet()
{
	PrintRequestAttributeSet pratts = new HashPrintRequestAttributeSet();
	//	media-printable-area = (25.4,25.4)->(165.1,228.6)mm - class javax.print.attribute.standard.MediaPrintableArea
	pratts.add(getMediaPrintableArea());
	//	orientation-requested = landscape - class javax.print.attribute.standard.OrientationRequested
	if (isLandscape())
		pratts.add(OrientationRequested.LANDSCAPE);
	else
		pratts.add(OrientationRequested.PORTRAIT);
	//	media = na-legal
	//Commented Lines By AA Goodwill: Custom Paper Support 
	//pratts.add(getMediaSizeName());
	//End Of AA Goodwill

	return pratts;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:22,代码来源:CPaper.java

示例8: print

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
/**
 * 	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);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:34,代码来源:PrintUtil.java

示例9: printInfoButtonActionPerformed

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
private void printInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printInfoButtonActionPerformed
    // TODO add your handling code here:
    PrinterJob pjob = PrinterJob.getPrinterJob();
    PageFormat preformat = pjob.defaultPage();
    preformat.setOrientation(PageFormat.PORTRAIT);
    PageFormat postformat = pjob.pageDialog(preformat);
    //If user does not hit cancel then print.
    if (preformat != postformat) {
        //Set print component
        pjob.setPrintable(new Printer(bottomPanel), postformat);
        if (pjob.printDialog()) {
            try {
                PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
                set.add(OrientationRequested.PORTRAIT);
                //pjob.print();
                table.print(JTable.PrintMode.FIT_WIDTH, header, null, false, set, false);
            } catch (PrinterException ex) {
                Logger.getLogger(EditProjectParticipants.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:23,代码来源:ViewProjectParticipants.java

示例10: setAttribute

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
public void setAttribute(final Attribute attr) {
    final Class<? extends Attribute> category = attr.getCategory();

    if (OrientationRequested.class.equals(category)) {
        setOrientation((OrientationRequested) attr);
    } else if (MediaSize.class.equals(category)) {
        setPaper((MediaSize) attr);
    } else if (Media.class.equals(category)) {
        setPaper((MediaSizeName) attr);
    } else if (Paper.class.equals(category)) {
        setPaper((Paper) attr);
    } else if (Copies.class.equals(category)) {
        setCopies((Copies) attr);
    } else if (PrintQuality.class.equals(category)) {
        setPrintQuality((PrintQuality) attr);
    } else if (Sides.class.equals(category)) {
        setSides((Sides) attr);
    } else if (SheetCollate.class.equals(category)) {
        setCollate((SheetCollate) attr);
    } else if (PrinterResolution.class.equals(category)) {
        setPrinterResolution((PrinterResolution) attr);
    } else if (Chromaticity.class.equals(category)) {
        setChromaticity((Chromaticity) attr);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:DevmodeStructWrapper.java

示例11: enableOrient

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
private void enableOrient(OrientationRequested[] list) {
    portraitBtn.setEnabled(false);
    landscapeBtn.setEnabled(false);
    rvportraitBtn.setEnabled(false);
    rvlandscapeBtn.setEnabled(false);
    
    if (list != null) {
        for (int i = 0; i < list.length; i++) {
            if (list[i].equals(OrientationRequested.LANDSCAPE)) {
                landscapeBtn.setEnabled(true);
            } else if (list[i].equals(OrientationRequested.PORTRAIT)) {
                portraitBtn.setEnabled(true);
            } else if (list[i].equals(OrientationRequested.REVERSE_LANDSCAPE)) {
                rvlandscapeBtn.setEnabled(true);
            } else if (list[i].equals(OrientationRequested.REVERSE_PORTRAIT)) {
                rvportraitBtn.setEnabled(true);
            }
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:ServiceUIDialog.java

示例12: createOrientationCombo

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
private void createOrientationCombo(PrintRequestAttributeSet set) {
	OrientationRequested[] orientations = (OrientationRequested[]) mService.getSupportedAttributeValues(OrientationRequested.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
	if (orientations != null && orientations.length > 0) {
		HashSet<OrientationRequested> possible = new HashSet<>();
		for (OrientationRequested one : orientations) {
			possible.add(one);
		}
		ArrayList<PageOrientation> choices = new ArrayList<>();
		for (PageOrientation orientation : PageOrientation.values()) {
			if (possible.contains(orientation.getOrientationRequested())) {
				choices.add(orientation);
			}
		}
		mOrientation = new JComboBox<>(choices.toArray(new PageOrientation[0]));
		mOrientation.setSelectedItem(PrintUtilities.getPageOrientation(mService, set));
		UIUtilities.setOnlySize(mOrientation, mOrientation.getPreferredSize());
		LinkedLabel label = new LinkedLabel(ORIENTATION, mOrientation);
		add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
		add(mOrientation);
	} else {
		mOrientation = null;
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:24,代码来源:PageSetupPanel.java

示例13: printsWithLandscapeOrientation

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
@Test
public void printsWithLandscapeOrientation() throws Exception {
    PrinterEndpoint endpoint = new PrinterEndpoint();
    PrinterConfiguration configuration = new PrinterConfiguration();
    configuration.setHostname("localhost");
    configuration.setPort(631);
    configuration.setPrintername("DefaultPrinter");
    configuration.setMediaSizeName(MediaSizeName.ISO_A4);
    configuration.setInternalSides(Sides.ONE_SIDED);
    configuration.setInternalOrientation(OrientationRequested.REVERSE_LANDSCAPE);
    configuration.setMediaTray("middle");
    configuration.setSendToPrinter(false);

    PrinterProducer producer = new PrinterProducer(endpoint, configuration);
    producer.start();
    PrinterOperations printerOperations = producer.getPrinterOperations();
    PrintRequestAttributeSet attributeSet = printerOperations.getPrintRequestAttributeSet();

    Attribute attribute = attributeSet.get(OrientationRequested.class);
    Assert.assertNotNull(attribute);
    Assert.assertEquals("reverse-landscape", attribute.toString());
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:23,代码来源:PrinterIntegrationTest.java

示例14: printComponent

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
public static void printComponent(Component c) {
  // Get a list of all printers that can handle Printable objects.
  DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
  PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, null);
  // Set some define printing attributes
  PrintRequestAttributeSet printAttributes = new HashPrintRequestAttributeSet();
  //printAttributes.add(OrientationRequested.LANDSCAPE); // landscape mode
  printAttributes.add(OrientationRequested.PORTRAIT);                    // PORTRAIT mode
  printAttributes.add(Chromaticity.MONOCHROME);                          // print in mono
  printAttributes.add(javax.print.attribute.standard.PrintQuality.HIGH); // highest resolution
  // Display a dialog that allows the user to select one of the
  // available printers and to edit the default attributes
  PrintService service = ServiceUI.printDialog(null, 100, 100, services, null, null, printAttributes);
  // If the user canceled, don't do anything
  if(service==null) {
    return;
  }
  // Now call a method defined below to finish the printing
  printToService(c, service, printAttributes);
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:21,代码来源:PrintUtils.java

示例15: printableJob

import javax.print.attribute.standard.OrientationRequested; //导入依赖的package包/类
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,代码行数:38,代码来源:PSStreamPrintJob.java


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