This is the code:

HTML:

MainForm.html

The border is like tacos example, only to load tacos dependencies and 
the debug flag

<body jwcid="$content$">
  <span jwcid="@BorderSIG" pageTitle="literal:P&aacute;gina principal">
    <div id="header">
      <span class="title">
        <span jwcid="[EMAIL PROTECTED]" source="ognl:historicLinks" 
index="ognl:idx" value="ognl:histLink">
          <div jwcid="[EMAIL PROTECTED]" 
listener="listener:onHistoricLink" parameters="ognl:idx">
            <label jwcid="[EMAIL PROTECTED]" 
value="ognl:histLink.descLink" class="info">desc</label>
          </div>
        </span>
      </span>    
      <span class="logout"><a href="" jwcid="[EMAIL PROTECTED]" 
service="literal:restart">Salir</a></span>
    </div>
      <div dojoType="LayoutContainer"
           layoutChildPriority='top-bottom'
           style="width: 100%; height: 100%;">
        <div dojoType="SplitContainer"
             orientation="horizontal"
             sizerWidth="5"
             activeSizing="0"
             layoutAlign="client">
          <div dojoType="ContentPane" layoutAlign="client" sizeMin="180" 
sizeShare="10">
... some data parent of the hierarchy content
          </div>
          <div dojoType="SplitContainer"
               id="rightPane"
               orientation="vertical"
               sizerWidth="5"
               activeSizing="0"
               sizeMin="50" sizeShare="80">
            <div id="mainTabContainer" dojoType="TabContainer" 
sizeMin="30" sizeShare="250">
                <ul>
                  <span jwcid="errors">
                    <li jwcid="isInError" style="color: red">
                      <span jwcid="error" class="fm-error" />
                    </li>
                  </span>
                </ul>           
                <span jwcid="[EMAIL PROTECTED]" source="ognl:pestanas" 
value="ognl:dato">
                  <a jwcid="[EMAIL PROTECTED]:AjaxDirectLink"
                     dojoType="LinkPane"
                     listener="listener:onTabClick"
                     parameters="ognl:{dato.tipo, agrupa, dato.codGasto, 
dato.nivelGasto}">
                    <span jwcid="[EMAIL PROTECTED]" 
value="ognl:dato.nomGasto"></span></a>
                </span>
            </div>
            <div dojoType="ContentPane" sizeMin="20" sizeShare="150">
               <span key="InfoPnlInf">Info Adicional</span>
            </div>
          </div>
        </div>
      </div>
  </span>
</body>
</html>


GlobalInfo.html (the data page)

<body jwcid="@Body">
  <table border="1" width="100%">
    <tr>
      <td colspan="4"><strong>Presupuesto Total de <label 
class="subtitulo" jwcid="[EMAIL PROTECTED]" 
value="ognl:currentDist.nomGasto">link</label></strong></td>
      <td colspan="2"><div jwcid="@Insert" align="right" 
value="ognl:getCurrencyMask(currentDist.totAprop)">$2500.000.000</div></td>
    </tr>
    <tr>
      <td colspan="7">&nbsp;</td>
    </tr>
    <span jwcid="@If" condition="ognl:currentDist.tipo.equals('INGRESOS')">
      <tr>
        <td align="center" width="15%"><strong>Concepto</strong></td>
        <td align="center" width="12%"><strong>Valor<br />(En 
millones)</strong></td>
        <td align="center" width="5%"><strong>% * </strong></td>
        <td align="center" width="32%"><strong>Gr&aacute;fico</strong></td>
        <td align="center" width="5%"><strong>% ** </strong></td>
        <td align="center" width="33%"><strong>Gr&aacute;fico</strong></td>
      </tr>
      <tr>
        <td>Ingresos presupuestados a hoy</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totApropHoy)">$2000</span></td>
        <td align="center">100%</td>
        <td align="center" rowspan="2">&nbsp;</td>
        <td align="center">100%</td>
        <td align="center" rowspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td>Ingresos reales</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totCertificados)">$1600</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCertificadosHoy)">80%</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCertificadosHoy)">80%</span></td>
      </tr>
    </span>
    <span jwcid="@Else">
      <tr>
        <td align="center" width="15%"><strong>Concepto</strong></td>
        <td align="center" width="12%"><strong>Valor<br />(En 
millones)</strong></td>
        <td align="center" width="5%"><strong>% * </strong></td>
        <td align="center" width="32%"><strong>Gr&aacute;fico</strong></td>
        <td align="center" width="5%"><strong>% ** </strong></td>
        <td align="center" width="33%"><strong>Gr&aacute;fico</strong></td>
      </tr>
      <tr>
        <td>Apropiaci&oacute;n a hoy</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totApropHoy)">$2000</span></td>
        <td align="center">100%</td>
        <td align="center" rowspan="5">&nbsp;</td>
        <td align="center">100%</td>
        <td align="center" rowspan="5">&nbsp;</td>
      </tr>
      <tr>
        <td>Certificados</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totCertificados)">$1600</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCertificadosHoy)">80%</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCertificadosHoy)">80%</span></td>
      </tr>
      <tr>
        <td>Compromisos</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totCompromisos)">$1200</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCompromisosHoy)">60%</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porCompromisosCertificados)">75%</span></td>
      </tr>
      <tr>
        <td>Obligaciones</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totObligaciones)">$800</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porObligacionesHoy)">40%</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porObligacionesCompromisos)">66.67%</span></td>
      </tr>
      <tr>
        <td>Pagos</td>
        <td align="right"><span jwcid="@Insert" 
value="ognl:getCurrencyMask(currentDist.totPagos)">$400</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porPagosHoy)">40%</span></td>
        <td align="center"><span jwcid="@Insert" 
value="ognl:getPercentMask(currentDist.porPagosObligaciones)">50%</span></td>
      </tr>
      <tr>
        <td colspan="6"><div><em>* Porcentaje de ejecuci&oacute;n 
respecto a apropiaci&oacute;n a hoy</em></div></td>
      </tr>
      <tr>
        <td colspan="6"><div><em>** Porcentaje de ejecuci&oacute;n 
respecto a tr&aacute;mite anterior </em></div></td>
      </tr>
    </span>
  </table>
  <br /><br />
  <form jwcid="@Form">
  <table>
    <span jwcid="@If" condition="ognl:currentDist.tipo.equals('INGRESOS')">
      <tr>
        <span jwcid="@If" condition="ognl:currentDist.gastoEsNivel">
          <td>
            <div id="fm-hsubmit" class="dialog">
              <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnIngXRubro" value=" Ver por rubro " 
listener="listener:onClickLink" parameters="ognl:{'RUBRO'}" />
            </div>
          </td>
          <td>
            <div id="fm-hsubmit" class="dialog">
              <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnIngXRecurso" value=" Ver por recursos " 
listener="listener:onClickLink" parameters="ognl:{'RECURSO'}" />
            </div>
          </td>
          <td>
            <div id="fm-hsubmit" class="dialog">
              <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnIngXFte" value=" Ver por fuente " 
listener="listener:onClickLink" parameters="ognl:{'FUENTE'}" />
            </div>
          </td>
        </span>       
      </tr>     
    </span>
    <span jwcid="@Else">
      <span jwcid="@If" condition="ognl:currentDist.tipo.equals('GASTO')">
        <tr>
          <span jwcid="@If" condition="ognl:currentDist.unidadEsNivel">
            <td>
              <div id="fm-hsubmit" class="button">
                <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnGasXSubUnidad" value=" Ver por subunidades ejecutoras " 
listener="listener:onClickLink" parameters="ognl:{'SUBUNIDAD'}"/>
              </div>
            </td>
          </span>
          <span jwcid="@If" condition="ognl:currentDist.gastoEsNivel">
            <td>
              <div id="fm-hsubmit" class="button">
                <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnGasXUnidad" value=" Ver por unidades ejecutoras " 
listener="listener:onClickLink" parameters="ognl:{'UNIDAD'}"/>
              </div>
            </td>
            <td>
              <div id="fm-hsubmit" class="button">
                <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnGasXRubro" value=" Ver por rubro " 
listener="listener:onClickLink" parameters="ognl:{'RUBRO'}"/>
              </div>
            </td>
            <td>
              <div id="fm-hsubmit" class="button">
                <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnGasXFte" value=" Ver por fuente " 
listener="listener:onClickLink" parameters="ognl:{'FUENTE'}"/>
              </div>
            </td>
          </span>
        </tr>    
      </span>
      <span jwcid="@Else">
        <span jwcid="@If" 
condition="ognl:currentDist.tipo.equals('INVERSION')">
          <span jwcid="@If" condition="ognl:currentDist.gastoEsNivel">
            <td>
              <div id="fm-hsubmit" class="button">
                <input type="button" jwcid="[EMAIL PROTECTED]" 
name="btnInvXRubro" value=" Ver inversiones " 
listener="listener:onClickLink" parameters="ognl:{'RUBRO'}"/>
              </div>
            </td>
          </span>
        </span>
      </span>
    </span>
  </table> 
  </form>
</body>
</html>

MainForm.page

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
<page-specification class="com.pct.SIG.MainForm">

  <inject property="ajaxRequest" object="service:tacos.AjaxWebRequest" />
  <property name="dato" />
  <property name="idx" />
  <property name="histLink" />
  <property name="currentFieldTracking" />

  <component id="errors" type="For">
    <binding name="source" value="beans.delegate.fieldTracking" />
    <binding name="value" value="currentFieldTracking" />
  </component>

  <component id="error" type="Delegator">
    <binding name="delegate" value="currentFieldTracking.errorRenderer" />
  </component>

  <component id="onError" type="If">
    <binding name="condition" value="currentFieldTracking.inError" />
  </component>

  <component id="isInError" type="If">
    <binding name="condition" value="currentFieldTracking.inError" />
    <binding name="element" value="literal:li"/>
  </component>

</page-specification>


//GlobalForm.page doesn't have anything only its declaration

MainForm.Java (Only the pertinent source)

...
    @InjectPage("GlobalInfo")
    public abstract GlobalInfo getGlobalInfoPage();
   
    @InjectState("listGlobal")
    public abstract TListGlobal getListGlobal();
    public abstract void setListGlobal(TListGlobal Result);

    @Persist("session")
    public abstract ArrayList<THistoricLink> getHistoricLinks();
    public abstract void setHistoricLinks(ArrayList<THistoricLink> Result);


    public Enumeration<TDistGlobal> getPestanas(){        
        return getListGlobal().getDatos().elements();
    }

    public ArrayList<TKeyValue> getSubtipos(){       
        return getListGlobal().getListKeyUnidades();
    }

    public void pageBeginRender(PageEvent event)
    {
        if (!event.getRequestCycle().isRewinding()) {       
          if (getListGlobal().size() == 0){
                try{
                    getListGlobal().fillListGastos(getUser(), 
"EstGasto", null);
                    getListGlobal().fillListIngresos(getUser(), 
"IngGeneral", null);
                    TDistGlobal dist = 
getListGlobal().getDatos().get(getListGlobal().getListPosKeyGlobal().get(0)); 

                    getGlobalInfoPage().setCurrentDist(dist);
                    getGlobalInfoPage().setAgrupa("GLOBAL");
                    setTipo(dist.getTipo());
                    if (getHistoricLinks()==null)
                      setHistoricLinks(new ArrayList<THistoricLink>());
                    getGlobalInfoPage().setLastNvlUnidad(1);
        }
                catch (Exception ex){
                    if (logger.isDebugEnabled()){
                        logger.debug(ex.getMessage());
                    }
                    IValidationDelegate delegate = getDelegate();
((IForm)getComponent("MainForm")).getDelegate();
                    delegate.setFormComponent(null);               
                    delegate.record(ex.getMessage(), null);
                }
          }
          setProperties();           
        }
    }
   
//This is the listener when the user clicks on tab (the GlobalInfo page 
is loaded in a lazy way)

    public GlobalInfo onTabClick(String tipo, String campoAgrupa, String 
codigo, Integer nivelCodigo){
        if (getListGlobal().getDatos().get(codigo) != null){ //Codigo is 
found
            
getGlobalInfoPage().setCurrentDist(getListGlobal().getDatos().get(codigo));
            getGlobalInfoPage().getCurrentDist().setEscala(1000000);
            setLastValue(codigo);
        }
        else{ //This happens when back or forward button is pressed
            getData(campoAgrupa, false);
            
getGlobalInfoPage().setCurrentDist((getListGlobal().getDatos().get(codigo)));   
 
       
            getGlobalInfoPage().getCurrentDist().setEscala(1000000); 
//Para que muestre en millones           
        }
        return getGlobalInfoPage();
    }

getData build a SQL sentence with dynamic grouping and fill TListGlobal 
object which is a Hash of TDistGlobal which is an array with the row 
values of the SQL built.

    public void getData(String campoAgrupa, boolean incNivel){
        Object[] params; //SQL parameters: they are found as part of the 
process based on procedure parameters
        TDistGlobal currentTab = getGlobalInfoPage().getCurrentDist();

 In this line is the big problem because never found the object into 
GlobalInfo page, always is null and the app cannot bring the data


GlobalInfo.java

    @InjectPage("MainForm")
    public abstract MainForm getMainFormPage();

    @Persist("client")
    public abstract TDistGlobal getCurrentDist();
    public abstract void setCurrentDist(TDistGlobal curr);   

//This is the procedure that re-load all page (MainForm)

    public MainForm onClickLink(String campoAgrupa){   
        getMainFormPage().getData(campoAgrupa, true); //Here always 
GetCurrentDist is null
        if (getMainFormPage().getHistoricLinks().size() == 0)
            getMainFormPage().getHistoricLinks().add(new 
THistoricLink(getCurrentDist(), null, getLastCodGasto(), 
getLastNvlGasto(), getLastCodUnidad(), getLastNvlUnidad(), 
getLastCodRecurso()));
        else getMainFormPage().getHistoricLinks().add(new 
THistoricLink(getCurrentDist(), campoAgrupa, getLastCodGasto(), 
getLastNvlGasto(), getLastCodUnidad(), getLastNvlUnidad(), 
getLastCodRecurso()));
        return getMainFormPage();
    }   


This code maybe can help to understand what I'm trying to do

Thanks in advance

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel

Reply via email to