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:47:36 UTC
svn commit: r948679 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/
tobago-example/tobago-example-demo...
Author: lofwyr
Date: Thu May 27 05:47:36 2010
New Revision: 948679
URL: http://svn.apache.org/viewvc?rev=948679&view=rev
Log:
TOBAGO-885: Add possibility to reset the column sizes of a sheet.
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=948679&r1=948678&r2=948679&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Thu May 27 05:47:36 2010
@@ -17,8 +17,6 @@ package org.apache.myfaces.tobago.intern
* limitations under the License.
*/
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.Attributes;
@@ -41,6 +39,8 @@ import org.apache.myfaces.tobago.layout.
import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutTokens;
import org.apache.myfaces.tobago.model.SheetState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
@@ -141,6 +141,17 @@ public abstract class AbstractUISheet ex
return columnLayout;
}
+ /**
+ * Remove the (by user) resized column widths. An application may provide a button to access it.
+ */
+ public void resetColumnWidths() {
+ SheetState state = getState();
+ if (state != null) {
+ state.setColumnWidths(null);
+ }
+ getAttributes().remove(Attributes.WIDTH_LIST_STRING);
+ }
+
public int getLast() {
int last = getFirst() + getRows();
return last < getRowCount() ? last : getRowCount();
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=948679&r1=948678&r2=948679&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Thu May 27 05:47:36 2010
@@ -17,8 +17,6 @@ package org.apache.myfaces.tobago.exampl
* limitations under the License.
*/
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.myfaces.tobago.component.UISheet;
import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.context.ResourceManager;
@@ -28,6 +26,8 @@ import org.apache.myfaces.tobago.example
import org.apache.myfaces.tobago.example.data.SolarObject;
import org.apache.myfaces.tobago.model.SelectItem;
import org.apache.myfaces.tobago.model.SheetState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
@@ -155,6 +155,14 @@ public class OverviewController {
lastAction = actionEvent.getComponent().getId();
}
+ public void resetColumnWidths(ActionEvent event) {
+ final UISheet sheet = (UISheet) event.getComponent().findComponent("sheet");
+ if (sheet != null) {
+ sheet.resetColumnWidths();
+ } else {
+ LOG.warn("Didn't find sheet component!");
+ }
+ }
public void sheetSorter(ActionEvent event) {
if (event instanceof SortActionEvent) {
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml?rev=948679&r1=948678&r2=948679&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml Thu May 27 05:47:36 2010
@@ -31,6 +31,8 @@
</f:facet>
<f:facet name="toolBar">
<tc:toolBar>
+ <tc:toolBarCommand label="#{overviewBundle.sheet_resetLabel}" tip="#{overviewBundle.sheet_resetTip}"
+ actionListener="#{overviewController.resetColumnWidths}" />
<tc:toolBarCommand label="#" tip="#{overviewBundle.sheet_configTip}">
<tc:attribute name="renderedPartially" value="sheetConfigPopup"/>
<f:facet name="popup">
@@ -115,9 +117,11 @@
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout columns="*;auto"/>
+ <tc:gridLayout columns="*;auto;auto"/>
</f:facet>
<tc:cell/>
+ <tc:button label="#{overviewBundle.sheet_resetLabel}" tip="#{overviewBundle.sheet_resetTip}"
+ actionListener="#{overviewController.resetColumnWidths}" />
<tc:button label="Sheet Configuration">
<tc:attribute name="renderedPartially" value="sheetConfigPopup"/>
<tc:popupReference for="sheetConfigPopup"/>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=948679&r1=948678&r2=948679&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Thu May 27 05:47:36 2010
@@ -136,6 +136,8 @@
drag and drop the column border.
</ul>
</entry>
+<entry key="sheet_resetLabel">Reset</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>
@@ -356,4 +358,4 @@
...</entry>
<entry key="theme_photo">Photo of the location</entry>
-</properties>
\ No newline at end of file
+</properties>
Modified: myfaces/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/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml?rev=948679&r1=948678&r2=948679&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml Thu May 27 05:47:36 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: <ul style="margin-top: 2px;"> <li style="line-height: 130%;">Paging: Es wird nur ein Teil der Gesamtliste angezeigt. Ãber die Pfeilknöpfe kann in der Liste navigiert werden.</li> <li style="line-height: 130%;">Sortierung: Durch Drücken auf die Spaltenüberschrift kann die entsprechende Spalte sortiert werden.</li> <li style="line-height: 130%;">Inline-Editing: Es können bei Bedarf Werte direkt in die Tabelle eingegeben werden.</li> <li style="line-height: 130%;">Die Spaltenbreite kann direkt mit der Maus manipuliert werden.</li> </ul></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>