/* * 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.others; import java.util.LinkedHashMap; import com.google.gwt.core.client.GWT; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.PartialCommitOption; import com.smartgwt.client.widgets.BatchUploader; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.IntegerItem; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.sample.showcase.client.Showcase; import com.google.gwt.core.client.EntryPoint; public class BatchUploaderSample implements EntryPoint { @Override public void onModuleLoad() { DataSource dataSource = DataSource.get("supplyItemCustom"); // Include the supplyItemUnits DataSource so it shows up in the source window DataSource supplyItemUnits = DataSource.get("supplyItemUnits"); final BatchUploader batchUploader = new BatchUploader(); batchUploader.setWidth100(); batchUploader.setUploadDataSource(dataSource); ListGrid properties = new ListGrid(); properties.setHeight(300); batchUploader.setAutoChildProperties("grid", properties); TextItem stringValue = new TextItem("stringValue", "String Value"); stringValue.setWrapTitle(false); IntegerItem numberValue = new IntegerItem("numericValue", "Numeric Value"); numberValue.setWrapTitle(false); batchUploader.setUploadFormItems(stringValue, numberValue); DynamicForm uploadFormProperties = new DynamicForm(); uploadFormProperties.setTitleWidth(110); batchUploader.setAutoChildProperties("uploadForm", uploadFormProperties); batchUploader.setDataURL(GWT.getModuleBaseURL() + "/exampleTransactionManager.do"); DynamicForm partialCommitsForm = new DynamicForm(); SelectItem partialCommits = new SelectItem("partialCommits", "Partial Commit Mode"); partialCommits.setWrapTitle(false); partialCommits.setValueMap(new LinkedHashMap() {{ put(PartialCommitOption.ALLOW, "Allow"); put(PartialCommitOption.PREVENT, "Prevent"); put(PartialCommitOption.PROMPT, "Prompt"); put(PartialCommitOption.RETAIN, "Retain"); }}); partialCommits.setDefaultValue("Prompt"); partialCommits.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { batchUploader.setPartialCommit(PartialCommitOption.valueOf((String)event.getValue())); } }); partialCommitsForm.setItems(partialCommits); ListGrid supplyItemsGrid = new ListGrid(); supplyItemsGrid.setShowFilterEditor(true); supplyItemsGrid.setDataSource(dataSource); supplyItemsGrid.setUseAllDataSourceFields(true); supplyItemsGrid.setWidth100(); supplyItemsGrid.setHeight(300); supplyItemsGrid.setAutoFetchData(true); VLayout layout = new VLayout(15); layout.setWidth100(); layout.addMember(partialCommitsForm); layout.addMember(batchUploader); VLayout layout2 = new VLayout(); layout2.addMember(new Label("
Supply Items Table Contents
")); layout2.addMember(supplyItemsGrid); layout.addMember(layout2); layout.draw(); } }