tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Sommerville (JIRA)" <...@tapestry.apache.org>
Subject [jira] Created: (TAPESTRY-1395) Add mixin to render element name & id
Date Tue, 03 Apr 2007 03:15:32 GMT
Add mixin to render element name & id
-------------------------------------

                 Key: TAPESTRY-1395
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1395
             Project: Tapestry
          Issue Type: Improvement
          Components: tapestry-core
    Affects Versions: 5.0.4
            Reporter: Ben Sommerville
            Priority: Trivial


Currently all field components have to render their name and id explicitly. 
Since all field components need to do this it seems reasonable to add a mixin to do it for
them, similar to the RenderDisabled mixin.

This moves the responsiblity for rendering element names and ids to one place & reduce
the code for component implementations.  It also means that derived components don't have
to worry about names/id in unit tests (which is tricky since both those fields are read only)

e.g.

/**
 * Renders a "name" and "id' attribute for the containing field.
 */
@MixinAfter
public class RenderIdentifiers {

    @InjectComponent
    private Field _field;

    void beginRender(MarkupWriter writer)
    {
          writer.attributes("name",field.getElementName()
                                        "id", field.getClientId);
    }
}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message