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:
parent
86a4329ac4
commit
9b9deeca04
|
@ -73,6 +73,12 @@ import org.compiere.util.Msg;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: Info.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
* @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
|
public abstract class Info extends CDialog
|
||||||
implements ListSelectionListener
|
implements ListSelectionListener
|
||||||
|
@ -306,6 +312,10 @@ public abstract class Info extends CDialog
|
||||||
protected String p_keyColumn;
|
protected String p_keyColumn;
|
||||||
/** Enable more than one selection */
|
/** Enable more than one selection */
|
||||||
protected boolean p_multiSelection;
|
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 */
|
/** Initial WHERE Clause */
|
||||||
protected String p_whereClause = "";
|
protected String p_whereClause = "";
|
||||||
|
|
||||||
|
@ -1004,6 +1014,70 @@ public abstract class Info extends CDialog
|
||||||
return m_SO_Window_ID;
|
return m_SO_Window_ID;
|
||||||
} // getAD_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
|
* Mouse Clicked
|
||||||
|
@ -1020,6 +1094,19 @@ public abstract class Info extends CDialog
|
||||||
{
|
{
|
||||||
if (p_WindowNo == 0)
|
if (p_WindowNo == 0)
|
||||||
zoom();
|
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
|
else
|
||||||
dispose(true);
|
dispose(true);
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1171,11 @@ public abstract class Info extends CDialog
|
||||||
Class<?> c = p_layout[col].getColClass();
|
Class<?> c = p_layout[col].getColClass();
|
||||||
int colIndex = col + colOffset;
|
int colIndex = col + colOffset;
|
||||||
if (c == IDColumn.class)
|
if (c == IDColumn.class)
|
||||||
|
{
|
||||||
data = new IDColumn(m_rs.getInt(colIndex));
|
data = new IDColumn(m_rs.getInt(colIndex));
|
||||||
|
if (p_multiSelection)
|
||||||
|
((IDColumn)data).setSelected(isDefaultSelected());
|
||||||
|
}
|
||||||
else if (c == Boolean.class)
|
else if (c == Boolean.class)
|
||||||
data = new Boolean("Y".equals(m_rs.getString(colIndex)));
|
data = new Boolean("Y".equals(m_rs.getString(colIndex)));
|
||||||
else if (c == Timestamp.class)
|
else if (c == Timestamp.class)
|
||||||
|
|
Loading…
Reference in New Issue