/* * Isomorphic SmartGWT web presentation layer * Copyright 2000 and beyond Isomorphic Software, Inc. * * OWNERSHIP NOTICE * Isomorphic Software owns and reserves all rights not expressly granted in this source code, * including all intellectual property rights to the structure, sequence, and format of this code * and to all designs, interfaces, algorithms, schema, protocols, and inventions expressed herein. * * If you have any questions, please email
. * * This entire comment must accompany any portion of Isomorphic Software source code that is * copied or moved from this file. */ package com.smartgwt.sample.showcase.client.dataintegration.java.grid; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.sample.showcase.client.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class BasicConnectorSample implements EntryPoint { public void onModuleLoad() { final ListGrid listGrid = new ListGrid(); listGrid.setWidth(700); listGrid.setHeight(224); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(DataSource.get("worldDS")); listGrid.setAutoFetchData(true); listGrid.setShowFilterEditor(true); listGrid.setCanEdit(true); listGrid.setEditEvent(ListGridEditEvent.CLICK); listGrid.setCanRemoveRecords(true); ListGridField countryCode = new ListGridField("countryCode", "Code", 50); ListGridField countryName = new ListGridField("countryName", "Country"); ListGridField capital = new ListGridField("capital", "Capital"); ListGridField government = new ListGridField("government", "Government"); ListGridField continent = new ListGridField("continent", "Continent"); ListGridField independence = new ListGridField("independence", "Independence"); ListGridField area = new ListGridField("area", "Area (km²)"); ListGridField population = new ListGridField("population", "Population"); ListGridField gdp = new ListGridField("gdp", "GDP($M)"); listGrid.setFields(countryCode, countryName, capital, government, continent, independence, area, population, gdp); IButton newButton = new IButton("Add New"); newButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { listGrid.startEditingNew(); } }); VLayout layout = new VLayout(15); layout.addMember(listGrid); layout.addMember(newButton); layout.draw(); } }