myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Volker Weber <users.myfa...@weber-oldenburg.de>
Subject Re: MethodBinding in CustomRenderer(2)
Date Thu, 01 Dec 2005 15:20:14 GMT
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.

Mime
View raw message