123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- <class name="MainApp" default="true">
- <relationships>
- <association name="modelverse" class="Modelverse" min="1" max="1"/>
- <association name="windows" class="Window"/>
- </relationships>
- <constructor>
- <parameter name="root"/>
- <parameter name="location"/>
- <parameter name="username"/>
- <parameter name="password"/>
- <parameter name="model"/>
- <parameter name="limited_mode"/>
- <body>
- self.nr_of_windows = 0
- self.root = root
- self.splash_window = None
- self.open_model = model
- self.limited_mode = limited_mode
- global data
- data = {}
- data['username'] = username
- data['password'] = password
- data['mv_address'] = location
- data['timeout'] = 20.0
- </body>
- </constructor>
- <scxml initial="parallel">
- <parallel id="parallel">
- <state id="behaviour" initial="init_modelverse">
- <state id="init_modelverse" initial="splash">
- <state id="splash">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'windows'"/>
- <parameter expr="'SplashWindow'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../instantiate">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- self.splash_window = association_name
- </script>
- </transition>
- </state>
- <state id="instantiate">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'modelverse'"/>
- <parameter expr="'Modelverse'"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="0"/>
- <parameter expr="'Waiting for Modelverse Instantiation...'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../initializing_network">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="5"/>
- <parameter expr="'Waiting for Modelverse Instantiation... OK'"/>
- </raise>
- </transition>
- </state>
- <state id="initializing_network">
- <onentry>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="10"/>
- <parameter expr="'Waiting for HTTP connection to Modelverse...'"/>
- </raise>
- </onentry>
- <transition event="mv_ready" target="../initializing_modelverse">
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="20"/>
- <parameter expr="'Waiting for HTTP connection to Modelverse... OK'"/>
- </raise>
- </transition>
- </state>
- <state id="initializing_modelverse">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'init'"/>
- <parameter expr="[data['mv_address'], data['timeout']]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="30"/>
- <parameter expr="'Waiting for Modelverse initialization...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../logging_in_modelverse/login">
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="40"/>
- <parameter expr="'Waiting for Modelverse initialization... OK'"/>
- </raise>
- </transition>
- </state>
- <state id="logging_in_modelverse" initial="prompt_username">
- <state id="prompt_username">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'windows'"/>
- <parameter expr="'PromptWindow'"/>
- <parameter expr="{'username': data['username'], 'password': data['password']}"/>
- <parameter expr="{'password': {'show': '*'}}"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../wait_for_credentials">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- self.prompt_window = association_name
- </script>
- </transition>
- </state>
- <state id="wait_for_credentials">
- <state id="responsive">
- <transition event="prompt_results" target=".">
- <parameter name="results"/>
- <script>
- data['username'] = results["username"]
- data['password'] = results["password"]
- </script>
- </transition>
- <transition event="close_window" cond="data['username'] == ''" target="../../prompt_username"/>
- <transition event="close_window" cond="data['username'] != ''" target="../../login"/>
- </state>
- <onexit>
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.prompt_window"/>
- </raise>
- </onexit>
- </state>
- <state id="login">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'login'"/>
- <parameter expr="[data['username'], data['password']]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="50"/>
- <parameter expr="'Logging in...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../register_SCD">
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="70"/>
- <parameter expr="'Logging in... OK'"/>
- </raise>
- </transition>
- <transition event="mv_exception" target="../prompt_username">
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="40"/>
- <parameter expr="'Incorrect username or password'"/>
- </raise>
- </transition>
- </state>
- <state id="register_SCD">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'alter_context'"/>
- <parameter expr="['formalisms/SimpleClassDiagrams', 'formalisms/SimpleClassDiagrams']"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../register_conf_bottom"/>
- </state>
- <state id="register_conf_bottom">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'alter_context'"/>
- <parameter expr="['formalisms/Bottom', 'formalisms/SimpleClassDiagrams']"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../upload_models"/>
- </state>
- <state id="upload_models" initial="upload_MM_render">
- <state id="upload_MM_render">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'model_add'"/>
- <parameter expr="['formalisms/MM_render', 'formalisms/SimpleClassDiagrams', open('models/MM_render.mvc', 'r').read()]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="75"/>
- <parameter expr="'Uploading MM render...'"/>
- </raise>
- </onentry>
- <transition event="mv_exception" target="../upload_render_SCD"/>
- <transition event="mv_response" target="../upload_render_SCD"/>
- </state>
- <state id="upload_render_SCD">
- <onentry>
- <raise event="mv_request">
- <parameter expr="'transformation_add_AL'"/>
- <parameter expr="[{'rendered': 'formalisms/MM_render', 'abstract': 'formalisms/SimpleClassDiagrams'}, {'rendered': 'formalisms/MM_render'}, 'models/render_SCD', open('models/render_SCD.alc', 'r').read()]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="self.splash_window">
- <parameter expr="80"/>
- <parameter expr="'Uploading render_SCD...'"/>
- </raise>
- </onentry>
- <transition event="mv_exception" target="../../../wait_close_splash"/>
- <transition event="mv_response" target="../modify_render_SCD">
- <parameter name="context"/>
- <script>
- self.context = context
- </script>
- </transition>
- </state>
- <state id="modify_render_SCD" initial="trace_class">
- <onexit>
- <script>
- self.context = None
- </script>
- </onexit>
- <state id="trace_class">
- <onentry>
- <raise event="mv_request_context">
- <parameter expr="'instantiate'"/>
- <parameter expr="[None, 'Association', ('abstract/Class', 'rendered/Group'), 'TracabilityClass']"/>
- <parameter expr="self.context"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../trace_association"/>
- </state>
- <state id="trace_association">
- <onentry>
- <raise event="mv_request_context">
- <parameter expr="'instantiate'"/>
- <parameter expr="[None, 'Association', ('abstract/Association', 'rendered/ConnectingLine'), 'TracabilityAssociation']"/>
- <parameter expr="self.context"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../exit"/>
- </state>
- <state id="exit">
- <onentry>
- <raise event="mv_request_context">
- <parameter expr="'exit'"/>
- <parameter expr="[]"/>
- <parameter expr="self.context"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../../../../wait_close_splash"/>
- </state>
- <transition event="mv_exception" target="../../../wait_close_splash"/>
- </state>
- </state>
- </state>
- <state id="wait_close_splash">
- <transition after="0.0" target="../closing_splash"/>
- </state>
- <state id="closing_splash">
- <onentry>
- <raise event="close" scope="narrow" target="self.splash_window"/>
- </onentry>
- <transition event="close_window" target="../../init_main_window">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.splash_window"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="init_main_window">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'windows'"/>
- <parameter expr="'MainWindow'"/>
- <parameter expr="self.open_model"/>
- <parameter expr="self.limited_mode"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../main_behaviour">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="main_behaviour">
- <transition event="close_window" target="../stopped"/>
- </state>
- <state id="stopped">
- <onentry>
- <script>
- self.root.quit()
- </script>
- </onentry>
- </state>
- </state>
- <state id="forward_requests">
- <state id="forward">
- <transition event="mv_request_context" target=".">
- <parameter name="name"/>
- <parameter name="params"/>
- <parameter name="context" default="None"/>
- <raise event="action" scope="narrow" target="'modelverse'">
- <parameter expr="name"/>
- <parameter expr="None"/>
- <parameter expr="context"/>
- <parameter expr="params"/>
- </raise>
- </transition>
- <transition event="mv_request" target=".">
- <parameter name="name"/>
- <parameter name="params"/>
- <raise event="action" scope="narrow" target="'modelverse'">
- <parameter expr="name"/>
- <parameter expr="None"/>
- <parameter expr="None"/>
- <parameter expr="params"/>
- </raise>
- </transition>
- <transition event="mv_result" target=".">
- <parameter name="ID"/>
- <parameter name="result"/>
- <raise event="mv_response" scope="broad">
- <parameter expr="result"/>
- </raise>
- <raise event="mv_response" scope="local">
- <parameter expr="result"/>
- </raise>
- </transition>
- <transition event="mv_exception" target=".">
- <parameter name="ID"/>
- <parameter name="exception_name"/>
- <parameter name="exception"/>
- <raise event="mv_exception" scope="broad">
- <parameter expr="exception_name"/>
- <parameter expr="exception"/>
- </raise>
- <script>
- print("Got Modelverse exception: " + str(exception_name))
- print("Details: " + str(exception))
- </script>
- </transition>
- </state>
- </state>
- </parallel>
- </scxml>
- </class>
|