Hi moktc,
Its been quite a while since I left this application: I will paste it as is - leaving you to take what you want
notification.xhtml
Code: Select all
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:i="http://primefaces.prime.com.tr/touch"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:vb="http://java.sun.com/jsf/composite/components/form">
<ui:decorate template="/WEB-INF/templates/t_view.xhtml">
<ui:param name="viewId" value="policyNotification" />
<ui:param name="viewTitle" value="#{msgs['policy.notification.title']}" />
<ui:define name="leftNavBar">
<i:navBarControl label="#{msgs['button.back']}" view="policy" />
</ui:define>
<ui:define name="content">
<i:rowGroup title="#{msgs['settings']}">
<i:rowItem>
<vb:labelSelectBooleanCheckbox id="notificationEnabled" label="#{msgs['policy.notification.enabled']}"
value="#{policyBean.userPolicy.notificationEnabled}" />
</i:rowItem>
<i:rowItem>
<h:panelGrid columns="2" styleClass="full" columnClasses="nowrap,">
<h:outputLabel value="#{msgs['policy.notification.threshold']}:" for="notificationThreshold" />
<h:inputText id="notificationThreshold" value="#{policyBean.userPolicy.notificationThreshold}"
label="#{msgs['policy.notification.threshold']}">
<f:validateLongRange minimum="0" maximum="100" />
</h:inputText>
</h:panelGrid>
<center><p:slider id="notificationThresholdSlider" for="notificationThreshold" minValue="0" maxValue="100" /></center>
</i:rowItem>
</i:rowGroup>
<i:rowGroup title="#{msgs['policy.notification.method']}">
<i:rowItem>
<vb:labelInputText id="email" label="#{msgs['policy.notification.email']}" value="#{accountBean.email.address}" />
</i:rowItem>
<i:rowItem>
<vb:labelInputText id="sms" label="#{msgs['policy.notification.sms']}" value="#{accountBean.sms.localDirectory}" />
</i:rowItem>
</i:rowGroup>
<p:commandButton type="submit" value="#{msgs['button.update']}" styleClass="whiteButton"
actionListener="#{accountBean.updateAccount}" update="@form,policy_form:settings" />
</ui:define>
</ui:decorate>
</f:view>
As you can see - I've implemented some custom components for "label and checkbox", "label and input text" etc. These are listed below:
labelSelectBooleanCheckbox.xhtml:
Code: Select all
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="label" required="true" />
<composite:attribute name="value" required="true" />
<composite:attribute name="readonly" required="false" />
<composite:attribute name="required" required="false" />
<composite:editableValueHolder name="checkbox" />
</composite:interface>
<composite:implementation>
<h:panelGrid columns="2" styleClass="full" columnClasses="nowrap,">
<h:outputLabel id="label" value="#{cc.attrs.label}:" for="checkbox" />
<h:selectBooleanCheckbox id="checkbox" label="#{cc.attrs.label}" value="#{cc.attrs.value}" readonly="#{cc.attrs.readonly}"
required="#{cc.attrs.required}" />
</h:panelGrid>
</composite:implementation>
</f:view>
labelInputText.xhtml
Code: Select all
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="label" required="true" />
<composite:attribute name="waterMarkLabel" required="false" />
<composite:attribute name="value" required="true" />
<composite:attribute name="required" required="false" />
<composite:attribute name="readonly" required="false" />
<composite:editableValueHolder name="input" />
</composite:interface>
<composite:implementation>
<h:panelGrid columns="2" styleClass="full" columnClasses="nowrap,">
<h:outputLabel id="label" value="#{cc.attrs.label}:" for="input" />
<h:inputText id="input" label="#{cc.attrs.label}" value="#{cc.attrs.value}" readonly="#{cc.attrs.readonly}"
required="#{cc.attrs.required}" />
<p:watermark for="input" value="#{cc.attrs.waterMarkLabel}" rendered="#{not empty cc.attrs.waterMarkLabel}" />
</h:panelGrid>
</composite:implementation>
</f:view>
Hope you can use it.
Regards,
Christian