Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi, sorry because this might be a stupid question.
If I create a mashup and call it "MyMashup" with a blue background color and a gauge scale as widget, I'm actually making a web page so I guess somewhere I should have a html (or jsp) file which is MyMashup with some HTML language stuff inside in order to create the widget and a CSS file with the code "background-color:blue". Isn't it?
If so, where those files are?
Because I can't find any into the Tomcat/webapps/Thingworx directory
If it is not like this, then I have another question: I have a boolean and I want it to be represented on the mash up by an image of a green LED light if the boolean is true or a red light if is false.
If I had to develop a web page I would manage this with a javascript code; is there a way to do this with Thingworx?
Solved! Go to Solution.
For your first question, I think the HTML is assembled on the fly somehow. I'm not clear on the details and would be happy to learn more.
For your second question: you can do this sort of thing in Composer with a ValueDisplay widget. (It is only possible to modify mashups via Javascript if you create a custom widget.)
1) Create your lights as Media Entities.
2) Create a State Definition where "true" is associated with a custom style that displays the green light, and "false" with a custom style that displays the red light. (If you'll reuse the images, you might want to use persistent Style Definitions instead.)
3) Create a ValueDisplay widget in the mashup. Click on its ValueFormat field.
4) Set Renderer to String and Format to Show No Text. (Possibly an Image renderer might work too, but I've had more luck with String.)
5) Choose State-Based Formatting and choose your boolean and your state definition. (But if you change the state definition in the future, you'll have to come back and re-select it here, because the definition is imported and not just referenced.) Click Done.
6) Bind your boolean to the Data field of the ValueDisplay.
7) If your images are the wrong size, set the ImageScaling field. (But don't use Height, which is currently broken in 7.0 and 7.1.)
It's kind of a pain, but I hope this helps.
For your first question, I think the HTML is assembled on the fly somehow. I'm not clear on the details and would be happy to learn more.
For your second question: you can do this sort of thing in Composer with a ValueDisplay widget. (It is only possible to modify mashups via Javascript if you create a custom widget.)
1) Create your lights as Media Entities.
2) Create a State Definition where "true" is associated with a custom style that displays the green light, and "false" with a custom style that displays the red light. (If you'll reuse the images, you might want to use persistent Style Definitions instead.)
3) Create a ValueDisplay widget in the mashup. Click on its ValueFormat field.
4) Set Renderer to String and Format to Show No Text. (Possibly an Image renderer might work too, but I've had more luck with String.)
5) Choose State-Based Formatting and choose your boolean and your state definition. (But if you change the state definition in the future, you'll have to come back and re-select it here, because the definition is imported and not just referenced.) Click Done.
6) Bind your boolean to the Data field of the ValueDisplay.
7) If your images are the wrong size, set the ImageScaling field. (But don't use Height, which is currently broken in 7.0 and 7.1.)
It's kind of a pain, but I hope this helps.
Ok, thank you very much for your answer. Just one think: I don't know how to create a state definition.
Do you know if there is any manual in the web?
Fabio, you can create a State Definition from the Composer home screen. Here's a link to the Style and State Definitions Help Center page.
Thank you.