use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebDataLookupField method dependencyChanged.
/*
* (non-Javadoc)
*
* @see com.servoy.j2db.dataprocessing.IDisplayDependencyData#dependencyChanged(com.servoy.j2db.dataprocessing.IRecordInternal)
*/
@Override
public void dependencyChanged(IRecordInternal record) {
this.parentState = record;
if (list != null) {
int index = -1;
if (!ScopesUtils.isVariableScope(getDataProviderID()) && (getDataProviderID() != null)) {
index = getDataProviderID().lastIndexOf('.');
}
if (index == -1 || parentState == null) {
list.fill(parentState);
} else {
IFoundSetInternal relatedFoundSet = parentState.getRelatedFoundSet(getDataProviderID().substring(0, index));
if (relatedFoundSet == null) {
this.relatedRecord = parentState.getParentFoundSet().getPrototypeState();
list.fill(relatedRecord);
} else if (relatedFoundSet.getSize() == 0) {
this.relatedRecord = relatedFoundSet.getPrototypeState();
list.fill(relatedRecord);
} else {
IRecordInternal relRecord = relatedFoundSet.getRecord(relatedFoundSet.getSelectedIndex());
if (relRecord != relatedRecord) {
this.relatedRecord = relRecord;
list.fill(relatedRecord);
}
}
}
}
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebDataRenderer method getParentViewBgColor.
private String getParentViewBgColor() {
if (parentView != null) {
String rowBGColorCalculation = parentView.getRowBGColorScript();
IRecordInternal rec = (IRecordInternal) getDefaultModelObject();
if (rec != null && rec.getRawData() != null) {
IFoundSetInternal parentFoundSet = rec.getParentFoundSet();
int recIndex = parentFoundSet.getSelectedIndex();
boolean isSelected = recIndex == parentFoundSet.getRecordIndex(rec);
if (rowBGColorCalculation != null) {
Object bg_color = null;
if (rec.getRawData().containsCalculation(rowBGColorCalculation)) {
// data renderer is always on the selected index.
bg_color = parentFoundSet.getCalculationValue(rec, rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(recIndex), new Boolean(isSelected), null, null, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), null);
} else {
try {
FormController currentForm = dataAdapterList.getFormController();
bg_color = currentForm.executeFunction(rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(parentFoundSet.getSelectedIndex()), new Boolean(isSelected), null, null, currentForm.getName(), rec, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), true, null, true, null);
} catch (Exception ex) {
Debug.error(ex);
}
}
if (bg_color != null && !(bg_color.toString().trim().length() == 0) && !(bg_color instanceof Undefined)) {
return bg_color.toString();
}
}
if (parentView instanceof ISupportRowStyling) {
ISupportRowStyling parentViewWithRowStyling = (ISupportRowStyling) parentView;
IStyleSheet ss = parentViewWithRowStyling.getRowStyleSheet();
IStyleRule style = isSelected ? parentViewWithRowStyling.getRowSelectedStyle() : null;
if (style != null && style.getAttributeCount() == 0)
style = null;
if (style == null) {
style = (recIndex % 2 == 0) ? parentViewWithRowStyling.getRowEvenStyle() : parentViewWithRowStyling.getRowOddStyle();
}
if (ss != null && style != null) {
return PersistHelper.createColorString(ss.getBackground(style));
}
}
}
}
return null;
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class FoundSetIndexModel method onRender.
/**
* @see wicket.MarkupContainer#onRender(wicket.markup.MarkupStream)
*/
@Override
protected void onRender(MarkupStream markupStream) {
super.onRender(markupStream);
IFoundSetInternal fs = foundSetIndexModel.getFoundSet();
if (fs != null) {
totalRecords = (fs.getSize() == 0 ? "" : (fs.getSize() + (fs.hadMoreRows() ? "+" : "")));
selectedRecord = (fs.getSelectedIndex() == -1 ? "" : "" + (fs.getSelectedIndex() + 1));
}
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class FoundsetTest method foundsetChangeMonitorChangeFlags.
@Test
public void foundsetChangeMonitorChangeFlags() throws ServoyException {
IWebFormController form = (IWebFormController) client.getFormManager().showFormInCurrentContainer("test");
Assert.assertNotNull(form);
FoundsetTypeSabloValue rawPropertyValue = (FoundsetTypeSabloValue) form.getFormUI().getWebComponent("mycustombean").getRawPropertyValue("myfoundset");
IFoundSetInternal foundSet = rawPropertyValue.getFoundset();
rawPropertyValue.changeMonitor.clearChanges();
foundSet.newRecord(0, false);
Assert.assertEquals(FoundsetTypeChangeMonitor.SEND_FOUNDSET_SIZE | FoundsetTypeChangeMonitor.SEND_SELECTED_INDEXES, rawPropertyValue.changeMonitor.changeFlags);
rawPropertyValue.changeMonitor.clearChanges();
foundSet.deleteRecord(0);
Assert.assertEquals(FoundsetTypeChangeMonitor.SEND_FOUNDSET_SIZE | FoundsetTypeChangeMonitor.SEND_SELECTED_INDEXES, rawPropertyValue.changeMonitor.changeFlags);
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebTabPanel method registerSelectionListeners.
private void registerSelectionListeners(IRecordInternal parentState, String relationName) {
// $NON-NLS-1$
String[] parts = relationName.split("\\.");
IRecordInternal currentRecord = parentState;
for (int i = 0; currentRecord != null && i < parts.length - 1; i++) {
IFoundSetInternal fs = currentRecord.getRelatedFoundSet(parts[i]);
if (fs instanceof ISwingFoundSet) {
related.add((ISwingFoundSet) fs);
((ISwingFoundSet) fs).getSelectionModel().addListSelectionListener(this);
}
currentRecord = (fs == null) ? null : fs.getRecord(fs.getSelectedIndex());
}
}
Aggregations