cancel
Showing results for 
Search instead for 
Did you mean: 

Howto make Property sheet render HTML

ruffp
Champ in-the-making
Champ in-the-making
Hello,

I have a property with some html code inside.

Is it possible to make the view page rendering correctly the html metadata only by configuring a xml file?

If no, what to do?

I tried to make that from my generator (generateAndAdd method) :

public UIComponent generateAndAdd(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item) {

UIComponent component = null;
if( propertySheet.getMode().equals("view")){
   component = super.generateAndAdd(context, propertySheet, item);
   HtmlOutputText hot = new HtmlOutputText();      
   hot.setParent(component);
   hot.setId("output_text_view_summary");
   hot.setEscape(false);
   return component;
}
// some other code for edition

But it doesn t work. I probably make something wrong but don't know what.
I also tried to make the setParent(item) and setParent(propertySheet) but always the same effect

Thanks in advance for your answers.
2 REPLIES 2

ruffp
Champ in-the-making
Champ in-the-making
Hello again,

I found a solution:

Instead of instanciate the HtmlOutputComponent, I replace by this code:

component = context.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);
component.getAttributes().put("escape", false);

And it's working for the view property sheet.

My problem is to edit these properties now… I see two problems :

1° As my property is multivaluated, I get a list under my html editor, but just under there's some glitches because Alfresco copies some text from the list in a hidden field. How I can control what Alfresco put in that field?

2° When I doing the decode in my UIComponent (I don't use Renderer), I cannot find a clear sample on JSF how to parse all the fields of my component (My component is composed with a input text and a TinyMCEEditor)

Thanks

gavinc
Champ in-the-making
Champ in-the-making
You will need to look at UIMultiValueEditor and MultiValueFieldRenderer and/or MultiValueSelectorRenderer to investigate the glitches.

As for decoding your component, probably the most complex example we have is the association editors, these encode several items in it's value and decodes them, take a look at BaseAssociationEditor in particular.