diff --git a/AlgebraicDataflowArchitectureModel/models/SimpleUI2.model b/AlgebraicDataflowArchitectureModel/models/SimpleUI2.model index 9c08080..55fdf7b 100644 --- a/AlgebraicDataflowArchitectureModel/models/SimpleUI2.model +++ b/AlgebraicDataflowArchitectureModel/models/SimpleUI2.model @@ -2,21 +2,22 @@ screenTemplates := { "000": { "widgets": { - "001": {"type": "textInput", "text": "", "state": 0, "visible": true}, - "002": {"type": "button", "text": "Next", "state": 0, "visible": true}, - "005": {"type": "label", "text": "aaa", "state": 0, "visible": true} - }, + "001": {"type": "textInput", "text": "", "visible": true}, + "002": {"type": "button", "text": "Next", "visible": true}, + "005": {"type": "label", "text": "", "visible": true}, + "006": {"type": "button", "text": "hello", "visible": true} + }, "layout": true }, "001": { "widgets": { - "003": {"type": "label", "text": "label", "state": 0, "visible": true}, - "004": {"type": "button", "text": "Back", "state": 0, "visible": true} + "003": {"type": "label", "text": "label", "visible": true}, + "004": {"type": "button", "text": "Back", "visible": true} }, "layout": true } } - sender1:= "005" + sender5 := "005" } native channel ScreenUpdate { @@ -69,30 +70,19 @@ 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 EventDispatch2(wid: Str) { - in screen.widgets.{wid}.text(curText: Str, dispatchEvent(curScId, wid, nextText: Str)) = nextText - ref curScreen(curScId: Str, dispatchEvent(curScId, wid, nextText)) - out screenTemplates.{curScId}.widgets.{wid}.text(curText: Str, dispatchEvent(curScId, wid, nextText)) = nextText +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 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 EventHandler3(wid: Str) { + in screen.widgets.{wid="001"}.text(curText: Str, handler3(nextText: Str, target:Str)) = nextText + ref sender5(target, handler3(nextState, target)) + out screen.widgets.{target}.text(curText, handler3(nextText, target)) = nextText } -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 EventHandler3(scId: Str, wid: Str) { - in screenTemplates.{scId="000"}.widgets.{wid="001"}.text(curText: Str, handleEvent3(nextText: Str, target)) = nextText - ref sender1(target, handleEvent3(nextText, target)) - out screen.widgets.{target}.text(curText: Str, handleEvent3(nextText, target)) = nextText -}