java - SWT problems with saving data in the data base -
i trying make editable table using swt, while have trouble save dates modified in database using toplink:
if (referenceviewid.equalsignorecase(tistableviewpart.id)) { //todo yuchen : register , save objects in db system.out.println("test"); final iviewpart viewpart = workbenchpage.findview(tistableviewpart.id); final tistableviewpart vdv = (tistableviewpart) viewpart; workingunitmasterdataimpl sessionuow = new workingunitmasterdataimpl(); object test = vdv.getlocalcomposite().gettableviewer().getelementat(1); sessionuow.registerobject(test); try { sessionuow.commitandresume(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } }
by using
object test = vdv.getlocalcomposite().gettableviewer().getelementat(1);
i can object of first colomne of table, use
sessionuow.registerobject(test);
to save change. have idea whole table object in order register , commitresume? in advance.
if using tableviewer set contentprovider, assumed contentprovider holds elements table contains.
try access these elements through getelements() method in case content provider implements istructuredcontentprovider.
object[] elements = tableviever.getcontentprovider().getelements();
in case want register object changes, can in method setinput() ofthe contentprovider. indeed javadoc icontentprovider interface suggests method place registering changes.
if need access input @ moment, tableviewer object gives access table input through getinput() method:
object tableinput = tableviewer.getinput();
good luck!
Comments
Post a Comment