Hi, thanks Volker, adding the Components the right way made the Links work.
But! Now I run into another problem: As soon as I add the second Component I get the following exeption: javax.faces.FacesException: Client-id : sucheRoot_1 is duplicated in the faces tree. "suchRoot" is the id I specified for the surrounding tag on the jsp. But I explicitly set the id of all components I am adding. So where does this _1 come from. Could this come from some Id generated in Javascript for the CommandLinks?? Does anyone know at what point MyFaces generates Id's with "_1"? Any suggestion appreciated. Marcel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPITZ CONSULTING bringt Ihnen alle Termine auf einen Blick! Bestellen Sie unseren kostenlosen Jahres-Wandkalender 2006 unter mailto:[EMAIL PROTECTED] - http://www.opitz-consulting.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -----Ursprüngliche Nachricht----- Von: Volker Weber [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 1. Dezember 2005 16:20 An: 'MyFaces Discussion' Betreff: Re: MethodBinding in CustomRenderer(2) Hi, ok, you have a panelGrid in your jsp with component binding to your managed-bean property 'panelGrid' ? In your action-method schrittweiseKriteriumHinzufuegen() your are creating a new instance of SuchkriterienTable. I can't see wehre you add this instance to any parent component. Note: child.setParent(parent) don't add a child to the parent! Use, as you do it with your commandLinks, parent.getChildren().add(child) instead. If this is not the problem, than i have no idea, but if you create a example i can have a look again. Regards Volker Marcel Soulier wrote: > Hi, > > > > ok, here's what my code looks like: > > > > I create new components in the schrittweiseKriteriumHinzufuegen method > in a managed-bean. The new Component gets a CommandLink and is added to > the tree. > > > > public void schrittweiseKriteriumHinzufuegen(ActionEvent ae) > > { > > setTabIndex(1); > > SuchkriterienTable bean = erzeugeBean(); > > addLoeschenLink(bean); > > > > if (baumWurzel==null) > > { > > bean.setParent(this.getPanelGrid()); > > baumWurzel = bean; > > } > > else > > { > > bean.setParent(((UIComponent)ae.getSource()).getParent()); > > baumWurzel.addKriterium(bean); > > } > > > > } > > > > > > private SuchkriterienTable erzeugeBean() > > { > > SuchkriterienTable suchBean = new SuchkriterienTable(); > > suchBean.setSuchSpalte(kriteriumSpalte); > > > suchBean.setSuchSpalteLabel(getLabelToValueFromList(suchspaltenListe,kriteriumSpalte)); > > suchBean.setSuchOperator(kriteriumOperator); > > > suchBean.setSuchOperatorLabel(getLabelToValueFromList(suchoperatorListe,kriteriumOperator)); > > suchBean.setSuchWert(kriteriumWert); > > > suchBean.setVerknuepfung(MessageUtil.getMessageString("suche_kriterium_und","messages",null,FacesContext.getCurrentInstance().getExternalContext().getRequestLocale())); > > > > return suchBean; > > } > > > > private void addLoeschenLink(SuchkriterienTable bean) > > { > > HtmlCommandLink loeschenLink = new HtmlCommandLink(); > > HtmlGraphicImage image = new HtmlGraphicImage(); > > image.setUrl("/images/delete_icon.jpg"); > > loeschenLink.getChildren().add(image); > > MethodBinding binding = > FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{sucheHandler.schrittweiseKriteriumLoeschen}",new > Class[]{ActionEvent.class}); > > loeschenLink.setActionListener(binding); > > bean.getChildren().add(loeschenLink); > > } > > > > > > PanelGrid is a binding to the surrounding PanelGridTag on the jsp so > that I can set the correct parent for the first node in the tree. > BaumWurzel is the rootNode of the tree. Each of my CustomComponents has > a addKriteium method that adds the new Component to a list of dependant > components. (separate List to separate them form the Links that are > stored as Children). > > > > The MethodBinding should point to a method in a session-scope managed-bean. > > > > My Component 'SuchkriteriumTable' extends UIComponentBase with some > additional Attributes that should not be involved with this problem. > > > > When rendering the CommandLink I render a table-like HTML structure in a > CustomRenderer and let the Link render itself in the right table-cell. > > > > for (int j=0;j<component.getChildren().size();j++) > > { > > > ((UIComponent)leaf.getChildren().get(j)).encodeBegin(facesContext); > > > ((UIComponent)leaf.getChildren().get(j)).encodeChildren(facesContext); > > ((UIComponent)leaf.getChildren().get(j)).encodeEnd(facesContext); > > } > > > > > > I hope this is enough to make a guess. If not please respond an I will > try to set up a complete example of my case. > > > > Marcel > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Besuchen Sie unsere kostenlose Veranstaltung > "Effizientes Prozess- und IT-Management - > Die Verbindung von ARIS mit IT-Infrastrukturen" > am 24.11.2005 in Köln. Anmeldungen unter > http://www.opitz-consulting.de <BLOCKED::http://www.opitz-consulting.de> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > -- Don't answer to From: address! Mail to this account are droped if not recieved via mailinglist. To contact me direct create the mail address by concatenating my forename to my senders domain.

