mirror of
https://github.com/eMoflon/emoflon-ibex-ui.git
synced 2024-06-02 18:32:05 +00:00
Merge branch 'victory_ui' into victory_ui_issue_144
This commit is contained in:
commit
0ad445c141
|
@ -10,36 +10,36 @@ import org.emoflon.ibex.tgg.ui.debug.views.MatchListView;
|
|||
|
||||
public class UIController extends IbexController {
|
||||
|
||||
private MatchListView matchListView; // TODO convert to interface
|
||||
private List<IVictoryDataConsumer> dataConsumers;
|
||||
private MatchListView matchListView; // TODO convert to interface
|
||||
private List<IVictoryDataConsumer> dataConsumers;
|
||||
|
||||
public UIController(MatchListView pMatchListView, IVictoryDataConsumer... pDataConsumers) {
|
||||
dataConsumers = Arrays.asList(pDataConsumers);
|
||||
matchListView = pMatchListView;
|
||||
}
|
||||
public UIController(MatchListView pMatchListView, IVictoryDataConsumer... pDataConsumers) {
|
||||
dataConsumers = Arrays.asList(pDataConsumers);
|
||||
matchListView = pMatchListView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ObservableEvent eventType, Object... additionalInformation) {
|
||||
// CONCURRENCY: Ibex thread only
|
||||
@Override
|
||||
public void update(ObservableEvent eventType, Object... additionalInformation) {
|
||||
// CONCURRENCY: Ibex thread only
|
||||
|
||||
// TODO implement
|
||||
}
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMatch chooseOneMatch(VictoryDataPackage pDataPackage) {
|
||||
// CONCURRENCY: Ibex thread only
|
||||
@Override
|
||||
public IMatch chooseOneMatch(VictoryDataPackage pDataPackage) {
|
||||
// CONCURRENCY: Ibex thread only
|
||||
|
||||
IbexDebugUI.getDisplay().syncExec(() -> dataConsumers.forEach(consumer -> consumer.accept(pDataPackage)));
|
||||
IbexDebugUI.getDisplay().syncExec(() -> matchListView.populate(pDataPackage.getMatches()));
|
||||
IbexDebugUI.getDisplay().syncExec(() -> dataConsumers.forEach(consumer -> consumer.accept(pDataPackage)));
|
||||
IbexDebugUI.getDisplay().syncExec(() -> matchListView.populate(pDataPackage.getMatches()));
|
||||
|
||||
return matchListView.getChosenMatch();
|
||||
}
|
||||
return matchListView.getChosenMatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRequestedMatchCount() {
|
||||
@Override
|
||||
protected int getRequestedMatchCount() {
|
||||
|
||||
// TODO implement actual user-specified setting
|
||||
// TODO implement actual user-specified setting
|
||||
|
||||
return 100;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package org.emoflon.ibex.tgg.ui.debug.options;
|
||||
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.UserOptionsManager.VisualizationLabelOptions;
|
||||
|
||||
public interface IUserOptions {
|
||||
|
||||
public boolean displayFullRuleForMatches();
|
||||
|
||||
public IBeXOp getOp();
|
||||
|
||||
/**
|
||||
* @return the visualization option for correspondence labels
|
||||
*/
|
||||
public VisualizationLabelOptions getCorrLabelVisualization();
|
||||
}
|
||||
|
|
|
@ -2,35 +2,59 @@ package org.emoflon.ibex.tgg.ui.debug.options;
|
|||
|
||||
public class UserOptionsManager implements IUserOptions {
|
||||
|
||||
private boolean isInvalid = false;
|
||||
private boolean isInvalid = false;
|
||||
|
||||
private boolean displayFullRuleForMatches = false;
|
||||
private final IBeXOp op;
|
||||
private boolean displayFullRuleForMatches = false;
|
||||
private final IBeXOp op;
|
||||
|
||||
public UserOptionsManager(IBeXOp pOp) {
|
||||
op = pOp;
|
||||
}
|
||||
private VisualizationLabelOptions corrLabelVisualization = VisualizationLabelOptions.NONE;
|
||||
|
||||
public boolean displayFullRuleForMatches() {
|
||||
return displayFullRuleForMatches;
|
||||
}
|
||||
|
||||
public IBeXOp getOp() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public void setDisplayFullRuleForMatches(boolean pDisplayFullRuleForMatches) {
|
||||
if (displayFullRuleForMatches != pDisplayFullRuleForMatches) {
|
||||
displayFullRuleForMatches = pDisplayFullRuleForMatches;
|
||||
isInvalid = true;
|
||||
public UserOptionsManager(IBeXOp pOp) {
|
||||
op = pOp;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInvalid() {
|
||||
return isInvalid;
|
||||
}
|
||||
public boolean displayFullRuleForMatches() {
|
||||
return displayFullRuleForMatches;
|
||||
}
|
||||
|
||||
public void revalidate() {
|
||||
isInvalid = false;
|
||||
}
|
||||
public IBeXOp getOp() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public void setDisplayFullRuleForMatches(boolean pDisplayFullRuleForMatches) {
|
||||
if (displayFullRuleForMatches != pDisplayFullRuleForMatches) {
|
||||
displayFullRuleForMatches = pDisplayFullRuleForMatches;
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInvalid() {
|
||||
return isInvalid;
|
||||
}
|
||||
|
||||
public void revalidate() {
|
||||
isInvalid = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the visualization option for correspondence labels
|
||||
*/
|
||||
public VisualizationLabelOptions getCorrLabelVisualization() {
|
||||
return corrLabelVisualization;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param corrLabelVisualization the visualization option for correspondence
|
||||
* labels
|
||||
*/
|
||||
public void setCorrLabelVisualization(VisualizationLabelOptions corrLabelVisualization) {
|
||||
if (this.corrLabelVisualization != corrLabelVisualization) {
|
||||
this.corrLabelVisualization = corrLabelVisualization;
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
|
||||
public enum VisualizationLabelOptions {
|
||||
FULLNAME, ABBREVIATED, NONE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,15 +13,24 @@ import org.eclipse.emf.ecore.EObject
|
|||
import org.emoflon.ibex.tgg.ui.debug.options.IUserOptions
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.IBeXOp
|
||||
import org.emoflon.ibex.tgg.operational.monitoring.data.TGGObjectGraph
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.UserOptionsManager.VisualizationLabelOptions
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
||||
class VictoryPlantUMLGenerator {
|
||||
|
||||
static val createColor = "SpringGreen"
|
||||
static val contextColor = "Black"
|
||||
static val translateColor = "LightSlateGray"
|
||||
static val srcColor = "LightYellow"
|
||||
static val trgColor = "MistyRose"
|
||||
static val corrColor = "LightCyan"
|
||||
|
||||
def static String visualiseTGGRule(TGGRule rule, IUserOptions userOptions) {
|
||||
'''
|
||||
@startuml
|
||||
«plantUMLPreamble»
|
||||
|
||||
«visualiseRule(rule, false, true, userOptions.op)»
|
||||
«visualiseRule(rule, false, true, userOptions.op, userOptions.corrLabelVisualization)»
|
||||
|
||||
@enduml
|
||||
'''
|
||||
|
@ -46,9 +55,9 @@ class VictoryPlantUMLGenerator {
|
|||
@startuml
|
||||
«plantUMLPreamble»
|
||||
|
||||
«visualiseRule(rule, true, userOptions.displayFullRuleForMatches, userOptions.op)»
|
||||
«visualiseRule(rule, true, userOptions.displayFullRuleForMatches, userOptions.op, userOptions.corrLabelVisualization)»
|
||||
|
||||
«visualiseEObjectGraph(mapEObjects(srcParamToEObjectMap.values), mapEObjects(trgParamToEObjectMap.values), corrEdges)»
|
||||
«visualiseEObjectGraph(mapEObjects(srcParamToEObjectMap.values), mapEObjects(trgParamToEObjectMap.values), corrEdges, userOptions.corrLabelVisualization)»
|
||||
|
||||
«FOR String param : nonCorrParamToEObjectMap.keySet»
|
||||
«paramToNodeIdMap.get(param)» #.[#Blue]..# «nonCorrEObjectMapping.get(nonCorrParamToEObjectMap.get(param)).key»
|
||||
|
@ -58,7 +67,7 @@ class VictoryPlantUMLGenerator {
|
|||
'''
|
||||
}
|
||||
|
||||
def static String visualiseObjectGraph(TGGObjectGraph eObjects) {
|
||||
def static String visualiseObjectGraph(TGGObjectGraph eObjects, VisualizationLabelOptions corrLabelVisualizationOption) {
|
||||
'''
|
||||
@startuml
|
||||
«plantUMLPreamble»
|
||||
|
@ -70,7 +79,7 @@ class VictoryPlantUMLGenerator {
|
|||
(it.eGet(it.eClass.getEStructuralFeature("source")) as EObject
|
||||
-> it.eGet(it.eClass.getEStructuralFeature("target")) as EObject)
|
||||
-> it.eClass.name
|
||||
])»
|
||||
], corrLabelVisualizationOption)»
|
||||
|
||||
@enduml
|
||||
'''
|
||||
|
@ -85,26 +94,26 @@ class VictoryPlantUMLGenerator {
|
|||
skinparam shadowing false
|
||||
|
||||
skinparam class {
|
||||
BorderColor<<CREATE>> SpringGreen
|
||||
BorderColor<<TRANSLATE>> Gold
|
||||
BorderColor<<OTHER>> Black
|
||||
BackgroundColor<<TRG>> MistyRose
|
||||
BackgroundColor<<SRC>> LightYellow
|
||||
BackgroundColor<<CORR>> LightCyan
|
||||
ArrowColor Black
|
||||
BorderColor<<CREATE>> «createColor»
|
||||
BorderColor<<TRANSLATE>> «translateColor»
|
||||
BorderColor<<OTHER>> «contextColor»
|
||||
BackgroundColor<<TRG>> «trgColor»
|
||||
BackgroundColor<<SRC>> «srcColor»
|
||||
BackgroundColor<<CORR>> «corrColor»
|
||||
ArrowColor «contextColor»
|
||||
}
|
||||
|
||||
skinparam object {
|
||||
BorderColor Black
|
||||
BackgroundColor<<TRG>> MistyRose
|
||||
BackgroundColor<<SRC>> LightYellow
|
||||
BackgroundColor<<CORR>> LightCyan
|
||||
ArrowColor Black
|
||||
BorderColor «contextColor»
|
||||
BackgroundColor<<TRG>> «trgColor»
|
||||
BackgroundColor<<SRC>> «srcColor»
|
||||
BackgroundColor<<CORR>> «corrColor»
|
||||
ArrowColor «contextColor»
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
private def static String visualiseRule(TGGRule rule, boolean groupFullRule, boolean showCreated, IBeXOp op) {
|
||||
private def static String visualiseRule(TGGRule rule, boolean groupFullRule, boolean showCreated, IBeXOp op, VisualizationLabelOptions corrLabelVisualizationOption) {
|
||||
|
||||
val nodeGroupMap = rule.nodes.groupBy[it.domainType]
|
||||
val nodeIdMap = rule.nodes.toInvertedMap[idForNode]
|
||||
|
@ -136,14 +145,14 @@ class VictoryPlantUMLGenerator {
|
|||
«FOR node : nodeGroupMap.get(DomainType.CORR)»
|
||||
«val corrNode = node as TGGRuleCorr»
|
||||
«IF showCreated || corrNode.bindingType !== BindingType.CREATE»
|
||||
«visualiseRuleCorrEdge(nodeIdMap.get(corrNode.source), nodeIdMap.get(corrNode.target), corrNode.type.name, corrNode.bindingType === BindingType.CREATE)»
|
||||
«visualiseRuleCorrEdge(nodeIdMap.get(corrNode.source), nodeIdMap.get(corrNode.target), corrNode.type.name, corrNode.bindingType === BindingType.CREATE, corrLabelVisualizationOption)»
|
||||
«ENDIF»
|
||||
«ENDFOR»
|
||||
«ENDIF»
|
||||
|
||||
«FOR edge : rule.edges»
|
||||
«IF edge.domainType !== DomainType.CORR && (showCreated || edge.bindingType !== BindingType.CREATE)»
|
||||
«visualiseRuleEdge(nodeIdMap.get(edge.srcNode), nodeIdMap.get(edge.trgNode), edge.type.name, edge.bindingType === BindingType.CREATE)»
|
||||
«visualiseRuleEdge(nodeIdMap.get(edge.srcNode), nodeIdMap.get(edge.trgNode), edge.type.name, getColorDefinitionsForEdge(edge.bindingType, edge.domainType, op))»
|
||||
«ENDIF»
|
||||
«ENDFOR»
|
||||
|
||||
|
@ -151,7 +160,7 @@ class VictoryPlantUMLGenerator {
|
|||
'''
|
||||
}
|
||||
|
||||
private def static String visualiseEObjectGraph(Map<EObject, Pair<String, String>> srcObjectMapping, Map<EObject, Pair<String, String>> trgObjectMapping, Iterable<Pair<Pair<EObject, EObject>, String>> corrEdges) {
|
||||
private def static String visualiseEObjectGraph(Map<EObject, Pair<String, String>> srcObjectMapping, Map<EObject, Pair<String, String>> trgObjectMapping, Iterable<Pair<Pair<EObject, EObject>, String>> corrEdges, VisualizationLabelOptions corrLabelVisualizationOption) {
|
||||
'''
|
||||
together {
|
||||
«visualiseEObjectGroup(srcObjectMapping, "<<SRC>>")»
|
||||
|
@ -159,7 +168,7 @@ class VictoryPlantUMLGenerator {
|
|||
|
||||
«IF corrEdges !== null»
|
||||
«FOR edge : corrEdges»
|
||||
«srcObjectMapping.get(edge.key.key).key» ... «trgObjectMapping.get(edge.key.value).key» : «edge.value»
|
||||
«srcObjectMapping.get(edge.key.key).key» ... «trgObjectMapping.get(edge.key.value).key» «getLabel(edge.value, corrLabelVisualizationOption)»
|
||||
«ENDFOR»
|
||||
«ENDIF»
|
||||
}
|
||||
|
@ -218,18 +227,38 @@ class VictoryPlantUMLGenerator {
|
|||
'''class «ruleId» «colorDefinitions»'''
|
||||
}
|
||||
|
||||
private def static String visualiseRuleEdge(String srcNodeId, String trgNodeId, String edgeId, boolean bindingTypeCreate) {
|
||||
'''«srcNodeId» -«IF (bindingTypeCreate)»[#SpringGreen]«ENDIF»-> «trgNodeId» : "«edgeId»"'''
|
||||
private def static String visualiseRuleEdge(String srcNodeId, String trgNodeId, String edgeId, String colorDefinitions) {
|
||||
|
||||
'''«srcNodeId» -«colorDefinitions»-> «trgNodeId» : "«edgeId»"'''
|
||||
}
|
||||
|
||||
private def static String visualiseRuleCorrEdge(String srcNodeId, String trgNodeId, String edgeId, boolean bindingTypeCreate) {
|
||||
'''«srcNodeId» ...«IF (bindingTypeCreate)»[#SpringGreen]«ENDIF» «trgNodeId» : "«edgeId»"'''
|
||||
private def static String visualiseRuleCorrEdge(String srcNodeId, String trgNodeId, String edgeId, boolean bindingTypeCreate, VisualizationLabelOptions corrLabelVisualizationOption) {
|
||||
'''«srcNodeId» ...«IF (bindingTypeCreate)»[#«createColor»]«ENDIF» «trgNodeId» «getLabel(edgeId, corrLabelVisualizationOption)»'''
|
||||
}
|
||||
|
||||
private def static String idForNode(TGGRuleNode node) {
|
||||
'''"«node.name» : «node.type.name»"'''
|
||||
}
|
||||
|
||||
private def static String getColorDefinitionsForEdge(BindingType binding, DomainType domain, IBeXOp op) {
|
||||
var bindingColor = contextColor
|
||||
if(binding === BindingType.CREATE)
|
||||
if((op === IBeXOp.INITIAL_FWD && domain === DomainType.SRC)
|
||||
|| (op === IBeXOp.INITIAL_BWD && domain === DomainType.TRG))
|
||||
bindingColor = translateColor
|
||||
else
|
||||
bindingColor = createColor
|
||||
'''[#«bindingColor»]'''
|
||||
}
|
||||
|
||||
private def static String getLabel(String name, VisualizationLabelOptions labelOptions) {
|
||||
switch(labelOptions) {
|
||||
case FULLNAME: ''': "«name»"'''
|
||||
case ABBREVIATED : ''': "«StringUtils.abbreviateMiddle(name, "...", 10)»"'''
|
||||
case NONE: ''
|
||||
}
|
||||
}
|
||||
|
||||
private def static String getColorDefinitions(BindingType binding, DomainType domain, IBeXOp op) {
|
||||
|
||||
var bindingColour = "OTHER"
|
||||
|
|
|
@ -3,16 +3,18 @@ package org.emoflon.ibex.tgg.ui.debug.views;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
@ -20,6 +22,7 @@ import org.emoflon.ibex.tgg.operational.matches.IMatch;
|
|||
import org.emoflon.ibex.tgg.operational.monitoring.IVictoryDataProvider;
|
||||
import org.emoflon.ibex.tgg.operational.monitoring.data.TGGObjectGraph;
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.UserOptionsManager;
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.UserOptionsManager.VisualizationLabelOptions;
|
||||
import org.emoflon.ibex.tgg.ui.debug.views.visualisable.IMatchVisualisation;
|
||||
import org.emoflon.ibex.tgg.ui.debug.views.visualisable.ObjectGraphVisualisation;
|
||||
import org.emoflon.ibex.tgg.ui.debug.views.visualisable.TGGRuleVisualisation;
|
||||
|
@ -29,140 +32,185 @@ import language.TGGRule;
|
|||
|
||||
public class MatchDisplayView extends Composite implements IVisualiser {
|
||||
|
||||
private IVictoryDataProvider dataProvider;
|
||||
private UserOptionsManager userOptionsManager;
|
||||
private IVictoryDataProvider dataProvider;
|
||||
private UserOptionsManager userOptionsManager;
|
||||
|
||||
private ScrolledComposite imageScroller;
|
||||
private Label imageContainer;
|
||||
private ScrolledComposite imageScroller;
|
||||
private Label imageContainer;
|
||||
|
||||
private MatchDisplayView(Composite parent, IVictoryDataProvider pDataProvider,
|
||||
UserOptionsManager pUserOptionsManager) {
|
||||
super(parent, SWT.NONE);
|
||||
private MatchDisplayView(Composite parent, IVictoryDataProvider pDataProvider,
|
||||
UserOptionsManager pUserOptionsManager) {
|
||||
super(parent, SWT.NONE);
|
||||
|
||||
dataProvider = pDataProvider;
|
||||
userOptionsManager = pUserOptionsManager;
|
||||
}
|
||||
dataProvider = pDataProvider;
|
||||
userOptionsManager = pUserOptionsManager;
|
||||
}
|
||||
|
||||
private MatchDisplayView build() {
|
||||
setLayout(new GridLayout());
|
||||
private MatchDisplayView build() {
|
||||
setLayout(new GridLayout());
|
||||
|
||||
imageScroller = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
imageScroller.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
imageScroller.setExpandHorizontal(true);
|
||||
imageScroller.setExpandVertical(true);
|
||||
imageScroller.setAlwaysShowScrollBars(true);
|
||||
imageScroller = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
imageScroller.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
imageScroller.setExpandHorizontal(true);
|
||||
imageScroller.setExpandVertical(true);
|
||||
imageScroller.setAlwaysShowScrollBars(true);
|
||||
|
||||
imageContainer = new Label(imageScroller, SWT.BORDER | SWT.CENTER);
|
||||
imageContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
|
||||
imageContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
imageContainer.setImage(null);
|
||||
imageContainer.pack();
|
||||
imageContainer = new Label(imageScroller, SWT.BORDER | SWT.CENTER);
|
||||
imageContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
|
||||
imageContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
imageContainer.setImage(null);
|
||||
imageContainer.pack();
|
||||
|
||||
imageScroller.setContent(imageContainer);
|
||||
imageScroller.setContent(imageContainer);
|
||||
|
||||
Composite buttonRow = new Composite(this, SWT.NONE);
|
||||
buttonRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
buttonRow.setLayout(new GridLayout(3, false));
|
||||
Composite buttonRow = new Composite(this, SWT.NONE);
|
||||
buttonRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
buttonRow.setLayout(new GridLayout(4, false));
|
||||
|
||||
Button toggleFullRuleVisButton = new Button(buttonRow, SWT.TOGGLE);
|
||||
toggleFullRuleVisButton.setText("Full Vis");
|
||||
toggleFullRuleVisButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
|
||||
toggleFullRuleVisButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
userOptionsManager.setDisplayFullRuleForMatches(toggleFullRuleVisButton.getSelection());
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
Button toggleFullRuleVisButton = new Button(buttonRow, SWT.TOGGLE);
|
||||
toggleFullRuleVisButton.setText("Full Vis");
|
||||
toggleFullRuleVisButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||
toggleFullRuleVisButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
userOptionsManager.setDisplayFullRuleForMatches(toggleFullRuleVisButton.getSelection());
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
|
||||
Button saveModelsButton = new Button(buttonRow, SWT.PUSH);
|
||||
saveModelsButton.setText("Save Models");
|
||||
saveModelsButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
|
||||
saveModelsButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
try {
|
||||
dataProvider.saveModels();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Save Models has a problem.");
|
||||
Combo selectCorrVisualizationComboBox = new Combo(buttonRow, SWT.READ_ONLY);
|
||||
toggleFullRuleVisButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
|
||||
final String[] corrVisualizationOptions = new String[] { "Show Corr Labels", "Show abbreviated Corr Labels",
|
||||
"Hide Corr Labels" };
|
||||
for (String option : corrVisualizationOptions) {
|
||||
selectCorrVisualizationComboBox.add(option);
|
||||
}
|
||||
}
|
||||
});
|
||||
switch (userOptionsManager.getCorrLabelVisualization()) {
|
||||
case FULLNAME:
|
||||
selectCorrVisualizationComboBox.select(0);
|
||||
case ABBREVIATED:
|
||||
selectCorrVisualizationComboBox.select(1);
|
||||
case NONE:
|
||||
selectCorrVisualizationComboBox.select(2);
|
||||
}
|
||||
selectCorrVisualizationComboBox.select(2);
|
||||
selectCorrVisualizationComboBox.addSelectionListener(new SelectionListener() {
|
||||
|
||||
Button terminateButton = new Button(buttonRow, SWT.PUSH);
|
||||
terminateButton.setText("Quit Debugger");
|
||||
terminateButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
|
||||
terminateButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
private VisualizationLabelOptions getSelectedVisualization(String selectedVisualization) {
|
||||
if (selectedVisualization.equals(corrVisualizationOptions[0])) {
|
||||
return VisualizationLabelOptions.FULLNAME;
|
||||
} else if (selectedVisualization.equals(corrVisualizationOptions[1])) {
|
||||
return VisualizationLabelOptions.ABBREVIATED;
|
||||
} else if (selectedVisualization.equals(corrVisualizationOptions[2])) {
|
||||
return VisualizationLabelOptions.NONE;
|
||||
} else {
|
||||
throw new RuntimeException("Unknown visualization option: " + selectedVisualization);
|
||||
}
|
||||
}
|
||||
|
||||
pack();
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
userOptionsManager
|
||||
.setCorrLabelVisualization(getSelectedVisualization(selectCorrVisualizationComboBox.getText()));
|
||||
refresh();
|
||||
}
|
||||
|
||||
public static MatchDisplayView create(Composite pParent, IVictoryDataProvider pDataProvider,
|
||||
UserOptionsManager pUserOptionsManager) {
|
||||
return new MatchDisplayView(pParent, pDataProvider, pUserOptionsManager).build();
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
userOptionsManager
|
||||
.setCorrLabelVisualization(getSelectedVisualization(selectCorrVisualizationComboBox.getText()));
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* display specific code
|
||||
*/
|
||||
Button saveModelsButton = new Button(buttonRow, SWT.PUSH);
|
||||
saveModelsButton.setText("Save Models");
|
||||
saveModelsButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
|
||||
saveModelsButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
try {
|
||||
dataProvider.saveModels();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Save Models has a problem.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private Map<TGGRule, VisualisableElement> ruleElementMap = new HashMap<>();
|
||||
private Map<IMatch, VisualisableElement> matchElementMap = new HashMap<>();
|
||||
Button terminateButton = new Button(buttonRow, SWT.PUSH);
|
||||
terminateButton.setText("Quit Debugger");
|
||||
terminateButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
|
||||
terminateButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent pSelectionEvent) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
private VisualisableElement currentElement;
|
||||
|
||||
@Override
|
||||
public void display(TGGRule pRule) {
|
||||
|
||||
if (!ruleElementMap.containsKey(pRule)) {
|
||||
VisualisableElement ruleElement = new TGGRuleVisualisation(pRule, userOptionsManager);
|
||||
ruleElementMap.put(pRule, ruleElement);
|
||||
pack();
|
||||
return this;
|
||||
}
|
||||
|
||||
currentElement = ruleElementMap.get(pRule);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(IMatch pMatch) {
|
||||
|
||||
if (!matchElementMap.containsKey(pMatch)) {
|
||||
VisualisableElement matchElement = new IMatchVisualisation(pMatch, dataProvider, userOptionsManager);
|
||||
matchElementMap.put(pMatch, matchElement);
|
||||
public static MatchDisplayView create(Composite pParent, IVictoryDataProvider pDataProvider,
|
||||
UserOptionsManager pUserOptionsManager) {
|
||||
return new MatchDisplayView(pParent, pDataProvider, pUserOptionsManager).build();
|
||||
}
|
||||
|
||||
currentElement = matchElementMap.get(pMatch);
|
||||
/*
|
||||
* display specific code
|
||||
*/
|
||||
|
||||
refresh();
|
||||
}
|
||||
private Map<TGGRule, VisualisableElement> ruleElementMap = new HashMap<>();
|
||||
private Map<IMatch, VisualisableElement> matchElementMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void display(TGGObjectGraph pObjectGraph) {
|
||||
currentElement = new ObjectGraphVisualisation(pObjectGraph);
|
||||
refresh();
|
||||
}
|
||||
private VisualisableElement currentElement;
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
if (userOptionsManager.isInvalid()) {
|
||||
ruleElementMap.values().forEach(VisualisableElement::invalidate);
|
||||
matchElementMap.values().forEach(VisualisableElement::invalidate);
|
||||
userOptionsManager.revalidate();
|
||||
@Override
|
||||
public void display(TGGRule pRule) {
|
||||
|
||||
if (!ruleElementMap.containsKey(pRule)) {
|
||||
VisualisableElement ruleElement = new TGGRuleVisualisation(pRule, userOptionsManager);
|
||||
ruleElementMap.put(pRule, ruleElement);
|
||||
}
|
||||
|
||||
currentElement = ruleElementMap.get(pRule);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
displayImage(currentElement.getImage());
|
||||
}
|
||||
@Override
|
||||
public void display(IMatch pMatch) {
|
||||
|
||||
private void displayImage(byte[] pImageData) {
|
||||
Image image = new Image(Display.getCurrent(), new ByteArrayInputStream(pImageData));
|
||||
imageScroller.setMinSize(image.getBounds().width, image.getBounds().height);
|
||||
imageContainer.setImage(image);
|
||||
}
|
||||
if (!matchElementMap.containsKey(pMatch)) {
|
||||
VisualisableElement matchElement = new IMatchVisualisation(pMatch, dataProvider, userOptionsManager);
|
||||
matchElementMap.put(pMatch, matchElement);
|
||||
}
|
||||
|
||||
currentElement = matchElementMap.get(pMatch);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(TGGObjectGraph pObjectGraph) {
|
||||
currentElement = new ObjectGraphVisualisation(pObjectGraph);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
if (userOptionsManager.isInvalid()) {
|
||||
ruleElementMap.values().forEach(VisualisableElement::invalidate);
|
||||
matchElementMap.values().forEach(VisualisableElement::invalidate);
|
||||
userOptionsManager.revalidate();
|
||||
}
|
||||
|
||||
displayImage(currentElement.getImage());
|
||||
}
|
||||
|
||||
private void displayImage(byte[] pImageData) {
|
||||
Image image = new Image(Display.getCurrent(), new ByteArrayInputStream(pImageData));
|
||||
imageScroller.setMinSize(image.getBounds().width, image.getBounds().height);
|
||||
imageContainer.setImage(image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package org.emoflon.ibex.tgg.ui.debug.views.visualisable;
|
||||
|
||||
import org.emoflon.ibex.tgg.operational.monitoring.data.TGGObjectGraph;
|
||||
import org.emoflon.ibex.tgg.ui.debug.options.UserOptionsManager.VisualizationLabelOptions;
|
||||
import org.emoflon.ibex.tgg.ui.debug.plantuml.VictoryPlantUMLGenerator;
|
||||
|
||||
public class ObjectGraphVisualisation extends VisualisableElement {
|
||||
|
||||
private TGGObjectGraph objectGraph;
|
||||
private TGGObjectGraph objectGraph;
|
||||
|
||||
public ObjectGraphVisualisation(TGGObjectGraph pObjectGraph) {
|
||||
objectGraph = pObjectGraph;
|
||||
}
|
||||
public ObjectGraphVisualisation(TGGObjectGraph pObjectGraph) {
|
||||
objectGraph = pObjectGraph;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String generateVisualisationString() {
|
||||
return VictoryPlantUMLGenerator.visualiseObjectGraph(objectGraph);
|
||||
}
|
||||
@Override
|
||||
protected String generateVisualisationString() {
|
||||
return VictoryPlantUMLGenerator.visualiseObjectGraph(objectGraph, VisualizationLabelOptions.NONE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue