In my JSF application, Primefaces autocomplete itemSelect event is not fired. I double checked and it is inside a form element. I can not figure out why it is not fired.
I have listed code below.
<p:panelGrid columns="1" >
<p:outputLabel value="Medicine/Device" ></p:outputLabel>
<p:autoComplete forceSelection="true" id="acStock" value="#{pharmacySaleController.billItem.pharmaceuticalBillItem.stock}" converter="stockCon" completeMethod="#{pharmacySaleController.completeAvailableStocks}" var="i" itemLabel="#{i.itemBatch.item.name}" itemValue="#{i}" >
<p:column headerText="Item">
<h:outputLabel value="#{i.itemBatch.item.name}" ></h:outputLabel>
</p:column>
<p:column headerText="Rate">
<h:outputLabel value="#{i.itemBatch.retailsaleRate}" >
<f:convertNumber pattern="#,##0.00" ></f:convertNumber>
</h:outputLabel>
</p:column>
<p:column headerText="Stocks">
<h:outputLabel value="#{i.stock}" >
<f:convertNumber pattern="#,###" ></f:convertNumber>
</h:outputLabel>
</p:column>
<p:column headerText="Expiary">
<h:outputLabel value="#{i.itemBatch.dateOfExpire}" >
<f:convertDateTime pattern="MMM yyyy" ></f:convertDateTime>
</h:outputLabel>
</p:column>
<p:ajax event="query" update="lstSelectItems" ></p:ajax>
<p:ajax event="itemSelect" listener="#{pharmacySaleController.handleSelect}" update="txtRate txtQty txtVal" ></p:ajax>
</p:autoComplete>
</p:panelGrid>
<p:panelGrid columns="1" >
<p:outputLabel value="Quentity" ></p:outputLabel>
<p:inputText id="txtQty" value="#{pharmacySaleController.billItem.pharmaceuticalBillItem.qty}" >
</p:inputText>
</p:panelGrid>
<p:panelGrid columns="1" >
<p:outputLabel value="Rate" ></p:outputLabel>
<p:inputText id="txtRate" value="#{pharmacySaleController.billItem.rate}" >
</p:inputText>
</p:panelGrid>
<p:panelGrid columns="1" >
<p:outputLabel value="Value" ></p:outputLabel>
<p:inputText id="txtVal" value="#{pharmacySaleController.billItem.netValue}" >
</p:inputText>
</p:panelGrid>
<p:commandButton value="Add" action="#{pharmacySaleController.addBillItem()}" ></p:commandButton>
</p:panelGrid>
Controller
public void handleSelect(SelectEvent event){
calculateRates();
}
public void calculateRates() {
System.out.println("calculating rates");
if (bill == null) {
System.out.println("bill is null");
return;
}
if (billItem == null) {
System.out.println("billItem is null");
return;
}
if (billItem.getPharmaceuticalBillItem() == null) {
System.out.println("pharmaceutical bill item is null");
return;
}
if (billItem.getPharmaceuticalBillItem().getStock() == null) {
System.out.println("billItem.getPharmaceuticalBillItem().getStock() = " + billItem.getPharmaceuticalBillItem().getStock());
return;
}
System.out.println("cal error check finished");
//
System.out.println("billItem.getPharmaceuticalBillItem().getStock().getItemBatch().getRetailsaleRate() = " + billItem.getPharmaceuticalBillItem().getStock().getItemBatch().getRetailsaleRate());
billItem.setRate(billItem.getPharmaceuticalBillItem().getStock().getItemBatch().getRetailsaleRate());
billItem.setDiscountRate(calculateBillItemDiscountRate(billItem));
billItem.setNetRate(billItem.getRate() - billItem.getDiscountRate());
billItem.setGrossValue(billItem.getRate() * billItem.getQty());
billItem.setDiscount(billItem.getDiscountRate() * billItem.getQty());
billItem.setNetValue(billItem.getNetRate() * billItem.getQty());
}
Related
I'm facing some problem updating my dataTable when I perform a filter operation with this:
<p:panel styleClass="card" header="Filtri">
<h:panelGrid columns="4" layout="grid"
styleClass="ui-panelgrid-blank form-group">
<h:panelGroup styleClass="md-inputfield">
<p:inputText id="orderMinFilter" label="N. bolla più basso"
value="#{productionOrdersView.orderNumberStartFilter}">
</p:inputText>
<p:outputLabel for="orderMinFilter" value="N. bolla più basso" />
</h:panelGroup>
<h:panelGroup styleClass="md-inputfield">
<p:inputText id="orderMaxFilter" label="N. bolla più alto"
value="#{productionOrdersView.orderNumberEndFilter}">
</p:inputText>
<p:outputLabel for="orderMaxFilter" value="N. bolla più alto" />
</h:panelGroup>
<p:commandButton value="Cancella filtri" icon="ui-icon-clear"
styleClass="red-btn flat"
actionListener="#{productionOrdersView.clearFilter()}"
style="width:auto;margin-bottom:10px; float:right;"
update="dtOrders" />
<p:commandButton value="Cerca" icon="ui-icon-search"
styleClass="primary-btn flat"
actionListener="#{productionOrdersView.filter()}"
update="dtOrders"
style="width:auto;margin-bottom:10px; float:right;" />
</h:panelGrid>
</p:panel>
This is my dataTable:
<p:dataTable id="dtOrders" var="productionOrder"
value="#{productionOrdersView.orders}" selectionMode="single"
reflow="true" selection="#{productionOrdersView.selected}"
filteredValue="#{productionOrdersView.filtered}"
widgetVar="ordersTable" rowKey="#{productionOrder.pk}"
emptyMessage="Nessun elemento oppure la ricerca è ancora attiva..."
paginator="true" rows="20">
And this is the method:
public void filter() {
if (orderNumberStartFilter != null && orderNumberEndFilter != null) {
this.orders = productionOrderController.findFromToOrderNumber(Integer.valueOf(orderNumberStartFilter),
Integer.valueOf(orderNumberEndFilter));
this.filtered = orders;
}
}
The filter() method is executed correctly and the list in the bean are correct (I search for 11 elements and I got it), but the dataTable is updated but not with these values; why? Where am I wrong?
You add form tag to update property of commandButton.
<p:commandButton value="Cerca" icon="ui-icon-search"
styleClass="primary-btn flat"
actionListener="#{productionOrdersView.filter()}"
update=":formName:dtOrders"
style="width:auto;margin-bottom:10px; float:right;" />
.
Hi I have a datatable which publishes the information very well, however, for this particular case something happens, in one column have a Boolean value that can only be true once the entire table of the database, so if I detect someone puts another record as true then update the above false and so the cycle ends. The update is done right in the database but when I want to refresh the datatable to also show the modification of another record, and does not work ...
this is my xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="template.xhtml">
<ui:define name="content">
<h:form id="someForm">
<p:growl id="msg" showDetail="true" life="3000" autoUpdate="true"/>
<p:panelGrid style="100%">
<p:row>
<p:column style="350px">title 1</p:column>
<p:column>
<p:inputText id="cveSituacion" value="#{someBean.cve}" maxlength="20" />
</p:column>
</p:row>
<p:row>
<p:column style="350px">title 2</p:column>
<p:column>
<p:inputText id="name" value="#{someBean.name}" />
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<p:spacer></p:spacer>
</p:column>
</p:row>
<p:row>
<p:column>
<p:commandButton action="#{someBean.searchAll}" value="Search All" ajax="true" update="someForm" immediate="true"/>
</p:column>
</p:row>
<p:row>
<p:column colspan="4">
<p:spacer></p:spacer>
</p:column>
</p:row>
<p:row>
<p:column colspan="4">
<p:dataTable id="resultSearch" var="someVariable" value="#{someBean.listOfData}" editable="true">
<p:ajax event="rowEdit" listener="#{someBean.onEdit}" update=":someForm:msg :someForm:resultSearch" />
<p:ajax event="rowEditCancel" listener="#{someBean.onCancel}" update=":someForm:msg" />
<p:column headerText="Clave Sit Ticket" sortBy="#{someVariable.cve}">
<h:outputText value="#{someVariable.cve}" />
</p:column>
<p:column headerText="Name" sortBy="#{someVariable.name}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{someVariable.name}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{someVariable.name}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Description" sortBy="#{someVariable.desc}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{someVariable.desc}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{someVariable.desc}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Sit" sortBy="#{someVariable.situation}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{someVariable.situation}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu id="cboBox" value="#{someVariable.situation}" style="width=200px">
<f:selectItems value="#{commonCboBean.listOfData}" var="cboBox" itemValue="#{cboBox.cve}" itemLabel="#{cboBox.desc}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Default" sortBy="#{someVariable.BSitDefault}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{someVariable.BSitDefault}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu id="cboVoF" value="#{someVariable.BSitDefault}" style="width=200px">
<f:selectItems value="#{fovBean.fov}" var="fov" itemValue="#{fov.bandera}" itemLabel="#{fov.descripcion}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:50px;" >
<p:rowEditor />
</p:column>
</p:dataTable>
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>
this is my backing bean:
#SuppressWarnings("serial")
#ManagedBean
#ViewScoped
public class SomeBean implements Serializable{
private String cve;
private String name;
private List<SomeObject> listOfData;
private SomeObject newDefault;
private SomeObject sitDefault;
private RequestContext context = null;
... some methods ....
public void onEdit(RowEditEvent event) {
/*
IF I JUST UPDATE DATA LIKE THIS: updateData(SomeObject obj) THE DATATABLE
IS UPDATED CORRECTLY, BUT IF A LEAVE THE NEXT CODE, IT DOESNT
*/
newDefault = (SomeObject)event.getObject();
if( newDefault.getFlag.equals(Constants.V) ){
List<SomeObject> list = ejb.find(newDefault.getCve);
if( list == null || list.size() <= 0 ){
updateData( newDefault );
}else{
if( list.get(0).getCve().equals( newDefault.getCve() ) ){
updateData( newDefault );
}else{
SomeObject sitDefault = list.get(0);
if( ejb.update(sitDefault) > 0 ){
updateData(newDefault);
searchAll();
}else
FacesContext.getCurrentInstance().addMessage( null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"sometitle",
"some messsage")
);
}
}
}else{
updateData( newDefault );
}
}
public void updateNewDefault(){
sitDefault.setBSitDefault("F");
if( ejb.update(sitDefault) > 0 ){
updateData(newDefault);
searchAll();
}else
FacesContext.getCurrentInstance().addMessage( null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"error",
"some error has ocurred")
);
}
private void updateData(SomeObject obj){
int result = ejb.update( obj );
if( result > 0 ){
FacesContext.getCurrentInstance().addMessage( null,
new FacesMessage(FacesMessage.SEVERITY_WARN,
"OK",
"OK"
)
);
searchAll();
}else{
FacesContext.getCurrentInstance().addMessage( null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"ERROR",
"SOME ERROR")
);
}
}
public void searchAll(){
setListOfData( ejb.findAll() );
}
/******** getters & setters *************/
}
Please help!!! took a while stuck with it :(
I am Using Prime faces 3.5.8,I am getting duplicate rows with row edit event.I am getting my row count as fine but one record is showing twice instead of other.This I am getting when call my clintList to load.When I close dialog and open it it is fine,Even I checked my list It is getting right data,Thanks in Advance..
My BeanCode for edit,
public void onClientEdit(RowEditEvent event) {
try {
Client edtClient = (Client) event.getObject();
if (null == edtClient.getClientName()
|| edtClient.getClientName() == "") {
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
CommonStringUtil.getUIString("clintNameEmpty"),
CommonStringUtil.getUIString("clintNameEmpty")));
getAgencyClients();
return;
}
HibernateUtil.beginTransaction();
Agency tempAgency = agencyHome.findById(agency.getAgencyId());
Hibernate.initialize(tempAgency.getClients());
HibernateUtil.commitTransaction();
for (Client cl : (Set<Client>) tempAgency.getClients()) {
if (cl.getClientName().equalsIgnoreCase(
edtClient.getClientName().trim())) {
log.debug("Client Name Already exists");
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_WARN,
CommonStringUtil
.getUIString("clientNameExists"),
CommonStringUtil
.getUIString("clientNameExists")));
getAgencyClients();
return;
}
}
HibernateUtil.beginTransaction();
Client eClient = clientHome.findById(edtClient.getClientId());
eClient.setClientName(edtClient.getClientName());
clientHome.attachDirty(eClient);
clientName = null;
agencyHome.attachDirty(agency);
HibernateUtil.commitTransaction();
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_INFO, CommonStringUtil
.getUIString("clientNameEditSucc"), CommonStringUtil
.getUIString("clientNameEditSucc")));
} catch (Exception e) {
if (HibernateUtil.isTransactionActive())
HibernateUtil.rollbackTransaction();
log.error("Error Updating Client Name", e);
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, CommonStringUtil
.getUIString("clientNameEditFail"), CommonStringUtil
.getUIString("clientNameEditFail")));
}
}
My View Part
<p:dialog widgetVar="clientDialogue" modal="true" id="clientdilogId"
showHeader="false" style="padding:0;">
<h:form id="clientDlgForm">
<p:toolbar style="height:38px;">
<p:toolbarGroup align="left">
<h:outputText
value="Edit Client Messages: #{adminAgencyBean.agencyName}"
styleClass="dialog-header-Text" style="line-height:38px"></h:outputText>
</p:toolbarGroup>
<p:toolbarGroup align="right" style="margin-left:50px;">
<p:inputText value="#{adminAgencyBean.clientName}" id="clientName"
maxlength="45" />
<p:spacer width="5"></p:spacer>
<p:commandButton action="#{adminAgencyBean.createClient}"
icon="ui-icon-custom-arrow" iconPos="right" value="Create"
style="margin-left:5px;margin-right:20px;" update="#form" />
<p:commandLink value="X" onclick="clientDialogue.hide()"
style="text-decoration:none;margin-right:10px;" process="#none"></p:commandLink>
</p:toolbarGroup>
</p:toolbar>
<p:messages id="clientMsgs" />
<p:scrollPanel style="width:980px;height:400px;width:100%;"
mode="native">
<p:dataTable value="#{adminAgencyBean.clientList}" var="client"
sortBy="#{client.clientName}" sortOrder="ascending" editable="true"
id="ClientTable">
<p:ajax event="rowEdit" listener="#{adminAgencyBean.onClientEdit}"
update=":clientDlgForm:clientMsgs"/>
<p:ajax event="rowEditCancel" />
<p:column headerText="Client Name" sortBy="#{client.clientName}"
style="white-space:pre-line;width:130px;">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.clientName}" />
</f:facet>
<f:facet name="input">
<p:inputText id="editClientName" value="#{client.clientName}"
maxlength="45" style="width:90px"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit Client"
style="white-space:pre-line;width:80px;">
<p:rowEditor
rendered="#{adminAgencyBean.clientTransactionMap[client.clientId] lt 1}" />
<h:outputText value="#{commonmessages.NoEdit}"
rendered="#{adminAgencyBean.clientTransactionMap[client.clientId] ge 1}" />
</p:column>
<p:column headerText="Remove Client"
style="width:85px;white-space:pre-line">
<p:commandButton value="Remove"
rendered="#{adminAgencyBean.clientTransactionMap[client.clientId] lt 1}"
action="#{adminAgencyBean.deleteClient}" update="#form"
process="#none" styleClass="blue_button">
<f:setPropertyActionListener target="#{adminAgencyBean.clientId}"
value="#{client.clientId}"></f:setPropertyActionListener>
</p:commandButton>
<h:outputText value="#{commonmessages.nodelete}"
rendered="#{adminAgencyBean.clientTransactionMap[client.clientId] ge 1}" />
</p:column>
</p:dataTable>
</p:scrollPanel>
</h:form>
</p:dialog>
There are several primefaces inputtext controls and commandbuttons in a single form. Pressing the return ket on one inputtext need to activate the click of related commandbutton. How can I achieve that functionality? I tried to use onkeydown even, but could not find out the method.
You can try(you need to find to detect enter key in javascript by yourself)
xhtml:
<p:input onkeydown="test()" />
<p:commandButton styleClass="foo" />
javascript:
function test(){
$('.foo').click();
}
You can see also:
How-to-programmatically-trigger-onclick-event
and
How-to-refer-to-a-jsf-component-id-in-jquery
As guided by RongNK, I changed my code as below and it serves my purpose perfectly.
Added CDATA to include JavaScript.
Used \\ to escape : in id of JSF compoents
<h:form id="frmEn">
<script type="text/javascript" language="JavaScript">
//<![CDATA[
function forDx(e) {
if (e.keyCode === 13) {
$('#frmEn\\:btnDx').click();
return false;
} else {
return true;
}
}
function forIx(e) {
if (e.keyCode === 13) {
$('#frmEn\\:btnIx').click();
return false;
} else {
return true;
}
}
function forMx(e) {
if (e.keyCode === 13) {
$('#frmEn\\:btnMx').click();
return false;
} else {
return true;
}
}
function forRx(e) {
if (e.keyCode === 13) {
$('#frmEn\\:btnRx').click();
return false;
} else {
return true;
}
}
// ]]>
</script>
<p:panel header="Encounter" >
<h:panelGrid columns="2" >
<p:panel header="Encounter Details" >
<h:panelGrid columns="4" >
<h:outputLabel value="Tests" ></h:outputLabel>
<p:autoComplete id="txtIx" value="#{encounterController.test }" completeMethod="#{encounterController.completeIx}" styleClass="defaultTxt" onkeydown="return forIx(event)" >
</p:autoComplete>
<h:commandButton id="btnIx" value="Add" action="#{encounterController.addTest()}">
<f:ajax execute="btnIx txtIx" render="tblIx" />
</h:commandButton>
<p:dataTable value="#{encounterController.ecIxs }" var="ix" id="tblIx" >
<p:column >
<f:facet name="header" >
<h:outputLabel value="Tests"/>
</f:facet>
<h:outputLabel value="#{ix.concept.name}"></h:outputLabel>
</p:column>
</p:dataTable>
<h:outputLabel value="Diagnosis" ></h:outputLabel>
<p:autoComplete id="txtDx" value="#{encounterController.diagnosis }" completeMethod="#{encounterController.completeDx}" styleClass="defaultTxt" onkeydown="return forDx(event)" />
<h:commandButton id="btnDx" value="Add" action="#{encounterController.addDiagnosis()}" >
<f:ajax execute="btnDx txtDx" render="tblDx txtDx" />
</h:commandButton>
<p:dataTable value="#{encounterController.ecDxs }" var="dx" id="tblDx" >
<p:column >
<f:facet name="header" >
<h:outputLabel value="Diagnoses"/>
</f:facet>
<h:outputLabel value="#{dx.concept.name}"></h:outputLabel>
</p:column>
</p:dataTable>
<h:outputLabel value="Treatment" ></h:outputLabel>
<p:autoComplete id="txtRx" value="#{encounterController.rx}" completeMethod="#{encounterController.completeRx}" styleClass="defaultTxt" onkeydown="return forRx(event)">
</p:autoComplete>
<h:commandButton id="btnRx" value="Add" action="#{encounterController.addRx()}">
<f:ajax execute="btnRx txtRx" render="tblRx" />
</h:commandButton>
<p:dataTable value="#{encounterController.ecRxs }" var="rx" id="tblRx" >
<p:column >
<f:facet name="header" >
<h:outputLabel value="Treatment"/>
</f:facet>
<h:outputLabel value="#{rx.concept.name}"></h:outputLabel>
</p:column>
</p:dataTable>
<h:outputLabel value="Plan" ></h:outputLabel>
<p:autoComplete id="txtMx" value="#{encounterController.plan }" completeMethod="#{encounterController.completeMx}" styleClass="defaultTxt" onkeydown="return forMx(event)">
</p:autoComplete>
<h:commandButton id="btnMx" value="Add" action="#{encounterController.addPlanOfAction() }">
<f:ajax execute="btnMx txtMx" render="tblMx" />
</h:commandButton>
<p:dataTable value="#{encounterController.ecMxs}" var="mx" id="tblMx" >
<p:column >
<f:facet name="header" >
<h:outputLabel value="Plan"/>
</f:facet>
<h:outputLabel value="#{mx.concept.name}"></h:outputLabel>
</p:column>
</p:dataTable>
<h:outputLabel value="Details" ></h:outputLabel>
<h:inputTextarea value="#{encounterController.current.comments}" styleClass="defaultTxtArea"></h:inputTextarea>
<h:outputLabel value="" ></h:outputLabel>
<h:outputLabel value="" ></h:outputLabel>
<h:outputLabel value="Charges" ></h:outputLabel>
<h:inputTextarea value="#{encounterController.current.charge}" styleClass="defaultTxt"></h:inputTextarea>
<h:outputLabel value="" ></h:outputLabel>
<h:outputLabel value="" ></h:outputLabel>
<h:outputLabel value=""></h:outputLabel>
<h:commandButton value="Save" action="#{encounterController.saveSelected()}"></h:commandButton>
<h:outputLabel value="" ></h:outputLabel>
<h:outputLabel value="" ></h:outputLabel>
</h:panelGrid>
</p:panel>
<p:panel header="Patient Details" >
<h:panelGrid columns="2" >
<h:outputLabel value="Name"></h:outputLabel>
<h:outputLabel value="#{encounterController.current.patient.person.name}"></h:outputLabel>
<h:outputLabel value="Age"></h:outputLabel>
<h:outputLabel value="#{encounterController.current.patient.person.age}"></h:outputLabel>
<h:outputLabel value="Date of Birth"></h:outputLabel>
<h:outputLabel value="#{encounterController.current.patient.person.dob}">
<f:convertDateTime pattern="dd MMMM yyyy" />
</h:outputLabel>
<h:outputLabel value="Sex"></h:outputLabel>
<h:outputLabel value="#{encounterController.current.patient.person.sex.name}"></h:outputLabel>
<h:outputLabel value="Address"></h:outputLabel>
<h:outputLabel value="#{encounterController.current.patient.person.address}"></h:outputLabel>
</h:panelGrid>
</p:panel>
</h:panelGrid>
</p:panel>
</h:form>
I'm use Primefaces and trying to create infoWindow with different content for different types of overlays.
Map.java
public void onMarkerSelect(OverlaySelectEvent event) {
if (event.getOverlay() instanceof Marker) {
selectedOverlay = "marker";
selMarkerSite = (Site) event.getOverlay().getData();
selMarkerSiteNetworkElements = new ArrayList<NetworkElement>();
List<NetworkElement> neList = selMarkerSite.getNetworkElements();
if (!neList.isEmpty()) {
for (NetworkElement ne : neList) {
if (!(ne.getNeFunc().getName().equals("CELL2G") || ne.getNeFunc().getName().equals("CELL3G") || (ne.getNeStatus() != null && ne.getNeStatus().getId().equals(new BigDecimal(26))))
&& filter.getRadioType().contains(ne.getNeFunc().getGeneration())) {
selMarkerSiteNetworkElements.add(ne);
}
}
}
balloonText = HtmlFormatter.siteBalloonInfoFormater(selMarkerSite);
}
if (event.getOverlay() instanceof Polygon) {
selectedOverlay = "polygon";
// my code
}
}
jsf
<p:gmap center="#{map.center}"
zoom="#{map.zoom}" fitBounds="false" type="HYBRID" id="mainMapId"
style="width:100%; height:100%" widgetVar="mainMap"
model="#{map.mapModel}">
<p:ajax event="overlaySelect" listener="#{map.onMarkerSelect}" />
<p:ajax event="stateChange" listener="#{map.onStateChange}"
global="false"/>
/>
<p:gmapInfoWindow>
<p:panel rendered="#{map.selectedOverlay=='marker'}">
<h:panelGrid columns="2" width="580">
<p:column style="width:200px">
<p:outputPanel style="display:block; width:180px">
<h:outputText value="#{map.balloonText}" escape="false" />
<h:panelGrid columns="2" style="width:180px">
<p:commandLink id="getAlarmsForSite"
actionListener="#{map.getSiteAlarms}">
<h:outputText value="Alarms" />
</p:commandLink>
<p:commandLink id="editSiteOnMapBtn"
actionListener="#{map.editSite()}">
<f:setPropertyActionListener
target="#{createOrUpdateSiteDialogController.componentsToUpdateOnNetworkElementSelectListener}"
value=":updateOrCreateNetworkElementDialogId" />
<h:outputText value="Edit this Site" />
</p:commandLink>
</h:panelGrid>
</p:outputPanel>
</p:column>
<p:column style="width:380px">
<p:tabView id="tabView" var="NE"
value="#{map.selMarkerSiteNetworkElements}"
rendered="#{map.selMarkerSiteNetworkElements.size()>0}">
<p:tab id="neTab" title="#{NE.name}"
titleStyleClass="tabSev#{NE.minSeverity}">
<h:panelGrid columns="2" style="width: 420px;">
<h:panelGrid columns="2" style="width: 230px;">
<h:outputText value="MO: " style="font-weight: bold" />
<h:outputText value="#{NE.managingElement.name}" />
<h:outputText value="DN: " style="font-weight: bold" />
<h:outputText value="#{NE.dn}" />
<h:outputText value="TYPE: " style="font-weight: bold" />
<h:outputText value="#{NE.neFunc.name}" />
<h:outputText value="STATUS: " style="font-weight: bold" />
<h:outputText value="#{NE.neStatus.nameEng}" />
<h:outputText value="Customer " style="font-weight: bold" />
<p:graphicImage width="18" cache="true"
title="#{NE.nms.customer.nameEng}"
url="#{NE.nms.customer.labelSmall}"
style="padding-top: 2px;" />
<p:commandLink id="getAlarmsForNE"
actionListener="#{map.getBsAlarms(NE)}">
<h:outputText
value="Alarms (#{NE.sizeAlarmsWithChildrenNE})"
styleClass="sev#{NE.minSeverity}" />
</p:commandLink>
<p:commandLink id="editNeOnMapBtn"
actionListener="#{map.editNe(NE)}">
<h:outputText value="Edit this NE" />
<f:setPropertyActionListener
target="#{createOrupdateNetworkElementController.componentsToUpdateOnSiteViweActionListener}"
value=":updateOrCreateSiteDialogId" />
</p:commandLink>
</h:panelGrid>
<p:dataList value="#{NE.networkElements}" var="NEc"
rendered="#{NE.networkElements.size()>0}">
<h:outputText
value="name: #{NEc.name}; azimuth: #{NEc.azimuth!=null ? NEc.azimuth : '-' }" />
</p:dataList>
</h:panelGrid>
</p:tab>
</p:tabView>
</p:column>
</h:panelGrid>
</p:panel>
<p:panel rendered="#{map.selectedOverlay=='polygon'}">
//
</p:panel>
</p:gmapInfoWindow>
</p:gmap>
The troubleis that the infoWindow is not showed when i click on any overlay except marker.
I want use jsf code in infoWindow.
How i can show infoWindow for another overlays?