use of org.compiere.util.Language in project lar_361 by comitsrl.
the class ALogin method connectionOK.
// actionPerformed
/**
************************************************************************
* Connection OK pressed
*/
private void connectionOK() {
log.info("");
//
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
confirmPanel.getOKButton().setEnabled(false);
m_connectionOK = tryConnection();
if (m_connectionOK) {
// Verify Language & Load Msg
Language l = Language.getLoginLanguage();
Env.verifyLanguage(m_ctx, l);
Env.setContext(m_ctx, Env.LANGUAGE, l.getAD_Language());
Msg.getMsg(m_ctx, "0");
// Migration
MSystem system = MSystem.get(m_ctx);
if (system.isJustMigrated()) {
statusBar.setStatusLine("Running: After Migration ....", true);
ADialog.info(m_WindowNo, this, "AfterMigration");
Thread.yield();
DB.afterMigration(m_ctx);
}
// Set Defaults
printerField.setValue(Ini.getProperty(Ini.P_PRINTER));
// Change Tab to Default
loginTabPane.setSelectedIndex(1);
}
confirmPanel.getOKButton().setEnabled(true);
setCursor(Cursor.getDefaultCursor());
}
use of org.compiere.util.Language 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.compiere.util.Language in project adempiere by adempiere.
the class ADServiceImpl method login.
public ADLoginResponseDocument login(ADLoginRequestDocument req) throws XFireFault {
authenticate(webServiceName, "login");
// TODO: Implement security layer
log.log(Level.SEVERE, "Warning: Security layer not implemented yet - opening web service " + webServiceName + " implies a security risk for server");
ADLoginResponseDocument res = ADLoginResponseDocument.Factory.newInstance();
ADLoginResponse lr = res.addNewADLoginResponse();
ADLoginRequest r = req.getADLoginRequest();
if (// initial phase - return possible translations
r.getStage() == 0) {
LookupValues langs = lr.addNewLangs();
for (int i = 0; i < Language.getLanguageCount(); i++) {
Language language = Language.getLanguage(i);
LookupValue lv = langs.addNewLv();
lv.setKey(language.getAD_Language());
lv.setVal(language.getName());
}
} else if (// Verify user and pass
r.getStage() == 1) {
KeyNamePair[] roles = null;
KeyNamePair[] clients = null;
KeyNamePair[] orgs = null;
KeyNamePair[] warehouses = null;
Login login = new Login(m_cs.getM_ctx());
roles = login.getRoles(r.getUser(), r.getPass());
if (roles == null) {
lr.setStatus(-1);
return res;
} else {
if (r.getRoleID() == -1 && roles != null && roles.length > 0)
r.setRoleID(Integer.parseInt(roles[0].getID()));
if (r.getRoleID() > -1)
clients = login.getClients(new KeyNamePair(r.getRoleID(), ""));
if (r.getClientID() == -1 && clients != null && clients.length > 0)
r.setClientID(Integer.parseInt(clients[0].getID()));
if (r.getClientID() > -1)
orgs = login.getOrgs(new KeyNamePair(r.getClientID(), ""));
if (r.getOrgID() == -1 && orgs != null && orgs.length > 0)
r.setOrgID(Integer.parseInt(orgs[0].getID()));
if (r.getOrgID() > -1)
warehouses = login.getWarehouses(new KeyNamePair(r.getOrgID(), ""));
ADLookup.fillLookupValues(lr.addNewRoles(), roles);
ADLookup.fillLookupValues(lr.addNewClients(), clients);
ADLookup.fillLookupValues(lr.addNewOrgs(), orgs);
ADLookup.fillLookupValues(lr.addNewWarehouses(), warehouses);
}
} else if (// Verify user and pass
r.getStage() == 2) {
Login login = new Login(m_cs.getM_ctx());
KeyNamePair[] roles = login.getRoles(r.getUser(), r.getPass());
if (roles != null) {
KeyNamePair org = new KeyNamePair(r.getRoleID(), Integer.toString(r.getRoleID()));
String error = login.validateLogin(org);
if (error != null && error.length() > 0) {
lr.setStatus(-1);
return res;
}
int AD_User_ID = Env.getAD_User_ID(m_cs.getM_ctx());
if (!m_cs.login(AD_User_ID, r.getRoleID(), r.getClientID(), r.getOrgID(), r.getWarehouseID(), r.getLang())) {
lr.setStatus(-1);
return res;
}
} else {
lr.setStatus(-1);
return res;
}
}
return res;
}
use of org.compiere.util.Language in project adempiere by adempiere.
the class ReportProcessor method runReport.
// ReportServer
public JasperPrint runReport() {
System.setProperty("jasper.reports.compile.keep.java.file", "true");
ReportPool rp = new ReportPool();
ReportInfo reportInfo = rp.getReport(m_AD_Process_ID);
rp = null;
if (!reportInfo.hasError() && reportInfo.getJasperReport() != null) {
// add parameter
m_Param.putAll(reportInfo.getSubReport());
addProcessParameters(m_AD_PInstance_ID, m_Param);
m_Param.put("RECORD_ID", new Integer(m_Record_ID));
// Marco LOMBARDO: REPORT_HOME used to express subreports path.
//System.getProperty("REPORT_HOME"));
m_Param.put("REPORT_HOME", REPORT_PATH__fix);
// End Marco LOMBARDO.
Language currLang = Env.getLanguage(Env.getCtx());
m_Param.put("CURRENT_LANG", currLang.getAD_Language());
java.sql.Connection conn = DB.getConnectionRO();
//DB_CONN
m_Param.put("REPORT_CONNECTION", conn);
m_Param.put("DB_CONN", conn);
System.out.println("REPORT_CONNECTION = " + conn.toString());
log.saveError("REPORT_CONNECTION = " + conn.toString(), "");
// fill report
try {
compiereDataSource ds = CompiereDataSourceFactory.createDataSource(m_ctx, reportInfo, m_pi, m_Param);
//compiereDataSource ds = new compiereDataSource (m_ctx, reportInfo.getJasperReport());
m_jasperPrint = JasperFillManager.fillReport(reportInfo.getJasperReport(), m_Param, ds);
ds.close();
log.finest("ReportProcessor.fillReport");
} catch (JRException e) {
m_jasperPrint = null;
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
} else
System.out.println("Error:" + reportInfo.getErrorMsg());
return m_jasperPrint;
}
use of org.compiere.util.Language in project adempiere by adempiere.
the class WOrderReceiptIssue method fillPicks.
// init
/**
* Fill Picks
* Column_ID from C_Order
* This is only run as part of the windows initialization process
* @throws Exception if Lookups cannot be initialized
*/
private void fillPicks() throws Exception {
Properties ctx = Env.getCtx();
// Base Language
Language language = Language.getLoginLanguage();
MLookup orderLookup = MLookupFactory.get(ctx, m_WindowNo, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_PP_Order_ID), DisplayType.Search, language, "PP_Order_ID", 0, false, "PP_Order.DocStatus = '" + MPPOrder.DOCACTION_Complete + "'");
orderField = new WSearchEditor(MPPOrder.COLUMNNAME_PP_Order_ID, false, false, true, orderLookup);
orderField.addValueChangeListener(this);
MLookup resourceLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_S_Resource_ID), DisplayType.TableDir);
resourceField = new WSearchEditor(MPPOrder.COLUMNNAME_S_Resource_ID, false, false, false, resourceLookup);
MLookup warehouseLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir);
warehouseField = new WSearchEditor(MPPOrder.COLUMNNAME_M_Warehouse_ID, false, false, false, warehouseLookup);
MLookup productLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Product_ID), DisplayType.TableDir);
productField = new WSearchEditor(MPPOrder.COLUMNNAME_M_Product_ID, false, false, false, productLookup);
MLookup uomLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
uomField = new WSearchEditor(MPPOrder.COLUMNNAME_C_UOM_ID, false, false, false, uomLookup);
MLookup uomOrderLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
uomorderField = new WSearchEditor(MPPOrder.COLUMNNAME_C_UOM_ID, false, false, false, uomOrderLookup);
MLocatorLookup locatorL = new MLocatorLookup(ctx, m_WindowNo);
locatorField = new WLocatorEditor(MLocator.COLUMNNAME_M_Locator_ID, true, false, true, locatorL, m_WindowNo);
// Tab, Window
int m_Window = MWindow.getWindow_ID("Manufacturing Order");
GridFieldVO vo = GridFieldVO.createStdField(ctx, m_WindowNo, 0, m_Window, MTab.getTab_ID(m_Window, "Manufacturing Order"), false, false, false);
vo.AD_Column_ID = MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID);
vo.ColumnName = MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID;
vo.displayType = DisplayType.PAttribute;
GridField field = new GridField(vo);
// M_AttributeSetInstance_ID
attribute = new WPAttributeEditor(field.getGridTab(), field);
attribute.setReadWrite(true);
attribute.setValue(0);
// 4Layers - Further init
scrapQtyField.setValue(Env.ZERO);
rejectQty.setValue(Env.ZERO);
// 4Layers - end
pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@IsBackflush@"), 1);
pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@OnlyIssue@"), 2);
pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@OnlyReceiptProduct@"), 3);
pickcombo.addEventListener(Events.ON_CHANGE, this);
Process.addActionListener(this);
toDeliverQty.addValueChangeListener(this);
scrapQtyField.addValueChangeListener(this);
}
Aggregations