From be66313aaf7d4766f27242ffcbbe5bb2f875ce5f Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Sat, 23 Jun 2007 18:40:50 +0000 Subject: [PATCH] BF [ 1742159 ] Editable number field for inactive record http://sourceforge.net/tracker/index.php?func=detail&aid=1742159&group_id=176962&atid=879332 --- base/src/org/compiere/model/GridTab.java | 44 ++++++++++++++----- .../src/org/compiere/grid/GridController.java | 4 +- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index bf7a5f554e..0c4c6e8a09 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -49,6 +49,8 @@ import org.compiere.util.*; * * @author Jorg Janke * @version $Id: GridTab.java,v 1.10 2006/10/02 05:18:39 jjanke Exp $ + * + * @author Teo Sarca - BF [ 1742159 ] */ public class GridTab implements DataStatusListener, Evaluatee, Serializable { @@ -2279,16 +2281,17 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable */ public boolean isProcessed() { - int index = m_mTable.findColumn("Processed"); - if (index != -1) - { - Object oo = m_mTable.getValueAt(m_currentRow, index); - if (oo instanceof String) - return "Y".equals(oo); - if (oo instanceof Boolean) - return ((Boolean)oo).booleanValue(); - } - return "Y".equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, "Processed")); + return getValueAsBoolean("Processed"); + } // isProcessed + + /** + * Is the current record active + * @return true if current record is active + * @author Teo Sarca - BF [ 1742159 ] + */ + public boolean isActive() + { + return getValueAsBoolean("IsActive"); } // isProcessed /** @@ -2429,6 +2432,27 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable return getValue(field); } // getValue + /** + * Get Boolean Value of Field with columnName. + * If there is no column with the given name, the context for current window will be checked. + * @param columnName column name + * @return boolean value or false if the field was not found + * @author Teo Sarca + */ + public boolean getValueAsBoolean(String columnName) + { + int index = m_mTable.findColumn(columnName); + if (index != -1) + { + Object oo = m_mTable.getValueAt(m_currentRow, index); + if (oo instanceof String) + return "Y".equals(oo); + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + } + return "Y".equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, columnName)); + } // isProcessed + /** * Get Value of Field * @param field field diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index 95b915f5db..f62ccb4f62 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -94,6 +94,8 @@ import org.compiere.util.*; * * @author Jorg Janke * @version $Id: GridController.java,v 1.8 2006/09/25 00:59:52 jjanke Exp $ + * + * @author Teo Sarca - BF [ 1742159 ] */ public class GridController extends CPanel implements DataStatusListener, ListSelectionListener, Evaluatee, @@ -962,7 +964,7 @@ public class GridController extends CPanel */ public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { - if (m_mTab.isProcessed()) // only active records + if (m_mTab.isProcessed() || !m_mTab.isActive()) // only active records { Object source = e.getSource(); if (source instanceof VEditor)