use of com.servoy.j2db.persistence.IDataProviderLookup in project servoy-client by Servoy.
the class WebDataRendererFactory method placeElements.
protected Map placeElements(IApplication app, Form form, IScriptExecuter listener, Map emptyDataRenderers, boolean printing, ControllerUndoManager undoManager, TabSequenceHelper<Component> tabSequence) throws Exception {
// $NON-NLS-1$
final boolean useAJAX = Utils.getAsBoolean(app.getRuntimeProperties().get("useAJAX"));
IDataProviderLookup dataProviderLookup = app.getFlattenedSolution().getDataproviderLookup(app.getFoundSetManager(), form);
Map listTocomplete = new HashMap();
Map labelForComponents = new HashMap();
String orientation = OrientationApplier.getHTMLContainerOrientation(app.getLocale(), app.getSolution().getTextOrientation());
// $NON-NLS-1$
boolean leftToRight = !"rtl".equalsIgnoreCase(orientation);
// $NON-NLS-1$
boolean isAnchoringEnabled = Utils.getAsBoolean(app.getRuntimeProperties().get("enableAnchors"));
// Insets insets = new Insets(0, 0, 0, 0);
for (IFormElement obj : Utils.iterate(form.getFormElementsSortedByFormIndex())) {
Point l = null;
l = (obj).getLocation();
// unknown where to add
if (l == null)
continue;
if (printing && obj instanceof ISupportPrinting) {
if (!((ISupportPrinting) obj).getPrintable())
continue;
}
Iterator it = emptyDataRenderers.values().iterator();
while (it.hasNext()) {
WebDataRenderer panel = (WebDataRenderer) it.next();
// Border border = panel.getBorder();
// if (border instanceof EmptyBorder)
// {
// insets = ((EmptyBorder)border).getBorderInsets();
// }
int start = panel.getLocation().y;
if (l.y >= start && l.y < start + panel.getSize().height) {
org.apache.wicket.Component comp = (org.apache.wicket.Component) ComponentFactory.createComponent(app, form, obj, dataProviderLookup, listener, printing);
if (comp != null) {
if (obj instanceof Field) {
String name = ((Field) obj).getName();
if (name != null && !"".equals(name)) {
labelForComponents.put(name, comp);
}
} else if (obj instanceof GraphicalComponent && (comp instanceof WebBaseLabel || comp instanceof WebBaseSubmitLink)) {
String labelFor = ((GraphicalComponent) obj).getLabelFor();
if (labelFor != null && !"".equals(labelFor)) {
labelForComponents.put(comp, labelFor);
}
}
if ((obj instanceof ISupportTabSeq) && (tabSequence != null)) {
tabSequence.add(panel, (ISupportTabSeq) obj, comp);
}
org.apache.wicket.Component newComp = comp;
if (newComp instanceof IDisplay) {
panel.addDisplayComponent(obj, (IDisplay) newComp);
} else if (newComp instanceof WebImageBeanHolder) {
WebImageBeanHolder wiBeanHolder = (WebImageBeanHolder) newComp;
Object bean = wiBeanHolder.getDelegate();
if (bean instanceof IServoyAwareBean) {
IServoyAwareBean ourBean = (IServoyAwareBean) bean;
panel.addDisplayComponent(obj, ourBean);
}
}
((IComponent) comp).setLocation(new Point((l.x), (l.y - start)));
if (form.getOnRecordEditStartMethodID() > 0 && comp instanceof IFieldComponent) {
if (useAJAX && comp instanceof IDisplayData && ((IDisplayData) comp).getDataProviderID() != null && !ScopesUtils.isVariableScope(((IDisplayData) comp).getDataProviderID())) {
StartEditOnFocusGainedEventBehavior.addNewBehaviour(comp);
}
}
// - beans
if (isAnchoringEnabled && (((obj instanceof Field) && WebAnchoringHelper.needsWrapperDivForAnchoring((Field) obj)) || (obj instanceof Bean) || ((obj instanceof GraphicalComponent) && ComponentFactory.isButton((GraphicalComponent) obj)))) {
panel.add(WebAnchoringHelper.getWrapperComponent(comp, obj, start, panel.getSize(), leftToRight, false));
} else {
panel.add(comp);
}
}
}
}
}
Iterator it = labelForComponents.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Entry) it.next();
Object key = entry.getKey();
if (key instanceof WebBaseLabel || key instanceof WebBaseSubmitLink) {
IFieldComponent component = (IFieldComponent) labelForComponents.get(entry.getValue());
if (component != null) {
if (key instanceof WebBaseLabel) {
((WebBaseLabel) entry.getKey()).setLabelFor(component);
} else {
((WebBaseSubmitLink) entry.getKey()).setLabelFor(component);
}
(component).addLabelFor((ILabel) entry.getKey());
if (!component.isVisible()) {
component.setComponentVisible(component.isVisible());
}
if (!component.isEnabled()) {
component.setComponentEnabled(component.isEnabled());
}
}
}
}
it = emptyDataRenderers.values().iterator();
while (it.hasNext()) {
WebDataRenderer panel = (WebDataRenderer) it.next();
panel.createDataAdapter(app, dataProviderLookup, listener, undoManager);
}
return listTocomplete;
}
use of com.servoy.j2db.persistence.IDataProviderLookup in project servoy-client by Servoy.
the class FlattenedSolution method getDataproviderLookup.
public IDataProviderLookup getDataproviderLookup(IFoundSetManagerInternal foundSetManager, final IPersist p) {
IDataProviderLookup retval = null;
synchronized (this) {
if (dataProviderLookups == null)
dataProviderLookups = new HashMap<IPersist, IDataProviderLookup>();
retval = dataProviderLookups.get(p);
if (retval != null)
return retval;
}
if (p instanceof Form) {
ITable t = null;
try {
if (foundSetManager == null) {
t = getTable(((Form) p).getDataSource());
} else {
t = foundSetManager.getTable(((Form) p).getDataSource());
}
} catch (RepositoryException e) {
Debug.error(e);
}
retval = new FormAndTableDataProviderLookup(this, (Form) p, t);
} else if (p instanceof Portal) {
ITable t = null;
Relation[] relations = getRelationSequence(((Portal) p).getRelationName());
if (relations == null) {
return null;
}
t = getTable(relations[relations.length - 1].getForeignDataSource());
retval = new FormAndTableDataProviderLookup(this, (Form) p.getParent(), t);
} else // solution
{
retval = new IDataProviderLookup() {
public IDataProvider getDataProvider(String id) throws RepositoryException {
return getGlobalDataProvider(id);
}
public Table getTable() throws RepositoryException {
return null;
}
};
}
synchronized (this) {
dataProviderLookups.put(p, retval);
}
return retval;
}
use of com.servoy.j2db.persistence.IDataProviderLookup in project servoy-client by Servoy.
the class DataRendererFactory method placeElements.
// returns usesSliding
private Map placeElements(Iterator<IFormElement> e1, IApplication app, Form form, IScriptExecuter listner, Map emptyDataRenderers, int width, int XCorrection, int YCorrection, boolean printing, boolean cutDataProviderNames, ControllerUndoManager undoManager, boolean isPortal, TabSequenceHelper<Component> tabSequence) throws Exception {
IDataProviderLookup dataProviderLookup = app.getFlattenedSolution().getDataproviderLookup(app.getFoundSetManager(), form);
Map listTocomplete = new HashMap();
Map labelForComponents = new HashMap();
// Insets insets = new Insets(0, 0, 0, 0);
while (e1.hasNext()) {
Point l = null;
IPersist obj = e1.next();
l = ((IFormElement) obj).getLocation();
// unkown where to add
if (l == null)
continue;
if (printing && obj instanceof ISupportPrinting) {
if (!((ISupportPrinting) obj).getPrintable())
continue;
}
Iterator it = emptyDataRenderers.values().iterator();
while (it.hasNext()) {
DataRenderer panel = (DataRenderer) it.next();
int start = panel.getLocation().y;
if (l.y >= start && l.y < start + panel.getSize().height) {
Component comp = (Component) ComponentFactory.createComponent(app, form, obj, dataProviderLookup, listner, printing);
// Test for a visible bean, then get the real component
if (comp instanceof VisibleBean) {
comp = ((VisibleBean) comp).getDelegate();
}
if (comp != null) {
if (obj instanceof Field && comp instanceof JComponent) {
String name = ((Field) obj).getName();
if (name != null && !"".equals(name)) {
labelForComponents.put(name, comp);
}
} else if (obj instanceof GraphicalComponent && comp instanceof JLabel) {
String labelFor = ((GraphicalComponent) obj).getLabelFor();
if (labelFor != null && !"".equals(labelFor)) {
labelForComponents.put(comp, labelFor);
}
}
if (obj instanceof ISupportTabSeq && comp instanceof JComponent && (tabSequence != null)) {
tabSequence.add(panel, (ISupportTabSeq) obj, comp);
}
Component newComp = comp;
if (newComp instanceof IDisplay) {
// HACK:don;t no other way to do this.........
if (newComp instanceof IDisplayData && cutDataProviderNames) {
IDisplayData da = (IDisplayData) newComp;
String id = da.getDataProviderID();
if (id != null && !ScopesUtils.isVariableScope(id)) {
// only cut first relation (so you can have relation chain inside portal)
int index = id.indexOf('.');
// TODO:check if part before . is same as relation name (objToRender.getRelationID() )
if (index > 0) {
id = id.substring(index + 1);
}
da.setDataProviderID(id);
}
}
panel.addDisplayComponent(obj, (IDisplay) newComp);
}
comp.setLocation((l.x) + XCorrection, (l.y - start) + YCorrection);
int index = 0;
if (!printing && obj instanceof ISupportAnchors) {
panel.add(comp, new Integer(((ISupportAnchors) obj).getAnchors()), index);
} else if (printing) {
if (obj instanceof ISupportPrintSliding && !isPortal) {
int slide = ((ISupportPrintSliding) obj).getPrintSliding();
if (slide != ISupportPrintSliding.NO_SLIDING) {
listTocomplete.put(comp, new Integer(slide));
panel.setUsingSliding(true);
}
}
panel.add(comp, index);
} else {
panel.add(comp, index);
}
}
}
}
}
if (!printing) {
Iterator it = labelForComponents.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Entry) it.next();
if (entry.getKey() instanceof JLabel) {
JComponent component = (JComponent) labelForComponents.get(entry.getValue());
if (component != null) {
((JLabel) entry.getKey()).setLabelFor(component);
if (component instanceof IFieldComponent) {
((IFieldComponent) component).addLabelFor((ILabel) entry.getKey());
if (!((IFieldComponent) component).isVisible()) {
((IFieldComponent) component).setComponentVisible(((IFieldComponent) component).isVisible());
}
if (!((IFieldComponent) component).isEnabled()) {
((IFieldComponent) component).setComponentEnabled(((IFieldComponent) component).isEnabled());
}
}
}
}
}
}
Iterator it = emptyDataRenderers.values().iterator();
while (it.hasNext()) {
DataRenderer panel = (DataRenderer) it.next();
panel.createDataAdapter(app, dataProviderLookup, listner, undoManager);
}
return listTocomplete;
}
use of com.servoy.j2db.persistence.IDataProviderLookup in project servoy-client by Servoy.
the class DataproviderTypeSabloValue method dataProviderOrRecordChanged.
@Override
public void dataProviderOrRecordChanged(final IRecordInternal record, final String dataProvider, final boolean isFormDP, final boolean isGlobalDP, boolean fireChangeEvent) {
// TODO can type or fieldFormat change, for example in scripting the format is reset (but type shouldn't really change)
IDataProviderLookup dpLookup = new FormAndTableDataProviderLookup(servoyDataConverterContext.getApplication().getFlattenedSolution(), servoyDataConverterContext.getForm().getForm(), record != null ? record.getParentFoundSet().getTable() : null);
Collection<PropertyDescription> properties = webObjectContext.getProperties(TypesRegistry.getType(FormatPropertyType.TYPE_NAME));
FormatTypeSabloValue formatSabloValue = null;
for (PropertyDescription formatPd : properties) {
// see whether format if "for" this property (dataprovider)
Object formatConfig = formatPd.getConfig();
if (formatConfig instanceof String[] && Arrays.asList((String[]) formatConfig).indexOf(dpPD.getName()) != -1) {
INGApplication application = servoyDataConverterContext.getApplication();
formatSabloValue = (FormatTypeSabloValue) webObjectContext.getProperty(formatPd.getName());
if (formatSabloValue != null) {
if (formatSabloValue.getFormatDesignValue() != null) {
fieldFormat = ComponentFormat.getComponentFormat(formatSabloValue.getFormatDesignValue(), dataProviderID, dpLookup, application);
}
break;
}
}
}
if (fieldFormat != null) {
typeOfDP = NGUtils.getDataProviderPropertyDescription(fieldFormat.uiType, getDataProviderConfig().hasParseHtml(), fieldFormat.parsedFormat.useLocalDateTime());
if (record instanceof FindState) {
((FindState) record).setFormat(dataProviderID, fieldFormat.parsedFormat);
}
} else {
// see type of dataprovider; this is done only once - first time we get a new record
typeOfDP = NGUtils.getDataProviderPropertyDescription(dataProviderID, servoyDataConverterContext.getApplication(), servoyDataConverterContext.getForm().getForm(), record != null ? record.getParentFoundSet().getTable() : null, getDataProviderConfig().hasParseHtml(), formatSabloValue != null ? formatSabloValue.getComponentFormat().parsedFormat.useLocalDateTime() : false);
}
if (dpPD.hasTag(TAG_TYPE_NAME)) {
IPropertyType<?> specType = TypesRegistry.getType((String) dpPD.getTag(TAG_TYPE_NAME));
if (specType != null && (typeOfDP == null || !specType.getClass().isAssignableFrom(typeOfDP.getClass()))) {
typeOfDP = new PropertyDescriptionBuilder().withName("Spec type hint").withType(specType).build();
}
}
String dpID = dataProviderID;
IDataProvider dp = null;
if (dpLookup != null) {
try {
dp = dpLookup.getDataProvider(dataProviderID);
if (dp != null) {
dpID = dp.getDataProviderID();
}
} catch (RepositoryException e) {
Debug.error(e);
}
}
if (globalRelationName != null) {
try {
IFoundSetInternal newRelatedFoundset = servoyDataConverterContext.getApplication().getFoundSetManager().getGlobalRelatedFoundSet(globalRelationName);
if (newRelatedFoundset != globalRelatedFoundset) {
if (globalRelatedFoundsetListener == null) {
globalRelatedFoundsetListener = new IFoundSetEventListener() {
@Override
public void foundSetChanged(FoundSetEvent e) {
if (e.getType() == FoundSetEvent.CONTENTS_CHANGED) {
dataProviderOrRecordChanged(DataproviderTypeSabloValue.this.dataAdapterList.getRecord(), null, false, false, true);
}
}
};
} else if (globalRelatedFoundset != null) {
globalRelatedFoundset.removeFoundSetEventListener(globalRelatedFoundsetListener);
}
globalRelatedFoundset = newRelatedFoundset;
globalRelatedFoundset.addFoundSetEventListener(globalRelatedFoundsetListener);
}
} catch (Exception ex) {
Debug.error(ex);
}
}
if (relatedFoundsetSelectionListener != null) {
try {
ArrayList<IFoundSetInternal> newRelatedFoundsets = getRelatedFoundsets(record, relationName);
boolean equals = testByReference(newRelatedFoundsets, this.relatedFoundsets);
if (!equals) {
IDataProvider column = dp;
if (column instanceof ColumnWrapper) {
column = ((ColumnWrapper) column).getColumn();
}
boolean isAggregate = (column instanceof IColumn) ? ((IColumn) column).isAggregate() : false;
if (isAggregate && relatedFoundsets.size() > 0) {
relatedFoundsets.get(relatedFoundsets.size() - 1).removeAggregateModificationListener(relatedRecordModificationListener);
}
for (IFoundSetInternal relatedFoundset : relatedFoundsets) {
((ISwingFoundSet) relatedFoundset).getSelectionModel().removeListSelectionListener(relatedFoundsetSelectionListener);
}
relatedFoundsets = newRelatedFoundsets;
for (IFoundSetInternal relatedFoundset : relatedFoundsets) {
((ISwingFoundSet) relatedFoundset).getSelectionModel().addListSelectionListener(relatedFoundsetSelectionListener);
}
if (isAggregate && relatedFoundsets.size() > 0) {
relatedFoundsets.get(relatedFoundsets.size() - 1).addAggregateModificationListener(relatedRecordModificationListener);
}
}
} catch (Exception ex) {
Debug.error(ex);
}
}
if (relatedRecordModificationListener != null) {
try {
ArrayList<IRecordInternal> newRelatedRecords = getRelatedRecords(record, relationName);
boolean equals = testByReference(newRelatedRecords, this.relatedRecords);
if (!equals) {
for (IRecordInternal relatedRecord : relatedRecords) {
relatedRecord.removeModificationListener(relatedRecordModificationListener);
}
relatedRecords = newRelatedRecords;
for (IRecordInternal relatedRecord : relatedRecords) {
relatedRecord.addModificationListener(relatedRecordModificationListener);
}
}
} catch (Exception ex) {
Debug.error(ex);
}
}
Object v = com.servoy.j2db.dataprocessing.DataAdapterList.getValueObject(record, servoyDataConverterContext.getForm().getFormScope(), dpID);
if (v == Scriptable.NOT_FOUND)
v = null;
if (fieldFormat != null && !findMode) {
// if it has an UI converter, transform it from the record/scope value into the UI value
v = ComponentFormat.applyUIConverterToObject(v, dataProviderID, servoyDataConverterContext.getApplication().getFoundSetManager(), fieldFormat);
}
v = replaceTagsIfNeeded(v);
boolean changed = ((v != uiValue) && (v == null || !v.equals(uiValue)));
uiValue = v;
if (changed) {
jsonValue = null;
}
if (// if it is a foundset related DAL then always call valuechanged (the value can be of a previous row)
fireChangeEvent && (changed || dataAdapterList instanceof FoundsetDataAdapterList)) {
changeMonitor.valueChanged();
}
}
use of com.servoy.j2db.persistence.IDataProviderLookup in project servoy-client by Servoy.
the class FormatTypeSabloValue method getSabloValue.
protected ComponentFormat getSabloValue(String formatValue, String dataproviderId, Object valuelistId, String foundsetId, IWebObjectContext webObjectCntxt) {
INGApplication application = ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getApplication();
IDataProviderLookup dataProviderLookup = null;
// IMPORTANT: here we use the for: configs in .spec file
//
// if you have for: [valuelist, dataprovider] then 2 things can happen:
// - valuelist if it has both real and display values - forces the type; it is either TEXT (custom vl., global method vl.) or the 'display' column type in case it's a DB valuelist
// - valuelist if not real/display but only one kind of values: here it is required in docs in the spec file that the valuelist property also defines "for": dataprovider if format
// defines both "for" valuelist and dataprovider => valuelist doesn't force the type and then the dataprovider will decide the type
//
// if you have just for: dataprovider the the dataprovider property determines the type
// if you have just for: valuelist (TODO) - this is currently not properly supported - as here we should get the type always from the VL (for both display and real values) - as we don't have a dataprovider to fall back on
isValuelistFormatSet = false;
if (valuelistId != null) {
// if we have a "for" valuelist, see if this valuelist forces the format type due to display values (when they are separate from real values)
// otherwise it will do nothing and loop/fallback to the other if clause below which checks the "for" dataprovider
ValueList valuelistPersist = ValueListTypeSabloValue.getValuelistPersist(valuelistId, application);
if (valuelistPersist != null) {
IDataProvider dataProvider = null;
ITable table;
try {
if (valuelistPersist.getRelationName() != null) {
Relation[] relations = application.getFlattenedSolution().getRelationSequence(valuelistPersist.getRelationName());
table = application.getFlattenedSolution().getTable(relations[relations.length - 1].getForeignDataSource());
} else {
table = application.getFlattenedSolution().getTable(valuelistPersist.getDataSource());
}
if (table != null) {
// if the format is for a table valuelist - the type to be used is the one of the dp chosen as 'display' in the valuelist
String dp = null;
// if show == real then we can use show anyway cause there is only one value for both real and display; if show != real we care about show
int showDataProviders = valuelistPersist.getShowDataProviders();
if ((showDataProviders & 1) != 0) {
dp = valuelistPersist.getDataProviderID1();
}
if ((showDataProviders & 2) != 0) {
// display value is a concat of multiple columns, so a string; not even sure if format property makes sense, but it is for a String then
if (dp != null)
return ComponentFormat.getComponentFormat(formatValue, IColumnTypes.TEXT, application);
dp = valuelistPersist.getDataProviderID2();
}
if ((showDataProviders & 4) != 0) {
// display value is a concat of multiple columns, so a string; not even sure if format property makes sense, but it is for a String then
if (dp != null)
return ComponentFormat.getComponentFormat(formatValue, IColumnTypes.TEXT, application);
dp = valuelistPersist.getDataProviderID3();
}
if (dp != null) {
dataProvider = application.getFlattenedSolution().getDataProviderForTable(table, dp);
}
isValuelistFormatSet = true;
return ComponentFormat.getComponentFormat(formatValue, dataProvider, application, true);
} else if (valuelistPersist.getValueListType() == IValueListConstants.CUSTOM_VALUES) {
IValueList realValuelist = null;
ValueListTypeSabloValue valuelistSabloValue = (ValueListTypeSabloValue) FoundsetLinkedTypeSabloValue.unwrapIfNeeded(webObjectContext.getProperty(propertyDependencies.valueListPropertyName));
if (valuelistSabloValue != null) {
// take it from property, may not be the shared instance in case setvaluelistitems on component was used
realValuelist = valuelistSabloValue.getValueList();
}
if (realValuelist == null) {
realValuelist = com.servoy.j2db.component.ComponentFactory.getRealValueList(application, valuelistPersist, true, Types.OTHER, ComponentFormat.getComponentFormat(formatValue, dataproviderId, null, application, true).parsedFormat, null, true);
}
if (realValuelist.hasRealValues()) {
// if custom vl has both real and display values, the display values are TEXT (format is for those)
// of if it has displayValueType set, use that
isValuelistFormatSet = true;
int realValueDisplayType = realValuelist.getValueList().getDisplayValueType();
return ComponentFormat.getComponentFormat(formatValue, realValueDisplayType != 0 ? realValueDisplayType : IColumnTypes.TEXT, application);
}
} else if (valuelistPersist.getValueListType() == IValueListConstants.GLOBAL_METHOD_VALUES) {
PropertyDescription vlPD = webObjectCntxt.getPropertyDescription(propertyDependencies.valueListPropertyName);
Object vlPDConfig = null;
if (vlPD != null) {
vlPDConfig = vlPD.getConfig();
if (vlPDConfig instanceof FoundsetLinkedConfig)
vlPDConfig = ((FoundsetLinkedConfig) vlPDConfig).getWrappedConfig();
}
boolean lazyLoad = valuelistPersist.getLazyLoading() && vlPDConfig instanceof ValueListConfig && ((ValueListConfig) vlPDConfig).getLazyLoading();
if (!lazyLoad) {
IValueList realValuelist = com.servoy.j2db.component.ComponentFactory.getRealValueList(application, valuelistPersist, true, Types.OTHER, null, null, true);
if (realValuelist instanceof GlobalMethodValueList) {
((GlobalMethodValueList) realValuelist).fill(null, "", null);
if (realValuelist.hasRealValues() || realValuelist.getSize() == 0 || (realValuelist.getSize() == 1 && valuelistPersist.getAddEmptyValue() == IValueListConstants.EMPTY_VALUE_ALWAYS)) {
// if global method vl has both real and display values, the display values are TEXT (format is for those)
// of if it has displayValueType set, use that
isValuelistFormatSet = true;
int realValueDisplayType = realValuelist.getValueList().getDisplayValueType();
return ComponentFormat.getComponentFormat(formatValue, realValueDisplayType != 0 ? realValueDisplayType : IColumnTypes.TEXT, application);
}
}
}
}
} catch (Exception ex) {
Debug.error(ex);
}
}
// here - we want to fall back to the dataprovider if available in for: [ ..., dataprovider] if valuelist didn't force a certain display type on the format
}
if (dataproviderId != null && foundsetId != null) {
ITable table = null;
Form form = ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm();
// always assume now that the the properties has the foundset property name.
FoundsetTypeSabloValue runtimeValOfFoundset = (FoundsetTypeSabloValue) webObjectCntxt.getUnderlyingWebObject().getProperty(this.propertyDependencies.foundsetPropertyName);
if (runtimeValOfFoundset != null && runtimeValOfFoundset.getFoundset() != null && runtimeValOfFoundset.getFoundset().getDataSource().equals(foundsetId)) {
table = runtimeValOfFoundset.getFoundset().getTable();
}
if (table == null)
table = FoundsetTypeSabloValue.getTableBasedOfFoundsetPropertyFromFoundsetIdentifier(foundsetId, application, form);
if (table != null) {
dataProviderLookup = new FormAndTableDataProviderLookup(application.getFlattenedSolution(), form, table);
}
// else it will be searched for in form's context and table as below
}
if (dataProviderLookup == null) {
WebObjectSpecification spec = ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getParent().getSpecification();
if (spec != null) {
Collection<PropertyDescription> formComponentProperties = spec.getProperties(FormComponentPropertyType.INSTANCE);
if (formComponentProperties != null) {
for (PropertyDescription property : formComponentProperties) {
if (property.getConfig() instanceof ComponentTypeConfig && ((ComponentTypeConfig) property.getConfig()).forFoundset != null) {
FoundsetTypeSabloValue runtimeValOfFoundset = (FoundsetTypeSabloValue) ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getParent().getProperty(((ComponentTypeConfig) property.getConfig()).forFoundset);
ITable table = null;
Form form = ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm();
if (runtimeValOfFoundset.getFoundset() != null)
table = runtimeValOfFoundset.getFoundset().getTable();
if (table == null)
table = FoundsetTypeSabloValue.getTableBasedOfFoundsetPropertyFromFoundsetIdentifier(runtimeValOfFoundset.getFoundsetSelector(), application, form);
if (table != null) {
dataProviderLookup = new FormAndTableDataProviderLookup(application.getFlattenedSolution(), form, table);
}
break;
}
}
}
}
}
if (dataProviderLookup == null && application != null)
dataProviderLookup = application.getFlattenedSolution().getDataproviderLookup(application.getFoundSetManager(), ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm());
ComponentFormat format = ComponentFormat.getComponentFormat(formatValue, dataproviderId, dataProviderLookup, application, true);
return format;
}
Aggregations