IDEMPIERE-5921 Enable Multi-Selection on Search fields (Info Windows) by default (#2107)
* IDEMPIERE-5921 Enable Multi-Selection on Search fields (Info Windows) by default * Fix first open as single selection * Make it work as single selection for custom form (tested with Payment Allocation form) * Added setMultipleSelection(boolean) api * * Fix also Info Product on forms --------- Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
parent
75be677f2e
commit
2547edf522
|
@ -107,6 +107,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
protected ADWindow adwindow;
|
protected ADWindow adwindow;
|
||||||
private EventListener<InputEvent> autoCompleteListener;
|
private EventListener<InputEvent> autoCompleteListener;
|
||||||
|
|
||||||
|
protected boolean multipleSelection = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param gridField
|
* @param gridField
|
||||||
|
@ -133,6 +135,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
|
|
||||||
init();
|
init();
|
||||||
getComponent().setAttribute(ATTRIBUTE_IS_INFO_PANEL_OPEN, false);
|
getComponent().setAttribute(ATTRIBUTE_IS_INFO_PANEL_OPEN, false);
|
||||||
|
multipleSelection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +179,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
columnName = lookup.getColumnName();
|
columnName = lookup.getColumnName();
|
||||||
super.setColumnName(columnName);
|
super.setColumnName(columnName);
|
||||||
init();
|
init();
|
||||||
|
multipleSelection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,6 +204,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
super.setColumnName(columnName);
|
super.setColumnName(columnName);
|
||||||
init();
|
init();
|
||||||
|
multipleSelection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -512,7 +517,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
setTableAndKeyColumn();
|
setTableAndKeyColumn();
|
||||||
|
|
||||||
// process input text with infopanel/infowindow
|
// process input text with infopanel/infowindow
|
||||||
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, getComponent().getText(), true, getWhereClause());
|
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, getComponent().getText(), multipleSelection, getWhereClause());
|
||||||
if (ip != null && ip.loadedOK() && ip.getRowCount() == 1)
|
if (ip != null && ip.loadedOK() && ip.getRowCount() == 1)
|
||||||
{
|
{
|
||||||
if (ip.getFirstRowKey() instanceof Integer)
|
if (ip.getFirstRowKey() instanceof Integer)
|
||||||
|
@ -742,7 +747,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
if (m_tableName == null) // sets table name & key column
|
if (m_tableName == null) // sets table name & key column
|
||||||
setTableAndKeyColumn();
|
setTableAndKeyColumn();
|
||||||
|
|
||||||
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, true, whereClause);
|
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, multipleSelection, whereClause);
|
||||||
if (ip != null)
|
if (ip != null)
|
||||||
showInfoPanel(ip);
|
showInfoPanel(ip);
|
||||||
}
|
}
|
||||||
|
@ -977,6 +982,20 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if info window allow multiple selection
|
||||||
|
*/
|
||||||
|
public boolean isMultipleSelection() {
|
||||||
|
return multipleSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param multipleSelection
|
||||||
|
*/
|
||||||
|
public void setMultipleSelection(boolean multipleSelection) {
|
||||||
|
this.multipleSelection = multipleSelection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search box component
|
* Search box component
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class DefaultInfoFactory implements IInfoFactory {
|
||||||
|
|
||||||
if (col.equals("M_Product_ID"))
|
if (col.equals("M_Product_ID"))
|
||||||
{
|
{
|
||||||
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, true, whereClause, AD_InfoWindow_ID, true, field);
|
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
|
||||||
if (infoWindow.loadedOK())
|
if (infoWindow.loadedOK())
|
||||||
return infoWindow;
|
return infoWindow;
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class InfoManager
|
||||||
if (service != null)
|
if (service != null)
|
||||||
{
|
{
|
||||||
s_infoFactoryCache.put(serviceId, serviceReference);
|
s_infoFactoryCache.put(serviceId, serviceReference);
|
||||||
ip = service.create(lookup, field, tableName, keyColumn, queryValue, false, whereClause, AD_InfoWindow_ID);
|
ip = service.create(lookup, field, tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID);
|
||||||
if (ip != null)
|
if (ip != null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue