&& attrs.containsKey(MediaPrintableArea.class)
&& attrs.get(Media.class).equals(selectedMedia)
&& isMediaSizeSelected) {
/* p.1 - see fillMarginsFields() comments above*/
try {
MediaPrintableArea attrsPA = (MediaPrintableArea)
attrs.get(MediaPrintableArea.class);
margins = new MediaMargins(selectedSize, attrsPA);
} catch(IllegalArgumentException e) {
/*
* If we are unable to get correct margins values from the
* given MediaPrintableArea (attrsPA) and MediaSize
* (selectedSize), we just ignore this case
*/
}
}
if ((margins == null)
&& (isMarginsSupported || (dialogType == PAGE_DIALOG))) {
/* p.2 - see fillMarginsFields() comments above*/
margins = (MediaMargins) (attrs.containsKey(MediaMargins.class)
? attrs.get(MediaMargins.class)
: myService.getDefaultAttributeValue(MediaMargins.class));
}
if ((margins == null)
&& isPaSupported
&& isMediaSupported
&& isMediaSizeSelected) {
/* p.3 - see fillMarginsFields() comments above*/
try {
MediaPrintableArea defaultPA = (MediaPrintableArea)
myService.getDefaultAttributeValue(
MediaPrintableArea.class);
if ((defaultPA != null) && (selectedSize != null)) {
margins = new MediaMargins(selectedSize, defaultPA);
}