IDEMPIERE-3653 1004207 Change behavior of system cacheing for multi-tenants. Allow field editor to inform find window that it is not means to be searchable.

This commit is contained in:
Heng Sin Low 2014-08-19 16:58:19 +08:00
parent 4aac55cca2
commit 2b963b7ac1
4 changed files with 50 additions and 7 deletions

View File

@ -316,4 +316,12 @@ public class WButtonEditor extends WEditor implements IProcessButton
public IADTabpanel getADTabpanel() { public IADTabpanel getADTabpanel() {
return adTabpanel; return adTabpanel;
} }
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#isSearchable()
*/
@Override
public boolean isSearchable() {
return false;
}
} }

View File

@ -169,6 +169,14 @@ public class WChartEditor extends WEditor
super.dynamicDisplay(); super.dynamicDisplay();
createChart(); createChart();
} }
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#isSearchable()
*/
@Override
public boolean isSearchable() {
return false;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String) * @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String)

View File

@ -637,6 +637,13 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
component.setStyle(style); component.setStyle(style);
} }
} }
/**
* @return true if usable in find window, false otherwise
*/
public boolean isSearchable() {
return true;
}
protected String buildStyle(int AD_Style_ID) { protected String buildStyle(int AD_Style_ID) {
MStyle style = MStyle.get(Env.getCtx(), AD_Style_ID); MStyle style = MStyle.get(Env.getCtx(), AD_Style_ID);

View File

@ -317,7 +317,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
{ {
for(int i = 0; i < findFields.length; i++) for(int i = 0; i < findFields.length; i++)
{ {
if (findFields[i].getAD_Field_ID() != m_findFields[i].getAD_Field_ID()) return false; if (m_findFields[i] != null && findFields[i].getAD_Field_ID() != m_findFields[i].getAD_Field_ID()) return false;
} }
} }
@ -714,6 +714,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_findFields[i] = findField; m_findFields[i] = findField;
mField = findField; mField = findField;
} }
if (mField.isSelectionColumn()) { if (mField.isSelectionColumn()) {
gridFieldList.add(mField); // isSelectionColumn gridFieldList.add(mField); // isSelectionColumn
} else { } else {
@ -756,9 +757,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
} }
}); });
List<GridField> excludes = new ArrayList<GridField>();
// adding sorted columns // adding sorted columns
for(GridField field:gridFieldList){ for(GridField field:gridFieldList){
addSelectionColumn (field); if (!addSelectionColumn (field))
excludes.add(field);
} }
//add ... link to show the rest of the columns //add ... link to show the rest of the columns
@ -770,11 +773,23 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
cell.setColspan(3); cell.setColspan(3);
cell.setAlign("left"); cell.setAlign("left");
for(GridField field:moreFieldList){ for(GridField field:moreFieldList){
addSelectionColumn (field, rowg); if (!addSelectionColumn (field, rowg))
excludes.add(field);
} }
rowg.setOpen(false); rowg.setOpen(false);
} }
if (!excludes.isEmpty()) {
for(GridField field : excludes) {
for(int i = 0; i < m_findFields.length; i++) {
if (m_findFields[i] == field) {
m_findFields[i] = null;
break;
}
}
}
}
if (m_sEditors.isEmpty()) { if (m_sEditors.isEmpty()) {
Tabpanel tabPanel = winMain.getComponent().getTabpanel(0); Tabpanel tabPanel = winMain.getComponent().getTabpanel(0);
tabPanel.getLinkedTab().setVisible(false); tabPanel.getLinkedTab().setVisible(false);
@ -1004,6 +1019,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
for (int c = 0; c < m_findFields.length; c++) for (int c = 0; c < m_findFields.length; c++)
{ {
GridField field = m_findFields[c]; GridField field = m_findFields[c];
if (field == null) continue;
String columnName = field.getColumnName(); String columnName = field.getColumnName();
String header = field.getHeader(); String header = field.getHeader();
@ -1073,16 +1089,16 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
* Add Selection Column to first Tab * Add Selection Column to first Tab
* @param mField field * @param mField field
**/ **/
public void addSelectionColumn(GridField mField) public boolean addSelectionColumn(GridField mField)
{ {
addSelectionColumn(mField, null); return addSelectionColumn(mField, null);
} }
/** /**
* Add Selection Column to first Tab * Add Selection Column to first Tab
* @param mField field * @param mField field
**/ **/
public void addSelectionColumn(GridField mField, Group group) public boolean addSelectionColumn(GridField mField, Group group)
{ {
if (log.isLoggable(Level.CONFIG)) log.config(mField.getHeader()); if (log.isLoggable(Level.CONFIG)) log.config(mField.getHeader());
int displayLength = mField.getDisplayLength(); int displayLength = mField.getDisplayLength();
@ -1095,6 +1111,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
WEditor editor = null; WEditor editor = null;
//false will use hflex which is render 1 pixel too width on firefox //false will use hflex which is render 1 pixel too width on firefox
editor = WebEditorFactory.getEditor(mField, true); editor = WebEditorFactory.getEditor(mField, true);
if (!editor.isSearchable()) {
return false;
}
editor.setMandatory(false); editor.setMandatory(false);
editor.setReadWrite(true); editor.setReadWrite(true);
editor.dynamicDisplay(); editor.dynamicDisplay();
@ -1163,6 +1182,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_sEditors.add(editor); m_sEditors.add(editor);
fieldEditor.addEventListener(Events.ON_OK,this); fieldEditor.addEventListener(Events.ON_OK,this);
return true;
} // addSelectionColumn } // addSelectionColumn
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
@ -2043,7 +2063,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
for (int c = 0; c < m_findFields.length; c++) for (int c = 0; c < m_findFields.length; c++)
{ {
GridField field = m_findFields[c]; GridField field = m_findFields[c];
if (columnName.equals(field.getColumnName())) if (field != null && columnName.equals(field.getColumnName()))
return field; return field;
} }
return null; return null;