use of org.zkoss.zk.ui.event.EventListener 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();
}
});
}
use of org.zkoss.zk.ui.event.EventListener 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);
}
});
}
use of org.zkoss.zk.ui.event.EventListener 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);
}
}
use of org.zkoss.zk.ui.event.EventListener in project spatial-portal by AtlasOfLivingAustralia.
the class ToolComposer method addTolMultipleBk.
private void addTolMultipleBk(String lsid, String sciname, String family, String kingdom, boolean insertAtBeginning) {
for (Listitem li : lMultipleBk.getItems()) {
Listcell lsidCell = (Listcell) li.getLastChild();
Listcell scinameCell = (Listcell) li.getFirstChild().getNextSibling();
if ((lsidCell.getLabel().equals(lsid)) || (scinameCell.getLabel().replace("(not found)", "").trim().equals(sciname))) {
return;
}
}
Listitem li = new Listitem();
// remove button
Listcell lc = new Listcell("x");
lc.setSclass("xRemove");
lc.addEventListener(StringConstants.ONCLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
Listitem li = (Listitem) event.getTarget().getParent();
li.detach();
toggles();
}
});
lc.setParent(li);
// sci name
if (lsid == null) {
lc = new Listcell(sciname + " (not found)");
lc.setSclass("notFoundSciname");
} else {
lc = new Listcell(sciname);
}
lc.setParent(li);
// family
if (lsid == null) {
lc = new Listcell("click to search");
lc.setSclass("notFoundFamily");
lc.addEventListener(StringConstants.ONCLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
Listitem li = (Listitem) event.getTarget().getParent();
Listcell scinameCell = (Listcell) li.getFirstChild().getNextSibling();
String sciname = scinameCell.getLabel().replace("(not found)", "").trim();
mSearchSpeciesACCompBk.getAutoComplete().refresh(sciname);
mSearchSpeciesACCompBk.getAutoComplete().open();
mSearchSpeciesACCompBk.getAutoComplete().setText(sciname + " ");
li.detach();
toggles();
}
});
} else {
lc = new Listcell(family);
}
lc.setParent(li);
// kingdom
lc = new Listcell(kingdom);
lc.setParent(li);
// count
if (lsid != null) {
int count = new BiocacheQuery(lsid, null, null, null, false, getGeospatialKosherBk()).getOccurrenceCount();
if (count > 0) {
lc = new Listcell(String.valueOf(count));
} else {
lc = new Listcell(kingdom);
}
} else {
lc = new Listcell(kingdom);
}
lc.setParent(li);
// lsid
lc = new Listcell(lsid);
lc.setParent(li);
if (insertAtBeginning && !lMultipleBk.getChildren().isEmpty()) {
lMultipleBk.insertBefore(li, lMultipleBk.getFirstChild());
} else {
li.setParent(lMultipleBk);
}
}
use of org.zkoss.zk.ui.event.EventListener in project spatial-portal by AtlasOfLivingAustralia.
the class ToolComposer method addToMpLayers.
void addToMpLayers(MapLayer ml, boolean analysis) {
// get layer name
String name = null;
String url = ml.getUri();
if (analysis) {
name = ml.getName();
} else {
int p1 = url.indexOf("&style=") + 7;
int p2 = url.indexOf("_style", p1);
if (p1 > 4) {
if (p2 < 0) {
p2 = url.length();
}
name = url.substring(p1, p2);
}
}
// cbLayer1
Menuitem mi = new Menuitem(ml.getDisplayName());
mi.setValue(name);
mi.addEventListener(StringConstants.ONCLICK, new EventListener() {
public void onEvent(Event event) {
Menuitem mi = (Menuitem) event.getTarget();
String displayname = ((JSONObject) CommonData.getLayer(mi.getValue()).get("layer")).get("displayname").toString();
cbLayer1.setValue(displayname + " ");
cbLayer1.refresh(displayname);
for (Object o : cbLayer1.getItems()) {
Comboitem ci = (Comboitem) o;
JSONObject jo = ci.getValue();
if (jo.get(StringConstants.NAME).toString().equals(displayname)) {
cbLayer1.setSelectedItem(ci);
cbLayer1.setText(ci.getLabel());
toggles();
return;
}
}
}
});
mi.setParent(mpLayer1);
// cbLayer2
mi = new Menuitem(ml.getDisplayName());
mi.setValue(name);
mi.addEventListener(StringConstants.ONCLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
Menuitem mi = (Menuitem) event.getTarget();
String displayname = ((JSONObject) CommonData.getLayer(mi.getValue()).get("layer")).get("displayname").toString();
cbLayer2.setValue(displayname + " ");
cbLayer2.refresh(displayname);
for (Object o : cbLayer2.getItems()) {
Comboitem ci = (Comboitem) o;
JSONObject jo = ci.getValue();
if (jo.get(StringConstants.NAME).equals(displayname)) {
cbLayer2.setSelectedItem(ci);
cbLayer2.setText(ci.getLabel());
toggles();
return;
}
}
}
});
mi.setParent(mpLayer2);
}
Aggregations