A quick facelet tip. If you needed an extra attribute on a component you can add and access it easily with facelets. Here I needed to add an node attribute on boolean check box, which is part of rich faces tree.
<h:selectBooleanCheckbox id="tree_cbx" value="#{tree.getNode(item).selected}"
node="#{tree.getNode(item)}">
<a4j:support ajaxSingle="true" event="onchange"
reRender="tree_yetki">
<a4j:ajaxListener
type="tr.com.innova.ortak.tree.node.YetkiNodeListener"/>
</a4j:support>
</h:selectBooleanCheckbox>
You can access the attribute easily once you have the component. Here is my ajaxListener;
public class YetkiNodeListener implements AjaxListener {
@Override
public void processAjax(AjaxEvent event) {
UIComponent holder = (UIComponent) ((UIComponent) event.getSource())
.getParent();
holder.getValueExpression("node").getValue(FacesContext.getCurrentInstance().getELContext());
...
}
A4j ? ;)
ReplyDeleteI'll use the 'p' on my next project :)
ReplyDelete