Question

Hello guys I have a doubt in the primefaces infowindow

First: I use jsf2 + primefaces4 + mojarra2

When looking at the documentation and primefaces showcase the attributes of the marker are LatLgn latlgn, String title, Object data, String icon, String shadow

Where in latlgn I'll pass the coordinates for the marker, the title will be a description of the image and data will be the image.

In the current application works good and I am currently doing so:

Bean:

advancedModel.addOverlay(new Marker (new LatLng(user.getLatitude(), user.getLongitude()),   user.getName() + " " + user.getAdress(), user.getPhoto()));  

Xhtml:

<p:gmapInfoWindow>  
    <p:outputPanel >    
        <p:imageSwitch>    
            <ui:repeat value="#{searchMBean.marker.data}" var="photo">    
                <p:graphicImage value="/temp/#{photo.id}.jpg" />    
            </ui:repeat>    
        </p:imageSwitch>  
        <h:outputText value="#{searchMBean.marker.title}" />  
    </p:outputPanel>    
 </p:gmapInfoWindow> 

What I want to do in String title: I want to pass more than a string so I can modify the xhtml it with css, because the way is the name and address are together

It there a possibility to pass more than one parameter to the String title? But would like some ideas how.

Was it helpful?

Solution 2

Well guys solved the problem of infowindow what I posted some time ago.

Basically, the marker has 5 parameters (LatLgn latlgn) for latitude and longitude (String title) for the title of the image (Object data) to the image, (String icon) if you want to customize your icon on the map and (String shadow ) where is the shadow of the icon. With this guy I put the address string that I needed, following the example below.

MBean

advancedModel.addOverlay(new Marker
(new
    LatLng(user.getLatitude(), user.getLongitude()), // LatLgn latitude and longitude
    user.getName(), // String title
    user.getPhoto(), //Object data
    iconName, // String icon
    user.getAddress() + ", " + user.getNumber() + " - " + user.getNeighborhood() // String shadow)
);

Xhtml

<div class="searchAddress">
    <h:outputText value="#{searchMBean.marker.shadow}" />
</div>

OTHER TIPS

You can pass parameters in the EL expression that evaluates the title value. For example:

<h:outputText value="#{searchMBean.marker.title('param1', 'param2')}" />

This forces the managed-bean getter for the title to match the following signature:

public String getTitle(String param1, String param2) {
   //
}

More info:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top