package	 com.archway.test.client;

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.types.ValueItemType;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.FilterBuilder;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.IPickTreeItem;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeNode;

public class FWFilterBuilder extends FilterBuilder {
	public static String storedFieldName;
	
	public FWFilterBuilder() {
		//Un-comment the below stated code to make the operand combo to a tree view combo.
		/*DataSource FBDataSource = DataSource.get("FSFilterBuilder");
		IPickTreeItem fieldPickerProperties = new IPickTreeItem();
		fieldPickerProperties.setLoadDataOnDemand(false);
		fieldPickerProperties.setEmptyMenuMessage("No Sub Categories");  
		this.setFieldPickerProperties(fieldPickerProperties);*/
	}

	static {
	}

	@Override
	public FormItem getFieldPickerProperties() {
		// TODO Auto-generated method stub
		return super.getFieldPickerProperties();
	}
	
	@Override
	public void setFieldPickerProperties(FormItem fieldPickerProperties)
			throws IllegalStateException {
		// TODO Auto-generated method stub
		super.setFieldPickerProperties(fieldPickerProperties);
	}

	/*
	 * Commented Below Override Method for ISSUE#8. Reverted to Normal Operand
	 * List;
	 */
	/*
	 * @Override public FormItem getFieldPickerProperties() { // TODO
	 * Auto-generated method stub IPickTreeItem categoryItem = new
	 * IPickTreeItem();
	 * categoryItem.setDataSource(DataSource.get("FSFilterBuilder"));
	 * categoryItem.setRedrawOnChange(true);
	 * categoryItem.setLoadDataOnDemand(false);
	 * categoryItem.setEmptyMenuMessage("No Sub Categories");
	 * categoryItem.setCanSelectParentItems(false); return categoryItem; }
	 */
	public FormItem getValueFieldProperties(FieldType type, String fieldName,
			OperatorId operatorId, ValueItemType itemType, String custom) {
		SC.say("Selected fieldname is '" + fieldName);
		return super.getValueFieldProperties(type, fieldName, operatorId, itemType, "");
	}

}
