public WButtonEditor(GridField gridField, int rowIndex) { super(new Button(), gridField, rowIndex); m_text = gridField.getHeader(); AD_Process_ID = gridField.getAD_Process_ID(); gridfield = gridField; init(); }
private void verifyChangedField(GridField field, String columnName) { ArrayList<String> list = field.getDependentOn(); if (list.contains(columnName)) { if (field.getLookup() instanceof MLookup) { MLookup mLookup = (MLookup) field.getLookup(); // if the lookup is dynamic (i.e. contains this columnName as variable) if (mLookup.getValidation().indexOf("@" + columnName + "@") != -1) { log.fine(columnName + " changed - " + field.getColumnName() + " set to null"); // invalidate current selection field.setValue(null, true); } } } }
/** * Add Editor to parameterPanel alernative right/left depending on m_newRow. Field Value changes * update Editors * * @param field field * @param editor editor * @param mandatory mandatory */ private void addLine(GridField field, VEditor editor, boolean mandatory) { log.fine("Field=" + field); JLabel label = VEditorFactory.getLabel(field); label.setLabelFor((Component) editor); editor.setReadWrite(true); editor.setMandatory(mandatory); // MField => VEditor field.addPropertyChangeListener(editor); // label if (m_newRow) { m_gbc.gridy = m_line++; m_gbc.gridx = 0; } else m_gbc.gridx = 2; m_gbc.insets = m_labelInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 0; parameterPanel.add(label, m_gbc); // Field if (m_newRow) m_gbc.gridx = 1; else m_gbc.gridx = 3; m_gbc.insets = m_fieldInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 1; parameterPanel.add((Component) editor, m_gbc); // m_newRow = !m_newRow; } // addLine
public String priceBeco( Ctx ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) { System.out.println("pricebeco ... "); try { BigDecimal precio = (BigDecimal) mField.getValue(); String priceRuleSQL = "select xx_lowrank,xx_highrank,xx_termination,xx_increase,xx_infinitevalue from xx_vme_pricerule order by (xx_lowrank)"; PreparedStatement priceRulePstmt = DB.prepareStatement(priceRuleSQL, null); ResultSet priceRuleRs = priceRulePstmt.executeQuery(); Integer precioInt = precio.intValue(); BigDecimal precioBig = new BigDecimal(precioInt); while (priceRuleRs.next()) { if (precioBig.compareTo(priceRuleRs.getBigDecimal("xx_lowrank")) >= 0 && precioBig.compareTo(priceRuleRs.getBigDecimal("xx_highrank")) <= 0) { Integer incremento = priceRuleRs.getInt("xx_increase"); for (Integer i = priceRuleRs.getInt("xx_lowrank") - 1; i <= priceRuleRs.getInt("xx_highrank"); i = i + incremento) { BigDecimal var = new BigDecimal(i); if (precioBig.compareTo(var) <= 0) { BigDecimal beco = var; BigDecimal terminacion = priceRuleRs.getBigDecimal("xx_termination"); if (terminacion.intValue() == 0) { beco = var.add(terminacion); } else { var = var.divide(new BigDecimal(10)); Integer aux = var.intValue() * 10; beco = new BigDecimal(aux).add(terminacion); } // mTab.setValue("PriceList", beco); priceRuleRs.close(); priceRulePstmt.close(); if (beco.compareTo(precio) == 0) { return priceBandBeco(ctx, WindowNo, mTab, mField, value, oldValue); // return""; } else { mTab.setValue("PriceList", beco); return ""; // return "Precio Beco Sugerido "+beco.toString(); } } } } } priceRuleRs.close(); priceRulePstmt.close(); return priceBandBeco(ctx, WindowNo, mTab, mField, value, oldValue); // return ""; } catch (Exception e) { return e.getMessage(); } }
/** @param gridField */ public WLocatorEditor(GridField gridField) { super(new EditorBox(), gridField); m_mLocator = (MLocatorLookup) gridField.getLookup(); getComponent().setButtonImage("/images/Locator10.png"); setDefault_Locator_ID(); // set default locator, teo_sarca [ 1661546 ] m_WindowNo = gridField.getWindowNo(); if (gridField != null) { popupMenu = new WEditorPopupMenu(true, true, false); if (gridField != null && gridField.getGridTab() != null) { WRecordInfo.addMenu(popupMenu); } getComponent().setContext(popupMenu.getId()); } }
@Override public synchronized Object put(Object key, Object value) { if (gridTab == null) throw new IllegalStateException("Method not supported (gridTab is null)"); if (gridTab.getCurrentRow() != row) { return ctx.put(key, value); } String columnName = getColumnName(key); if (columnName == null) { return ctx.put(key, value); } GridField field = gridTab.getField(columnName); if (field == null) { return ctx.put(key, value); } Object valueOld = field.getValue(); field.setValue(value, false); // inserting=false return valueOld; }
/** * Restore window context. * * @author teo_sarca [ 1699826 ] * @see org.compiere.model.GridField#restoreValue() */ protected void cleanContext() { for (GridField f : m_mFields) { if (f != null) { f.restoreValue(); Env.setContext(f.getVO().ctx, p_WindowNo, f.getVO().Help, ""); } } for (GridField f : m_mFields2) { if (f != null) { f.restoreValue(); Env.setContext(f.getVO().ctx, p_WindowNo, f.getVO().Help, ""); } } }
/** Dynamic Display. */ public void dynamicDisplay() { for (int i = 0; i < m_wEditors.size(); i++) { WEditor editor = m_wEditors.get(i); GridField mField = editor.getGridField(); if (mField.isDisplayed(true)) { if (!editor.isVisible()) { editor.setVisible(true); if (mField.getVO().isRange) { // m_separators.get(i).setVisible(true); m_wEditors2.get(i).setVisible(true); } } boolean rw = mField.isEditablePara(true); // r/w - check if // field is Editable editor.setReadWrite(rw); editor.dynamicDisplay(); if (mField.getVO().isRange) { WEditor editorRange = m_wEditors2.get(i); if (editorRange != null) { editorRange.setReadWrite(rw); editorRange.dynamicDisplay(); } } } else if (editor.isVisible()) { editor.setVisible(false); if (mField.getVO().isRange) { // m_separators.get(i).setVisible(false); m_wEditors2.get(i).setVisible(false); } } } }
/** * Evaluate Dependencies * * @param changedField changed field */ private void processDependencies(GridField changedField) { String columnName = changedField.getVO().Help; ; for (GridField field : m_mFields) { if (field == null || field == changedField) continue; verifyChangedField(field, columnName); } for (GridField field : m_mFields2) { if (field == null || field == changedField) continue; verifyChangedField(field, columnName); } } // processDependencies
/** * Dyanmic Init. When a row is selected, the editor values are set (editors do not change grid) * * @return true if initialized */ private boolean initAccount() { m_AD_Client_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "AD_Client_ID"); // Get AcctSchema Info if (s_AcctSchema == null || s_AcctSchema.getC_AcctSchema_ID() != m_C_AcctSchema_ID) s_AcctSchema = new MAcctSchema(Env.getCtx(), m_C_AcctSchema_ID, null); log.config(s_AcctSchema.toString() + ", #" + s_AcctSchema.getAcctSchemaElements().length); Env.setContext(Env.getCtx(), m_WindowNo, "C_AcctSchema_ID", m_C_AcctSchema_ID); // Model int AD_Window_ID = 153; // Maintain Account Combinations GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0); if (wVO == null) return false; m_mWindow = new GridWindow(wVO); m_mTab = m_mWindow.getTab(0); // Make sure is the tab is loaded - teo_sarca [ 1659124 ] if (!m_mTab.isLoadComplete()) m_mWindow.initTab(0); // ParameterPanel restrictions m_mTab.getField("Alias").setDisplayLength(15); m_mTab.getField("Combination").setDisplayLength(15); // Grid restrictions m_mTab.getField("AD_Client_ID").setDisplayed(false); m_mTab.getField("C_AcctSchema_ID").setDisplayed(false); m_mTab.getField("IsActive").setDisplayed(false); m_mTab.getField("IsFullyQualified").setDisplayed(false); // don't show fields not being displayed in this environment for (int i = 0; i < m_mTab.getFieldCount(); i++) { GridField field = m_mTab.getField(i); if (!field.isDisplayed(true)) // check context field.setDisplayed(false); } // GridController m_gridController = new GridController(); m_gridController.initGrid(m_mTab, true, m_WindowNo, null, null); m_gridController.setPreferredSize(new Dimension(300, 100)); panel.add(m_gridController, BorderLayout.CENTER); // Prepare Parameter m_gbc.anchor = GridBagConstraints.NORTHWEST; m_gbc.gridy = 0; // line m_gbc.gridx = 0; m_gbc.gridwidth = 1; m_gbc.insets = m_fieldInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 0; m_gbc.weighty = 0; int TabNo = 0; // Alias if (s_AcctSchema.isHasAlias()) { GridField alias = m_mTab.getField("Alias"); f_Alias = VEditorFactory.getEditor(m_mTab, alias, false); addLine(alias, f_Alias, false); } // Alias // Combination GridField combination = m_mTab.getField("Combination"); f_Combination = VEditorFactory.getEditor(m_mTab, combination, false); addLine(combination, f_Combination, false); m_newRow = true; /** Create Fields in Element Order */ MAcctSchemaElement[] elements = s_AcctSchema.getAcctSchemaElements(); for (int i = 0; i < elements.length; i++) { MAcctSchemaElement ase = elements[i]; String type = ase.getElementType(); boolean isMandatory = ase.isMandatory(); // if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Organization)) { GridField field = m_mTab.getField("AD_Org_ID"); f_AD_Org_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_AD_Org_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Account)) { GridField field = m_mTab.getField("Account_ID"); f_Account_ID = VEditorFactory.getEditor(m_mTab, field, false); // ((VLookup)f_Account_ID).setWidth(400); addLine(field, f_Account_ID, isMandatory); f_Account_ID.addVetoableChangeListener(this); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SubAccount)) { GridField field = m_mTab.getField("C_SubAcct_ID"); f_SubAcct_ID = VEditorFactory.getEditor(m_mTab, field, false); // ((VLookup)f_SubAcct_ID).setWidth(400); addLine(field, f_SubAcct_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Product)) { GridField field = m_mTab.getField("M_Product_ID"); f_M_Product_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_M_Product_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_BPartner)) { GridField field = m_mTab.getField("C_BPartner_ID"); f_C_BPartner_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_BPartner_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Campaign)) { GridField field = m_mTab.getField("C_Campaign_ID"); f_C_Campaign_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Campaign_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationFrom)) { GridField field = m_mTab.getField("C_LocFrom_ID"); f_C_LocFrom_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_LocFrom_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationTo)) { GridField field = m_mTab.getField("C_LocTo_ID"); f_C_LocTo_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_LocTo_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Project)) { GridField field = m_mTab.getField("C_Project_ID"); f_C_Project_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Project_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SalesRegion)) { GridField field = m_mTab.getField("C_SalesRegion_ID"); f_C_SalesRegion_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_SalesRegion_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_OrgTrx)) { GridField field = m_mTab.getField("AD_OrgTrx_ID"); f_AD_OrgTrx_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_AD_OrgTrx_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Activity)) { GridField field = m_mTab.getField("C_Activity_ID"); f_C_Activity_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Activity_ID, isMandatory); } // User1 else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList1)) { GridField field = m_mTab.getField("User1_ID"); f_User1_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_User1_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList2)) { GridField field = m_mTab.getField("User2_ID"); f_User2_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_User2_ID, isMandatory); } } // Create Fields in Element Order // Add description m_newRow = true; m_gbc.gridy = m_line++; m_gbc.gridx = 0; m_gbc.gridwidth = 4; m_gbc.insets = new Insets(5, 15, 2, 0); // top,left,bottom,right m_gbc.fill = GridBagConstraints.HORIZONTAL; f_Description.setFont(f_Description.getFont().deriveFont(Font.ITALIC)); parameterPanel.add(f_Description, m_gbc); // Finish m_query = new MQuery(); m_query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID); m_query.addRestriction("IsFullyQualified", MQuery.EQUAL, "Y"); if (m_mAccount.C_ValidCombination_ID == 0) m_mTab.setQuery(MQuery.getEqualQuery("1", "2")); else { MQuery query = new MQuery(); query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID); query.addRestriction("C_ValidCombination_ID", MQuery.EQUAL, m_mAccount.C_ValidCombination_ID); m_mTab.setQuery(query); } m_mTab.query(false); m_gridController.getTable().addMouseListener(new VAccountDialog_mouseAdapter(this)); m_gridController.addDataStatusListener(this); statusBar.setStatusLine(s_AcctSchema.toString()); statusBar.setStatusDB("?"); // Initial value if (m_mAccount.C_ValidCombination_ID != 0) m_mTab.navigate(0); log.config("fini"); return true; } // initAccount
/** * Create Left Top aligned TD * * @param element element * @return td table data */ private WebDoc CreateChatPage(WWindowStatus ws, WebSessionCtx wsc, WebDoc doc, int CM_Chat_ID) { doc = WebDoc.createPopup("Chat "); td center = doc.addWindowCenter(false); int record_ID = ws.curTab.getRecord_ID(); log.info("Record_ID=" + record_ID); if (record_ID == -1) // No Key { log.info("Record does not exist"); return doc; } // Find display String infoName = null; String infoDisplay = null; for (int i = 0; i < ws.curTab.getFieldCount(); i++) { GridField field = ws.curTab.getField(i); if (field.isKey()) infoName = field.getHeader(); if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null) infoDisplay = field.getValue().toString(); if (infoName != null && infoDisplay != null) break; } String description = infoName + ": " + infoDisplay; // if (ws.curTab.getCM_ChatID() > 0) m_chat = new MChat(wsc.ctx, ws.curTab.getCM_ChatID(), null); else if (CM_Chat_ID > 0) m_chat = new MChat(wsc.ctx, CM_Chat_ID, null); else m_chat = new MChat(wsc.ctx, ws.curTab.getAD_Table_ID(), record_ID, description, null); String text = m_chat.getHistory(MChat.CONFIDENTIALTYPE_Internal).toString(); form myForm = new form("WChat").setName("chat"); myForm.setOnSubmit("this.Submit.disabled=true;return true;"); if (CM_Chat_ID == 0) myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", ws.curTab.getCM_ChatID())); else myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", CM_Chat_ID)); myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", ws.curTab.getAD_Table_ID())); myForm.addElement(new input(input.TYPE_HIDDEN, "record_ID", record_ID)); myForm.addElement(new input(input.TYPE_HIDDEN, "description", description)); table myTable = new table("0", "0", "5", "100%", null); myTable.setID("WChatParameter"); m_displayLength = 80; // history field myTable.addElement(new tr().addElement(new td("History"))); m_readOnly = true; table HistoryTable = new table("1", "0", "5", "100%", null); HistoryTable.addElement( new tr() .addElement( new td(text) .setRowSpan(10) .setAlign(AlignType.LEFT) .setVAlign(AlignType.TOP) .setColSpan(4))); myTable.addElement(HistoryTable); // input field myTable.addElement(new tr().addElement(new td("Input"))); m_readOnly = false; m_columnName = "chatinput"; myTable.addElement(new tr().addElement(getTextField("", 10))); // Reset String textbtn = "Reset"; if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Reset"); input restbtn = new input(input.TYPE_RESET, textbtn, " " + text); restbtn.setID(text); restbtn.setClass("resetbtn"); // Submit textbtn = "Submit"; if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Submit"); input submitbtn = new input(input.TYPE_SUBMIT, textbtn, " " + text); submitbtn.setID(text); submitbtn.setClass("submitbtn"); // Close textbtn = "Close"; if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Close"); input closebtn = new input(input.TYPE_SUBMIT, textbtn, " " + text); closebtn.setID(text); closebtn.setClass("closebtn"); closebtn.setOnClick("self.close();return false;"); myTable.addElement( new tr() .addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false, restbtn)) .addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false, submitbtn)) .addElement(new td(null, AlignType.LEFT, AlignType.MIDDLE, false, closebtn))); myForm.addElement(myTable); center.addElement(myForm); return doc; }
/** @param e */ public void valueChange(ValueChangeEvent e) { if (gridTab.isProcessed()) // only active records { Object source = e.getSource(); if (source instanceof WEditor) { // Elaine 2009/05/06 WEditor editor = (WEditor) source; GridField gridField = editor.getGridField(); if (gridField != null) { if (!gridField.isEditable(true)) { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } else if (!editor.isReadWrite()) { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } else { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } // processed logger.config( "(" + gridTab.toString() + ") " + e.getPropertyName() + "=" + e.getNewValue() + " (" + e.getOldValue() + ") " + (e.getOldValue() == null ? "" : e.getOldValue().getClass().getName())); // Get Row/Col Info GridTable mTable = gridTab.getTableModel(); int row = gridTab.getCurrentRow(); int col = mTable.findColumn(e.getPropertyName()); // if (e.getNewValue() == null && e.getOldValue() != null && e.getOldValue().toString().length() > 0) // some editors return "" instead of null // this is the original code from GridController, don't know what it does there but // it breaks ignore button for web ui // mTable.setChanged (true); mTable.setValueAt(e.getNewValue(), row, col); else { Object newValue = e.getNewValue(); Integer newValues[] = null; if (newValue instanceof Integer[]) { newValues = ((Integer[]) newValue); newValue = newValues[0]; if (newValues.length > 1) { Integer valuesCopy[] = new Integer[newValues.length - 1]; System.arraycopy(newValues, 1, valuesCopy, 0, valuesCopy.length); newValues = valuesCopy; } else { newValues = null; } } else if (newValue instanceof Object[]) { logger.severe("Multiple values can only be processed for IDs (Integer)"); throw new IllegalArgumentException( "Multiple Selection values not available for this field. " + e.getPropertyName()); } mTable.setValueAt(newValue, row, col); // Force Callout if (e.getPropertyName().equals("S_ResourceAssignment_ID")) { GridField mField = gridTab.getField(col); if (mField != null && mField.getCallout().length() > 0) { gridTab.processFieldChange(mField); // Dependencies & Callout } } if (newValues != null && newValues.length > 0) { // Save data, since record need to be used for generating clones. if (!gridTab.dataSave(false)) { throw new AdempiereException("SaveError"); } // Retrieve the current record ID int recordId = gridTab.getKeyID(gridTab.getCurrentRow()); Trx trx = Trx.get(Trx.createTrxName(), true); trx.start(); try { saveMultipleRecords( Env.getCtx(), gridTab.getTableName(), e.getPropertyName(), recordId, newValues, trx.getTrxName()); trx.commit(); gridTab.dataRefreshAll(); } catch (Exception ex) { trx.rollback(); logger.severe(ex.getMessage()); throw new AdempiereException("SaveError"); } finally { trx.close(); } } } } // ValueChange
public void addField(MBrowseField field, Row row, String name, String title) { GridFieldVO voBase = GridFieldVO.createStdField(field.getCtx(), p_WindowNo, 0, 0, 0, false, false, false); String uniqueName = field.getAD_View_Column().getColumnSQL(); voBase.isProcess = true; voBase.IsDisplayed = true; voBase.IsReadOnly = false; voBase.IsUpdateable = true; voBase.WindowNo = p_WindowNo; voBase.AD_Column_ID = field.getAD_View_Column().getAD_Column_ID(); voBase.AD_Table_ID = field.getAD_View_Column().getAD_Column().getAD_Table_ID(); voBase.ColumnName = field.getAD_View_Column().getAD_Column().getColumnName(); voBase.displayType = field.getAD_Reference_ID(); voBase.AD_Reference_Value_ID = field.getAD_Reference_Value_ID(); voBase.IsMandatory = field.isMandatory(); voBase.IsAlwaysUpdateable = false; voBase.IsKey = field.isKey(); voBase.DefaultValue = 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(); voBase.isRange = field.isRange(); voBase.Description = field.getDescription(); voBase.Help = uniqueName; voBase.Header = title; GridField gField = new GridField(GridFieldVO.createParameter(voBase)); GridField gField2 = null; WEditor editor = WebEditorFactory.getEditor(gField, false); editor.setReadWrite(true); editor.addValueChangeListener(this); editor.dynamicDisplay(); gField.addPropertyChangeListener(editor); Object defaultObject = null; Object defaultObject2 = null; // Set Default if (field.getAD_View_Column().getAD_Column_ID() > 0) { defaultObject = gField.getDefault(); if (defaultObject != null && field.getDefaultValue() != null) { gField.setValue(defaultObject, true); editor.setValue(defaultObject); } } gField.lookupLoadComplete(); m_mFields.add(gField); m_wEditors.add(editor); if (DisplayType.YesNo != field.getAD_Reference_ID()) { Div div = new Div(); div.setAlign("right"); org.adempiere.webui.component.Label label = editor.getLabel(); label.setValue(title); div.appendChild(label); if (label.getDecorator() != null) div.appendChild(label.getDecorator()); row.appendChild(div); } row.appendChild(editor.getComponent()); setParameter(name, editor); if (field.isRange()) { title = Msg.getMsg(Env.getCtx(), "To"); name = name + "_To"; voBase.Header = title; voBase.DefaultValue = field.getDefaultValue2(); gField2 = new GridField(GridFieldVO.createParameter(voBase)); gField2.lookupLoadComplete(); WEditor editor2 = WebEditorFactory.getEditor(gField2, false); editor2.setReadWrite(true); editor2.addValueChangeListener(this); editor2.dynamicDisplay(); // Set Default if (field.getAD_View_Column().getAD_Column_ID() > 0) { defaultObject2 = gField2.getDefault(); if (defaultObject2 != null && field.getDefaultValue2() != null) { gField2.setValue(defaultObject2, true); editor2.setValue(defaultObject2); } } m_mFields2.add(gField2); m_wEditors2.add(editor2); Div div = new Div(); div.setAlign("right"); org.adempiere.webui.component.Label label = editor2.getLabel(); label.setValue(title); div.appendChild(label); if (label.getDecorator() != null) div.appendChild(label.getDecorator()); row.appendChild(div); row.appendChild(editor2.getComponent()); setParameter(name, editor2); } else { m_mFields2.add(null); m_wEditors2.add(null); } if (gField != null) processNewValue(defaultObject, gField.getVO().Help); if (gField2 != null) processNewValue(defaultObject2, gField2.getVO().Help); }