Search in sources :

Example 1 with MLookupInfo

use of org.compiere.model.MLookupInfo in project adempiere by adempiere.

the class WGraph method loadData.

private void loadData() {
    list = builder.loadData();
    if (m_renderChart && m_chartSelection) {
        Toolbar toolbar = new Toolbar();
        panel.appendChild(toolbar);
        int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType");
        MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID);
        MLookup mLookup = new MLookup(info, 0);
        WTableDirEditor editor = new WTableDirEditor("ChartType", false, false, true, mLookup);
        toolbar.appendChild(editor.getComponent());
        editor.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent evt) {
                Object value = evt.getNewValue();
                if (value == null || value.toString().trim().length() == 0)
                    return;
                JFreeChart chart = null;
                chart = builder.createChart(value.toString());
                if (chart != null)
                    render(chart);
            }
        });
    }
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookupInfo(org.compiere.model.MLookupInfo) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) ValueChangeListener(org.adempiere.exceptions.ValueChangeListener) MLookup(org.compiere.model.MLookup) Point(java.awt.Point) JFreeChart(org.jfree.chart.JFreeChart) Toolbar(org.zkoss.zul.Toolbar)

Example 2 with MLookupInfo

use of org.compiere.model.MLookupInfo in project adempiere by adempiere.

the class HRPayPrint method loadPaymentRule.

//  loadPaySelectInfo
/**
	 *  Bank changed - load PaymentRule
	 */
public ArrayList<ValueNamePair> loadPaymentRule(int C_PaySelection_ID) {
    ArrayList<ValueNamePair> data = new ArrayList<ValueNamePair>();
    // load PaymentRule for Bank
    //  MLookupInfo.getAD_Reference_ID("All_Payment Rule");
    int AD_Reference_ID = 195;
    Language language = Language.getLanguage(Env.getAD_Language(Env.getCtx()));
    MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID);
    String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY")) + " AND " + info.KeyColumn + " IN (SELECT PaymentRule FROM HR_PaySelectionCheck WHERE HR_PaySelection_ID=?) " + info.Query.substring(info.Query.indexOf(" ORDER BY"));
    try {
        PreparedStatement pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, C_PaySelection_ID);
        ResultSet rs = pstmt.executeQuery();
        //
        while (rs.next()) {
            ValueNamePair pp = new ValueNamePair(rs.getString(2), rs.getString(3));
            data.add(pp);
        }
        rs.close();
        pstmt.close();
    } catch (SQLException e) {
        log.log(Level.SEVERE, sql, e);
    }
    if (data.size() == 0)
        log.config("PaySel=" + C_PaySelection_ID + ", BAcct=" + m_C_BankAccount_ID + " - " + sql);
    return data;
}
Also used : MLookupInfo(org.compiere.model.MLookupInfo) Language(org.compiere.util.Language) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) ValueNamePair(org.compiere.util.ValueNamePair)

Example 3 with MLookupInfo

use of org.compiere.model.MLookupInfo in project adempiere by adempiere.

the class PayPrint method loadPaymentRule.

//  loadPaySelectInfo
/**
	 *  Bank changed - load PaymentRule
	 */
public ArrayList<ValueNamePair> loadPaymentRule(int paySelectionId) {
    ArrayList<ValueNamePair> data = new ArrayList<ValueNamePair>();
    // load PaymentRule for Bank
    //  MLookupInfo.getAD_Reference_ID("All_Payment Rule");
    int AD_Reference_ID = 195;
    Language language = Language.getLanguage(Env.getAD_Language(Env.getCtx()));
    MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID);
    String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY")) + " AND " + info.KeyColumn + " IN (SELECT PaymentRule FROM C_PaySelectionCheck WHERE C_PaySelection_ID=?) " + info.Query.substring(info.Query.indexOf(" ORDER BY"));
    try {
        PreparedStatement pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, paySelectionId);
        ResultSet rs = pstmt.executeQuery();
        //
        while (rs.next()) {
            ValueNamePair pp = new ValueNamePair(rs.getString(2), rs.getString(3));
            data.add(pp);
        }
        rs.close();
        pstmt.close();
    } catch (SQLException e) {
        log.log(Level.SEVERE, sql, e);
    }
    if (data.size() == 0)
        log.config("PaySel=" + paySelectionId + ", BAcct=" + bankAccountId + " - " + sql);
    return data;
}
Also used : MLookupInfo(org.compiere.model.MLookupInfo) Language(org.compiere.util.Language) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) ValueNamePair(org.compiere.util.ValueNamePair)

Example 4 with MLookupInfo

use of org.compiere.model.MLookupInfo in project adempiere by adempiere.

the class WPayPrint method dynInit.

//  VPayPrint
/**
	 *  Dynamic Init
	 */
private void dynInit() {
    //  C_PaySelection_ID
    //  C_PaySelectionCheck.C_PaySelection_ID
    int AD_Column_ID = 7670;
    //	FR [ 297 ]
    //	Add DocStatus for validation
    MLookupInfo info = MLookupFactory.getLookupInfo(Env.getCtx(), windowNo, AD_Column_ID, DisplayType.Search);
    info.ValidationCode = "C_PaySelection.DocStatus IN('CO', 'CL') AND C_PaySelection.C_BankAccount_ID IS NOT NULL";
    MLookup lookupPS = new MLookup(info, 0);
    paySelectSearch = new WSearchEditor("C_PaySelection_ID", true, false, true, lookupPS);
    paySelectSearch.addValueChangeListener(this);
}
Also used : MLookupInfo(org.compiere.model.MLookupInfo) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) PayPrint(org.compiere.apps.form.PayPrint)

Example 5 with MLookupInfo

use of org.compiere.model.MLookupInfo in project adempiere by adempiere.

the class Graph method loadData.

private void loadData() {
    list = builder.loadData();
    JFreeChart chart = builder.createChart(builder.getMGoal().getChartType());
    if (chartPanel != null)
        remove(chartPanel);
    chartPanel = new ChartPanel(chart);
    chartPanel.setSize(getSize());
    chartPanel.addChartMouseListener(this);
    add(chartPanel, BorderLayout.CENTER);
    if (m_userSelection) {
        int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType");
        MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID);
        MLookup mLookup = new MLookup(info, 0);
        VLookup lookup = new VLookup("ChartType", false, false, true, mLookup);
        lookup.addVetoableChangeListener(new VetoableChangeListener() {

            public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
                Object value = evt.getNewValue();
                if (value == null)
                    return;
                JFreeChart chart = null;
                chart = builder.createChart(value.toString());
                if (chart != null) {
                    if (chartPanel != null)
                        remove(chartPanel);
                    chartPanel = new ChartPanel(chart);
                    chartPanel.setSize(getSize());
                    chartPanel.addChartMouseListener(Graph.this);
                    add(chartPanel, BorderLayout.CENTER);
                    getParent().validate();
                }
            }
        });
        add(lookup, BorderLayout.NORTH);
    }
    this.setMinimumSize(paneldimension);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) MLookupInfo(org.compiere.model.MLookupInfo) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChartPanel(org.jfree.chart.ChartPanel) MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) VetoableChangeListener(java.beans.VetoableChangeListener) JFreeChart(org.jfree.chart.JFreeChart) Point(java.awt.Point)

Aggregations

MLookupInfo (org.compiere.model.MLookupInfo)10 PreparedStatement (java.sql.PreparedStatement)4 ResultSet (java.sql.ResultSet)4 SQLException (java.sql.SQLException)4 ArrayList (java.util.ArrayList)4 MLookup (org.compiere.model.MLookup)4 ValueNamePair (org.compiere.util.ValueNamePair)4 Language (org.compiere.util.Language)3 Point (java.awt.Point)2 VLookup (org.compiere.grid.ed.VLookup)2 JFreeChart (org.jfree.chart.JFreeChart)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyVetoException (java.beans.PropertyVetoException)1 VetoableChangeListener (java.beans.VetoableChangeListener)1 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 ValueChangeListener (org.adempiere.exceptions.ValueChangeListener)1 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)1 WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)1 PayPrint (org.compiere.apps.form.PayPrint)1 ChartPanel (org.jfree.chart.ChartPanel)1