Search in sources :

Example 1 with UploadSpeciesController

use of au.org.ala.spatial.composer.input.UploadSpeciesController in project spatial-portal by AtlasOfLivingAustralia.

the class ToolComposer method onUpload$fileUpload.

public void onUpload$fileUpload(Event event) {
    UploadEvent ue = null;
    UserDataDTO ud = null;
    if (event instanceof UploadEvent) {
        ue = (UploadEvent) event;
    } else if (event instanceof ForwardEvent) {
        ue = (UploadEvent) ((ForwardEvent) event).getOrigin();
    }
    Media m = ue.getMedia();
    if (ud == null) {
        ud = new UserDataDTO(m.getName());
    }
    if (ud.getName().trim().isEmpty()) {
        ud.setName(m.getName());
    }
    ud.setFilename(m.getName());
    if (ud.getName() == null || ud.getName().length() == 0) {
        ud.setName(m.getName());
    }
    if (ud.getDescription() == null || ud.getDescription().length() == 0) {
        ud.setDescription(m.getName());
    }
    ud.setUploadedTimeInMs(System.currentTimeMillis());
    UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", this, null);
    usc.setAddToMap(false);
    if (rgSpeciesBk != null) {
        if (rgSpeciesBk.getSelectedItem() == rSpeciesUploadLSIDBk) {
            usc.setUploadType(StringConstants.ASSEMBLAGE_BK);
        } else if (rgSpeciesBk.getSelectedItem() == rSpeciesUploadSpeciesBk) {
            usc.setUploadType("bk");
        }
    }
    usc.setVisible(false);
    usc.doOverlapped();
    usc.doFileUpload(ud, event);
    usc.detach();
}
Also used : UploadSpeciesController(au.org.ala.spatial.composer.input.UploadSpeciesController) Media(org.zkoss.util.media.Media) UserDataDTO(au.org.ala.spatial.dto.UserDataDTO)

Example 2 with UploadSpeciesController

use of au.org.ala.spatial.composer.input.UploadSpeciesController 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 3 with UploadSpeciesController

use of au.org.ala.spatial.composer.input.UploadSpeciesController 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

UploadSpeciesController (au.org.ala.spatial.composer.input.UploadSpeciesController)3 SandboxPasteController (au.org.ala.spatial.composer.sandbox.SandboxPasteController)2 IOException (java.io.IOException)2 UserDataDTO (au.org.ala.spatial.dto.UserDataDTO)1 Media (org.zkoss.util.media.Media)1