Search in sources :

Example 1 with SandboxPasteController

use of au.org.ala.spatial.composer.sandbox.SandboxPasteController in project spatial-portal by AtlasOfLivingAustralia.

the class ToolComposer method onClick$btnUpload.

public void onClick$btnUpload(Event event) {
    try {
        LOGGER.debug("onClick$btnUpload(Event event)");
        if (StringUtils.isNotEmpty((String) CommonData.getSettings().getProperty("sandbox.url", null)) && CommonData.getSettings().getProperty("import.points.layers-service", "false").equals("false")) {
            SandboxPasteController spc = (SandboxPasteController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxPaste.zul", getMapComposer(), null);
            spc.setAddToMap(true);
            spc.setParent(getMapComposer());
            spc.doModal();
        } else {
            UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", this, null);
            if (rSpeciesUploadSpecies.isSelected()) {
                usc.setTbInstructions("3. Select file (comma separated ID (text), longitude (decimal degrees), latitude(decimal degrees))");
            } else if (rSpeciesUploadLSID.isSelected()) {
                usc.setTbInstructions("3. Select file (text file, one LSID or name per line)");
            } else {
                usc.setTbInstructions("3. Select file");
            }
            usc.setAddToMap(true);
            usc.setParent(this);
            usc.doModal();
        }
    } catch (Exception e) {
        LOGGER.error("file upload error", e);
    }
}
Also used : SandboxPasteController(au.org.ala.spatial.composer.sandbox.SandboxPasteController) UploadSpeciesController(au.org.ala.spatial.composer.input.UploadSpeciesController) IOException(java.io.IOException)

Example 2 with SandboxPasteController

use of au.org.ala.spatial.composer.sandbox.SandboxPasteController in project spatial-portal by AtlasOfLivingAustralia.

the class MapComposer method importSpecies.

/**
     * Species are imported through the species list tool.
     *
     * @param event
     */
public void importSpecies(Event event) {
    String type = (String) event.getData();
    if (type != null && type.length() > 0) {
        if ("assemblage".equalsIgnoreCase(type)) {
            Map params = new HashMap();
            params.put("enableImportAssemblage", true);
            openModal("WEB-INF/zul/add/AddSpecies.zul", params, "addspecieswindow");
        } else {
            if (StringUtils.isNotEmpty((String) CommonData.getSettings().getProperty("sandbox.url", null)) && CommonData.getSettings().getProperty("import.points.layers-service", "false").equals("false")) {
                String sandboxEmbedded = CommonData.getSettings().getProperty("sandbox.embedded", "false");
                if (sandboxEmbedded != null && Boolean.parseBoolean(sandboxEmbedded)) {
                    SandboxEmbeddedController spc = (SandboxEmbeddedController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxExternal.zul", getMapComposer(), null);
                    spc.setAddToMap(true);
                    spc.setParent(getMapComposer());
                    spc.doModal();
                } else {
                    SandboxPasteController spc = (SandboxPasteController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxPaste.zul", getMapComposer(), null);
                    spc.setAddToMap(true);
                    spc.setParent(getMapComposer());
                    spc.doModal();
                }
            } else {
                Map params = new HashMap();
                params.put("setTbInstructions", "3. Select file (comma separated ID (text), " + "longitude (decimal degrees), latitude(decimal degrees))");
                params.put("addToMap", true);
                openModal("WEB-INF/zul/input/UploadSpecies.zul", params, "uploadspecieswindow");
            }
        }
    }
}
Also used : SandboxPasteController(au.org.ala.spatial.composer.sandbox.SandboxPasteController) SandboxEmbeddedController(au.org.ala.spatial.composer.sandbox.SandboxEmbeddedController) RemoteMap(au.org.emii.portal.util.RemoteMap)

Example 3 with SandboxPasteController

use of au.org.ala.spatial.composer.sandbox.SandboxPasteController in project spatial-portal by AtlasOfLivingAustralia.

the class AddSpeciesController method onClick$btnUpload.

public void onClick$btnUpload(Event event) {
    try {
        if (StringUtils.isNotEmpty((String) CommonData.getSettings().getProperty("sandbox.url", null)) && CommonData.getSettings().getProperty("import.points.layers-service", "false").equals("false")) {
            SandboxPasteController spc = (SandboxPasteController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxPaste.zul", getMapComposer(), null);
            spc.setAddToMap(true);
            spc.setParent(getMapComposer());
            spc.doModal();
        } else {
            UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", getMapComposer(), null);
            if (rUploadCoordinates.isSelected()) {
                usc.setTbInstructions(CommonData.lang("instruction_upload_species_csv"));
            } else if (rUploadLSIDs.isSelected()) {
                usc.setTbInstructions(CommonData.lang("instruction_upload_species_lsids"));
            } else {
                usc.setTbInstructions(CommonData.lang("instruction_upload_species_other"));
            }
            usc.setAddToMap(true);
            usc.setDefineArea(chkArea.isChecked());
            usc.setParent(getMapComposer());
            usc.doModal();
        }
    } catch (Exception e) {
        LOGGER.error("error displaying uploadspecies.zul", e);
    }
}
Also used : SandboxPasteController(au.org.ala.spatial.composer.sandbox.SandboxPasteController) UploadSpeciesController(au.org.ala.spatial.composer.input.UploadSpeciesController) IOException(java.io.IOException)

Aggregations

SandboxPasteController (au.org.ala.spatial.composer.sandbox.SandboxPasteController)3 UploadSpeciesController (au.org.ala.spatial.composer.input.UploadSpeciesController)2 IOException (java.io.IOException)2 SandboxEmbeddedController (au.org.ala.spatial.composer.sandbox.SandboxEmbeddedController)1 RemoteMap (au.org.emii.portal.util.RemoteMap)1