Search in sources :

Example 1 with Event

use of org.zkoss.zk.ui.event.Event in project spatial-portal by AtlasOfLivingAustralia.

the class AreaReportController method listJournalmap.

public void listJournalmap() {
    if (journalmapHtml != null) {
        Event ev = new Event(StringConstants.ONCLICK, this, "Journalmap Documents\n" + journalmapHtml);
        getMapComposer().openHTML(ev);
    }
}
Also used : Event(org.zkoss.zk.ui.event.Event) ListDataEvent(javax.swing.event.ListDataEvent) ForwardEvent(org.zkoss.zk.ui.event.ForwardEvent) SpeciesListEvent(au.org.ala.spatial.composer.quicklinks.SpeciesListEvent) SamplingEvent(au.org.ala.spatial.composer.quicklinks.SamplingEvent)

Example 2 with Event

use of org.zkoss.zk.ui.event.Event in project spatial-portal by AtlasOfLivingAustralia.

the class ExternalContentComposer method doOverlapped.

@Override
public void doOverlapped() {
    super.doOverlapped();
    this.getFellow("hide").addEventListener(StringConstants.ONCLICK, new EventListener() {

        public void onEvent(Event event) throws Exception {
            close();
        }
    });
    this.getFellow(StringConstants.RESET).addEventListener(StringConstants.ONCLICK, new EventListener() {

        public void onEvent(Event event) throws Exception {
            Events.echoEvent(StringConstants.SET_SRC, event.getTarget().getParent().getParent(), null);
        }
    });
    this.getFellow(StringConstants.BREAKOUT).addEventListener(StringConstants.ONCLICK, new EventListener() {

        public void onEvent(Event event) throws Exception {
            close();
        }
    });
}
Also used : Event(org.zkoss.zk.ui.event.Event) EventListener(org.zkoss.zk.ui.event.EventListener)

Example 3 with Event

use of org.zkoss.zk.ui.event.Event in project spatial-portal by AtlasOfLivingAustralia.

the class AreaUploadShapefile method afterCompose.

@Override
public void afterCompose() {
    super.afterCompose();
    txtLayerName.setValue(getMapComposer().getNextAreaLayerName(CommonData.lang(StringConstants.DEFAULT_AREA_LAYER_NAME)));
    fileUpload.addEventListener("onUpload", new EventListener() {

        public void onEvent(Event event) throws Exception {
            onClick$btnOk(event);
        }
    });
}
Also used : Event(org.zkoss.zk.ui.event.Event) ForwardEvent(org.zkoss.zk.ui.event.ForwardEvent) UploadEvent(org.zkoss.zk.ui.event.UploadEvent) EventListener(org.zkoss.zk.ui.event.EventListener) ParseException(com.vividsolutions.jts.io.ParseException) SuspendNotAllowedException(org.zkoss.zk.ui.SuspendNotAllowedException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 4 with Event

use of org.zkoss.zk.ui.event.Event in project spatial-portal by AtlasOfLivingAustralia.

the class TabulationComposer method onFinish.

@Override
public boolean onFinish() {
    String f1DisplayName = cbTabLayers1.getSelectedItem().getValue();
    String f2DisplayName = cbTabLayers2.getSelectedItem().getValue();
    String f1Name = "", f2Name = "";
    Iterator<FieldDTO> it = tabLayers.keySet().iterator();
    while (it.hasNext()) {
        FieldDTO fi = it.next();
        if (f1DisplayName.equals(fi.getDisplayName())) {
            f1Name = fi.getName();
        } else if (f2DisplayName.equals(fi.getDisplayName())) {
            f2Name = fi.getName();
        }
    }
    Event e = new Event("tabulation", this, CommonData.getLayersServer() + "/tabulation/" + cbTabType.getSelectedItem().getValue() + "/" + f1Name + "/" + f2Name + "/tabulation.html" + "\n" + StringConstants.TABULATION + "\n" + CommonData.getLayersServer() + "/tabulation/" + cbTabType.getSelectedItem().getValue() + "/" + f1Name + "/" + f2Name + "/tabulation.csv");
    getMapComposer().openUrl(e);
    remoteLogger.logMapAnalysis(StringConstants.TABULATION, "Tool - Tabulation", "", "", f1Name + ":" + f2Name, "", (String) cbTabType.getSelectedItem().getValue(), StringConstants.STARTED);
    this.detach();
    return true;
}
Also used : Event(org.zkoss.zk.ui.event.Event) FieldDTO(au.org.ala.spatial.dto.FieldDTO)

Example 5 with Event

use of org.zkoss.zk.ui.event.Event in project spatial-portal by AtlasOfLivingAustralia.

the class TabulationComposer method afterCompose.

@Override
public void afterCompose() {
    super.afterCompose();
    this.selectedMethod = StringConstants.TABULATION;
    this.totalSteps = 1;
    this.updateWindowTitle();
    cbTabLayers1.setFocus(true);
    tabLayers = new HashMap<FieldDTO, List<FieldDTO>>();
    tabLayerDisplayNames = new HashMap<String, List<String>>();
    try {
        int i;
        HttpClient client = new HttpClient();
        GetMethod get = new GetMethod(CommonData.getLayersServer() + "/tabulations.json");
        get.addRequestHeader(StringConstants.ACCEPT, StringConstants.APPLICATION_JSON);
        client.executeMethod(get);
        String tlayers = get.getResponseBodyAsString();
        JSONParser jp = new JSONParser();
        JSONObject joTop = (JSONObject) jp.parse(tlayers);
        JSONArray joarr = (JSONArray) joTop.get("tabulations");
        for (i = 0; i < joarr.size(); i++) {
            JSONObject jo = (JSONObject) joarr.get(i);
            FieldDTO f1 = new FieldDTO(jo.get("fid1").toString(), jo.get("name1").toString(), "");
            FieldDTO f2 = new FieldDTO(jo.get("fid2").toString(), jo.get("name2").toString(), "");
            load(f1, f2);
            load(f2, f1);
        }
        Set keySet = (Set) tabLayerDisplayNames.keySet();
        List keyList = new ArrayList(keySet);
        Collections.sort(keyList);
        LOGGER.debug("keyList1=" + keyList);
        for (int j = 0; j < keyList.size(); j++) {
            String temp = (String) keyList.get(j);
            LOGGER.debug("temp=" + temp);
            Comboitem ci = new Comboitem(temp);
            ci.setValue(temp);
            ci.setParent(cbTabLayers1);
        }
        cbTabLayers1.addEventListener("onChange", new EventListener() {

            public void onEvent(Event event) throws Exception {
                onChange$cbTabLayer1(event);
            }
        });
        cbTabLayers1.setSelectedIndex(0);
        onChange$cbTabLayer1(null);
        cbTabLayers2.setSelectedIndex(0);
        cbTabType.setSelectedIndex(0);
    } catch (Exception e) {
        LOGGER.debug("Unable to call tabulation service for a list of layers", e);
    }
}
Also used : JSONArray(org.json.simple.JSONArray) JSONObject(org.json.simple.JSONObject) HttpClient(org.apache.commons.httpclient.HttpClient) GetMethod(org.apache.commons.httpclient.methods.GetMethod) Event(org.zkoss.zk.ui.event.Event) JSONParser(org.json.simple.parser.JSONParser) Comboitem(org.zkoss.zul.Comboitem) EventListener(org.zkoss.zk.ui.event.EventListener) FieldDTO(au.org.ala.spatial.dto.FieldDTO)

Aggregations

Event (org.zkoss.zk.ui.event.Event)60 EventListener (org.zkoss.zk.ui.event.EventListener)42 JSONObject (org.json.simple.JSONObject)11 ForwardEvent (org.zkoss.zk.ui.event.ForwardEvent)9 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)7 Component (org.zkoss.zk.ui.Component)7 CheckEvent (org.zkoss.zk.ui.event.CheckEvent)7 LegendObject (au.org.ala.legend.LegendObject)6 IOException (java.io.IOException)6 SQLException (java.sql.SQLException)6 JSONParser (org.json.simple.parser.JSONParser)6 Center (org.zkoss.zul.Center)6 MapLayer (au.org.emii.portal.menu.MapLayer)5 JSONArray (org.json.simple.JSONArray)5 Borderlayout (org.zkoss.zul.Borderlayout)5 Tabpanel (org.adempiere.webui.component.Tabpanel)4 WTableModelEvent (org.adempiere.webui.event.WTableModelEvent)4 ParseException (org.json.simple.parser.ParseException)4 Div (org.zkoss.zul.Div)4 North (org.zkoss.zul.North)4