diff --git a/AlgebraicDataflowArchitectureModel/models/SimpleUI.model b/AlgebraicDataflowArchitectureModel/models/SimpleUI.model index d31906b..f279641 100644 --- a/AlgebraicDataflowArchitectureModel/models/SimpleUI.model +++ b/AlgebraicDataflowArchitectureModel/models/SimpleUI.model @@ -1,10 +1,10 @@ init { screenTemplates := { - "000": {"widgets": {"001": {"type": "textInput", "text": "", "state": 0}, - "002": {"type": "button", "text": "Next", "state": 0}}, + "000": {"widgets": {"001": {"type": "textInput", "text": ""}, + "002": {"type": "button", "text": "Next"}}, "layout": true}, - "001": {"widgets": {"003": {"type": "label", "text": "label", "state": 0}, - "004": {"type": "button", "text": "Back", "state": 0}}, + "001": {"widgets": {"003": {"type": "label", "text": "label"}, + "004": {"type": "button", "text": "Back"}}, "layout": true} } } @@ -59,20 +59,14 @@ out screen(curS, transScreen(nextScId, screen)) = screen } -channel EventDispatch(wid: Str) { - in screen.widgets.{wid}.state(curState: Int, dispatchEvent(curScId, wid, nextState)) = nextState - ref curScreen(curScId: Str, dispatchEvent(curScId, wid, nextState)) - out screenTemplates.{curScId}.widgets.{wid}.state(curState: Int, dispatchEvent(curScId, wid, nextState)) = nextState +channel EventHandler1(wid: Str) { + in screen.widgets.{wid="002"}.state(curState: Int, handleEvent1(nextState)) = nextState + out curScreen(curScId: Str, handleEvent1(nextState)) = if((curScId == "000") && (nextState == 0), "001", curScId) } -channel EventHandler1(scId: Str, wid: Str) { - in screenTemplates.{scId="000"}.widgets.{wid="002"}.state(curState: Int, handleEvent1(nextState)) = nextState - out curScreen(curScId: Str, handleEvent1(nextState)) = if(nextState == 0, "001", curScId) -} - -channel EventHandler2(scId: Str, wid: Str) { - in screenTemplates.{scId="001"}.widgets.{wid="004"}.state(curState: Int, handleEvent2(nextState)) = nextState - out curScreen(curScId: Str, handleEvent2(nextState)) = if(nextState == 0, "000", curScId) +channel EventHandler2(wid: Str) { + in screen.widgets.{wid="004"}.state(curState: Int, handleEvent2(nextState)) = nextState + out curScreen(curScId: Str, handleEvent2(nextState)) = if((curScId == "001") && (nextState == 0), "000", curScId) } channel ChangeLayout {