Search in sources :

Example 26 with VLookup

use of org.compiere.grid.ed.VLookup in project adempiere by adempiere.

the class VCRPDetail method fillPicks.

private void fillPicks() {
    Properties ctx = Env.getCtx();
    MLookup resourceL = MLookupFactory.get(ctx, m_form.getWindowNo(), 0, MColumn.getColumn_ID(I_S_Resource.Table_Name, "S_Resource_ID"), DisplayType.TableDir);
    resource = new VLookup("S_Resource_ID", false, false, true, resourceL);
}
Also used : MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) Properties(java.util.Properties)

Example 27 with VLookup

use of org.compiere.grid.ed.VLookup in project adempiere by adempiere.

the class EMailDialog method vetoableChange.

//	actionPerformed
/**
	 * 	Vetoable Change - User selected 
	 *	@param evt
	 *	@throws PropertyVetoException
	 */
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
    VLookup source = (VLookup) evt.getSource();
    Object value = evt.getNewValue();
    log.info("Value=" + value);
    if (source.equals(fUser)) {
        // fUser			
        if (value == null)
            fTo.setText("");
        if (value instanceof Integer) {
            int AD_User_ID = ((Integer) value).intValue();
            m_user = MUser.get(Env.getCtx(), AD_User_ID);
            fTo.setValue(m_user.getEMail());
        }
    } else {
        // fCcUser
        if (value == null)
            fCc.setText("");
        if (value instanceof Integer) {
            int AD_User_ID = ((Integer) value).intValue();
            m_ccuser = MUser.get(Env.getCtx(), AD_User_ID);
            fCc.setValue(m_ccuser.getEMail());
        }
    }
}
Also used : VLookup(org.compiere.grid.ed.VLookup)

Example 28 with VLookup

use of org.compiere.grid.ed.VLookup in project adempiere by adempiere.

the class EMailDialog method commonInit.

//	EmailDialog
/**
	 * 	Common Init
	 *	@param from from
	 *	@param to to 
	 *	@param subject subject
	 *	@param message message
	 *	@param attachment optional attachment
	 */
private void commonInit(MUser from, String to, String subject, String message, File attachment) {
    m_client = MClient.get(Env.getCtx());
    try {
        int WindowNo = 0;
        int AD_Column_ID = 0;
        Lookup lookup = MLookupFactory.get(Env.getCtx(), WindowNo, AD_Column_ID, DisplayType.Search, Env.getLanguage(Env.getCtx()), "AD_User_ID", 0, false, "EMail IS NOT NULL");
        fUser = new VLookup("AD_User_ID", false, false, true, lookup);
        fUser.addVetoableChangeListener(this);
        fCcUser = new VLookup("AD_User_ID", false, false, true, lookup);
        fCcUser.addVetoableChangeListener(this);
        jbInit();
    } catch (Exception ex) {
        log.log(Level.SEVERE, "EMailDialog", ex);
    }
    set(from, to, subject, message);
    setAttachment(attachment);
    AEnv.showCenterScreen(this);
}
Also used : VLookup(org.compiere.grid.ed.VLookup) Lookup(org.compiere.model.Lookup) VLookup(org.compiere.grid.ed.VLookup) PropertyVetoException(java.beans.PropertyVetoException)

Example 29 with VLookup

use of org.compiere.grid.ed.VLookup in project adempiere by adempiere.

the class Info method actionPerformed.

/**************************************************************************
	 *	(Button) Action Listener & Popup Menu
	 *  @param e event
	 */
public void actionPerformed(ActionEvent e) {
    if (!p_loadedOK)
        return;
    String cmd = e.getActionCommand();
    if (cmd.equals("CausedFocusEvent")) {
        return;
    }
    Object source = null;
    if (e.getSource() != null) {
        source = e.getSource();
        //  Keep the focus on the source field if the table updates
        m_heldLastFocus = this.getFocusOwner();
        //  Popup => Calculator
        if (source.equals(calcMenu)) {
            BigDecimal number = null;
            if (m_popupRow >= 0 && m_popupColumn >= 0) {
                Object data = p_table.getValueAt(m_popupRow, m_popupColumn);
                try {
                    if (data != null) {
                        if (data instanceof BigDecimal)
                            number = (BigDecimal) data;
                        else
                            number = new BigDecimal(data.toString());
                    }
                } catch (Exception ex) {
                }
                Calculator c = new Calculator(null, number);
                c.setVisible(true);
            }
            return;
        } else //  Popup => zoom
        if (e.getSource().equals(zoomMenu)) {
            if (m_popupRow >= 0 && m_popupColumn >= 0) {
                zoom(p_table.getRowKey(m_popupRow));
            }
            return;
        } else if (cmd.equals(ConfirmPanel.A_OK)) {
            //  VLookup fields in the criteria
            if (hasOutstandingChanges()) {
                return;
            } else {
                // We might close
                p_triggerRefresh = false;
            }
        } else if (source instanceof VComboBox) {
            if (((VComboBox) source).getParent() instanceof VLookup) {
                source = ((VComboBox) source).getParent();
                VLookup vl = ((VLookup) source);
                m_heldLastFocus = vl;
                //  events that don't have changes from the last action.
                if (cmd.equals("comboBoxChanged")) {
                    if (!vl.hasChanged())
                        return;
                    else
                        p_triggerRefresh = true;
                } else if (cmd.equals("comboBoxEdited")) {
                    if (!vl.hasChanged() && !hasOutstandingChanges()) {
                        vl.requestFocus();
                        return;
                    }
                    p_triggerRefresh = true;
                }
            }
        } else if (source instanceof CTextField) {
            CTextField tf = ((CTextField) source);
            if (tf.getParent() instanceof VLookup) {
                // instead.
                return;
            } else if (//  The change may have come from another field
            tf.hasChanged() || hasOutstandingChanges()) {
                p_triggerRefresh = true;
            } else {
                // if the dialog was opened from a menu.
                if (p_TabNo == 0)
                    return;
                else
                    //  Save the selection and close;
                    dispose(true);
            }
        } else if (e.getSource() instanceof VCheckBox) {
            //  Check box changes generally always cause a refresh
            //  Capture changes that don't 
            p_triggerRefresh = true;
            VCheckBox cb = (VCheckBox) e.getSource();
            if (cb.getName().equals("AutoQuery")) {
                //  Only trigger a refresh if the check box is selected
                if (!cb.isSelected()) {
                    return;
                }
            }
        }
        // Check if we need to reset the table.  The flag is reset when
        // the table is reset.  The first change triggers the reset.
        p_resetColumns = p_resetColumns || columnIsDynamic(source);
    }
    if (cmd.equals(ConfirmPanel.A_OK)) {
        dispose(p_saveResults);
    } else if (cmd.equals(ConfirmPanel.A_CANCEL)) {
        m_cancel = true;
        dispose(false);
    } else if (cmd.equals(ConfirmPanel.A_REFRESH)) {
        //  Refresh always causes a requery in case there are
        //  changes to the underlying tables - even if the 
        //  criteria haven't changed.
        p_resetColumns = true;
        p_triggerRefresh = true;
        p_refreshNow = true;
    } else if (cmd.equals(ConfirmPanel.A_HISTORY))
        showHistory(p_table.getLeadRowKey());
    else if (cmd.equals(ConfirmPanel.A_CUSTOMIZE))
        customize();
    else if (cmd.equals(ConfirmPanel.A_ZOOM))
        zoom(p_table.getLeadRowKey());
    else if (cmd.equals(ConfirmPanel.A_RESET)) {
        //  Go back to the defaults
        // Prevent other actions
        p_loadedOK = false;
        initInfo();
        p_loadedOK = true;
        //
        p_resetColumns = true;
        p_triggerRefresh = true;
    } else if (cmd.equals(ConfirmPanel.A_PRINT))
        PrintScreenPainter.printScreen(this);
    // Refresh if the autoquery feature is selected or the refresh button is clicked.
    if (p_triggerRefresh && (p_refreshNow || autoQuery())) {
        //  Something changed so save the state and prepare for the query
        executeQuery();
    }
    //  Reset the flags
    p_triggerRefresh = false;
    p_refreshNow = false;
}
Also used : Calculator(org.compiere.grid.ed.Calculator) CTextField(org.compiere.swing.CTextField) VLookup(org.compiere.grid.ed.VLookup) VComboBox(org.compiere.grid.ed.VComboBox) VCheckBox(org.compiere.grid.ed.VCheckBox) BigDecimal(java.math.BigDecimal) SQLException(java.sql.SQLException)

Example 30 with VLookup

use of org.compiere.grid.ed.VLookup in project adempiere by adempiere.

the class myJTree method preInit.

//	init
/**
	 * 	Fill Tree Combo
	 */
private void preInit() throws Exception {
    m_fieldProduct = MLookupFactory.get(getCtx(), 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 VLookup("M_Product_ID", false, false, true, m_fieldProduct) {

        private static final long serialVersionUID = 1L;

        public void setValue(Object value) {
            super.setValue(value);
            action_loadBOM();
        }
    };
    implosion.addActionListener(this);
    splitPane.add(dataPane, JSplitPane.RIGHT);
    splitPane.add(treePane, JSplitPane.LEFT);
}
Also used : VLookup(org.compiere.grid.ed.VLookup)

Aggregations

VLookup (org.compiere.grid.ed.VLookup)44 MLookup (org.compiere.model.MLookup)25 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)10 CPanel (org.compiere.swing.CPanel)9 Dimension (java.awt.Dimension)7 Properties (java.util.Properties)7 ALayout (org.compiere.apps.ALayout)7 Insets (java.awt.Insets)6 VComboBox (org.compiere.grid.ed.VComboBox)6 GridBagConstraints (java.awt.GridBagConstraints)5 KeyNamePair (org.compiere.util.KeyNamePair)5 CTextField (org.compiere.swing.CTextField)4 Language (org.compiere.util.Language)4 VCheckBox (org.compiere.grid.ed.VCheckBox)3 VLocator (org.compiere.grid.ed.VLocator)3 VPAttribute (org.compiere.grid.ed.VPAttribute)3 MLocatorLookup (org.compiere.model.MLocatorLookup)3 CLabel (org.compiere.swing.CLabel)3 BorderLayout (java.awt.BorderLayout)2 PropertyVetoException (java.beans.PropertyVetoException)2