Capturing bean properties of rich modelwindow(PoPupwindon) values into calling form.
ajaykadiyala Mar 4, 2010 2:27 AMCapturing bean properties of rich modelwindow(PoPupwindon) values into calling form.
Currenly I do not have fine tune up code.
Please suggeste to me how to achive a fine tune up code.
Req:Capturing bean properties of rich modelwindow(PoPupwindon) values into calling form.
1) PhoneType.xtml
<ui:include
src="/pages/sim/popupwindow/simModelWindow.xhtml" />
<h:panelGrid columns="2" cellspacing="0" styleClass="tbl-forms"
columnClasses="even,odd" width="100%">
<h:outputLabel value="#{msg.phoneName}" />
<h:panelGroup>
<h:inputText value="#{phoneInfo.phone.phonename}" id="simName"
size="28" maxlength="10" readonly="#{simInfo.readOnlyPK}"
styleClass="textfield">
</h:inputText>
<rich:message for="simName" />
</h:panelGroup>
<h:outputLabel value="#{msg.Sim}" />
<h:panelGroup>
<h:inputText
value="#{phoneInfo.phone.SimId}"
id="simId" size="28" maxlength="6" readonly="true" />
<a4j:commandLink value="link" id="deviceModel" reRender="xx"
action="#{simInfo.getAllSims}"
oncomplete="#{rich:component('simModelWindow')}.show()">
</a4j:commandLink>
// When user clicks on link,it's open a modelpopwindow and loads the all sim info rich:extendable table
<rich:message for="simId" />
</h:panelGroup>
</h:panelGrid>
2) simModelWindow.xhtml
<f:subview id="subviewSimInfo">
<rich:modalPanel id="simModelWindow" autosized="false" keepVisualState="true"
moveable="false" resizeable="false" width="320" height="500">
<f:facet name="header">
<h:outputText value="#{msg.simInfoInformationTitle}"></h:outputText>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/close.png" styleClass="hidelink"
id="hidelink" />
<rich:componentControl for="simModelWindow" attachTo="hidelink"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<a4j:form id="Form">
<h:panelGrid columns="2" cellspacing="0" styleClass="tbl-forms" id="simInfoPanelGrid"
columnClasses="even,odd" footerClass="odd">
<h:outputText value="#{msg.simName}"></h:outputText>
<h:inputText value="#{simInfo.sim.simName}" />
<h:outputText value="#{msg.description}"></h:outputText>
<h:inputText value="#{simInfo.sim.simDesc}" />
</h:panelGrid>
<h:panelGrid columns="2" width="100%">
<h:outputText
value="                   " />
<a4j:commandButton value="#{msg.search}" id="simSearch" action="#{simInfo.searchSimInfo}"
oncomplete="#{rich:component('simModelWindow')}.show()">
</a4j:commandButton>
//user can able to search and load the respective data in rich:datatable.
</h:panelGrid>
<h:panelGrid columns="1" id="simDataTable">
<rich:extendedDataTable rows="15"
value="#{simInfo.listOfSimsForPopup}"
var="dataItems" id="simInfoDataTables" width="300px"
height="200px" rowKeyVar="vk1"
selection="#{simInfo.selectionSimInfosForPopupWindow}">
<f:facet name="header">
<rich:columnGroup>
<rich:column colspan="3">
<h:outputText value="#{msg.listOfSims}" />
</rich:column>
<rich:column breakBefore="true" width="100px">
<h:outputLink value="#{msg.simName}" />
</rich:column>
<rich:column width="100px">
<h:outputText value="#{msg.simDescription}" />
</rich:column>
<rich:column width="100px">
<h:outputText value="#{msg.simRemarks}" />
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column width="100px">
<h:outputText value="#{dataItems.simName}" />
</rich:column>
<rich:column width="100px">
<h:outputText
value="#{dataItems.simDesc}" />
</rich:column>
<rich:column width="100px">
<h:outputText value="#{dataItems.simRemark}" />
</rich:column>
<a4j:support action="#{simInfo.takeSimNameSelectionForPopupWindow}"
ignoreDupResponses="true" event="onselectionchange"
oncomplete="#{rich:component('simModelWindow')}.hide()"
reRender="simId" />
</rich:extendedDataTable>
</h:panelGrid>
</a4j:form>
</rich:modalPanel>
</f:subview>
3) SimInfoBean.xtml
To capturing the code of sim id form siminforBean to phoneBean of sim(phone.simid) attribute
The code for reseting I need a fine tune up.
public void takeSimNameSelectionForPopupWindow() {
log
.debug(":::::::::::: takeSimNameSelectionForPopupWindow() :::::::::::: ");
Iterator<Object> iterator = selectionSimInfosForPopupWindow.getKeys();
Integer key = (Integer) iterator.next();
SimVO simPopup = new SimVO();
//where listOfSimsForPopup is have all sim id
simPopup = (SimVO) listOfSimsForPopup.get(key.intValue());
String simId=simPopup.getSimId();
FacesContext context = FacesContext.getCurrentInstance();
phoneInfoBean phoneTypes = (phoneInfoBean) context.getApplication()
.createValueBinding(String.format("#{%s}", "phoneInfo"))
.getValue(context);
phoneInfoBean.getPhoneVO().setSimid(simId);
// final we are string the simid into the phone vo of sim id
}
Please do the needful help.
Thanks
Ajaykumar