Open leuschel opened 3 years ago
Here is an adapted VisBHover.java file, to inherit the parsing from VisBItem, but much more needs to be done to implement this change.
package de.prob2.ui.visb.visbobjects; import de.prob2.ui.visb.visbobjects.VisBItem; import de.prob.animator.domainobjects.IEvalElement; import de.prob2.ui.visb.exceptions.VisBNestedException; import de.prob.model.classicalb.ClassicalBModel; import de.prob.exception.ProBError; import de.prob.statespace.Trace; import de.prob.animator.domainobjects.EvaluationException; import de.prob.animator.domainobjects.ClassicalB; import de.prob2.ui.prob2fx.CurrentTrace; import de.prob.animator.domainobjects.FormulaExpand; /** * The VisBEvent is designed for the JSON / VisB file */ public class VisBHover extends VisBItem { private String hoverLeaveValue; /* from VisBItem private String id; private String attribute; private String value; // B Formula to compute value of attribute for SVG object id private Boolean optional; // if true then we ignore identifier not found errors and simply disable this item private IEvalElement parsedFormula; // if different from null the formula has already been parsed */ public VisBHover(String hoverID, String hoverAttribute, String hoverEnterValue, String hoverLeaveValue){ super(hoverID,hoverAttribute,hoverEnterValue,false); this.hoverLeaveValue = hoverLeaveValue; } public String getHoverId() { return getId(); } public String getHoverAttr() { return getAttribute(); } public String getHoverEnterVal() { return getValue(); } public String getHoverLeaveVal() { return hoverLeaveValue; } public IEvalElement getParsedEnterFormula() { // getter which does not require CurrentTrace; but cannot parse on demand return getParsedFormula(); } // a variation of getParsedValueFormula in VisBItem, but just for parsing Hover Enter formulas public IEvalElement getParsedEnterValueFormula(CurrentTrace currentTrace) throws VisBNestedException, ProBError { return getParsedValueFormula(currentTrace); } @Override public String toString(){ return ""; } }
Currently the VisB hovers are static and cannot be changed depending on the current state of the B model. It would be nice to evaluate the EnterValue as a formula, just like for VisB items. This requires some non-trivial refactoring.