This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cuzstomized component  RSS feed

 
Lukas Wozniak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I'm using facelets and I want add one extra atrribute "wrap" to the standard inputTextarea component.
Here's my code:



faces-config:


and my enhanced UIHtmlInputTextarea class:

}
}



And now, when I use on the xhtml code :

<b:inputTextareaEnhanced id="zlec_nazwa" wrap="off" cols="35" rows="5" ...

then I see in my UIHtmlInputTextarea object that "wrap" has value "off". But I can't figure out,
how to render teaxtarea together with this new attribute - my rendered HTML code dosen't have "wrap" attribute at all.

I think I should Override either encodeBegin or encodeEnd and there add some code like:
"
writer.writeAttribute("wrap", getWrap(), null);
"
but I dont' want create whole new textarea component(writer.startElement("textarea", this) ...)
but only invoke super.encodeBegin/super.encodeEnd and add in some way that new attribute to the rendered response ...
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well for starters, RFC1866 - which defines HTML - doesn't list "WRAP" as a valid attribute for the TEXTAREA element. Although the standard ignores illegal attributes and therefore won't throw an error, I don't know what you're expecting to get when HTML isn't going to honour the attribute anyway.
 
Lukas Wozniak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the best thing is that "wrap" isn't valid attribute, but it works. Instead of css {white-space:nowrap; } which dosen't work for me at all(in IE and FF).
And back to my question, I created whole new HTML element in my new component and overrided



enjoy maybe someone will use my solution

greet
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!