|
|
|
|
|
Re: GalleryTreeViewer & IEMFListProperty [message #491782 is a reply to message #491748] |
Thu, 15 October 2009 19:16 |
Matthew Hall Messages: 368 Registered: July 2009 |
Senior Member |
|
|
Rencana Tarigan wrote:
> Hi, thanks for reply :)
> i have a model like : Mail
> - MailFolder (as root of group)
> - MailEntry (as children)
>
> here is my code :
> GalleryTreeViewer viewer = new GalleryTreeViewer(parent);
> EObject inputObject = mail;
> IEMFListProperty childrenProp =
> EMFProperties.list(ModelPackage.Literals.PIM_MAIL__CURRENT_F OLDER);
> IEMFValueProperty[] columnProps = new IEMFValueProperty[] {
>
> EMFProperties.value(ModelPackage.Literals.MAIL_FOLDER__ENTRY ),
> EMFProperties.value(ModelPackage.Literals.MAIL_ENTRY__CONTEN T)
> };
>
> ViewerSupport.bind(viewer, inputObject,childrenProp, columnProps);
> return viewer;
>
> that's code not work, that's only show the group of gallery :(
Ok, you have a non-homogeneous tree structure. So you need to create a
list property that:
* For a Mail instance, observes the mail folders
* For a MailFolder instance, observes the mail entries
Use DelegatingListProperty:
IListProperty childrenProp = new DelegatingListProperty() {
IListProperty mailFolders = EMFProperties.list(
ModelPackage.Literals.PIM_MAIL__CURRENT_FOLDER);
IListProperty folderEntries = EMFProperties.list(
ModelPackage.Literals.PIM_MAIL_FOLDER__ENTRIES);
protected IListProperty doGetDelegate(Object source) {
if (source instanceof Mail)
return mailFolders;
if (source instanceof MailFolder)
return folderEntries;
}
};
> can you tell me what is IEMFListProperty mean ?
This is just a specialized IListProperty extension interface that lets
you do property chaining using EMF structural features:
IEMFListProperty foldersProp =
EMFProperties.list(ModelPackage.Literals.PIM_MAIL__CURRENT_F OLDER);
IEMFListProperty folderNamesProp =
foldersProp.values(ModelPackage.Literals.PIM_MAIL_FOLDER__NA ME);
Using this second property you could:
IEMFObservableList folderNamesObs = folderNamesProp.observe(mail);
...which gives you an observable list of folder *names*. Property
chaining allows you to project a value property over all elements of the
master list.
Hope this helps,
Matthew
|
|
|
|
|
|
|
Re: GalleryTreeViewer & IEMFListProperty [message #598441 is a reply to message #491688] |
Thu, 15 October 2009 16:12 |
|
Hi, thanks for reply :)
i have a model like :
Mail
- MailFolder (as root of group)
- MailEntry (as children)
here is my code :
GalleryTreeViewer viewer = new GalleryTreeViewer(parent);
EObject inputObject = mail;
IEMFListProperty childrenProp = EMFProperties.list(ModelPackage.Literals.PIM_MAIL__CURRENT_F OLDER);
IEMFValueProperty[] columnProps = new IEMFValueProperty[] {
EMFProperties.value(ModelPackage.Literals.MAIL_FOLDER__ENTRY ),
EMFProperties.value(ModelPackage.Literals.MAIL_ENTRY__CONTEN T)
};
ViewerSupport.bind(viewer, inputObject,childrenProp, columnProps);
return viewer;
that's code not work, that's only show the group of gallery :(
can you tell me what is IEMFListProperty mean ?
Thanks,
http://cana.web.id
|
|
|
Re: GalleryTreeViewer & IEMFListProperty [message #598444 is a reply to message #598441] |
Thu, 15 October 2009 19:16 |
Matthew Hall Messages: 368 Registered: July 2009 |
Senior Member |
|
|
Rencana Tarigan wrote:
> Hi, thanks for reply :)
> i have a model like : Mail
> - MailFolder (as root of group)
> - MailEntry (as children)
>
> here is my code :
> GalleryTreeViewer viewer = new GalleryTreeViewer(parent);
> EObject inputObject = mail;
> IEMFListProperty childrenProp =
> EMFProperties.list(ModelPackage.Literals.PIM_MAIL__CURRENT_F OLDER);
> IEMFValueProperty[] columnProps = new IEMFValueProperty[] {
>
> EMFProperties.value(ModelPackage.Literals.MAIL_FOLDER__ENTRY ),
> EMFProperties.value(ModelPackage.Literals.MAIL_ENTRY__CONTEN T)
> };
>
> ViewerSupport.bind(viewer, inputObject,childrenProp, columnProps);
> return viewer;
>
> that's code not work, that's only show the group of gallery :(
Ok, you have a non-homogeneous tree structure. So you need to create a
list property that:
* For a Mail instance, observes the mail folders
* For a MailFolder instance, observes the mail entries
Use DelegatingListProperty:
IListProperty childrenProp = new DelegatingListProperty() {
IListProperty mailFolders = EMFProperties.list(
ModelPackage.Literals.PIM_MAIL__CURRENT_FOLDER);
IListProperty folderEntries = EMFProperties.list(
ModelPackage.Literals.PIM_MAIL_FOLDER__ENTRIES);
protected IListProperty doGetDelegate(Object source) {
if (source instanceof Mail)
return mailFolders;
if (source instanceof MailFolder)
return folderEntries;
}
};
> can you tell me what is IEMFListProperty mean ?
This is just a specialized IListProperty extension interface that lets
you do property chaining using EMF structural features:
IEMFListProperty foldersProp =
EMFProperties.list(ModelPackage.Literals.PIM_MAIL__CURRENT_F OLDER);
IEMFListProperty folderNamesProp =
foldersProp.values(ModelPackage.Literals.PIM_MAIL_FOLDER__NA ME);
Using this second property you could:
IEMFObservableList folderNamesObs = folderNamesProp.observe(mail);
...which gives you an observable list of folder *names*. Property
chaining allows you to project a value property over all elements of the
master list.
Hope this helps,
Matthew
|
|
|
|
Re: GalleryTreeViewer & IEMFListProperty [message #598469 is a reply to message #491783] |
Mon, 19 October 2009 05:01 |
|
Hi, Matthew
Thanks for reply and give me explanation about IEMFListProperty :) and it's work now :)
about Nebula Gallery :
when i move my application, it always refresh the viewer, how to make it not refresh the canvas when i move the application or minimize or maximize my application ?
about GalleryTreeViewer :
I have a model structure like a list, only 1 root and many list item, can it handle by GalleryTreeViewer ?
http://cana.web.id
|
|
|
Powered by
FUDForum. Page generated in 0.03349 seconds