Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Grouping objects under a folder
Grouping objects under a folder [message #35983] |
Mon, 05 June 2006 03:54 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
Dear All,
I use EMF to define my domain model. In the editor of my data model, I
display my data model in a TreeViewer. Now I want to group objects of
the same type in its own folder. My problem is that I can not refresh
immediately the objects under folder after creating a new object. If
anyone has ever implemented a similar feature, could you share that with me?
Here is an example of my model and how I implement it:
- I manage a pet store, I define an EMF model, let's say PetStore model.
The root element of my TreeViewer is a Store object
- I can add animals to my pet store
- I want to group objects of the same type in a specific folder, for
example: mammal, reptile.
- My problem is that I can not refresh immediately the objects under
folder after creating a new object.
- To implement the folder, I define another model, let's say UIThing
model. I don't want to tie the 'folder' concept to my PerStore model.
- In UIThing model, I define a DummyFolder object which does not know
anything about PerStore model. It has a attribute which is an EMF
feature. It also has a 'parent' attribute which is an EObject. Here, the
DummyFolder is generic and not tied to any specific model.
- To make DummyFolder displayed in the TreeViewer, I do like this:
+ Override the StoreItemProvider.getChilden(). I add two DummyFolder
objects for mammal and reptile to the returned children collection. I
set parent and feature for the two DummyFolder objects accordingly.
+ Override the DummyFolderItemProvider.getChilden(). I get the parent
object and then get all children of the type 'feature' (mammal or reptile).
- I get existing objects displayed correctly under its own folder nicely.
- When I add a new animal, I can not refresh the content (children) of
the DummyFolder object immediately and keep the collapse/expand status!
- In the StoreItemProvider.notifyChanged(), I can only refresh the
Store's content by calling:
case PetStorePackage.ANIMAL__MAMMAL:
fireNotifyChanged(new ViewerNotification(notification,
notification.getNotifier(), true, false));
- The content of the Store is updated, and also the content of MAMMAL
dummy folder, but the "collapse/expand" state of the mammal dummy folder
is set to "collapsed", even though it's was expanded before adding new
animal! That's quite right because only the Store object is updated, and
DummyFolder is a (fake) 'child' of it, it will only update the 'plus'
sign, and make the DummyFolder collapsed.
- I've tried to modify the "notification" to refresh the DummyFolder but
no success.
I'm really stuck at that point. Any suggestion will be appreciated.
Thanks,
Hoc
|
|
|
Re: Grouping objects under a folder [message #36052 is a reply to message #35983] |
Mon, 05 June 2006 11:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hoc,
This sounds like a question that is more appropriate for the
eclipse.tools.emf newsgroup. You will definitely get an answer, there.
Christian
Hoc Nguyen wrote:
> Dear All,
>
> I use EMF to define my domain model. In the editor of my data model, I
> display my data model in a TreeViewer. Now I want to group objects of
> the same type in its own folder. My problem is that I can not refresh
> immediately the objects under folder after creating a new object. If
> anyone has ever implemented a similar feature, could you share that with
> me?
>
> Here is an example of my model and how I implement it:
> - I manage a pet store, I define an EMF model, let's say PetStore model.
> The root element of my TreeViewer is a Store object
> - I can add animals to my pet store
> - I want to group objects of the same type in a specific folder, for
> example: mammal, reptile.
> - My problem is that I can not refresh immediately the objects under
> folder after creating a new object.
> - To implement the folder, I define another model, let's say UIThing
> model. I don't want to tie the 'folder' concept to my PerStore model.
> - In UIThing model, I define a DummyFolder object which does not know
> anything about PerStore model. It has a attribute which is an EMF
> feature. It also has a 'parent' attribute which is an EObject. Here, the
> DummyFolder is generic and not tied to any specific model.
> - To make DummyFolder displayed in the TreeViewer, I do like this:
> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
> objects for mammal and reptile to the returned children collection. I
> set parent and feature for the two DummyFolder objects accordingly.
> + Override the DummyFolderItemProvider.getChilden(). I get the parent
> object and then get all children of the type 'feature' (mammal or
> reptile). - I get existing objects displayed correctly under its own
> folder nicely. - When I add a new animal, I can not refresh the content
> (children) of the DummyFolder object immediately and keep the
> collapse/expand status! - In the StoreItemProvider.notifyChanged(), I can
> only refresh the Store's content by calling:
>
> case PetStorePackage.ANIMAL__MAMMAL:
> fireNotifyChanged(new ViewerNotification(notification,
> notification.getNotifier(), true, false));
>
> - The content of the Store is updated, and also the content of MAMMAL
> dummy folder, but the "collapse/expand" state of the mammal dummy folder
> is set to "collapsed", even though it's was expanded before adding new
> animal! That's quite right because only the Store object is updated, and
> DummyFolder is a (fake) 'child' of it, it will only update the 'plus'
> sign, and make the DummyFolder collapsed.
>
> - I've tried to modify the "notification" to refresh the DummyFolder but
> no success.
>
> I'm really stuck at that point. Any suggestion will be appreciated.
>
> Thanks,
> Hoc
|
|
|
Re: Grouping objects under a folder [message #36120 is a reply to message #35983] |
Mon, 05 June 2006 14:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
Hoc,
There are examples like this from the book. In the book example, a
derived version of Store would be used for the dummy folder item
provider and the store would know when animals are added so would
produce notifications indicating that children were added to the "dummy"
folder. Another way to fake this would be to have the Store item
provider produce a notification for each of the dummy folders
(substituting each dummy folder in place of notification.getNotifier())
when the store's animals are changed. In the end, your dummy folder
object needs to produce a notification just like would Store when adding
a child. You might need to change the getParent of the animal item
provider to specify the right dummy folder if you need navigation to be
able to select the object in an unexpanded tree.
Hoc Nguyen wrote:
> Dear All,
>
> I use EMF to define my domain model. In the editor of my data model, I
> display my data model in a TreeViewer. Now I want to group objects of
> the same type in its own folder. My problem is that I can not refresh
> immediately the objects under folder after creating a new object. If
> anyone has ever implemented a similar feature, could you share that
> with me?
>
> Here is an example of my model and how I implement it:
> - I manage a pet store, I define an EMF model, let's say PetStore
> model. The root element of my TreeViewer is a Store object
> - I can add animals to my pet store
> - I want to group objects of the same type in a specific folder, for
> example: mammal, reptile.
> - My problem is that I can not refresh immediately the objects under
> folder after creating a new object.
> - To implement the folder, I define another model, let's say UIThing
> model. I don't want to tie the 'folder' concept to my PerStore model.
> - In UIThing model, I define a DummyFolder object which does not know
> anything about PerStore model. It has a attribute which is an EMF
> feature. It also has a 'parent' attribute which is an EObject. Here,
> the DummyFolder is generic and not tied to any specific model.
> - To make DummyFolder displayed in the TreeViewer, I do like this:
> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
> objects for mammal and reptile to the returned children collection. I
> set parent and feature for the two DummyFolder objects accordingly.
> + Override the DummyFolderItemProvider.getChilden(). I get the
> parent object and then get all children of the type 'feature' (mammal
> or reptile).
> - I get existing objects displayed correctly under its own folder nicely.
> - When I add a new animal, I can not refresh the content (children) of
> the DummyFolder object immediately and keep the collapse/expand status!
> - In the StoreItemProvider.notifyChanged(), I can only refresh the
> Store's content by calling:
>
> case PetStorePackage.ANIMAL__MAMMAL:
> fireNotifyChanged(new ViewerNotification(notification,
> notification.getNotifier(), true, false));
>
> - The content of the Store is updated, and also the content of MAMMAL
> dummy folder, but the "collapse/expand" state of the mammal dummy
> folder is set to "collapsed", even though it's was expanded before
> adding new animal! That's quite right because only the Store object is
> updated, and DummyFolder is a (fake) 'child' of it, it will only
> update the 'plus' sign, and make the DummyFolder collapsed.
>
> - I've tried to modify the "notification" to refresh the DummyFolder
> but no success.
>
> I'm really stuck at that point. Any suggestion will be appreciated.
>
> Thanks,
> Hoc
|
|
|
Re: Grouping objects under a folder [message #36221 is a reply to message #36120] |
Tue, 06 June 2006 05:27 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
Thank you, Ed Merks. What book are you mentioning? Is there a link to
download it?
Hoc
Ed Merks wrote:
> Hoc,
>
> There are examples like this from the book. In the book example, a
> derived version of Store would be used for the dummy folder item
> provider and the store would know when animals are added so would
> produce notifications indicating that children were added to the "dummy"
> folder. Another way to fake this would be to have the Store item
> provider produce a notification for each of the dummy folders
> (substituting each dummy folder in place of notification.getNotifier())
> when the store's animals are changed. In the end, your dummy folder
> object needs to produce a notification just like would Store when adding
> a child. You might need to change the getParent of the animal item
> provider to specify the right dummy folder if you need navigation to be
> able to select the object in an unexpanded tree.
>
>
> Hoc Nguyen wrote:
>
>> Dear All,
>>
>> I use EMF to define my domain model. In the editor of my data model, I
>> display my data model in a TreeViewer. Now I want to group objects of
>> the same type in its own folder. My problem is that I can not refresh
>> immediately the objects under folder after creating a new object. If
>> anyone has ever implemented a similar feature, could you share that
>> with me?
>>
>> Here is an example of my model and how I implement it:
>> - I manage a pet store, I define an EMF model, let's say PetStore
>> model. The root element of my TreeViewer is a Store object
>> - I can add animals to my pet store
>> - I want to group objects of the same type in a specific folder, for
>> example: mammal, reptile.
>> - My problem is that I can not refresh immediately the objects under
>> folder after creating a new object.
>> - To implement the folder, I define another model, let's say UIThing
>> model. I don't want to tie the 'folder' concept to my PerStore model.
>> - In UIThing model, I define a DummyFolder object which does not know
>> anything about PerStore model. It has a attribute which is an EMF
>> feature. It also has a 'parent' attribute which is an EObject. Here,
>> the DummyFolder is generic and not tied to any specific model.
>> - To make DummyFolder displayed in the TreeViewer, I do like this:
>> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
>> objects for mammal and reptile to the returned children collection. I
>> set parent and feature for the two DummyFolder objects accordingly.
>> + Override the DummyFolderItemProvider.getChilden(). I get the
>> parent object and then get all children of the type 'feature' (mammal
>> or reptile).
>> - I get existing objects displayed correctly under its own folder nicely.
>> - When I add a new animal, I can not refresh the content (children) of
>> the DummyFolder object immediately and keep the collapse/expand status!
>> - In the StoreItemProvider.notifyChanged(), I can only refresh the
>> Store's content by calling:
>>
>> case PetStorePackage.ANIMAL__MAMMAL:
>> fireNotifyChanged(new ViewerNotification(notification,
>> notification.getNotifier(), true, false));
>>
>> - The content of the Store is updated, and also the content of MAMMAL
>> dummy folder, but the "collapse/expand" state of the mammal dummy
>> folder is set to "collapsed", even though it's was expanded before
>> adding new animal! That's quite right because only the Store object is
>> updated, and DummyFolder is a (fake) 'child' of it, it will only
>> update the 'plus' sign, and make the DummyFolder collapsed.
>>
>> - I've tried to modify the "notification" to refresh the DummyFolder
>> but no success.
>>
>> I'm really stuck at that point. Any suggestion will be appreciated.
>>
>> Thanks,
>> Hoc
|
|
|
Re: Grouping objects under a folder [message #36323 is a reply to message #36221] |
Tue, 06 June 2006 11:57 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------060904070806090700010109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hoc,
The EMF book talks about this in 14.2.3
http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf
Hoc Nguyen wrote:
> Thank you, Ed Merks. What book are you mentioning? Is there a link to
> download it?
> Hoc
>
> Ed Merks wrote:
>
>> Hoc,
>>
>> There are examples like this from the book. In the book example, a
>> derived version of Store would be used for the dummy folder item
>> provider and the store would know when animals are added so would
>> produce notifications indicating that children were added to the
>> "dummy" folder. Another way to fake this would be to have the Store
>> item provider produce a notification for each of the dummy folders
>> (substituting each dummy folder in place of
>> notification.getNotifier()) when the store's animals are changed. In
>> the end, your dummy folder object needs to produce a notification
>> just like would Store when adding a child. You might need to change
>> the getParent of the animal item provider to specify the right dummy
>> folder if you need navigation to be able to select the object in an
>> unexpanded tree.
>>
>>
>> Hoc Nguyen wrote:
>>
>>> Dear All,
>>>
>>> I use EMF to define my domain model. In the editor of my data model,
>>> I display my data model in a TreeViewer. Now I want to group objects
>>> of the same type in its own folder. My problem is that I can not
>>> refresh immediately the objects under folder after creating a new
>>> object. If anyone has ever implemented a similar feature, could you
>>> share that with me?
>>>
>>> Here is an example of my model and how I implement it:
>>> - I manage a pet store, I define an EMF model, let's say PetStore
>>> model. The root element of my TreeViewer is a Store object
>>> - I can add animals to my pet store
>>> - I want to group objects of the same type in a specific folder, for
>>> example: mammal, reptile.
>>> - My problem is that I can not refresh immediately the objects under
>>> folder after creating a new object.
>>> - To implement the folder, I define another model, let's say UIThing
>>> model. I don't want to tie the 'folder' concept to my PerStore model.
>>> - In UIThing model, I define a DummyFolder object which does not
>>> know anything about PerStore model. It has a attribute which is an
>>> EMF feature. It also has a 'parent' attribute which is an EObject.
>>> Here, the DummyFolder is generic and not tied to any specific model.
>>> - To make DummyFolder displayed in the TreeViewer, I do like this:
>>> + Override the StoreItemProvider.getChilden(). I add two
>>> DummyFolder objects for mammal and reptile to the returned children
>>> collection. I set parent and feature for the two DummyFolder objects
>>> accordingly.
>>> + Override the DummyFolderItemProvider.getChilden(). I get the
>>> parent object and then get all children of the type 'feature'
>>> (mammal or reptile).
>>> - I get existing objects displayed correctly under its own folder
>>> nicely.
>>> - When I add a new animal, I can not refresh the content (children)
>>> of the DummyFolder object immediately and keep the collapse/expand
>>> status!
>>> - In the StoreItemProvider.notifyChanged(), I can only refresh the
>>> Store's content by calling:
>>>
>>> case PetStorePackage.ANIMAL__MAMMAL:
>>> fireNotifyChanged(new
>>> ViewerNotification(notification, notification.getNotifier(), true,
>>> false));
>>>
>>> - The content of the Store is updated, and also the content of
>>> MAMMAL dummy folder, but the "collapse/expand" state of the mammal
>>> dummy folder is set to "collapsed", even though it's was expanded
>>> before adding new animal! That's quite right because only the Store
>>> object is updated, and DummyFolder is a (fake) 'child' of it, it
>>> will only update the 'plus' sign, and make the DummyFolder collapsed.
>>>
>>> - I've tried to modify the "notification" to refresh the DummyFolder
>>> but no success.
>>>
>>> I'm really stuck at that point. Any suggestion will be appreciated.
>>>
>>> Thanks,
>>> Hoc
>>
--------------060904070806090700010109
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hoc,<br>
<br>
The EMF book talks about this in 14.2.3<br>
<blockquote> <a
href=" http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf"> http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf</a><br>
</blockquote>
<br>
Hoc Nguyen wrote:
<blockquote cite="mide633rp$nf1$2@utils.eclipse.org" type="cite">Thank
you, Ed Merks. What book are you mentioning? Is there a link to
download it?
<br>
Hoc
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Hoc,
<br>
<br>
There are examples like this from the book. In the book example, a
derived version of Store would be used for the dummy folder item
provider and the store would know when animals are added so would
produce notifications indicating that children were added to the
"dummy" folder. Another way to fake this would be to have the Store
item provider produce a notification for each of the dummy folders
(substituting each dummy folder in place of notification.getNotifier())
when the store's animals are changed. In the end, your dummy folder
object needs to produce a notification just like would Store when
adding a child. You might need to change the getParent of the animal
item provider to specify the right dummy folder if you need navigation
to be able to select the object in an unexpanded tree.
<br>
<br>
<br>
Hoc Nguyen wrote:
<br>
<br>
<blockquote type="cite">Dear All,
<br>
<br>
I use EMF to define my domain model. In the editor of my data model, I
display my data model in a TreeViewer. Now I want to group objects of
the same type in its own folder. My problem is that I can not refresh
immediately the objects under folder after creating a new object. If
anyone has ever implemented a similar feature, could you share that
with me?
<br>
<br>
Here is an example of my model and how I implement it:
<br>
- I manage a pet store, I define an EMF model, let's say PetStore
model. The root element of my TreeViewer is a Store object
<br>
- I can add animals to my pet store
<br>
- I want to group objects of the same type in a specific folder, for
example: mammal, reptile.
<br>
- My problem is that I can not refresh immediately the objects under
folder after creating a new object.
<br>
- To implement the folder, I define another model, let's say UIThing
model. I don't want to tie the 'folder' concept to my PerStore model.
<br>
- In UIThing model, I define a DummyFolder object which does not know
anything about PerStore model. It has a attribute which is an EMF
feature. It also has a 'parent' attribute which is an EObject. Here,
the DummyFolder is generic and not tied to any specific model.
<br>
- To make DummyFolder displayed in the TreeViewer, I do like this:
<br>
+ Override the StoreItemProvider.getChilden(). I add two DummyFolder
objects for mammal and reptile to the returned children collection. I
set parent and feature for the two DummyFolder objects accordingly.
<br>
+ Override the DummyFolderItemProvider.getChilden(). I get the parent
object and then get all children of the type 'feature' (mammal or
reptile).
<br>
- I get existing objects displayed correctly under its own folder
nicely.
<br>
- When I add a new animal, I can not refresh the content (children) of
the DummyFolder object immediately and keep the collapse/expand status!
<br>
- In the StoreItemProvider.notifyChanged(), I can only refresh the
<br>
Store's content by calling:
<br>
<br>
case PetStorePackage.ANIMAL__MAMMAL:
<br>
fireNotifyChanged(new ViewerNotification(notification,
notification.getNotifier(), true, false));
<br>
<br>
- The content of the Store is updated, and also the content of MAMMAL
dummy folder, but the "collapse/expand" state of the mammal dummy
folder is set to "collapsed", even though it's was expanded before
adding new animal! That's quite right because only the Store object is
updated, and DummyFolder is a (fake) 'child' of it, it will only update
the 'plus' sign, and make the DummyFolder collapsed.
<br>
<br>
- I've tried to modify the "notification" to refresh the DummyFolder
but no success.
<br>
<br>
I'm really stuck at that point. Any suggestion will be appreciated.
<br>
<br>
Thanks,
<br>
Hoc
<br>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------060904070806090700010109--
|
|
|
Re: Grouping objects under a folder [message #579638 is a reply to message #35983] |
Mon, 05 June 2006 11:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hoc,
This sounds like a question that is more appropriate for the
eclipse.tools.emf newsgroup. You will definitely get an answer, there.
Christian
Hoc Nguyen wrote:
> Dear All,
>
> I use EMF to define my domain model. In the editor of my data model, I
> display my data model in a TreeViewer. Now I want to group objects of
> the same type in its own folder. My problem is that I can not refresh
> immediately the objects under folder after creating a new object. If
> anyone has ever implemented a similar feature, could you share that with
> me?
>
> Here is an example of my model and how I implement it:
> - I manage a pet store, I define an EMF model, let's say PetStore model.
> The root element of my TreeViewer is a Store object
> - I can add animals to my pet store
> - I want to group objects of the same type in a specific folder, for
> example: mammal, reptile.
> - My problem is that I can not refresh immediately the objects under
> folder after creating a new object.
> - To implement the folder, I define another model, let's say UIThing
> model. I don't want to tie the 'folder' concept to my PerStore model.
> - In UIThing model, I define a DummyFolder object which does not know
> anything about PerStore model. It has a attribute which is an EMF
> feature. It also has a 'parent' attribute which is an EObject. Here, the
> DummyFolder is generic and not tied to any specific model.
> - To make DummyFolder displayed in the TreeViewer, I do like this:
> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
> objects for mammal and reptile to the returned children collection. I
> set parent and feature for the two DummyFolder objects accordingly.
> + Override the DummyFolderItemProvider.getChilden(). I get the parent
> object and then get all children of the type 'feature' (mammal or
> reptile). - I get existing objects displayed correctly under its own
> folder nicely. - When I add a new animal, I can not refresh the content
> (children) of the DummyFolder object immediately and keep the
> collapse/expand status! - In the StoreItemProvider.notifyChanged(), I can
> only refresh the Store's content by calling:
>
> case PetStorePackage.ANIMAL__MAMMAL:
> fireNotifyChanged(new ViewerNotification(notification,
> notification.getNotifier(), true, false));
>
> - The content of the Store is updated, and also the content of MAMMAL
> dummy folder, but the "collapse/expand" state of the mammal dummy folder
> is set to "collapsed", even though it's was expanded before adding new
> animal! That's quite right because only the Store object is updated, and
> DummyFolder is a (fake) 'child' of it, it will only update the 'plus'
> sign, and make the DummyFolder collapsed.
>
> - I've tried to modify the "notification" to refresh the DummyFolder but
> no success.
>
> I'm really stuck at that point. Any suggestion will be appreciated.
>
> Thanks,
> Hoc
|
|
|
Re: Grouping objects under a folder [message #579711 is a reply to message #35983] |
Mon, 05 June 2006 14:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Ed Merks![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ed.merks%40gmail.com) Messages: 33205 Registered: July 2009 |
Senior Member |
|
|
Hoc,
There are examples like this from the book. In the book example, a
derived version of Store would be used for the dummy folder item
provider and the store would know when animals are added so would
produce notifications indicating that children were added to the "dummy"
folder. Another way to fake this would be to have the Store item
provider produce a notification for each of the dummy folders
(substituting each dummy folder in place of notification.getNotifier())
when the store's animals are changed. In the end, your dummy folder
object needs to produce a notification just like would Store when adding
a child. You might need to change the getParent of the animal item
provider to specify the right dummy folder if you need navigation to be
able to select the object in an unexpanded tree.
Hoc Nguyen wrote:
> Dear All,
>
> I use EMF to define my domain model. In the editor of my data model, I
> display my data model in a TreeViewer. Now I want to group objects of
> the same type in its own folder. My problem is that I can not refresh
> immediately the objects under folder after creating a new object. If
> anyone has ever implemented a similar feature, could you share that
> with me?
>
> Here is an example of my model and how I implement it:
> - I manage a pet store, I define an EMF model, let's say PetStore
> model. The root element of my TreeViewer is a Store object
> - I can add animals to my pet store
> - I want to group objects of the same type in a specific folder, for
> example: mammal, reptile.
> - My problem is that I can not refresh immediately the objects under
> folder after creating a new object.
> - To implement the folder, I define another model, let's say UIThing
> model. I don't want to tie the 'folder' concept to my PerStore model.
> - In UIThing model, I define a DummyFolder object which does not know
> anything about PerStore model. It has a attribute which is an EMF
> feature. It also has a 'parent' attribute which is an EObject. Here,
> the DummyFolder is generic and not tied to any specific model.
> - To make DummyFolder displayed in the TreeViewer, I do like this:
> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
> objects for mammal and reptile to the returned children collection. I
> set parent and feature for the two DummyFolder objects accordingly.
> + Override the DummyFolderItemProvider.getChilden(). I get the
> parent object and then get all children of the type 'feature' (mammal
> or reptile).
> - I get existing objects displayed correctly under its own folder nicely.
> - When I add a new animal, I can not refresh the content (children) of
> the DummyFolder object immediately and keep the collapse/expand status!
> - In the StoreItemProvider.notifyChanged(), I can only refresh the
> Store's content by calling:
>
> case PetStorePackage.ANIMAL__MAMMAL:
> fireNotifyChanged(new ViewerNotification(notification,
> notification.getNotifier(), true, false));
>
> - The content of the Store is updated, and also the content of MAMMAL
> dummy folder, but the "collapse/expand" state of the mammal dummy
> folder is set to "collapsed", even though it's was expanded before
> adding new animal! That's quite right because only the Store object is
> updated, and DummyFolder is a (fake) 'child' of it, it will only
> update the 'plus' sign, and make the DummyFolder collapsed.
>
> - I've tried to modify the "notification" to refresh the DummyFolder
> but no success.
>
> I'm really stuck at that point. Any suggestion will be appreciated.
>
> Thanks,
> Hoc
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Grouping objects under a folder [message #579820 is a reply to message #36120] |
Tue, 06 June 2006 05:27 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
Thank you, Ed Merks. What book are you mentioning? Is there a link to
download it?
Hoc
Ed Merks wrote:
> Hoc,
>
> There are examples like this from the book. In the book example, a
> derived version of Store would be used for the dummy folder item
> provider and the store would know when animals are added so would
> produce notifications indicating that children were added to the "dummy"
> folder. Another way to fake this would be to have the Store item
> provider produce a notification for each of the dummy folders
> (substituting each dummy folder in place of notification.getNotifier())
> when the store's animals are changed. In the end, your dummy folder
> object needs to produce a notification just like would Store when adding
> a child. You might need to change the getParent of the animal item
> provider to specify the right dummy folder if you need navigation to be
> able to select the object in an unexpanded tree.
>
>
> Hoc Nguyen wrote:
>
>> Dear All,
>>
>> I use EMF to define my domain model. In the editor of my data model, I
>> display my data model in a TreeViewer. Now I want to group objects of
>> the same type in its own folder. My problem is that I can not refresh
>> immediately the objects under folder after creating a new object. If
>> anyone has ever implemented a similar feature, could you share that
>> with me?
>>
>> Here is an example of my model and how I implement it:
>> - I manage a pet store, I define an EMF model, let's say PetStore
>> model. The root element of my TreeViewer is a Store object
>> - I can add animals to my pet store
>> - I want to group objects of the same type in a specific folder, for
>> example: mammal, reptile.
>> - My problem is that I can not refresh immediately the objects under
>> folder after creating a new object.
>> - To implement the folder, I define another model, let's say UIThing
>> model. I don't want to tie the 'folder' concept to my PerStore model.
>> - In UIThing model, I define a DummyFolder object which does not know
>> anything about PerStore model. It has a attribute which is an EMF
>> feature. It also has a 'parent' attribute which is an EObject. Here,
>> the DummyFolder is generic and not tied to any specific model.
>> - To make DummyFolder displayed in the TreeViewer, I do like this:
>> + Override the StoreItemProvider.getChilden(). I add two DummyFolder
>> objects for mammal and reptile to the returned children collection. I
>> set parent and feature for the two DummyFolder objects accordingly.
>> + Override the DummyFolderItemProvider.getChilden(). I get the
>> parent object and then get all children of the type 'feature' (mammal
>> or reptile).
>> - I get existing objects displayed correctly under its own folder nicely.
>> - When I add a new animal, I can not refresh the content (children) of
>> the DummyFolder object immediately and keep the collapse/expand status!
>> - In the StoreItemProvider.notifyChanged(), I can only refresh the
>> Store's content by calling:
>>
>> case PetStorePackage.ANIMAL__MAMMAL:
>> fireNotifyChanged(new ViewerNotification(notification,
>> notification.getNotifier(), true, false));
>>
>> - The content of the Store is updated, and also the content of MAMMAL
>> dummy folder, but the "collapse/expand" state of the mammal dummy
>> folder is set to "collapsed", even though it's was expanded before
>> adding new animal! That's quite right because only the Store object is
>> updated, and DummyFolder is a (fake) 'child' of it, it will only
>> update the 'plus' sign, and make the DummyFolder collapsed.
>>
>> - I've tried to modify the "notification" to refresh the DummyFolder
>> but no success.
>>
>> I'm really stuck at that point. Any suggestion will be appreciated.
>>
>> Thanks,
>> Hoc
|
|
|
Re: Grouping objects under a folder [message #579887 is a reply to message #36221] |
Tue, 06 June 2006 11:57 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Ed Merks![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ed.merks%40gmail.com) Messages: 33205 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------060904070806090700010109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hoc,
The EMF book talks about this in 14.2.3
http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf
Hoc Nguyen wrote:
> Thank you, Ed Merks. What book are you mentioning? Is there a link to
> download it?
> Hoc
>
> Ed Merks wrote:
>
>> Hoc,
>>
>> There are examples like this from the book. In the book example, a
>> derived version of Store would be used for the dummy folder item
>> provider and the store would know when animals are added so would
>> produce notifications indicating that children were added to the
>> "dummy" folder. Another way to fake this would be to have the Store
>> item provider produce a notification for each of the dummy folders
>> (substituting each dummy folder in place of
>> notification.getNotifier()) when the store's animals are changed. In
>> the end, your dummy folder object needs to produce a notification
>> just like would Store when adding a child. You might need to change
>> the getParent of the animal item provider to specify the right dummy
>> folder if you need navigation to be able to select the object in an
>> unexpanded tree.
>>
>>
>> Hoc Nguyen wrote:
>>
>>> Dear All,
>>>
>>> I use EMF to define my domain model. In the editor of my data model,
>>> I display my data model in a TreeViewer. Now I want to group objects
>>> of the same type in its own folder. My problem is that I can not
>>> refresh immediately the objects under folder after creating a new
>>> object. If anyone has ever implemented a similar feature, could you
>>> share that with me?
>>>
>>> Here is an example of my model and how I implement it:
>>> - I manage a pet store, I define an EMF model, let's say PetStore
>>> model. The root element of my TreeViewer is a Store object
>>> - I can add animals to my pet store
>>> - I want to group objects of the same type in a specific folder, for
>>> example: mammal, reptile.
>>> - My problem is that I can not refresh immediately the objects under
>>> folder after creating a new object.
>>> - To implement the folder, I define another model, let's say UIThing
>>> model. I don't want to tie the 'folder' concept to my PerStore model.
>>> - In UIThing model, I define a DummyFolder object which does not
>>> know anything about PerStore model. It has a attribute which is an
>>> EMF feature. It also has a 'parent' attribute which is an EObject.
>>> Here, the DummyFolder is generic and not tied to any specific model.
>>> - To make DummyFolder displayed in the TreeViewer, I do like this:
>>> + Override the StoreItemProvider.getChilden(). I add two
>>> DummyFolder objects for mammal and reptile to the returned children
>>> collection. I set parent and feature for the two DummyFolder objects
>>> accordingly.
>>> + Override the DummyFolderItemProvider.getChilden(). I get the
>>> parent object and then get all children of the type 'feature'
>>> (mammal or reptile).
>>> - I get existing objects displayed correctly under its own folder
>>> nicely.
>>> - When I add a new animal, I can not refresh the content (children)
>>> of the DummyFolder object immediately and keep the collapse/expand
>>> status!
>>> - In the StoreItemProvider.notifyChanged(), I can only refresh the
>>> Store's content by calling:
>>>
>>> case PetStorePackage.ANIMAL__MAMMAL:
>>> fireNotifyChanged(new
>>> ViewerNotification(notification, notification.getNotifier(), true,
>>> false));
>>>
>>> - The content of the Store is updated, and also the content of
>>> MAMMAL dummy folder, but the "collapse/expand" state of the mammal
>>> dummy folder is set to "collapsed", even though it's was expanded
>>> before adding new animal! That's quite right because only the Store
>>> object is updated, and DummyFolder is a (fake) 'child' of it, it
>>> will only update the 'plus' sign, and make the DummyFolder collapsed.
>>>
>>> - I've tried to modify the "notification" to refresh the DummyFolder
>>> but no success.
>>>
>>> I'm really stuck at that point. Any suggestion will be appreciated.
>>>
>>> Thanks,
>>> Hoc
>>
--------------060904070806090700010109
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hoc,<br>
<br>
The EMF book talks about this in 14.2.3<br>
<blockquote> <a
href=" http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf"> http://www.awprofessional.com/content/images/0131425420/samp lechapter/budinskych02.pdf</a><br>
</blockquote>
<br>
Hoc Nguyen wrote:
<blockquote cite="mide633rp$nf1$2@utils.eclipse.org" type="cite">Thank
you, Ed Merks. What book are you mentioning? Is there a link to
download it?
<br>
Hoc
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Hoc,
<br>
<br>
There are examples like this from the book. In the book example, a
derived version of Store would be used for the dummy folder item
provider and the store would know when animals are added so would
produce notifications indicating that children were added to the
"dummy" folder. Another way to fake this would be to have the Store
item provider produce a notification for each of the dummy folders
(substituting each dummy folder in place of notification.getNotifier())
when the store's animals are changed. In the end, your dummy folder
object needs to produce a notification just like would Store when
adding a child. You might need to change the getParent of the animal
item provider to specify the right dummy folder if you need navigation
to be able to select the object in an unexpanded tree.
<br>
<br>
<br>
Hoc Nguyen wrote:
<br>
<br>
<blockquote type="cite">Dear All,
<br>
<br>
I use EMF to define my domain model. In the editor of my data model, I
display my data model in a TreeViewer. Now I want to group objects of
the same type in its own folder. My problem is that I can not refresh
immediately the objects under folder after creating a new object. If
anyone has ever implemented a similar feature, could you share that
with me?
<br>
<br>
Here is an example of my model and how I implement it:
<br>
- I manage a pet store, I define an EMF model, let's say PetStore
model. The root element of my TreeViewer is a Store object
<br>
- I can add animals to my pet store
<br>
- I want to group objects of the same type in a specific folder, for
example: mammal, reptile.
<br>
- My problem is that I can not refresh immediately the objects under
folder after creating a new object.
<br>
- To implement the folder, I define another model, let's say UIThing
model. I don't want to tie the 'folder' concept to my PerStore model.
<br>
- In UIThing model, I define a DummyFolder object which does not know
anything about PerStore model. It has a attribute which is an EMF
feature. It also has a 'parent' attribute which is an EObject. Here,
the DummyFolder is generic and not tied to any specific model.
<br>
- To make DummyFolder displayed in the TreeViewer, I do like this:
<br>
+ Override the StoreItemProvider.getChilden(). I add two DummyFolder
objects for mammal and reptile to the returned children collection. I
set parent and feature for the two DummyFolder objects accordingly.
<br>
+ Override the DummyFolderItemProvider.getChilden(). I get the parent
object and then get all children of the type 'feature' (mammal or
reptile).
<br>
- I get existing objects displayed correctly under its own folder
nicely.
<br>
- When I add a new animal, I can not refresh the content (children) of
the DummyFolder object immediately and keep the collapse/expand status!
<br>
- In the StoreItemProvider.notifyChanged(), I can only refresh the
<br>
Store's content by calling:
<br>
<br>
case PetStorePackage.ANIMAL__MAMMAL:
<br>
fireNotifyChanged(new ViewerNotification(notification,
notification.getNotifier(), true, false));
<br>
<br>
- The content of the Store is updated, and also the content of MAMMAL
dummy folder, but the "collapse/expand" state of the mammal dummy
folder is set to "collapsed", even though it's was expanded before
adding new animal! That's quite right because only the Store object is
updated, and DummyFolder is a (fake) 'child' of it, it will only update
the 'plus' sign, and make the DummyFolder collapsed.
<br>
<br>
- I've tried to modify the "notification" to refresh the DummyFolder
but no success.
<br>
<br>
I'm really stuck at that point. Any suggestion will be appreciated.
<br>
<br>
Thanks,
<br>
Hoc
<br>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------060904070806090700010109--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Sun Sep 01 06:56:32 GMT 2024
Powered by FUDForum. Page generated in 0.04274 seconds
|