You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Alexander Panzhin (JIRA)" <de...@myfaces.apache.org> on 2006/03/25 17:23:18 UTC

[jira] Created: (TOMAHAWK-214) t:outputText attribute \n ->

t:outputText attribute \n -> <br/>
----------------------------------

         Key: TOMAHAWK-214
         URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
     Project: MyFaces Tomahawk
        Type: New Feature
    Reporter: Alexander Panzhin
    Priority: Minor


A boolean attribute, when set would convert '\n' to '<br/>'.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (TOMAHAWK-214) t:outputText attribute \n ->

Posted by "Bill Schneider (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=comments#action_12417857 ] 

Bill Schneider commented on TOMAHAWK-214:
-----------------------------------------

I did some more research on this, and it looks like there may already be support there for some \n to <br> conversion.

shared/renderkit/html/util/HTMLEncoder seems to provide support when escaping other HTML chars.

shared class HtmlResponseWriterImpl, method writeText(char cbuf[], int off, int len) appears to set flags to enable \n to <br> conversion.

BUT writeText(String, String), the form which is called from HtmlOutputTextRenderer, does *not* set these flags.

So it would seem straightforward to set the 'false' flags to 'true.'  including the same 'if (isTextarea())' condition.




> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>          Key: TOMAHAWK-214
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>      Project: MyFaces Tomahawk
>         Type: New Feature

>     Reporter: Alexander Panzhin
>     Priority: Minor

>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (TOMAHAWK-214) t:outputText attribute \n ->

Posted by "Bill Schneider (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=all ]

Bill Schneider updated TOMAHAWK-214:
------------------------------------

    Status: Patch Available  (was: Open)

> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>          Key: TOMAHAWK-214
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>      Project: MyFaces Tomahawk
>         Type: New Feature

>     Reporter: Alexander Panzhin
>     Priority: Minor

>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (TOMAHAWK-214) t:outputText attribute \n ->

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=comments#action_12436649 ] 
            
Martin Marinschek commented on TOMAHAWK-214:
--------------------------------------------

Well, I'm not sure. You could surely have a normal output-text where you'd want to have breaks showing, or even not showing. This needs definitely to be an attribute. I'm therefore cancelling the patch.

regards,

Martin

> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>                 Key: TOMAHAWK-214
>                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>             Project: MyFaces Tomahawk
>          Issue Type: New Feature
>            Reporter: Alexander Panzhin
>            Priority: Minor
>         Attachments: TOMAHAWK-214.diff
>
>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (TOMAHAWK-214) t:outputText attribute \n ->

Posted by "Bill Schneider (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=comments#action_12417371 ] 

Bill Schneider commented on TOMAHAWK-214:
-----------------------------------------

This would be incredibly useful, yet it isn't as easy as it looks, in no small part because you have to do the newline conversion *after* escaping other special chars for HTML.

So it's not enough to override getValue() in Tomahawk's HtmlOutputText class.  Instead, you have to drag a big chunk of HtmlTextRendererBase from 'shared' into Tomahawk's own HtmlTextRenderer, to do both the escaping and the newline conversion at the right moment.   

It might be better to refactor the output text escaping/conversion into a separate method from the actual output writing, so that you have a way to override some behavior from Tomahawk's classes.  That way, the Tomahawk renderer could just do something like 

protected String getOutputText() { 
  String escaped = super.getOutputText();
  return StringUtils.replace(escaped, "\n", "<br>"); 
}

> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>          Key: TOMAHAWK-214
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>      Project: MyFaces Tomahawk
>         Type: New Feature

>     Reporter: Alexander Panzhin
>     Priority: Minor

>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (TOMAHAWK-214) t:outputText attribute \n ->

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/TOMAHAWK-214?page=all ]

Martin Marinschek updated TOMAHAWK-214:
---------------------------------------

    Status: Open  (was: Patch Available)

> t:outputText attribute \n -> <br/>
> ----------------------------------
>
>                 Key: TOMAHAWK-214
>                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-214
>             Project: MyFaces Tomahawk
>          Issue Type: New Feature
>            Reporter: Alexander Panzhin
>            Priority: Minor
>         Attachments: TOMAHAWK-214.diff
>
>
> A boolean attribute, when set would convert '\n' to '<br/>'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira