java - JavaFX: Nested Tables -
it possible create table contains other subtables in javafx in picture?
the program in photo written in javafx closed source.
is there other external or internal component in java allows me create similar interface?
my problem same this: javafx tableview: open detail information between rows on click however, need load different value in sub tables every row. how can this?
this creation of sub-tabs.
private node createdetailspane(objectproperty<model> item) { vbox vbox = new vbox(); observablelist<model> dv = fxcollections.observablearraylist(); observablelist<model> dl = fxcollections.observablearraylist(); observablelist<model> dp = fxcollections.observablearraylist(); tableview visite = new tableview(); tableview latte = new tableview(); tableview parti = new tableview(); visite.setcolumnresizepolicy(tableview.constrained_resize_policy); latte.setcolumnresizepolicy(tableview.constrained_resize_policy); parti.setcolumnresizepolicy(tableview.constrained_resize_policy); visite.settablemenubuttonvisible(true); latte.settablemenubuttonvisible(true); parti.settablemenubuttonvisible(true); visite.getselectionmodel().setselectionmode(selectionmode.multiple); latte.getselectionmodel().setselectionmode(selectionmode.multiple); parti.getselectionmodel().setselectionmode(selectionmode.multiple); visite.getcolumns().addall(idvisita, datavisita, azioniterapeutiche, descrizionevisita, incinta, dataprevistaparto, veterinario); latte.getcolumns().addall(idlatte, litri, dataproduzione); parti.getcolumns().addall(idparto, dataparto, azioniparticolari); visite.setfixedcellsize(25); visite.prefheightproperty().bind(visite.fixedcellsizeproperty().multiply(bindings.size(visite.getitems()).add(2))); visite.minheightproperty().bind(visite.prefheightproperty()); visite.maxheightproperty().bind(visite.prefheightproperty()); latte.setfixedcellsize(25); latte.prefheightproperty().bind(latte.fixedcellsizeproperty().multiply(bindings.size(latte.getitems()).add(2))); latte.minheightproperty().bind(latte.prefheightproperty()); latte.maxheightproperty().bind(latte.prefheightproperty()); parti.setfixedcellsize(25); parti.prefheightproperty().bind(parti.fixedcellsizeproperty().multiply(bindings.size(parti.getitems()).add(2))); parti.minheightproperty().bind(parti.prefheightproperty()); parti.maxheightproperty().bind(parti.prefheightproperty()); parti.setitems(dp); latte.setitems(dl); string id; if(treeview.getselectionmodel().getselectedindices().get(treeview.getselectionmodel().getselecteditems().size()-1) != -1) { id = treeview.getselectionmodel().getselecteditems().get(treeview.getselectionmodel().getselecteditems().size()-1).getidprov(); try { connection conn = driver.connection(); conn = drivermanager.getconnection("jdbc:mysql://localhost:3306/animali?autoreconnect=true&usessl=false", "admin", "admincs97"); statement stmt = conn.createstatement(); sql = "select distinct `id_visita`,`data_visita`,`azioni_terapeutiche`,`descrizione_visita`,`stato_visita`,`gravida_da_gg`,`data_prevista_parto`,`veterinario` `visite` " + "left join `anagrafe` using(`id_provvisorio`, `bolo`) " + "left join `parti` using(`id_provvisorio`, `bolo`) " + "left join `latte` using(`id_provvisorio`, `bolo`) " +where; string temp = ""; if(where.trim().length() > 0) temp += " , visite.`id_provvisorio` = '"+id+"'"; else temp = "where visite.`id_provvisorio` = '"+id+"'"; sql += temp; resultset rs = stmt.executequery(sql); if(rs.next()) { dv.add(new model( rs.getstring(1), rs.getstring(2), rs.getstring(3), rs.getstring(4), rs.getstring(5), rs.getstring(6), rs.getstring(7), rs.getstring(8))); /*rs.getstring(13), rs.getstring(14), rs.getstring(15), rs.getstring(16), rs.getstring(17), rs.getstring(18), rs.getstring(19), rs.getstring(20), rs.getstring(21), rs.getstring(22), rs.getstring(23), rs.getstring(24), rs.getstring(25), rs.getstring(26) */ } while(rs.next()); } catch(sqlexception e) { new fxdialogs().showexception("errore", "errore nel caricamento dei dati", e); } } visite.setitems(dv); vbox.getchildren().addall(visite, latte, parti); return vbox ; } everything works until select multiple rows in main table.
if example have 2 main lines, if select first second , first subtables give me same value.


Comments
Post a Comment