gwt - How to add a generic "All" value in GXT ComboBox -
i have generic gxt3 combobox display available values enums :
public static <t extends enum<t>> combobox<t> buildenumcombo(class<t> t){ liststore<t> liststore=new liststore<t>(new enummodelkeyprovider<t>()); for(t e:t.getenumconstants()){ liststore.add(e); } combobox<t> combo= new combobox<t>(liststore, new enumlabelprovider<t>()); combo.settriggeraction(comboboxcell.triggeraction.all); return combo; } this combo works fine.
what need : able add "all" value.
i tried add "null" in store , customize labelprovider display "all" particular case not work expected : combo contains expected line displays empty text instead of "all" , line not have correct size.
here generic modelkeyprovider enums
public class enummodelkeyprovider<t extends enum> implements modelkeyprovider<t> { @override public string getkey(t item) { if(item==null){ return null; }else{ return item.name(); } } and generic labelprovider :
public class enumlabelprovider<t extends enum<t>> implements labelprovider<t> { @override public string getlabel(t item) { if(item==null){ return "all"; }else{ return i18nenum.i18nenum(item); } } }
maybe not solution looking for, solved setting emptytext of combobox "all".
Comments
Post a Comment