Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Parsley » Seeing unwanted features(Tree showing unwanted children)
Seeing unwanted features [message #1692791] Sat, 18 April 2015 18:36 Go to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Using a Tree View but I do not want to see all the children.

My model uses an abstract class called
Entity ->name, tag, alternateId,comments

Entity also can have one or more Event objects contained in it.

The following extend Entity:
Location -> name, tag, alternateId, ^type,comments
Person -> name, lastName, tag, alternateId, ^type,comments
Enclosure -> name, tag, alternateId, ^type,comments
Item -> name, tag, alternateId, ^type,comments

I do not want to see any Event children in my tree only the concrete extensions to Entity. (Location, Person, Enclosure,Item).

I would expect:

featuresProvider {
			        features {
			            Location -> name, tag, alternateId, ^type,comments
			            Person -> name, lastName, tag, alternateId, ^type,comments
				    Enclosure -> name, tag, alternateId, ^type,comments
				   Item -> name, tag, alternateId, ^type,comments
			        }
			    }
  


To create a tree that would NOT show any Event children to my concrete Entities, but they do show up. Is there a way to prevent the display of children in a Tree?
Re: Seeing unwanted features [message #1692855 is a reply to message #1692791] Mon, 20 April 2015 09:15 Go to previous messageGo to next message
Francesco Guidieri is currently offline Francesco GuidieriFriend
Messages: 12
Registered: July 2009
Junior Member
Hi John,

if I've got your point, you need to customize the content provider via the DSL. It will let you choose wich children to show for each element.

es.
viewerContentProvider{
children{
Entity -> (...)
}
}


I hope this clarifies...

Cheers
Francesco

Re: Seeing unwanted features [message #1692937 is a reply to message #1692855] Mon, 20 April 2015 17:31 Go to previous messageGo to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Hi Francesco,

Closer... I tried this:
viewerContentProvider{
	children{

		Location -> {^children}
		Person -> {^children}
		Enclosure -> {^children}
		Vehicle -> {^children}

		Item -> {""}
		Reader-> {  }
		Course-> {null}
		
		}
	}


The first four items can contain all the others as ^children feature They also can contain one or more event children. Using the notation above the first four elements now only display the other nodes in the tree. This is just what I want.

The last three elements Item,Reader, Course, are just elements that can contain events. I dont want to see events in these either. I just can't ascertain the correct syntax to not show the event children in the tree. The Item -> {""} shows a space as a child, but no events thats better, but I would rather not see that space either. The
Reader-> { }
Course-> {null}
still show event children.

Any tips on getting ride of those unwanted 'children' events for the elements that only have event children?

thanks,
John
Re: Seeing unwanted features [message #1692991 is a reply to message #1692937] Tue, 21 April 2015 06:42 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1741
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 20/04/2015 19:31, John Conlon wrote:
> Hi Francesco,
>
> Closer... I tried this:
> viewerContentProvider{
> children{
>
> Location -> {^children}
> Person -> {^children}
> Enclosure -> {^children}
> Vehicle -> {^children}
>
> Item -> {""}
> Reader-> { }
> Course-> {null}
>
> }
> }
>
> The first four items can contain all the others as ^children feature
> They also can contain one or more event children. Using the notation
> above the first four elements now only display the other nodes in the
> tree. This is just what I want.
> The last three elements Item,Reader, Course, are just elements that can
> contain events. I dont want to see events in these either. I just
> can't ascertain the correct syntax to not show the event children in the
> tree. The Item -> {""} shows a space as a child, but no events thats
> better, but I would rather not see that space either. The Reader-> { }
> Course-> {null}
> still show event children.
>
> Any tips on getting ride of those unwanted 'children' events for the
> elements that only have event children?
>

Hi John

as in EMF content provider, 'children' is expected to return a List of
objects, thus, returning an empty list should do what you want.

Please keep in mind that, if you do not return a List, but a single
object, then Parsley will wrap it in a singleton list, that's why
returning "" shows an empty space as a child :)

Hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: Seeing unwanted features [message #1694227 is a reply to message #1692991] Sat, 02 May 2015 18:49 Go to previous message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Returning an Collections.EMPTY_LIST did it! thanks.
Previous Topic:Embedding parsley components
Next Topic:Show or hide logic in FeatureCaptionProvider
Goto Forum:
  


Current Time: Mon Feb 19 06:37:39 GMT 2018

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

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