void notifyAttrListeners(final PrintJobAttribute... attrs) { final PrintJobAttributeSet attrSet = new HashPrintJobAttributeSet(attrs); final PrintJobAttributeEvent event = new PrintJobAttributeEvent(this, attrSet); for (PrintJobAttribute attr : attrs) { final Class<? extends Attribute> cat = attr.getCategory(); for (Map.Entry<PrintJobAttributeListener, PrintJobAttributeSet> e : attrListeners .entrySet()) { if ((e.getValue() == null) || (e.getValue().containsKey(cat))) { e.getKey().attributeUpdate(event); } } } }
public PrintJobAttributeSet getAttributes() { synchronized (this) { if (jobAttrSet == null) { /* just return an empty set until the job is submitted */ PrintJobAttributeSet jobSet = new HashPrintJobAttributeSet(); return AttributeSetUtilities.unmodifiableView(jobSet); } else { return jobAttrSet; } } }
@Override public PrintJobAttributeSet getAttributes(){ synchronized(this){ if(jobAttrSet == null){ /* just return an empty set until the job is submitted */ PrintJobAttributeSet jobSet = new HashPrintJobAttributeSet(); return AttributeSetUtilities.unmodifiableView(jobSet); }else{ return jobAttrSet; } } }
/** * Constructs a <code>PrintJobAttributeEvent</code> object. * * @param source the source of this event * @param attributes the attribute changes being reported */ public PrintJobAttributeEvent(DocPrintJob source, PrintJobAttributeSet attributes) { super(source); this.attributes = attributes; }
/** * @see DocPrintJob#addPrintJobAttributeListener(PrintJobAttributeListener, PrintJobAttributeSet) */ public void addPrintJobAttributeListener(PrintJobAttributeListener listener, PrintJobAttributeSet attributes) { if (listener == null) return; attributesListener.add(listener); attributesListenerAttributes.add(attributes); }