use of org.compiere.model.I_AD_Tab in project metasfresh-webui-api by metasfresh.
the class InMemoryUIElementsProvider method getUISections.
@Override
public List<I_AD_UI_Section> getUISections(final int AD_Tab_ID) {
// Generate the UI elements if needed
if (!adTabId2sections.containsKey(AD_Tab_ID)) {
final WindowUIElementsGenerator generator = WindowUIElementsGenerator.forConsumer(this);
final I_AD_Tab adTab = InterfaceWrapperHelper.create(Env.getCtx(), AD_Tab_ID, I_AD_Tab.class, ITrx.TRXNAME_ThreadInherited);
final boolean primaryTab = adTab.getTabLevel() == 0;
if (primaryTab) {
generator.migratePrimaryTab(adTab);
} else {
generator.migrateDetailTab(adTab);
}
}
return adTabId2sections.get(AD_Tab_ID);
}
use of org.compiere.model.I_AD_Tab in project metasfresh-webui-api by metasfresh.
the class HUEditorViewFactoryTemplate method createSqlViewBinding.
private SqlViewBinding createSqlViewBinding() {
// Get HU's standard entity descriptor. We will needed all over.
final DocumentEntityDescriptor huEntityDescriptor = getHUEntityDescriptor();
//
// Static where clause
final StringBuilder sqlWhereClause = new StringBuilder();
{
// top level
sqlWhereClause.append(I_M_HU.COLUMNNAME_M_HU_Item_Parent_ID + " is null");
// Consider window tab's where clause if any
final I_AD_Tab huTab = Services.get(IADWindowDAO.class).retrieveFirstTab(WEBUI_HU_Constants.WEBUI_HU_Window_ID.toInt());
if (!Check.isEmpty(huTab.getWhereClause(), true)) {
sqlWhereClause.append("\n AND (").append(huTab.getWhereClause()).append(")");
}
}
//
// Start preparing the sqlViewBinding builder
final List<String> displayFieldNames = ImmutableList.of(I_M_HU.COLUMNNAME_M_HU_ID);
final SqlViewBinding.Builder sqlViewBinding = SqlViewBinding.builder().tableName(I_M_HU.Table_Name).displayFieldNames(displayFieldNames).sqlWhereClause(sqlWhereClause.toString()).rowIdsConverter(HUSqlViewRowIdsConverter.instance);
//
// View fields: from M_HU's entity descriptor
{
// NOTE: we need to add all HU's standard fields because those might be needed for some of the standard filters defined
final SqlDocumentEntityDataBindingDescriptor huEntityBindings = SqlDocumentEntityDataBindingDescriptor.cast(huEntityDescriptor.getDataBinding());
huEntityBindings.getFields().stream().map(huField -> SqlViewFactory.createViewFieldBindingBuilder(huField, displayFieldNames).build()).forEach(sqlViewBinding::field);
}
//
// View field: BestBeforeDate
{
sqlViewBinding.field(SqlViewRowFieldBinding.builder().fieldName(HUEditorRow.FIELDNAME_BestBeforeDate).widgetType(DocumentFieldWidgetType.Date).columnSql(Constants.sqlBestBeforeDate(sqlViewBinding.getTableAlias() + "." + I_M_HU.COLUMNNAME_M_HU_ID)).fieldLoader((rs, adLanguage) -> rs.getTimestamp(HUEditorRow.FIELDNAME_BestBeforeDate)).build());
}
//
// View filters and converters
{
sqlViewBinding.filterDescriptors(createFilterDescriptorsProvider()).filterConverter(HUBarcodeSqlDocumentFilterConverter.FILTER_ID, HUBarcodeSqlDocumentFilterConverter.instance).filterConverter(HUIdsFilterHelper.FILTER_ID, HUIdsFilterHelper.SQL_DOCUMENT_FILTER_CONVERTER);
createFilterConvertersIndexedByFilterId().forEach(sqlViewBinding::filterConverter);
}
//
return sqlViewBinding.build();
}
use of org.compiere.model.I_AD_Tab in project metasfresh-webui-api by metasfresh.
the class GridTabVOBasedDocumentEntityDescriptorFactory method createLabelsLookup.
private static final LabelsLookup createLabelsLookup(final I_AD_UI_Element labelsUIElement, final String tableName) {
final I_AD_Tab labelsTab = labelsUIElement.getLabels_Tab();
final String labelsTableName = labelsTab.getAD_Table().getTableName();
final String linkColumnName;
if (labelsTab.getParent_Column_ID() > 0) {
linkColumnName = labelsTab.getParent_Column().getColumnName();
} else {
linkColumnName = InterfaceWrapperHelper.getKeyColumnName(tableName);
}
final String labelsLinkColumnName;
if (labelsTab.getAD_Column_ID() > 0) {
labelsLinkColumnName = labelsTab.getAD_Column().getColumnName();
} else {
labelsLinkColumnName = linkColumnName;
}
final I_AD_Column labelsValueColumn = labelsUIElement.getLabels_Selector_Field().getAD_Column();
final String labelsValueColumnName = labelsValueColumn.getColumnName();
final LookupDescriptor labelsValuesLookupDescriptor = SqlLookupDescriptor.builder().setCtxTableName(labelsTableName).setCtxColumnName(labelsValueColumnName).setDisplayType(labelsValueColumn.getAD_Reference_ID()).setWidgetType(DescriptorsFactoryHelper.extractWidgetType(labelsValueColumnName, labelsValueColumn.getAD_Reference_ID())).setAD_Reference_Value_ID(labelsValueColumn.getAD_Reference_Value_ID()).setAD_Val_Rule_ID(labelsValueColumn.getAD_Val_Rule_ID()).buildForDefaultScope();
return LabelsLookup.builder().labelsTableName(labelsTableName).labelsValueColumnName(labelsValueColumnName).labelsValuesLookupDescriptor(labelsValuesLookupDescriptor).labelsLinkColumnName(labelsLinkColumnName).tableName(tableName).linkColumnName(linkColumnName).build();
}
Aggregations