-
1. Problem with a4j x custom components
jeancz Mar 8, 2011 2:39 PM (in response to jeancz)Anybody???
-
2. Problem with a4j x custom components
jbalunas Mar 8, 2011 4:55 PM (in response to jeancz)Hi Jean,
Can you give some more information on your env, such as RichFaces version, JSF Impl, etc..?
Thanks,
Jay
-
3. Problem with a4j x custom components
jeancz Mar 8, 2011 8:12 PM (in response to jbalunas)Sure...
JSF: 1.2
RichFaces: 3.3.3
JBoss: 4.3.3
-
4. Problem with a4j x custom components
ilya_shaikovsky Mar 9, 2011 4:18 AM (in response to jeancz)does just simple
<w:paginador count="#{dummy.count}" max="5" actual="#{dummy.atual}" executeSubmit="false" onselect="alert('working')">
works for you? Probably just event handler not encoded/bound properly.
-
5. Problem with a4j x custom components
jeancz Mar 9, 2011 9:32 AM (in response to ilya_shaikovsky)Really i'm not notifying events to jsf framework. How i do it?
-
6. Problem with a4j x custom components
jeancz Mar 9, 2011 5:13 PM (in response to jeancz)I searched in the web and found some articles abount events, then i try to call method queueEvent in decode method od my render, but don't works. What is missing?
@Override
public void decode(FacesContext context, UIComponent component) {
super.decode(context, component);
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
String clientId = component.getClientId(context);
String actual = request.getParameter(clientId + "_actual");
if (component.getValueExpression("actual") != null) {
component.getValueExpression("actual").setValue(context.getELContext(), Integer.parseInt(actual));
}
if (request.getParameter(clientId + "_onselect") != null) {
MethodExpression selectListener = ((Paginador)component).getSelectListener();
if (selectListener != null) {
selectListener.invoke(context.getELContext(), new Object[] { component, "SelectEvent" });
}
component.queueEvent(new ActionEvent(component));
}
}
-
7. Problem with a4j x custom components
nbelaevski Mar 10, 2011 3:25 AM (in response to jeancz)Jean,
You should render client-side event handlers such as onclick, onselect etc.
-
8. Problem with a4j x custom components
jeancz Mar 25, 2011 12:38 PM (in response to nbelaevski)Could you explain?
-
9. Problem with a4j x custom components
nbelaevski Mar 25, 2011 12:43 PM (in response to jeancz)Does this work as expected:
onselect="alert('select')"?
-
10. Re: Problem with a4j x custom components
jeancz Mar 25, 2011 1:42 PM (in response to nbelaevski)Onselect works fine without a4j. I implemented support to onselect on my component. See the code attached in this thread.
When I click on my pager component, it call a4j event, the event comes on the server, executes the decode method of my renderer, but do not call his endode methods. In other words, is like if it don't know which component to rerender. I could see other person with the same problem, but I can't any response.
I tried to extend UIInput component and HtmlBasicInputRenderer but I don't got success yet.
-
11. Problem with a4j x custom components
nbelaevski Mar 25, 2011 7:05 PM (in response to jeancz)Jean,
Looked over the code - nothing suspicious. Can you please attach the whole project so that I check it at my side?
-
12. Problem with a4j x custom components
jeancz Mar 28, 2011 7:54 AM (in response to nbelaevski)Hi Nick
I've attached all sources in this thread.
In last weekend I resolved my problem. I did this in validade method:
if (oldValue != newValue) {
addComponentsToRender(context);
queueEvent(new ValueChangeEvent(this, oldValue, newValue));
}
private void addComponentsToRender(FacesContext ctx) {
if (!executeSubmit && rerender != null) {
if (rerender.contains(",")) {
String[] ids = rerender.split(",");
for (int i = 0; i < ids.length; i++) {
UIComponent cp = ctx.getViewRoot().findComponent(getCompleteName(ctx, ids[i]));
if (cp != null) {
AjaxContext.getCurrentInstance().addComponentToAjaxRender(cp);
}
}
} else {
UIComponent cp = ctx.getViewRoot().findComponent(getCompleteName(ctx, rerender));
if (cp != null) {
AjaxContext.getCurrentInstance().addComponentToAjaxRender(cp);
}
}
}
}
I know which not is the wonderful soluction, but resolved my problem now. I hope this help other peoples with same problem.
-
13. Problem with a4j x custom components
nbelaevski Mar 28, 2011 8:08 PM (in response to jeancz)Jean,
This is the incorrect method that should be removed:
@Override
public void setValueExpression(String arg0, ValueExpression arg1) {
super.setValueExpression(arg0, arg1);
if (arg1 != null) {
if (!arg1.isLiteralText()) {
getAttributes().put(
arg0,
arg1.getValue(FacesContext.getCurrentInstance()
.getELContext()));
}
}
}