@Override protected void convertInput() { visitChildren( TextField.class, new org.apache.wicket.Component.IVisitor() { public Object component(Component component) { ((TextField) component).processInput(); return null; } }); if(isCRSFieldVisible()) { crsPanel.processInput(); } // update the envelope model if(minX != null && maxX != null && minY != null && maxY != null) { if(crsRequired && crs == null) { setConvertedInput(null); } else { setConvertedInput(new ReferencedEnvelope(minX, maxX, minY, maxY, crs)); } } else { setConvertedInput(null); } }
@SuppressWarnings("unchecked") @Override public void convertInput() { visitChildren( TextField.class, (component, visit) -> { ((TextField<String>) component).processInput(); }); if (isCRSFieldVisible()) { crsPanel.processInput(); } // update the envelope model if (minX != null && maxX != null && minY != null && maxY != null) { if (crsRequired && crs == null) { setConvertedInput(null); } else { if (is3D()) { double minZsafe = minZ == null ? Double.NaN : minZ; double maxZsafe = maxZ == null ? Double.NaN : maxZ; setConvertedInput( new ReferencedEnvelope3D( minX, maxX, minY, maxY, minZsafe, maxZsafe, crs)); } else { setConvertedInput(new ReferencedEnvelope(minX, maxX, minY, maxY, crs)); } } } else { setConvertedInput(null); } }
@Override protected void onClick(AjaxRequestTarget target, Form form) { // perform manual processing of the required fields nativeBBox.processInput(); declaredCRS.processInput(); ReferencedEnvelope nativeBounds = (ReferencedEnvelope) nativeBBox.getModelObject(); try { // if the native bounds are not around compute them if(nativeBounds == null) { ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); nativeBounds = cb.getNativeBounds(resource); resource.setNativeBoundingBox(nativeBounds); nativeBBox.setModelObject(nativeBounds); target.addComponent(nativeBBox); } CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); latLonPanel.setModelObject(cb.getLatLonBounds(nativeBounds, declaredCRS.getCRS())); } catch(IOException e) { LOGGER.log(Level.SEVERE, "Error computing the geographic BBOX", e); error("Error computing the geographic bounds:" + e.getMessage()); } target.addComponent(latLonPanel); } };