Search in sources :

Example 6 with GridFieldVO

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

the class SmallViewController method createField.

//	createField
/**
	 *	Creates model gridFields which will accessible via the {@link #fields fields} list.
	 *  The {@link #fieldsTo fieldsTo} list will contain the matching "to" range or null.<br>
	 *  <br>
	 *  This function should be called by the view's {@link #loadData() loadData()} function. 
	 *  @param MProcessPara - the process parameter used to create the field
	 *  @param windowNo the Window number where the field will appear. This 
	 *  is required to ensure the context variables are set correctly for
	 *  the created field.
	 *  
	 *   @see org.compiere.model.GridFieldVO#createParameter(java.util.Properties, int, ResultSet)
	 *   
	 */
protected void createField(MProcessPara processParameter, int windowNo) {
    //  Create Field
    GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), windowNo, processParameter);
    GridField field = new GridField(voF);
    GridField fieldTo = null;
    //  add to Fields
    fields.add(field);
    //
    if (voF.IsRange) {
        //
        GridFieldVO voF2 = GridFieldVO.createParameter(voF);
        //	BR [ 298 ]
        voF2.DefaultValue = voF2.DefaultValue2;
        //	Change Name
        voF2.ColumnName = voF2.ColumnName + "_To";
        //	
        fieldTo = new GridField(voF2);
        //	
        fieldsTo.add(fieldTo);
    } else {
        fieldsTo.add(null);
    }
}
Also used : GridFieldVO(org.compiere.model.GridFieldVO) GridField(org.compiere.model.GridField)

Example 7 with GridFieldVO

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

the class SmallViewController method createVO.

//	createField
/**
	 * Create GridFieldVO from a MBrowseField field
	 * @param field the MBrowseField
	 * @param isTo true if the MBrowseField represents the "To" part of a range
	 * @param windowNo - the window number that will be used in the context
	 * @return GridFieldVO used to establish a GridField field.
	 */
private GridFieldVO createVO(MBrowseField field, boolean isTo, int windowNo) {
    //  Create Field
    GridFieldVO voBase = GridFieldVO.createStdField(field.getCtx(), windowNo, 0, 0, 0, false, false, false);
    String uniqueName = field.getAD_View_Column().getColumnName() + (isTo ? "_To" : "");
    voBase.isProcess = true;
    voBase.IsDisplayed = true;
    voBase.IsReadOnly = false;
    voBase.IsUpdateable = true;
    voBase.WindowNo = windowNo;
    M_Element element = (M_Element) field.getAD_Element();
    voBase.ColumnName = element.getColumnName();
    //	FR [ 344 ]
    voBase.ColumnSQL = field.getAD_View_Column().getColumnSQL();
    //	BR [ 318 ]
    if (field.getAD_View_Column().getAD_Column_ID() > 0) {
        voBase.AD_Column_ID = field.getAD_View_Column().getAD_Column_ID();
        voBase.AD_Table_ID = field.getAD_View_Column().getAD_Column().getAD_Table_ID();
    }
    //	Set unique alias
    voBase.ColumnNameAlias = uniqueName;
    voBase.displayType = field.getAD_Reference_ID();
    voBase.AD_Reference_Value_ID = field.getAD_Reference_Value_ID();
    voBase.IsMandatory = field.isMandatory();
    voBase.IsAlwaysUpdateable = true;
    voBase.IsKey = field.isKey();
    voBase.DefaultValue = isTo ? field.getDefaultValue2() : field.getDefaultValue();
    voBase.DefaultValue2 = field.getDefaultValue2();
    voBase.InfoFactoryClass = field.getInfoFactoryClass();
    voBase.FieldLength = field.getFieldLength();
    voBase.ReadOnlyLogic = field.getReadOnlyLogic();
    voBase.DisplayLogic = field.getDisplayLogic();
    voBase.VFormat = field.getVFormat();
    voBase.ValueMin = field.getValueMin();
    voBase.ValueMax = field.getValueMax();
    voBase.ValidationCode = field.getAD_Val_Rule().getCode();
    //	FR [ 349 ]
    voBase.IsRange = field.isRange();
    voBase.Description = field.getDescription();
    voBase.Help = field.getHelp();
    voBase.Header = isTo ? Msg.getMsg(Env.getCtx(), "To") : field.getName();
    voBase.IsColumnSQLReference = true;
    voBase.initFinish();
    //	Return 
    return voBase;
}
Also used : GridFieldVO(org.compiere.model.GridFieldVO) M_Element(org.compiere.model.M_Element)

Example 8 with GridFieldVO

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

the class Find method initFind.

/**
	 *	Dynamic Init.6
	 *  Set up GridController
	 */
private void initFind() {
    log.config("");
    //  Get Info from target Tab
    int parameterNo = 0;
    for (int i = 0; i < m_findFields.length; i++) {
        GridField mField = m_findFields[i];
        if (mField.isSelectionColumn())
            parameterNo++;
    }
    if (parameterNo >= 7)
        isTwoColumns = true;
    //	Get Info from target Tab
    for (int i = 0; i < m_findFields.length; i++) {
        GridField mField = m_findFields[i];
        // Make Yes-No searchable as list
        if (mField.getVO().displayType == DisplayType.YesNo) {
            GridFieldVO vo = mField.getVO();
            GridFieldVO ynvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
            ynvo.IsDisplayed = true;
            ynvo.displayType = DisplayType.List;
            ynvo.AD_Reference_Value_ID = AD_REFERENCE_ID_YESNO;
            ynvo.lookupInfo = MLookupFactory.getLookupInfo(ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType, Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID, ynvo.IsParent, ynvo.ValidationCode);
            ynvo.lookupInfo.InfoFactoryClass = ynvo.InfoFactoryClass;
            GridField ynfield = new GridField(ynvo);
            // replace the original field by the YN List field
            m_findFields[i] = ynfield;
            mField = ynfield;
        }
        // Make Buttons searchable
        if (mField.getVO().displayType == DisplayType.Button) {
            GridFieldVO vo = mField.getVO();
            if (vo.AD_Reference_Value_ID > 0) {
                GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
                postedvo.IsDisplayed = true;
                postedvo.displayType = DisplayType.List;
                postedvo.lookupInfo = MLookupFactory.getLookupInfo(postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, postedvo.IsParent, postedvo.ValidationCode);
                postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass;
                GridField postedfield = new GridField(postedvo);
                // replace the original field by the Posted List field
                m_findFields[i] = postedfield;
                mField = postedfield;
            }
        }
        /** metas: teo_sarca: Specify exactly which are the search fields - http://sourceforge.net/projects/adempiere/forums/forum/610548/topic/3736214
			if (columnName.equals("Value"))
				hasValue = true;
			else if (columnName.equals("Name"))
				hasName = true;
			else if (columnName.equals("DocumentNo"))
				hasDocNo = true;
			else if (columnName.equals("Description"))
				hasDescription = true;
			else
			/**/
        if (mField.isSelectionColumn()) {
            addSelectionColumn(mField);
            isPair = !isPair;
        }
        /** metas: teo_sarca: Specify exactly which are the search fields - http://sourceforge.net/projects/adempiere/forums/forum/610548/topic/3736214
			else if (columnName.indexOf("Name") != -1)
				addSelectionColumn (mField);
			/**/
        //  TargetFields
        m_targetFields.put(new Integer(mField.getAD_Column_ID()), mField);
    }
    //  for all target tab fields
    //	Disable simple query fields
    valueLabel.setVisible(hasValue);
    valueField.setVisible(hasValue);
    if (hasValue)
        valueField.addActionListener(this);
    docNoLabel.setVisible(hasDocNo);
    docNoField.setVisible(hasDocNo);
    if (hasDocNo)
        docNoField.addActionListener(this);
    nameLabel.setVisible(hasName);
    nameField.setVisible(hasName);
    if (hasName)
        nameField.addActionListener(this);
    descriptionLabel.setVisible(hasDescription);
    descriptionField.setVisible(hasDescription);
    if (hasDescription)
        descriptionField.addActionListener(this);
    //	Get Total
    m_total = getNoOfRecords(null, false);
    setStatusDB(m_total);
    statusBar.setStatusLine("");
    tabbedPane.addChangeListener(this);
    //	Better Labels for OK/Cancel
    confirmPanelA.getOKButton().setToolTipText(Msg.getMsg(Env.getCtx(), "QueryEnter"));
    confirmPanelA.getCancelButton().setToolTipText(Msg.getMsg(Env.getCtx(), "QueryCancel"));
    confirmPanelS.getOKButton().setToolTipText(Msg.getMsg(Env.getCtx(), "QueryEnter"));
    confirmPanelS.getCancelButton().setToolTipText(Msg.getMsg(Env.getCtx(), "QueryCancel"));
}
Also used : GridFieldVO(org.compiere.model.GridFieldVO) GridField(org.compiere.model.GridField)

Example 9 with GridFieldVO

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

the class WOrderReceiptIssue method fillPicks.

//	init
/**
	 *	Fill Picks
	 *		Column_ID from C_Order
	 *	This is only run as part of the windows initialization process
	 *  @throws Exception if Lookups cannot be initialized
	 */
private void fillPicks() throws Exception {
    Properties ctx = Env.getCtx();
    // Base Language
    Language language = Language.getLoginLanguage();
    MLookup orderLookup = MLookupFactory.get(ctx, m_WindowNo, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_PP_Order_ID), DisplayType.Search, language, "PP_Order_ID", 0, false, "PP_Order.DocStatus = '" + MPPOrder.DOCACTION_Complete + "'");
    orderField = new WSearchEditor(MPPOrder.COLUMNNAME_PP_Order_ID, false, false, true, orderLookup);
    orderField.addValueChangeListener(this);
    MLookup resourceLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_S_Resource_ID), DisplayType.TableDir);
    resourceField = new WSearchEditor(MPPOrder.COLUMNNAME_S_Resource_ID, false, false, false, resourceLookup);
    MLookup warehouseLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir);
    warehouseField = new WSearchEditor(MPPOrder.COLUMNNAME_M_Warehouse_ID, false, false, false, warehouseLookup);
    MLookup productLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Product_ID), DisplayType.TableDir);
    productField = new WSearchEditor(MPPOrder.COLUMNNAME_M_Product_ID, false, false, false, productLookup);
    MLookup uomLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
    uomField = new WSearchEditor(MPPOrder.COLUMNNAME_C_UOM_ID, false, false, false, uomLookup);
    MLookup uomOrderLookup = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
    uomorderField = new WSearchEditor(MPPOrder.COLUMNNAME_C_UOM_ID, false, false, false, uomOrderLookup);
    MLocatorLookup locatorL = new MLocatorLookup(ctx, m_WindowNo);
    locatorField = new WLocatorEditor(MLocator.COLUMNNAME_M_Locator_ID, true, false, true, locatorL, m_WindowNo);
    //  Tab, Window
    int m_Window = MWindow.getWindow_ID("Manufacturing Order");
    GridFieldVO vo = GridFieldVO.createStdField(ctx, m_WindowNo, 0, m_Window, MTab.getTab_ID(m_Window, "Manufacturing Order"), false, false, false);
    vo.AD_Column_ID = MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID);
    vo.ColumnName = MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID;
    vo.displayType = DisplayType.PAttribute;
    GridField field = new GridField(vo);
    // M_AttributeSetInstance_ID
    attribute = new WPAttributeEditor(field.getGridTab(), field);
    attribute.setReadWrite(true);
    attribute.setValue(0);
    // 4Layers - Further init
    scrapQtyField.setValue(Env.ZERO);
    rejectQty.setValue(Env.ZERO);
    // 4Layers - end
    pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@IsBackflush@"), 1);
    pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@OnlyIssue@"), 2);
    pickcombo.appendItem(Msg.parseTranslation(Env.getCtx(), "@OnlyReceiptProduct@"), 3);
    pickcombo.addEventListener(Events.ON_CHANGE, this);
    Process.addActionListener(this);
    toDeliverQty.addValueChangeListener(this);
    scrapQtyField.addValueChangeListener(this);
}
Also used : MLocatorLookup(org.compiere.model.MLocatorLookup) WLocatorEditor(org.adempiere.webui.editor.WLocatorEditor) Language(org.compiere.util.Language) GridFieldVO(org.compiere.model.GridFieldVO) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) GridField(org.compiere.model.GridField) Properties(java.util.Properties) WPAttributeEditor(org.adempiere.webui.editor.WPAttributeEditor)

Example 10 with GridFieldVO

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

the class FindWindow method initFind.

private void initFind() {
    log.config("");
    //  Get Info from target Tab
    int parameterNo = 0;
    for (int i = 0; i < m_findFields.length; i++) {
        GridField mField = m_findFields[i];
        if (mField.isSelectionColumn())
            parameterNo++;
    }
    if (parameterNo >= 7)
        isTwoColumns = true;
    for (int i = 0; i < m_findFields.length; i++) {
        GridField mField = m_findFields[i];
        // Make Yes-No searchable as list
        if (mField.getVO().displayType == DisplayType.YesNo) {
            GridFieldVO vo = mField.getVO();
            GridFieldVO ynvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
            ynvo.IsDisplayed = true;
            ynvo.displayType = DisplayType.List;
            ynvo.AD_Reference_Value_ID = AD_REFERENCE_ID_YESNO;
            ynvo.lookupInfo = MLookupFactory.getLookupInfo(ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType, Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID, ynvo.IsParent, ynvo.ValidationCode);
            ynvo.lookupInfo.InfoFactoryClass = ynvo.InfoFactoryClass;
            GridField ynfield = new GridField(ynvo);
            // replace the original field by the YN List field
            m_findFields[i] = ynfield;
            mField = ynfield;
        }
        // Make Buttons searchable
        if (mField.getVO().displayType == DisplayType.Button) {
            GridFieldVO vo = mField.getVO();
            if (vo.AD_Reference_Value_ID > 0) {
                GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
                postedvo.IsDisplayed = true;
                postedvo.displayType = DisplayType.List;
                postedvo.lookupInfo = MLookupFactory.getLookupInfo(postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, postedvo.IsParent, postedvo.ValidationCode);
                postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass;
                GridField postedfield = new GridField(postedvo);
                // replace the original field by the Posted List field
                m_findFields[i] = postedfield;
                mField = postedfield;
            }
        }
        /** metas: teo_sarca: Specify exactly which are the search fields - http://sourceforge.net/projects/adempiere/forums/forum/610548/topic/3736214
            if (columnName.equals("Value"))
                hasValue = true;
            else if (columnName.equals("Name"))
                hasName = true;
            else if (columnName.equals("DocumentNo"))
                hasDocNo = true;
            else if (columnName.equals("Description"))
                hasDescription = true;
            else
            /**/
        if (mField.isSelectionColumn()) {
            addSelectionColumn(mField);
            isPair = !isPair;
        }
        /** metas: teo_sarca: Specify exactly which are the search fields - http://sourceforge.net/projects/adempiere/forums/forum/610548/topic/3736214
            else if (columnName.indexOf("Name") != -1)
                addSelectionColumn (mField);
            /**/
        //  TargetFields
        m_targetFields.put(new Integer(mField.getAD_Column_ID()), mField);
    }
    //  for all target tab fields
    //  Disable simple query fields
    pnlValue.setVisible(hasValue);
    if (hasValue)
        fieldValue.addEventListener(Events.ON_CHANGE, this);
    pnlDocument.setVisible(hasDocNo);
    if (hasDocNo)
        fieldDocumentNo.addEventListener(Events.ON_CHANGE, this);
    pnlName.setVisible(hasName);
    if (hasName)
        fieldName.addEventListener(Events.ON_CHANGE, this);
    pnlDescription.setVisible(hasDescription);
    if (hasDescription)
        fieldDescription.addEventListener(Events.ON_CHANGE, this);
    m_total = getNoOfRecords(null, false);
}
Also used : GridFieldVO(org.compiere.model.GridFieldVO) GridField(org.compiere.model.GridField)

Aggregations

GridFieldVO (org.compiere.model.GridFieldVO)12 GridField (org.compiere.model.GridField)10 Properties (java.util.Properties)2 MLocatorLookup (org.compiere.model.MLocatorLookup)2 MLookup (org.compiere.model.MLookup)2 Language (org.compiere.util.Language)2 Dimension (java.awt.Dimension)1 Insets (java.awt.Insets)1 WLocatorEditor (org.adempiere.webui.editor.WLocatorEditor)1 WPAttributeEditor (org.adempiere.webui.editor.WPAttributeEditor)1 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)1 GridController (org.compiere.grid.GridController)1 VLocator (org.compiere.grid.ed.VLocator)1 VLookup (org.compiere.grid.ed.VLookup)1 VPAttribute (org.compiere.grid.ed.VPAttribute)1 GridWindow (org.compiere.model.GridWindow)1 GridWindowVO (org.compiere.model.GridWindowVO)1 MAcctSchema (org.compiere.model.MAcctSchema)1 MAcctSchemaElement (org.compiere.model.MAcctSchemaElement)1 MPAttributeLookup (org.compiere.model.MPAttributeLookup)1