Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328663

Summary: Need ability to embed HTML content from model in the UI
Product: z_Archived Reporter: Konstantin Komissarchik <konstantin>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: ling.hao
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Konstantin Komissarchik CLA 2010-10-25 18:16:24 EDT
It is sometimes desirable to be able to render HTML content from the model in the Sapphire UI. To support this, we should add HtmlContent annotation that will allow developers to tag a value property as having HTML content. A corresponding property editor renderer will look for this annotation and render the content via SWT Browser control. Since the browser control has no editing abilities, this property editor will be read-only regardless of writable abilities of the property.
Comment 1 Konstantin Komissarchik CLA 2010-11-16 12:16:52 EST
Enhancement implemented.
Comment 2 Ling Hao CLA 2010-12-15 18:22:44 EST
How to show bold/link...etc? The following test case only the text is shown:
    <html-content>
      <a href="http://www.oracle.com/">Oracle</a> 
      <p>paragraph</p>
      <html><body>body</body></html>
      ABCD
    </html-content>
Comment 3 Konstantin Komissarchik CLA 2010-12-15 18:28:16 EST
Make sure that property value represents a fully well-formed HTML document. The text is fed directly to a browser. For instance...

<html>
  <body>
    <a href="http://www.oracle.com/">Oracle</a>
    <p>paragraph</p>
    ABCD
  </body>
</html>
Comment 4 Konstantin Komissarchik CLA 2010-12-15 18:28:40 EST
Meant to re-resolve.
Comment 5 Ling Hao CLA 2010-12-15 18:33:16 EST
Even well formed HTML does not work.
Comment 6 Konstantin Komissarchik CLA 2010-12-15 18:44:48 EST
Could you attach your repro?

Note that you can see this working in the contacts sample... Right click on contact and select "send contact". The wizard that comes up is based on ISendContactOp.
Comment 7 Ling Hao CLA 2010-12-15 18:52:04 EST
It is because I'm using the default XML binding? I expected all the children in the XML to show up in the browser. User error?
Comment 8 Ling Hao CLA 2010-12-15 18:52:37 EST
    // *** HtmlContent ***
    
    @Label( standard = "HTML content" )
    @XmlBinding( path = "html-content" )
    @HtmlContent
    
    ValueProperty PROP_HTML_CONTENT = new ValueProperty( TYPE, "HtmlContent" );
    
    Value<String> getHtmlContent();
Comment 9 Konstantin Komissarchik CLA 2010-12-15 18:55:41 EST
Ah that makes sense. If you entered xml directly into source view and didn't escape tags, then this is user error. If you entered xml into a sapphire property editor and content wasn't escaped when written to source, then that is a bug (separate issue from this).
Comment 10 Konstantin Komissarchik CLA 2010-12-15 19:42:55 EST
Re-resolving based on Comment #7 and Comment #9.
Comment 11 Ling Hao CLA 2010-12-15 19:52:24 EST
Verified