3

我正在使用 Primefaces 并尝试为不同类型的叠加层创建具有不同内容的 infoWindow。

地图.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>

麻烦的是,当我单击除标记之外的任何覆盖时,不会显示 infoWindow。我想在 infoWindow 中使用 jsf 代码。我如何为另一个覆盖显示 infoWindow?

4

0 回答 0