Sunday, January 31, 2010

Work Progress - Jan 24 - Jan 31

Progress:
  • The dragging action is now able to update the statement tree data structure. Currently the drag simply append a new PStatmentMethod statement to the statement tree data structure. (See my modified InsertCodelet() method in JPnlScriptlet.java for details.)
Demo:
  • Run SB/SBGui.java
  • Select the Skateboarder object on the right render window.
  • Go to the "Events" tab. Select an event
  • Go to the "Methods" tab. Drag any method prototype to the middle JPnlScriptlet window.
-- On dragging --

-- Right after drag --

Next step:
  • PStatement.Void display - should we provide an empty textbox and let the user enter the value directly? Since then we need to turn that PStatement.Void object to a PStatementConst object.
  • An illustrative example of execution of statements in the statement tree.
  • Enable addition of codelet to arbitrary location of the statement tree.
  • Enable removal of codelet by selection at arbitrary location of the statement tree.
  • The height of the method prototype (with multiple arguments) when it is being dragged needs to be fixed. The width of the method prototype with no argument, when standing in the middle JPnlScriptlet window on its own, needs to be fixed as well.
  • Utility's changeArraySize() method has generic array creation issue. I rewrite a intuitive code to replace any call on this method. We may need to investigate the issue to help keep our code elegant.
  • JPnlScriptlet window may show the current event being edited.

Friday, January 22, 2010

Work Progress - Jan 18 - Jan 22

Summary of my work in the winter:
  • Complete the display of objects' method prototype (which is going to be for users to drag and construct their simulation's visual programming) on the left hand side of the pCSDT main window. Now when a particular object is selected in the render view on the right hand side of the pCSDT main window, the available methods of the object are shown, with their respect argument names.
  • Complete the display of the PStatement tree, which tells what actions to do when an event is triggered, at the middle of the pCSDT main window. Now once an event of a object is selected, the corresponding PStatement tree will be shown.
The two images in the weekly progress section presents visual illustrations of the above two points.

Potential future work:
For the scripting functionality you mention, sorry I didn't have a time looking into it in details. The existing code has just allowed me to complete the display part of the method, though. Below are some potential tasks I can think of (may be done in parallel):
  • The Save() function in every JPnlLine subclass.
  • The actual drag-n-drop. I think the right function call has already been available in the repository's drag-n-drop test code.
  • The completion of the display of other function blocks, like the if...then..., while do...
  • The execution of the PStatement tree when the corresponding event is triggered. (My impression is most parts have already been completed - of course you need to check with Jason for the actual situation - we may just need an example to demonstrate it.)

Weekly progress
Run SB/SBGui.java for a demonstration.
  • Enhancement on the the codelet prototype and statement tree view, as follows.
  • Add a static member of PStatementConst called Void, which corresponds to a PStatementConst wrapped around a PVariant.Void. Since then when a codelet is freshly dragged from the prototype view on the left to the statement tree in JPnlScriptlet window in the middle, the parameter values can be initialized directly with the same PStatmentConst.Void, instead of instantiating separate PStatementConst objects. This saves memory. See SB/BoarderEngine.java line 115 in revision 242 for an example.
  • Documentation

Saturday, January 16, 2010

Work Progress - Jan 11 - Jan 15

Finished rendering the statement tree in Scriptlet window
  • I've set up an example in the skateboarder code (SB/BoarderEngine.java). I create an event for the BoardEngine called DummyEvent. It is accessible under the Events tab on the left window as soon as we run SB/SBGui.java, at which time the stuff associated with the Engine are loaded. Click on it, and you'll see the methods associated to it displayed.
  • Rendering of the statement is delegated to the individual statement types. In this example statement tree, in the Something2() method we have parameter val being evaluated by a binary statement "x + x". the rendering of the binary statement part is depending on the existing implementation in the class JPnlLineBinary.
  • Fix the problem that when another object is selected, the statement tree in the scriplet window is not clear.
  • Fix the problem that the method's parameters are not immediately shown after the corresponding object is selected.

Saturday, January 9, 2010

Work Progress - Jan 4 - Jan 8

- Collect further system specification from Jason

- To do:
1) Display PMethod in Prototype window
  • In code responsible for displaying PMethod in the prototype window, set all the input fields as disabled always. [Done]
2) Render the statement tree in Scriptlet window
  • Create a new static member of PStatementConst called void, which corresponds to a PStatementConst wrapped around a PVariant.Void. [Seems to be done somewhere when bunch of PMethodStatement's are created]
  • Understand the PStatement life cycle:
    1) A separate statement tree is associated with each event. JPnlScriplet.BindCodelet(.) is the way for the Scriplet to obtain the current PEvent's statement tree to render. PStatementList seems not able to attach children statements...
    2) When a PStatementMethod is created, the parameters should be a bunch of PVariant.Void.
    3) User inputs the data to the input fields.
    4) When about to execute, obtain data from the input field via PStatement.FromString() method
  • Concerning the display:
    1) PVariant is wrapped with PStatementConst.
    2) Call the following recursive construct to show up GUI
    for (IStatement s:m_statement.GetChildren) {
    JPnlLine gui = s.GetGui(info);
    Add Gui to self;
    }