Originally posted on 2020-11-04
Want to add a map to a DominoKit project? If OpenLayers meets your needs check out domino-ui-map-addon. Take a look at the README.md to see what's involved in getting it set up.
And don't forget to add the necessary inherits
tag to your gwt.xml file:
<inherits name='org.dominokit.addons.ol.OLMapAddon'/>
Here's the code for the simplest map on a card implementation I could come up with in DominoKit:
package com.awslabs.iatt.spe.serverless.gwt.client;
import com.google.gwt.core.client.EntryPoint;
import org.dominokit.addons.ol.presets.MapPresets;
import org.dominokit.addons.ol.ui.MapCard;
import org.dominokit.domino.ui.icons.Icons;
import org.dominokit.domino.ui.layout.Layout;
import org.dominokit.domino.ui.tabs.Tab;
import org.dominokit.domino.ui.tabs.TabsPanel;
public class IotEntryPoint implements EntryPoint {
public static final String MAP_ID = "mapId";
@Override
public void onModuleLoad() {
Layout layout = Layout.create("Map test")
.disableLeftPanel()
.show();
TabsPanel tabsPanel = TabsPanel.create();
Tab mapTab = Tab.create(Icons.ALL.bug_check_mdi(), "Map card");
tabsPanel.appendChild(mapTab);
MapCard mapCard = new MapCard(MAP_ID, "Map in a card");
mapTab.appendChild(mapCard);
layout
.getContentPanel()
.appendChild(tabsPanel);
MapPresets.getOsmMap(mapCard.getCard().getBody().getId());
}
}