Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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:h="http://java.sun.com/jsf/html"
- xmlns:composite="http://java.sun.com/jsf/composite"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:fn="http://java.sun.com/jsp/jstl/functions"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
- <head>
- <title>Not present in rendered output</title>
- </head>
- <h:body>
- <composite:interface>
- <composite:attribute name="visibleFieldValue" required="true" />
- <composite:attribute name="hiddenFieldValue" required="true" />
- <composite:clientBehavior name="changeLocation" event="change" targets="visibleId"/>
- </composite:interface>
- <composite:implementation>
- <script type="text/javascript">
- /* <![CDATA[ */
- function locationSet(id, name, fieldId, fieldName) {
- fieldName.value = name;
- fieldId.value = id;
- }
- function launchEvent(fieldName) {
- if ("fireEvent" in fieldName) {
- fieldName.fireEvent("onchange");
- } else {
- var evt = document.createEvent("HTMLEvents");
- evt.initEvent("change", false, true);
- fieldName.dispatchEvent(evt);
- }
- }
- function locationSelected(id, name, fieldId, fieldName) {
- locationSet(id, name, fieldId, fieldName);
- #{rich:component('popUpPnl')}.hide();
- launchEvent(fieldName);
- }
- function locationCleared(fieldId, fieldName) {
- locationSet('', '', fieldId, fieldName);
- launchEvent(fieldName);
- }
- /* ]]> */
- </script>
- <div id="#{cc.clientId}">
- <h:inputText id="visibleId" value="#{cc.attrs.visibleFieldValue}"
- readonly="true"
- onfocus="#{rich:component('popUpPnl')}.show('', {top:'100px', left:'250px'});"/>
- <h:inputHidden id="hiddenId" value="#{cc.attrs.hiddenFieldValue}"
- converter="es.caib.gesma.gesman.data.converter.LocationConverter" />
- <h:commandButton id="deleteButton"
- image="/resources/images/icons/textfield_delete.png" alt="Borrar"
- onclick="javascript:locationCleared(document.getElementById('#{cc.clientId}:hiddenId'), document.getElementById('#{cc.clientId}:visibleId'));return false;" />
- <rich:popupPanel modal="true" id="popUpPnl" autosized="false"
- minWidth="300" minHeight="500">
- <f:facet name="header">
- <h:outputText value="Doble click para seleccionar un valor" />
- </f:facet>
- <f:facet name="controls">
- <h:graphicImage value="/resources/images/icons/cancel.png"
- style="cursor:pointer"
- onclick="#{rich:component('popUpPnl')}.hide()" alt="Cerrar" />
- </f:facet>
- <rich:tree toggleType="ajax" var="item" >
- <rich:treeModelRecursiveAdaptor roots="#{masters.rootLocations}"
- nodes="#{item.divisions}">
- <rich:treeNode id="locNode"
- ondblclick="javascript:locationSelected('#{item.id}','#{item.description}',document.getElementById('#{cc.clientId}:hiddenId'), document.getElementById('#{cc.clientId}:visibleId'));">
- #{item.name}
- </rich:treeNode>
- </rich:treeModelRecursiveAdaptor>
- </rich:tree>
- </rich:popupPanel>
- </div>
- </composite:implementation>
- </h:body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement