Skip to main content



      Home
Home » Eclipse Projects » GEF » How can I create objects int the outline viewer without figure?
How can I create objects int the outline viewer without figure? [message #92358] Thu, 04 September 2003 05:34 Go to next message
Eclipse UserFriend
Originally posted by: stephane.fournier.sysde.eads.net

I would like to create an application to deal with subscribers and
networks.

I would like to create 2 default objects in my outline viewer, one to
represent an Address Book and one for the NetworkList. These two objects
are children of the root element.

But I don't really need graphical figure for theses 2 objects. So when I
create a subscriber or a network from the palette, I would like
subscribers as children of the Address Book and networks as children of
the Networks'List.

At this moment, I have created editparts for the AddressBook and for the
networks'list, but the createFigure method has to be overridden. So, I did
the same thing like the LogicDiagram (GEF Example) createFigure method but
It is not really good.

When I select theses 2 objects, I see the selection in the editor part.
How can I prevent from such a selection in the graphical editor ? How can
I simply add subscribers or networks from the palette in these 2
containers without graphical representations ?


Stephane
Re: How can I create objects int the outline viewer without figure? [message #92418 is a reply to message #92358] Thu, 04 September 2003 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This post is confusing. Tree do not show figures, they show treeitems.

If you basically want two grouping treeitems with no corresponding *model*
object, just create a fake model object, perhaps the String "subscribers".
Use that as the model for the grouping editpart. Then, have that editpart
actually observe and obtain its children from the "real" model.

"Stephane Fournier" <stephane.fournier@sysde.eads.net> wrote in message
news:bj70uf$jip$1@eclipse.org...
> I would like to create an application to deal with subscribers and
> networks.
>
> I would like to create 2 default objects in my outline viewer, one to
> represent an Address Book and one for the NetworkList. These two objects
> are children of the root element.
>
> But I don't really need graphical figure for theses 2 objects. So when I
> create a subscriber or a network from the palette, I would like
> subscribers as children of the Address Book and networks as children of
> the Networks'List.
>
> At this moment, I have created editparts for the AddressBook and for the
> networks'list, but the createFigure method has to be overridden. So, I did
> the same thing like the LogicDiagram (GEF Example) createFigure method but
> It is not really good.
>
> When I select theses 2 objects, I see the selection in the editor part.
> How can I prevent from such a selection in the graphical editor ? How can
> I simply add subscribers or networks from the palette in these 2
> containers without graphical representations ?
>
>
> Stephane
>
>
>
>
>
>
>
Re: How can I create objects int the outline viewer without figure? [message #92554 is a reply to message #92418] Thu, 04 September 2003 14:15 Go to previous message
Eclipse UserFriend
Stephane,
Correct me if I'm wrong, but I think the question you're asking is how
to have something in the outline viewer that doesn't show up in the
editor. What you'd need to do is implement 2 TreeEditParts -- one for
the address book and one for the network list -- that will be children
of the main TreeEditPart. In your main TreeEditPart (which will be
similar to the LogicContainerTreeEditPart), you should change
getModelChildren() to return a list that just contains the model objects
corresponding to the address book and network list (you may need to
create new model objects for these 2 edit parts)...

protected List getModelChildren() {
List children = new ArrayList(2);
children.add(addressBooks);
children.add(networkLists);
return children;
}

....where addressBooks and networkLists are your model objects.

I tried this with the logic example and decided to implement model
objects for the 2 subsections because they could provide icons, text,
etc for the TreeItems. Make sure you update your factory to create the
appropriate edit parts for the new models. Finally, in the address book
and network list edit parts, override getModelChildren() to get the main
diagram (getParent().getModel()) and iterate through its children to get
the children that belong to that subsection. For example, in
AddressBookTreeContainerEditPart (wow, that's long ;)...

protected List getModelChildren() {
List children = new ArrayList();
Iterator iter =
((YourMainDiagram)getParent().getModel()).getChildren().iter ator();
while (iter.hasNext()) {
Object child = iter.next();
if (child instanceof AddressBook)
children.add(child);
}
return children;
}

Hope this helps.
Eric



Randy Hudson wrote:
> This post is confusing. Tree do not show figures, they show treeitems.
>
> If you basically want two grouping treeitems with no corresponding *model*
> object, just create a fake model object, perhaps the String "subscribers".
> Use that as the model for the grouping editpart. Then, have that editpart
> actually observe and obtain its children from the "real" model.
>
> "Stephane Fournier" <stephane.fournier@sysde.eads.net> wrote in message
> news:bj70uf$jip$1@eclipse.org...
>
>>I would like to create an application to deal with subscribers and
>>networks.
>>
>>I would like to create 2 default objects in my outline viewer, one to
>>represent an Address Book and one for the NetworkList. These two objects
>>are children of the root element.
>>
>>But I don't really need graphical figure for theses 2 objects. So when I
>>create a subscriber or a network from the palette, I would like
>>subscribers as children of the Address Book and networks as children of
>>the Networks'List.
>>
>>At this moment, I have created editparts for the AddressBook and for the
>>networks'list, but the createFigure method has to be overridden. So, I did
>>the same thing like the LogicDiagram (GEF Example) createFigure method but
>>It is not really good.
>>
>>When I select theses 2 objects, I see the selection in the editor part.
>>How can I prevent from such a selection in the graphical editor ? How can
>>I simply add subscribers or networks from the palette in these 2
>>containers without graphical representations ?
>>
>>
>>Stephane
>>
>>
>>
>>
>>
>>
>>
>
>
>
Previous Topic:How can I select a connection
Next Topic:How can I stretch my contents figure to a preferred size?
Goto Forum:
  


Current Time: Wed May 07 15:19:52 EDT 2025

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

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

Back to the top