Search in sources :

Example 1 with PasteLayerListController

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

the class ToolComposer method onSelect$selectedLayersCombobox.

public void onSelect$selectedLayersCombobox(Event event) {
    Comboitem ci = selectedLayersCombobox.getSelectedItem();
    if (ci != null && lbListLayers != null) {
        String layersList = null;
        if (ci.getValue() != null && ci.getValue() instanceof LayerSelection) {
            layersList = ((LayerSelection) ci.getValue()).getLayers();
        } else {
            if (ci.getValue() == null) {
                if (ci.getLabel().toLowerCase().contains("paste")) {
                    PasteLayerListController window = (PasteLayerListController) Executions.createComponents("WEB-INF/zul/input/PasteLayerList.zul", this, null);
                    window.setCallback(new EventListener() {

                        @Override
                        public void onEvent(Event event) throws Exception {
                            selectLayerFromList((String) event.getData());
                            updateLayerSelectionCount();
                        }
                    });
                    try {
                        window.setParent(this);
                        window.doModal();
                    } catch (Exception e) {
                        LOGGER.error("error opening PasteLayerList.zul", e);
                    }
                } else if (ci.getLabel().toLowerCase().contains("import")) {
                    UploadLayerListController window = (UploadLayerListController) Executions.createComponents("WEB-INF/zul/input/UploadLayerList.zul", this, null);
                    window.setCallback(new EventListener() {

                        @Override
                        public void onEvent(Event event) throws Exception {
                            selectLayerFromList((String) event.getData());
                            updateLayerSelectionCount();
                        }
                    });
                    try {
                        window.setParent(this);
                        window.doModal();
                    } catch (Exception e) {
                        LOGGER.error("error opening UploadLayerList.zul", e);
                    }
                }
                selectedLayersCombobox.setSelectedIndex(-1);
            }
        }
        selectLayerFromList(layersList);
    }
}
Also used : UploadLayerListController(au.org.ala.spatial.composer.input.UploadLayerListController) PasteLayerListController(au.org.ala.spatial.composer.input.PasteLayerListController) EventListener(org.zkoss.zk.ui.event.EventListener) IOException(java.io.IOException)

Aggregations

PasteLayerListController (au.org.ala.spatial.composer.input.PasteLayerListController)1 UploadLayerListController (au.org.ala.spatial.composer.input.UploadLayerListController)1 IOException (java.io.IOException)1 EventListener (org.zkoss.zk.ui.event.EventListener)1