-/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
+/*******************************************************************************
+ * Copyright (c) 2010 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
package org.simantics.databoard.accessor.impl;
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.concurrent.Executor;\r
-\r
-import org.simantics.databoard.accessor.Accessor.Listener;\r
-import org.simantics.databoard.accessor.event.Event;\r
-import org.simantics.databoard.accessor.interestset.InterestSet;\r
-import org.simantics.databoard.accessor.reference.ChildReference;\r
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.Executor;
+
+import org.simantics.databoard.accessor.Accessor.Listener;
+import org.simantics.databoard.accessor.event.Event;
+import org.simantics.databoard.accessor.interestset.InterestSet;
+import org.simantics.databoard.accessor.reference.ChildReference;
/**
* ListenerEntry is a linked list of <Listener, InterestSet> pairs
public Listener listener;
public InterestSet interestSet;
// Path from the listened object
- public ChildReference path;\r
+ public ChildReference path;
public Executor executor;
public ListenerEntry next;
this.listener = listener;
this.interestSet = interestSet;
this.path = path;
- this.executor = executor;\r
+ this.executor = executor;
}
/**
* @param e
*/
public void emitEvent(final Event e) {
-// e.reference = ChildReference.concatenate(path, e.reference);\r
+// e.reference = ChildReference.concatenate(path, e.reference);
+ if (executor == null) {
+ listener.onEvents( Collections.singleton(e) );
+ } else {
+ executor.execute( new Runnable() {
+ public void run() {
+ listener.onEvents( Collections.singleton(e) );
+ }});
+ }
+ }
+
+ public void emitEvents(final Collection<Event> events) {
+// for (Event e : events) {
+// e.reference = ChildReference.concatenate(path, e.reference);
+// }
if (executor == null) {
- listener.onEvents( Collections.singleton(e) );\r
- } else {\r
- executor.execute( new Runnable() {\r
- public void run() {\r
- listener.onEvents( Collections.singleton(e) );\r
- }});\r
+ listener.onEvents( events );
+ } else {
+ executor.execute( new Runnable() {
+ public void run() {
+ listener.onEvents( events );
+ }});
}
}
-\r
- public void emitEvents(final Collection<Event> events) {\r
-// for (Event e : events) {\r
-// e.reference = ChildReference.concatenate(path, e.reference);\r
-// }\r
- if (executor == null) {\r
- listener.onEvents( events );\r
- } else {\r
- executor.execute( new Runnable() {\r
- public void run() {\r
- listener.onEvents( events );\r
- }});\r
- }\r
- }\r
}