/* * GWT-Ext Widget Library * Copyright(c) 2007-2008, GWT-Ext. * licensing@gwt-ext.com * * http://www.gwt-ext.com/license */ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; import com.gwtext.client.data.SimpleStore; import com.gwtext.client.data.Store; import com.gwtext.client.widgets.Panel; import com.gwtext.client.widgets.form.ComboBox; import com.gwtext.client.widgets.form.FormPanel; public class ComboBoxCompactSample implements EntryPoint { public void onModuleLoad() { Panel panel = new Panel(); panel.setBorder(false); panel.setPaddings(15); final Store store = new SimpleStore(new String[]{"abbr", "states"}, getStates()); store.load(); ComboBox cb = new ComboBox(); cb.setMinChars(1); cb.setFieldLabel("State"); cb.setStore(store); cb.setDisplayField("states"); cb.setMode(ComboBox.LOCAL); cb.setEmptyText("Enter State"); cb.setLoadingText("Searching..."); cb.setTypeAhead(true); cb.setSelectOnFocus(true); cb.setWidth(200); //do not show drop fown icon cb.setHideTrigger(true); FormPanel form = new FormPanel(); form.setLabelWidth(35); form.setBorder(false); form.add(cb); panel.add(form); RootPanel.get().add(panel); } private static String[][] getStates() { return new String[][]{ new String[]{"AL", "Alabama", "The Heart of Dixie"}, new String[]{"AK", "Alaska", "The Land of the Midnight Sun"}, new String[]{"AZ", "Arizona", "The Grand Canyon State"}, new String[]{"AR", "Arkansas", "The Natural State"}, new String[]{"CA", "California", "The Golden State"}, new String[]{"CO", "Colorado", "The Mountain State"}, new String[]{"CN", "Connecticut", "The Constitution State"}, new String[]{"DE", "Delaware", "The First State"}, new String[]{"DC", "District of Columbia", "The Nation's Capital"}, new String[]{"FL", "Florida", "The Sunshine State"}, new String[]{"GA", "Georgia", "The Peach State"}, new String[]{"HW", "Hawaii", "The Aloha State"}, new String[]{"ID", "Idaho", "Famous Potatoes"}, new String[]{"IL", "Illinois", "The Prairie State"}, new String[]{"IN", "Indiana", "The Hospitality State"}, new String[]{"IA", "Iowa", "The Corn State"}, new String[]{"KS", "Kansas", "The Sunflower State"}, new String[]{"KY", "Kentucky", "The Bluegrass State"}, new String[]{"LA", "Louisiana", "The Bayou State"}, new String[]{"ME", "Maine", "The Pine Tree State"}, new String[]{"MA", "Massachusetts", "The Spirit of America"}, new String[]{"MD", "Maryland", "Chesapeake State"}, new String[]{"MI", "Michigan", "Great Lakes State"}, new String[]{"MN", "Minnesota", "North Star State"}, new String[]{"MS", "Mississippi", "Magnolia State"}, new String[]{"MO", "Missouri", "Show Me State"}, new String[]{"MT", "Montana", "Big Sky Country"}, new String[]{"NE", "Nebraska", "Beef State"}, new String[]{"NV", "Nevada", "Silver State"}, new String[]{"NH", "New Hampshire", "Granite State"}, new String[]{"NJ", "New Jersey", "Garden State"}, new String[]{"NM", "New Mexico", "Land of Enchantment"}, new String[]{"NY", "New York", "Empire State"}, new String[]{"NC", "North Carolina", "First in Freedom"}, new String[]{"ND", "North Dakota", "Peace Garden State"}, new String[]{"OH", "Ohio", "The Heart of it All"}, new String[]{"OK", "Oklahoma", "Oklahoma is OK"}, new String[]{"OR", "Oregon", "Pacific Wonderland"}, new String[]{"PA", "Pennsylvania", "Keystone State"}, new String[]{"RH", "Rhode Island", "Ocean State"}, new String[]{"SC", "South Carolina", "Nothing Could be Finer"}, new String[]{"SD", "South Dakota", "Great Faces, Great Places"}, new String[]{"TE", "Tennessee", "Volunteer State"}, new String[]{"TX", "Texas", "Lone Star State"}, new String[]{"UT", "Utah", "Salt Lake State"}, new String[]{"VE", "Vermont", "Green Mountain State"}, new String[]{"VA", "Virginia", "Mother of States"}, new String[]{"WA", "Washington", "Green Tree State"}, new String[]{"WV", "West Virginia", "Mountain State"}, new String[]{"WI", "Wisconsin", "America's Dairyland"}, new String[]{"WY", "Wyoming", "Like No Place on Earth"} }; } }