Search in sources :

Example 21 with VLookup

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

the class InfoInOut method statInit.

/**
	 *	Static Setup - add fields to parameterPanel
	 */
private void statInit() {
    lDocumentNo.setLabelFor(fDocumentNo);
    fDocumentNo.setBackground(AdempierePLAF.getInfoBackground());
    fDocumentNo.addActionListener(this);
    lDescription.setLabelFor(fDescription);
    fDescription.setBackground(AdempierePLAF.getInfoBackground());
    fDescription.addActionListener(this);
    lPOReference.setLabelFor(fPOReference);
    fPOReference.setBackground(AdempierePLAF.getInfoBackground());
    fPOReference.addActionListener(this);
    fIsSOTrx.setSelected(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
    fIsSOTrx.addActionListener(this);
    //
    fBPartner_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInOut.Table_Name, MInOut.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    lBPartner_ID.setLabelFor(fBPartner_ID);
    fBPartner_ID.setBackground(AdempierePLAF.getInfoBackground());
    fBPartner_ID.addActionListener(this);
    //
    fShipper_ID = new VLookup("M_Shipper_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInOut.Table_Name, MInOut.COLUMNNAME_M_Shipper_ID), DisplayType.TableDir));
    lShipper_ID.setLabelFor(fShipper_ID);
    fShipper_ID.setBackground(AdempierePLAF.getInfoBackground());
    fShipper_ID.addActionListener(this);
    //
    lDateFrom.setLabelFor(fDateFrom);
    fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
    fDateFrom.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
    fDateFrom.addActionListener(this);
    lDateTo.setLabelFor(fDateTo);
    fDateTo.setBackground(AdempierePLAF.getInfoBackground());
    fDateTo.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
    fDateTo.addActionListener(this);
    //
    CPanel datePanel = new CPanel();
    datePanel.setLayout(new ALayout(0, 0, true));
    datePanel.add(fDateFrom, new ALayoutConstraint(0, 0));
    datePanel.add(lDateTo, null);
    datePanel.add(fDateTo, null);
    //  First Row
    p_criteriaGrid.add(lDocumentNo, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fDocumentNo, null);
    p_criteriaGrid.add(lBPartner_ID, null);
    p_criteriaGrid.add(fBPartner_ID, null);
    p_criteriaGrid.add(fIsSOTrx, new ALayoutConstraint(0, 5));
    //  2nd Row
    p_criteriaGrid.add(lDescription, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fDescription, null);
    p_criteriaGrid.add(lDateFrom, null);
    p_criteriaGrid.add(datePanel, null);
    //  3rd Row
    p_criteriaGrid.add(lPOReference, new ALayoutConstraint(2, 0));
    p_criteriaGrid.add(fPOReference, null);
    p_criteriaGrid.add(lShipper_ID, null);
    p_criteriaGrid.add(fShipper_ID, null);
}
Also used : VLookup(org.compiere.grid.ed.VLookup) CPanel(org.compiere.swing.CPanel) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ALayout(org.compiere.apps.ALayout)

Example 22 with VLookup

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

the class InfoAssignment method statInit.

//private CButton bNew = new CButton();
/**
	 *	Static Setup - add fields to parameterPanel.
	 *  <pre>
	 * 		ResourceType	Resource	DateTimeFrom	DateTimeTo	New
	 *  </pre>
	 */
private void statInit() {
    fieldResourceType = new VLookup("S_ResourceType_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResourceType.Table_Name, MResourceType.COLUMNNAME_S_ResourceType_ID), DisplayType.TableDir));
    fieldResourceType.addActionListener(this);
    fieldResource = new VLookup("S_Resource_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResource.Table_Name, MResource.COLUMNNAME_S_Resource_ID), DisplayType.TableDir));
    fieldResource.addActionListener(this);
    //
    fieldFrom.addActionListener(this);
    fieldTo.addActionListener(this);
    //
    p_criteriaGrid.setLayout(new ALayout());
    p_criteriaGrid.add(labelResourceType, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fieldResourceType, null);
    p_criteriaGrid.add(labelResource, null);
    p_criteriaGrid.add(fieldResource, null);
    //
    p_criteriaGrid.add(labelFrom, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fieldFrom, null);
    p_criteriaGrid.add(labelTo, null);
    p_criteriaGrid.add(fieldTo, null);
//parameterPanel.add(bNew, null);
}
Also used : VLookup(org.compiere.grid.ed.VLookup) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ALayout(org.compiere.apps.ALayout)

Example 23 with VLookup

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

the class InfoProduct method actionPerformed.

/**************************************************************************
	 *  Action Listener
	 *	@param e event
	 */
public void actionPerformed(ActionEvent e) {
    if (!p_loadedOK)
        return;
    String cmd = e.getActionCommand();
    Object source = null;
    if (e.getSource() != null) {
        source = e.getSource();
        if (cmd.equals(ConfirmPanel.A_PATTRIBUTE)) {
            // when the attribute window is closed.
            if (p_table.isMultiSelection()) {
                int row = p_table.getSelectionModel().getLeadSelectionIndex();
                p_table.setRowChecked(row, true);
            }
            MProduct mp = MProduct.get(Env.getCtx(), m_M_Product_ID);
            //  Set title and parameters for the PattributeInstance window
            String title = "";
            int wh_id = 0;
            if (isValidVObject(fWarehouse_ID)) {
                title = fWarehouse_ID.getDisplay() + " - " + mp.getName();
                wh_id = ((Integer) (fWarehouse_ID.getValue())).intValue();
            }
            //  Get the business partner from the context - it may be different than the Vendor
            int bp_id = 0;
            String s_bp_id = Env.getContext(Env.getCtx(), p_WindowNo, p_TabNo, "C_BPartner_ID", false);
            if (s_bp_id != null && s_bp_id.length() != 0 && (new Integer(s_bp_id).intValue() > 0))
                bp_id = new Integer(s_bp_id).intValue();
            //  Display the window
            PAttributeInstance pai = new PAttributeInstance(this, title, wh_id, 0, p_table.getLeadRowKey(), bp_id);
            if (!pai.wasCancelled()) {
                //  Get the results and update the fASI criteria field
                m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
                m_M_Locator_ID = pai.getM_Locator_ID();
                if (m_M_AttributeSetInstance_ID > 0)
                    fASI_ID.setValue(m_M_AttributeSetInstance_ID);
                else
                    //  No instance
                    fASI_ID.setValue(0);
            }
            //  looking around.
            if (//  If the results are saved, we can save now - an ASI is product specific
            p_saveResults && m_M_AttributeSetInstance_ID != -1 && !pai.wasCancelled()) {
                dispose(p_saveResults);
                return;
            }
            return;
        } else if (source instanceof VComboBox) {
            if (((VComboBox) source).getParent() instanceof VLookup) {
                // Works for VLookups using DisplayType.TableDir
                source = ((VComboBox) source).getParent();
                VLookup vl = ((VLookup) source);
                m_heldLastFocus = vl;
                if (cmd.equals("comboBoxEdited")) {
                    if (!vl.hasChanged() && !hasOutstandingChanges()) {
                        vl.requestFocus();
                        return;
                    }
                    p_triggerRefresh = true;
                    //  perform field-specific changes
                    if (vl == fWarehouse_ID) {
                        if (!isValidVObject(fWarehouse_ID)) {
                            //  Disable the stock button
                            checkOnlyStock.setSelected(false);
                            checkOnlyStock.setEnabled(false);
                        } else
                            checkOnlyStock.setEnabled(true);
                    }
                }
            }
        } else if (source instanceof CTextField) {
            CTextField tf = ((CTextField) source);
            if (tf.getParent() instanceof VPAttribute) {
                source = tf.getParent();
                VPAttribute vpa = ((VPAttribute) source);
                //  The VPAttribute field can't hold the focus effectively
                m_heldLastFocus = fieldValue;
                if (vpa.hasChanged()) {
                    p_triggerRefresh = true;
                }
            }
        } else if (e.getSource() instanceof VCheckBox) {
            //  Check box changes generally always cause a refresh
            //  Capture changes that don't 	
            VCheckBox cb = (VCheckBox) e.getSource();
            //  ShowDetail check box
            if (cb.getName().equals("ShowDetail")) {
                // Refresh only the ATP tab 
                refreshAtpTab();
                return;
            }
        }
    }
    //  e.getSource() is null
    //  Let the info class decide what to do.
    super.actionPerformed(e);
}
Also used : MProduct(org.compiere.model.MProduct) VPAttribute(org.compiere.grid.ed.VPAttribute) CTextField(org.compiere.swing.CTextField) VLookup(org.compiere.grid.ed.VLookup) VComboBox(org.compiere.grid.ed.VComboBox) VCheckBox(org.compiere.grid.ed.VCheckBox) ALayoutConstraint(org.compiere.apps.ALayoutConstraint)

Example 24 with VLookup

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

the class InfoInvoice method statInit.

/**
	 *	Static Setup - add fields to parameterPanel
	 */
private void statInit() {
    lDocumentNo.setLabelFor(fDocumentNo);
    fDocumentNo.setBackground(AdempierePLAF.getInfoBackground());
    fDocumentNo.addActionListener(this);
    lDescription.setLabelFor(fDescription);
    fDescription.setBackground(AdempierePLAF.getInfoBackground());
    fDescription.addActionListener(this);
    fIsPaid.setSelected(false);
    fIsPaid.addActionListener(this);
    fIsSOTrx.setSelected(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
    fIsSOTrx.addActionListener(this);
    //
    //	C_Invoice.C_BPartner_ID
    fBPartner_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInvoice.Table_Name, MInvoice.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    lBPartner_ID.setLabelFor(fBPartner_ID);
    fBPartner_ID.setBackground(AdempierePLAF.getInfoBackground());
    fBPartner_ID.addActionListener(this);
    //	C_Invoice.C_Order_ID
    fOrder_ID = new VLookup("C_Order_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInvoice.Table_Name, MInvoice.COLUMNNAME_C_Order_ID), DisplayType.Search));
    lOrder_ID.setLabelFor(fOrder_ID);
    fOrder_ID.setBackground(AdempierePLAF.getInfoBackground());
    fOrder_ID.addActionListener(this);
    //
    lDateFrom.setLabelFor(fDateFrom);
    fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
    fDateFrom.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
    lDateTo.setLabelFor(fDateTo);
    fDateTo.setBackground(AdempierePLAF.getInfoBackground());
    fDateTo.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
    lAmtFrom.setLabelFor(fAmtFrom);
    fAmtFrom.setBackground(AdempierePLAF.getInfoBackground());
    fAmtFrom.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
    lAmtTo.setLabelFor(fAmtTo);
    fAmtTo.setBackground(AdempierePLAF.getInfoBackground());
    fAmtTo.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
    //
    CPanel amtPanel = new CPanel();
    CPanel datePanel = new CPanel();
    amtPanel.setLayout(new ALayout(0, 0, true));
    amtPanel.add(fAmtFrom, new ALayoutConstraint(0, 0));
    amtPanel.add(lAmtTo, null);
    amtPanel.add(fAmtTo, null);
    datePanel.setLayout(new ALayout(0, 0, true));
    datePanel.add(fDateFrom, new ALayoutConstraint(0, 0));
    datePanel.add(lDateTo, null);
    datePanel.add(fDateTo, null);
    //  First Row
    p_criteriaGrid.add(lDocumentNo, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fDocumentNo, null);
    p_criteriaGrid.add(lBPartner_ID, null);
    p_criteriaGrid.add(fBPartner_ID, null);
    p_criteriaGrid.add(fIsSOTrx, new ALayoutConstraint(0, 5));
    //  2nd Row
    p_criteriaGrid.add(lDescription, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fDescription, null);
    p_criteriaGrid.add(lDateFrom, null);
    p_criteriaGrid.add(datePanel, null);
    p_criteriaGrid.add(fIsPaid, new ALayoutConstraint(1, 5));
    //  3rd Row
    p_criteriaGrid.add(lOrder_ID, new ALayoutConstraint(2, 0));
    p_criteriaGrid.add(fOrder_ID, null);
    p_criteriaGrid.add(lAmtFrom, null);
    p_criteriaGrid.add(amtPanel, null);
    m_sqlSchedule = scheduleTbl.prepareTable(s_subLayout, s_subFrom, s_subWhere, false, "i");
    scheduleTbl.setRowSelectionAllowed(true);
    scheduleTbl.setMultiSelection(false);
    scheduleTbl.addMouseListener(this);
    scheduleTbl.setShowTotals(true);
    scheduleTbl.autoSize();
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.setLayout(new BorderLayout());
    tablePanel.add(new JScrollPane(scheduleTbl), BorderLayout.CENTER);
    //  Add the details to the p_detailPanel
    p_detailTaskPane.setTitle(Msg.translate(Env.getCtx(), "C_InvoicePaySchedule_ID"));
    p_detailTaskPane.add(tablePanel, BorderLayout.CENTER);
    p_detailTaskPane.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) BorderLayout(java.awt.BorderLayout) VLookup(org.compiere.grid.ed.VLookup) CPanel(org.compiere.swing.CPanel) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) Dimension(java.awt.Dimension) ALayout(org.compiere.apps.ALayout)

Example 25 with VLookup

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

the class VCRP method fillPicks.

// dispose
/**
	 * Fill Picks Column_ID from C_Order
	 * @throws Exception if Lookups cannot be initialized
	 */
private void fillPicks() throws Exception {
    Properties ctx = Env.getCtx();
    MLookup resourceL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(I_M_Product.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)

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