diff --git a/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java b/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java new file mode 100644 index 0000000..0ffb191 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/simulator/interfaces/html/HtmlElement.java @@ -0,0 +1,54 @@ +package simulator.interfaces.html; + +import java.util.HashMap; +import java.util.Map; + +public class HtmlElement { + + private final String type; + private final String id; + private String text; + private Map styles; + //多分ここにもwebsocketのインスタンスが必要になりそう? + //styleなどが変更されたときに通知しなければならないから + //それかそれぞれのreceiverのほうにその処理を作るか + + HtmlElement(String type, String id, String text){ + this.type = type; + this.id = id; + this.text = text; + styles = new HashMap<>(); + } + + public void setStyle(String property, String value) { + styles.put(property, value); + /* + * こちら側にwebsocketの処理を書く場合 + * ws.send("styleChange", id, { property : value } ); + * みたいな感じになりそう + */ + } + + public void resetStyle(String property) { + styles.remove(property); + // ws.send("styleChange", id, { property : null }); + } + + + public String getType() { + return type; + } + + public String getId() { + return id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + +}