package web.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.FilterBuilder;
import com.smartgwt.client.widgets.layout.VLayout;

public class Main extends VLayout implements EntryPoint {

	private static String[] fields = new String[]{"foo", "bar", "baz"};
	public Main(){
		setWidth(600);
		setHeight(400);
		addMember(new FilterBuilder(){{
			setDataSource(new DataSource(){{
				for(String field : fields)
					addField(new DataSourceTextField(field){{
//						setValidOperators(OperatorId.EQUALS, OperatorId.NOT_EQUAL, OperatorId.CONTAINS, OperatorId.STARTS_WITH, OperatorId.ENDS_WITH);
					}});
				setTypeOperators(null, new OperatorId[]{OperatorId.EQUALS, OperatorId.NOT_EQUAL, OperatorId.CONTAINS, OperatorId.STARTS_WITH, OperatorId.ENDS_WITH});
			}});
		}});
	}
	
	@Override
	public void onModuleLoad() {
		RootLayoutPanel.get().add(new Main());
	}
}
