use of elemental2.dom.Node in project kie-wb-common by kiegroup.
the class KieSelectElementTest method testSetup.
@Test
public void testSetup() {
final HTMLElement viewRoot = spy(new HTMLElement());
viewRoot.innerHTML = "bar";
doReturn(viewRoot).when(view).getElement();
final HTMLSelectElement selectElement = spy(new HTMLSelectElement());
doReturn(selectElement).when(view).getSelect();
final Element container = spy(new Element() {
@Override
public Node appendChild(final Node node) {
if (node instanceof HTMLElement) {
this.innerHTML += ((HTMLElement) node).innerHTML;
}
return node;
}
});
container.innerHTML = "";
final List<Option> options = singletonList(new Option("Label", "Value"));
kieSelectElement.setup(container, options, "Value", value -> {
});
verify(view).setValue(eq("Value"));
verify(view).initSelect();
verify(optionsListPresenter).setup(eq(selectElement), eq(options), any());
assertEquals("bar", container.innerHTML);
}
use of elemental2.dom.Node in project mvp4g2-examples by mvp4g.
the class ShellView method setCenter.
@Override
public void setCenter(Element element) {
if (content.childElementCount > 0) {
for (int i = 0; i < content.childNodes.length; i++) {
Node oldChild = content.childNodes.item(i);
content.removeChild(oldChild);
}
}
content.appendChild(element);
}
use of elemental2.dom.Node in project gwt-ol3 by TDesjardins.
the class WfsTest method testWriteGetFeature.
public void testWriteGetFeature() {
injectUrlAndTest(() -> {
assertNotNull(wfsFormat);
WfsWriteFeatureOptions wfsWriteFeatureOptions = new WfsWriteFeatureOptions();
wfsWriteFeatureOptions.setFeatureNS("http://openstreemap.org");
wfsWriteFeatureOptions.setFeaturePrefix("osm");
wfsWriteFeatureOptions.setFeatureTypes(new String[] { "water_areas" });
Node node = wfsFormat.writeGetFeature(wfsWriteFeatureOptions);
assertNotNull(node);
});
}
use of elemental2.dom.Node in project gwt-ol3 by TDesjardins.
the class WfsExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a vector layer
Vector vectorSource = new Vector();
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vectorSource);
ol.layer.Vector wfsLayer = new ol.layer.Vector(vectorLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = new Coordinate(-8908887.277395891, 5381918.072437216);
view.setCenter(centerCoordinate);
view.setZoom(12);
view.setMaxZoom(19);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(DemoUtils.createOsmLayer());
map.addLayer(wfsLayer);
Wfs wfs = new Wfs();
WfsWriteFeatureOptions wfsWriteFeatureOptions = new WfsWriteFeatureOptions();
String[] featureTypes = { "water_areas" };
wfsWriteFeatureOptions.setSrsName("EPSG:3857");
wfsWriteFeatureOptions.setFeaturePrefix("osm");
wfsWriteFeatureOptions.setFeatureNS("http://openstreemap.org");
wfsWriteFeatureOptions.setFeatureTypes(featureTypes);
// set a filter
wfsWriteFeatureOptions.setFilter(new IsLike("name", "Mississippi*"));
wfsWriteFeatureOptions.setOutputFormat("application/json");
// create WFS-XML node
Node wfsNode = wfs.writeGetFeature(wfsWriteFeatureOptions);
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, "https://ahocevar.com/geoserver/wfs");
requestBuilder.setRequestData(new XMLSerializer().serializeToString(wfsNode));
requestBuilder.setCallback(new RequestCallback() {
@Override
public void onResponseReceived(com.google.gwt.http.client.Request request, Response response) {
GeoJson geoJson = new GeoJson();
Feature[] features = geoJson.readFeatures(response.getText());
vectorSource.addFeatures(features);
map.getView().fit(vectorSource.getExtent());
}
@Override
public void onError(com.google.gwt.http.client.Request request, Throwable exception) {
Window.alert(exception.getMessage());
}
});
try {
requestBuilder.send();
} catch (RequestException e) {
Window.alert(e.getMessage());
}
}
use of elemental2.dom.Node in project mvp4g2-examples by mvp4g.
the class ShellView method setCenter.
@Override
public void setCenter(Element element) {
if (content.childElementCount > 0) {
for (int i = 0; i < content.childNodes.length; i++) {
Node oldChild = content.childNodes.item(i);
content.removeChild(oldChild);
}
}
content.appendChild(element);
}
Aggregations