Thread: Re: [Java-gnome-developer] Re: Tree view Expand row signal
Brought to you by:
afcowie
From: Joao V. <jvi...@ya...> - 2005-03-31 12:56:45
|
Try using addListener; take a look at the javadoc for TreeViewListener and TreeViewEvent. Here's a quick example (i didn't compile it, so forgive me for silly errors): First, if you have a TreeView you'll need an array of DataColumns defining the columns, and a model object. For the example, it'll be this: ------------------------------------------------------ //The columns DataColumn cols = {new DataColumnString(), new DataColumnString()}; //the model object TreeStore model = new TreeStore(cols); Now continuing with that code... _treeView.addListener(this); //Callback public void treeViewEvent(TreeViewEvent e) { if (e.isExpand()) { //it's an expand event... //let's get the value of the 1st column String value = model.getValue (e.getTreeIter(), (DataColumnString) cols[1]); System.out.println("value: " + value); } } ------------------------------------------------------ Cheers, J.V. --- Manuel Ledesma <man...@co...> wrote: > I finally got the callback working, But now If I try to use the handlers > the program is quitting. I read that the GObject.getGObjectFromHandle is > for internal use but How can I get the row that just expanded. > > example. > > // Callback definition ... > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > result); > > > // Callback function > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > GObject test = GObject.getGObjectFromHandle(widget); > > return true; > } > > > On Wed, 2005-03-30 at 23:07 -0500, Manuel Ledesma wrote: > > > I'm trying to catch the "test-expand-row" signal. I cannot find an > > example for Java. > > > > Can someone illustrate me ? > __________________________________________________ Converse com seus amigos em tempo real com o Yahoo! Messenger http://br.download.yahoo.com/messenger/ |
From: Joao V. <jvi...@ya...> - 2005-03-31 13:08:12
|
--- Joao Victor <jvi...@ya...> wrote: > String value = model.getValue (e.getTreeIter(), (DataColumnString) cols[1]); That should be *cols[0]*... duh, sorry. Cheers, J.V. Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ |
From: Manuel L. <man...@co...> - 2005-03-31 23:29:51
|
I have already tried that and It does not work. This is why? I'm trying to use the signal. Let me paste my class complete ... here is the output of this class: -- row expanded -- test-expand-row -- row collapsed -- Expanded : false Expanded : false The row is expanded but the class does not receive any event, only when row is collapsed and somehow get called twice. This was my first approach before trying the signals. Probably there's a bug and event should happen when row is expanded. public class DirectoryTree implements TreeViewListener { /** * Default constructor */ public DirectoryTree(TreeView treeView) { ... somethig begfore _treeView.addListener(this); } public TreeIter addNode(TreeIter parent, File file, boolean addImage) { TreeIter result = _treeStore.appendRow(parent); _treeView.addEventHandler("test-expand-row", "testExpandRow", this, result); return result; } public boolean testExpandRow(Handle widget, Handle data, Object obj) { System.out.println("test-expand-row"); return false; } public void treeViewEvent(TreeViewEvent event) { System.out.println("Expanded : " + event.isExpand()); TreeIter current = event.getTreeIter(); } } On Thu, 2005-03-31 at 09:56 -0300, Joao Victor wrote: > Try using addListener; take a look at the javadoc for TreeViewListener and TreeViewEvent. Here's a > quick example (i didn't compile it, so forgive me for silly errors): > > First, if you have a TreeView you'll need an array of DataColumns defining the columns, and a > model object. For the example, it'll be this: > > ------------------------------------------------------ > > //The columns > DataColumn cols = {new DataColumnString(), new DataColumnString()}; > > //the model object > TreeStore model = new TreeStore(cols); > > Now continuing with that code... > > _treeView.addListener(this); > > //Callback > public void treeViewEvent(TreeViewEvent e) { > > if (e.isExpand()) { > > //it's an expand event... > //let's get the value of the 1st column > > String value = model.getValue (e.getTreeIter(), (DataColumnString) cols[1]); > System.out.println("value: " + value); > } > } > > ------------------------------------------------------ > > > Cheers, > J.V. > > > > --- Manuel Ledesma <man...@co...> wrote: > > I finally got the callback working, But now If I try to use the handlers > > the program is quitting. I read that the GObject.getGObjectFromHandle is > > for internal use but How can I get the row that just expanded. > > > > example. > > > > // Callback definition ... > > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > > result); > > > > > > // Callback function > > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > > GObject test = GObject.getGObjectFromHandle(widget); > > > > return true; > > } > > > > > > On Wed, 2005-03-30 at 23:07 -0500, Manuel Ledesma wrote: > > > > > I'm trying to catch the "test-expand-row" signal. I cannot find an > > > example for Java. > > > > > > Can someone illustrate me ? > > > > __________________________________________________ > Converse com seus amigos em tempo real com o Yahoo! Messenger > http://br.download.yahoo.com/messenger/ > > > ------------------------------------------------------- > This SF.net email is sponsored by Demarc: > A global provider of Threat Management Solutions. > Download our HomeAdmin security software for free today! > http://www.demarc.com/info/Sentarus/hamr30 > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Laurent M. <la...@ao...> - 2005-04-01 00:52:23
|
>>>>> "Jeff" == Jeff Morgan <ku...@gm...> writes: Jeff> On Thu, 31 Mar 2005 19:07:03 -0500, Manuel Ledesma Jeff> <man...@co...> wrote: >> I start looking at the source and here is the list of signals map >> to TreeViewListener, ROW_COLLAPSED is defined and I believe it >> was intended to be ROW_EXPANDED. This is a easy bug to >> fix. Meanwhiel I will download the source and fixed myself but >> I'm still interesting of understanding how signals works in >> java-gnome. >> >> evtMap.initialize(this, TreeViewEvent.Type.COLUMNS_CHANGED); >> evtMap.initialize(this, >> TreeViewEvent.Type.EXPAND_COLLAPSE_CURSOR_ROW); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_ACTIVATED); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_ALL); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_PARENT); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_ROW); >> evtMap.initialize(this, >> TreeViewEvent.Type.START_INTERACTIVE_SEARCH); >> evtMap.initialize(this, TreeViewEvent.Type.TOGGLE_CURSOR_ROW); >> evtMap.initialize(this, TreeViewEvent.Type.UNSELECT_ALL); Jeff> Manuel, Jeff> Thanks. You are correct - this should be ROW_EXPANDED. Are Jeff> you going to be able to attend java-gnome-con this Saturday in Jeff> person or on irc? If so I will be giving an overview of the Jeff> java-gnome architecture including the event handling. In the Jeff> mean while I will fix this issue. Wasn't it fxid already ? http://bugzilla.gnome.org/show_bug.cgi?id=156712 Looks like there was a regression between 1.33.2.1 and 1.33.2.2... -- Laurent Martelli la...@ao... Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org |
From: Manuel L. <man...@co...> - 2005-04-01 00:07:14
|
I start looking at the source and here is the list of signals map to TreeViewListener, ROW_COLLAPSED is defined and I believe it was intended to be ROW_EXPANDED. This is a easy bug to fix. Meanwhiel I will download the source and fixed myself but I'm still interesting of understanding how signals works in java-gnome. evtMap.initialize(this, TreeViewEvent.Type.COLUMNS_CHANGED); evtMap.initialize(this, TreeViewEvent.Type.EXPAND_COLLAPSE_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.ROW_ACTIVATED); evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); evtMap.initialize(this, TreeViewEvent.Type.SELECT_ALL); evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_PARENT); evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.START_INTERACTIVE_SEARCH); evtMap.initialize(this, TreeViewEvent.Type.TOGGLE_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.UNSELECT_ALL); On Thu, 2005-03-31 at 18:29 -0500, Manuel Ledesma wrote: > I have already tried that and It does not work. This is why? I'm > trying to use the signal. Let me paste my class complete ... > > here is the output of this class: > -- row expanded -- > test-expand-row > -- row collapsed -- > Expanded : false > Expanded : false > > The row is expanded but the class does not receive any event, only > when row is collapsed and somehow get called twice. This was my first > approach before trying the signals. Probably there's a bug and event > should happen when row is expanded. > > > public class DirectoryTree implements TreeViewListener { > /** > * Default constructor > */ > public DirectoryTree(TreeView treeView) { > ... somethig begfore > _treeView.addListener(this); > } > > public TreeIter addNode(TreeIter parent, File file, boolean addImage) > { > TreeIter result = _treeStore.appendRow(parent); > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > result); > return result; > } > > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > System.out.println("test-expand-row"); > return false; > } > > public void treeViewEvent(TreeViewEvent event) { > > System.out.println("Expanded : " + event.isExpand()); > TreeIter current = event.getTreeIter(); > } > } > > > On Thu, 2005-03-31 at 09:56 -0300, Joao Victor wrote: > > > Try using addListener; take a look at the javadoc for TreeViewListener and TreeViewEvent. Here's a > > quick example (i didn't compile it, so forgive me for silly errors): > > > > First, if you have a TreeView you'll need an array of DataColumns defining the columns, and a > > model object. For the example, it'll be this: > > > > ------------------------------------------------------ > > > > //The columns > > DataColumn cols = {new DataColumnString(), new DataColumnString()}; > > > > //the model object > > TreeStore model = new TreeStore(cols); > > > > Now continuing with that code... > > > > _treeView.addListener(this); > > > > //Callback > > public void treeViewEvent(TreeViewEvent e) { > > > > if (e.isExpand()) { > > > > //it's an expand event... > > //let's get the value of the 1st column > > > > String value = model.getValue (e.getTreeIter(), (DataColumnString) cols[1]); > > System.out.println("value: " + value); > > } > > } > > > > ------------------------------------------------------ > > > > > > Cheers, > > J.V. > > > > > > > > --- Manuel Ledesma <man...@co...> wrote: > > > I finally got the callback working, But now If I try to use the handlers > > > the program is quitting. I read that the GObject.getGObjectFromHandle is > > > for internal use but How can I get the row that just expanded. > > > > > > example. > > > > > > // Callback definition ... > > > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > > > result); > > > > > > > > > // Callback function > > > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > > > GObject test = GObject.getGObjectFromHandle(widget); > > > > > > return true; > > > } > > > > > > > > > On Wed, 2005-03-30 at 23:07 -0500, Manuel Ledesma wrote: > > > > > > > I'm trying to catch the "test-expand-row" signal. I cannot find an > > > > example for Java. > > > > > > > > Can someone illustrate me ? > > > > > > > __________________________________________________ > > Converse com seus amigos em tempo real com o Yahoo! Messenger > > http://br.download.yahoo.com/messenger/ > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by Demarc: > > A global provider of Threat Management Solutions. > > Download our HomeAdmin security software for free today! > > http://www.demarc.com/info/Sentarus/hamr30 > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Jeff M. <ku...@gm...> - 2005-04-01 00:17:50
|
On Thu, 31 Mar 2005 19:07:03 -0500, Manuel Ledesma <man...@co...> wrote: > I start looking at the source and here is the list of signals map to > TreeViewListener, ROW_COLLAPSED is defined and I believe it was intended to > be ROW_EXPANDED. This is a easy bug to fix. Meanwhiel I will download the > source and fixed myself but I'm still interesting of understanding how > signals works in java-gnome. > > evtMap.initialize(this, TreeViewEvent.Type.COLUMNS_CHANGED); > evtMap.initialize(this, TreeViewEvent.Type.EXPAND_COLLAPSE_CURSOR_ROW); > evtMap.initialize(this, TreeViewEvent.Type.ROW_ACTIVATED); > evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); > evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); > evtMap.initialize(this, TreeViewEvent.Type.SELECT_ALL); > evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_PARENT); > evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_ROW); > evtMap.initialize(this, TreeViewEvent.Type.START_INTERACTIVE_SEARCH); > evtMap.initialize(this, TreeViewEvent.Type.TOGGLE_CURSOR_ROW); > evtMap.initialize(this, TreeViewEvent.Type.UNSELECT_ALL); Manuel, Thanks. You are correct - this should be ROW_EXPANDED. Are you going to be able to attend java-gnome-con this Saturday in person or on irc? If so I will be giving an overview of the java-gnome architecture including the event handling. In the mean while I will fix this issue. -- Jeffrey Morgan "The highest reward for a man's toil is not what he gets for it, but what he becomes by it" - Jon Ruskin |
From: Laurent M. <la...@ao...> - 2005-04-01 01:02:14
|
>>>>> "Jeff" == Jeff Morgan <ku...@gm...> writes: Jeff> On Thu, 31 Mar 2005 19:07:03 -0500, Manuel Ledesma Jeff> <man...@co...> wrote: >> I start looking at the source and here is the list of signals map >> to TreeViewListener, ROW_COLLAPSED is defined and I believe it >> was intended to be ROW_EXPANDED. This is a easy bug to >> fix. Meanwhiel I will download the source and fixed myself but >> I'm still interesting of understanding how signals works in >> java-gnome. >> >> evtMap.initialize(this, TreeViewEvent.Type.COLUMNS_CHANGED); >> evtMap.initialize(this, >> TreeViewEvent.Type.EXPAND_COLLAPSE_CURSOR_ROW); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_ACTIVATED); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); >> evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_ALL); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_PARENT); >> evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_ROW); >> evtMap.initialize(this, >> TreeViewEvent.Type.START_INTERACTIVE_SEARCH); >> evtMap.initialize(this, TreeViewEvent.Type.TOGGLE_CURSOR_ROW); >> evtMap.initialize(this, TreeViewEvent.Type.UNSELECT_ALL); Jeff> Manuel, Jeff> Thanks. You are correct - this should be ROW_EXPANDED. Are Jeff> you going to be able to attend java-gnome-con this Saturday in Jeff> person or on irc? If so I will be giving an overview of the Jeff> java-gnome architecture including the event handling. In the Jeff> mean while I will fix this issue. Wasn't it fxid already ? http://bugzilla.gnome.org/show_bug.cgi?id=156712 Looks like there was a regression between 1.33.2.1 and 1.33.2.2... -- Laurent Martelli la...@ao... Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org |
From: Jeff M. <ku...@gm...> - 2005-04-01 01:16:08
|
On Fri, 01 Apr 2005 02:51:27 +0200, Laurent Martelli <la...@ao...> wrote: > Wasn't it fxid already ? > http://bugzilla.gnome.org/show_bug.cgi?id=156712 > > Looks like there was a regression between 1.33.2.1 and 1.33.2.2... Wow. I think you are right. This was around the time we merged in the 64-bit support. This must have gotten lost during the merge. > > -- > Laurent Martelli > la...@ao... Java Aspect Components > http://www.aopsys.com/ http://jac.objectweb.org > > > ------------------------------------------------------- > This SF.net email is sponsored by Demarc: > A global provider of Threat Management Solutions. > Download our HomeAdmin security software for free today! > http://www.demarc.com/info/Sentarus/hamr30 > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > -- Jeffrey Morgan "The highest reward for a man's toil is not what he gets for it, but what he becomes by it" - Jon Ruskin |