Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GalleryTreeViewer & IEMFListProperty
GalleryTreeViewer & IEMFListProperty [message #491411] Wed, 14 October 2009 13:16 Go to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

is it possible to set IEMFListProperty as the input for GalleryViewer ?
is there sample for integrate EMF databinding with GalleryTreeViewer ?

Thanks.


Re: GalleryTreeViewer & IEMFListProperty [message #491540 is a reply to message #491411] Wed, 14 October 2009 22:43 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Rencana Tarigan wrote:
> is it possible to set IEMFListProperty as the input for GalleryViewer ?
> is there sample for integrate EMF databinding with GalleryTreeViewer ?

You mean IEMFObservableList?

Matthew
Re: GalleryTreeViewer & IEMFListProperty [message #491633 is a reply to message #491540] Thu, 15 October 2009 10:29 Go to previous messageGo to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

ya, i mean IEMFObservableList.
is there any sample for that ?
with GalleryTreeViewer or GalleryViewer.

Thanks,


Re: GalleryTreeViewer & IEMFListProperty [message #491688 is a reply to message #491633] Thu, 15 October 2009 13:22 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Rencana Tarigan wrote:
> ya, i mean IEMFObservableList.
> is there any sample for that ?
> with GalleryTreeViewer or GalleryViewer.

GalleryTreeViewer treeViewer = ...

// input object that contains the root tree elements as children
EObject inputObject = ..

IEMFListProperty childrenProp =
EMFProperties.list(inputObjectChildrenStructuralFeature);

IEMFValueProperty[] columnProps = new IEMFValueProperty[] {
EMFProperties.value(property1),
EMFProperties.value(property2),
EMFProperties.value(property3),
}

ViewerSupport.bind(treeViewer, inputObject, childrenProp, columnProps);

Hope this helps,

Matthew
Re: GalleryTreeViewer & IEMFListProperty [message #491748 is a reply to message #491688] Thu, 15 October 2009 16:12 Go to previous messageGo to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

Hi, thanks for reply Smile
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 Sad
can you tell me what is IEMFListProperty mean ?

Thanks,


Re: GalleryTreeViewer & IEMFListProperty [message #491782 is a reply to message #491748] Thu, 15 October 2009 19:16 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
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 #491783 is a reply to message #491782] Thu, 15 October 2009 19:17 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Matthew Hall wrote:
> protected IListProperty doGetDelegate(Object source) {
> if (source instanceof Mail)
> return mailFolders;
> if (source instanceof MailFolder)
> return folderEntries;

else return null :)

> }
Re: GalleryTreeViewer & IEMFListProperty [message #492138 is a reply to message #491783] Mon, 19 October 2009 05:01 Go to previous messageGo to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

Hi, Matthew
Thanks for reply and give me explanation about IEMFListProperty Smile and it's work now Smile

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 ?


Re: GalleryTreeViewer & IEMFListProperty [message #598431 is a reply to message #491540] Thu, 15 October 2009 10:29 Go to previous messageGo to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

ya, i mean IEMFObservableList.
is there any sample for that ?
with GalleryTreeViewer or GalleryViewer.

Thanks,


Re: GalleryTreeViewer & IEMFListProperty [message #598438 is a reply to message #598431] Thu, 15 October 2009 13:22 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Rencana Tarigan wrote:
> ya, i mean IEMFObservableList.
> is there any sample for that ?
> with GalleryTreeViewer or GalleryViewer.

GalleryTreeViewer treeViewer = ...

// input object that contains the root tree elements as children
EObject inputObject = ..

IEMFListProperty childrenProp =
EMFProperties.list(inputObjectChildrenStructuralFeature);

IEMFValueProperty[] columnProps = new IEMFValueProperty[] {
EMFProperties.value(property1),
EMFProperties.value(property2),
EMFProperties.value(property3),
}

ViewerSupport.bind(treeViewer, inputObject, childrenProp, columnProps);

Hope this helps,

Matthew
Re: GalleryTreeViewer & IEMFListProperty [message #598441 is a reply to message #491688] Thu, 15 October 2009 16:12 Go to previous messageGo to next message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

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,


Re: GalleryTreeViewer & IEMFListProperty [message #598444 is a reply to message #598441] Thu, 15 October 2009 19:16 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
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 #598451 is a reply to message #491782] Thu, 15 October 2009 19:17 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Matthew Hall wrote:
> protected IListProperty doGetDelegate(Object source) {
> if (source instanceof Mail)
> return mailFolders;
> if (source instanceof MailFolder)
> return folderEntries;

else return null :)

> }
Re: GalleryTreeViewer & IEMFListProperty [message #598469 is a reply to message #491783] Mon, 19 October 2009 05:01 Go to previous message
Rencana Tarigan is currently offline Rencana TariganFriend
Messages: 56
Registered: July 2009
Location: Bandung, Indonesia
Member

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 ?


Previous Topic:Gantt chart on seconds level
Next Topic:GridTableViewer Sorting
Goto Forum:
  


Current Time: Mon Dec 22 15:06:24 GMT 2014

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

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