You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Stephen Friedrich (JIRA)" <de...@myfaces.apache.org> on 2007/10/05 00:30:50 UTC

[jira] Created: (TRINIDAD-755) Positions of "required" and "message" label should be skinnable

Positions of "required" and "message" label should be skinnable
---------------------------------------------------------------

                 Key: TRINIDAD-755
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-755
             Project: MyFaces Trinidad
          Issue Type: New Feature
          Components: Skinning
    Affects Versions: 1.0.3-core
            Reporter: Stephen Friedrich


Currently Trinidad always shows icon and text of a label in this order: <message-icon> <required-.icon> <text>
It should be able to specify a different order in the skin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TRINIDAD-755) Positions of "required" and "message" label should be skinnable

Posted by "Stephen Friedrich (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Friedrich updated TRINIDAD-755:
---------------------------------------

    Status: Patch Available  (was: Open)

> Positions of "required" and "message" label should be skinnable
> ---------------------------------------------------------------
>
>                 Key: TRINIDAD-755
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-755
>             Project: MyFaces Trinidad
>          Issue Type: New Feature
>          Components: Skinning
>    Affects Versions: 1.0.3-core
>            Reporter: Stephen Friedrich
>         Attachments: positions.patch
>
>
> Currently Trinidad always shows icon and text of a label in this order: <message-icon> <required-.icon> <text>
> It should be able to specify a different order in the skin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-755) Positions of "required" and "message" label should be skinnable

Posted by "Stephen Friedrich (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534235 ] 

Stephen Friedrich commented on TRINIDAD-755:
--------------------------------------------

When I started I hoped for just a few tweaks in the code, but in the end the changes were larger than that:
* First, if the position of the required icon is skinnable, then the position of the message icon should sure be skinnable, too. Yet, now one must care for the relative ordering in between both icons, too. I solved that by specify the position as an integer index relative to the text position, so -2 for message icon and -1 for required icon is the default, -1 for message and +1 for required would show the message icon in front of and the required icon after the text.
* There is so much code just to determine whether an icon is shown at all. I need to check that first, to figure out if a &nbsp; is needed in front of and/or behind the label's text. Most of that code would be needed again if the icon is finally really rendered. To avoid that you can of course remember each icon's details (message type, alt text, ...). Well, to remember it, it makes sense to encapsulate it. 
* If you encapsulate it, you can just as well move icon specific code to the encapsulation class, using it as a delegate from within the renderer. Then it makes sense to move code that is common for both delegates to a base class.
* Two utility methods that were available from within the renderer at a base class were not accessible from the delegates. I made them static, which is probably ok, because several other methods of the same kind were already static.

All in all I think the code is more readable now. 

> Positions of "required" and "message" label should be skinnable
> ---------------------------------------------------------------
>
>                 Key: TRINIDAD-755
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-755
>             Project: MyFaces Trinidad
>          Issue Type: New Feature
>          Components: Skinning
>    Affects Versions: 1.0.3-core
>            Reporter: Stephen Friedrich
>         Attachments: positions.patch, skin-selectors.patch
>
>
> Currently Trinidad always shows icon and text of a label in this order: <message-icon> <required-.icon> <text>
> It should be able to specify a different order in the skin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-755) Positions of "required" and "message" label should be skinnable

Posted by "Stephen Friedrich (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625854#action_12625854 ] 

Stephen Friedrich commented on TRINIDAD-755:
--------------------------------------------

Just in case somebody needs a workaround (well, a dirty hack):
Include the jquery core, then use 

function fixRequiredIcons() {
    $('.AFRequiredIconStyle').each(function() {
        var e = $(this);
        var parent = e.parent();
        parent.append(' ');
        e.appendTo(parent);
    })
}

// Needs to re-apply the required icon fix
TrPage.getInstance().getRequestQueue().addStateChangeListener(pprCallback);

function pprCallback(status) {
    if (status == TrRequestQueue.STATE_READY) {
        fixRequiredIcons()
    }
}

$(document).ready(function() {
    fixRequiredIcons();
});



> Positions of "required" and "message" label should be skinnable
> ---------------------------------------------------------------
>
>                 Key: TRINIDAD-755
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-755
>             Project: MyFaces Trinidad
>          Issue Type: New Feature
>          Components: Skinning
>    Affects Versions: 1.0.3-core
>            Reporter: Stephen Friedrich
>         Attachments: positions.patch, skin-selectors.patch
>
>
> Currently Trinidad always shows icon and text of a label in this order: <message-icon> <required-.icon> <text>
> It should be able to specify a different order in the skin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.