Search in sources :

Example 21 with Language

use of org.compiere.util.Language in project adempiere by adempiere.

the class LoginPanel method languageChanged.

private void languageChanged(String langName) {
    Language language = findLanguage(langName);
    //	Locales
    Locale loc = language.getLocale();
    Locale.setDefault(loc);
    res = ResourceBundle.getBundle(RESOURCE, loc);
    lblUserId.setValue(res.getString("User"));
    lblPassword.setValue(res.getString("Password"));
    lblLanguage.setValue(res.getString("Language"));
    chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe"));
}
Also used : Locale(java.util.Locale) Language(org.compiere.util.Language)

Example 22 with Language

use of org.compiere.util.Language in project adempiere by adempiere.

the class LoginPanel method findLanguage.

private Language findLanguage(String langName) {
    Language tmp = Language.getLanguage(langName);
    Language language = new Language(tmp.getName(), tmp.getAD_Language(), tmp.getLocale(), tmp.isDecimalPoint(), tmp.getDateFormat().toPattern(), tmp.getMediaSize());
    Env.verifyLanguage(ctx, language);
    Env.setContext(ctx, Env.LANGUAGE, language.getAD_Language());
    Env.setContext(ctx, AEnv.LOCALE, language.getLocale().toString());
    return language;
}
Also used : Language(org.compiere.util.Language)

Example 23 with Language

use of org.compiere.util.Language in project adempiere by adempiere.

the class WTreeBOM method preInit.

//  dynInit
private void preInit() throws Exception {
    Properties ctx = getCtx();
    // Base Language
    Language language = Language.getLoginLanguage();
    MLookup m_fieldProduct = MLookupFactory.get(ctx, m_WindowNo, MColumn.getColumn_ID(MProduct.Table_Name, "M_Product_ID"), DisplayType.Search, language, MProduct.COLUMNNAME_M_Product_ID, 0, false, " M_Product.IsSummary = 'N'");
    fieldProduct = new WSearchEditor("M_Product_ID", true, false, true, m_fieldProduct) {

        public void setValue(Object value) {
            super.setValue(value);
            action_loadBOM();
        }
    };
    implosion.addActionListener(this);
}
Also used : Language(org.compiere.util.Language) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) Properties(java.util.Properties)

Example 24 with Language

use of org.compiere.util.Language in project adempiere by adempiere.

the class WMRPDetailed method statInit.

private void statInit() throws Exception {
    //Resource Lookup 
    // Base Language
    Language language = Language.getLoginLanguage();
    MLookup resourceL = MLookupFactory.get(getCtx(), p_WindowNo, MColumn.getColumn_ID(MResource.Table_Name, MResource.COLUMNNAME_S_Resource_ID), DisplayType.TableDir, language, MResource.COLUMNNAME_S_Resource_ID, 0, false, MResource.Table_Name + "." + MResource.COLUMNNAME_ManufacturingResourceType + "= '" + MResource.MANUFACTURINGRESOURCETYPE_Plant + "'");
    fResource_ID = new WSearchEditor(MPPMRP.COLUMNNAME_S_Resource_ID, false, false, true, resourceL) {

        private final long serialVersionUID = 1L;

        public void setValue(Object arg0) {
            super.setValue(arg0);
        }

        ;
    };
    fPlanner_ID = new WSearchEditor(MPPMRP.COLUMNNAME_Planner_ID, false, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPPProductPlanning.Table_Name, MPPMRP.COLUMNNAME_Planner_ID), DisplayType.Table)) {

        private final long serialVersionUID = 1L;

        public void setValue(Object arg0) {
            super.setValue(arg0);
        }

        ;
    };
    fWarehouse_ID = new WSearchEditor(MPPMRP.COLUMNNAME_M_Warehouse_ID, false, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MWarehouse.Table_Name, MPPMRP.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir)) {

        private final long serialVersionUID = 1L;

        public void setValue(Object arg0) {
            super.setValue(arg0);
        }

        ;
    };
    fMaster.setSelected(false);
    fMaster.setEnabled(false);
    fMRPReq.setSelected(false);
    fMRPReq.setEnabled(false);
    fCreatePlan.setSelected(false);
    fCreatePlan.setEnabled(false);
    lUOM.setText(Msg.translate(getCtx(), MUOM.COLUMNNAME_C_UOM_ID));
    fUOM.setReadonly(true);
    lType.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Policy));
    fType.setReadonly(true);
    lOrderPeriod.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Period));
    fOrderPeriod.setReadWrite(false);
    lTimefence.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_TimeFence));
    fTimefence.setReadWrite(false);
    lLeadtime.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_DeliveryTime_Promised));
    fLeadtime.setReadWrite(false);
    lMinOrd.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Min));
    fMinOrd.setReadWrite(false);
    lMaxOrd.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Max));
    fMaxOrd.setReadWrite(false);
    lOrdMult.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Pack));
    fOrdMult.setReadWrite(false);
    lOrderQty.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Qty));
    fOrderQty.setReadWrite(false);
    lYield.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Yield));
    fYield.setReadWrite(false);
    lOnhand.setText(Msg.translate(getCtx(), MStorage.COLUMNNAME_QtyOnHand));
    fOnhand.setReadWrite(false);
    lSafetyStock.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_SafetyStock));
    fSafetyStock.setReadWrite(false);
    lReserved.setText(Msg.translate(getCtx(), MStorage.COLUMNNAME_QtyReserved));
    fReserved.setReadWrite(false);
    lAvailable.setText(Msg.translate(getCtx(), "QtyAvailable"));
    fAvailable.setReadWrite(false);
    lOrdered.setText(Msg.translate(getCtx(), MPPOrder.COLUMNNAME_QtyOrdered));
    fOrdered.setReadWrite(false);
    //Product Lookup
    fProduct_ID = new WSearchEditor(MPPMRP.COLUMNNAME_M_Product_ID, true, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MProduct.Table_Name, MPPMRP.COLUMNNAME_M_Product_ID), DisplayType.Search)) {

        private final long serialVersionUID = 1L;

        public void setValue(Object arg0) {
            super.setValue(arg0);
        }

        ;
    };
    fMaster.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_IsMPS));
    fMRPReq.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_IsRequiredMRP));
    fCreatePlan.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_IsCreatePlan));
    //AttributeSet Button
    fAttrSetInstance_ID = new Button() {

        private final long serialVersionUID = 1L;

        private Object m_value;

        public void setLabel(String text) {
            if (text == null) {
                text = "---";
            }
            if (text.length() > 23) {
                text = text.substring(0, 20) + "...";
            }
            super.setLabel(text);
        }

        public void setValue(Object arg0) {
            m_value = arg0;
            int i = (arg0 instanceof Integer) ? ((Integer) arg0).intValue() : 0;
            if (i == 0) {
                setLabel(null);
            }
        }

        public Object getValue() {
            return m_value;
        }
    };
    fAttrSetInstance_ID.addActionListener(new EventListener() {

        @Override
        public void onEvent(Event event) throws Exception {
            selectAttributeSetInstance();
        }
    });
    //
    fDateFrom.getComponent().setTooltiptext(Msg.translate(getCtx(), MLot.COLUMNNAME_DateFrom));
    fDateTo.getComponent().setTooltiptext(Msg.translate(getCtx(), MLot.COLUMNNAME_DateTo));
    fSupplyType = new WSearchEditor(MPPMRP.COLUMNNAME_TypeMRP, false, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPPMRP.Table_Name, MPPMRP.COLUMNNAME_TypeMRP), DisplayType.List));
    Rows rows = null;
    Row row = null;
    rows = new Rows();
    rows.setParent(parameterPanel);
    //  1st Row
    row = rows.newRow();
    row.appendChild(lProduct_ID.rightAlign());
    row.appendChild(fProduct_ID.getComponent());
    row.appendChild(lUOM.rightAlign());
    row.appendChild(fUOM);
    row.appendChild(lType.rightAlign());
    row.appendChild(fType);
    //  2nd Row
    row = rows.newRow();
    row.appendChild(lAttrSetInstance_ID.rightAlign());
    row.appendChild(fAttrSetInstance_ID);
    row.appendChild(lOnhand.rightAlign());
    row.appendChild(fOnhand.getComponent());
    row.appendChild(lOrderPeriod.rightAlign());
    row.appendChild(fOrderPeriod.getComponent());
    //  3rd Row
    row = rows.newRow();
    row.appendChild(lPlanner_ID.rightAlign());
    row.appendChild(fPlanner_ID.getComponent());
    row.appendChild(lSafetyStock.rightAlign());
    row.appendChild(fSafetyStock.getComponent());
    row.appendChild(lMinOrd.rightAlign());
    row.appendChild(fMinOrd.getComponent());
    //  4th Row
    row = rows.newRow();
    row.appendChild(lWarehouse_ID.rightAlign());
    row.appendChild(fWarehouse_ID.getComponent());
    row.appendChild(lReserved.rightAlign());
    row.appendChild(fReserved.getComponent());
    row.appendChild(lMaxOrd.rightAlign());
    row.appendChild(fMaxOrd.getComponent());
    //  5th Row
    row = rows.newRow();
    row.appendChild(lResource_ID.rightAlign());
    row.appendChild(fResource_ID.getComponent());
    row.appendChild(lAvailable.rightAlign());
    row.appendChild(fAvailable.getComponent());
    row.appendChild(lOrdMult.rightAlign());
    row.appendChild(fOrdMult.getComponent());
    //  6th Row
    row = rows.newRow();
    row.appendChild(lDateFrom.rightAlign());
    row.appendChild(fDateFrom.getComponent());
    row.appendChild(lOrdered.rightAlign());
    row.appendChild(fOrdered.getComponent());
    row.appendChild(lOrderQty.rightAlign());
    row.appendChild(fOrderQty.getComponent());
    //  7th Row
    row = rows.newRow();
    row.appendChild(lDateTo.rightAlign());
    row.appendChild(fDateTo.getComponent());
    row.appendChild(new Space());
    row.appendChild(new Space());
    row.appendChild(lTimefence.rightAlign());
    row.appendChild(fTimefence.getComponent());
    //  8th Row
    row = rows.newRow();
    row.appendChild(new Space());
    row.appendChild(fMaster);
    row.appendChild(new Space());
    row.appendChild(fCreatePlan);
    row.appendChild(lLeadtime.rightAlign());
    row.appendChild(fLeadtime.getComponent());
    //  9th Row
    row = rows.newRow();
    row.appendChild(new Space());
    row.appendChild(new Space());
    row.appendChild(new Space());
    row.appendChild(fMRPReq);
    row.appendChild(lYield.rightAlign());
    row.appendChild(fYield.getComponent());
}
Also used : Space(org.zkoss.zul.Space) MLookup(org.compiere.model.MLookup) DBException(org.adempiere.exceptions.DBException) SQLException(java.sql.SQLException) Language(org.compiere.util.Language) Button(org.adempiere.webui.component.Button) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) Event(org.zkoss.zk.ui.event.Event) WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) ListDataEvent(org.zkoss.zul.event.ListDataEvent) EventListener(org.zkoss.zk.ui.event.EventListener) Row(org.adempiere.webui.component.Row) Rows(org.adempiere.webui.component.Rows)

Example 25 with Language

use of org.compiere.util.Language in project lar_361 by comitsrl.

the class ALogin method languageComboChanged.

/**
 *	Change Language
 */
private void languageComboChanged() {
    String langName = (String) languageCombo.getSelectedItem();
    // log.info( "Language: " + langName);
    Language language = Language.getLanguage(langName);
    Language.setLoginLanguage(language);
    Env.setContext(m_ctx, Env.LANGUAGE, language.getAD_Language());
    // Locales
    Locale loc = language.getLocale();
    Locale.setDefault(loc);
    this.setLocale(loc);
    res = ResourceBundle.getBundle(RESOURCE, loc);
    // 
    this.setTitle(res.getString("Login"));
    hostLabel.setText(res.getString("Host"));
    userLabel.setText(res.getString("User"));
    userLabel.setToolTipText(res.getString("EnterUser"));
    passwordLabel.setText(res.getString("Password"));
    passwordLabel.setToolTipText(res.getString("EnterPassword"));
    languageLabel.setText(res.getString("Language"));
    languageLabel.setToolTipText(res.getString("SelectLanguage"));
    // 
    roleLabel.setText(res.getString("Role"));
    clientLabel.setText(res.getString("Client"));
    orgLabel.setText(res.getString("Organization"));
    dateLabel.setText(res.getString("Date"));
    warehouseLabel.setText(res.getString("Warehouse"));
    printerLabel.setText(res.getString("Printer"));
    defaultPanel.setToolTipText(res.getString("Defaults"));
    connectionPanel.setToolTipText(res.getString("Connection"));
    // 
    // txt_Connected = res.getString("Connected");
    txt_NotConnected = res.getString("NotConnected");
    txt_NoDatabase = res.getString("DatabaseNotFound");
    txt_UserPwdError = res.getString("UserPwdError");
    txt_RoleError = res.getString("RoleNotFound");
    txt_LoggedIn = res.getString("Authorized");
    // 
    loginTabPane.setTitleAt(0, res.getString("Connection"));
    loginTabPane.setTitleAt(1, res.getString("Defaults"));
    confirmPanel.getOKButton().setToolTipText(res.getString("Ok"));
    confirmPanel.getCancelButton().setToolTipText(res.getString("Cancel"));
    // DateField with new format
    dateField.setFormat();
    dateField.setValue(new Timestamp(System.currentTimeMillis()));
    // 
    if (m_connectionOK) {
        this.setTitle(hostField.getDisplay());
        statusBar.setStatusLine(txt_LoggedIn);
    } else {
        this.setTitle(res.getString("Login"));
        statusBar.setStatusLine(txt_NotConnected, true);
    }
}
Also used : Locale(java.util.Locale) Language(org.compiere.util.Language) Timestamp(java.sql.Timestamp)

Aggregations

Language (org.compiere.util.Language)43 SQLException (java.sql.SQLException)11 PreparedStatement (java.sql.PreparedStatement)8 ResultSet (java.sql.ResultSet)8 Locale (java.util.Locale)8 MLookup (org.compiere.model.MLookup)7 Properties (java.util.Properties)6 PrintInfo (org.compiere.model.PrintInfo)6 MPrintFormat (org.compiere.print.MPrintFormat)5 IOException (java.io.IOException)4 Timestamp (java.sql.Timestamp)4 ArrayList (java.util.ArrayList)4 VLookup (org.compiere.grid.ed.VLookup)4 MQuery (org.compiere.model.MQuery)4 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 JRException (net.sf.jasperreports.engine.JRException)3 MUser (org.compiere.model.MUser)3 ReportEngine (org.compiere.print.ReportEngine)3 PrinterJob (java.awt.print.PrinterJob)2