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


Java OrientationRequested.equals方法代码示例

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


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

示例1: getPageAttributes

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private void getPageAttributes()
{
  OrientationRequested orientation = (OrientationRequested)
    attributes.get( OrientationRequested.LANDSCAPE.getCategory() );
  if( orientation == null)
    return;

  if( orientation.equals(OrientationRequested.PORTRAIT) )
    pageFormat.setOrientation(PageFormat.PORTRAIT);
  else if( orientation.equals(OrientationRequested.LANDSCAPE) )
    pageFormat.setOrientation(PageFormat.LANDSCAPE);
  else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) )
      pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:JavaPrinterJob.java

示例2: getPageAttributes

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private void getPageAttributes()
 {
   OrientationRequested orientation = (OrientationRequested)
     attributes.get( OrientationRequested.LANDSCAPE.getCategory() );
   if( orientation == null)
     return;

   if( orientation.equals(OrientationRequested.PORTRAIT) )
     pageFormat.setOrientation(PageFormat.PORTRAIT);
   else if( orientation.equals(OrientationRequested.LANDSCAPE) )
     pageFormat.setOrientation(PageFormat.LANDSCAPE);
   else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) )
pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:15,代码来源:JavaPrinterJob.java

示例3: selectOrient

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private void selectOrient(OrientationRequested par) {
    if (par == null) {
        par = OrientationRequested.PORTRAIT;
    }
    if (par.equals(OrientationRequested.LANDSCAPE)) {
        landscapeBtn.setSelected(true);
    } else if (par.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
        rvlandscapeBtn.setSelected(true);
    } else if (par.equals(OrientationRequested.REVERSE_PORTRAIT)) {
        rvportraitBtn.setSelected(true);
    } else {
        portraitBtn.setSelected(true);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:ServiceUIDialog.java

示例4: orientEnabled

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private boolean orientEnabled(OrientationRequested par) {
    if (par == null) {
        return false;
    } else if (par.equals(OrientationRequested.LANDSCAPE)) {
        return landscapeBtn.isEnabled();
    } else if (par.equals(OrientationRequested.PORTRAIT)) {
        return portraitBtn.isEnabled();
    } else if (par.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
        return rvlandscapeBtn.isEnabled();
    } else if (par.equals(OrientationRequested.REVERSE_PORTRAIT)) {
        return rvportraitBtn.isEnabled();
    } else {
        return false;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:ServiceUIDialog.java

示例5: patchMedia

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private Pageable patchMedia( Pageable pageable ){
	/* OpenBook is used internally only when app uses Printable.
     * This is the case when we use the values from the attribute set.
     */
    Media media = (Media)reqAttrSet.get(Media.class);
    OrientationRequested orientReq = (OrientationRequested)reqAttrSet.get(OrientationRequested.class);
    MediaPrintableArea mpa = (MediaPrintableArea)reqAttrSet.get(MediaPrintableArea.class);

    if ((orientReq != null || media != null || mpa != null) && pageable instanceof OpenBook) {

        /* We could almost(!) use PrinterJob.getPageFormat() except
         * here we need to start with the PageFormat from the OpenBook :
         */
        Printable printable = pageable.getPrintable(0);
        PageFormat pf = (PageFormat)pageable.getPageFormat(0).clone();
        Paper paper = pf.getPaper();

        /* If there's a media but no media printable area, we can try
         * to retrieve the default value for mpa and use that.
         */
        if (mpa == null && media != null && service.isAttributeCategorySupported(MediaPrintableArea.class)) {
            Object mpaVals = service. getSupportedAttributeValues(MediaPrintableArea.class, null, reqAttrSet);
            if (mpaVals instanceof MediaPrintableArea[] && ((MediaPrintableArea[])mpaVals).length > 0) {
                mpa = ((MediaPrintableArea[])mpaVals)[0];
            }
        }

        if (isSupportedValue(orientReq, reqAttrSet) || (!fidelity && orientReq != null)) {
            int orient;
            if (orientReq.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
                orient = PageFormat.REVERSE_LANDSCAPE;
            } else if (orientReq.equals(OrientationRequested.LANDSCAPE)) {
                orient = PageFormat.LANDSCAPE;
            } else {
                orient = PageFormat.PORTRAIT;
            }
            pf.setOrientation(orient);
        }

        if (isSupportedValue(media, reqAttrSet) || (!fidelity && media != null)) {
            if (media instanceof MediaSizeName) {
                MediaSizeName msn = (MediaSizeName)media;
                MediaSize msz = MediaSize.getMediaSizeForName(msn);
                if (msz != null) {
                    float paperWid =  msz.getX(MediaSize.INCH) * 72.0f;
                    float paperHgt =  msz.getY(MediaSize.INCH) * 72.0f;
                    paper.setSize(paperWid, paperHgt);
                    if (mpa == null) {
                        paper.setImageableArea(72.0, 72.0, paperWid-144.0, paperHgt-144.0);
                    }
                }
            }
        }

        if (isSupportedValue(mpa, reqAttrSet) || (!fidelity && mpa != null)) {
            float [] printableArea = mpa.getPrintableArea(MediaPrintableArea.INCH);
            for (int i=0; i < printableArea.length; i++) {
                printableArea[i] = printableArea[i]*72.0f;
            }
            paper.setImageableArea(printableArea[0], printableArea[1], printableArea[2], printableArea[3]);
        }

        pf.setPaper(paper);
        pf = validatePage(pf);
        return new OpenBook(pf, printable);
    }
    return pageable;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:69,代码来源:Win32PrintJob.java

示例6: pageSetupMenuItem_ActionPerformed

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
/**
 * Comment
 * @param actionEvent
 */
public void pageSetupMenuItem_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
//	new Thread() {
//		public void run()
//		{

			final GetPrintableInterface pi = (GetPrintableInterface)CommandManager.getInstance().getCommand("GetPrintableInterface");
		
			if(pi == null)
				return;
			
			PrintRequestAttributeSet printRequestAttributeSet = Page.getPrintRequestAttributeSet();
		
			PrinterJob printerJob = PrinterJob.getPrinterJob();
			PrintService temp = PrinterSelector.getPrinterSelector(this).getPrintService(lastPrintService);
			
			if (temp == null) {
			    return;
			} else {
			    lastPrintService = temp;
			    try {
                    printerJob.setPrintService(lastPrintService);
                } catch (PrinterException e) {
                    handleException(e);
                }
			}
							
			PageFormat pageFormat = printerJob.pageDialog(printRequestAttributeSet);
			
			if(pageFormat==null)
				return;
		
			int pageFormatOrientation = PageFormat.PORTRAIT;

			OrientationRequested orientationRequested = (OrientationRequested)
				printRequestAttributeSet.get(OrientationRequested.class);
				
			if(orientationRequested != null)
			{
				if(orientationRequested.equals(OrientationRequested.LANDSCAPE))
					pageFormatOrientation = PageFormat.LANDSCAPE;
				else if(orientationRequested.equals(OrientationRequested.REVERSE_LANDSCAPE))
					pageFormatOrientation = PageFormat.REVERSE_LANDSCAPE;
			}
			
			pi.getPageable().getPageFormat(0).setOrientation(pageFormatOrientation);
		
			MediaPrintableArea mediaPrintableArea = (MediaPrintableArea)
				printRequestAttributeSet.get(MediaPrintableArea.class);
				
			Paper paper = pi.getPageable().getPageFormat(0).getPaper();
		
			paper.setImageableArea(mediaPrintableArea.getX(MediaPrintableArea.INCH) * 72.0,
				mediaPrintableArea.getY(MediaPrintableArea.INCH) * 72.0,
				mediaPrintableArea.getWidth(MediaPrintableArea.INCH) * 72,
				mediaPrintableArea.getHeight(MediaPrintableArea.INCH) * 72);
		
			pi.getPageable().getPageFormat(0).setPaper(paper);
						
			// store settings 
			com.cosylab.vdct.graphics.printing.Page.setPageFormat(pageFormat);
			Page.setPrintRequestAttributeSet(printRequestAttributeSet);
	//	}
	//}.start();

}
 
开发者ID:epics-extensions,项目名称:VisualDCT,代码行数:70,代码来源:VisualDCT.java

示例7: stateChanged

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
public void stateChanged(ChangeEvent e) {
    OrientationRequested now = getOrient();

    if ((lastOrient != null) && (now != null) && (!lastOrient.equals(now))) {
        /* if orientation was really changed */
        
        String txt = leftTxt.getText();

        if ((lastOrient.equals(OrientationRequested.PORTRAIT)
                        && now.equals(OrientationRequested.LANDSCAPE))
                || (lastOrient.equals(OrientationRequested.LANDSCAPE)  
                        && now.equals(OrientationRequested.REVERSE_PORTRAIT))
                || (lastOrient.equals(OrientationRequested.REVERSE_PORTRAIT)
                        && now.equals(OrientationRequested.REVERSE_LANDSCAPE)) 
                || (lastOrient.equals(OrientationRequested.REVERSE_LANDSCAPE) 
                        && now.equals(OrientationRequested.PORTRAIT))) {
            leftTxt.setText(bottomTxt.getText());
            bottomTxt.setText(rightTxt.getText());
            rightTxt.setText(topTxt.getText());
            topTxt.setText(txt);

        } else if ((lastOrient.equals(OrientationRequested.PORTRAIT) 
                        && now.equals(OrientationRequested.REVERSE_PORTRAIT))
                || (lastOrient.equals(OrientationRequested.LANDSCAPE) 
                        && now.equals(OrientationRequested.REVERSE_LANDSCAPE))
                || (lastOrient.equals(OrientationRequested.REVERSE_PORTRAIT) 
                        && now.equals(OrientationRequested.PORTRAIT))
                || (lastOrient.equals(OrientationRequested.REVERSE_LANDSCAPE)
                        && now.equals(OrientationRequested.LANDSCAPE))) {
            leftTxt.setText(rightTxt.getText());
            rightTxt.setText(txt);
            txt = topTxt.getText();
            topTxt.setText(bottomTxt.getText());
            bottomTxt.setText(txt);
        
        } else {
            leftTxt.setText(topTxt.getText());
            topTxt.setText(rightTxt.getText());
            rightTxt.setText(bottomTxt.getText());
            bottomTxt.setText(txt);
        }
    }
    
    if (now != null) {
        lastOrient = now;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:48,代码来源:ServiceUIDialog.java

示例8: attrsToFormat

import javax.print.attribute.standard.OrientationRequested; //导入方法依赖的package包/类
private static PageFormat attrsToFormat(
                final PrintRequestAttributeSet attributes) {
    if (attributes == null) {
        return new PageFormat();
    }

    final PageFormat format = new PageFormat();
    final Paper paper = new Paper();
    final OrientationRequested orient = (OrientationRequested) attributes
                    .get(OrientationRequested.class);
    final MediaSize size = attributes.containsKey(Media.class) ? MediaSize
                    .getMediaSizeForName((MediaSizeName) attributes
                                    .get(Media.class))
                    : (MediaSize) attributes.get(MediaSize.class);
    final MediaPrintableArea area = (MediaPrintableArea) attributes
                    .get(MediaPrintableArea.class);

    if (orient != null) {
        if (orient.equals(OrientationRequested.LANDSCAPE)) {
            format.setOrientation(PageFormat.LANDSCAPE);
        } else if (orient.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
            format.setOrientation(PageFormat.REVERSE_LANDSCAPE);
        }
    }

    if (size != null) {
        paper.setSize(size.getX(Size2DSyntax.INCH) * 72.0, size
                        .getY(Size2DSyntax.INCH) * 72.0);
    }

    if (area != null) {
        paper.setImageableArea(area.getX(Size2DSyntax.INCH) * 72.0, area
                        .getY(Size2DSyntax.INCH) * 72.0, area
                        .getWidth(Size2DSyntax.INCH) * 72.0, area
                        .getHeight(Size2DSyntax.INCH) * 72.0);
    }

    format.setPaper(paper);

    return format;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:42,代码来源:PrinterJobImpl.java


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