1173 } catch (URISyntaxException e) { 1174 return null; 1175 } 1176 } 1177 } else if (category == Sides.class) { 1178 switch(defSides) { 1179 case DMDUP_VERTICAL : 1180 return Sides.TWO_SIDED_LONG_EDGE; 1181 case DMDUP_HORIZONTAL : 1182 return Sides.TWO_SIDED_SHORT_EDGE; 1183 default : 1184 return Sides.ONE_SIDED; 1185 } 1186 } else if (category == PrinterResolution.class) { 1187 int yRes = defYRes; 1188 int xRes = defQuality; 1189 if ((xRes < 0) || (yRes < 0)) { 1190 int res = (yRes > xRes) ? yRes : xRes; 1191 if (res > 0) { 1192 return new PrinterResolution(res, res, PrinterResolution.DPI); 1193 } 1194 } 1195 else { 1196 return new PrinterResolution(xRes, yRes, PrinterResolution.DPI); 1197 } 1198 } else if (category == ColorSupported.class) { 1199 int caps = getPrinterCapabilities(); 1200 if ((caps & DEVCAP_COLOR) != 0) { 1201 return ColorSupported.SUPPORTED; 1202 } else { 1203 return ColorSupported.NOT_SUPPORTED; 1204 } 1205 } else if (category == PrintQuality.class) { 1206 if ((defQuality < 0) && (defQuality >= DMRES_HIGH)) { 1207 switch (defQuality) { 1208 case DMRES_HIGH: 1209 return PrintQuality.HIGH; 1210 case DMRES_MEDIUM: 1211 return PrintQuality.NORMAL; 1212 default: | 1173 } catch (URISyntaxException e) { 1174 return null; 1175 } 1176 } 1177 } else if (category == Sides.class) { 1178 switch(defSides) { 1179 case DMDUP_VERTICAL : 1180 return Sides.TWO_SIDED_LONG_EDGE; 1181 case DMDUP_HORIZONTAL : 1182 return Sides.TWO_SIDED_SHORT_EDGE; 1183 default : 1184 return Sides.ONE_SIDED; 1185 } 1186 } else if (category == PrinterResolution.class) { 1187 int yRes = defYRes; 1188 int xRes = defQuality; 1189 if ((xRes < 0) || (yRes < 0)) { 1190 int res = (yRes > xRes) ? yRes : xRes; 1191 if (res > 0) { 1192 return new PrinterResolution(res, res, PrinterResolution.DPI); 1193 } else { 1194 return new PrinterResolution(300, 300, PrinterResolution.DPI); 1195 } 1196 } 1197 else { 1198 return new PrinterResolution(xRes, yRes, PrinterResolution.DPI); 1199 } 1200 } else if (category == ColorSupported.class) { 1201 int caps = getPrinterCapabilities(); 1202 if ((caps & DEVCAP_COLOR) != 0) { 1203 return ColorSupported.SUPPORTED; 1204 } else { 1205 return ColorSupported.NOT_SUPPORTED; 1206 } 1207 } else if (category == PrintQuality.class) { 1208 if ((defQuality < 0) && (defQuality >= DMRES_HIGH)) { 1209 switch (defQuality) { 1210 case DMRES_HIGH: 1211 return PrintQuality.HIGH; 1212 case DMRES_MEDIUM: 1213 return PrintQuality.NORMAL; 1214 default: |