diff --git a/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java b/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java index 0373165..a1264f4 100644 --- a/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java +++ b/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java @@ -1,7 +1,9 @@ package simulator.interfaces.html; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import models.algebra.Constant; import models.dataConstraintModel.JsonTerm; @@ -13,6 +15,7 @@ private final String id; private String text; private Map styles; + private Set classes; private IRestEventListener restEventListener; HtmlElement(String type, String id, String text){ @@ -20,6 +23,7 @@ this.id = id; this.text = text; styles = new HashMap<>(); + classes = new HashSet<>(); } public void setStyle(String property, String value) { @@ -30,6 +34,14 @@ styles.remove(property); } + public void addClass(String className) { + classes.add(className); + } + + public void removeClass(String className) { + classes.remove(className); + } + public MapTerm toMap() { MapTerm res = new MapTerm(); res.insert("\"type\"", new Constant("\"" + type + "\"")); @@ -40,6 +52,8 @@ stylesMap.insert(prop, new Constant(styles.get(prop))); } res.insert("\"styles\"", stylesMap); + String classTmp = String.join(" ", classes); + res.insert("\"class\"", new Constant(classTmp)); return res; }