incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Böhringer Jochen <Jochen.Boehrin...@tcc-products.de>
Subject Duplicated clientIds in Components embedded in Trinidad TreeTable
Date Fri, 01 Dec 2006 13:10:05 GMT
Hello,

 

It's the first time I'm developing an own component, so I think my problems have a very simple
solution. I want to develop a component for drag and drop using the dojo toolkit.

But my component is by now very simple. It only renders a div Tag around its children. 

The component is a simple class extending UIComponentBase and only overriding getFamily and
the saveState/restoreState methods.

The renderer is extending javax.faces.render.Renderer and overrides encodeBegin and ecodeEnd
to write the div Tag.

The div tag should get a unique id and I thought the clientId would be the right choice:

 

      @Override

      public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{

            if ((context == null) || (component == null)) {

                  throw new NullPointerException();

            }

            Draggable draggable = (Draggable) component;

            

            if (draggable.isRendered()) {

                  ResponseWriter writer = context.getResponseWriter();

                  writer.startElement("div", component);

                  writer.writeAttribute("id", draggable.getClientId(context), "clientId");

            }

      }

 

But if I embed the component (tcc:draggable) in a Trinidad Treetable the div tag is rendered
to the client with the same clientid for all rows in the tree table. What do I have to change
to have a unique id for each row in the table? For tr:outputText it works?!

 

 

<f:facet name="nodeStamp">

                        <tr:column>

                             <f:facet name="header">

                                   <tr:outputText value="Name (Level / Total Number of
Children)" />

                             </f:facet>

                             

                             <tcc:draggable>

                                   <tr:outputText

                                         inlineStyle="font-weight:bold;cursor:move;" 

                                         value="(#{treeNode.depth} / #{treeNode.totalNumberOfChildren})
#{treeNode.displayName}" 

                                         rendered="#{not treeNode.isVirtual}"/>

                                   <tr:outputText

                                         inlineStyle="font-weight:bold;cursor:move;"

                                         rendered="#{treeNode.isVirtual}"

                                         value="(#{treeNode.depth} / #{treeNode.totalNumberOfChildren})
#{treeNode.displayName}"

                                         styleClass="treeEditorVirtualNodeRowText" /> 
 

                             </tcc:draggable>

                        </tr:column>

                  </f:facet>

 

When I have reached a more advanced level of knowledge in component development I hope I will
be able to donate my drag&drop component to tomahawk or Trinidad.

 

Regards

Jochen


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message