Commit 4a4635a8 authored by Andreas Bayha's avatar Andreas Bayha

MIRA: Filter and editor-opening for ReqirementsOverview

Added filter bahaviour and opening-behaviour to RequirementsOverview.

Issue-Ref: 3914
Issue-Url: https://af3-developer.fortiss.org/issues/3914Signed-off-by: Andreas Bayha's avatarAndreas Bayha <bayha@fortiss.org>
parent 36f2b100
ModelElementFXEditorUIProviderBase.java 53e2e10449cfa2e93b374fb7959a97a6594f6ec3 YELLOW
RequirementsOverviewFXEditor.java 65ed86d9a34c8964ce51a7c9d3b5a542e021f90a YELLOW
RequirementsOverviewFXEditor.java 1dd6ec50837cd05bb8799466f8738b282b964e95 YELLOW
RequirementsOverviewFXEditorBinding.java c8c5fedf3019b5668b18714f8a4884a94261085a YELLOW
RequirementsOverviewFXEditorContentProvider.java e02006eabb6164eb8569571fc1dca0fb5b7b9841 YELLOW
RequirementsOverviewFXEditorUIProvider.java 714f46e7c7211404f1008ed913518b2346ce0a71 YELLOW
RequirementsOverviewFXEditorContentProvider.java 5a9ed1dc5a6c5722e40074d090c3d6a84b70ed7d YELLOW
RequirementsOverviewFXEditorUIProvider.java 4645800d29ae9d01ebf67ff4a4e63501a4c5ab43 YELLOW
/*-------------------------------------------------------------------------+
| Copyright 2020 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.editor.overview.fx;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
import org.fortiss.tooling.kernel.ui.extension.base.FXEditorBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import javafx.scene.Node;
import javafx.scene.control.ContextMenu;
/**
* Base implementation for FX UIProvider for ModelElements.
*
* @author bayha
*/
public abstract class ModelElementFXEditorUIProviderBase<T extends IModelElement>
extends DynamicTreeTableUIProviderBase<T> {
/** The editor used to post selection changes. */
protected final FXEditorBase<?> editor;
/** Constructor. */
public ModelElementFXEditorUIProviderBase(FXEditorBase<?> editor) {
this.editor = editor;
}
/** {@inheritDoc} */
@Override
public Node getIconNode(IModelElement element, int column) {
if(element == null) {
return null;
}
return IModelElementHandlerService.getInstance().getFXIcon(element);
}
/** {@inheritDoc} */
@Override
public ContextMenu createContextMenu(IModelElement element, int column) {
if(element == null || column != 0) {
return null;
}
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().addAll(createPrototypeMenu(element, null));
return contextMenu;
}
/** {@inheritDoc} */
@Override
public void select(IModelElement oldValue, IModelElement newValue) {
IStructuredSelection selection =
newValue == null ? StructuredSelection.EMPTY : new StructuredSelection(newValue);
editor.getSite().getSelectionProvider().setSelection(selection);
}
}
......@@ -18,13 +18,17 @@ package org.fortiss.af3.mira.ui.editor.overview.fx;
import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.IDoubleClickHandler;
import org.fortiss.tooling.kernel.ui.extension.base.FXEditorBase;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
import org.fortiss.tooling.kernel.utils.KernelServiceBasedModelListenerBase;
import javafx.scene.Parent;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.BorderPane;
/**
......@@ -64,16 +68,30 @@ public class RequirementsOverviewFXEditor<T extends IHierarchicElement> extends
filterWidget.textProperty().addListener((obs, oVal, nVal) -> {
contentProvider.setFilterExpression(nVal);
treeTableViewer.update();
treeTableViewer.expandAllItems();
});
filterWidget.setTooltip(new Tooltip("type filter text"));
filterWidget.setPromptText("type filter text");
treeTableViewer = new DynamicTreeTableViewer<IHierarchicElement>(edited, true, 2,
treeTableViewer = new DynamicTreeTableViewer<IHierarchicElement>(edited, true, 3,
contentProvider, uiProvider);
treeTableViewer.addColumn("Type", 160);
treeTableViewer.addColumn("Status", 160);
treeTableViewer.addColumn("Name", 160);
treeTableViewer.addColumn("Description", 160);
treeTableViewer.addColumn("Description", 280);
treeTableViewer.addColumn("Comment", 250);
treeTableViewer.setDoubleClickHandler(new IDoubleClickHandler() {
@Override
public void doubleClicked(Object value) {
if(value instanceof EObject) {
IModelEditorBindingService.getInstance().openInEditor((EObject)value);
}
}
});
BorderPane pane = new BorderPane();
pane.setTop(filterWidget);
pane.setCenter(treeTableViewer.getControl());
......
......@@ -15,6 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.editor.overview.fx;
import static java.util.stream.Collectors.toList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import java.util.ArrayList;
......@@ -79,6 +80,47 @@ public class RequirementsOverviewFXEditorContentProvider
return result;
}
/** {@inheritDoc} */
@Override
protected boolean filter(IHierarchicElement element, String filterValue) {
if(element == null) {
return false;
}
if(element instanceof Analysis) {
return true;
}
if(element instanceof FXEditorGlossaryEntryContainer) {
List<GlossaryEntry> filteredGlos = ((FXEditorGlossaryEntryContainer)element).entries
.stream().filter(g -> filter(g, filterValue)).collect(toList());
return filteredGlos.size() > 0;
}
if(element instanceof FXEditorRequirementsContainer) {
List<Requirement> filteredReqs = ((FXEditorRequirementsContainer)element).entries
.stream().filter(r -> filter(r, filterValue)).collect(toList());
return filteredReqs.size() > 0;
}
if(element instanceof Requirement) {
Requirement req = (Requirement)element;
String checkStr = req.getName() + req.getDescription() + req.getComment() +
req.getStatus().getName();
return checkStr.toLowerCase().contains(filterValue.toLowerCase());
}
if(element instanceof GlossaryEntry) {
GlossaryEntry ge = (GlossaryEntry)element;
String checkString = ge.getName() + ge.getDefinition() + ge.getStatus().getName();
return checkString.toLowerCase().contains(filterValue.toLowerCase());
}
return false;
}
}
/**
......
......@@ -23,6 +23,7 @@ import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.glossary.GlossaryEntry;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.editor.fx.controller.ModelElementFXEditorUIProviderBase;
import org.fortiss.tooling.kernel.ui.extension.base.FXEditorBase;
import javafx.scene.Node;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment