use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class RolePanel method validateRoles.
/**
* validate Roles
*
**/
public void validateRoles() {
Comboitem lstItemRole = lstRole.getSelectedItem();
Comboitem lstItemClient = lstClient.getSelectedItem();
Comboitem lstItemOrg = lstOrganisation.getSelectedItem();
Comboitem lstItemWarehouse = lstWarehouse.getSelectedItem();
if (lstItemRole == null || lstItemRole.getValue() == null) {
throw new WrongValueException(lstRole, Msg.getMsg(m_ctx, "FillMandatory") + lblRole.getValue());
} else if (lstItemClient == null || lstItemClient.getValue() == null) {
throw new WrongValueException(lstClient, Msg.getMsg(m_ctx, "FillMandatory") + lblClient.getValue());
} else if (lstItemOrg == null || lstItemOrg.getValue() == null) {
throw new WrongValueException(lstOrganisation, Msg.getMsg(m_ctx, "FillMandatory") + lblOrganisation.getValue());
}
int orgId = 0, warehouseId = 0;
orgId = Integer.parseInt((String) lstItemOrg.getValue());
KeyNamePair orgKNPair = new KeyNamePair(orgId, lstItemOrg.getLabel());
KeyNamePair warehouseKNPair = null;
if (lstItemWarehouse != null && lstItemWarehouse.getValue() != null) {
warehouseId = Integer.parseInt((String) lstItemWarehouse.getValue());
warehouseKNPair = new KeyNamePair(warehouseId, lstItemWarehouse.getLabel());
}
String msg = login.validateLogin(orgKNPair);
if (msg != null && msg.length() > 0) {
throw new WrongValueException(msg);
}
msg = login.loadPreferences(orgKNPair, warehouseKNPair, null, null);
if (!(msg == null || msg.length() == 0)) {
throw new WrongValueException(msg);
}
wndLogin.loginCompleted();
// Elaine 2009/02/06 save preference to AD_Preference
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
userPreference.setProperty(UserPreference.P_LANGUAGE, Env.getContext(m_ctx, UserPreference.LANGUAGE_NAME));
userPreference.setProperty(UserPreference.P_ROLE, lstItemRole != null ? (String) lstItemRole.getValue() : "0");
userPreference.setProperty(UserPreference.P_CLIENT, lstItemClient != null ? (String) lstItemClient.getValue() : "0");
userPreference.setProperty(UserPreference.P_ORG, lstItemOrg != null ? (String) lstItemOrg.getValue() : "0");
userPreference.setProperty(UserPreference.P_WAREHOUSE, lstItemWarehouse != null ? (String) lstItemWarehouse.getValue() : "0");
userPreference.savePreference();
//
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class LoginPanel method initComponents.
private void initComponents() {
lblUserId = new Label();
lblUserId.setId("lblUserId");
lblUserId.setValue("User ID");
lblPassword = new Label();
lblPassword.setId("lblPassword");
lblPassword.setValue("Password");
lblLanguage = new Label();
lblLanguage.setId("lblLanguage");
lblLanguage.setValue("Language");
txtUserId = new Textbox();
txtUserId.setId("txtUserId");
//txtUserId.setCols(25);
txtUserId.setMaxlength(40);
//txtUserId.setWidth("220px");
// Elaine 2009/02/06
txtUserId.addEventListener(Events.ON_CHANGE, this);
txtPassword = new Textbox();
txtPassword.setId("txtPassword");
txtPassword.setType("password");
//txtPassword.setCols(25);
//txtPassword.setWidth("220px");
lstLanguage = new Combobox();
lstLanguage.setAutocomplete(true);
lstLanguage.setAutodrop(true);
lstLanguage.setId("lstLanguage");
lstLanguage.addEventListener(Events.ON_SELECT, this);
//lstLanguage.setWidth("220px");
// Update Language List
lstLanguage.getItems().clear();
ArrayList<String> supported = Env.getSupportedLanguages();
String[] availableLanguages = Language.getNames();
for (String langName : availableLanguages) {
Language language = Language.getLanguage(langName);
if (!language.isBaseLanguage()) {
if (!supported.contains(language.getAD_Language()))
continue;
}
lstLanguage.appendItem(langName, language.getAD_Language());
}
chkRememberMe = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "RememberMe"));
chkRememberMe.setId("chkRememberMe");
// Make the default language the language of client System
String defaultLanguage = MClient.get(ctx, 0).getAD_Language();
for (int i = 0; i < lstLanguage.getItemCount(); i++) {
Comboitem li = lstLanguage.getItemAtIndex(i);
if (li.getValue().equals(defaultLanguage)) {
lstLanguage.setSelectedIndex(i);
languageChanged(li.getLabel());
break;
}
}
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class WTableDirEditor method onEvent.
public void onEvent(Event event) {
if (Events.ON_SELECT.equalsIgnoreCase(event.getName())) {
Object newValue = getValue();
if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
}
} else if (Events.ON_BLUR.equalsIgnoreCase(event.getName())) {
Comboitem item = getComponent().getSelectedItem();
if (item == null) {
setValue(oldValue);
} else {
//on select not fire for empty label item
if (item.getLabel().equals("")) {
Object newValue = getValue();
if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
}
}
}
}
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class WTableDirEditor method getValue.
@Override
public Object getValue() {
Object retVal = null;
Comboitem selItem = getComponent().getSelectedItem();
if (selItem != null) {
retVal = selItem.getValue();
if ((retVal instanceof Integer) && (Integer) retVal == -1)
retVal = null;
}
return retVal;
}
use of org.zkoss.zul.Comboitem in project adempiere by adempiere.
the class WTableDirEditor method getDisplay.
@Override
public String getDisplay() {
String display = null;
Comboitem selItem = getComponent().getSelectedItem();
if (selItem != null) {
display = selItem.getLabel();
}
return display;
}
Aggregations