use of org.zkoss.zul.Comboitem in project spatial-portal by AtlasOfLivingAustralia.
the class TabulationComposer method onChange$cbTabLayer1.
public void onChange$cbTabLayer1(Event event) {
String f1DisplayNames = cbTabLayers1.getSelectedItem().getValue();
List<String> f2DisplayNamess = getFieldDisplayName2(f1DisplayNames);
if (!cbTabLayers2.getChildren().isEmpty()) {
cbTabLayers2.getChildren().clear();
}
if (f2DisplayNamess != null) {
for (int i = 0; i < f2DisplayNamess.size(); i++) {
String f2 = f2DisplayNamess.get(i);
Comboitem ci = new Comboitem(f2);
ci.setValue(f2);
ci.setParent(cbTabLayers2);
}
cbTabLayers2.setSelectedIndex(0);
} else {
LOGGER.debug("f2DisplayNames == null");
}
}
use of org.zkoss.zul.Comboitem 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.zul.Comboitem in project adempiere by adempiere.
the class WDeleteEntity method loadValues.
// dispose
/**
* Clear View
*/
private void loadValues() {
// Client
Comboitem o = clientPick.getSelectedItem();
if (o != null) {
setClientId(((KeyNamePair) o.getValue()).getKey());
}
// Table
o = tablePick.getSelectedItem();
if (o != null) {
setTableId(((KeyNamePair) o.getValue()).getKey());
}
// Dry Run
setDryRun(dryRun.isChecked());
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class Combobox method setValue.
/**
* Set selected item for the list box based on the value of list item
* set selected to none if no item found matching the value given or
* value is null
* @param value Value of ListItem to set as selected
*/
public void setValue(Object value) {
setSelectedItem(null);
if (value == null) {
return;
}
List<Comboitem> items = getItems();
for (Comboitem item : items) {
if (value.getClass() != item.getValue().getClass()) {
// if the classes of value and item are different convert both to String
String stringValue = value.toString();
String stringItem = item.getValue().toString();
if (stringValue.equals(stringItem)) {
setSelectedItem(item);
break;
}
} else {
if (value.equals(item.getValue())) {
setSelectedItem(item);
break;
}
}
}
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class FindWindow method refreshUserQueries.
private void refreshUserQueries() {
String value = m_sLast;
if (fQueryName.getItemCount() > 0) {
// The list is initialized
value = fQueryName.getValue();
}
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
fQueryName.getItems().clear();
boolean selected = false;
fQueryName.appendItem(m_sNew);
for (int i = 0; i < userQueries.length; i++) {
Comboitem ci = fQueryName.appendItem(userQueries[i].getName());
if (value.equals(userQueries[i].getName())) {
fQueryName.setSelectedItem(ci);
parseUserQuery(userQueries[i]);
selected = true;
}
}
if (!selected) {
fQueryName.setSelectedIndex(-1);
fQueryName.setText(m_sTipText);
createFields();
}
}
Aggregations