• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Need inputTextArea functionality + escape="false"

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Would seem a pretty simple question but I've not found any option as yet to perform the functionality that's required.
In conjunction to using the richfaces a4j:push control I'm needing to update a text area on the form with log information that is refreshed on a set time interval.
I have a listener object that accepts strings of messages from a message server and upon time interval will (currently) update the contents of an inputTextArea with the current contents of the sum of the messages, essentially providing a realtime log reader service.
So I've set the inputTextArea to read only, set the size to a particular size so it contain a reasonable number of log messages and once/if the log extends the size of the area vertical scroll bar is dynamically generated to be able to scroll the additional messages. Currently it works very well.
Problem is, I would like to conditionally apply formatting to some of the lines to style (for example, on a warning message I'd like to set the background and font color to something that will differentiate from a normal informational message. The inputTextArea does not provide the ability to do this and the easiest description for what I'm wanting is an "outputTextArea" that will allow html/xml rendering so I can apply styles to the text accordingly.
There must be something relatively simple and straight forward to accomplish this, but I've been hunting for a few days now without a solution.

Any help/suggestions would certainly be appreciated.
Thanks!
Karl


 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are only outputting something with the input then you are on a right track when you want a "outputTextArea". But it is not needed in JSF since you can always use outputText. So why can't you use outputText? If you absolutely need the input to be actual html textarea you can just use plain html textarea and put the inputText inside it or something similar (like fake it with CSS)

EDIT: And after reading your text more carefully I think that what you try to accomplish is not possible. You want html textarea input where you can change some of the text to use different font and/or background color? I think that may be impossible since html textarea does not allow that. If it would be enough to change the style of the whole text then you would naturally apply the changes to the whole input (with style or class attribute). So I would stick with outputText and use CSS. Naturally there is something that does this in some third party JSF library somewhere but if you have already looked through richfaces and found none then I wouldn't try to include some second library if this is the only thing you need from it....
 
Karl Krasnowsky
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ilari Moilanen wrote: And after reading your text more carefully I think that what you try to accomplish is not possible. You want html textarea input where you can change some of the text to use different font and/or background color? I think that may be impossible since html textarea does not allow that. If it would be enough to change the style of the whole text then you would naturally apply the changes to the whole input (with style or class attribute). So I would stick with outputText and use CSS. Naturally there is something that does this in some third party JSF library somewhere but if you have already looked through richfaces and found none then I wouldn't try to include some second library if this is the only thing you need from it....



Therein lies my frustration. For something so seemingly obvious I cannot find such a 3rd party control available. I'm thinking I may need to roll something myself, but this can't be such a novelty that it doesn't exist... however in the time that I'm taking looking for it I might as well write it myself.
 
Saloon Keeper
Posts: 28313
207
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are several JSF controls that allow rich text editing. The RichFaces Editor component is one of them. They provide not only the raw input textarea with formatting, but the option to present various format controls as part of the assembly.

A lot like the message editor we use on the JavaRanch.
 
Karl Krasnowsky
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:There are several JSF controls that allow rich text editing. The RichFaces Editor component is one of them. They provide not only the raw input textarea with formatting, but the option to present various format controls as part of the assembly.

A lot like the message editor we use on the JavaRanch.



It's most likely my fault, but I'm fairly certain you don't understand my question. I can't make it any clearer, therefore, thanks but nevermind.
 
Tim Holloway
Saloon Keeper
Posts: 28313
207
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You limited yourself when you said "inputTextArea". You can do this sort of stuff with a scrollable html div and an outputTextArea with "escape="false"".

Or you can use an inputTextArea with "readonly="true".

What you aren't going to find is automatic removal of text once the buffer limit is reached. They all figure you want it removed, remove it yourself. According to whatever rules you see fit.

Which is (relatively) easy to do with either of the above solutions.

If you want something more record-oriented, use a dataTable with the model set up so that each row in the table is a line of text. However that one in its most basic form won't give you a scrollbat. There's a RichFaces Extended DataTable that will, however.
 
Replace the word "snake" with "danger noodle" in all tiny ads.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic