Search in sources :

Example 46 with VLookup

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

the class VBrowserCellEditor method getTableCellEditorComponent.

//	isCellEditable
/**
     * Sets an initial value for the editor. This will cause the editor to
     * stopEditing and lose any partially edited value if the editor is editing
     * when this method is called.
     * Returns the component that should be added to the client's Component hierarchy.
     * Once installed in the client's hierarchy this component
     * will then be able to draw and receive user input.
     *
     * @param table
     * @param value
     * @param isSelected
     * @param row
     * @param col
     * @return component
     */
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int col) {
    log.finest(m_mField.getColumnName() + ": Value=" + value + ", row=" + row + ", col=" + col);
    if (row >= 0)
        //  force moving to new row
        table.setRowSelectionInterval(row, row);
    if (m_editor == null)
        createEditor();
    if (m_editor instanceof VLookup) {
        ((VLookup) m_editor).setStopEditing(false);
    }
    this.row = row;
    this.col = col;
    m_editor.setReadWrite(m_mField.isEditable(false));
    this.table = (VBrowserTable) table;
    //	Set Value
    m_editor.setValue(value);
    //	Set Background/Foreground to "normal" (unselected) colors
    m_editor.setBackground(m_mField.isError());
    m_editor.setForeground(AdempierePLAF.getTextColor_Normal());
    //  Other UI
    m_editor.setFont(table.getFont());
    if (m_editor instanceof VLookup) {
        VLookup lookup = (VLookup) m_editor;
        if (lookup.getComponents()[0] instanceof JComboBox) {
            lookup.setBorder(BorderFactory.createEmptyBorder());
        } else {
            lookup.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
        }
    } else {
        m_editor.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
    }
    //
    return (Component) m_editor;
}
Also used : JComboBox(javax.swing.JComboBox) VLookup(org.compiere.grid.ed.VLookup) Component(java.awt.Component)

Example 47 with VLookup

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

the class VInOutInvoiceGen method fillPicks.

//	jbInit
/**
	 *	Fill Picks.
	 *		Column_ID from C_Order
	 *  @throws Exception if Lookups cannot be initialized
	 */
private void fillPicks() throws Exception {
    //	C_OrderLine.M_Warehouse_ID
    MLookup orgL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2223, DisplayType.TableDir);
    fWarehouse = new VLookup("M_Warehouse_ID", true, false, true, orgL);
    lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
    fWarehouse.addVetoableChangeListener(this);
    m_M_Warehouse_ID = fWarehouse.getValue();
    //	C_Order.C_BPartner_ID
    MLookup bpL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
    fBPartner = new VLookup("C_BPartner_ID", false, false, true, bpL);
    lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addVetoableChangeListener(this);
    //Document Type Sales Order/Vendor RMA
    lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
    cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
    cmbDocType.addActionListener(this);
}
Also used : MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) KeyNamePair(org.compiere.util.KeyNamePair)

Example 48 with VLookup

use of org.compiere.grid.ed.VLookup in project lar_361 by comitsrl.

the class VInvoiceGen method dynInit.

// jbInit
/**
 *	Fill Picks.
 *		Column_ID from C_Order
 *  @throws Exception if Lookups cannot be initialized
 */
public void dynInit() throws Exception {
    // @m_zuniga custom
    if (MSysConfig.getBooleanValue("ERGIO_InvoiceGen_Login_ORG_and_PDV", true, Env.getAD_Client_ID(Env.getCtx()))) {
        // Muestra unicamente la Organización con que se logueó
        MLookup orgL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 2163, /* C_Order.AD_Org_ID */
        DisplayType.TableDir, Env.getLanguage(Env.getCtx()), "AD_Org_ID", 3000023, /* AD_Org Login */
        false, "");
        // Campo obligatorio para evitar selección vacía y que se muestren órdenes de otras organizaciones
        fOrg = new VLookup("AD_Org_ID", true, false, true, orgL);
    } else // @m_zuniga custom
    {
        MLookup orgL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2163, DisplayType.TableDir);
        fOrg = new VLookup("AD_Org_ID", false, false, true, orgL);
    }
    // lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
    fOrg.addVetoableChangeListener(this);
    MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 3494, /* C_Invoice.DocStatus */
    DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135, /* _Document Action */
    false, "AD_Ref_List.Value IN ('CO','PR')");
    docAction = new VLookup("DocAction", true, false, true, docActionL);
    // lDcoACtion.setText((Msg.translate(Env.getCtx(), "DocAction")););
    docAction.addVetoableChangeListener(this);
    // @mzuniga Deja por defecto la acción Completar
    docAction.setValue("CO");
    // 
    MLookup bpL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
    fBPartner = new VLookup("C_BPartner_ID", false, false, true, bpL);
    // lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addVetoableChangeListener(this);
    // Document Type Sales Order/Vendor RMA
    lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
    cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA")));
    cmbDocType.addActionListener(this);
    // @m_zuniga custom
    if (MSysConfig.getBooleanValue("ERGIO_InvoiceGen_Login_ORG_and_PDV", true, Env.getAD_Client_ID(Env.getCtx()))) {
        // Muestra PDVS disponibles para la Organización con que se logueó
        MLookup posL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 3000068, /* C_Invoice.C_POS_ID */
        DisplayType.Table, Env.getLanguage(Env.getCtx()), "C_POS_ID", 3000022, /* LAR_POS_ID Login Org*/
        false, "");
        fPOS = new VLookup("C_POS_ID", true, false, true, posL);
    } else // @m_zuniga custom
    // @emmie custom
    {
        MLookup posL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 3000068, DisplayType.Table);
        fPOS = new VLookup("C_POS_ID", true, false, true, posL);
    }
    lPOS.setText("PDV");
    // @emmie custom
    // @@
    panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));
}
Also used : MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) KeyNamePair(org.compiere.util.KeyNamePair)

Aggregations

VLookup (org.compiere.grid.ed.VLookup)48 MLookup (org.compiere.model.MLookup)27 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)11 CPanel (org.compiere.swing.CPanel)9 Insets (java.awt.Insets)8 ALayout (org.compiere.apps.ALayout)8 Dimension (java.awt.Dimension)7 Properties (java.util.Properties)7 GridBagConstraints (java.awt.GridBagConstraints)6 VComboBox (org.compiere.grid.ed.VComboBox)6 KeyNamePair (org.compiere.util.KeyNamePair)6 CTextField (org.compiere.swing.CTextField)5 CLabel (org.compiere.swing.CLabel)4 Language (org.compiere.util.Language)4 Timestamp (java.sql.Timestamp)3 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 CButton (org.compiere.swing.CButton)3