PDA

View Full Version : Edits vanish but red triangle appears



darkling235
14 Jan 2010, 7:48 AM
Hi I'm having a problem with my edit grid. If I try to edit a cell the values reset immediately after I hit the enter button. The red triangle does appear however. Is there something I have to do in my edit handler to make sure those edits don't immediately reset. I'm not trying to commit them yet, I just want the edits to not vanish.

I've tried debugging and the "modified" object never has the correct value. It always has the original value before editing. I'm not sure why it does this or what I'm doing wrong but some help would be greatly appreciated as I'm running out of time to wrap up this project.
Thanks



package com.ray.adt.client.grid;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import com.extjs.gxt.ui.client.Style;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.RowEditorEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.store.StoreListener;
import com.extjs.gxt.ui.client.store.Record.RecordUpdate;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.RowEditor;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.selection.SelectionModel;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.ray.adt.client.error.ErrorScreen;
import com.ray.adt.client.listGrid.Resources;

public class Grid extends LayoutContainer
{

private GridDataServiceAsync GridDataService = GWT.create(GridDataService.class);
private ListStore<GridData> store;
private ErrorScreen errors;
private Record currentRecord;
private int currentRow;
private int userRole;
private int gridRole;
private EditorGrid<GridData> grid;
private ColumnModel cm;
private ContentPanel cp;
private CellEditor editor;
public Grid(ErrorScreen e)
{
errors = e;
}

protected void onRender(Element parent, int index)
{
super.onRender(parent, index);

setLayout(new FlowLayout(10));
//this.setSize("200%", "200%");
cp = new ContentPanel();
cp.setHeading("Edit Grid");
cp.setFrame(true);
cp.setIcon(Resources.ICONS.table());
cp.setSize(1200, 500);
cp.setLayout(new FlowLayout());
cp.setScrollMode(Style.Scroll.ALWAYS);


List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
store = new ListStore<GridData>();
store.setMonitorChanges(true);
store.addStoreListener(new StoreListener<GridData>()
{

public void handleEvent(StoreEvent<GridData> event)
{
Record record = event.getRecord();

System.out.println("Event " + event.getOperation());

if(event.getOperation() == RecordUpdate.EDIT)
{
//not sure what I need to do here
}

if(event.getOperation() == RecordUpdate.COMMIT)
{
GridData gridData = new GridData();
gridData.setData(record.getModel());
System.out.println(gridData.toString());

GridDataService.updateGridData(gridData,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
errors.setErrorText("Error updating grid row");
}

public void onSuccess(Void result) {
}
});

}




}

});



cm = new ColumnModel(configs);
grid = new EditorGrid<GridData>(store, cm);
grid.setSelectionModel(new GridSelectionModel<GridData>());
grid.setSize(1000, 300);
/* grid.addListener(Events.BeforeEdit, new Listener<GridEvent<?>>() {
public void handleEvent(GridEvent<?> gridEvent) {
gridEvent.setCancelled(isAuthorized(userRole, gridRole));
}
});*/

configs.add(this.makeTextField("docNumber", "Document Number"));
configs.add(this.makeTextField("docDescription", "Document Description"));
configs.add(this.makeTextField("docCode", "Doc Code"));
configs.add(this.makeTextField("respEid", "Resp Eng EIDs"));
configs.add(this.makeTextField("respEngs", "Resp Engs"));
configs.add(this.makeC5Field("c5BidCode", "C5 Bid Code"));
configs.add(this.makeTextField("modelingReuse", "Modeling Reuse"));
configs.add(this.makeDateField("modelingPlanDate", "Modeling Plan Date"));
configs.add(this.makeDateField("modelingOutlookDate", "Modeling Outlook Date"));
configs.add(this.makeDateField("modelingActualDate", "Modeling Actual Date"));
configs.add(this.makeTextField("analysisReuse", "Analysis Reuse"));
configs.add(this.makeTextField("drawingReuse", "Drawing Reuse"));
configs.add(this.makeDateField("drawingPlanDate", "Drawing Plan Date"));
configs.add(this.makeDateField("drawingOutlookDate", "Drawing Outlook Date"));
configs.add(this.makeDateField("drawingActualDate", "Drawing Actual Date"));
//configs.add(this.makeTextField("thermalReuse", "Thermal Reuse"));
configs.add(this.makeDateField("thermalPlanDate", "Thermal Plan Date"));
configs.add(this.makeDateField("thermalOutlookDate", "Thermal Outlook Date"));
configs.add(this.makeDateField("thermalActualDate", "Thermal Actual Date"));
configs.add(this.makeTextField("outlookNumberOfSheets", "Outlook Number of Sheets"));
configs.add(this.makeOutlookSheetField("outlookSheetSize", "Outlook Sheet Size"));
configs.add(this.makeTextField("outlookNumber of Termination", "Outlook Number of Termination"));
configs.add(this.makeTextField("effectiveSqFeet", "Effective Outlook Square Feet"));
configs.add(this.makeTextField("effectiveNumberOfTermination", "Effective Number of Termination"));
configs.add(this.makePercent("modelingComplete", "Modeling Complete"));
configs.add(this.makePercent("structualComplete", "Structural Complete"));
configs.add(this.makePercent("thermalComplete", "Thermal Complete"));
configs.add(this.makePercent("drawingComplete", "Drawing Complete"));
configs.add(this.makePercent("checkingComplete", "Checking Complete"));
configs.add(this.makeTextField("actionDocument", "Action Document"));
configs.add(this.makeDateField("submittedPlanDate", "Submitted Plan Date"));
configs.add(this.makeDateField("submittedOutlookDate", "Submitted Outlook Date"));
configs.add(this.makeDateField("submittedActualDate", "Submitted Actual Date"));
configs.add(this.makeTextField("CCBStart", "CCB Start"));
configs.add(this.makeDateField("releasedPlanDate", "Released Plan Date"));
configs.add(this.makeDateField("releasedOutlookDate", "Released Outlook Date"));
configs.add(this.makeDateField("releasedActualDate", "Released Actual Date"));
configs.add(this.makeTextField("iscNeedDate", "ISC Need Date"));
configs.add(this.makeTextField("drawingNeedDate", "Drawing Need Date"));
configs.add(this.makeTextField("udText1", "UDText1"));
configs.add(this.makeTextField("udText2", "UDText2"));
configs.add(this.makeTextField("udText3", "UDText3"));
configs.add(this.makeTextField("udText4", "UDText4"));
configs.add(this.makeTextField("udText5", "UDText5"));
configs.add(this.makeTextField("udText6", "UDText6"));
configs.add(this.makeDateField("udDate1", "UDDate1"));
configs.add(this.makeDateField("udDate2", "UDDate2"));
configs.add(this.makeCheckBox("deleted", "Deleted"));
configs.add(this.makeTextField("percentComplete", "%Complete"));








grid.setBorders(true);
cp.add(grid);

ToolBar toolBar = new ToolBar();
Button add = new Button("Add Row");
add.addSelectionListener(new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
GridData data = new GridData();
grid.stopEditing();
store.insert(data, 0);
grid.startEditing(0, 0);

}

});
toolBar.add(add);
cp.setTopComponent(toolBar);

cp.setButtonAlign(HorizontalAlignment.CENTER);
cp.addButton(new Button("Reset", new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
store.rejectChanges();
}
}));

cp.addButton(new Button("Save", new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
store.commitChanges();
}
}));


add(cp);

}

protected ColumnConfig makeTextField(String id, String name)
{
ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);


TextField<String> field = new TextField<String>();
field.setAllowBlank(true);
column.setEditor(new CellEditor(field));
return column;

}

protected ColumnConfig makeCheckBox(String id, String name)
{
CheckColumnConfig checkColumn = new CheckColumnConfig(id, name, 55);
checkColumn.setId(id);
checkColumn.setHeader(name);
grid.addPlugin(checkColumn);
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
checkColumn.setEditor(checkBoxEditor);

return checkColumn;
}

protected ColumnConfig makeDateField(String id, String name)
{
DateField dateField = new DateField();
dateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat("MM/dd/y"));

ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(95);
column.setEditor(new CellEditor(dateField));
column.setDateTimeFormat(DateTimeFormat.getMediumDateFormat());
return column;
}

protected ColumnConfig makeC5Field(String id, String name)
{
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.add("DHB");
combo.add("DDC");
combo.add("DEC");
combo.add("AD");
combo.add("AE");
combo.add("AH");
combo.add("BD");
combo.add("BE");
combo.add("BH");
combo.add("DDB");
combo.add("DEB");
combo.add("DGA");
combo.add("HAA");
combo.add("HBA");
combo.add("Other");

ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(95);
column.setEditor(new CellEditor(combo));
return column;
}

protected ColumnConfig makeOutlookSheetField(String id, String name)
{
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.add("A = 0.6493 sqft");
combo.add("B = 1.2986 sqft");
combo.add("C = 2.5972 sqft");
combo.add("D = 5.1944 sqft");
combo.add("E = 10.3889 sqft");


ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);
column.setEditor(new CellEditor(combo));
return column;
}


protected ColumnConfig makePercent(String id, String name)
{
NumberField field = new NumberField();
field.setMaxValue(100);
field.setMinValue(0);
field.setAllowDecimals(true);
field.setAllowNegative(false);
ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);
column.setEditor(new CellEditor(field));
return column;
}

public void fetch(String key)
{
GridDataService.fetchGridData(key, new AsyncCallback<List<GridData>>(){


public void onFailure(Throwable caught) {
errors.setErrorText("Failure to fetch grid");

}


public void onSuccess(List<GridData> result) {
store.add(result);
grid.reconfigure(store, cm);
for(int x = 0; x < store.getCount(); x++)
System.out.println(store.getAt(x).toString());
grid.getView().refresh(false);
}



});
}

private boolean isAuthorized(int userRole, int gridRole)
{
return false;
}

public ListStore<GridData>getStore()
{
return store;
}

}

darkling235
15 Jan 2010, 3:26 AM
I've done some more checking on this issue and I can't find any modified values being passed through the event handler. Could there be something messed up with my model? I'm not what methods are used to do the edits so maybe I didn't override the right ones. I extended BaseModelData.
Any help would be most appreciated as I really have no idea what to do next.



package com.ray.adt.client.grid;
import java.io.Serializable;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;



public class GridData extends BaseModelData implements Serializable, ModelData
{

/**
*
*/
private static final long serialVersionUID = 1L;
private String gridId;
private String rowId;
private String docNumber;
private String docDescription;
private String udText1;
private String udText2;
private String docCode;
private String respEid;
private String respEngs;
private String c5BidCode;
private String modelingReuse;
private String analysisReuse;
private String drawingReuse;
private int outlookNumberOfSheets;
private String outlookSheetSize;
private int outlookNumberOfTermination;
private String effectiveSqFeet;
private String effectiveNumberOfTermination;
private String modelingComplete;
private String structualComplete;
private String thermalComplete;
private String drawingComplete;
private String checkingComplete;
private String actionDocument;
private Date submittedPlanDate;
private Date submittedOutlookDate;
private Date submittedActualDate;
private String CCBStart;
private Date releasedPlanDate;
private Date releasedOutlookDate;
private Date releasedActualDate;
private Date iscNeedDate;
private String drawingNeedDate;
private boolean deleted;
private String percentComplete;
private HashMap<String, Object> map;

private String header;
private String similarTo;
private String udText3;
private String udText4;
private String udText5;
private String udText6;
private Date udDate1;
private Date udDate2;
private String intraLinkFileName;
private Date modelingPlanDate;
private Date modelingOutlookDate;
private Date modelingActualDate;
private Date structuralPlanDate;
private Date structuralOutlookDate;
private Date structuralActualDate;
private Date thermalPlanDate;
private Date thermalOutlookDate;
private Date thermalActualDate;
private Date drawingPlanDate;
private Date drawingOutlookDate;
private Date drawingActualDate;
private Date checkingPlanDate;
private Date checkingOutlookDate;
private Date checkingActualDate;
private String comments;
private String baseLine;

public GridData()
{
map = new HashMap<String, Object>();
}




public Map<String, Object> getProperties() {
System.out.println("get properties");
return map;
}


public Collection<String> getPropertyNames() {
System.out.println("get property names");
return map.keySet();
}



public Object get(String name)
{
return map.get(name);
}

public Object get(String name, Object value)
{
if(map.get(name) != null)
return map.get(name);
else
return "";
}
public void buildMap()
{
map.put("gridID", gridId);
map.put("docNumber", docNumber);
map.put("docDescription", docDescription);
map.put("udText1", udText1);
map.put("udText2", udText2);
map.put("docCode", docCode);
map.put("respEid", respEid);
map.put("respEngs", respEngs);
map.put("c5BidCode", c5BidCode);
map.put("modelingReuse", modelingReuse);
map.put("analysisReuse", analysisReuse);
map.put("drawingReuse", drawingReuse);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookSheetSize", outlookSheetSize);
map.put("outlookNumberOfTermination", outlookNumberOfTermination);
map.put("outlookSqFeet", effectiveSqFeet);
map.put("effectiveNumberOfTermination", effectiveNumberOfTermination);
map.put("modelingComplete", modelingComplete);
map.put("structualComplete", structualComplete);
map.put("thermalComplete", thermalComplete);
map.put("drawingComplete", drawingComplete);
map.put("drawingReuse", drawingReuse);
map.put("checkingComplete", checkingComplete);
map.put("actionDocument", actionDocument);
map.put("submittedPlanDate", submittedPlanDate);
map.put("submittedOutlookDate", submittedOutlookDate);
map.put("submittedActualDate", submittedActualDate);
map.put("CCBStart", CCBStart);
map.put("releasedPlanDate", releasedPlanDate);
map.put("releasedOutlookDate", releasedOutlookDate);
map.put("releasedActualDate", releasedActualDate);
map.put("iscNeedDate", iscNeedDate);
map.put("drawingNeedDate", drawingNeedDate);
map.put("deleted", deleted);
map.put("percentComplete", percentComplete);
map.put("udText3", udText3);
map.put("udText4", udText4);
map.put("udText5", udText5);
map.put("udText6", udText6);
map.put("udDate1", udDate1);
map.put("udDate2", udDate2);
map.put("modelingPlanDate", modelingPlanDate);
map.put("modelingOutlookDate", modelingOutlookDate);
map.put("modelingActualDate", modelingActualDate);
map.put("structuralPlanDate", structuralPlanDate);
map.put("structuralOutlookDate", structuralOutlookDate);
map.put("structuralActualDate", structuralActualDate);
map.put("thermalPlanDate", thermalPlanDate);
map.put("thermalOutlookDate", thermalOutlookDate);
map.put("thermalActualDate", thermalActualDate);
map.put("drawingPlanDate", drawingPlanDate);
map.put("drawingOutlookDate", drawingOutlookDate);
map.put("drawingActualDate", drawingActualDate);
map.put("checkingPlanDate", checkingPlanDate);
map.put("checkingOutlookDate", checkingOutlookDate);
map.put("checkingActualDate", checkingActualDate);
map.put("comments", comments);
map.put("baseLine", baseLine);
map.put("intraLinkFileName", intraLinkFileName);
map.put("header", header);
map.put("similarTo", similarTo);
map.put("rowId", rowId);
}

public void extractFromMap()
{
this.setGridId((String)map.get("gridId"));
this.setRowId((String)map.get("rowId"));
this.setDocNumber((String)map.get("docNumber"));
this.setDocDescription ((String)map.get("docDescription"));
this.setUdText1 ((String)map.get("udText1"));
this.setUdText2 ((String)map.get("udText2"));
this.setDocCode ((String)map.get("docCode"));
this.setRespEid ((String)map.get("respEid"));
this.setRespEngs ((String)map.get("respEngs"));
this.setModelingReuse ((String)map.get("modelingReuse"));
this.setAnalysisReuse ((String)map.get("analysisReuse"));
this.setDrawingReuse ((String)map.get("drawingReuse"));
this.setOutlookNumberOfSheets ((Integer)map.get("outlookNumberOfSheets"));
this.setOutlookNumberOfTermination ((Integer)map.get("outlookNumberOfTermination"));
this.setEffectiveSqFeet ((String)map.get("outlookSqFeet"));
this.setEffectiveNumberOfTermination ((String)map.get("effectiveNumberOfTermination"));
this.setModelingComplete ((String)map.get("modelingComplete"));
this.setDrawingReuse((String)map.get("drawingReuse"));
if(map.get("deleted") != null)
this.setDeleted(((Boolean)map.get("deleted")).booleanValue());
this.setDrawingNeedDate((String)map.get("drawingNeedDate"));
this.setPercentComplete ((String)map.get("percentComplete"));
this.setIscNeedDate((Date)map.get("iscNeedDate"));
this.setReleasedActualDate((Date)map.get("releasedActualDate"));
this.setReleasedOutlookDate ((Date)map.get("releasedOutlookDate"));
this.setReleasedPlanDate ((Date)map.get("releasedPlanDate"));
this.setCCBStart ((String)map.get("CCBStart"));
this.setSubmittedActualDate ((Date)map.get("submittedActualDate"));
this.setSubmittedOutlookDate ((Date)map.get("submittedOutlookDate"));
this.setSubmittedPlanDate ((Date)map.get("submittedPlanDate"));
this.setActionDocument ((String)map.get("actionDocument"));
this.setCheckingComplete ((String)map.get("checkingComplete"));
this.setDrawingComplete ((String)map.get("drawingComplete"));
this.setThermalComplete ((String)map.get("thermalComplete"));
this.setStructualComplete((String)map.get("structuralComplete"));
this.setModelingPlanDate((Date)map.get("modelingPlanDate"));
this.setModelingOutlookDate((Date)map.get("modelingOutlookDate"));
this.setModelingActualDate((Date)map.get("modelingActualDate"));
this.setThermalPlanDate((Date)map.get("thermalPlanDate"));
this.setThermalOutlookDate((Date)map.get("thermalOutlookDate"));
this.setThermalActualDate((Date)map.get("thermalActualDate"));
this.setStructuralPlanDate((Date)map.get("structuralPlanDate"));
this.setStructuralOutlookDate((Date)map.get("structuralOutlookDate"));
this.setStructuralActualDate((Date)map.get("structuralActualDate"));
this.setDrawingPlanDate((Date)map.get("drawingPlanDate"));
this.setDrawingOutlookDate((Date)map.get("drawingOutlookDate"));
this.setDrawingActualDate((Date)map.get("drawingActualDate"));
this.setCheckingPlanDate((Date)map.get("checkingPlanDate"));
this.setCheckingOutlookDate((Date)map.get("checkingOutlookDate"));
this.setCheckingActualDate((Date)map.get("checkingActualDate"));
this.setUdText3((String)map.get("udText3"));
this.setUdText4((String)map.get("udText4"));
this.setUdText5((String)map.get("udText5"));
this.setUdText6((String)map.get("udText6"));
this.setUdDate1((Date)map.get("udDate1"));
this.setUdDate2((Date)map.get("udDate2"));
this.setBaseLine((String) map.get("baseLine"));
this.setComments((String) map.get("comments"));
this.setIntraLinkFileName((String) map.get("intraLinkFileName"));
this.setHeader((String) map.get("header"));
this.setSimilarTo((String) map.get("similarTo"));

}

public String getDocNumber() {
return docNumber;
}
public void setDocNumber(String docNumber) {
this.docNumber = docNumber;
}
public String getDocDescription() {
return docDescription;
}
public void setDocDescription(String docDescription) {
this.docDescription = docDescription;
}
public String getUdText1() {
return udText1;
}
public void setUdText1(String udText1) {
this.udText1 = udText1;
}
public String getUdText2() {
return udText2;
}
public void setUdText2(String udText2) {
this.udText2 = udText2;
}
public String getDocCode() {
return docCode;
}
public void setDocCode(String docCode) {
this.docCode = docCode;
}
public String getRespEid() {
return respEid;
}
public void setRespEid(String respEid) {
this.respEid = respEid;
}
public String getRespEngs() {
return respEngs;
}
public void setRespEngs(String respEngs) {
this.respEngs = respEngs;
}
public String getC5BidCode() {
return c5BidCode;
}
public void setC5BidCode(String c5BidCode) {
this.c5BidCode = c5BidCode;
}
public String getModelingReuse() {
return modelingReuse;
}
public void setModelingReuse(String modelinReuse) {
this.modelingReuse = modelinReuse;
}

public String getAnalysisReuse() {
return analysisReuse;
}


public void setAnalysisReuse(String analysisReuse) {
this.analysisReuse = analysisReuse;
}

public String getDrawingReuse() {
return drawingReuse;
}

public void setDrawingReuse(String drawingReuse) {
this.drawingReuse = drawingReuse;
}


public int getOutlookNumberOfSheets() {
return outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(int outlookNumberOfSheets) {
this.outlookNumberOfSheets = outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(Integer outlookNumberOfSheets) {
if(outlookNumberOfSheets != null)
this.outlookNumberOfSheets = outlookNumberOfSheets.intValue();
}
public String getOutlookSheetSize() {
return outlookSheetSize;
}
public void setOutlookSheetSize(String outlookSheetSize) {
this.outlookSheetSize = outlookSheetSize;
}
public int getOutlookNumberOfTermination() {
return outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(int outlookNumberOfTermination) {
this.outlookNumberOfTermination = outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(Integer outlookNumberOfTermination) {
if(outlookNumberOfTermination != null)
this.outlookNumberOfTermination = outlookNumberOfTermination.intValue();
}
public String getEffectiveSqFeet() {
return effectiveSqFeet;
}
public void setEffectiveSqFeet(String outlookSqFeet) {
this.effectiveSqFeet = outlookSqFeet;
}
public String getEffectiveNumberOfTermination() {
return effectiveNumberOfTermination;
}
public void setEffectiveNumberOfTermination(String effectiveNumberOfTermination) {
this.effectiveNumberOfTermination = effectiveNumberOfTermination;
}
public String getModelingComplete() {
return modelingComplete;
}
public void setModelingComplete(String modelingComplete) {
this.modelingComplete = modelingComplete;
}
public String getStructualComplete() {
return structualComplete;
}
public void setStructualComplete(String structualComplete) {
this.structualComplete = structualComplete;
}
public String getThermalComplete() {
return thermalComplete;
}
public void setThermalComplete(String thermalComplete) {
this.thermalComplete = thermalComplete;
}
public String getDrawingComplete() {
return drawingComplete;
}
public void setDrawingComplete(String drawingComplete) {
this.drawingComplete = drawingComplete;
}
public String getCheckingComplete() {
return checkingComplete;
}
public void setCheckingComplete(String checkingComplete) {
this.checkingComplete = checkingComplete;
}
public String getActionDocument() {
return actionDocument;
}
public void setActionDocument(String actionDocument) {
this.actionDocument = actionDocument;
}
public Date getSubmittedPlanDate() {
return submittedPlanDate;
}
public void setSubmittedPlanDate(Date submittedPlanDate) {
this.submittedPlanDate = submittedPlanDate;
}
public Date getSubmittedOutlookDate() {
return submittedOutlookDate;
}
public void setSubmittedOutlookDate(Date submittedOutlookDate) {
this.submittedOutlookDate = submittedOutlookDate;
}
public Date getSubmittedActualDate() {
return submittedActualDate;
}
public void setSubmittedActualDate(Date submittedActualDate) {
this.submittedActualDate = submittedActualDate;
}
public String getCCBStart() {
return CCBStart;
}
public void setCCBStart(String cCBStart) {
CCBStart = cCBStart;
}
public Date getReleasedPlanDate() {
return releasedPlanDate;
}
public void setReleasedPlanDate(Date releasedPlanDate) {
this.releasedPlanDate = releasedPlanDate;
}
public Date getReleasedOutlookDate() {
return releasedOutlookDate;
}
public void setReleasedOutlookDate(Date releasedOutlookDate) {
this.releasedOutlookDate = releasedOutlookDate;
}
public Date getReleasedActualDate() {
return releasedActualDate;
}
public void setReleasedActualDate(Date releasedActualDate) {
this.releasedActualDate = releasedActualDate;
}
public Date getIscNeedDate() {
return iscNeedDate;
}
public void setIscNeedDate(Date iscNeedDate) {
this.iscNeedDate = iscNeedDate;
}
public String getDrawingNeedDate() {
return drawingNeedDate;
}
public void setDrawingNeedDate(String drawingNeedDate) {
this.drawingNeedDate = drawingNeedDate;
}
public void setDrawingNeedDate(Date drawingNeedDate) {
if(drawingNeedDate != null)
this.drawingNeedDate = drawingNeedDate.toGMTString();
}


public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public String getPercentComplete() {
return percentComplete;
}
public void setPercentComplete(String percentComplete) {
this.percentComplete = percentComplete;
}



public String getUdText3() {
return udText3;
}

public void setUdText3(String udText3) {
this.udText3 = udText3;
}

public String getUdText4() {
return udText4;
}

public void setUdText4(String udText4) {
this.udText4 = udText4;
}

public String getUdText5() {
return udText5;
}

public void setUdText5(String udText5) {
this.udText5 = udText5;
}

public String getUdText6() {
return udText6;
}

public void setUdText6(String udText6) {
this.udText6 = udText6;
}

public Date getUdDate1() {
return udDate1;
}

public void setUdDate1(Date udDate1) {
this.udDate1 = udDate1;
}

public Date getUdDate2() {
return udDate2;
}

public void setUdDate2(Date udDate2) {
this.udDate2 = udDate2;
}

public String getIntraLinkFileName() {
return intraLinkFileName;
}

public void setIntraLinkFileName(String intraLinkFileName) {
this.intraLinkFileName = intraLinkFileName;
}

public Date getModelingPlanDate() {
return modelingPlanDate;
}

public void setModelingPlanDate(Date modelingPlanDate) {
this.modelingPlanDate = modelingPlanDate;
}

public Date getModelingOutlookDate() {
return modelingOutlookDate;
}

public void setModelingOutlookDate(Date modelingOutlookDate) {
this.modelingOutlookDate = modelingOutlookDate;
}

public Date getModelingActualDate() {
return modelingActualDate;
}

public void setModelingActualDate(Date modelingActualDate) {
this.modelingActualDate = modelingActualDate;
}

public Date getStructuralPlanDate() {
return structuralPlanDate;
}

public void setStructuralPlanDate(Date structuralPlanDate) {
this.structuralPlanDate = structuralPlanDate;
}

public Date getStructuralOutlookDate() {
return structuralOutlookDate;
}

public void setStructuralOutlookDate(Date structuralOutlookDate) {
this.structuralOutlookDate = structuralOutlookDate;
}

public Date getStructuralActualDate() {
return structuralActualDate;
}

public void setStructuralActualDate(Date structualActualDate) {
this.structuralActualDate = structualActualDate;
}

public Date getThermalPlanDate() {
return thermalPlanDate;
}

public void setThermalPlanDate(Date thermalPlanDate) {
this.thermalPlanDate = thermalPlanDate;
}

public Date getThermalOutlookDate() {
return thermalOutlookDate;
}

public void setThermalOutlookDate(Date thermalOutlookDate) {
this.thermalOutlookDate = thermalOutlookDate;
}

public Date getThermalActualDate() {
return thermalActualDate;
}

public void setThermalActualDate(Date thermalActualDate) {
this.thermalActualDate = thermalActualDate;
}

public Date getCheckingPlanDate() {
return checkingPlanDate;
}

public void setCheckingPlanDate(Date checkingPlanDate) {
this.checkingPlanDate = checkingPlanDate;
}

public Date getCheckingOutlookDate() {
return checkingOutlookDate;
}

public void setCheckingOutlookDate(Date checkingOutlookDate) {
this.checkingOutlookDate = checkingOutlookDate;
}

public Date getCheckingActualDate() {
return checkingActualDate;
}

public void setCheckingActualDate(Date checkingActualDate) {
this.checkingActualDate = checkingActualDate;
}


public Date getDrawingPlanDate() {
return drawingPlanDate;
}

public void setDrawingPlanDate(Date drawingPlanDate) {
this.drawingPlanDate = drawingPlanDate;
}

public Date getDrawingOutlookDate() {
return drawingOutlookDate;
}

public void setDrawingOutlookDate(Date drawingOutlookDate) {
this.drawingOutlookDate = drawingOutlookDate;
}

public Date getDrawingActualDate() {
return drawingActualDate;
}

public void setDrawingActualDate(Date drawingActualDate) {
this.drawingActualDate = drawingActualDate;
}



public String getComments() {
return comments;
}

public void setComments(String comments) {
this.comments = comments;
}

public String getBaseLine() {
return baseLine;
}

public void setBaseLine(String baseLine) {
this.baseLine = baseLine;
}



public String getHeader() {
return header;
}

public void setHeader(String header) {
this.header = header;
}

public String getSimilarTo() {
return similarTo;
}

public void setSimilarTo(String similarTo) {
this.similarTo = similarTo;
}



public String getGridId() {
return gridId;
}

public void setGridId(String gridId) {
this.gridId = gridId;
}

public String getRowId() {
return rowId;
}

public void setRowId(String rowId) {
this.rowId = rowId;
}

public HashMap<String, Object> getMap()
{
return map;
}


public void setData(ModelData data)
{
if((data == null) || (data.getPropertyNames() == null ))
{
System.out.println("Data was null");
return;
}
Iterator<String> iter = data.getPropertyNames().iterator();
while(iter.hasNext())
{
String name = iter.next();
map.put(name, data.get(name));
}
this.extractFromMap();
}

public String toString()
{
Iterator<String> iter = map.keySet().iterator();
StringBuilder result = new StringBuilder();
while(iter.hasNext())
{
String name = iter.next();
result.append(name + " = " + map.get(name) + "\n");
}
return result.toString();
}






}

Arno.Nyhm
15 Jan 2010, 9:02 AM
it would be nice if your example is more standalone (in one class with EntryPoint) otherwise nobody can replay your example...

darkling235
16 Jan 2010, 5:38 AM
The problem is that my system is roughly 100 classes. I'll include all the Grid relevant portions. The Grid only appears on a popup screen so nothing else should really be effecting it. I included a dummy entry point that will let you run it correctly. There will be no data to access of course since you don't have my DB but the problem exists if you just try to add a row. Try entering data and watch it vanish. I believe I commented out all the DB references so things should run just fine. In any case I don't believe the problem with my grid involved the server at all since we don;t ever seem to talk to it after our initial fetch. I've tried running it in this dummy entry point and confirmed the problem still exists, on my machine at least. I've labeled all the relevant code chunks below.

Thanks in advance for any advice.


THE GRID


package com.ray.adt.client.grid;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.Style;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.DataProxy;
import com.extjs.gxt.ui.client.data.DataReader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.RowEditorEvent;
import com.extjs.gxt.ui.client.event.ScrollListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.store.StoreListener;
import com.extjs.gxt.ui.client.store.Record.RecordUpdate;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.RowEditor;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.selection.SelectionModel;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.ray.adt.client.error.ErrorScreen;
import com.ray.adt.client.listGrid.Resources;

public class Grid extends LayoutContainer
{

private GridDataServiceAsync GridDataService = GWT.create(GridDataService.class);
private ListStore<GridData> store;
private ErrorScreen errors;
private Record currentRecord;
private int currentRow;
private int userRole;
private int gridRole;
private String gridID;
private EditorGrid<GridData> grid;
private ColumnModel cm;
private ContentPanel cp;
private CellEditor editor;
private BasePagingLoader loader;
public Grid(ErrorScreen e)
{
errors = e;
}

protected void onRender(Element parent, int index)
{
super.onRender(parent, index);

setLayout(new FlowLayout(10));
//this.setSize("200%", "200%");
cp = new ContentPanel();
cp.setHeading("Edit Grid");
cp.setFrame(true);
cp.setIcon(Resources.ICONS.table());
cp.setSize(1200, 500);
cp.setLayout(new FlowLayout());
cp.setScrollMode(Style.Scroll.ALWAYS);


List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

RpcProxy<PagingLoadResult<GridData>> proxy = new RpcProxy<PagingLoadResult<GridData>>() {
@Override
public void load(Object loadConfig, AsyncCallback<PagingLoadResult<GridData>> callback) {
PagingLoadConfig pagingConfig = (PagingLoadConfig) loadConfig;
GridDataService.fetchGridData(gridID, pagingConfig.getOffset(), callback);
}
};

loader = new BasePagingLoader(proxy);
store = new ListStore<GridData>(loader);
store.setMonitorChanges(true);
store.addStoreListener(new StoreListener<GridData>()
{

public void handleEvent(StoreEvent<GridData> event)
{
Record record = event.getRecord();

if(event.getOperation() == RecordUpdate.EDIT)
{
//not sure what I need to do here
}

if(event.getOperation() == RecordUpdate.COMMIT)
{
GridData gridData = new GridData();
gridData.setData(record.getModel());
System.out.println(gridData.toString());

GridDataService.updateGridData(gridData,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
errors.setErrorText("Error updating grid row");
}

public void onSuccess(Void result) {
}
});

}




}

});



cm = new ColumnModel(configs);
grid = new EditorGrid<GridData>(store, cm);
grid.setSelectionModel(new GridSelectionModel<GridData>());
grid.setSize(1000, 300);
grid.addListener(Events.Attach, new Listener<GridEvent<GridData>>() {
public void handleEvent(GridEvent<GridData> be) {
PagingLoadConfig config = new BasePagingLoadConfig();
config.setOffset(0);
config.setLimit(10);

Map<String, Object> state = grid.getState();
if (state.containsKey("offset")) {
int offset = (Integer)state.get("offset");
int limit = (Integer)state.get("limit");
config.setOffset(offset);
config.setLimit(limit);
}
if (state.containsKey("sortField")) {
config.setSortField((String)state.get("sortField"));
//config.setSortDir(SortDir.valueOf((String)state.get("sortDir")));
}
loader.load(config);
}
});



/* grid.addListener(Events.BeforeEdit, new Listener<GridEvent<?>>() {
public void handleEvent(GridEvent<?> gridEvent) {
gridEvent.setCancelled(isAuthorized(userRole, gridRole));
}
});*/

configs.add(this.makeTextField("docNumber", "Document Number"));
configs.add(this.makeTextField("docDescription", "Document Description"));
configs.add(this.makeTextField("docCode", "Doc Code"));
configs.add(this.makeTextField("respEid", "Resp Eng EIDs"));
configs.add(this.makeTextField("respEngs", "Resp Engs"));
configs.add(this.makeC5Field("c5BidCode", "C5 Bid Code"));
configs.add(this.makeTextField("modelingReuse", "Modeling Reuse"));
configs.add(this.makeDateField("modelingPlanDate", "Modeling Plan Date"));
configs.add(this.makeDateField("modelingOutlookDate", "Modeling Outlook Date"));
configs.add(this.makeDateField("modelingActualDate", "Modeling Actual Date"));
configs.add(this.makeTextField("analysisReuse", "Analysis Reuse"));
configs.add(this.makeTextField("drawingReuse", "Drawing Reuse"));
configs.add(this.makeDateField("drawingPlanDate", "Drawing Plan Date"));
configs.add(this.makeDateField("drawingOutlookDate", "Drawing Outlook Date"));
configs.add(this.makeDateField("drawingActualDate", "Drawing Actual Date"));
//configs.add(this.makeTextField("thermalReuse", "Thermal Reuse"));
configs.add(this.makeDateField("thermalPlanDate", "Thermal Plan Date"));
configs.add(this.makeDateField("thermalOutlookDate", "Thermal Outlook Date"));
configs.add(this.makeDateField("thermalActualDate", "Thermal Actual Date"));
configs.add(this.makeTextField("outlookNumberOfSheets", "Outlook Number of Sheets"));
configs.add(this.makeOutlookSheetField("outlookSheetSize", "Outlook Sheet Size"));
configs.add(this.makeTextField("outlookNumber of Termination", "Outlook Number of Termination"));
configs.add(this.makeTextField("effectiveSqFeet", "Effective Outlook Square Feet"));
configs.add(this.makeTextField("effectiveNumberOfTermination", "Effective Number of Termination"));
configs.add(this.makePercent("modelingComplete", "Modeling Complete"));
configs.add(this.makePercent("structualComplete", "Structural Complete"));
configs.add(this.makePercent("thermalComplete", "Thermal Complete"));
configs.add(this.makePercent("drawingComplete", "Drawing Complete"));
configs.add(this.makePercent("checkingComplete", "Checking Complete"));
configs.add(this.makeTextField("actionDocument", "Action Document"));
configs.add(this.makeDateField("submittedPlanDate", "Submitted Plan Date"));
configs.add(this.makeDateField("submittedOutlookDate", "Submitted Outlook Date"));
configs.add(this.makeDateField("submittedActualDate", "Submitted Actual Date"));
configs.add(this.makeTextField("CCBStart", "CCB Start"));
configs.add(this.makeDateField("releasedPlanDate", "Released Plan Date"));
configs.add(this.makeDateField("releasedOutlookDate", "Released Outlook Date"));
configs.add(this.makeDateField("releasedActualDate", "Released Actual Date"));
configs.add(this.makeTextField("iscNeedDate", "ISC Need Date"));
configs.add(this.makeTextField("drawingNeedDate", "Drawing Need Date"));
configs.add(this.makeTextField("udText1", "UDText1"));
configs.add(this.makeTextField("udText2", "UDText2"));
configs.add(this.makeTextField("udText3", "UDText3"));
configs.add(this.makeTextField("udText4", "UDText4"));
configs.add(this.makeTextField("udText5", "UDText5"));
configs.add(this.makeTextField("udText6", "UDText6"));
configs.add(this.makeDateField("udDate1", "UDDate1"));
configs.add(this.makeDateField("udDate2", "UDDate2"));
configs.add(this.makeCheckBox("deleted", "Deleted"));
configs.add(this.makeTextField("percentComplete", "%Complete"));








grid.setBorders(true);
cp.add(grid);

PagingToolBar toolBar = new PagingToolBar(50);
toolBar.bind(loader);
Button add = new Button("Add Row");
add.addSelectionListener(new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
GridData data = new GridData();
grid.stopEditing();
store.insert(data, 0);
grid.startEditing(0, 0);

}

});
toolBar.add(add);
cp.setTopComponent(toolBar);

cp.setButtonAlign(HorizontalAlignment.CENTER);
cp.addButton(new Button("Reset", new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
store.rejectChanges();
}
}));

cp.addButton(new Button("Save", new SelectionListener<ButtonEvent>() {


public void componentSelected(ButtonEvent ce) {
store.commitChanges();
}
}));


add(cp);

}

protected ColumnConfig makeTextField(String id, String name)
{
ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);


TextField<String> field = new TextField<String>();
field.setAllowBlank(true);
column.setEditor(new CellEditor(field));
return column;

}

protected ColumnConfig makeCheckBox(String id, String name)
{
CheckColumnConfig checkColumn = new CheckColumnConfig(id, name, 55);
checkColumn.setId(id);
checkColumn.setHeader(name);
grid.addPlugin(checkColumn);
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
checkColumn.setEditor(checkBoxEditor);

return checkColumn;
}

protected ColumnConfig makeDateField(String id, String name)
{
DateField dateField = new DateField();
dateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat("MM/dd/y"));

ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(95);
column.setEditor(new CellEditor(dateField));
column.setDateTimeFormat(DateTimeFormat.getMediumDateFormat());
return column;
}

protected ColumnConfig makeC5Field(String id, String name)
{
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.add("DHB");
combo.add("DDC");
combo.add("DEC");
combo.add("AD");
combo.add("AE");
combo.add("AH");
combo.add("BD");
combo.add("BE");
combo.add("BH");
combo.add("DDB");
combo.add("DEB");
combo.add("DGA");
combo.add("HAA");
combo.add("HBA");
combo.add("Other");

ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(95);

CellEditor typeComboEditor = new CellEditor(combo) {

public Object preProcessValue(Object value) {
if (value == null) {
return value;
}
return combo.findModel(value.toString());
}


public Object postProcessValue(Object value) {
if (value == null) {
return value;
}
return ((ModelData) value).get("value");
}
};


column.setEditor(typeComboEditor);
return column;
}

protected ColumnConfig makeOutlookSheetField(String id, String name)
{
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.add("A");
combo.add("B");
combo.add("C");
combo.add("D");
combo.add("E");


ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);

CellEditor typeComboEditor = new CellEditor(combo) {

public Object preProcessValue(Object value) {
if (value == null) {
return value;
}
return combo.findModel(value.toString());
}


public Object postProcessValue(Object value) {
if (value == null) {
return value;
}
return ((ModelData) value).get("value");
}
};

column.setEditor(typeComboEditor);
return column;
}


protected ColumnConfig makePercent(String id, String name)
{
NumberField field = new NumberField();
field.setMaxValue(100);
field.setMinValue(0);
field.setAllowDecimals(true);
field.setAllowNegative(false);
ColumnConfig column = new ColumnConfig();
column.setId(id);
column.setHeader(name);
column.setWidth(220);
column.setEditor(new CellEditor(field));
return column;
}

public void fetch(String key)
{
gridID = key;
/*GridDataService.fetchGridData(key, 0, 50, new AsyncCallback<PagingLoadResult<GridData>>(){


public void onFailure(Throwable caught) {
errors.setErrorText("Failure to fetch grid");

}


public void onSuccess(PagingLoadResult<GridData> result) {
store.add(result.getData());
grid.reconfigure(store, cm);
//for(int x = 0; x < store.getCount(); x++)
//System.out.println(store.getAt(x).toString());
grid.getView().refresh(false);
}



});*/
}

private boolean isAuthorized(int userRole, int gridRole)
{
return false;
}

public ListStore<GridData>getStore()
{
return store;
}

public String getGridId()
{
return gridID;
}

}

MODEL



package com.ray.adt.client.grid;
import java.io.Serializable;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;



public class GridData extends BaseModelData implements Serializable, ModelData
{

/**
*
*/
private static final long serialVersionUID = 1L;
private String gridId;
private String rowId;
private String docNumber;
private String docDescription;
private String udText1;
private String udText2;
private String docCode;
private String respEid;
private String respEngs;
private String c5BidCode;
private String modelingReuse;
private String analysisReuse;
private String drawingReuse;
private int outlookNumberOfSheets;
private String outlookSheetSize;
private int outlookNumberOfTermination;
private String effectiveSqFeet;
private String effectiveNumberOfTermination;
private String modelingComplete;
private String structualComplete;
private String thermalComplete;
private String drawingComplete;
private String checkingComplete;
private String actionDocument;
private Date submittedPlanDate;
private Date submittedOutlookDate;
private Date submittedActualDate;
private String CCBStart;
private Date releasedPlanDate;
private Date releasedOutlookDate;
private Date releasedActualDate;
private Date iscNeedDate;
private String drawingNeedDate;
private boolean deleted;
private String percentComplete;
private HashMap<String, Object> map;

private String header;
private String similarTo;
private String udText3;
private String udText4;
private String udText5;
private String udText6;
private Date udDate1;
private Date udDate2;
private String intraLinkFileName;
private Date modelingPlanDate;
private Date modelingOutlookDate;
private Date modelingActualDate;
private Date structuralPlanDate;
private Date structuralOutlookDate;
private Date structuralActualDate;
private Date thermalPlanDate;
private Date thermalOutlookDate;
private Date thermalActualDate;
private Date drawingPlanDate;
private Date drawingOutlookDate;
private Date drawingActualDate;
private Date checkingPlanDate;
private Date checkingOutlookDate;
private Date checkingActualDate;
private String comments;
private String baseLine;

public GridData()
{
map = new HashMap<String, Object>();
}




public Map<String, Object> getProperties() {
System.out.println("get properties");
return map;
}


public Collection<String> getPropertyNames() {
System.out.println("get property names");
return map.keySet();
}



public Object get(String name)
{
return map.get(name);
}

public Object get(String name, Object value)
{
if(map.get(name) != null)
return map.get(name);
else
return "";
}

public void buildMap()
{
map.put("gridID", gridId);
map.put("docNumber", docNumber);
map.put("docDescription", docDescription);
map.put("udText1", udText1);
map.put("udText2", udText2);
map.put("docCode", docCode);
map.put("respEid", respEid);
map.put("respEngs", respEngs);
map.put("c5BidCode", c5BidCode);
map.put("modelingReuse", modelingReuse);
map.put("analysisReuse", analysisReuse);
map.put("drawingReuse", drawingReuse);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookSheetSize", outlookSheetSize);
map.put("outlookNumberOfTermination", outlookNumberOfTermination);
map.put("outlookSqFeet", effectiveSqFeet);
map.put("effectiveNumberOfTermination", effectiveNumberOfTermination);
map.put("modelingComplete", modelingComplete);
map.put("structualComplete", structualComplete);
map.put("thermalComplete", thermalComplete);
map.put("drawingComplete", drawingComplete);
map.put("drawingReuse", drawingReuse);
map.put("checkingComplete", checkingComplete);
map.put("actionDocument", actionDocument);
map.put("submittedPlanDate", submittedPlanDate);
map.put("submittedOutlookDate", submittedOutlookDate);
map.put("submittedActualDate", submittedActualDate);
map.put("CCBStart", CCBStart);
map.put("releasedPlanDate", releasedPlanDate);
map.put("releasedOutlookDate", releasedOutlookDate);
map.put("releasedActualDate", releasedActualDate);
map.put("iscNeedDate", iscNeedDate);
map.put("drawingNeedDate", drawingNeedDate);
map.put("deleted", deleted);
map.put("percentComplete", percentComplete);
map.put("udText3", udText3);
map.put("udText4", udText4);
map.put("udText5", udText5);
map.put("udText6", udText6);
map.put("udDate1", udDate1);
map.put("udDate2", udDate2);
map.put("modelingPlanDate", modelingPlanDate);
map.put("modelingOutlookDate", modelingOutlookDate);
map.put("modelingActualDate", modelingActualDate);
map.put("structuralPlanDate", structuralPlanDate);
map.put("structuralOutlookDate", structuralOutlookDate);
map.put("structuralActualDate", structuralActualDate);
map.put("thermalPlanDate", thermalPlanDate);
map.put("thermalOutlookDate", thermalOutlookDate);
map.put("thermalActualDate", thermalActualDate);
map.put("drawingPlanDate", drawingPlanDate);
map.put("drawingOutlookDate", drawingOutlookDate);
map.put("drawingActualDate", drawingActualDate);
map.put("checkingPlanDate", checkingPlanDate);
map.put("checkingOutlookDate", checkingOutlookDate);
map.put("checkingActualDate", checkingActualDate);
map.put("comments", comments);
map.put("baseLine", baseLine);
map.put("intraLinkFileName", intraLinkFileName);
map.put("header", header);
map.put("similarTo", similarTo);
map.put("rowId", rowId);
}

public void extractFromMap()
{
this.setGridId((String)map.get("gridId"));
this.setRowId((String)map.get("rowId"));
this.setDocNumber((String)map.get("docNumber"));
this.setDocDescription ((String)map.get("docDescription"));
this.setUdText1 ((String)map.get("udText1"));
this.setUdText2 ((String)map.get("udText2"));
this.setDocCode ((String)map.get("docCode"));
this.setRespEid ((String)map.get("respEid"));
this.setRespEngs ((String)map.get("respEngs"));
this.setModelingReuse ((String)map.get("modelingReuse"));
this.setAnalysisReuse ((String)map.get("analysisReuse"));
this.setDrawingReuse ((String)map.get("drawingReuse"));
this.setOutlookNumberOfSheets ((Integer)map.get("outlookNumberOfSheets"));
this.setOutlookNumberOfTermination ((Integer)map.get("outlookNumberOfTermination"));
this.setEffectiveSqFeet ((String)map.get("outlookSqFeet"));
this.setEffectiveNumberOfTermination ((String)map.get("effectiveNumberOfTermination"));
this.setModelingComplete ((String)map.get("modelingComplete"));
this.setDrawingReuse((String)map.get("drawingReuse"));
if(map.get("deleted") != null)
this.setDeleted(((Boolean)map.get("deleted")).booleanValue());
this.setDrawingNeedDate((String)map.get("drawingNeedDate"));
this.setPercentComplete ((String)map.get("percentComplete"));
this.setIscNeedDate((Date)map.get("iscNeedDate"));
this.setReleasedActualDate((Date)map.get("releasedActualDate"));
this.setReleasedOutlookDate ((Date)map.get("releasedOutlookDate"));
this.setReleasedPlanDate ((Date)map.get("releasedPlanDate"));
this.setCCBStart ((String)map.get("CCBStart"));
this.setSubmittedActualDate ((Date)map.get("submittedActualDate"));
this.setSubmittedOutlookDate ((Date)map.get("submittedOutlookDate"));
this.setSubmittedPlanDate ((Date)map.get("submittedPlanDate"));
this.setActionDocument ((String)map.get("actionDocument"));
this.setCheckingComplete ((String)map.get("checkingComplete"));
this.setDrawingComplete ((String)map.get("drawingComplete"));
this.setThermalComplete ((String)map.get("thermalComplete"));
this.setStructualComplete((String)map.get("structuralComplete"));
this.setModelingPlanDate((Date)map.get("modelingPlanDate"));
this.setModelingOutlookDate((Date)map.get("modelingOutlookDate"));
this.setModelingActualDate((Date)map.get("modelingActualDate"));
this.setThermalPlanDate((Date)map.get("thermalPlanDate"));
this.setThermalOutlookDate((Date)map.get("thermalOutlookDate"));
this.setThermalActualDate((Date)map.get("thermalActualDate"));
this.setStructuralPlanDate((Date)map.get("structuralPlanDate"));
this.setStructuralOutlookDate((Date)map.get("structuralOutlookDate"));
this.setStructuralActualDate((Date)map.get("structuralActualDate"));
this.setDrawingPlanDate((Date)map.get("drawingPlanDate"));
this.setDrawingOutlookDate((Date)map.get("drawingOutlookDate"));
this.setDrawingActualDate((Date)map.get("drawingActualDate"));
this.setCheckingPlanDate((Date)map.get("checkingPlanDate"));
this.setCheckingOutlookDate((Date)map.get("checkingOutlookDate"));
this.setCheckingActualDate((Date)map.get("checkingActualDate"));
this.setUdText3((String)map.get("udText3"));
this.setUdText4((String)map.get("udText4"));
this.setUdText5((String)map.get("udText5"));
this.setUdText6((String)map.get("udText6"));
this.setUdDate1((Date)map.get("udDate1"));
this.setUdDate2((Date)map.get("udDate2"));
this.setBaseLine((String) map.get("baseLine"));
this.setComments((String) map.get("comments"));
this.setIntraLinkFileName((String) map.get("intraLinkFileName"));
this.setHeader((String) map.get("header"));
this.setSimilarTo((String) map.get("similarTo"));

}

public String getDocNumber() {
return docNumber;
}
public void setDocNumber(String docNumber) {
this.docNumber = docNumber;
}
public String getDocDescription() {
return docDescription;
}
public void setDocDescription(String docDescription) {
this.docDescription = docDescription;
}
public String getUdText1() {
return udText1;
}
public void setUdText1(String udText1) {
this.udText1 = udText1;
}
public String getUdText2() {
return udText2;
}
public void setUdText2(String udText2) {
this.udText2 = udText2;
}
public String getDocCode() {
return docCode;
}
public void setDocCode(String docCode) {
this.docCode = docCode;
}
public String getRespEid() {
return respEid;
}
public void setRespEid(String respEid) {
this.respEid = respEid;
}
public String getRespEngs() {
return respEngs;
}
public void setRespEngs(String respEngs) {
this.respEngs = respEngs;
}
public String getC5BidCode() {
return c5BidCode;
}
public void setC5BidCode(String c5BidCode) {
this.c5BidCode = c5BidCode;
}
public String getModelingReuse() {
return modelingReuse;
}
public void setModelingReuse(String modelinReuse) {
this.modelingReuse = modelinReuse;
}

public String getAnalysisReuse() {
return analysisReuse;
}


public void setAnalysisReuse(String analysisReuse) {
this.analysisReuse = analysisReuse;
}

public String getDrawingReuse() {
return drawingReuse;
}

public void setDrawingReuse(String drawingReuse) {
this.drawingReuse = drawingReuse;
}


public int getOutlookNumberOfSheets() {
return outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(int outlookNumberOfSheets) {
this.outlookNumberOfSheets = outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(Integer outlookNumberOfSheets) {
if(outlookNumberOfSheets != null)
this.outlookNumberOfSheets = outlookNumberOfSheets.intValue();
}
public String getOutlookSheetSize() {
return outlookSheetSize;
}
public void setOutlookSheetSize(String outlookSheetSize) {
this.outlookSheetSize = outlookSheetSize;
}
public int getOutlookNumberOfTermination() {
return outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(int outlookNumberOfTermination) {
this.outlookNumberOfTermination = outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(Integer outlookNumberOfTermination) {
if(outlookNumberOfTermination != null)
this.outlookNumberOfTermination = outlookNumberOfTermination.intValue();
}
public String getEffectiveSqFeet() {
return effectiveSqFeet;
}
public void setEffectiveSqFeet(String outlookSqFeet) {
this.effectiveSqFeet = outlookSqFeet;
}
public String getEffectiveNumberOfTermination() {
return effectiveNumberOfTermination;
}
public void setEffectiveNumberOfTermination(String effectiveNumberOfTermination) {
this.effectiveNumberOfTermination = effectiveNumberOfTermination;
}
public String getModelingComplete() {
return modelingComplete;
}
public void setModelingComplete(String modelingComplete) {
this.modelingComplete = modelingComplete;
}
public String getStructualComplete() {
return structualComplete;
}
public void setStructualComplete(String structualComplete) {
this.structualComplete = structualComplete;
}
public String getThermalComplete() {
return thermalComplete;
}
public void setThermalComplete(String thermalComplete) {
this.thermalComplete = thermalComplete;
}
public String getDrawingComplete() {
return drawingComplete;
}
public void setDrawingComplete(String drawingComplete) {
this.drawingComplete = drawingComplete;
}
public String getCheckingComplete() {
return checkingComplete;
}
public void setCheckingComplete(String checkingComplete) {
this.checkingComplete = checkingComplete;
}
public String getActionDocument() {
return actionDocument;
}
public void setActionDocument(String actionDocument) {
this.actionDocument = actionDocument;
}
public Date getSubmittedPlanDate() {
return submittedPlanDate;
}
public void setSubmittedPlanDate(Date submittedPlanDate) {
this.submittedPlanDate = submittedPlanDate;
}
public Date getSubmittedOutlookDate() {
return submittedOutlookDate;
}
public void setSubmittedOutlookDate(Date submittedOutlookDate) {
this.submittedOutlookDate = submittedOutlookDate;
}
public Date getSubmittedActualDate() {
return submittedActualDate;
}
public void setSubmittedActualDate(Date submittedActualDate) {
this.submittedActualDate = submittedActualDate;
}
public String getCCBStart() {
return CCBStart;
}
public void setCCBStart(String cCBStart) {
CCBStart = cCBStart;
}
public Date getReleasedPlanDate() {
return releasedPlanDate;
}
public void setReleasedPlanDate(Date releasedPlanDate) {
this.releasedPlanDate = releasedPlanDate;
}
public Date getReleasedOutlookDate() {
return releasedOutlookDate;
}
public void setReleasedOutlookDate(Date releasedOutlookDate) {
this.releasedOutlookDate = releasedOutlookDate;
}
public Date getReleasedActualDate() {
return releasedActualDate;
}
public void setReleasedActualDate(Date releasedActualDate) {
this.releasedActualDate = releasedActualDate;
}
public Date getIscNeedDate() {
return iscNeedDate;
}
public void setIscNeedDate(Date iscNeedDate) {
this.iscNeedDate = iscNeedDate;
}
public String getDrawingNeedDate() {
return drawingNeedDate;
}
public void setDrawingNeedDate(String drawingNeedDate) {
this.drawingNeedDate = drawingNeedDate;
}
public void setDrawingNeedDate(Date drawingNeedDate) {
if(drawingNeedDate != null)
this.drawingNeedDate = drawingNeedDate.toGMTString();
}


public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public String getPercentComplete() {
return percentComplete;
}
public void setPercentComplete(String percentComplete) {
this.percentComplete = percentComplete;
}



public String getUdText3() {
return udText3;
}

public void setUdText3(String udText3) {
this.udText3 = udText3;
}

public String getUdText4() {
return udText4;
}

public void setUdText4(String udText4) {
this.udText4 = udText4;
}

public String getUdText5() {
return udText5;
}

public void setUdText5(String udText5) {
this.udText5 = udText5;
}

public String getUdText6() {
return udText6;
}

public void setUdText6(String udText6) {
this.udText6 = udText6;
}

public Date getUdDate1() {
return udDate1;
}

public void setUdDate1(Date udDate1) {
this.udDate1 = udDate1;
}

public Date getUdDate2() {
return udDate2;
}

public void setUdDate2(Date udDate2) {
this.udDate2 = udDate2;
}

public String getIntraLinkFileName() {
return intraLinkFileName;
}

public void setIntraLinkFileName(String intraLinkFileName) {
this.intraLinkFileName = intraLinkFileName;
}

public Date getModelingPlanDate() {
return modelingPlanDate;
}

public void setModelingPlanDate(Date modelingPlanDate) {
this.modelingPlanDate = modelingPlanDate;
}

public Date getModelingOutlookDate() {
return modelingOutlookDate;
}

public void setModelingOutlookDate(Date modelingOutlookDate) {
this.modelingOutlookDate = modelingOutlookDate;
}

public Date getModelingActualDate() {
return modelingActualDate;
}

public void setModelingActualDate(Date modelingActualDate) {
this.modelingActualDate = modelingActualDate;
}

public Date getStructuralPlanDate() {
return structuralPlanDate;
}

public void setStructuralPlanDate(Date structuralPlanDate) {
this.structuralPlanDate = structuralPlanDate;
}

public Date getStructuralOutlookDate() {
return structuralOutlookDate;
}

public void setStructuralOutlookDate(Date structuralOutlookDate) {
this.structuralOutlookDate = structuralOutlookDate;
}

public Date getStructuralActualDate() {
return structuralActualDate;
}

public void setStructuralActualDate(Date structualActualDate) {
this.structuralActualDate = structualActualDate;
}

public Date getThermalPlanDate() {
return thermalPlanDate;
}

public void setThermalPlanDate(Date thermalPlanDate) {
this.thermalPlanDate = thermalPlanDate;
}

public Date getThermalOutlookDate() {
return thermalOutlookDate;
}

public void setThermalOutlookDate(Date thermalOutlookDate) {
this.thermalOutlookDate = thermalOutlookDate;
}

public Date getThermalActualDate() {
return thermalActualDate;
}

public void setThermalActualDate(Date thermalActualDate) {
this.thermalActualDate = thermalActualDate;
}

public Date getCheckingPlanDate() {
return checkingPlanDate;
}

public void setCheckingPlanDate(Date checkingPlanDate) {
this.checkingPlanDate = checkingPlanDate;
}

public Date getCheckingOutlookDate() {
return checkingOutlookDate;
}

public void setCheckingOutlookDate(Date checkingOutlookDate) {
this.checkingOutlookDate = checkingOutlookDate;
}

public Date getCheckingActualDate() {
return checkingActualDate;
}

public void setCheckingActualDate(Date checkingActualDate) {
this.checkingActualDate = checkingActualDate;
}


public Date getDrawingPlanDate() {
return drawingPlanDate;
}

public void setDrawingPlanDate(Date drawingPlanDate) {
this.drawingPlanDate = drawingPlanDate;
}

public Date getDrawingOutlookDate() {
return drawingOutlookDate;
}

public void setDrawingOutlookDate(Date drawingOutlookDate) {
this.drawingOutlookDate = drawingOutlookDate;
}

public Date getDrawingActualDate() {
return drawingActualDate;
}

public void setDrawingActualDate(Date drawingActualDate) {
this.drawingActualDate = drawingActualDate;
}



public String getComments() {
return comments;
}

public void setComments(String comments) {
this.comments = comments;
}

public String getBaseLine() {
return baseLine;
}

public void setBaseLine(String baseLine) {
this.baseLine = baseLine;
}



public String getHeader() {
return header;
}

public void setHeader(String header) {
this.header = header;
}

public String getSimilarTo() {
return similarTo;
}

public void setSimilarTo(String similarTo) {
this.similarTo = similarTo;
}



public String getGridId() {
return gridId;
}

public void setGridId(String gridId) {
this.gridId = gridId;
}

public String getRowId() {
return rowId;
}

public void setRowId(String rowId) {
this.rowId = rowId;
}

public HashMap<String, Object> getMap()
{
return map;
}


public void setData(ModelData data)
{
if((data == null) || (data.getPropertyNames() == null ))
{
System.out.println("Data was null");
return;
}
Iterator<String> iter = data.getPropertyNames().iterator();
while(iter.hasNext())
{
String name = iter.next();
map.put(name, data.get(name));
}
this.extractFromMap();
}

public String toString()
{
Iterator<String> iter = map.keySet().iterator();
StringBuilder result = new StringBuilder();
while(iter.hasNext())
{
String name = iter.next();
result.append(name + " = " + map.get(name) + "\n");
}
return result.toString();
}






}

SERVICE


package com.ray.adt.client.grid;

import java.util.List;

import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("GridData")
public interface GridDataService extends RemoteService
{
public void addGridData(GridData data);

public void updateGridData(GridData data);

//public void removeGridData(GridData data);

public List<GridData> fetchGridData(String key);

public PagingLoadResult<GridData> fetchGridData(String key, int min);

}

ASYNC SERVICE


public interface GridDataServiceAsync {

void fetchGridData(String key, AsyncCallback<List<GridData>> callback);
void fetchGridData(String key, int min, AsyncCallback<PagingLoadResult<GridData>> callback);

void addGridData(GridData data, AsyncCallback<Void> callback);

void updateGridData(GridData data, AsyncCallback<Void> callback);

//void removeGridData(GridData data, AsyncCallback<Void> callback);

}

POPUP SCREEN FOR GRID



package com.ray.adt.client.grid;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.ray.adt.client.downloadFile.FileDownloadPanel;
import com.ray.adt.client.downloadFile.FileDownloadService;
import com.ray.adt.client.downloadFile.FileDownloadServiceAsync;
import com.ray.adt.client.error.ErrorScreen;
import com.ray.adt.client.filter.Filter;
import com.ray.adt.client.filter.FilterService;
import com.ray.adt.client.filter.FilterServiceAsync;
import com.ray.adt.client.weight.WeightWidget;

public class GridScreen extends PopupPanel
{

private WeightWidget weights;
private String gridID;
private Button close;
private Button updateWeights;
private Button export;
private Button baseline;
private Button calculations;
private Grid grid;
private ErrorScreen errors;
private Filter filter;
private VerticalPanel dialogVPanel;
private GridScreen screen;
private FileDownloadServiceAsync fileService = GWT.create(FileDownloadService.class);
private FileDownloadPanel filePanel;


public GridScreen(ErrorScreen e)
{
screen = this;
this.setSize("100%", "100%");
close = new Button("Close");
close.addClickHandler( new ClickHandler(){

public void onClick(ClickEvent event) {
screen.hide();
}});
dialogVPanel = new VerticalPanel();
weights = new WeightWidget(e);
grid = new Grid(e);
filter = new Filter(e, grid.getStore());
errors = e;
updateWeights = new Button("Update Grid Weights");
updateWeights.addClickHandler(new ClickHandler(){

public void onClick(ClickEvent event) {
weights.setWeights(gridID);

}});
export = new Button("Export Grid Data to Excel");

export.addClickHandler(new ClickHandler(){


public void onClick(ClickEvent event) {
fileService.exportGrid(grid.getGridId(), new AsyncCallback<String>(){

public void onFailure(Throwable caught) {
errors.setErrorText("Error exporting grid: " + caught.getMessage());

}

public void onSuccess(String result) {
filePanel = new FileDownloadPanel(errors, result);
}});

}});

baseline = new Button("Baseline Entire Grid");

baseline.addClickHandler( new ClickHandler(){


public void onClick(ClickEvent event) {
// TODO Auto-generated method stub

}});

calculations = new Button("Calculations");

calculations.addClickHandler(new ClickHandler(){


public void onClick(ClickEvent event) {
// TODO Auto-generated method stub

}});
dialogVPanel.add(close);
dialogVPanel.add(filter);
dialogVPanel.add(weights);
dialogVPanel.add(updateWeights);
dialogVPanel.add(export);
dialogVPanel.add(baseline);
dialogVPanel.add(calculations);
dialogVPanel.add(grid);
this.add(dialogVPanel);
}


public void fetchGrid(String key)
{
gridID = key;
grid.fetch(key);
filter.setGridID(key);
weights.getWeights(key);
}


}

DUMMY ENTRY POINT



package com.ray.adt.client;
import com.extjs.gxt.ui.client.widget.Layout;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.ray.adt.client.charts.BaseChart;
import com.ray.adt.client.error.ErrorScreen;
import com.ray.adt.client.fetchAvailableGrids.AvailableGridSelector;
import com.ray.adt.client.grid.Grid;
import com.ray.adt.client.grid.GridScreen;
import com.ray.adt.client.listGrid.EditableGridExample;
import com.ray.adt.client.readOnlyGrid.ReadOnlyGrid;
import com.ray.adt.client.tab.ADTMainTab;
import com.ray.adt.client.weight.WeightWidget;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class ADT implements EntryPoint {




Button sendButton;
AvailableGridSelector grids;
ErrorScreen error;

/**
* This is the entry point method.
*/
public void onModuleLoad() {

@SuppressWarnings("unused")
Layout junk = new AnchorLayout();

sendButton = new Button("Send");
error = new ErrorScreen();
error.addStyleName("ErrorScreen");

//ADTMainTab tabs = new ADTMainTab(error);
//tabs.init();
//RootPanel.get().add(tabs);

//EditableGridExample ex = new EditableGridExample();
//RootPanel.get().add(ex);


GridScreen ex = new GridScreen(error);
RootPanel.get().add(ex);

// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element
//RootPanel.get("nameFieldContainer").add(grids);
//RootPanel.get("sendButtonContainer").add(sendButton);

}

// Create a handler for the sendButton and nameField



}

The IMPL


package com.ray.adt.server.grid;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.ray.adt.client.filter.FilterPojo;
import com.ray.adt.client.filter.FilterService;
import com.ray.adt.client.grid.GridData;
import com.ray.adt.client.grid.GridDataService;
import com.ray.adt.client.gridMetaData.ADTCreationService;
import com.ray.adt.client.gridMetaData.GridMetaData;
import com.ray.adt.server.MockDBInterface.MockDBInterface;
import com.ray.adt.server.base.BaseGWTServlet;

public class GridServiceImpl extends BaseGWTServlet implements GridDataService, FilterService
{

/**
*
*/
private static final long serialVersionUID = 1L;
private String SQLQuerry = "select * from GRIDDATA LEFT JOIN GRIDMASTER ON GRIDDATA.GRIDID = GRIDMASTER.GRIDID AND GRIDDATA.GRIDID = ";



private String countQuery = "SELECT COUNT(ID) AS GRIDS FROM GRIDDATA WHERE GRIDID =";
private int resultSize = 50;
public String getSQLQuerry(String key)
{
return this.SQLQuerry + key + " WHERE ROWNUM >= 0 AND ROWNUM <= 50 AND GRIDDATA.GRIDID = " +key ;
}

public String getCountQuery(String key)
{
return this.countQuery + key;
}

public String getSQLQuerry(String key, int min, int max)
{
return "select * from ( select rownum rnum, a.* from (select GRIDDATA.*, Gridmaster.OWNERUID, " +
"GRIDMASTER.ISECMSCENTRIC from GRIDDATA LEFT JOIN GRIDMASTER ON GRIDDATA.GRIDID = GRIDMASTER.GRIDID " +
"AND GRIDDATA.GRIDID = " + key + " WHERE GRIDDATA.GRIDID = "+key+" ) a where rownum <= "+max+" ) where rnum >= "+min;
}

public void updateGridData(GridData data)
{
log.debug("update");
printData(data);
}

public PagingLoadResult<GridData> fetchGridData(String key, int min)
{
String query = null;
try{
query = this.getSQLQuerry(key, min+1, min+resultSize);
System.out.println(query);
//ResultSet set = this.getDBInterface().executeQuery(query);
//List<GridData> data = GridDataUtilities.getGridData(set);
//log.debug("Fetched with Paging " + data.size() + " rows");
BasePagingLoadResult<GridData> result = new BasePagingLoadResult<GridData>(null);

//query = this.getCountQuery(key);
//set = this.getDBInterface().executeQuery(query);

//only 1 result
//set.next();
//int count = set.getInt(1);

//result.setOffset(min);
//result.setTotalLength(count);
//result.setData(data);
getSession().setAttribute(this.gridIDName, key);
getSession().setAttribute(this.currentQueryName, query);
return result;
}catch(Exception e)
{
log.error("Couldn't fetch grid " + query);
e.printStackTrace();
}
return null;
}

public List<GridData> fetchGridData(String key)
{
try{
System.out.println(this.getSQLQuerry(key));
//ResultSet set = this.getDBInterface().executeQuery(getSQLQuerry(key));
//List<GridData> data = GridDataUtilities.getGridData(set);
//log.debug("Fetched " + data.size() + " rows");

//for(int x = 0; x < data.size(); x++)
//log.debug(data.toString());

getSession().setAttribute(this.gridIDName, key);
getSession().setAttribute(this.currentQueryName, getSQLQuerry(key));
return null;
}catch(Exception e)
{
log.error("Couldn't fetch grid " + getSQLQuerry(key));
e.printStackTrace();
}
return null;
}

//currently not used
public void removeGridData(GridData data)
{
log.debug("remove");
printData(data);
}


//may not be needed
public void addGridData(GridData data)
{
log.debug("Add");
printData(data);
}

protected MockDBInterface getMockDBInterface()
{
return new MockGrid();
}

private void printData(GridData data)
{
data.buildMap();
HashMap<String, Object> map = data.getMap();

Set<String> keys = map.keySet();
Iterator<String> iter = keys.iterator();
while(iter.hasNext())
{
String key = iter.next();
if(map.get(key) != null)
System.out.println(key + " = " + map.get(key).toString());
}
}


public List<GridData> filterData(String gridID, FilterPojo fp) {
StringBuilder newQuery = new StringBuilder();
newQuery.append("select GRIDDATA.*, Gridmaster.OWNERUID, " +
"GRIDMASTER.ISECMSCENTRIC from GRIDDATA LEFT JOIN GRIDMASTER ON GRIDDATA.GRIDID = GRIDMASTER.GRIDID " +
"AND GRIDDATA.GRIDID = " + gridID + " WHERE GRIDDATA.GRIDID = "+gridID);
newQuery.append(" AND ");
getSession().setAttribute(this.gridIDName, gridID);
if((fp.getDocumentNumber() != null) && (fp.getDocumentNumber().trim().length() != 0))
newQuery .append("DRAWING = '" + fp.getDocumentNumber() + "' AND ");

//might be wrong
if((fp.getRespEngEID() != null) && (fp.getRespEngEID().trim().length() != 0))
newQuery.append("OWNERUID = '" + fp.getRespEngEID() + "' AND ");

//is wrong
if((fp.getC5() != null) && (fp.getC5().trim().length() != 0))
newQuery.append("OWNERUID = '" + fp.getRespEngEID().trim() + "' AND ");

if((fp.getTextField() != null) && (fp.getTextField() != "") && !fp.getTextField().equals("null"))
newQuery.append(fp.getTextField()+ " = '" + fp.getText() + "' AND ");

if(fp.isDeleted())
newQuery.append("REMOVED = TRUE AND ");

if((fp.getDateField() != null) && (fp.getDateField() != "") && !fp.getDateField().equals("null"))
newQuery.append(fp.getDateField()+ " >= " + fp.getDate1() + " AND " + fp.getDateField() + " <= " + fp.getDate2());

String newQuery2 = newQuery.toString();
if(newQuery2.trim().lastIndexOf("AND") == newQuery2.trim().length()-3)
newQuery2 = newQuery.substring(0, newQuery2.trim().lastIndexOf("AND"));

log.debug("Running filter query " + newQuery2);

getSession().setAttribute(this.filterQueryName, newQuery2);

try{
ResultSet set = this.getDBInterface().executeQuery(newQuery2);
List<GridData> beans = GridDataUtilities.getGridData(set);
log.debug("Fetched " + beans.size() + " through the filter");
return beans;
}catch(Exception e)
{
log.error("Could not execute sql query " + newQuery);
log.error(e);
}

return null;
}


public List<GridData> unfilterData() {
getSession().removeAttribute(this.filterQueryName);
return fetchCurrentQuerySet();
}

public List<GridData> fetchCurrentQuerySet()
{
String query = null;
try{
query = (String)getSession().getAttribute(this.currentQueryName);
System.out.println(query);
ResultSet set = this.getDBInterface().executeQuery(query);
List<GridData> data = GridDataUtilities.getGridData(set);
log.debug("Fetched " + data.size() + " rows");

return data;
}catch(Exception e)
{
log.error("Couldn't fetch grid " + query);
e.printStackTrace();
}
return null;
}



}

darkling235
18 Jan 2010, 6:21 AM
I've been working over things and been completely unable to make any progress. The data just doesn't seem to process. I have to assume its an issue with my model. Can anyone help me?

darkling235
18 Jan 2010, 2:42 PM
Ok I've learned a few more things:
When I debug my event handler for the store, the EDIT event fires correctly and the correct field is marked as being edited but for some reason the modified field only contains the original value:

for example:
I have a field named docCode. It has been fetched with a value of 21. I edit the cell and set the value to 22. When I press enter my break point in the store event handler is fired and I can see the "modified" field inside of the Record object which belongs to the StoreEvent and it is still 21. I can't imagine why.
Thanks

darkling235
19 Jan 2010, 3:47 AM
Ok I found the solution. Just so no one else stumbles over this mess, the whole issue was with my Model. I overrode BaseModel rather than implemented Model and as a result of this my get/set methods weren't set up correctly. I did this because I couldn't seem to import the class X. But once I implemented all the methods in the model interface myself it worked flawlessly. I just passed back an Object instead of an X.

Arno.Nyhm
19 Jan 2010, 5:51 AM
thanks for your solution :-)

could you also pls post your fixed classes (it was just the model class?) - then it is more clear for the readers what to change to get it to work. thanks.

darkling235
21 Jan 2010, 5:38 AM
This is my working Model. The methods at the top are required for the grid to map data correctly. Make sure to implement all the methods in ModelData specifically, even if you extend BaseModelData



package com.ray.adt.client.grid;
import java.io.Serializable;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;




public class GridData extends BaseModelData implements Serializable, ModelData
{

/**
*
*/
private static final long serialVersionUID = 1L;
private String gridId;
private String rowId;
private String docNumber;
private String docDescription;
private String udText1;
private String udText2;
private String docCode;
private String respEid;
private String respEngs;
private String c5BidCode;
private String modelingReuse;
private String analysisReuse;
private String drawingReuse;
private int outlookNumberOfSheets;
private String outlookSheetSize;
private int outlookNumberOfTermination;
private String effectiveSqFeet;
private String effectiveNumberOfTermination;
private String modelingComplete;
private String structualComplete;
private String thermalComplete;
private String drawingComplete;
private String checkingComplete;
private String actionDocument;
private Date submittedPlanDate;
private Date submittedOutlookDate;
private Date submittedActualDate;
private String CCBStart;
private Date releasedPlanDate;
private Date releasedOutlookDate;
private Date releasedActualDate;
private Date iscNeedDate;
private String drawingNeedDate;
private boolean deleted;
private String percentComplete;
private HashMap<String, Object> map;

private String header;
private String similarTo;
private String udText3;
private String udText4;
private String udText5;
private String udText6;
private Date udDate1;
private Date udDate2;
private String intraLinkFileName;
private Date modelingPlanDate;
private Date modelingOutlookDate;
private Date modelingActualDate;
private Date structuralPlanDate;
private Date structuralOutlookDate;
private Date structuralActualDate;
private Date thermalPlanDate;
private Date thermalOutlookDate;
private Date thermalActualDate;
private Date drawingPlanDate;
private Date drawingOutlookDate;
private Date drawingActualDate;
private Date checkingPlanDate;
private Date checkingOutlookDate;
private Date checkingActualDate;
private String comments;
private String baseLine;

public GridData()
{
map = new HashMap<String, Object>();
}




public Map<String, Object> getProperties() {
return map;
}


public Collection<String> getPropertyNames() {
return map.keySet();
}



public Object get(String name)
{
return map.get(name);
}

public Object get(String name, Object value)
{
if(map.get(name) != null)
return map.get(name);
else
return "";
}

public Object set(String property, Object value)
{
map.put(property, value);
return value;
}

public void buildMap()
{
map.put("gridID", gridId);
map.put("docNumber", docNumber);
map.put("docDescription", docDescription);
map.put("udText1", udText1);
map.put("udText2", udText2);
map.put("docCode", docCode);
map.put("respEid", respEid);
map.put("respEngs", respEngs);
map.put("c5BidCode", c5BidCode);
map.put("modelingReuse", modelingReuse);
map.put("analysisReuse", analysisReuse);
map.put("drawingReuse", drawingReuse);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookNumberOfSheets", outlookNumberOfSheets);
map.put("outlookSheetSize", outlookSheetSize);
map.put("outlookNumberOfTermination", outlookNumberOfTermination);
map.put("effectiveSqFeet", effectiveSqFeet);
map.put("effectiveNumberOfTermination", effectiveNumberOfTermination);
map.put("modelingComplete", modelingComplete);
map.put("structualComplete", structualComplete);
map.put("thermalComplete", thermalComplete);
map.put("drawingComplete", drawingComplete);
map.put("drawingReuse", drawingReuse);
map.put("checkingComplete", checkingComplete);
map.put("actionDocument", actionDocument);
map.put("submittedPlanDate", submittedPlanDate);
map.put("submittedOutlookDate", submittedOutlookDate);
map.put("submittedActualDate", submittedActualDate);
map.put("CCBStart", CCBStart);
map.put("releasedPlanDate", releasedPlanDate);
map.put("releasedOutlookDate", releasedOutlookDate);
map.put("releasedActualDate", releasedActualDate);
map.put("iscNeedDate", iscNeedDate);
map.put("drawingNeedDate", drawingNeedDate);
map.put("deleted", deleted);
map.put("percentComplete", percentComplete);
map.put("udText3", udText3);
map.put("udText4", udText4);
map.put("udText5", udText5);
map.put("udText6", udText6);
map.put("udDate1", udDate1);
map.put("udDate2", udDate2);
map.put("modelingPlanDate", modelingPlanDate);
map.put("modelingOutlookDate", modelingOutlookDate);
map.put("modelingActualDate", modelingActualDate);
map.put("structuralPlanDate", structuralPlanDate);
map.put("structuralOutlookDate", structuralOutlookDate);
map.put("structuralActualDate", structuralActualDate);
map.put("thermalPlanDate", thermalPlanDate);
map.put("thermalOutlookDate", thermalOutlookDate);
map.put("thermalActualDate", thermalActualDate);
map.put("drawingPlanDate", drawingPlanDate);
map.put("drawingOutlookDate", drawingOutlookDate);
map.put("drawingActualDate", drawingActualDate);
map.put("checkingPlanDate", checkingPlanDate);
map.put("checkingOutlookDate", checkingOutlookDate);
map.put("checkingActualDate", checkingActualDate);
map.put("comments", comments);
map.put("baseLine", baseLine);
map.put("intraLinkFileName", intraLinkFileName);
map.put("header", header);
map.put("similarTo", similarTo);
map.put("rowId", rowId);
}

public void extractFromMap()
{
this.setGridId((String)map.get("gridID"));
this.setRowId((String)map.get("rowId"));
this.setDocNumber((String)map.get("docNumber"));
this.setDocDescription ((String)map.get("docDescription"));
this.setUdText1 ((String)map.get("udText1"));
this.setUdText2 ((String)map.get("udText2"));
this.setDocCode ((String)map.get("docCode"));
this.setRespEid ((String)map.get("respEid"));
this.setRespEngs ((String)map.get("respEngs"));
this.setModelingReuse ((String)map.get("modelingReuse"));
this.setAnalysisReuse ((String)map.get("analysisReuse"));
this.setDrawingReuse ((String)map.get("drawingReuse"));
this.setOutlookNumberOfSheets ((Integer)map.get("outlookNumberOfSheets"));
this.setOutlookNumberOfTermination ((Integer)map.get("outlookNumberOfTermination"));
this.setEffectiveSqFeet ((String)map.get("effectiveSqFeet"));
this.setEffectiveNumberOfTermination ((String)map.get("effectiveNumberOfTermination"));
this.setModelingComplete ((String)map.get("modelingComplete"));
this.setDrawingReuse((String)map.get("drawingReuse"));
if(map.get("deleted") != null)
this.setDeleted(((Boolean)map.get("deleted")).booleanValue());
this.setDrawingNeedDate((String)map.get("drawingNeedDate"));
this.setPercentComplete ((String)map.get("percentComplete"));
this.setIscNeedDate((Date)map.get("iscNeedDate"));
this.setReleasedActualDate((Date)map.get("releasedActualDate"));
this.setReleasedOutlookDate ((Date)map.get("releasedOutlookDate"));
this.setReleasedPlanDate ((Date)map.get("releasedPlanDate"));
this.setCCBStart ((String)map.get("CCBStart"));
this.setSubmittedActualDate ((Date)map.get("submittedActualDate"));
this.setSubmittedOutlookDate ((Date)map.get("submittedOutlookDate"));
this.setSubmittedPlanDate ((Date)map.get("submittedPlanDate"));
this.setActionDocument ((String)map.get("actionDocument"));
this.setCheckingComplete ((String)map.get("checkingComplete"));
this.setDrawingComplete ((String)map.get("drawingComplete"));
this.setThermalComplete ((String)map.get("thermalComplete"));
this.setStructualComplete((String)map.get("structuralComplete"));
this.setModelingPlanDate((Date)map.get("modelingPlanDate"));
this.setModelingOutlookDate((Date)map.get("modelingOutlookDate"));
this.setModelingActualDate((Date)map.get("modelingActualDate"));
this.setThermalPlanDate((Date)map.get("thermalPlanDate"));
this.setThermalOutlookDate((Date)map.get("thermalOutlookDate"));
this.setThermalActualDate((Date)map.get("thermalActualDate"));
this.setStructuralPlanDate((Date)map.get("structuralPlanDate"));
this.setStructuralOutlookDate((Date)map.get("structuralOutlookDate"));
this.setStructuralActualDate((Date)map.get("structuralActualDate"));
this.setDrawingPlanDate((Date)map.get("drawingPlanDate"));
this.setDrawingOutlookDate((Date)map.get("drawingOutlookDate"));
this.setDrawingActualDate((Date)map.get("drawingActualDate"));
this.setCheckingPlanDate((Date)map.get("checkingPlanDate"));
this.setCheckingOutlookDate((Date)map.get("checkingOutlookDate"));
this.setCheckingActualDate((Date)map.get("checkingActualDate"));
this.setUdText3((String)map.get("udText3"));
this.setUdText4((String)map.get("udText4"));
this.setUdText5((String)map.get("udText5"));
this.setUdText6((String)map.get("udText6"));
this.setUdDate1((Date)map.get("udDate1"));
this.setUdDate2((Date)map.get("udDate2"));
this.setBaseLine((String) map.get("baseLine"));
this.setComments((String) map.get("comments"));
this.setIntraLinkFileName((String) map.get("intraLinkFileName"));
this.setHeader((String) map.get("header"));
this.setSimilarTo((String) map.get("similarTo"));

}

public String getDocNumber() {
return docNumber;
}
public void setDocNumber(String docNumber) {
this.docNumber = docNumber;
}
public String getDocDescription() {
if(docDescription != null)
docDescription = docDescription.replace("'", "\\'");
return docDescription;
}
public void setDocDescription(String docDescription) {
this.docDescription = docDescription;
}
public String getUdText1() {
return udText1;
}
public void setUdText1(String udText1) {
this.udText1 = udText1;
}
public String getUdText2() {
return udText2;
}
public void setUdText2(String udText2) {
this.udText2 = udText2;
}
public String getDocCode() {
return docCode;
}
public void setDocCode(String docCode) {
this.docCode = docCode;
}
public String getRespEid() {
return respEid;
}
public void setRespEid(String respEid) {
this.respEid = respEid;
}
public String getRespEngs() {
return respEngs;
}
public void setRespEngs(String respEngs) {
this.respEngs = respEngs;
}
public String getC5BidCode() {
return c5BidCode;
}
public void setC5BidCode(String c5BidCode) {
this.c5BidCode = c5BidCode;
}
public String getModelingReuse() {
return modelingReuse;
}
public void setModelingReuse(String modelinReuse) {
this.modelingReuse = modelinReuse;
}

public String getAnalysisReuse() {
return analysisReuse;
}


public void setAnalysisReuse(String analysisReuse) {
this.analysisReuse = analysisReuse;
}

public String getDrawingReuse() {
return drawingReuse;
}

public void setDrawingReuse(String drawingReuse) {
this.drawingReuse = drawingReuse;
}


public int getOutlookNumberOfSheets() {
return outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(int outlookNumberOfSheets) {
this.outlookNumberOfSheets = outlookNumberOfSheets;
}
public void setOutlookNumberOfSheets(Integer outlookNumberOfSheets) {
if(outlookNumberOfSheets != null)
this.outlookNumberOfSheets = outlookNumberOfSheets.intValue();
}
public String getOutlookSheetSize() {
return outlookSheetSize;
}
public void setOutlookSheetSize(String outlookSheetSize) {
this.outlookSheetSize = outlookSheetSize;
}
public int getOutlookNumberOfTermination() {
return outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(int outlookNumberOfTermination) {
this.outlookNumberOfTermination = outlookNumberOfTermination;
}
public void setOutlookNumberOfTermination(Integer outlookNumberOfTermination) {
if(outlookNumberOfTermination != null)
this.outlookNumberOfTermination = outlookNumberOfTermination.intValue();
}
public String getEffectiveSqFeet() {
return effectiveSqFeet;
}
public void setEffectiveSqFeet(String outlookSqFeet) {
this.effectiveSqFeet = outlookSqFeet;
}
public String getEffectiveNumberOfTermination() {
return effectiveNumberOfTermination;
}
public void setEffectiveNumberOfTermination(String effectiveNumberOfTermination) {
this.effectiveNumberOfTermination = effectiveNumberOfTermination;
}
public String getModelingComplete() {
return modelingComplete;
}
public void setModelingComplete(String modelingComplete) {
this.modelingComplete = modelingComplete;
}
public String getStructualComplete() {
return structualComplete;
}
public void setStructualComplete(String structualComplete) {
this.structualComplete = structualComplete;
}
public String getThermalComplete() {
return thermalComplete;
}
public void setThermalComplete(String thermalComplete) {
this.thermalComplete = thermalComplete;
}
public String getDrawingComplete() {
return drawingComplete;
}
public void setDrawingComplete(String drawingComplete) {
this.drawingComplete = drawingComplete;
}
public String getCheckingComplete() {
return checkingComplete;
}
public void setCheckingComplete(String checkingComplete) {
this.checkingComplete = checkingComplete;
}
public String getActionDocument() {
return actionDocument;
}
public void setActionDocument(String actionDocument) {
this.actionDocument = actionDocument;
}
public Date getSubmittedPlanDate() {
return submittedPlanDate;
}
public void setSubmittedPlanDate(Date submittedPlanDate) {
this.submittedPlanDate = submittedPlanDate;
}
public Date getSubmittedOutlookDate() {
return submittedOutlookDate;
}
public void setSubmittedOutlookDate(Date submittedOutlookDate) {
this.submittedOutlookDate = submittedOutlookDate;
}
public Date getSubmittedActualDate() {
return submittedActualDate;
}
public void setSubmittedActualDate(Date submittedActualDate) {
this.submittedActualDate = submittedActualDate;
}
public String getCCBStart() {
return CCBStart;
}
public void setCCBStart(String cCBStart) {
CCBStart = cCBStart;
}
public Date getReleasedPlanDate() {
return releasedPlanDate;
}
public void setReleasedPlanDate(Date releasedPlanDate) {
this.releasedPlanDate = releasedPlanDate;
}
public Date getReleasedOutlookDate() {
return releasedOutlookDate;
}
public void setReleasedOutlookDate(Date releasedOutlookDate) {
this.releasedOutlookDate = releasedOutlookDate;
}
public Date getReleasedActualDate() {
return releasedActualDate;
}
public void setReleasedActualDate(Date releasedActualDate) {
this.releasedActualDate = releasedActualDate;
}
public Date getIscNeedDate() {
return iscNeedDate;
}
public void setIscNeedDate(Date iscNeedDate) {
this.iscNeedDate = iscNeedDate;
}
public String getDrawingNeedDate() {
return drawingNeedDate;
}
public void setDrawingNeedDate(String drawingNeedDate) {
this.drawingNeedDate = drawingNeedDate;
}
public void setDrawingNeedDate(Date drawingNeedDate) {
if(drawingNeedDate != null)
this.drawingNeedDate = drawingNeedDate.toGMTString();
}


public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public String getPercentComplete() {
return percentComplete;
}
public void setPercentComplete(String percentComplete) {
this.percentComplete = percentComplete;
}



public String getUdText3() {
return udText3;
}

public void setUdText3(String udText3) {
this.udText3 = udText3;
}

public String getUdText4() {
return udText4;
}

public void setUdText4(String udText4) {
this.udText4 = udText4;
}

public String getUdText5() {
return udText5;
}

public void setUdText5(String udText5) {
this.udText5 = udText5;
}

public String getUdText6() {
return udText6;
}

public void setUdText6(String udText6) {
this.udText6 = udText6;
}

public Date getUdDate1() {
return udDate1;
}

public void setUdDate1(Date udDate1) {
this.udDate1 = udDate1;
}

public Date getUdDate2() {
return udDate2;
}

public void setUdDate2(Date udDate2) {
this.udDate2 = udDate2;
}

public String getIntraLinkFileName() {
return intraLinkFileName;
}

public void setIntraLinkFileName(String intraLinkFileName) {
this.intraLinkFileName = intraLinkFileName;
}

public Date getModelingPlanDate() {
return modelingPlanDate;
}

public void setModelingPlanDate(Date modelingPlanDate) {
this.modelingPlanDate = modelingPlanDate;
}

public Date getModelingOutlookDate() {
return modelingOutlookDate;
}

public void setModelingOutlookDate(Date modelingOutlookDate) {
this.modelingOutlookDate = modelingOutlookDate;
}

public Date getModelingActualDate() {
return modelingActualDate;
}

public void setModelingActualDate(Date modelingActualDate) {
this.modelingActualDate = modelingActualDate;
}

public Date getStructuralPlanDate() {
return structuralPlanDate;
}

public void setStructuralPlanDate(Date structuralPlanDate) {
this.structuralPlanDate = structuralPlanDate;
}

public Date getStructuralOutlookDate() {
return structuralOutlookDate;
}

public void setStructuralOutlookDate(Date structuralOutlookDate) {
this.structuralOutlookDate = structuralOutlookDate;
}

public Date getStructuralActualDate() {
return structuralActualDate;
}

public void setStructuralActualDate(Date structualActualDate) {
this.structuralActualDate = structualActualDate;
}

public Date getThermalPlanDate() {
return thermalPlanDate;
}

public void setThermalPlanDate(Date thermalPlanDate) {
this.thermalPlanDate = thermalPlanDate;
}

public Date getThermalOutlookDate() {
return thermalOutlookDate;
}

public void setThermalOutlookDate(Date thermalOutlookDate) {
this.thermalOutlookDate = thermalOutlookDate;
}

public Date getThermalActualDate() {
return thermalActualDate;
}

public void setThermalActualDate(Date thermalActualDate) {
this.thermalActualDate = thermalActualDate;
}

public Date getCheckingPlanDate() {
return checkingPlanDate;
}

public void setCheckingPlanDate(Date checkingPlanDate) {
this.checkingPlanDate = checkingPlanDate;
}

public Date getCheckingOutlookDate() {
return checkingOutlookDate;
}

public void setCheckingOutlookDate(Date checkingOutlookDate) {
this.checkingOutlookDate = checkingOutlookDate;
}

public Date getCheckingActualDate() {
return checkingActualDate;
}

public void setCheckingActualDate(Date checkingActualDate) {
this.checkingActualDate = checkingActualDate;
}


public Date getDrawingPlanDate() {
return drawingPlanDate;
}

public void setDrawingPlanDate(Date drawingPlanDate) {
this.drawingPlanDate = drawingPlanDate;
}

public Date getDrawingOutlookDate() {
return drawingOutlookDate;
}

public void setDrawingOutlookDate(Date drawingOutlookDate) {
this.drawingOutlookDate = drawingOutlookDate;
}

public Date getDrawingActualDate() {
return drawingActualDate;
}

public void setDrawingActualDate(Date drawingActualDate) {
this.drawingActualDate = drawingActualDate;
}



public String getComments() {
return comments;
}

public void setComments(String comments) {
this.comments = comments;
}

public String getBaseLine() {
return baseLine;
}

public void setBaseLine(String baseLine) {
this.baseLine = baseLine;
}



public String getHeader() {
return header;
}

public void setHeader(String header) {
this.header = header;
}

public String getSimilarTo() {
return similarTo;
}

public void setSimilarTo(String similarTo) {
this.similarTo = similarTo;
}



public String getGridId() {
return gridId;
}

public void setGridId(String gridId) {
this.gridId = gridId;
}

public String getRowId() {
return rowId;
}

public void setRowId(String rowId) {
this.rowId = rowId;
}

public HashMap<String, Object> getMap()
{
return map;
}


public void setData(ModelData data)
{
if((data == null) || (data.getPropertyNames() == null ))
{
System.out.println("Data was null");
return;
}
Iterator<String> iter = data.getPropertyNames().iterator();
while(iter.hasNext())
{
String name = iter.next();
map.put(name, data.get(name));
}
this.extractFromMap();
}

public String toString()
{
Iterator<String> iter = map.keySet().iterator();
StringBuilder result = new StringBuilder();
while(iter.hasNext())
{
String name = iter.next();
result.append(name + " = " + map.get(name) + "\n");
}
return result.toString();
}






}

sven
21 Jan 2010, 5:43 AM
The problem is that you are using fields directly. Your setters and getters should directly act on the map, instead of using fields. Also you are creating an own map, there is no reason for that. BaseModelData creates it.


Make sure to implement all the methods in ModelData specifically, even if you extend BaseModelData

If you would use the methods from BaseModelData, you would not need to reimplement them.

darkling235
21 Jan 2010, 7:43 AM
I had a tough time understanding the javadoc for BaseModelData, what it does, how it does it, how to use it. Hopefully no one else has the same problems.

Arno.Nyhm
21 Jan 2010, 9:58 AM
thanks for pointing us to this.

better than reading the javadocs is reading the sourcecode for BaseModelData. this gives you more hints than some small javadoc descriptions.

sven
21 Jan 2010, 10:00 AM
better than reading the javadocs is reading the sourcecode for BaseModelData. this gives you more hints than some small javadoc descriptions.

I think this is wrong. You should first start with reading the sourcecode of the examples. They would have shown exactly what you are looking for.
Reading the source does not make you understand how to use it (if you are not good). Reading the example models will help a lot more.