Edit and run the model

1. Basic knowledge

1.1. Principle of Model Editor

    In the dynamic model, the structure of the model is also represented by the model. The structure of the model can indicate which attributes and sub-nodes the model has, as well as the editing methods of the attributes. Therefore, the editing form can be dynamically generated through the structure of the model, and the model can be edited through the form.     

1.2. Debug mode startup and hot deployment

    In IDEs, such as Eclipse and Idea, it is generally recommended to use Debug to start the model editor and set it to be hot-deployable, that is, the class can be automatically reloaded after the Java code is modified.

    Start the model editor in Deubg mode. The main reason is that the dynamic model is usually programmed dynamically at runtime, so that there is no need to restart the model editor after the Java code is modified.

2. Create a model

    After the model editor is running, in the model editor, you can open the new thing window through the right-click menu of the mouse, and select the model you want to create in the new thing window.

     For example, in the video below, I chose to create an SWT Shell model. After the model is created, it will open for editing.

3. Edit the model

    A model is a tree structured data composed of nodes and attributes like XML, so the basic method of editing a model is to write the attribute form of the model node, and add and delete the child nodes of the model.

    The following video demonstrates editing the property sheet of the model, and adding the child nodes of the model, etc.

4. Run the model

    The models that can be run usually define a run menu. For example, the SWT Shell model in this tutorial can be run through the menu SWT->Run.


Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号