InfoWindow on Markers

2838
1
07-24-2015 10:18 AM
rodolfobulati1
New Contributor II

Hello, i have this working code bellow that display on makers a infoWindow on mouse click.

Map<String, String> attributes = new LinkedHashMap<String, String>();
attributes.put("Test:", "123");
attributes.put("Test2:", "456");

markers = new GraphicsLayer();
markers.addGraphic(new Graphic(point, symbol, attributes));
map.getLayers().add(markers);

final InfoPopupOverlay infoPopupOverlay = new InfoPopupOverlay();
infoPopupOverlay.setPopupTitle("InfoPopup");
map.addMapOverlay(infoPopupOverlay);

markers.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() {
     @Override
     public void layerInitializeComplete(LayerInitializeCompleteEvent event) {
          infoPopupOverlay.addLayer(event.getLayer());
     }
});

It's working perfect and on infoWindows it shows the attributes content of markers like this:

Test: 123

Test2: 456

But now i need to show a HTML code or a JPainel inside this InfoWindow.

Can someone help me with this?

Using the code below, it accept html code on description, but i can't do many things like change size of infoWindow:

map.addMarkerGraphic(pLat, pLng, "test", "<html><b>test</b></html>");

------

One other question:

On this page: PopupView  it shows how to edit the attributes of Features, but how i can do the same with a Graphic?

on code below, PopupView.createEditView just accept a FeatureLayes on its parameter.

PopupView contentPanel = PopupView.createEditView("Edit Attributes", arcGISFeatureLayer);

Really thank you for answers.

0 Kudos
1 Reply
EricBader
Occasional Contributor III

Hi Rodolfo,

Regarding your last question:

The PopupView is for editing attribute data for Features from a FeatureLayer. It is tightly bound to the FeatureLayer schema and editing workflows around that.

At the present time we don't have an easy way in the Runtime API to build your own ad-hoc form editor for generic , "in-memory" Graphic elements using popup dialogs, which is what I think you're getting at. You'd have to write your own dialog and apply the edits to your data outside of the Runtime framework and workflow, so to speak.

Regarding your first question:

If I understand it correctly, you want to display custom HTML as content in your infoPopup. You can do this, but you won't be able to control the window size using the approach you described. It will scale your HTML content to what it decides best. Unfortunately. As a workaround, you may need to write a custom infowindow-like component to model the behavior you need.


I hope this information is helpful to you in some way.