Skip to content

Commit

Permalink
#161 don't load lookups for ProcessButton widgetTypes
Browse files Browse the repository at this point in the history
not supported atm
  • Loading branch information
teosarca committed Feb 21, 2017
1 parent a39209e commit a37fe7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ private final void createAndAddDocumentField(final DocumentEntityDescriptor.Buil

lookupDescriptorProvider = SqlLookupDescriptor.builder()
.setColumnName(sqlColumnName)
.setWidgetType(widgetType)
.setDisplayType(displayType)
.setAD_Reference_Value_ID(gridFieldVO.getAD_Reference_Value_ID())
.setAD_Val_Rule_ID(gridFieldVO.getAD_Val_Rule_ID())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import de.metas.i18n.TranslatableParameterizedString;
import de.metas.ui.web.window.WindowConstants;
import de.metas.ui.web.window.descriptor.DocumentFieldWidgetType;
import de.metas.ui.web.window.descriptor.DocumentLayoutElementFieldDescriptor.LookupSource;
import de.metas.ui.web.window.descriptor.LookupDescriptor;
import de.metas.ui.web.window.descriptor.LookupDescriptorProvider;
Expand Down Expand Up @@ -243,6 +244,7 @@ public static final class Builder
{
// Parameters
private String columnName;
private DocumentFieldWidgetType widgetType;
private Integer displayType;
private int AD_Reference_Value_ID = -1;
private int AD_Val_Rule_ID = -1;
Expand All @@ -268,16 +270,22 @@ public LookupDescriptorProvider buildProvider()
{
Check.assumeNotNull(displayType, "Parameter displayType is not null");

return buildProvider(columnName, displayType, AD_Reference_Value_ID, AD_Val_Rule_ID);
return buildProvider(columnName, widgetType, displayType, AD_Reference_Value_ID, AD_Val_Rule_ID);
}

private static LookupDescriptorProvider buildProvider(
final String sqlColumnName //
, final DocumentFieldWidgetType widgetType
, final int displayType //
, final int AD_Reference_Value_ID //
, final int AD_Val_Rule_ID //
)
{
if(widgetType == DocumentFieldWidgetType.ProcessButton)
{
return LookupDescriptorProvider.NULL;
}

if (DisplayType.isAnyLookup(displayType)
|| DisplayType.Button == displayType && AD_Reference_Value_ID > 0)
{
Expand Down Expand Up @@ -532,6 +540,12 @@ public Builder setColumnName(final String columnName)
this.columnName = columnName;
return this;
}

public Builder setWidgetType(final DocumentFieldWidgetType widgetType)
{
this.widgetType = widgetType;
return this;
}

public Builder setDisplayType(final int displayType)
{
Expand Down

0 comments on commit a37fe7b

Please sign in to comment.