Skip to main content



      Home
Home » Modeling » EMF Parsley » Seeing unwanted features(Tree showing unwanted children)
Seeing unwanted features [message #1692791] Sat, 18 April 2015 14:36 Go to next message
Eclipse UserFriend
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 05:15 Go to previous messageGo to next message
Eclipse UserFriend
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 13:31 Go to previous messageGo to next message
Eclipse UserFriend
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 02:42 Go to previous messageGo to next message
Eclipse UserFriend
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 14:49 Go to previous message
Eclipse UserFriend
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: Thu May 15 21:49:56 EDT 2025

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

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

Back to the top