/* * Smart GWT (GWT for SmartClient) * Copyright 2008 and beyond, Isomorphic Software, Inc. * * Smart GWT is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 * as published by the Free Software Foundation. Smart GWT is also * available under typical commercial license terms - see * http://smartclient.com/license * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import com.smartgwt.client.core.Rectangle; import com.smartgwt.client.util.Page; import com.smartgwt.client.widgets.AnimationCallback; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.events.CloseClickEvent; import com.smartgwt.client.widgets.events.CloseClickHandler; import com.smartgwt.client.widgets.layout.VLayout; import com.google.gwt.core.client.EntryPoint; public class SplitPaneAutoNavigateSample extends VLayout implements EntryPoint { public Canvas createSplitPane() { final SplitPane splitPane = new SplitPane(); final DetailViewer detailPane = new DetailViewer(); detailPane.setDataSource(ItemSupplyXmlDS.getInstance()); final ListGrid listPane = new ListGrid(); listPane.setDataSource(ItemSupplyXmlDS.getInstance()); if (Browser.getIsTablet()) { ListGridField itemNameField = new ListGridField("itemName"); ListGridField unitCostField = new ListGridField("unitCost"); ListGridField inStockField = new ListGridField("inStock"); listPane.setFields(itemNameField, unitCostField, inStockField); } final TreeGrid navigationPane = new TreeGrid(); navigationPane.setDataSource(SupplyCategoryXmlDS.getInstance()); navigationPane.setAutoFetchData(true); navigationPane.setShowHeader(Browser.getIsDesktop()); navigationPane.addSelectionUpdatedHandler(new SelectionUpdatedHandler() { @Override public void onSelectionUpdated(SelectionUpdatedEvent event) { splitPane.setDetailTitle(null); detailPane.setData(new Record[0]); } }); splitPane.setNavigationTitle("Categories"); splitPane.setShowLeftButton(false); splitPane.setShowRightButton(false); splitPane.setBorder("1px solid blue"); splitPane.setDetailPane(detailPane); splitPane.setListPane(listPane); splitPane.setNavigationPane(navigationPane); splitPane.setListPaneTitleTemplate("${record.categoryName}"); splitPane.setDetailPaneTitleTemplate("${index + 1} of ${totalRows}"); return splitPane; } public void onModuleLoad() { setWidth100(); setHeight100(); addMember(createSplitPane()); draw(); } }