Hi Folks:

I'm trying to fill a "tab panel" with this code:

Page.html
        <table>
          <tr>
<span jwcid="[EMAIL PROTECTED]" source="ognl:paramSelected" value="ognl:parametro">
              <td>
                <span jwcid="@If" condition="ognl:parametro.hasCheckbox">
                  <span jwcid="@Checkbox" value="ognl:parametro.enabled"/>
                </span>
<span class="labelClass" jwcid="@Insert" value="ognl:parametro.campo.displayName"/>
//This is a try using Hidden with listener
<span jwcid="@Hidden" listener="listener:onChangeParamAct" value="ognl:parametro.nomParametro"/>
                <div jwcid="@RenderBlock" block="ognl:componente"/>
<block jwcid="[EMAIL PROTECTED]">
  <span jwcid="@TextField" value="ognl:parametro.valor" size="20"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<input jwcid="[EMAIL PROTECTED]" displayName="ognl:campo.displayName" value="ognl:parametro.valor" validator="floatValidator" type="text" size="20"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<input jwcid="[EMAIL PROTECTED]" displayName="ognl:campo.displayName" value="ognl:parametro.valor" validator="entValidator" type="text" size="20"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
  <span jwcid="@DatePicker" value="ognl:parametro.fecValor"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
  <span jwcid="@Checkbox" value="ognl:valor"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<span jwcid="@TextField" enabled="false" value="ognl:parametro.valor" size="20"/> <input type="button" value="..." onClick="newWindow('/consultas/app?service=page&amp;page=LookupDialog&amp;session=T','','400','200','noresizable,scrollbars,status,notoolbar');"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<input jwcid="@TextField" enabled="false" value="ognl:parametro.valor" type="text" size="20"/> <input type="button" value="..." onClick="newWindow('/consultas/app?service=page&amp;page=LookupDialog&amp;session=T','','400','200','noresizable,scrollbars,status,notoolbar');"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<input jwcid="@TextField" enabled="false" value="ognl:parametro.valor" type="text" size="20"/> <input type="button" value="..." onClick="newWindow('/consultas/app?service=page&amp;page=LookupDialog&amp;session=T','','400','200','noresizable,scrollbars,status,notoolbar');"/>
</block>
<block jwcid="[EMAIL PROTECTED]">
<select name="combo" jwcid="@PropertySelection" model="ognl:lookList" value="ognl:lookValue">
    <option selected=true value=0>Seleccione el valor</option>
  </select>
</block>
         </td>
       </span>
    </tr>
  </table>

I would prefer the blocks on another page, but for now I want that the page works.

.Page

<page-specification ...>

...

<bean name="intValidator" class="org.apache.tapestry.valid.NumberValidator">
    <set name="required" value="false"/>
    <set name="valueType">"int"</set>
  </bean>

<bean name="floatValidator" class="org.apache.tapestry.valid.NumberValidator">
    <set name="required" value="false"/>
    <set name="valueType">"float"</set>
  </bean>
  <property name="parametro"/>
...
</page-specification>


and .java

//This procedure was a trying, but is never called when I debug
// paramAct is a private instance variable

        public void onChangeParamAct(String nomParamAct){
this.paramAct = (TParametro)getUser().getConsulta().getGrpParam(getSelectedGroup()).getParametro(nomParamAct);
        }

//This is the function in charged of return the right block, but only return the default parameter that is defined on another part (when the tab is selected. The tab isn't a component yet).
        
        public Block getComponente(){
                StringBuffer sb = new StringBuffer();
                
if (paramAct.getLookupTable()==null || paramAct.getLookupTable().equals("")){
                        if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.cadena){
                                sb.append("alfanumerico");
                        }
                        else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.entero){
                                sb.append("numerico");
                        }
                        else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.fecha){
                                sb.append("fecha");
                        }
                        else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.bool){
                                sb.append("booleano");                          
      
                        }
                        else sb.append("alfanumerico");
                }
                else{
                        if 
(paramAct.getMostrarComo()==pctTipos.TTipoShow.combo){
                                sb.append("combo");
                        }
                        else if 
(paramAct.getMostrarComo()==pctTipos.TTipoShow.dialog){
                                if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.cadena){
                                        sb.append("alfanumericoBoton");
                                }
                                else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.entero){
                                        sb.append("numericoBoton");
                                }
                                else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.fecha){
                                        sb.append("fecha");
                                }
                                else if 
(paramAct.getCampo().getTipo()==pctTipos.TTipoDato.bool){
                                        sb.append("booleano");
                                }
                        }
                }

                return (Block)getComponent(sb.toString());
        }

I try these things but neither works

1) With a Hidden component inside For which value is parametro.nomParametro (parametro is a normal POJO) and listener="listener:onChangeParamAct", but never onChangeParamAct is called

2) change <div jwcid="@RenderBlock" block="ognl:componente(parametro.nomParametro)"/> and getComponente function change to receive the parameter directly. This throws an exception

3) Change <div jwcid="@RenderBlock" block="ognl:componente" paramAct="ognl:parametro:nomParametro"/> and put a Hidden component which value = "ognl:components.block.getParameter('paramAct')" and the listener of point 1), but throws an exception Unable to read OGNL expression '<parsed OGNL expression>' of [EMAIL PROTECTED]: target is null for method getParameter

4) Others that I don“t remember at this moment

The problem in last instance is to pass something that while the For is performing, change the private instance variable or can pass something to getComponente function to "calculate" the correct block.

I'm doing something wrong or trying to do something in a wrong way. Can someone spotlight a viable solution or my mistake?

Thanks in advance

JQ


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to