blob: 3bf96829ced29bf2a0171bd9aa7aad378615fca8 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<ui:composition template="/main.xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns="http://www.w3.org/1999/xhtml">
<ui:param name="title" value="Partial Update (AJAX)"/>
<tc:panel id="parent">
<tc:out value="Demonstration and test of partial reload"/>
<tc:style file="content/50-partial/partial.css"/>
<tc:gridLayout columns="1fr 1fr">
<tc:box label="Left panel" id="left">
<tc:gridLayout rows="auto 1fr">
<tc:label value="Current seconds on server: "/>
<tc:out value="#{partialReloadController.currentDate}" markup="demoSeconds">
<f:convertDateTime pattern="ss:SSS"/>
</tc:out>
</tc:gridLayout>
</tc:box>
<tc:box label="Right panel" id="right">
<tc:gridLayout rows="auto 1fr">
<tc:label value="Current seconds on server: "/>
<tc:out value="#{partialReloadController.currentDate}" markup="demoSeconds">
<f:convertDateTime pattern="ss:SSS"/>
</tc:out>
</tc:gridLayout>
</tc:box>
</tc:gridLayout>
<tc:flowLayout>
<ul>
<li>Click on 'Reload Left' button to reload the left panel."</li>
<li>Click on 'Reload Right' button to reload the right panel."</li>
<li>Or select a option from the selectOneChoise control:"
<ul>
<li>Select 'Reload parent' to reload both panels parent container"</li>
<li>Select 'Reload both' to reload both panels in one request"</li>
<li>Select 'Goto prev' to navigate to previous page"</li>
<li>Select 'Goto next' to navigate to next page"</li>
</ul>
</li>
</ul>
</tc:flowLayout>
<tc:gridLayout columns="1fr 300px 1fr">
<tc:panel/>
<tc:gridLayout columns="1fr 1fr">
<tc:button label="Reload left" tip="Reload left side box"
action="#{partialReloadController.reload}">
<f:ajax render="left :page:header:headerInfo"/>
</tc:button>
<tc:button label="Reload right" tip="Reload right side box"
action="#{partialReloadController.reload}">
<f:ajax render="right :page:header:headerInfo"/>
</tc:button>
<tc:button label="Reload both" tip="Reload both boxes"
action="#{partialReloadController.reload}">
<f:ajax render="left right :page:header:headerInfo"/>
<tc:span column="2"/>
</tc:button>
<tc:button label="Reload full panel"
tip="Reload the full area inside the outer box"
action="#{partialReloadController.reload}">
<f:ajax render="parent :page:header:headerInfo"/>
<tc:span column="2"/>
</tc:button>
<tc:button label="Reload both (wait 3 s)"
tip="Reload both boxes, but the server has a delay of 3 seconds"
action="#{partialReloadController.waitAndReload3}">
<f:ajax render="left right :page:header:headerInfo"/>
<tc:span column="2"/>
</tc:button>
<tc:button label="Reload both (wait 7 s, timeout)"
tip="Reload both boxes, but the server has a delay of 7 seconds, this is more than the default timeout for AJAX"
action="#{partialReloadController.waitAndReload7}">
<f:ajax render="left right :page:header:headerInfo"/>
<tc:span column="2"/>
</tc:button>
<tc:panel id="navTest">
<tc:span column="2"/>
<tc:selectOneChoice fieldId="navSelect" value="#{partialReloadController.navigateActionValue}"
label="On Change">
<f:ajax execute="navTest"
render="navTest :page:header:headerInfo"
listener="#{partialReloadController.navigateAction}"/>
<f:selectItem itemLabel="Select action" itemValue=""/>
<f:selectItem itemLabel="Reload left" itemValue="left"/>
<f:selectItem itemLabel="Reload right" itemValue="right"/>
<f:selectItem itemLabel="Reload both" itemValue="both"/>
<f:selectItem itemLabel="Reload parent" itemValue="parent"/>
<f:selectItem itemLabel="Goto prev" itemValue="prev"/>
<f:selectItem itemLabel="Goto next" itemValue="next"/>
</tc:selectOneChoice>
</tc:panel>
<tc:button label="Error left" tip="Reload left side box, but an exception occures"
action="#{partialReloadController.error}">
<f:ajax render="left :page:header:headerInfo"/>
</tc:button>
<tc:button label="Error right" tip="Reload right side box, but an exception occures"
action="#{partialReloadController.error}">
<f:ajax render="right :page:header:headerInfo"/>
</tc:button>
</tc:gridLayout>
<tc:panel/>
</tc:gridLayout>
</tc:panel>
</ui:composition>