Example #1
0
 public void attributeUpdate(PrintServiceAttributeEvent e) {
   System.out.println("In attributeUpdate method");
   System.out.println("PS IS  " + e.getPrintService());
   PrintServiceAttributeSet psas = e.getAttributes();
   Attribute[] nattr = psas.toArray();
   System.out.println("New Attributes set:" + nattr.length);
   for (int i = 0; i < nattr.length; i++) {
     System.out.println("Printer is " + nattr[i]);
   }
 }
 boolean matchingService(PrintService service, PrintServiceAttributeSet serviceSet) {
   if (serviceSet != null) {
     Attribute[] attrs = serviceSet.toArray();
     Attribute serviceAttr;
     for (int i = 0; i < attrs.length; i++) {
       serviceAttr = service.getAttribute(attrs[i].getCategory());
       if (serviceAttr == null || !serviceAttr.equals(attrs[i])) {
         return false;
       }
     }
   }
   return true;
 }