2012年1月24日 星期二

Migrating Web Service to JAVA Applet (2)

     Before migrating whole web service to applet, the hardest part is how to change the mindset from developing web page to JAVA applet.

     Take Web page designing as an example:
In django, the directory looks like following structure


     Basically, every html page is deployed under templates, and view and controlling program is constructed under the project_app you've created. urls.py stands in between to communicates what should a views returns on the web page. Via the usage of page extension, you may extends the function module by extending base.html.




However, on java applet, the concept of laying a page is not that straightforward. Every component is deployed on a drawing canvas. Every components should be deployed in a container. 
1. So first of all, A frame (JFrame) should be deployed. 
2. Within the frame, a panel (ContentContainer)  is deployed to contain different components
3. For the usage of menu list, ContentPanel should be deployed on the upper of the frame.
4. Under the ContentPanel, thinking of switching panel while clicking different menu items, a CardLayout is deployed to manage different panel.
5. For every menu items clicked, a panel within the cardlayout is switched accordingly.

2012年1月22日 星期日

Migrating Web Service to JAVA Applet (1)

     As for the requirement to implement a data search engine for my customers. I first implement a prototype tool by using python + django. 

     Thanks to the online resource and strong community of python and django. The development is blazing fast. It took me no longer than three days to complete the task.

    However, as the installation of all components on others' computer is kind of complicated as for I mixed some of the elements from Java. Therefore, the only way to deliver the product is has it installed on VM. Though it sounds like a stupid idea (this whole idea is not initiated by me, but as an employee, what can I decide). Thus, I am now trying to migrate whole thing from python + django to Java Applet.

     Since it has been quite for a long time for me not writing java applet. I did do some research on this topic.

Here comes the implementation recipe: 

Target: A JDBC interface to search sensitive data within target DB.

Regimentation Notice:
     1. A menu to access different page.
     2. An asynchronous access method.
     3. Multiple DB access interface
     4. Backend repository
     5. Statistical report

In phase 1, the implementation of menu structure is as described as follows:

1. Create A JFrame container
     a. Create JMenuBar for menulist
        i. Create JMenu under JMenubar 

2. Create JPanel
     a. Create JScrollPane under panel
        i. Create JEditorPane under JScrollPane

To enable the clicking of menu will trigger different page displayed withinin JMenu, a mouse clicked event is added for the purpose.