Locale

Change the locale of the datepicker, schedule and client side validation messages.

Language
English
English
English
French
German
German
German
Italian
Korean
Spanish
Catalan
Dutch
Portuguese
Portuguese
Arabic
Arabic
Bulgarian
Bangla
Bosnian
Czech
Greek
Estonian
Persian
Finnish
Danish
Hindi
Indonesian
Icelandic
Croatian
Japanese
Hungarian
Hebrew
Georgian
Central Kurdish
Khmer
Kyrgyz
Kazakh
Lithuanian
Latvian
Malay
Norwegian
Polish
Romanian
Russian
Slovak
Slovenian
Serbian
Serbian
Swedish
Thai
Turkish
Ukrainian
Uzbek
Vietnamese
Chinese
Chinese

Input Style

Themes

PrimeUIX
Aura Light Emerald Aura Light Emerald
Aura Dark Emerald Aura Dark Emerald
PrimeOne
Saga Blue Saga Blue
Vela Blue Vela Blue
Arya Blue Arya Blue
Bootstrap
Bootstrap Blue Light Bootstrap Blue Light
Bootstrap Purple Light Bootstrap Purple Light
Bootstrap Blue Dark Bootstrap Blue Dark
Bootstrap Purple Dark Bootstrap Purple Dark
Material Design
Material Indigo Light Material Indigo Light
Material Deep Purple Light Material Deep Purple Light
Material Indigo Dark Material Indigo Dark
Material Deep Purple Dark Material Deep Purple Dark
Material Design Compact
Material Compact Indigo Light Material Compact Indigo Light
Material Compact Deep Purple Light Material Compact Deep Purple Light
Material Compact Indigo Dark Material Compact Indigo Dark
Material Compact Deep Purple Dark Material Compact Deep Purple Dark
Legacy
Nova Light Nova Light
Nova Dark Nova Dark
Nova Colored Nova Colored
Luna Amber Luna Amber
Luna Blue Luna Blue
Luna Green Luna Green
Luna Pink Luna Pink

GMap Adding Markers

This examples demonstrates how to add a marker and keep client side representation in sync with the server side model. Even though you use Google Maps as a Faces component you can still take advantage of the full Google Maps API.

Gmap Tag Documentation

GMap component is built on Google Maps API Version 3 and is highly integrated with Faces and enhanced with AJAX capabilities.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
apiKey String false Google Maps API key.
apiVersion String false weekly Google Maps API version.
center String true Center point of the map.
disableDefaultUI boolean false false Disables default UI controls.
disableDoubleClickZoom boolean false false Disables zooming on mouse double click.
draggable boolean false true Defines draggability of map.
fitBounds boolean false false Defines if center and zoom should be calculated automatically to contain all markers on the map.
libraries String false Comma-separated list of additional Google Maps libraries to load.
mapTypeControl boolean false true Defines visibility of map type control.
model MapModel false An org.primefaces.model.MapModel instance.
navigationControl boolean false true Defines visibility of navigation control.
onPointClick String false Javascript callback to execute when a point on map is clicked.
scrollWheel boolean false true Controls scrollwheel zooming on the map.
streetView boolean false false Controls street view support.
style String false Inline style of the component.
styleClass String false Style class of the component.
type String true There are four types of maps available: roadmap, satellite, hybrid, and terrain.
zoom int true 8 Defines the initial zoom level.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc Basic Event Markers Selection Add Markers Draggable InfoWindow Polylines Polygons Circles Rectangles StreetView Controls Geocode Dialog

Usage


<script src="https://maps.google.com/maps/api/js?key=AIzaSyCvCDkYieuUBmMWon_mfLAfjuaeuosuqow&amp;sensor=true"></script>
<script>
    var currentMarker = null;

    function handlePointClick(event) {
        if (currentMarker === null) {
            document.getElementById('lat').value = event.latLng.lat();
            document.getElementById('lng').value = event.latLng.lng();

            currentMarker = new google.maps.Marker({
                position: new google.maps.LatLng(event.latLng.lat(), event.latLng.lng())
            });

            PF('map').addOverlay(currentMarker);

            PF('dlg').show();
        }
    }

    function markerAddComplete() {
        var title = document.getElementById('title');
        currentMarker.setTitle(title.value);
        title.value = "";

        currentMarker = null;
        PF('dlg').hide();
    }

    function cancel() {
        PF('dlg').hide();
        currentMarker.setMap(null);
        currentMarker = null;

        return false;
    }
</script>


<p:growl id="messages" showDetail="true"/>
<div class="card">
    <p:gmap id="gmap" center="36.890257,30.707417" zoom="13" type="HYBRID" style="width:100%;height:400px"
            model="#{addMarkersView.emptyModel}" onPointClick="handlePointClick(event);" widgetVar="map"/>
</div>
<p:dialog widgetVar="dlg" showEffect="fade">
    <h:form prependId="false">
        <h:panelGrid columns="2">
            <h:outputLabel for="title" value="Title:"/>
            <p:inputText id="title" value="#{addMarkersView.title}"/>

            <f:facet name="footer">
                <p:commandButton value="Add" action="#{addMarkersView.addMarker}" update=":messages"
                                 oncomplete="markerAddComplete()"/>
                <p:commandButton value="Cancel" onclick="return cancel()"/>
            </f:facet>
        </h:panelGrid>

        <h:inputHidden id="lat" value="#{addMarkersView.lat}"/>
        <h:inputHidden id="lng" value="#{addMarkersView.lng}"/>
    </h:form>
</p:dialog>