BF [ 1742159 ] Editable number field for inactive record

http://sourceforge.net/tracker/index.php?func=detail&aid=1742159&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2007-06-23 18:40:50 +00:00
parent 074584f043
commit be66313aaf
2 changed files with 37 additions and 11 deletions

View File

@ -49,6 +49,8 @@ import org.compiere.util.*;
* </pre> * </pre>
* @author Jorg Janke * @author Jorg Janke
* @version $Id: GridTab.java,v 1.10 2006/10/02 05:18:39 jjanke Exp $ * @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 public class GridTab implements DataStatusListener, Evaluatee, Serializable
{ {
@ -2279,16 +2281,17 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/ */
public boolean isProcessed() public boolean isProcessed()
{ {
int index = m_mTable.findColumn("Processed"); return getValueAsBoolean("Processed");
if (index != -1) } // isProcessed
{
Object oo = m_mTable.getValueAt(m_currentRow, index); /**
if (oo instanceof String) * Is the current record active
return "Y".equals(oo); * @return true if current record is active
if (oo instanceof Boolean) * @author Teo Sarca - BF [ 1742159 ]
return ((Boolean)oo).booleanValue(); */
} public boolean isActive()
return "Y".equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, "Processed")); {
return getValueAsBoolean("IsActive");
} // isProcessed } // isProcessed
/** /**
@ -2429,6 +2432,27 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return getValue(field); return getValue(field);
} // getValue } // 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 * Get Value of Field
* @param field field * @param field field

View File

@ -94,6 +94,8 @@ import org.compiere.util.*;
* </pre> * </pre>
* @author Jorg Janke * @author Jorg Janke
* @version $Id: GridController.java,v 1.8 2006/09/25 00:59:52 jjanke Exp $ * @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 public class GridController extends CPanel
implements DataStatusListener, ListSelectionListener, Evaluatee, implements DataStatusListener, ListSelectionListener, Evaluatee,
@ -962,7 +964,7 @@ public class GridController extends CPanel
*/ */
public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException 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(); Object source = e.getSource();
if (source instanceof VEditor) if (source instanceof VEditor)