You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/05/27 07:17:11 UTC

svn commit: r948672 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/component/ example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/ example/demo/src/main/webapp/overview/ example/demo/src/...

Author: lofwyr
Date: Thu May 27 05:17:10 2010
New Revision: 948672

URL: http://svn.apache.org/viewvc?rev=948672&view=rev
Log:
TOBAGO-885: Add possibility to reset the column sizes of a sheet.

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/overview/sheet.jsp
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=948672&r1=948671&r2=948672&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Thu May 27 05:17:10 2010
@@ -19,22 +19,6 @@ package org.apache.myfaces.tobago.compon
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FIRST;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTED_LIST_STRING;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DIRECT_LINKS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_HEADER;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_PAGE_RANGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROW_RANGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST_STRING;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_RELOAD;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
 import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 import org.apache.myfaces.tobago.ajax.api.AjaxPhaseListener;
 import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
@@ -67,6 +51,23 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FIRST;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTED_LIST_STRING;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DIRECT_LINKS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_HEADER;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_PAGE_RANGE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROW_RANGE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST_STRING;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_RELOAD;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
+
 public class UIData extends javax.faces.component.UIData
     implements SheetStateChangeSource, SortActionSource, AjaxComponent {
 
@@ -101,6 +102,14 @@ public class UIData extends javax.faces.
 
   private transient LayoutTokens columnLayout;
 
+  public void resetColumnWidths(FacesContext facesContext) {
+    SheetState state = getSheetState(facesContext);
+    if (state != null) {
+      state.setColumnWidths(null);
+    }
+    getAttributes().remove(ATTR_WIDTH_LIST_STRING);
+  }
+
   public void encodeBegin(FacesContext facesContext) throws IOException {
     UILayout.prepareDimension(facesContext, this);
     SheetState state = getSheetState(facesContext);

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.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/overview/OverviewController.java?rev=948672&r1=948671&r2=948672&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Thu May 27 05:17:10 2010
@@ -24,17 +24,17 @@ import org.apache.myfaces.tobago.context
 import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 import org.apache.myfaces.tobago.event.SortActionEvent;
 import org.apache.myfaces.tobago.event.TabChangeEvent;
-import org.apache.myfaces.tobago.example.demo.model.solar.SolarObject;
 import org.apache.myfaces.tobago.example.demo.model.Salutation;
+import org.apache.myfaces.tobago.example.demo.model.solar.SolarObject;
 import org.apache.myfaces.tobago.model.SheetState;
 import org.apache.myfaces.tobago.taglib.component.ToolBarTag;
 
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.event.ActionEvent;
 import javax.faces.model.SelectItem;
-import javax.faces.component.UIComponent;
 import javax.faces.validator.ValidatorException;
-import javax.faces.application.FacesMessage;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -160,6 +160,11 @@ public class OverviewController {
     lastAction = actionEvent.getComponent().getId();
   }
 
+  public void resetColumnWidths(ActionEvent event) {
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    final UIData sheet = (UIData) event.getComponent().findComponent("sheet");
+    sheet.resetColumnWidths(facesContext);
+  }
 
   public void sheetSorter(ActionEvent event) {
     if (event instanceof SortActionEvent) {

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=948672&r1=948671&r2=948672&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 Thu May 27 05:17:10 2010
@@ -27,6 +27,8 @@
       </f:facet>
       <f:facet name="toolBar">
         <tc:toolBar>
+          <tc:toolBarCommand label="Reset" tip="#{overviewBundle.sheet_resetTip}"
+                             actionListener="#{overviewController.resetColumnWidths}" />
           <tc:toolBarCommand label="#" tip="#{overviewBundle.sheet_configTip}">
             <tc:attribute name="renderedPartially" value="sheetConfigPopup"/>
             <f:facet name="popup">

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=948672&r1=948671&r2=948672&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Thu May 27 05:17:10 2010
@@ -135,6 +135,7 @@
     drag and drop the column border.
     &lt;/ul&gt;
 </entry>
+<entry key="sheet_resetTip">Reset the modified widths of the columns in the sheet.</entry>
 <entry key="sheet_configTip">Click here to edit display attributes of the sheet.</entry>
 <entry key="sheet_configTitle">Sheet configuration</entry>
 
@@ -354,4 +355,4 @@
 &lt;/tobago-config&gt;
 ...</entry>
 
-</properties>
\ No newline at end of file
+</properties>

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml?rev=948672&r1=948671&r2=948672&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml Thu May 27 05:17:10 2010
@@ -97,6 +97,7 @@
 <!--  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_resetTip">Hier klicken um den Orginalzustand der Spaltenbreiten wiederherzustellen.</entry>
   <entry key="sheet_configTip">Hier klicken zum Einstellen der Tabellenkonfiguration.</entry>
   <entry key="sheet_configTitle">Tabelle konfigurieren</entry>