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();
}
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class LoginPanel method onUserIdChange.
private void onUserIdChange() {
String userId = txtUserId.getValue();
if (userId != null && userId.length() > 0) {
int AD_User_ID = DB.getSQLValue(null, "SELECT AD_User_ID FROM AD_User WHERE Name = ?", userId);
if (AD_User_ID > 0) {
// Elaine 2009/02/06 Load preference from AD_Preference
UserPreference userPreference = SessionManager.getSessionApplication().loadUserPreference(AD_User_ID);
String initDefault = userPreference.getProperty(UserPreference.P_LANGUAGE);
for (int i = 0; i < lstLanguage.getItemCount(); i++) {
Comboitem li = lstLanguage.getItemAtIndex(i);
if (li.getLabel().equals(initDefault)) {
lstLanguage.setSelectedIndex(i);
// Elaine 2009/04/17 language changed
languageChanged(li.getLabel());
break;
}
}
}
}
}
Aggregations