本文整理汇总了Java中javax.print.attribute.standard.OrientationRequested.PORTRAIT属性的典型用法代码示例。如果您正苦于以下问题:Java OrientationRequested.PORTRAIT属性的具体用法?Java OrientationRequested.PORTRAIT怎么用?Java OrientationRequested.PORTRAIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.print.attribute.standard.OrientationRequested
的用法示例。
在下文中一共展示了OrientationRequested.PORTRAIT属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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 };
}
示例3: selectOrient
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);
}
}
示例4: 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;
}
}
示例5: getDefaultAttributeValue
@Override
public Object getDefaultAttributeValue(Class<? extends Attribute> category) {
if (category == Media.class) {
return MediaSizeName.NA_LETTER;
}
if (category == OrientationRequested.class) {
return OrientationRequested.PORTRAIT;
}
return null;
}
示例6: 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;
}
示例7: 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);
}
}
示例8: getOrientation
public OrientationRequested getOrientation() {
return getDmOrientation(structPtr) == DMORIENT_LANDSCAPE
? OrientationRequested.LANDSCAPE
: OrientationRequested.PORTRAIT;
}
示例9: 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;
}