FR [ 2846869 ] Info class - add more helper methods

https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2846869&group_id=176962
FR [ 2847305 ] Info class improvements
https://sourceforge.net/tracker/?func=detail&aid=2847305&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-08-31 13:00:42 +00:00
parent 86a4329ac4
commit 9b9deeca04
1 changed files with 92 additions and 1 deletions

View File

@ -73,6 +73,12 @@ import org.compiere.util.Msg;
*
* @author Jorg Janke
* @version $Id: Info.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*
* @author Teo Sarca
* <li>FR [ 2846869 ] Info class - add more helper methods
* https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2846869&group_id=176962
* <li>FR [ 2847305 ] Info class improvements
* https://sourceforge.net/tracker/?func=detail&aid=2847305&group_id=176962&atid=879335
*/
public abstract class Info extends CDialog
implements ListSelectionListener
@ -306,6 +312,10 @@ public abstract class Info extends CDialog
protected String p_keyColumn;
/** Enable more than one selection */
protected boolean p_multiSelection;
/** Specify if the records should be checked(selected) by default (multi selection mode only) */
private boolean p_isDefaultSelected = false;
/** True if double click on a row toggles if row is selected (multi selection mode only) */
private boolean p_doubleClickTogglesSelection = false;
/** Initial WHERE Clause */
protected String p_whereClause = "";
@ -1004,6 +1014,70 @@ public abstract class Info extends CDialog
return m_SO_Window_ID;
} // getAD_Window_ID
/**
*
* @return Index of Key Column
*/
protected int getKeyColumnIndex()
{
return m_keyColumnIndex;
}
/**
*
* @return true if OK button was pressed
*/
public boolean isOkPressed()
{
return m_ok;
}
/**
*
* @return true if Cancel button was pressed
*/
public boolean isCancelPressed()
{
return m_cancel;
}
/**
* Specify if the records should be checked(selected) by default.
* (for multi-selection only)
* @param value
*/
public void setDefaultSelected(boolean value)
{
p_isDefaultSelected = value;
}
/**
* (for multi-selection only)
* @return true if records are selected by default
*/
public boolean isDefaultSelected()
{
return p_isDefaultSelected;
}
/**
* (for multi-selection only)
* @param value true if double click should toggle record selection
*/
public void setDoubleClickTogglesSelection(boolean value)
{
p_doubleClickTogglesSelection = value;
}
/**
* (for multi-selection only)
* @return true if double click should toggle record selection
*/
public boolean isDoubleClickTogglesSelection()
{
return p_doubleClickTogglesSelection;
}
/**************************************************************************
* Mouse Clicked
@ -1020,6 +1094,19 @@ public abstract class Info extends CDialog
{
if (p_WindowNo == 0)
zoom();
else if (p_multiSelection && isDoubleClickTogglesSelection())
{
if (m_keyColumnIndex >= 0)
{
Object data = p_table.getValueAt(p_table.getSelectedRow(), m_keyColumnIndex);
if (data instanceof IDColumn)
{
IDColumn id = (IDColumn)data;
id.setSelected(!id.isSelected());
p_table.setValueAt(data, p_table.getSelectedRow(), m_keyColumnIndex);
}
}
}
else
dispose(true);
}
@ -1084,7 +1171,11 @@ public abstract class Info extends CDialog
Class<?> c = p_layout[col].getColClass();
int colIndex = col + colOffset;
if (c == IDColumn.class)
{
data = new IDColumn(m_rs.getInt(colIndex));
if (p_multiSelection)
((IDColumn)data).setSelected(isDefaultSelected());
}
else if (c == Boolean.class)
data = new Boolean("Y".equals(m_rs.getString(colIndex)));
else if (c == Timestamp.class)