java - how to know which JTextField is changed in a set of fields -


i working on app reads database , fills table(each row has title, author, publisher. etc) . have set of textfields has information each row(location, copies, price). when select single row, , change fields change reflected perfectly. however, when select multiple rows, , changes 1 filed(e.g price) instead of refelcting field, information on textfields stored in selected rows.this screenshot of program http://i.imgur.com/ymw7iy5.png

in summary, problem how determine field user changed? (so can modify attribute object, without overwriting previous ones).

this how info table update book in db

arraylist<title> books = getall(rowindex);         int index=0;         for(title b:books){         b.setisbn((string) rectable.getvalueat(rowindex[index], 0));         b.settitle((string) rectable.getvalueat(rowindex[index], 1));         b.setauthor((string) rectable.getvalueat(rowindex[index], 2));         b.setcountry((string) rectable.getvalueat(rowindex[index], 3));         b.setpub((string) rectable.getvalueat(rowindex[index], 4));         b.setyear((int) rectable.getvalueat(rowindex[index], 5));         b.seted((string) rectable.getvalueat(rowindex[index], 6));         b.setprice((double) rectable.getvalueat(rowindex[index], 7));         b.setcopies((int) rectable.getvalueat(rowindex[index], 8));        title_record titlerecord = new title_record();         titlerecord.setrecord(createrecord(b,rowindex[index++]));         b.setrecord(titlerecord);         ctrl.updatetitle(b);` 

for each book call create record, creates book record , info text fields, why previos info in recored gets overwritten.

field = factory.newdatafield("960",' ',' '); // field.settag("960"); sf1 = factory.newsubfield('a'); sf1.setdata(acqtype.gettext()); sf2 = factory.newsubfield('g'); sf2.setdata(format.gettext()); sf3 = factory.newsubfield('i'); sf3.setdata(ordtype.gettext()); subfield sf4 = factory.newsubfield('k'); sf4.setdata(rloc.gettext()); subfield sf5 = factory.newsubfield('l'); sf5.setdata(bloc.gettext()); subfield sf6 = factory.newsubfield('m'); sf6.setdata(status960.gettext()); subfield sf7 = factory.newsubfield('o'); sf7.setdata(copies960.gettext()); subfield sf8 = factory.newsubfield('s'); sf8.setdata(price960.gettext()); subfield sf9 = factory.newsubfield('t'); sf9.setdata(location.gettext()); subfield sf10 = factory.newsubfield('u'); sf10.setdata((string) fundcambo.getselecteditem()); subfield sf11 = factory.newsubfield('v'); sf11.setdata(vendor.gettext()); subfield sf12 = factory.newsubfield('w'); sf12.setdata(lang.gettext()); subfield sf13 = factory.newsubfield('x'); sf13.setdata(ccode.gettext());

i want way change fields user has changed in case selected multiple rows.

define map string key subfield's name , boolean value field's changed state flag.

add documentlistener each subfield , on change (insert/delete) set flag field true in map.

to apply changed fields true flags map , use subfields' values update table data.

update: or easier keep changed fields' names in set.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -