Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Gantt: remove Connections
Gantt: remove Connections [message #64853] Fri, 19 June 2009 11:58 Go to next message
Manuel Steurer is currently offline Manuel SteurerFriend
Messages: 35
Registered: July 2009
Member
Hi,

I want to show specific connections when a user clicks on a GanttEvent.
Of course I have to remove/hide the old ones, how can I do this? I tried
disposing all connections, but this yields a NPE. I changed the source
accordingly (set the GanttConnection's parent), but is there another
way?

this is what I do (essentially):


Collection<GanttConnection> connections = new
HashSet<GanttConnection>();

connections.addAll(ganttChart.getGanttComposite().getGanttCo nnections())
;
for (GanttConnection conn : connections)
conn.dispose();
....
n times:
ganttChart.addConnection(parentEvent, childEvent);


I I call this twice, I get an NPE at the conn.dispose() line

Thanks,
Manuel

--
Re: Gantt: remove Connections [message #64900 is a reply to message #64853] Sun, 21 June 2009 16:17 Go to previous messageGo to next message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Hi Manuel,

Can you post or send me the NPE? I'm not suggesting connections should be
disposed and re-set as that's not exactly intended behavor and I'm not all
too surprised that there may be issues doing it that way, but I'd still like
to see what the issue is :-)

As for what you're looking for, won't this ISetting give you what you want?
/**
* Whether to only show the dependency connections only when an event is
selected, as opposed to always showing the lines.
*
* @return true if to show them only on selections. Default is false.
*/
public boolean showOnlyDependenciesForSelectedItems();
Regards,
Emil


"Manuel Steurer" <manuel.steurer@quattro-soft.de> wrote in message
news:h1fuhh$689$1@build.eclipse.org...
> Hi,
>
> I want to show specific connections when a user clicks on a GanttEvent.
> Of course I have to remove/hide the old ones, how can I do this? I tried
> disposing all connections, but this yields a NPE. I changed the source
> accordingly (set the GanttConnection's parent), but is there another
> way?
>
> this is what I do (essentially):
>
>
> Collection<GanttConnection> connections = new
> HashSet<GanttConnection>();
>
> connections.addAll(ganttChart.getGanttComposite().getGanttCo nnections())
> ;
> for (GanttConnection conn : connections)
> conn.dispose();
> ...
> n times:
> ganttChart.addConnection(parentEvent, childEvent);
>
>
> I I call this twice, I get an NPE at the conn.dispose() line
>
> Thanks,
> Manuel
>
> --
>
Re: Gantt: remove Connections [message #64939 is a reply to message #64900] Mon, 22 June 2009 11:55 Go to previous message
Manuel Steurer is currently offline Manuel SteurerFriend
Messages: 35
Registered: July 2009
Member
Hi Emil,

I attached a modified ConnectionExample-snippet. Works with your latest
nightly, not with the stable version though (where the GanttConnection
class does not exist yet as a public class).

To remedy the npe I did this to the GanttConnection package constructor:

GanttConnection(GanttComposite parent, GanttEvent source, GanttEvent
target,
Color color)
{
this._parent = parent;
this._source = source;
this._target = target;
this._color = color;
}

showOnlyDependenciesForSelectedItems is almost what I want, but I am
more flexible if I create the connections on the fly (see attached
screenshots)

(Although I'm not sure yet which connection-display-mode will actually
suit my needs better, showOnlyDependenciesForSelectedItems may also be
better performance-wise, if performance should ever be an issue.)

Greetings,
Manuel


Emil Crumhorn wrote:

> Hi Manuel,
>
> Can you post or send me the NPE? I'm not suggesting connections
> should be disposed and re-set as that's not exactly intended behavor
> and I'm not all too surprised that there may be issues doing it that
> way, but I'd still like to see what the issue is :-)
>
> As for what you're looking for, won't this ISetting give you what you
> want? /**
> * Whether to only show the dependency connections only when an
> event is selected, as opposed to always showing the lines. *
> * @return true if to show them only on selections. Default is false.
> */
> public boolean showOnlyDependenciesForSelectedItems();
> Regards,
> Emil
>
>
> "Manuel Steurer" <manuel.steurer@quattro-soft.de> wrote in message
> news:h1fuhh$689$1@build.eclipse.org...
> > Hi,
> >
> > I want to show specific connections when a user clicks on a
> > GanttEvent. Of course I have to remove/hide the old ones, how can
> > I do this? I tried disposing all connections, but this yields a
> > NPE. I changed the source accordingly (set the GanttConnection's
> > parent), but is there another way?
> >
> > this is what I do (essentially):
> >
> >
> >Collection<GanttConnection> connections = new
> > HashSet<GanttConnection>();
> >
> > connections.addAll(ganttChart.getGanttComposite().getGanttCo nnection
> > s()) ;
> > for (GanttConnection conn : connections)
> > conn.dispose();
> > ...
> > n times:
> > ganttChart.addConnection(parentEvent, childEvent);
> >
> >
> > I I call this twice, I get an NPE at the conn.dispose() line
> >
> > Thanks,
> > Manuel
> >
> > --



--




Re: Gantt: remove Connections [message #595318 is a reply to message #64853] Sun, 21 June 2009 16:17 Go to previous message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Hi Manuel,

Can you post or send me the NPE? I'm not suggesting connections should be
disposed and re-set as that's not exactly intended behavor and I'm not all
too surprised that there may be issues doing it that way, but I'd still like
to see what the issue is :-)

As for what you're looking for, won't this ISetting give you what you want?
/**
* Whether to only show the dependency connections only when an event is
selected, as opposed to always showing the lines.
*
* @return true if to show them only on selections. Default is false.
*/
public boolean showOnlyDependenciesForSelectedItems();
Regards,
Emil


"Manuel Steurer" <manuel.steurer@quattro-soft.de> wrote in message
news:h1fuhh$689$1@build.eclipse.org...
> Hi,
>
> I want to show specific connections when a user clicks on a GanttEvent.
> Of course I have to remove/hide the old ones, how can I do this? I tried
> disposing all connections, but this yields a NPE. I changed the source
> accordingly (set the GanttConnection's parent), but is there another
> way?
>
> this is what I do (essentially):
>
>
> Collection<GanttConnection> connections = new
> HashSet<GanttConnection>();
>
> connections.addAll(ganttChart.getGanttComposite().getGanttCo nnections())
> ;
> for (GanttConnection conn : connections)
> conn.dispose();
> ...
> n times:
> ganttChart.addConnection(parentEvent, childEvent);
>
>
> I I call this twice, I get an NPE at the conn.dispose() line
>
> Thanks,
> Manuel
>
> --
>
Re: Gantt: remove Connections [message #595337 is a reply to message #64900] Mon, 22 June 2009 11:55 Go to previous message
Manuel Steurer is currently offline Manuel SteurerFriend
Messages: 35
Registered: July 2009
Member
Hi Emil,

I attached a modified ConnectionExample-snippet. Works with your latest
nightly, not with the stable version though (where the GanttConnection
class does not exist yet as a public class).

To remedy the npe I did this to the GanttConnection package constructor:

GanttConnection(GanttComposite parent, GanttEvent source, GanttEvent
target,
Color color)
{
this._parent = parent;
this._source = source;
this._target = target;
this._color = color;
}

showOnlyDependenciesForSelectedItems is almost what I want, but I am
more flexible if I create the connections on the fly (see attached
screenshots)

(Although I'm not sure yet which connection-display-mode will actually
suit my needs better, showOnlyDependenciesForSelectedItems may also be
better performance-wise, if performance should ever be an issue.)

Greetings,
Manuel


Emil Crumhorn wrote:

> Hi Manuel,
>
> Can you post or send me the NPE? I'm not suggesting connections
> should be disposed and re-set as that's not exactly intended behavor
> and I'm not all too surprised that there may be issues doing it that
> way, but I'd still like to see what the issue is :-)
>
> As for what you're looking for, won't this ISetting give you what you
> want? /**
> * Whether to only show the dependency connections only when an
> event is selected, as opposed to always showing the lines. *
> * @return true if to show them only on selections. Default is false.
> */
> public boolean showOnlyDependenciesForSelectedItems();
> Regards,
> Emil
>
>
> "Manuel Steurer" <manuel.steurer@quattro-soft.de> wrote in message
> news:h1fuhh$689$1@build.eclipse.org...
> > Hi,
> >
> > I want to show specific connections when a user clicks on a
> > GanttEvent. Of course I have to remove/hide the old ones, how can
> > I do this? I tried disposing all connections, but this yields a
> > NPE. I changed the source accordingly (set the GanttConnection's
> > parent), but is there another way?
> >
> > this is what I do (essentially):
> >
> >
> >Collection<GanttConnection> connections = new
> > HashSet<GanttConnection>();
> >
> > connections.addAll(ganttChart.getGanttComposite().getGanttCo nnection
> > s()) ;
> > for (GanttConnection conn : connections)
> > conn.dispose();
> > ...
> > n times:
> > ganttChart.addConnection(parentEvent, childEvent);
> >
> >
> > I I call this twice, I get an NPE at the conn.dispose() line
> >
> > Thanks,
> > Manuel
> >
> > --



--




Previous Topic:help about gallery
Next Topic:Questions on Nebula Grid
Goto Forum:
  


Current Time: Mon Dec 22 19:56:52 GMT 2014

Powered by FUDForum. Page generated in 0.02690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software