You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/09/24 19:04:55 UTC
svn commit: r1000970 - in
/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp:
dataScrollerAjax.xhtml home.xhtml masterDetailAjax.xhtml sortTableAjax.xhtml
Author: lu4242
Date: Fri Sep 24 17:04:55 2010
New Revision: 1000970
URL: http://svn.apache.org/viewvc?rev=1000970&view=rev
Log:
remove dojo examples and add ajax examples for datatable and scroller
Added:
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/dataScrollerAjax.xhtml
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/masterDetailAjax.xhtml
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/sortTableAjax.xhtml
Modified:
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/home.xhtml
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/dataScrollerAjax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/dataScrollerAjax.xhtml?rev=1000970&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/dataScrollerAjax.xhtml (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/dataScrollerAjax.xhtml Fri Sep 24 17:04:55 2010
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:t="http://myfaces.apache.org/tomahawk">
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+//-->
+<body>
+ <ui:composition template="/META-INF/templates/template.xhtml">
+ <ui:define name="body">
+ <h:form id="mainForm">
+ <h:outputText value="Rows to show"/>
+ <h:inputText value="#{scrollerList.rowCount}" />
+ <h:commandButton value="set rowCount"/>
+
+ <h:panelGroup id="idbody">
+
+ <t:dataTable id="data"
+ styleClass="scrollerTable"
+ headerClass="standardTable_Header"
+ footerClass="standardTable_Header"
+ rowClasses="standardTable_Row1,standardTable_Row2"
+ columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
+ var="car"
+ value="#{scrollerList.list}"
+ preserveDataModel="false"
+ rows="#{scrollerList.rowCount}"
+ >
+ <h:column>
+ <f:facet name="header">
+ </f:facet>
+ <h:outputText value="#{car.id}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{example_messages['label_cars']}" />
+ </f:facet>
+ <h:outputText value="#{car.type}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{example_messages['label_color']}" />
+ </f:facet>
+ <h:outputText value="#{car.color}" />
+ </h:column>
+
+ </t:dataTable>
+
+ <h:panelGrid columns="1" styleClass="scrollerTable2" columnClasses="standardTable_ColumnCentered" >
+ <t:dataScroller id="scroll_1"
+ for="data"
+ fastStep="10"
+ pageCountVar="pageCount"
+ pageIndexVar="pageIndex"
+ styleClass="scroller"
+ paginator="true"
+ paginatorMaxPages="9"
+ paginatorTableClass="paginator"
+ paginatorActiveColumnStyle="font-weight:bold;"
+ immediate="true"
+ actionListener="#{scrollerList.scrollerAction}"
+ >
+ <f:ajax execute="scroll_1 scroll_2 data" render="scroll_1 scroll_2 data"/>
+ <f:facet name="first" >
+ <t:graphicImage url="images/arrow-first.gif" border="1" />
+ </f:facet>
+ <f:facet name="last">
+ <t:graphicImage url="images/arrow-last.gif" border="1" />
+ </f:facet>
+ <f:facet name="previous">
+ <t:graphicImage url="images/arrow-previous.gif" border="1" />
+ </f:facet>
+ <f:facet name="next">
+ <t:graphicImage url="images/arrow-next.gif" border="1" />
+ </f:facet>
+ <f:facet name="fastforward">
+ <t:graphicImage url="images/arrow-ff.gif" border="1" />
+ </f:facet>
+ <f:facet name="fastrewind">
+ <t:graphicImage url="images/arrow-fr.gif" border="1" />
+ </f:facet>
+ </t:dataScroller>
+ <t:dataScroller id="scroll_2"
+ for="data"
+ rowsCountVar="rowsCount"
+ displayedRowsCountVar="displayedRowsCountVar"
+ firstRowIndexVar="firstRowIndex"
+ lastRowIndexVar="lastRowIndex"
+ pageCountVar="pageCount"
+ immediate="true"
+ pageIndexVar="pageIndex"
+ >
+ <h:outputFormat value="#{example_messages['dataScroller_pages']}" styleClass="standard" >
+ <f:param value="#{rowsCount}" />
+ <f:param value="#{displayedRowsCountVar}" />
+ <f:param value="#{firstRowIndex}" />
+ <f:param value="#{lastRowIndex}" />
+ <f:param value="#{pageIndex}" />
+ <f:param value="#{pageCount}" />
+ </h:outputFormat>
+ </t:dataScroller>
+ </h:panelGrid>
+
+ </h:panelGroup>
+ <t:commandLink value="test" immediate="true" />
+
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</body>
+</html>
Modified: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/home.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/home.xhtml?rev=1000970&r1=1000969&r2=1000970&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/home.xhtml (original)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/home.xhtml Fri Sep 24 17:04:55 2010
@@ -40,8 +40,11 @@
<h:outputText value="Data Table"/>
<h:panelGrid style="padding-left:25px">
<h:outputLink value="masterDetail.jsf" ><f:verbatim>Master-Detail</f:verbatim></h:outputLink>
+ <h:outputLink value="masterDetailAjax.jsf" ><f:verbatim>Master-Detail with Ajax</f:verbatim></h:outputLink>
<h:outputLink value="dataScroller.jsf" ><f:verbatim>Data Scroller</f:verbatim></h:outputLink>
+ <h:outputLink value="dataScrollerAjax.jsf" ><f:verbatim>Data Scroller with Ajax</f:verbatim></h:outputLink>
<h:outputLink value="sortTable.jsf" ><f:verbatim>Sortable</f:verbatim></h:outputLink>
+ <h:outputLink value="sortTableAjax.jsf" ><f:verbatim>Sortable with Ajax</f:verbatim></h:outputLink>
<h:outputLink value="sortAutoTable.jsf" ><f:verbatim>Automatically sortable by all columns</f:verbatim></h:outputLink>
<h:outputLink value="sortAutoTable2.jsf" ><f:verbatim>Automatically sortable by choosen columns</f:verbatim></h:outputLink>
<h:outputLink value="pagedSortTable.jsf" ><f:verbatim>Paged and Sortable</f:verbatim></h:outputLink>
@@ -90,18 +93,6 @@
<h:outputLink value="collapsiblePanel.jsf" ><f:verbatim>Collapsible Panel</f:verbatim></h:outputLink>
<h:outputLink value="testExceptions.jsf" ><f:verbatim>Test the custom error page - not really jsf stuff, but a demonstration how to print the real exception</f:verbatim></h:outputLink>
<h:outputLink value="panelGroup.jsf" ><f:verbatim>Panel Group</f:verbatim></h:outputLink>
- <h:outputText value="Dojo Integration" />
- <h:panelGrid style="padding-left:25px">
- <h:outputLink value="dojo/dojoimporttest.jsf">
- <f:verbatim>Dojo Library Import via t:dojoInitializer</f:verbatim>
- </h:outputLink>
- <h:outputLink value="dojo/textareatestjsfonly.jsf">
- <f:verbatim>Simple Integration of the Dojo Toolkit example</f:verbatim>
- </h:outputLink>
- <h:outputLink value="dojo/debugconsolejsfonly.jsf">
- <f:verbatim>The dojo Debug Console</f:verbatim>
- </h:outputLink>
- </h:panelGrid>
<h:outputText value="Schedule" />
<h:panelGrid style="padding-left:25px">
<h:outputLink value="schedule1.jsf">
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/masterDetailAjax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/masterDetailAjax.xhtml?rev=1000970&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/masterDetailAjax.xhtml (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/masterDetailAjax.xhtml Fri Sep 24 17:04:55 2010
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:t="http://myfaces.apache.org/tomahawk">
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+//-->
+<body>
+ <ui:composition template="/META-INF/templates/template.xhtml">
+ <ui:define name="body">
+<h:form>
+<h:panelGroup id="idbody">
+
+<h:panelGrid columns="1">
+ <h:commandLink action="go_country" immediate="true">
+ <h:outputText value="#{example_messages['new_country']}" styleClass="standard"/>
+ </h:commandLink>
+ <h:commandLink action="go_edit_table" immediate="true">
+ <h:outputText value="#{example_messages['country_edit_table']}" styleClass="standard"/>
+ </h:commandLink>
+</h:panelGrid>
+
+ <p>
+ A table rendering the details using an independent table within an cell of the master table.<br/>
+ As a resulting effect the each child table will have its own cell width.
+ </p>
+
+ <t:dataTable id="data" styleClass="standardTable" headerClass="standardTable_Header" footerClass="standardTable_Header"
+ rowClasses="standardTable_Row1,standardTable_Row2"
+ columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column" var="currentCountry"
+ value="#{countryList.countries}" preserveDataModel="true" varDetailToggler="detailToggler">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{example_messages['label_country_name']}"/>
+ </f:facet>
+ <t:commandLink action="go_country" immediate="true">
+ <h:outputText value="#{currentCountry.name}"/>
+ <!-- for convenience: MyFaces extension. sets id of current row in countryForm -->
+ <!-- you don't have to implement a custom action! -->
+ <t:updateActionListener property="#{countryForm.id}" value="#{currentCountry.id}"/>
+ </t:commandLink>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{example_messages['label_country_iso']}"/>
+ </f:facet>
+ <h:outputText value="#{currentCountry.isoCode}"/>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{example_messages['label_country_cities']}"/>
+ </f:facet>
+ <t:div id="panel">
+ <h:commandLink rendered="#{detailToggler.currentDetailExpanded}" action="#{detailToggler.toggleDetail}">
+ <h:outputText value="Hide"/>
+ <f:ajax render="panel detailStampRow"/>
+ </h:commandLink>
+ <h:commandLink rendered="#{!detailToggler.currentDetailExpanded}" action="#{detailToggler.toggleDetail}">
+ <h:outputText value="Show"/>
+ <f:ajax render="panel detailStampRow"/>
+ </h:commandLink>
+ </t:div>
+ </h:column>
+ <f:facet name="detailStamp">
+ <t:dataTable id="cities" styleClass="standardTable_Column" var="city" value="#{currentCountry.cities}">
+ <h:column>
+ <h:outputText value="#{city}" style="font-size: 11px"/>
+ </h:column>
+ <h:column>
+ <h:selectBooleanCheckbox id="selcity" value="#{city.selected}" onclick="this.blur();">
+ <f:ajax/>
+ </h:selectBooleanCheckbox>
+ </h:column>
+ <h:column>
+ <h:commandLink action="#{city.unselect}" value="Unselect">
+ <f:ajax execute="@this" render="cities"></f:ajax>
+ </h:commandLink>
+ </h:column>
+ </t:dataTable>
+ </f:facet>
+</t:dataTable>
+
+ <p>
+ A table rendering the details using an "embedded" table. (embedded="true" at the child datatable).
+ In contrast to the above example this will result in a combined table sharing the same layout.
+ All cells in on collumn will have the same width.<br />
+ To achive this the child table will not renter a table start/end tag and, also the rendering of
+ any thead/tfoot/th will be supressed. You have to take care about that fact in your stylesheet(s).
+ </p>
+
+
+</h:panelGroup>
+
+</h:form>
+ </ui:define>
+ </ui:composition>
+</body>
+</html>
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/sortTableAjax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/sortTableAjax.xhtml?rev=1000970&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/sortTableAjax.xhtml (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/sortTableAjax.xhtml Fri Sep 24 17:04:55 2010
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:t="http://myfaces.apache.org/tomahawk">
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+//-->
+<body>
+ <ui:composition template="/META-INF/templates/template.xhtml">
+ <ui:define name="body">
+ <h:form id="mainForm">
+ <t:dataTable id="data"
+ styleClass="standardTable"
+ headerClass="standardTable_SortHeader"
+ footerClass="standardTable_Footer"
+ rowClasses="standardTable_Row1,standardTable_Row2"
+ var="car"
+ value="#{list.cars}"
+ sortColumn="#{list.sort}"
+ sortAscending="#{list.ascending}"
+ preserveDataModel="true"
+ preserveSort="true">
+
+ <f:facet name="header">
+ <h:outputText value="(header table)" />
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="(footer table)" />
+ </f:facet>
+
+ <h:column>
+ <f:facet name="header">
+ <t:commandSortHeader columnName="type" arrow="true">
+ <f:ajax render="data"/>
+ <h:outputText value="#{example_messages['sort_cartype']}" />
+ </t:commandSortHeader>
+ </f:facet>
+ <h:outputText value="#{car.type}" />
+ <f:facet name="footer">
+ <h:outputText id="ftr1" value="(footer col1)" />
+ </f:facet>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <t:commandSortHeader columnName="color" arrow="true">
+ <f:ajax render="data"/>
+ <h:outputText value="#{example_messages['sort_carcolor']}" />
+ </t:commandSortHeader>
+ </f:facet>
+ <h:outputText value="#{car.color}" />
+ <f:facet name="footer">
+ <h:outputText id="ftr2" value="(footer col2)" />
+ </f:facet>
+ </h:column>
+
+ </t:dataTable>
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</body>
+</html>