public void removeListener(PrintService service, PrintServiceAttributeListener listener) { if (service == null || listener == null) { return; } if (services.contains(service)) { ArrayList serviceListeners = (ArrayList)listeners.get(service); serviceListeners.remove(listener); if (serviceListeners.size() == 0) { listeners.remove(service); attributes.remove(service); services.remove(service); } } if (services.size() == 0) { running = false; } }
void addListener(PrintServiceAttributeListener listener) { synchronized (this) { if (listener == null || listeners == null) { return; } listeners.add(listener); } }
void removeListener(PrintServiceAttributeListener listener) { synchronized (this) { if (listener == null || listeners == null) { return; } listeners.remove(listener); } }
public void addPrintServiceAttributeListener(PrintServiceAttributeListener listener) { synchronized (this) { if (listener == null) { return; } if (notifier == null) { notifier = new ServiceNotifier(this); } notifier.addListener(listener); } }
public void removePrintServiceAttributeListener( PrintServiceAttributeListener listener) { synchronized (this) { if (listener == null || notifier == null ) { return; } notifier.removeListener(listener); if (notifier.isEmpty()) { notifier.stopNotifier(); notifier = null; } } }
public void addPrintServiceAttributeListener( PrintServiceAttributeListener listener) { synchronized (this) { if (listener == null) { return; } if (notifier == null) { notifier = new ServiceNotifier(this); } notifier.addListener(listener); } }
@Override public void addPrintServiceAttributeListener(PrintServiceAttributeListener listener){ synchronized (this) { if (listener == null) { return; } if (notifier == null) { notifier = new ServiceNotifier(this); } notifier.addListener(listener); } }
@Override public void removePrintServiceAttributeListener(PrintServiceAttributeListener listener){ synchronized (this) { if (listener == null || notifier == null ) { return; } notifier.removeListener(listener); if (notifier.isEmpty()) { notifier.stopNotifier(); notifier = null; } } }