6735296: Regression: Common print dialog does not show the correct page orientation

Reviewed-by: tdv, prr
This commit is contained in:
Jennifer Godinez 2009-03-05 10:56:06 -08:00
parent be8bd14e3c
commit c9de141417

View File

@ -2149,55 +2149,51 @@ public class ServiceDialog extends JDialog implements ActionListener {
} }
} }
} }
}
rbPortrait.setEnabled(pSupported);
rbLandscape.setEnabled(lSupported);
rbRevPortrait.setEnabled(rpSupported);
rbRevLandscape.setEnabled(rlSupported);
OrientationRequested or = (OrientationRequested)asCurrent.get(orCategory); rbPortrait.setEnabled(pSupported);
if (or == null || rbLandscape.setEnabled(lSupported);
!psCurrent.isAttributeValueSupported(or, docFlavor, asCurrent)) { rbRevPortrait.setEnabled(rpSupported);
rbRevLandscape.setEnabled(rlSupported);
or = (OrientationRequested)psCurrent.getDefaultAttributeValue(orCategory); OrientationRequested or = (OrientationRequested)asCurrent.get(orCategory);
// need to validate if default is not supported if (or == null ||
if (!psCurrent.isAttributeValueSupported(or, docFlavor, asCurrent)) { !psCurrent.isAttributeValueSupported(or, docFlavor, asCurrent)) {
or = null;
values = or = (OrientationRequested)psCurrent.getDefaultAttributeValue(orCategory);
psCurrent.getSupportedAttributeValues(orCategory, // need to validate if default is not supported
docFlavor, if ((or != null) &&
asCurrent); !psCurrent.isAttributeValueSupported(or, docFlavor, asCurrent)) {
if (values instanceof OrientationRequested[]) { or = null;
OrientationRequested[] orValues = Object values =
(OrientationRequested[])values; psCurrent.getSupportedAttributeValues(orCategory,
if (orValues.length > 1) { docFlavor,
// get the first in the list asCurrent);
or = orValues[0]; if (values instanceof OrientationRequested[]) {
} OrientationRequested[] orValues =
(OrientationRequested[])values;
if (orValues.length > 1) {
// get the first in the list
or = orValues[0];
} }
} }
if (or == null) {
or = OrientationRequested.PORTRAIT;
}
asCurrent.add(or);
} }
if (or == OrientationRequested.PORTRAIT) { if (or == null) {
rbPortrait.setSelected(true); or = OrientationRequested.PORTRAIT;
} else if (or == OrientationRequested.LANDSCAPE) {
rbLandscape.setSelected(true);
} else if (or == OrientationRequested.REVERSE_PORTRAIT) {
rbRevPortrait.setSelected(true);
} else { // if (or == OrientationRequested.REVERSE_LANDSCAPE)
rbRevLandscape.setSelected(true);
} }
} else { asCurrent.add(or);
rbPortrait.setEnabled(pSupported); }
rbLandscape.setEnabled(lSupported);
rbRevPortrait.setEnabled(rpSupported);
rbRevLandscape.setEnabled(rlSupported);
if (or == OrientationRequested.PORTRAIT) {
rbPortrait.setSelected(true);
} else if (or == OrientationRequested.LANDSCAPE) {
rbLandscape.setSelected(true);
} else if (or == OrientationRequested.REVERSE_PORTRAIT) {
rbRevPortrait.setSelected(true);
} else { // if (or == OrientationRequested.REVERSE_LANDSCAPE)
rbRevLandscape.setSelected(true);
} }
} }
} }