[Java-gnome-developer] Problem with TreeView
Brought to you by:
afcowie
From: Ralph H. <ra...@gm...> - 2005-06-16 04:55:00
|
Hello, i have a Problem with the TreeView. I'm write a little TestProgram with TreeView, i have (a little Code for example). I will when the Program start's , i will selectet a Column by default. The default Column is by the most start diffrent. I have not found a example todo this. Can you give ma a little example. I hope you understand my bad english! Greets Ralph Create TreeView from a glade-file ---------- GuiProgram --------------- .... private void initTreeViewBouquet() { tvBouquet.getSelection().addListener((TreeSelectionListener) this); dc = new DataColumn[2]; dc[0] = new DataColumnString(); dc[1] = new DataColumnString(); lsBouquet = new ListStore(dc); control.readBouquets(lsBouquet, dc); tvBouquet.setModel(lsBouquet); tvBouquet.setEnableSearch(true); tvBouquet.setAlternateRowColor(true); tvBouquet.setHeadersVisible(true); TreeViewColumn col0 = new TreeViewColumn(); CellRendererText render0 = new CellRendererText(); col0.packStart(render0, true); col0.addAttributeMapping(render0, CellRendererText.Attribute.TEXT,(DataColumnString) dc[1]); col0.setTitle("Bouquet"); tvBouquet.appendColumn(col0); tvBouquet.setSearchDataColumn(dc[1]); //tvBouquet.setSelectionColumn(control.getCulumnForSelection()) //TODO } ---------- GuiProgram --------------- i'm filling the TreeView... --------- ControlProgram ------------- ... public void readBouquets(ListStore ls, DataColumn dc[]){ ArrayList t = new ArrayList(ControlMain.getInstance().getBoxAccess().getBouquetList()); this.setBouquetList(t); TreeIter it = null; ls.clear(); for (int i = 0; i < t.size(); i++){ it = ls.appendRow(); ls.setValue(it, (DataColumnString) dc[0], new String(""+i)); ls.setValue(it, (DataColumnString) dc[1], (String)((BOBouquet)t.get(i)).getBouquetName()); } } public xxxx getCulumnForSelection(){ //TODO } --------- ControlProgram ------------- -- Ralph Henneberger <ra...@gm...> |