Monday, October 27, 2008

SCSNI

on saturday the 25th i gave the Sun Certified Specialist Netbeans IDE Beta Certification Exam. The exam was pretty cool with all the features that one could find in Netbeans. A guy who had worked in netbeans for an year with all the features of JUnit, using the config of netbeans, setting the properties of a netbeans project. And most importantly, the questions are focused on how to do a particular task in different ways in netbeans and i personally think that taking that people working on netbeans should take the exam to boost their stand.

Friday, October 24, 2008

keyboard events listener gxt

Keyboard events are handled in a different way in gxt than the traditional keyboardListener events. A new keyNav class has to be created with the component that is being handled. And then the key event that the user needs can be handled. Eg: TextField text = new TextField(); // new text field component new KeyNav(text) //new KeyNav class for text component { @override public void onTab(ComponentEvent ce) /overriding the onTab method { super.onTab(ce); // your code } } I still wonder why gxt doesnot provide more specific listeners like the clickListener or KeyboardListener that handles all the events. They do support all the listeners in a generic way.

Thursday, October 23, 2008

submitting data from formPanel gxt

There is always a requirement to get all the data from the forms and have it stored in database or displayed some where else. Instead of actually getting the data component by component gxt can actually get all the data at once using the "getFields" method in FormPanel. This method returns a List of all the fields that are present in the form, and then iterating over the fields we can extract the values based on the way it is rendered on the form. Eg: FormPanel formPanel = new FormPanel(); //creating a formPanel List field = formPanel.getFields(); //getting a list of all the fields in the formpanel for (Field f : field) // Iterating over the list f.getValue(); // value for all components in the formPanel }

Wednesday, October 22, 2008

populating the combo box EXT-GWT

There are only a few samples on ext-gwt. The most recent version being 1.1 released in august. I recently have an issue of populating the combo box before the "down-arrow" in the combo box is clicked. Populating the combo box from the database using cold fusion can be done in the following way
  • Firstly we need to define the ModelType of the data that is being extracted from the CFM file, with the root.
  • Next the JSONReader has to be set to the ModelType which specifies the type of the data that has to be stored in the combo box Store.
  • We then need to set up the HttpProxy for the connection to be established with the database. This proxy contains the requestbuilder which actually builds the request String with a "post" or a "get". The header for the request builder should be set which i am not pretty sure why we are doing it, but if doesnot display the output when it is not set.
  • Then the loader for the combo box has to be set with the proxy which tells about the connections to the database and the JSONReader which talks about the format of the expected text.
  • Finally the store is set with the loader, which is assigned to the combo box.
This is usually the process that is followed not only for the combo box but also for almost widget that gets data from a database. Combo box usually gets the data dynamically i.e, the load of the loader is called only when the "down arrow" of the combo box is clicked. To over ride that and have the data extracted well before the button is clicked then we can just include loader.load(); after setting the store, which will perform the load operation.