myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r931272 - in /myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main: java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java webapp/overview/sheet.jsp
Date Tue, 06 Apr 2010 18:54:08 GMT
Author: weber
Date: Tue Apr  6 18:54:08 2010
New Revision: 931272

URL: http://svn.apache.org/viewvc?rev=931272&view=rev
Log:
(TOBAGO-869) Command facet on tc:panel
<https://issues.apache.org/jira/browse/TOBAGO-869>

Demo: add example usecase

Modified:
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java?rev=931272&r1=931271&r2=931272&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
Tue Apr  6 18:54:08 2010
@@ -562,6 +562,30 @@ public class TobagoDemoController {
   private SelectItem[] orbitItems;
   private static final String SHOW_ALL_ORBITS = "Show all";
 
+  public void selectOrbit(ActionEvent event) {
+    SolarObject clicked = (SolarObject) ComponentUtil.findParameter(event.getComponent(),
"luminary");
+    boolean add = false;
+    List<Integer> selectedRows = sheetState.getSelectedRows();
+    for (int i = 0, solarListSize = solarList.size(); i < solarListSize; i++) {
+      if (clicked.getOrbit().equals(solarList.get(i).getOrbit())) {
+        add = !selectedRows.contains(i);
+        LOG.info(" add = " + add);
+        LOG.info(" i = " + i);
+        break;
+      }
+    }
+
+    for (int i = 0, solarListSize = solarList.size(); i < solarListSize; i++) {
+      if (clicked.getOrbit().equals(solarList.get(i).getOrbit())) {
+        if (add && !selectedRows.contains(i)) {
+          selectedRows.add(i);
+        } else {
+          selectedRows.remove((Object) i);
+        }
+      }
+    }
+  }
+  
   public void filterOrbit(ActionEvent event) {
     UISelectOne selectOne = (UISelectOne) event.getComponent().getFacet(FACET_ITEMS);
     if (filteredList == null) {

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp?rev=931272&r1=931271&r2=931272&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp Tue
Apr  6 18:54:08 2010
@@ -142,7 +142,15 @@
               </tx:menuRadio>
             </tc:menu>
           </f:facet>
-          <tc:out value="#{luminary.orbit}" id="t_orbit"/>
+          <tc:panel>
+            <f:facet name="click">
+              <tc:command actionListener="#{demo.selectOrbit}" >
+                <f:param value="#{luminary}" name="luminary"/>
+                <tc:attribute name="renderedPartially" value="sheet"/>
+              </tc:command>
+            </f:facet>
+            <tc:out value="#{luminary.orbit}" id="t_orbit"/>            
+          </tc:panel>
         </tc:column>
         <tc:column label="#{overviewBundle.solarArrayPopulation}" sortable="true" id="population">
           <tc:in value="#{luminary.population}" id="t_population"/>



Mime
View raw message