Author: ilya_shaikovsky
Date: 2008-09-12 10:18:18 -0400 (Fri, 12 Sep 2008)
New Revision: 10437
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/editDataTable.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/editTable.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable.xhtml
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
Log:
dataTable vs modalPanel example
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-09-12
14:02:57 UTC (rev 10436)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-09-12
14:18:18 UTC (rev 10437)
@@ -6,10 +6,14 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import java.util.Set;
+import javax.faces.context.FacesContext;
+
import org.richfaces.component.UIScrollableDataTable;
import org.richfaces.demo.datafilterslider.DemoInventoryItem;
import org.richfaces.model.SortField;
@@ -22,6 +26,13 @@
*
*/
public class DataTableScrollerBean {
+
+ private DemoInventoryItem currentItem = new DemoInventoryItem();
+
+ private Set<Integer> keys = new HashSet<Integer>();
+
+ private int currentRow;
+
private SimpleSelection selection = new SimpleSelection();
private UIScrollableDataTable table;
@@ -268,5 +279,39 @@
public void setOrder(SortOrder order) {
this.order = order;
}
+
+ public DemoInventoryItem getCurrentItem() {
+ return currentItem;
+ }
+
+ public void setCurrentItem(DemoInventoryItem currentItem) {
+ this.currentItem = currentItem;
+ }
+
+ public int getCurrentRow() {
+ return currentRow;
+ }
+
+ public void setCurrentRow(int currentRow) {
+ this.currentRow = currentRow;
+ }
+
+ public void store() {
+ allCars.set(currentRow, currentItem);
+ keys.clear();
+ keys.add(currentRow);
+ }
+
+ public void delete() {
+ allCars.remove(currentRow);
+ }
+
+ public Set<Integer> getKeys() {
+ return keys;
+ }
+
+ public void setKeys(Set<Integer> keys) {
+ this.keys = keys;
+ }
}
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/editDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/editDataTable.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/editDataTable.xhtml 2008-09-12
14:18:18 UTC (rev 10437)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+
+
+ <p>
+ In this example you could see two basic and frequently asked use-cases
+ implemented. TBD description.
+ </p>
+
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">DataTable Column/ColumnGroup
example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/dataTable/examples/editTable.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/dataTable/examples/editTable.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ </ui:define>
+
+ </ui:composition>
+</html>
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/editTable.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/editTable.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/editTable.xhtml 2008-09-12
14:18:18 UTC (rev 10437)
@@ -0,0 +1,133 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <h:form>
+ <rich:dataTable value="#{dataTableScrollerBean.allCars}"
+ var="category" rows="20" rowKeyVar="row"
+ ajaxKeys="#{dataTableScrollerBean.keys}" id="table">
+ <f:facet name="header">
+ <h:outputText value="Cars Store"/>
+ </f:facet>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Make" />
+ </f:facet>
+ <h:outputText value="#{category.make}" id="make" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{category.model}" id="model" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{category.price}" id="price" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Mileage" />
+ </f:facet>
+ <h:outputText value="#{category.mileage}" />
+ </rich:column>
+ <rich:column width="200px">
+ <f:facet name="header">
+ <h:outputText value="VIN" />
+ </f:facet>
+ <h:outputText value="#{category.vin}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Stock" />
+ </f:facet>
+ <h:outputText value="#{category.stock}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ Actions
+ </f:facet>
+ <a4j:commandLink ajaxSingle="true" id="editlink"
+ oncomplete="#{rich:component('editPanel')}.show()">
+ <h:graphicImage value="/images/icons/edit.gif"
style="border:0"/>
+ <f:setPropertyActionListener value="#{category}"
+ target="#{dataTableScrollerBean.currentItem}" />
+ <f:setPropertyActionListener value="#{row}"
+ target="#{dataTableScrollerBean.currentRow}" />
+ <rich:toolTip value="Edit"></rich:toolTip>
+ </a4j:commandLink>
+ <a4j:commandLink ajaxSingle="true" id="deletelink"
+ oncomplete="#{rich:component('deletePanel')}.show()">
+ <h:graphicImage value="/images/icons/delete.gif"
style="border:0"/>
+ <f:setPropertyActionListener value="#{row}"
+ target="#{dataTableScrollerBean.currentRow}" />
+ <rich:toolTip value="Delete"></rich:toolTip>
+ </a4j:commandLink>
+ </rich:column>
+ <f:facet name="footer">
+ <rich:datascroller renderIfSinglePage="false"
maxPages="5"/>
+ </f:facet>
+ </rich:dataTable>
+ </h:form>
+
+ <rich:modalPanel id="editPanel" autosized="true">
+ <f:facet name="header">
+ <h:outputText value="Edit Current Car" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png"
+ style="cursor:pointer" id="hidelink" />
+ <rich:componentControl for="editPanel" attachTo="hidelink"
+ operation="hide" event="onclick" />
+ </h:panelGroup>
+ </f:facet>
+ <h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:panelGrid columns="2">
+ <h:outputText value="Make" />
+ <h:inputText value="#{dataTableScrollerBean.currentItem.make}" />
+ <h:outputText value="Model" />
+ <h:inputText value="#{dataTableScrollerBean.currentItem.model}" />
+ <h:outputText value="Price" />
+ <h:inputText value="#{dataTableScrollerBean.currentItem.price}" />
+ </h:panelGrid>
+ </a4j:outputPanel>
+ <a4j:commandButton value="Store"
+ action="#{dataTableScrollerBean.store}"
+ reRender="make, model, price"
+ oncomplete="#{rich:component('editPanel')}.hide();" />
+ </h:form>
+ </rich:modalPanel>
+ <rich:modalPanel id="deletePanel" autosized="true">
+ <f:facet name="header">
+ <h:outputText value="Delete this car from list?"
+ style="padding-right:15px;" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png"
+ style="cursor:pointer" id="hidelink2" />
+ <rich:componentControl for="deletePanel" attachTo="hidelink2"
+ operation="hide" event="onclick" />
+ </h:panelGroup>
+ </f:facet>
+ <h:form>
+ <h:panelGrid columns="2" width="100%">
+ <a4j:commandButton value="Yes" ajaxSingle="true"
+ action="#{dataTableScrollerBean.delete}"
+ oncomplete="#{rich:component('deletePanel')}.hide();"
+ reRender="table" />
+ <a4j:commandButton value="Cancel"
+ onclick="#{rich:component('deletePanel')}.hide();return false;"
/>
+ </h:panelGrid>
+ </h:form>
+ </rich:modalPanel>
+ <rich:messages></rich:messages>
+</ui:composition>
+
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable.xhtml 2008-09-12
14:02:57 UTC (rev 10436)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable.xhtml 2008-09-12
14:18:18 UTC (rev 10437)
@@ -15,6 +15,9 @@
<rich:tab label="Extended Data Model" name="dataModel">
<ui:include src="/richfaces/dataTable/extended-data-model.xhtml"/>
</rich:tab>
+ <rich:tab label="Edit Table with ModalPanel"
name="editDataTable">
+ <ui:include src="/richfaces/dataTable/editDataTable.xhtml"/>
+ </rich:tab>
<rich:tab name="info" label="Tag Information">
<rich:insert
src="/WEB-INF/#{componentNavigator.currentComponent.tagInfoLocation}"
Modified: trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml 2008-09-12
14:02:57 UTC (rev 10436)
+++
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml 2008-09-12
14:18:18 UTC (rev 10437)
@@ -50,13 +50,13 @@
<a4j:outputPanel id="hide2" styleClass="viewsourcelooklink"
style="display:none">
<rich:effect for="hide2" event="onclick"
type="BlindUp" targetId="source1" params="id:'source1',
duration:1.0" />
<rich:effect for="hide2" event="onclick"
type="Appear" targetId="look" params="delay:1.5,
duration:0.5" />
- <rich:effect for="hide2" event="onclick" type="Fade"
targetId="hide2" params="delay:0.9, duration:0.1" />
+ <rich:effect for="hide2" event="onclick" type="Fade"
targetId="hide2" params="delay:0.0, duration:0.1" />
<h:outputText style="padding-right:5px" value="Hide"/>
</a4j:outputPanel>
<a4j:outputPanel styleClass="viewsourcelooklink" id="look">
<rich:effect for="look" event="onclick" type="Fade"
targetId="source1" params="duration:0.0" />
- <rich:effect for="look" event="onclick" type="Fade"
params="duration:0.1" />
+ <rich:effect for="look" event="onclick" type="Fade"
params="duration:0.0" />
<rich:effect for="look" event="onclick"
type="BlindDown" targetId="source1"
params="delay:0.1,duration:1.0,from:0.0,to:1.0" />
<rich:effect for="look" event="onclick"
type="Appear" targetId="source1"
params="delay:0.1,duration:0.5,from:0.0,to:1.0" />
<rich:effect for="look" event="onclick"
type="Appear" targetId="hide2"
params="delay:1.5,duration:1.0,from:0.0,to:1.0" />
@@ -75,7 +75,7 @@
<a4j:outputPanel id="hide" styleClass="viewsourcehidelink">
<rich:effect for="hide" event="onclick"
type="BlindUp" targetId="source1" params="id:'source1',
duration:1.0" />
<rich:effect for="hide" event="onclick"
type="Appear" targetId="look" params="delay:1.5,
duration:0.5" />
- <rich:effect for="hide" event="onclick" type="Fade"
targetId="hide2" params="delay:1.0, duration:0.1" />
+ <rich:effect for="hide" event="onclick" type="Fade"
targetId="hide2" params="delay:0.0, duration:0.1" />
<h:outputText style="padding-right:5px" value="<<Hide
Source"/>
</a4j:outputPanel>