use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebSplitPane method showFoundSet.
private void showFoundSet(WebTabFormLookup flp, IRecordInternal parentState, List<SortColumn> sort) {
deregisterSelectionListeners();
if (!flp.isReady())
return;
FormController fp = flp.getWebForm().getController();
if (fp != null && flp.getRelationName() != null) {
IFoundSetInternal relatedFoundset = parentState == null ? null : parentState.getRelatedFoundSet(flp.getRelationName(), sort);
registerSelectionListeners(parentState, flp.getRelationName());
fp.loadData(relatedFoundset, null);
}
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class FormManager method ifRootFormInFind.
private boolean ifRootFormInFind(FormController fc) {
boolean result = false;
if (fc.isFormVisible() && fc.isInFindMode()) {
IFoundSetInternal foundSet = fc.getFoundSet();
if (foundSet instanceof RelatedFoundSet) {
// see if any parent foundset is in find mode; if not, then add it as root
// form in find mode
List<IRecordInternal> parentRecords = ((RelatedFoundSet) foundSet).getParents();
boolean hasParentsInFindMode = false;
for (IRecordInternal record : parentRecords) {
IFoundSetInternal parentFoundSet = record.getParentFoundSet();
if (parentFoundSet instanceof FoundSet && ((FoundSet) parentFoundSet).isInFindMode()) {
hasParentsInFindMode = true;
break;
}
}
if (!hasParentsInFindMode) {
result = true;
}
} else {
result = true;
}
}
return result;
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class RowReferencePropertyType method toRhinoValue.
@Override
public Object toRhinoValue(final String webComponentValue, PropertyDescription pd, IWebObjectContext componentOrService, Scriptable startScriptable) {
// TODO change this to another function class as it's not a call-to-client function in it's javadoc maybe? this is actually all on server
return new WebBaseFunction(null) {
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
IRecordInternal record = null;
if (args != null && args.length == 1 && args[0] instanceof IFoundSetInternal) {
Pair<String, Integer> splitHashAndIndex = FoundsetTypeSabloValue.splitPKHashAndIndex(webComponentValue);
int recordIndex = ((IFoundSetInternal) args[0]).getRecordIndex(splitHashAndIndex.getLeft(), splitHashAndIndex.getRight().intValue());
if (recordIndex != -1)
record = ((IFoundSetInternal) args[0]).getRecord(recordIndex);
}
return record;
}
};
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebForm method printXML.
/**
* @see com.servoy.j2db.IFormUIInternal#printXML(boolean)
*/
public String printXML(boolean printCurrentRecordOnly) {
IApplication application = formController.getApplication();
IFoundSetInternal fs = formController.getFoundSet();
try {
if (printCurrentRecordOnly) {
fs = fs.copyCurrentRecordFoundSet();
}
FormPreviewPanel fpp = new FormPreviewPanel(application, formController, fs);
// AWT stuff happens here, so execute it in the AWT Event Thread - else exceptions can occur
// for example in JEditorPane while getting the preferred size & stuff
processFppInAWTEventQueue(fpp, application);
StringWriter w = new StringWriter();
((PageList) fpp.getPageable()).toXML(w);
fpp.destroy();
return w.toString();
} catch (Throwable ex) {
// $NON-NLS-1$
application.reportError(application.getI18NMessage("servoy.formPanel.error.printDocument"), ex);
}
return null;
}
use of com.servoy.j2db.dataprocessing.IFoundSetInternal in project servoy-client by Servoy.
the class WebFormManager method reload.
public void reload(FormController[] fcontrollers) {
HashSet<MainPage> mainPages = new HashSet<MainPage>();
for (FormController fc : fcontrollers) {
WebForm formUI = (WebForm) fc.getFormUI();
MainPage mp = formUI.findParent(MainPage.class);
if (mp != null && mainPages.add(mp)) {
mp.setVersioned(false);
mp.setMainPageSwitched();
}
}
String navigatorName = null;
Set<MainPage> parents = new HashSet<MainPage>();
for (FormController fp : fcontrollers) {
if (fp != null) {
boolean formVisible = fp.isFormVisible();
IFoundSetInternal foundset = fp.getFormModel();
WebForm wf = (WebForm) fp.getFormUI();
MarkupContainer wfParent = wf.getParent();
boolean refresh = false;
// datasource has changed, but foundset has not
if (foundset != null && !Utils.equalObjects(foundset.getDataSource(), fp.getDataSource())) {
try {
foundset = (getApplication()).getFoundSetManager().getSharedFoundSet(fp.getDataSource());
foundset.loadAllRecords();
refresh = true;
} catch (ServoyException e) {
// $NON-NLS-1$
Debug.error("Failed to reload foundset.", e);
}
}
MainPage page = wf.findParent(MainPage.class);
try {
if (page != null) {
page.setTempRemoveMainForm(true);
}
fp.destroy();
} finally {
if (page != null) {
page.setTempRemoveMainForm(false);
}
}
while (wfParent != null && !(wfParent instanceof IWebFormContainer) && !(wfParent.getParent() instanceof MainPage) && !(wfParent.getParent() instanceof WebForm)) {
wfParent = wfParent.getParent();
}
if (wfParent instanceof IWebFormContainer) {
if (formVisible) {
FormController fc = leaseFormPanel(fp.getName());
if (fc != null) {
// form was deleted in developer?
fc.loadData(foundset, null);
if (refresh)
fc.recreateUI();
List<Runnable> runnables = new ArrayList<Runnable>();
((IWebFormContainer) wfParent).notifyVisible(true, runnables);
Utils.invokeLater(getApplication(), runnables);
}
}
} else if (wfParent != null) {
WebForm parentWF = wfParent.findParent(WebForm.class);
if (parentWF != null) {
if (!Arrays.asList(fcontrollers).contains(parentWF.getController()))
parentWF.getController().destroy();
} else {
MainPage parent = wfParent.findParent(MainPage.class);
if (parent != null && !parents.contains(parent)) {
parents.add(parent);
if (parent.getNavigator() == fp) {
navigatorName = fp.getName();
FormController navigator = getFormController(navigatorName, parent);
if (navigator != null) {
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
navigator.notifyVisible(true, invokeLaterRunnables);
Utils.invokeLater(getApplication(), invokeLaterRunnables);
parent.setNavigator(navigator);
// parent.triggerBrowserRequestIfNeeded(); // FIXME: this is needed here but currently does nothing because the request target is not yet set
}
}
FormController previousMainShowingForm = (parent != null ? parent.getController() : null);
if (previousMainShowingForm != null) {
FormController previousNavigator = parent.getNavigator();
parent.setController(null);
// navigator is not re-applied so apply it manually
int navigatorID = previousMainShowingForm.getForm().getNavigatorID();
if (navigatorID == Form.NAVIGATOR_IGNORE || (previousNavigator != null && previousNavigator.getForm().getID() == navigatorID)) {
parent.setNavigator(previousNavigator);
} else if (navigatorID > 0) {
Form newNavigator = application.getFlattenedSolution().getForm(navigatorID);
if (newNavigator != null) {
parent.setNavigator(leaseFormPanel(newNavigator.getName()));
}
}
showFormInMainPanel(previousMainShowingForm.getName(), parent, null, true, null);
// parent.triggerBrowserRequestIfNeeded(); // FIXME: this is needed here but currently does nothing because the request target is not yet set
}
}
}
}
}
}
for (MainPage mainPage : mainPages) {
mainPage.setVersioned(true);
}
}
Aggregations