Re: Trying to write my own component - AGAIN
Thanks Bruno, I'm studying the source since yesterday :). I was trying to code it in the encodeBegin, but nothing displayed. I'll try to code in the encodeEnd() method, following the schedule like you said. Best Regards Rafael Mauricio Nami2005/11/4, Bruno Aranda <[EMAIL PROTECTED]>: I think that the best option to see how to implement a component isdirectly check out the sources for the tomahawk/sandbox components.Every component has the component, tag, and renderer implementation.You can check the faces-config.xml file to see how this components areregistered and also the tld.About your specific questions: you don't need any binding if yourcomponent has everything in it (save/restore state, etc). Just pass the model to the value attribute (I guess it should be something likevalue="#{bean.graphicModel" (without the getter)). Take a look at theschedule component, as it accepts a custom model object.The encodeBegin is optional as long as your component does not render any children. When a component has children, the method encodeBegin iscalled before and the encodeEnd afterwars. In your case, I guess youonly need the encodeEnd in your renderer object (recommended).HTH, Bruno2005/11/4, Rafael Nami <[EMAIL PROTECTED]>:> Hi everyone, and thanks for the explanations about packing a component.> Im trying to write now a Graphics component. I already have a > GraphicFactory, that> receives a model object, and convert its attributes in coordinates. I'm> trying to> follow the approach that is described in Core JSF - chapter 12. I just want> to know one thing: > 1 - How can I add something like:> , where this backingbean> method returns this> model object, filling the component with the model object in one fellow > swoop.> Did I have to do some Binding code, because it's just a output component.> Did I have to only write the encodeBegin() method in the Tag??>> Thanks and Best Regards> > Rafael Mauricio Nami>
Re: Trying to write my own component - AGAIN
I think that the best option to see how to implement a component is directly check out the sources for the tomahawk/sandbox components. Every component has the component, tag, and renderer implementation. You can check the faces-config.xml file to see how this components are registered and also the tld. About your specific questions: you don't need any binding if your component has everything in it (save/restore state, etc). Just pass the model to the value attribute (I guess it should be something like value="#{bean.graphicModel" (without the getter)). Take a look at the schedule component, as it accepts a custom model object. The encodeBegin is optional as long as your component does not render any children. When a component has children, the method encodeBegin is called before and the encodeEnd afterwars. In your case, I guess you only need the encodeEnd in your renderer object (recommended). HTH, Bruno 2005/11/4, Rafael Nami <[EMAIL PROTECTED]>: > Hi everyone, and thanks for the explanations about packing a component. > Im trying to write now a Graphics component. I already have a > GraphicFactory, that > receives a model object, and convert its attributes in coordinates. I'm > trying to > follow the approach that is described in Core JSF - chapter 12. I just want > to know one thing: > 1 - How can I add something like: > , where this backingbean > method returns this > model object, filling the component with the model object in one fellow > swoop. > Did I have to do some Binding code, because it's just a output component. > Did I have to only write the encodeBegin() method in the Tag?? > > Thanks and Best Regards > > Rafael Mauricio Nami >
Trying to write my own component - AGAIN
Hi everyone, and thanks for the explanations about packing a component. Im trying to write now a Graphics component. I already have a GraphicFactory, that receives a model object, and convert its attributes in coordinates. I'm trying to follow the approach that is described in Core JSF - chapter 12. I just want to know one thing: 1 - How can I add something like: , where this backingbean method returns this model object, filling the component with the model object in one fellow swoop. Did I have to do some Binding code, because it's just a output component. Did I have to only write the encodeBegin() method in the Tag?? Thanks and Best Regards Rafael Mauricio Nami