Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » More complex node-template labels?
More complex node-template labels? [message #663347] Mon, 04 April 2011 17:36 Go to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Hey there...

Amazingly enough, I now have an editor built with the latest Sapphire 0.3 build that works with my latest configuration xml file. Life is good!!

That said, I'm now looking at trying to clean up what I've got working. Adding functionality such as a browse dialog for classes, drop-down lists where they make sense, etc.

I've run into a place where I have an element with no good candidate for a simple label. There are three attributes and I'd like to combine two of them into a generated label, but I've not had any luck doing so.

This type of example shows up everywhere in the example sdef files:

<node-template>
   <label>${ Name == null ? "&lt;transform.java&gt;" : Name } </label>
   ...
</node-template>


So if the Name is null, use this string "<transform.java>", if not use the property value instead. Easy enough.

But what happens if I have an XML element like:

<smooks:transform.smooks from="msgC" to="msgD">


And I want the node label in the tree to look like:

<from: msgC><to: msgD>


I've tried the first part in my sdef with something like this:

<label>${ TransformSmooksFrom == null ? "&lt;from:undefined&gt;" : "&lt;from: " + ${TransformSmooksFrom} + "&gt;" }</label>


But it doesn't work. Is there another way to do this?

Thanks in advance!
--Fitz
Re: More complex node-template labels? [message #663393 is a reply to message #663347] Mon, 04 April 2011 20:19 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Sapphire expression language is based in part on EL specification in JSP/JSF. There is no "+" operator for string concatenation, but you can concatenate the results of multiple expressions and static text blocks into one uber-expression...

So your scenario could be written like this:

&lt;from: ${ TransformSmooksFrom == null ? "undefined" : TransformSmooksFrom }&gt;&lt;${ TransformSmooksTo == null ? "undefined" : TransformSmooksTo }&gt;


There is a good document on EL at Help -> Content -> Sapphire Developer Guide -> Expression Language.

See "String Concatenation" section at the end.

- Konstantin
Re: More complex node-template labels? [message #663414 is a reply to message #663393] Mon, 04 April 2011 22:48 Go to previous message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
That worked great, thanks Konstantin. I'll keep a note as to the link to th EL docs as well.

--Fitz
Previous Topic:JBoss Blog Post re:Sapphire
Next Topic:Relative File Path Browsing
Goto Forum:
  


Current Time: Thu Mar 28 12:18:39 GMT 2024

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

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

Back to the top