hi everyone!

I'm trying sgwt2.1 recently....as i was exploring the new features
available in the new version i tend to attempt "getting a widget in
listgrid"...and i'm confused with "addEmbeddedComponent"
method...could anybody help? My code goes like this....


package com.app.client;

import java.util.LinkedHashMap;
import java.util.Map;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.EmbeddedPosition;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.util.SC;
public class TestListGrid implements EntryPoint {
        TextItem ti=new TextItem();

        public TestListGrid() {
                // TODO Auto-generated constructor stub

        }
        public void onModuleLoad() {
                // TODO Auto-generated method stub
                ListGrid lg=new ListGrid();
                IButton ib=new IButton();
                ib.setShowTitle(false);
                SelectItem si=new SelectItem();
                si.setShowTitle(false);
                LinkedHashMap<String, Object> option=new LinkedHashMap<String,
Object>();
                option.put("aaa","aaa");
                option.put("bbb","bbb");
                option.put("ccc","ccc");
                option.put("null", null);
                si.setValueMap(option);

                rgv.setErrorMessage("this's invalide");
                ti.setValue("raj");
                ti.setShowTitle(false);
                final DynamicForm df=new DynamicForm();
                si.addChangeHandler(new ChangeHandler(){

                        public void onChange(ChangeEvent event) {
                                // TODO Auto-generated method stub
                                System.out.println("inside change handler");
                                if(event.getValue().equals("aaa")){
                                        ti.enable();
                                        ti.setValue("");
                                        SC.say("this is invalide");
                                }
                                else{
                                        ti.disable();
                                        ti.setValue((String)event.getValue());
                                }

                        }

                });

                ListGridField lgf1=new ListGridField("name");
                ListGridField lgf2=new ListGridField("value");
                lg.setFields(lgf1,lgf2);
                ListGridRecord lgr1=new ListGridRecord();
                lgr1.setAttribute("name", "raj");
                ListGridRecord[]lgr=new ListGridRecord[]{lgr1};
                df.setFields(si,ti);
                lg.addEmbeddedComponent(df,lgr[0], 0, 1, 
EmbeddedPosition.WITHIN);

                lg.setRecords(lgr);
                lg.draw();
                ti.disable();
        }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to