I think there's a good argument for making the components as malleable
as possible - much more so than the other framework APIs. The exposure
to upgrade breakages is probably a necessary trade-off. E.g. for the full
utility of mixins to be realized:
https://issues.apache.org/jira/browse/TAPESTRY-1764
Cheers,
Nick.
Howard Lewis Ship wrote:
Alternately, you could subclass GridRows to provide the hooks for what you
need, then subclass Grid to make use of your custom GridRows.
The components in Tapestry are not meant to be sacrosanct, just useful.
Though that does bring up the question of component compatibility between
releases. Hmph.
On 9/27/07, Carl Pulley <[EMAIL PROTECTED]> wrote:
Having now had the chance to tidy up my example code, here's my MixIn code
for the Grid Component:
@MixinAfter
public class ActionRows {
public static final String event = "rowAction";
@Parameter(value="click", defaultPrefix="literal")
private String action;
@Parameter(required=true)
private String rowid;
@Inject
private ComponentResources resources;
@AfterRender
void after(MarkupWriter writer) {
final String tbodyPath = "div/table/tbody";
Element tbody = writer.getElement().find(tbodyPath);
if (tbody == null) {
throw new RuntimeException(...);
}
for (Node rowNode : tbody.getChildren()) {
if (rowNode instanceof Element) {
((Element) rowNode).attribute("on" + action, "
window.location.assign('" +
resources.createActionLink(event, false, new Object[] { rowid }) + "')");
}
}
} // end of AfterRender method
} // end of MixIn class ActionRows
and here's a typical page-usage scenario:
@Component(parameters = { "action=dblclick", "rowid=row.id", "row=row",
...
})
@MixinClasses(ActionRows.class)
private Grid displayData;
@OnEvent(value = ActionRows.event, component = ...)
public Object displayRow(int id) {
...
}
Hope that helps,
Carl.
--
View this message in context:
http://www.nabble.com/-T5--Linkable-rows-with-Grid-component-tf4519155.html#a12916995
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]