cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: How can I create a new browser window from flowscript?
Date Tue, 11 May 2010 15:08:41 GMT
That's not the way to do this...

Just use an action instead of a form submit and add an event handler in your form definition...

I added some samples of a complex application I built so you can check some stuff out if you
like.

Cheers,
Robby


---------------- formdefinition -------------


<?xml version="1.0" encoding="UTF-8"?>
<fd:form id="objectsearcherForm" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
  <fd:widgets>
    <fd:action id="refresh">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.refresh();
        </javascript>
      </fd:on-action>
    </fd:action>
    <fd:action id="reset">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.reset();
        </javascript>
      </fd:on-action>
    </fd:action>
    <fd:repeater id="properties">
      <fd:widgets>
        <fd:booleanfield id="showField">
          <fd:initial-value>false</fd:initial-value>
        </fd:booleanfield>
        <fd:field id="propertyKey" state="invisible">
	      <fd:datatype base="string"/>          
        </fd:field>        
        <fd:field id="propertyName" state="output">
	      <fd:datatype base="string"/>          
        </fd:field>
        <fd:field id="datatype" state="output">
	      <fd:datatype base="string"/>
        </fd:field>
        <fd:union id="datatype-union" case="datatype">
          <fd:widgets>
          
            <fd:group id="String">
              <fd:widgets>
                <fd:field id="operator">
	              <fd:datatype base="string"/>
	              <fd:selection-list>
	                <fd:item value="-- operator --"/>
	                <fd:item value="EQUALS"><fd:label>=</fd:label></fd:item>

	                <fd:item value="CONTAINS"><fd:label>contains</fd:label></fd:item>
                 
	                <fd:item value="IS_NULL"><fd:label>is null</fd:label></fd:item>
 
	                <fd:item value="IS_EMPTY"><fd:label>is empty</fd:label></fd:item>
	                <fd:item value="IN"><fd:label>in</fd:label></fd:item>
                 	                	                	                	                
	              </fd:selection-list>
	              <fd:on-value-changed>
	                <javascript>
                      var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                      objectSearcher.handleOperatorChangedEvent(event);	                
	                </javascript>
	              </fd:on-value-changed>	        
                </fd:field>              
                <fd:union id="operator-union" case="operator">
                  <fd:widgets>
                    <fd:group id="-- operator --"/>                  
                    <fd:group id="CONTAINS">
                      <fd:widgets>  
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="string"/>			        
                        </fd:field>
                      </fd:widgets>
                    </fd:group>
                    <fd:group id="EQUALS">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="string"/>			        
                        </fd:field>
                      </fd:widgets>                    
                    </fd:group>
                    <fd:group id="IS_NULL"/>
                    <fd:group id="IS_EMPTY"/>
                    <fd:group id="IN">
                      <fd:widgets>
                        <fd:multivaluefield id="criteria">
	                      <fd:datatype base="string"/>                        
                        </fd:multivaluefield>                    
                      </fd:widgets>
                    </fd:group>                                                    
                       
                  </fd:widgets>
                </fd:union>
              </fd:widgets>
            </fd:group>
            
            <fd:group id="Integer">
              <fd:widgets>
                <fd:field id="operator">
	              <fd:datatype base="string"/>
	              <fd:selection-list>
	                <fd:item value="-- operator --"/>
	                <fd:item value="EQUALS"><fd:label>=</fd:label></fd:item>
 
	                <fd:item value="IS_NULL"><fd:label>is null</fd:label></fd:item>
 
	                <fd:item value="LT"><fd:label>&lt;</fd:label></fd:item>
	                <fd:item value="LTE"><fd:label>&lt;=</fd:label></fd:item>
	                <fd:item value="GT"><fd:label>&gt;</fd:label></fd:item>
	                <fd:item value="GTE"><fd:label>&gt;=</fd:label></fd:item>
	                <fd:item value="BETWEEN"><fd:label>between</fd:label></fd:item>
                	                	                	                	 	                	  
             	                	                
	              </fd:selection-list>
	              <fd:on-value-changed>
	                <javascript>
                      var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                      objectSearcher.handleOperatorChangedEvent(event);	                
	                </javascript>
	              </fd:on-value-changed>	              	              			        
                </fd:field>               
                <fd:union id="operator-union" case="operator">
                  <fd:widgets>
                    <fd:group id="-- operator --"/>                  
                    <fd:group id="EQUALS">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="IS_NULL"/>
                    <fd:group id="LT">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                                    
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="LTE">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                                        
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="GT">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                                       
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="GTE">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                                        
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="BETWEEN">
                      <fd:widgets>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>
                        <fd:field id="criterium2" required="true">
	                      <fd:datatype base="integer"/>			        
                        </fd:field>                        
                      </fd:widgets>                     
                    </fd:group>                                                    
                                                                                         
       
                  </fd:widgets>
                </fd:union>
              </fd:widgets>
            </fd:group>
            
            <fd:group id="Double">
              <fd:widgets>
                <fd:field id="operator">
	              <fd:datatype base="string"/>
	              <fd:selection-list>
	                <fd:item value="-- operator --"/>
	                <fd:item value="EQUALS"><fd:label>=</fd:label></fd:item>
 
	                <fd:item value="IS_NULL"><fd:label>is null</fd:label></fd:item>
 
	                <fd:item value="LT"><fd:label>&lt;</fd:label></fd:item>
	                <fd:item value="LTE"><fd:label>&lt;=</fd:label></fd:item>
	                <fd:item value="GT"><fd:label>&gt;</fd:label></fd:item>
	                <fd:item value="GTE"><fd:label>&gt;=</fd:label></fd:item>
	                <fd:item value="BETWEEN"><fd:label>between</fd:label></fd:item>
	                	                	                	                	 	                	 
              	                	                
	              </fd:selection-list>
	              <fd:on-value-changed>
	                <javascript>
                      var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                      objectSearcher.handleOperatorChangedEvent(event);	                
	                </javascript>
	              </fd:on-value-changed>	                            		        
                </fd:field>               
                <fd:union id="operator-union" case="operator">
                  <fd:widgets>
                    <fd:group id="-- operator --"/>
                    <fd:group id="EQUALS">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="IS_NULL"/>
                    <fd:group id="LT">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                                          
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="LTE">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="GT">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="GTE">
                      <fd:widgets>
                        <fd:action id="lookup">
                          <fd:on-action>
                            <javascript>
                              var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
                              objectSearcher.handleLookupClickEvent(event);
                            </javascript>
                          </fd:on-action>
                        </fd:action>                     
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                      </fd:widgets>                     
                    </fd:group>
                    <fd:group id="BETWEEN">
                      <fd:widgets>                    
                        <fd:field id="criterium1" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>
                        <fd:field id="criterium2" required="true">
	                      <fd:datatype base="double"/>			        
                        </fd:field>             
                      </fd:widgets>
                    </fd:group>                                                    
                                                                                         
       
                  </fd:widgets>
                </fd:union>
              </fd:widgets>
            </fd:group>                      
            
          </fd:widgets>
        </fd:union>       
                 		
      </fd:widgets>
    </fd:repeater>
        
    <fd:field id="sortBy">
	  <fd:datatype base="string"/>
	  <fd:on-value-changed>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.handleSortByValueChangedEvent(event);
        </javascript>	  
	  </fd:on-value-changed>		        
    </fd:field>
    
    <fd:action id="first">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.firstPage();
        </javascript>
      </fd:on-action>
    </fd:action>
    <fd:action id="previous">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.previousPage();
        </javascript>
      </fd:on-action>
    </fd:action>
    <fd:action id="next">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.nextPage();
        </javascript>
      </fd:on-action>
    </fd:action> 
    <fd:action id="last">
      <fd:on-action>
        <javascript>
          var objectSearcher = event.getSource().getForm().getAttribute("objectSearcher");
          objectSearcher.lastPage();
        </javascript>
      </fd:on-action>
    </fd:action>
    
    <fd:field id="showResults">
	  <fd:datatype base="string"/>
      <fd:initial-value>false</fd:initial-value>	  
	  <fd:selection-list>
	    <fd:item value="true"><fd:label>true</fd:label></fd:item>	 
	    <fd:item value="false"><fd:label>false</fd:label></fd:item>	
                	                	                	                	 	                	  
             	                	                
	  </fd:selection-list>	              		        
    </fd:field>          
  </fd:widgets>
</fd:form>



---------------- formtemplate macro-------------
  <jx:macro name="objectsearcher-widget">
    <ft:form action="#{$cocoon/continuation/id}.continue" method="POST" >
      <table>
        <tr>
          <td style="width: 4%; border-bottom: 1px solid black; border-top: 1px solid black;">
            <div title="Clicking this button indexes any new or changed objects again.">
	          <ft:widget id="refresh">
                <fi:styling type="image" src="shared/resource/external/icons/Blue/32/refresh.png"/>
              </ft:widget>
            </div>          
          </td>
          <td style="width: 4%; border-bottom: 1px solid black; border-top: 1px solid black;">
            <div title="Clicking this button clears the cached objects and indexes all
objects again. Be aware that this is a timeconsuming operation.">
	          <ft:widget id="reset">
                <fi:styling type="image" src="shared/resource/external/icons/Blue/32/Recycle.png"/>
              </ft:widget>
           </div>            
          </td>
          <td style="width: 88%; border-bottom: 1px solid black; border-top: 1px solid
black;">
            Objects last indexed at ${lastProcessedDate}
          </td>
          <td style="width: 4%; border-bottom: 1px solid black; border-top: 1px solid black;">
            <jx:if test="${hasCorruptObjects}">
              <a href="${corruptObjectsViewerURI}" target="_blank" style="color: white;"
title="View corrupt objects">
                <img src="shared/resource/external/icons/yellow/32/about.png"/>
              </a>  
            </jx:if>          
          </td>
        </tr>
      </table>
      <ft:repeater id="properties">
        <table>
          <thead>
            <tr class="subheader">
              <th style="width: 5%;">Show</th>
              <th style="width: 1%;"/> <!--  for key -->
              <th style="width: 30%;">Property</th>
              <th style="width: 15%;">Operator</th>
              <th style="width: 40%;">Value(s)</th>                          
           
            </tr>
          </thead>
          <tbody>
            <ft:repeater-rows>
              <tr>
                <td>
                  <ft:widget id="showField"/>
                </td>
                <td>
                  <ft:widget id="propertyKey"/>
                </td>                
                <td>
                  <ft:widget id="propertyName"/>
                </td>
                <ft:union id="datatype-union">
                  <ft:case id="String">
                    <ft:group id="String">
                      <td>
                        <ft:widget id="operator">
                          <fi:styling list-type="dropdown" submit-on-change="true"/>
                        </ft:widget>
                      </td>
                      <td style="1px solid blue; padding: 0px;">               
	                    <ft:union id="operator-union">
	                      <ft:case id="-- operator --">
	                        <ft:group id="-- operator --"/>
	                      </ft:case>                        
	                      <ft:case id="CONTAINS">
	                        <ft:group id="CONTAINS">
	                          <ft:widget id="criterium1"/>
	                        </ft:group>
	                      </ft:case>
	                      <ft:case id="EQUALS">
	                        <ft:group id="EQUALS">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>	                        
	                          <ft:widget id="criterium1"/>                      
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="IS_NULL">
	                        <ft:group id="IS_NULL"/>                      
	                      </ft:case>
	                      <ft:case id="IS_EMPTY">
	                        <ft:group id="IS_EMPTY"/>                          
	                      </ft:case>
	                      <ft:case id="IN">
	                        <ft:group id="IN">
                              <ft:widget id="criteria">
                                <fi:styling list-type="double-listbox">
                                  <fi:available-label>Available</fi:available-label>
                                  <fi:selected-label>Selected</fi:selected-label>
                                </fi:styling>
                              </ft:widget>
	                        </ft:group>                          
	                      </ft:case>	                                                 
                                                  
	                    </ft:union>
	                  </td>      
                    </ft:group>
                  </ft:case>
                  <ft:case id="Integer">
                    <ft:group id="Integer">
                      <td>
                        <ft:widget id="operator">
                          <fi:styling list-type="dropdown" submit-on-change="true"/>
                        </ft:widget>
                      </td>
                      <td>                        
	                    <ft:union id="operator-union">
	                      <ft:case id="-- operator --">
	                        <ft:group id="-- operator --"/>
	                      </ft:case>                        
	                      <ft:case id="EQUALS">
	                        <ft:group id="EQUALS">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                           
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="IS_NULL">
	                        <ft:group id="IS_NULL"/>                      
	                      </ft:case>
	                      <ft:case id="LT">
	                        <ft:group id="LT">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                           
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="LTE">
	                        <ft:group id="LTE">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                           
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="GT">
	                        <ft:group id="GT">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                           
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="GTE">
	                        <ft:group id="GTE">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="BETWEEN">
	                        <ft:group id="BETWEEN">	                        
	                          <ft:widget id="criterium1"/> and <ft:widget id="criterium2"/>
                                                       
	                        </ft:group>                          
	                      </ft:case>                                         
	                    </ft:union>
                      </td>                    
                    </ft:group>                    
                  </ft:case>
                  <ft:case id="Double">
                    <ft:group id="Double">
                      <td>
                        <ft:widget id="operator">
                          <fi:styling list-type="dropdown" submit-on-change="true"/>
                        </ft:widget>
                      </td>
                      <td>                        
	                    <ft:union id="operator-union">
	                      <ft:case id="-- operator --">
	                        <ft:group id="-- operator --"/>
	                      </ft:case>                        
	                      <ft:case id="EQUALS">
	                        <ft:group id="EQUALS">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="IS_NULL">
	                        <ft:group id="IS_NULL"/>                      
	                      </ft:case>
	                      <ft:case id="LT">
	                        <ft:group id="LT">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="LTE">
	                        <ft:group id="LTE">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="GT">
	                        <ft:group id="GT">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="GTE">
	                        <ft:group id="GTE">
	                          <ft:widget id="lookup">
                                <fi:styling type="image" src="shared/resource/external/icons/Blue/24/zoom.png"/>
                              </ft:widget>		                        
	                          <ft:widget id="criterium1"/>                            
	                        </ft:group>                          
	                      </ft:case>
	                      <ft:case id="BETWEEN">
	                        <ft:group id="BETWEEN">		                        
	                          <ft:widget id="criterium1"/> and <ft:widget id="criterium2"/>
                                                         
	                        </ft:group>                          
	                      </ft:case>                                         
	                    </ft:union>
	                  </td>                            
                    </ft:group>                    
                  </ft:case>                                        
                </ft:union>
              </tr>
            </ft:repeater-rows>       
          </tbody>
        </table>
      </ft:repeater>
      <br/>
      <input type="submit" value="Search"/>
      <div style="visibility: hidden;">
        <ft:widget id="showResults"/>
      </div>  

      <jx:if test="${datatable != null}">
        <div id="panel1">
	      <div class="hd">
	        <span>
              results package selector SPIDER
            </span>  
	      </div>

	        <div class="bd">
	          <div>
              ${datatable.getResultSet().size()} result(s) found for Query:
              </div>  	        
	          <div style="white-space: normal; width: 100%; font-weigh: bold;">
                ${queryString}
              </div>  	        
	          <table>
	            <tr>
	              <td>
                    Sort By 
                    <ft:widget id="sortBy">
                      <fi:styling list-type="dropdown" submit-on-change="true"/>   
        
                    </ft:widget>	              
	              </td>
	              <td>
	                <ft:widget id="first">
                      <fi:styling type="image" src="shared/resource/external/icons/Blue/24/Backward_01.png"/>
                    </ft:widget>
	                <ft:widget id="previous">
                      <fi:styling type="image" src="shared/resource/external/icons/Blue/24/Backward.png"/>
                    </ft:widget>
	                <ft:widget id="next">
                      <fi:styling type="image" src="shared/resource/external/icons/Blue/24/Forward.png"/>
                    </ft:widget>
	                <ft:widget id="last">
                      <fi:styling type="image" src="shared/resource/external/icons/Blue/24/Forward_01.png"/>
                    </ft:widget> 	              
	              </td>
	              <td>
	                Page ${datatable.getPaginator().getCurrentPageIndex()} of ${datatable.getPaginator().getPageCount()}
	              </td>
	            </tr>
	          </table>	        
	        
	        
	          <table>
	            <thead>
                  <tr class="subheader">
                    <jx:eval select="${tags.customheadercells}"/>
                    <jx:forEach var="pd" items="${datatable.getPropertyDefinitions()}">

                      <jx:if test="${!pd.getKey().equals('Id')}" >    
                        <th>${pd.getName()}</th>
                      </jx:if>  
                    </jx:forEach>
                  </tr>	              
	            </thead>
	            <tbody>
                  <jx:forEach var="object" items="${datatable.getPaginator().getCurrentPage()}">
                    <tr>
                      <jx:eval select="${tags.custombodycells}"/>
                      <jx:forEach var="pd" items="${datatable.getPropertyDefinitions()}"
varStatus="status">
                        <jx:set var="color">
                          <jx:choose>
                            <jx:when test="${status.index % 2 == 0}">background-color:white;</jx:when>
                            <jx:otherwise>background-color: #F1F1F1;</jx:otherwise>
                          </jx:choose>
                        </jx:set>
                        <jx:if test="${!pd.getKey().equals('Id')}" >               
     
                          <td>
                            <jx:attribute name="style">${color}</jx:attribute>
                            ${object.getProperty(pd.getKey()).getValue()}
                          </td>
                        </jx:if>  
                      </jx:forEach>
                    </tr>
                  </jx:forEach>	              
	            </tbody>
	          </table>
	        </div>
	        <div class="ft"></div>
          </div>
        </jx:if>

    </ft:form>
  </jx:macro>


---------------- flowscript -------------

importClass(Packages.org.apache.cocoon.forms.formmodel.WidgetState);

/***************************************************************************************
					       GENERIC OBJECT SEARCHER
***************************************************************************************/
function ObjectSearcher(objectSelector, objectSearcher, view, corruptObjectsViewerURI) {
    this.objectSelector = objectSelector;
    this.objectSearcher = objectSearcher;
    this.corruptObjectsViewerURI = corruptObjectsViewerURI;
    this.view = view;
    this.initialize();
}

ObjectSearcher.prototype.initialize = function() {
	cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
	this.form = new Form("cocoon://formdefinition");
	this.wForm = this.form.form;
	this.wProperties = this.wForm.lookupWidget("properties");
	this.form.setAttribute("objectSearcher", this);
	this.objectSearcher.initialize(this.wForm);
	this.datatable = null;
    var lastProcessedDate = this.objectSelector.getLastProcessedDate();	
    var queryString = null;
    var datatable = null;
    var hasCorruptObjects = this.objectSelector.getCorruptObjects().size() > 0;
    
	this.viewData = ViewData(lastProcessedDate, queryString, null, hasCorruptObjects, this.corruptObjectsViewerURI);
	while(true) {	
	    this.showForm(this.viewData);
	    this.objectSearcher.search();
	    
//	    var csv = this.objectSearcher.getResultsToCSV();
//	    print(csv);
	    
        this.wForm.lookupWidget("showResults").setValue("true");
	    lastProcessedDate = this.objectSelector.getLastProcessedDate();
	    queryString = this.objectSearcher.getQueryString();
	    datatable = this.objectSearcher.getDataTable();
	    this.viewData = ViewData(lastProcessedDate, queryString, datatable, hasCorruptObjects,
this.corruptObjectsViewerURI);
	}    
}

ObjectSearcher.prototype.showForm = function(viewData) {
	this.form.showForm(this.view, viewData);
}

ObjectSearcher.prototype.handleLookupClickEvent = function(event) {
    this.wForm.lookupWidget("showResults").setValue("false");	
	this.objectSearcher.handleLookupClickedEvent(event);
}

ObjectSearcher.prototype.handleOperatorChangedEvent = function(event) {
    this.wForm.lookupWidget("showResults").setValue("false");	
	this.objectSearcher.handleOperatorChangedEvent(event);
}

ObjectSearcher.prototype.handleSortByValueChangedEvent = function(event) {
	this.objectSearcher.handleSortByValueChangedEvent(event);
}

ObjectSearcher.prototype.refresh = function() {
	this.objectSelector.refresh();
}

ObjectSearcher.prototype.reset = function() {
	this.objectSelector.reset();	
}

ObjectSearcher.prototype.firstPage = function() {
	this.objectSearcher.getDataTable().getPaginator().first();
}

ObjectSearcher.prototype.previousPage = function() {
	this.objectSearcher.getDataTable().getPaginator().previous();	
}

ObjectSearcher.prototype.nextPage = function() {
	this.objectSearcher.getDataTable().getPaginator().next();	
}

ObjectSearcher.prototype.lastPage = function() {
	this.objectSearcher.getDataTable().getPaginator().last();	
}

/***************************************************************************************
                               VIEW DATA
***************************************************************************************/

function ViewData(lastProcessedDate, queryString, datatable, hasCorruptObjects, corruptObjectsViewerURI)
{
	var data = {};
	data.lastProcessedDate = lastProcessedDate;
	data.queryString = queryString;	
	data.datatable = datatable;
	data.hasCorruptObjects = hasCorruptObjects;
	data.corruptObjectsViewerURI = corruptObjectsViewerURI;
	return data;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message