Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / models / SimpleUI2.model
Sakoda2269 22 days ago 1 KB モデルファイル変更
init {
	variables := {
		"a": {
			"from": "001",
			"to": "002"
		}
	}
}

native channel ScreenUpdate {
	in screen(curSc: Json, update(curSc, nextSc)) = nextSc
}

native channel SetLayout {
	in screen.layout(curLayout: Bool, setLayout(nextLayout)) = nextLayout
}

native channel SetVisible(wid: Str) {
	in screen.widgets.{wid}.visible(curVisible: Bool, setVisible(nextVisible)) = nextVisible
}

native channel SetText(wid: Str) {
	in screen.widgets.{wid}.text(curText: Str, setText(nextText)) = nextText
}

native channel MouseEvent(wid: Str) {
	out screen.widgets.{wid}.state(curState: Int, mouseEvent(nextState)) = nextState
}

native channel TextEvent(wid: Str) {
	out screen.widgets.{wid}.text(curText: Str, textEvent(nextText)) = nextText
}

channel AddTextInput {
	out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0})
}

channel ChangeText(wid: Str) {
	ref variables.a.from(from, updateText(from, to, newText))
	ref variables.a.to(to, updateText(from, to, nexText))
	in screen.widgets.{wid}.text(curText: Str, updateText(from, to, nexText)) = curText
	out screen.widgets.{to}.text(curText: Str, updateText(from, to, nexText)) = if(wid == from, nextText, curText)
}