Please disable your adblock and script blockers to view this page

Search this blog

Tuesday, 16 August 2016

Enable selection and Get selected marker value from dvt:thematicMap in ADF Faces

Hello All

Previously I have posted about using dvt:thematicMap to mark locations using latitude and longitude, In that post I have described about showing different cities as markers on a world map using a POJO based data structure

Now In this post I am going to describe that how can we enable selection in thematic map and get selected location value in managed bean so here in this post I am extending that previous application

dvt:thematicMap looks like this after pointing cities markers

Now to enable selection set selection mode to single for dvt:pointDataLayer and create a selection listener method in managed bean

Now bind dvt:pointDataLayer to bean (Create component binding in Managed Bean)

    private UIPointDataLayer dataLayerBind;

    public void setDataLayerBind(UIPointDataLayer dataLayerBind) {
        this.dataLayerBind = dataLayerBind;

    public UIPointDataLayer getDataLayerBind() {
        return dataLayerBind;

See the generated XML of dvt:thematicMap

<dvt:thematicMap basemap="world" id="tm1" summary="World Map" styleClass="AFStretchWidth"
                                     partialTriggers="::b1" inlineStyle="background-color:#e9ffdc;">
                        <dvt:areaLayer layer="continents" id="al2">
                            <dvt:pointDataLayer id="dl1" value="#{viewScope.MapBean.mapDetail}" var="row"
                                <dvt:pointLocation id="pl1" type="pointXY" pointY="#{row.lattitude}"
                                    <dvt:marker id="m1" shortDesc="#{row.textDisp}" fillColor="#ff0000"
                                                borderWidth="1.0" scaleX="2.0" scaleY="2.0" labelDisplay="on"
                                                labelPosition="bottom" shape="triangleDown" value="#{row.location}"

SelectionListener code to get selected location value

import org.apache.myfaces.trinidad.event.SelectionEvent;
import org.apache.myfaces.trinidad.model.RowKeySet;
import java.util.Iterator;

    /**Method to get selected marker value in Managed Bean
     * @param selectionEvent
    public void mapSelectionListener(SelectionEvent selectionEvent) {
        //getDataLayerBind is binding of dvt:pointDataLayer on page.
        RowKeySet selectedMarker = getDataLayerBind().getSelectedRowKeys();
        //Create iterator from RowKeySet
        Iterator iter = selectedMarker.iterator();

        while (iter.hasNext()) {
            String i =;
            //LocationDetail is the list used to populate table and name is a column of table
            //So here filter list using index and get values then
            LocationDetail mapRow = mapDetail.get(Integer.parseInt(i));
            FacesMessage msg = new FacesMessage("Selected Marker is: " + mapRow.getLocation());
            FacesContext.getCurrentInstance().addMessage(null, msg);

All Done :) Run and check application


  1. Hello
    question If possible
    How can I use adf security provided specific column data
    For example :
    No. 1 user can see all the data in which No. 1
    And No. 2 user can see all the data in which No. 2
    Etc ..

    1. You can design your quesry using usercode as bind variable and pass user code value in query at runtime . In this way you can get desired result

  2. Great technical article. I'd like to feature you in my next article. Promise you can trust my paper review when it happens i'll let you know.

  3. The world map and the selected city within the world map should be marked very well so that the interested people can know.The pro custom writing review will let the people know about the benefits of learning the unknown issues.There are some apps for decorating the apps for arranging the selected cities.

  4. Bingo! I have been hunting this topic for a while. Thanks!

  5. Hi Ashish,

    I have more than one tab in my application. This issue is occurring while filtering a column in any tab. When we provide any text in filter option and hit enter.
    Filtered results are displaying correctly. But when user switches to other tab and returns to previous tab, the entered text in column filter option is appending with * symbol.
    Example: I have two tab Employee and Departments. User is currently in Employee tab and filtered “Name” column by entering “Tiger”.
    All the results related to Tiger are displayed. Then we moved to Department tab and returned to Employee tab, Tiger* is displaying as filter text . This is occurring in all filter columns.

    Please help me on this.