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

added SysConfig parameters
This commit is contained in:
teo_sarca 2009-09-06 06:42:13 +00:00
parent 2b177ce5c2
commit 9bbc11be55
3 changed files with 120 additions and 1 deletions

View File

@ -50,6 +50,7 @@ import org.compiere.minigrid.IDColumn;
import org.compiere.minigrid.MiniTable;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.swing.CDialog;
import org.compiere.swing.CMenuItem;
import org.compiere.swing.CPanel;
@ -73,6 +74,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
@ -81,6 +88,9 @@ public abstract class Info extends CDialog
*
*/
private static final long serialVersionUID = -5606614040914295869L;
public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED";
public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION";
/**
@ -306,6 +316,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 = MSysConfig.getBooleanValue(SYSCONFIG_INFO_DEFAULTSELECTED, false, Env.getAD_Client_ID(Env.getCtx()));
/** True if double click on a row toggles if row is selected (multi selection mode only) */
private boolean p_doubleClickTogglesSelection = MSysConfig.getBooleanValue(SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION, false, Env.getAD_Client_ID(Env.getCtx()));
/** Initial WHERE Clause */
protected String p_whereClause = "";
@ -1003,6 +1017,70 @@ public abstract class Info extends CDialog
return m_PO_Window_ID;
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;
}
/**************************************************************************
@ -1019,7 +1097,20 @@ public abstract class Info extends CDialog
if (e.getClickCount() > 1 && p_table.getSelectedRow() != -1)
{
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
dispose(true);
}
@ -1084,7 +1175,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)

View File

@ -0,0 +1,12 @@
-- Sep 6, 2009 9:20:34 AM EEST
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50032,'C',TO_DATE('2009-09-06 09:20:32','YYYY-MM-DD HH24:MI:SS'),0,'Info windows - Specify if the records should be checked(selected) by default (multi selection mode only)','D','Y','INFO_DEFAULTSELECTED',TO_DATE('2009-09-06 09:20:32','YYYY-MM-DD HH24:MI:SS'),0,'N')
;
-- Sep 6, 2009 9:21:13 AM EEST
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50033,'C',TO_DATE('2009-09-06 09:21:12','YYYY-MM-DD HH24:MI:SS'),0,'Info Window - True if double click on a row toggles if row is selected (multi selection mode only)','D','Y','INFO_DOUBLECLICKTOGGLESSELECTION',TO_DATE('2009-09-06 09:21:12','YYYY-MM-DD HH24:MI:SS'),0,'50000')
;
-- Sep 6, 2009 9:21:22 AM EEST
UPDATE AD_SysConfig SET Value='N',Updated=TO_DATE('2009-09-06 09:21:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_SysConfig_ID=50033
;

View File

@ -0,0 +1,12 @@
-- Sep 6, 2009 9:20:34 AM EEST
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50032,'C',TO_TIMESTAMP('2009-09-06 09:20:32','YYYY-MM-DD HH24:MI:SS'),0,'Info windows - Specify if the records should be checked(selected) by default (multi selection mode only)','D','Y','INFO_DEFAULTSELECTED',TO_TIMESTAMP('2009-09-06 09:20:32','YYYY-MM-DD HH24:MI:SS'),0,'N')
;
-- Sep 6, 2009 9:21:13 AM EEST
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50033,'C',TO_TIMESTAMP('2009-09-06 09:21:12','YYYY-MM-DD HH24:MI:SS'),0,'Info Window - True if double click on a row toggles if row is selected (multi selection mode only)','D','Y','INFO_DOUBLECLICKTOGGLESSELECTION',TO_TIMESTAMP('2009-09-06 09:21:12','YYYY-MM-DD HH24:MI:SS'),0,'50000')
;
-- Sep 6, 2009 9:21:22 AM EEST
UPDATE AD_SysConfig SET Value='N',Updated=TO_TIMESTAMP('2009-09-06 09:21:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_SysConfig_ID=50033
;