Adding errors to be handled. Organizing error handling.
[mkjsf-moved-to-github.git] / src / META-INF / resources / pz2utils / pz2watch.xhtml
1 <?xml version="1.0" encoding="UTF-8" ?>\r
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
3 <h:html xmlns="http://www.w3.org/1999/xhtml"\r
4       xmlns:f="http://java.sun.com/jsf/core"\r
5       xmlns:h="http://java.sun.com/jsf/html"\r
6       xmlns:ui="http://java.sun.com/jsf/facelets"\r
7       xmlns:cc="http://java.sun.com/jsf/composite">\r
8 \r
9 <head>\r
10 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
11 </head>\r
12 <body>\r
13 \r
14   <cc:interface>\r
15     <cc:attribute name="renderWhileActiveclients"/>\r
16     <cc:attribute name="trackHistory"/>\r
17     <cc:attribute name="renderOnHitoryChange"/> \r
18     <cc:attribute name="debug"/>   \r
19   </cc:interface>\r
20 \r
21   <cc:implementation>\r
22     <h:outputScript name="jsf.js" library="javax.faces" target="head" />\r
23     <h:outputScript name="fieldlisteners.js" library="pz2utils" target="head" />\r
24     \r
25     <!-- Initiate Ajax update listeners -->  \r
26     <script>\r
27      //<![CDATA[\r
28        var renderWhileActiveclients = "${cc.attrs.renderWhileActiveclients}";\r
29        var renderOnHistoryChange = "${cc.attrs.renderOnHistoryChange}";\r
30        var trackHistory = ("${cc.attrs.trackHistory}" == "true");  \r
31        setUpListeners();\r
32      //]]>\r
33     </script>  \r
34 \r
35     <h:form id="activeclientsForm" prependId="false">\r
36       <h:outputText id="activeClientsLabel" value="Active clients: " style="${cc.attrs.debug == 'true' ? '' : 'display:none;'}"/> \r
37       <h:outputText id="activeclientsField" value="${pz2.update()}"  style="${cc.attrs.debug == 'true' ? '' : 'display:none;'}"/>\r
38       <h:panelGrid id="errorMessages" style="${pz2.hasErrors() ? 'display: block;' : 'display: none;'}">\r
39         <h:dataTable value="#{pz2.configurationErrors}" var="error" cellspace="0" cellpadding="0" style="${pz2.hasConfigurationErrors() ? 'display: block; vertical-align: top;' : 'display: none;'}">\r
40           <h:column valign="top">\r
41             <h:outputText value="#{error.message}" style="color: red;"/>\r
42             <h:dataTable value="#{error.suggestions}" var="suggestion" cellspacing="0" cellpadding="0">\r
43              <h:column>\r
44                #{suggestion}        \r
45              </h:column>      \r
46             </h:dataTable>                                        \r
47           </h:column>\r
48         </h:dataTable>\r
49         <h:panelGrid  style="${pz2.hasCommandErrors() ? 'display: block;' : 'display: none;'}">\r
50           <h:column>\r
51             <h:outputText id="messages" value="#{pz2.commandError.message}" style="color: red;"/>\r
52           </h:column>\r
53           <h:dataTable value="#{pz2.commandError.suggestions}" var="suggestion" cellspacing="0" cellpadding="0">                  \r
54            <h:column>\r
55              #{suggestion}        \r
56            </h:column>      \r
57           </h:dataTable>\r
58         </h:panelGrid>                \r
59       </h:panelGrid>                      \r
60     </h:form>\r
61 \r
62     <h:form id="stateForm" prependId="false" rendered="${cc.attrs.trackHistory == 'true'}" style="${cc.attrs.debug == 'true' ? '' : 'display:none;'}">\r
63       State: \r
64       <h:inputText id="windowlocationhash" value="#{pz2.currentStateKey}" size="100">\r
65         <f:ajax event="change" render="#{cc.attrs.renderOnHistoryChange} #{pz2watch.activeclients}"/>\r
66       </h:inputText>\r
67     </h:form>\r
68   </cc:implementation>\r
69   \r
70 </body>\r
71 </h:html>