You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/01/19 23:49:19 UTC

svn commit: r370660 - in /incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/overview/ webapp/WEB-INF/ webapp/overview/ webapp/tobago-resource/html/standard/standard/property/

Author: weber
Date: Thu Jan 19 14:49:07 2006
New Revision: 370660

URL: http://svn.apache.org/viewcvs?rev=370660&view=rev
Log:
add configuration popup to sheet demo

Added:
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/SheetConfig.java
Modified:
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheetControl.jsp
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=370660&r1=370659&r2=370660&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Thu Jan 19 14:49:07 2006
@@ -19,19 +19,17 @@
  */
 package org.apache.myfaces.tobago.example.demo.overview;
 
-import org.apache.myfaces.tobago.context.ResourceManager;
-import org.apache.myfaces.tobago.context.ResourceManagerFactory;
-import org.apache.myfaces.tobago.model.TreeState;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.context.ResourceManager;
+import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.ActionEvent;
 import javax.faces.model.SelectItem;
-import javax.faces.component.UIComponent;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.ArrayList;
 
 public class OverviewController {
 
@@ -83,6 +81,8 @@
 
   private String lastAction;
 
+  private SheetConfig sheetConfig;
+
 // ///////////////////////////////////////////// constructor
 
   public OverviewController() {
@@ -92,6 +92,7 @@
     treeListboxSelectMode = TREELISTBOX_SELECT_MODE_KEYS[0];
     multiValue = new String[0];
     treeTabsState = new Integer(0);
+    sheetConfig = new SheetConfig();
   }
 
 // ///////////////////////////////////////////// action
@@ -235,7 +236,14 @@
     this.treeTabsState = treeTabsState;
   }
 
-  
+  public SheetConfig getSheetConfig() {
+    return sheetConfig;
+  }
+
+  public void setSheetConfig(SheetConfig sheetConfig) {
+    this.sheetConfig = sheetConfig;
+  }
+
   public List getInputSuggestItems(String prefix) {
     LOG.info("createing items for prefix :\"" + prefix + "\"");
     List li = new ArrayList();

Added: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/SheetConfig.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/SheetConfig.java?rev=370660&view=auto
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/SheetConfig.java (added)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/SheetConfig.java Thu Jan 19 14:49:07 2006
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * Created 19.01.2005 21:49:41.
+ * $Id:  $
+ */
+package org.apache.myfaces.tobago.example.demo.overview;
+
+import javax.faces.model.SelectItem;
+
+
+public class SheetConfig {
+
+  private static final String[] SHEET_PAGER_POSITION_KEYS = {
+    "none",
+    "left",
+    "center",
+    "right"
+  };
+
+
+
+  private boolean sheetShowHeader;
+  private int sheetPagingStart;
+  private int sheetPagingLength;
+  private int sheetDirectLinkCount;
+  private String sheetRowPagingPosition;
+  private String sheetDirectPagingPosition;
+  private String sheetPagePagingPosition;
+  private SelectItem[] sheetDirectLinkCountItems;
+  private SelectItem[] sheetPagingPositionItems;
+  private boolean sheetConfigPopup;
+
+  public SheetConfig() {
+    sheetPagingStart = 1;
+    sheetPagingLength = 7;
+    sheetDirectLinkCount = 5;
+    sheetDirectLinkCountItems = createSheetDirectLinkCountItems();
+    sheetShowHeader = true;
+    sheetRowPagingPosition = SHEET_PAGER_POSITION_KEYS[1];
+    sheetDirectPagingPosition = SHEET_PAGER_POSITION_KEYS[2];
+    sheetPagePagingPosition = SHEET_PAGER_POSITION_KEYS[3];
+    sheetPagingPositionItems = createSheetPagingPositionItems();
+  }
+
+
+  public String configSheet() {
+    sheetConfigPopup = ! sheetConfigPopup;
+    return null;
+  }
+
+  private SelectItem[] createSheetDirectLinkCountItems() {
+    int[] counts = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    SelectItem[] items = new SelectItem[counts.length];
+    for (int i = 0; i < counts.length; i++) {
+      items[i] = new SelectItem(counts[i], Integer.toString(counts[i]));
+    }
+    return items;
+  }
+
+
+
+  private SelectItem[] createSheetPagingPositionItems() {
+    SelectItem[] items = new SelectItem[SHEET_PAGER_POSITION_KEYS.length];
+
+    for (int i = 0; i < SHEET_PAGER_POSITION_KEYS.length; i++) {
+      items[i] = new SelectItem(SHEET_PAGER_POSITION_KEYS[i], SHEET_PAGER_POSITION_KEYS[i]);
+    }
+    return items;
+  }
+
+
+
+  public boolean isSheetShowHeader() {
+    return sheetShowHeader;
+  }
+
+  public void setSheetShowHeader(boolean sheetShowHeader) {
+    this.sheetShowHeader = sheetShowHeader;
+  }
+
+  public int getSheetPagingStart() {
+    return sheetPagingStart;
+  }
+
+  public int getSheetPagingLength() {
+    return sheetPagingLength;
+  }
+
+  public void setSheetPagingLength(int sheetPagingLength) {
+    this.sheetPagingLength = sheetPagingLength;
+  }
+
+  public int getSheetPagingStartValue() {
+    int value = getSheetPagingStart();
+    return (value - 1) < 0 ? 0 : value - 1;
+  }
+
+  public void setSheetPagingStart(int sheetPagingStart) {
+    this.sheetPagingStart = sheetPagingStart;
+  }
+
+  public boolean isSheetConfigPopup() {
+    return sheetConfigPopup;
+  }
+
+  public void setSheetConfigPopup(boolean sheetConfigPopup) {
+    this.sheetConfigPopup = sheetConfigPopup;
+  }
+
+  public int getSheetDirectLinkCount() {
+    return sheetDirectLinkCount;
+  }
+
+  public void setSheetDirectLinkCount(int sheetDirectLinkCount) {
+    this.sheetDirectLinkCount = sheetDirectLinkCount;
+  }
+
+  public SelectItem[] getSheetDirectLinkCountItems() {
+    return sheetDirectLinkCountItems;
+  }
+
+  public String getSheetRowPagingPosition() {
+    return sheetRowPagingPosition;
+  }
+
+  public void setSheetRowPagingPosition(String sheetRowPagingPosition) {
+    this.sheetRowPagingPosition = sheetRowPagingPosition;
+  }
+
+  public String getSheetDirectPagingPosition() {
+    return sheetDirectPagingPosition;
+  }
+
+  public void setSheetDirectPagingPosition(String sheetDirectPagingPosition) {
+    this.sheetDirectPagingPosition = sheetDirectPagingPosition;
+  }
+
+  public String getSheetPagePagingPosition() {
+    return sheetPagePagingPosition;
+  }
+
+  public void setSheetPagePagingPosition(String sheetPagePagingPosition) {
+    this.sheetPagePagingPosition = sheetPagePagingPosition;
+  }
+
+  public SelectItem[] getSheetPagingPositionItems() {
+    return sheetPagingPositionItems;
+  }
+}

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=370660&r1=370659&r2=370660&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml Thu Jan 19 14:49:07 2006
@@ -45,7 +45,10 @@
   <lifecycle>
     <phase-listener>
       org.apache.myfaces.tobago.example.demo.overview.SynchronizeNavigationPhaseListener
-    </phase-listener>    
+    </phase-listener>
+    <phase-listener>
+      org.apache.myfaces.tobago.util.DebugPhaseListener
+    </phase-listener>
   </lifecycle>
 
   <!-- miniHowto -->

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheetControl.jsp
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheetControl.jsp?rev=370660&r1=370659&r2=370660&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheetControl.jsp (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheetControl.jsp Thu Jan 19 14:49:07 2006
@@ -14,6 +14,7 @@
  *    limitations under the License.
 --%>
 <%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 
@@ -21,7 +22,7 @@
   <jsp:body>
     <tc:panel>
       <f:facet name="layout">
-        <tc:gridLayout rows="2*;4*" />
+        <tc:gridLayout rows="2*;3*" />
       </f:facet>
 
       <tc:out escape="false" value="#{overviewBundle.sheet_text}" />
@@ -30,12 +31,93 @@
         <f:facet name="layout">
           <tc:gridLayout />
         </f:facet>
+        <f:facet name="toolBar" >
+          <tc:toolBar >
+            <tc:toolBarCommand action="#{overviewController.sheetConfig.configSheet}"
+                               label="#"
+                               tip="#{overviewBundle.sheet_configTip}">
+              <f:facet name="popup" >
+                <tc:popup width="300" height="250"
+                    rendered="#{overviewController.sheetConfig.sheetConfigPopup}">
+                  <tc:box label="#{overviewBundle.sheet_configTitle}" >
+                    <f:facet name="layout">
+                      <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;1*;fixed"/>
+                    </f:facet>
+                    <tx:selectOneChoice label="showHeader"
+                        value="#{overviewController.sheetConfig.sheetShowHeader}"
+                        tip="TODO: show Header Text">
+                       <f:selectItem itemValue="#{true}" itemLabel="True" />
+                       <f:selectItem itemValue="#{false}" itemLabel="False" />
+                    </tx:selectOneChoice>
+                    <tx:in label="pagingStart"
+                      value="#{overviewController.sheetConfig.sheetPagingStart}"
+                        tip="TODO: paging Start Text" >
+                      <f:validateLongRange minimum="0" />
+                    </tx:in>
+                    <tx:in label="pagingLength"
+                      value="#{overviewController.sheetConfig.sheetPagingLength}"
+                        tip="TODO: paging Lenght Text" >
+                      <f:validateLongRange minimum="1" />
+                    </tx:in>
+
+                    <tx:selectOneChoice label="showRowRange"
+                      value="#{overviewController.sheetConfig.sheetRowPagingPosition}"
+                        tip="TODO: paging DirectLinkCount Text" >
+                      <f:selectItems value="#{overviewController.sheetConfig.sheetPagingPositionItems}" />
+                    </tx:selectOneChoice>
+
+                    <tx:selectOneChoice label="showPageRange"
+                      value="#{overviewController.sheetConfig.sheetPagePagingPosition}"
+                        tip="TODO: paging DirectLinkCount Text" >
+                      <f:selectItems value="#{overviewController.sheetConfig.sheetPagingPositionItems}" />
+                    </tx:selectOneChoice>
+
+                    <tx:selectOneChoice label="showDirectLinks"
+                      value="#{overviewController.sheetConfig.sheetDirectPagingPosition}"
+                        tip="TODO: paging DirectLinkCount Text" >
+                      <f:selectItems value="#{overviewController.sheetConfig.sheetPagingPositionItems}" />
+                    </tx:selectOneChoice>
+
+                    <tx:selectOneChoice label="directLinkCount"
+                      value="#{overviewController.sheetConfig.sheetDirectLinkCount}"
+                        tip="TODO: paging DirectLinkCount Text" >
+                      <f:selectItems value="#{overviewController.sheetConfig.sheetDirectLinkCountItems}" />
+                    </tx:selectOneChoice>
+
+                    <tc:cell />
+
+                    <tc:cell>
+                      <f:facet name="layout">
+                        <tc:gridLayout columns="100px;1*;100px"
+                            marginLeft="10px" marginRight="10px"/>
+                      </f:facet>
+                      <tc:button action="#{overviewController.sheetConfig.configSheet}"
+                                 immediate="true"
+                                 label="Cancel" />
+
+                      <tc:cell />
+                      <tc:button action="#{overviewController.sheetConfig.configSheet}"
+                                 label="Ok" />
+                    </tc:cell>
+
+                  </tc:box>
+                </tc:popup>
+              </f:facet>
+            </tc:toolBarCommand>
+          </tc:toolBar>
+        </f:facet>
 
         <tc:sheet value="#{demo.solarArray}" id="sheet"
             columns="3*;1*;3*;3*;3*;3*" var="luminary"
             state="#{demo.sheetState}"
-            showRowRange="left" showPageRange="right" showDirectLinks="center"
-            pagingLength="8" directLinkCount="5" stateChangeListener="#{demo.stateChangeListener}">
+            showHeader="#{overviewController.sheetConfig.sheetShowHeader}"
+            showRowRange="#{overviewController.sheetConfig.sheetRowPagingPosition}"
+            showPageRange="#{overviewController.sheetConfig.sheetPagePagingPosition}"
+            showDirectLinks="#{overviewController.sheetConfig.sheetDirectPagingPosition}"
+            pagingStart="#{overviewController.sheetConfig.sheetPagingStart}"
+            pagingLength="#{overviewController.sheetConfig.sheetPagingLength}"
+            directLinkCount="#{overviewController.sheetConfig.sheetDirectLinkCount}"
+            stateChangeListener="#{demo.stateChangeListener}">
           <tc:column label="#{overviewBundle.solarArrayName}" id="name" sortable="true">
             <tc:out value="#{luminary.name}" id="t_name" />
           </tc:column>

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=370660&r1=370659&r2=370660&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Thu Jan 19 14:49:07 2006
@@ -100,6 +100,8 @@
     drag and drop the column border.
     &lt;/ul&gt;
 </entry>
+<entry key="sheet_configTip">Click here to edit display attributes of the sheet.</entry>
+<entry key="sheet_configTitle">Sheet configuration</entry>
 
 <!--  tree -->
 <entry key="tree_sampleTitle">Tree Example's</entry>

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml?rev=370660&r1=370659&r2=370660&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml Thu Jan 19 14:49:07 2006
@@ -75,6 +75,8 @@
 <!--  sheet -->
   <entry key="sheet_sampleTitle">Tabellen Beispiel</entry>
   <entry key="sheet_text">Das Sheet-Control bietet eine einfache Möglichkeit tabellarische Daten darzustellen. Die wichtigsten Eigenschaften sind: &lt;ul style="margin-top: 2px;"&gt; &lt;li style="line-height: 130%;"&gt;Paging: Es wird nur ein Teil der Gesamtliste angezeigt.   Über die Pfeilknöpfe kann in der Liste navigiert werden.&lt;/li&gt; &lt;li style="line-height: 130%;"&gt;Sortierung: Durch Drücken auf die Spaltenüberschrift   kann die entsprechende Spalte sortiert werden.&lt;/li&gt; &lt;li style="line-height: 130%;"&gt;Inline-Editing: Es können bei Bedarf Werte   direkt in die Tabelle eingegeben werden.&lt;/li&gt; &lt;li style="line-height: 130%;"&gt;Die Spaltenbreite kann direkt mit der Maus   manipuliert werden.&lt;/li&gt; &lt;/ul&gt;</entry>
+  <entry key="sheet_configTip">Hier klicken zum Einstellen der Tabellenkonfiguration.</entry>
+  <entry key="sheet_configTitle">Tabelle konfigurieren</entry>
 
 <!--  tree -->
   <entry key="tree_sampleTitle">Baum Beispiel</entry>