use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class AlwaysRowSelectedSelectionModel method testStopUIEditing.
private boolean testStopUIEditing() {
for (IFormController fco : formControllers.toArray(new IFormController[formControllers.size()])) {
if (fco.isFormVisible()) {
EditRecordList editRecordList = fco.getApplication().getFoundSetManager().getEditRecordList();
IRecord[] editedRecords = editRecordList.getEditedRecords(fco.getFoundSet());
if (editedRecords.length > 0) {
int stopEditing = editRecordList.stopEditing(false, Arrays.asList(editedRecords));
return stopEditing == ISaveConstants.STOPPED || stopEditing == ISaveConstants.AUTO_SAVE_BLOCKED;
}
}
}
return true;
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class DebugJ2DBClient method destroyForm.
/**
* @param formController
* @return
*/
private void destroyForm(IFormController formController) {
refreshI18NMessages(true);
if (formController.isFormVisible()) {
IFoundSetInternal foundSet = formController.getFormModel();
if (foundSet instanceof FoundSet) {
((FoundSet) foundSet).refresh();
}
String name = null;
if (formController.getForm() != null)
name = formController.getForm().getName();
if (name == null)
name = formController.getName();
if (getFormManager().getCurrentForm() == formController) {
formController.destroy();
getFormManager().showFormInCurrentContainer(name);
} else {
SwingForm swingForm = (SwingForm) formController.getFormUI();
Container container = swingForm.getParent();
boolean isNavigator = false;
boolean isWindow = false;
boolean isLookupPanel = false;
if (container instanceof MainPanel) {
isNavigator = ((MainPanel) container).getNavigator() == formController;
} else if (container instanceof FormLookupPanel) {
isLookupPanel = true;
} else {
while (container != null && !(container instanceof FormWindow)) {
container = container.getParent();
}
if (container instanceof FormWindow) {
isWindow = true;
}
}
formController.destroy();
if (isLookupPanel) {
FormLookupPanel flp = (FormLookupPanel) container;
FormController newFormController = flp.getFormPanel();
if (newFormController != null) {
// deleted in developer ?
newFormController.loadData(foundSet, null);
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
newFormController.notifyVisible(true, invokeLaterRunnables);
Utils.invokeLater(this, invokeLaterRunnables);
}
} else if (isNavigator) {
// TODO isNavigator check will always be false for NGClient?
FormController navigator = ((FormManager) getFormManager()).getFormController(name, container);
if (navigator != null) {
navigator.loadData(foundSet, null);
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
navigator.notifyVisible(true, invokeLaterRunnables);
Utils.invokeLater(this, invokeLaterRunnables);
}
mainPanel.setNavigator(navigator);
} else if (isWindow) {
// TODO isWindow check will always be false for NGClient?
FormWindow w = (FormWindow) container;
((FormManager) getFormManager()).showFormInMainPanel(name, w.getMainContainer(), w.getTitle(), false, w.getName());
}
}
} else {
formController.destroy();
}
return;
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class DebugNGClient method refreshPersists.
@Override
public void refreshPersists(Collection<IPersist> changes) {
if (isShutDown())
return;
// flush the solution model cache of the form element helper when there is a solution copy.
// so that FormComponents are recreated with the latest data once.
Solution solutionCopy = getFlattenedSolution().getSolutionCopy(false);
if (solutionCopy != null)
solutionCopy.setRuntimeProperty(FormElementHelper.SOLUTION_MODEL_CACHE, null);
Set<IFormController>[] scopesAndFormsToReload = DebugUtils.getScopesAndFormsToReload(this, changes);
for (IFormController controller : scopesAndFormsToReload[1]) {
if (controller.getForm() instanceof FlattenedForm) {
FlattenedForm ff = (FlattenedForm) controller.getForm();
ff.reload();
}
}
boolean forcePageReload = false;
if (scopesAndFormsToReload[1] == null || scopesAndFormsToReload[1].size() < 1) {
for (IPersist persist : changes) {
// that one, can also have other css included, using the 'import' statement
if (persist instanceof Media && !PersistHelper.getOrderedStyleSheets(getFlattenedSolution()).isEmpty()) {
String name = ((Media) persist).getName().toLowerCase();
if (name.endsWith(".less") || name.endsWith(".css")) {
forcePageReload = true;
break;
}
}
}
}
refreshForms(scopesAndFormsToReload[1], forcePageReload);
for (IFormController controller : scopesAndFormsToReload[0]) {
controller.getFormScope().reload();
}
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class DebugWebClient method performRefresh.
private void performRefresh(List<IPersist> changes) {
Set<IFormController>[] scopesAndFormsToReload = DebugUtils.getScopesAndFormsToReload(this, changes);
for (IFormController controller : scopesAndFormsToReload[0]) {
if (controller.getForm() instanceof FlattenedForm) {
FlattenedForm ff = (FlattenedForm) controller.getForm();
ff.reload();
}
controller.getFormScope().reload();
}
if (scopesAndFormsToReload[1].size() > 0)
((WebFormManager) getFormManager()).reload((scopesAndFormsToReload[1]).toArray(new FormController[0]));
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class JSForm method removeVariableFromScopes.
private void removeVariableFromScopes(ScriptVariable var) {
List<IFormController> controllers = application.getFormManager().getCachedFormControllers(getForm());
for (IFormController formController : controllers) {
FormScope formScope = formController.getFormScope();
formScope.updateProviderswithCopy(getForm(), getForm());
formScope.remove(var);
}
}
Aggregations