commit bd03aa5701eb21a285cd91d4257c8b8ac4e772fd
Author: Vít Mazín <n5ver@seznam.cz>
Date:   Wed Jun 5 19:54:56 2019 +0200

    Filter fix (refs #7559)

diff --git a/sources/imiger-core/src/main/webapp/js/components/filterModalWindow.js b/sources/imiger-core/src/main/webapp/js/components/filterModalWindow.js
index 4a05de0..f807f03 100644
--- a/sources/imiger-core/src/main/webapp/js/components/filterModalWindow.js
+++ b/sources/imiger-core/src/main/webapp/js/components/filterModalWindow.js
@@ -415,6 +415,7 @@ class FilterModalWindow extends ModalWindow {
 		});
 		app.deletedVertexList.forEach(vertex => {
 			v.push(vertex);
+			app.viewportComponent.addNode(vertex);
 		});
 		app.deletedEdgeList.forEach(edge => {
 			e.push(edge);
@@ -500,12 +501,23 @@ class FilterModalWindow extends ModalWindow {
 		}
 
 		nodeFilter.run(app.nodeList).forEach(node => {
-			node._rootElement.style.display = 'none';
-			app.edgeList.forEach(edge => {
-				if(edge.from.id === node.id || edge.to.id === node.id) {
-					edge._rootElement.style.display = 'none';
+			if(node instanceof Group) {
+				let outEdges = node.outEdgeList;
+				let inEdges = node.inEdgeList;
+				this._hideEdges(outEdges);
+				this._hideEdges(inEdges);
+				node._rootElement.style.display = 'none';
+			} else {
+				if(node._group === null) {
+					node._rootElement.style.display = 'none';
+					app.edgeList.forEach(edge => {
+						if(edge.from.id === node.id || edge.to.id === node.id) {
+							edge._rootElement.style.display = 'none';
+						}
+					});
 				}
-			});
+			}
+			app.viewportComponent.removeNode(node);
 		});
 
 		var newNodeList = [];
@@ -539,6 +551,12 @@ class FilterModalWindow extends ModalWindow {
 		app.edgeList = newEdgeList;
 	}
 
+	_hideEdges(edges) {
+		edges.forEach(edge => {
+			edge._rootElement.style.display = 'none';
+		});
+	}
+
 	setDateBounds(minDate, maxDate) {
 		if(minDate !== null && maxDate !== null) {
 			this._showSlider = DOM.h('script', {
diff --git a/sources/imiger-core/src/main/webapp/js/services/filters/NodeTypeFilter.js b/sources/imiger-core/src/main/webapp/js/services/filters/NodeTypeFilter.js
index 9394aaf..21d698a 100644
--- a/sources/imiger-core/src/main/webapp/js/services/filters/NodeTypeFilter.js
+++ b/sources/imiger-core/src/main/webapp/js/services/filters/NodeTypeFilter.js
@@ -28,15 +28,15 @@ class NodeTypeFilter extends AbstractFilter {
 		switch (this._operation) {
 			case EnumFilterOperation.EQ:
 				filterFn = node => {
-					return (node instanceof Vertex && filterValues.indexOf(NodeTypeFilter.VERTEX) > -1)
-						|| (node instanceof Group && filterValues.indexOf(NodeTypeFilter.GROUP) > -1);
+					return (node instanceof Vertex && filterValues.indexOf(NodeTypeFilter.VERTEX) < 0)
+						|| (node instanceof Group && filterValues.indexOf(NodeTypeFilter.GROUP) < 0);
 				};
 				break;
 
 			case EnumFilterOperation.NEQ:
 				filterFn = node => {
-					return (node instanceof Vertex && filterValues.indexOf(NodeTypeFilter.VERTEX) < 0)
-						|| (node instanceof Group && filterValues.indexOf(NodeTypeFilter.GROUP) < 0);
+					return (node instanceof Vertex && filterValues.indexOf(NodeTypeFilter.VERTEX) > -1)
+						|| (node instanceof Group && filterValues.indexOf(NodeTypeFilter.GROUP) > -1);
 				};
 				break;
 
diff --git a/sources/imiger-core/src/main/webapp/js/services/filters/VertexArchetypeFilter.js b/sources/imiger-core/src/main/webapp/js/services/filters/VertexArchetypeFilter.js
index b8cad25..e568a02 100644
--- a/sources/imiger-core/src/main/webapp/js/services/filters/VertexArchetypeFilter.js
+++ b/sources/imiger-core/src/main/webapp/js/services/filters/VertexArchetypeFilter.js
@@ -34,13 +34,13 @@ class VertexArchetypeFilter extends AbstractFilter {
 		switch (this._operation) {
 			case EnumFilterOperation.EQ:
 				filterFn = vertex => {
-					return filterValues.indexOf(vertex.archetype) > -1;
+					return filterValues.indexOf(vertex.archetype) < 0;
 				};
 				break;
 
 			case EnumFilterOperation.NEQ:
 				filterFn = vertex => {
-					return filterValues.indexOf(vertex.archetype) < 0;
+					return filterValues.indexOf(vertex.archetype) > -1;
 				};
 				break;
 
diff --git a/sources/imiger-core/src/main/webapp/js/services/filters/VertexAttributeFilter.js b/sources/imiger-core/src/main/webapp/js/services/filters/VertexAttributeFilter.js
index f74736f..489128b 100644
--- a/sources/imiger-core/src/main/webapp/js/services/filters/VertexAttributeFilter.js
+++ b/sources/imiger-core/src/main/webapp/js/services/filters/VertexAttributeFilter.js
@@ -66,27 +66,27 @@ class VertexAttributeFilter extends AbstractFilter {
 		let comparatorFn;
 		switch (operation) {
 			case StringFilterOperation.EQ:
-				comparatorFn = (a, b) => a === b;
+				comparatorFn = (a, b) => a !== b;
 				break;
 
 			case StringFilterOperation.NEQ:
-				comparatorFn = (a, b) => a !== b;
+				comparatorFn = (a, b) => a === b;
 				break;
 
 			case StringFilterOperation.CONTAINS:
-				comparatorFn = (a, b) => a.includes(b);
+				comparatorFn = (a, b) => !(a.includes(b));
 				break;
 
 			case StringFilterOperation.STARTS_WITH:
-				comparatorFn = (a, b) => a.startsWith(b);
+				comparatorFn = (a, b) => !(a.startsWith(b));
 				break;
 
 			case StringFilterOperation.ENDS_WITH:
-				comparatorFn = (a, b) => a.endsWith(b);
+				comparatorFn = (a, b) => !(a.endsWith(b));
 				break;
 
 			case StringFilterOperation.REGEXP:
-				comparatorFn = (a, b) => a.match(new RegExp(b, 'i'));
+				comparatorFn = (a, b) => !(a.match(new RegExp(b, 'i')));
 				break;
 
 			default:
@@ -110,9 +110,14 @@ class VertexAttributeFilter extends AbstractFilter {
 					const attributeValues = attribute[1].split(', ');
 
 					// some (at least one) of the attribute items should be contained in the filters
-					return attributeValues.some(attributeValue => {
-						return filterValues.indexOf(attributeValue) > -1;
-					});
+					 let count = 0;
+					 attributeValues.forEach(value => {
+						if(filterValues.indexOf(value) > -1) {
+							count++;
+						}
+					 });
+
+					 return count === 0;
 				};
 				break;
 
@@ -122,9 +127,14 @@ class VertexAttributeFilter extends AbstractFilter {
 					const attributeValues = attribute[1].split(', ');
 
 					// every of the attribute items should not be contained in the filters (translated: none of the items should be contained in the filters)
-					return attributeValues.every(attributeValue => {
-						return filterValues.indexOf(attributeValue) < 0;
+					let count = 0;
+					attributeValues.forEach(value => {
+						if(filterValues.indexOf(value) > -1) {
+						count++;
+					}
 					});
+
+					return count > 0;
 				};
 				break;
 
@@ -153,11 +163,11 @@ class VertexAttributeFilter extends AbstractFilter {
 
 			let comparatorFn;
 			switch (operation) {
-				case DateFilterOperation.EQ:
+				case DateFilterOperation.NEQ:
 					comparatorFn = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
 					break;
 
-				case DateFilterOperation.NEQ:
+				case DateFilterOperation.EQ:
 					comparatorFn = (a, b) => a.getFullYear() !== b.getFullYear() || a.getMonth() !== b.getMonth() || a.getDate() !== b.getDate();
 					break;
 
