use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class JSForm method addVariableToScopes.
private void addVariableToScopes(ScriptVariable var) {
List<IFormController> controllers = application.getFormManager().getCachedFormControllers(getForm());
for (IFormController formController : controllers) {
FormScope formScope = formController.getFormScope();
formScope.put(var, true);
}
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class JSForm method refreshFromScopes.
private void refreshFromScopes() {
List<IFormController> controllers = application.getFormManager().getCachedFormControllers(getForm());
for (IFormController formController : controllers) {
FormScope formScope = formController.getFormScope();
formScope.updateProviderswithCopy(getForm(), getForm());
formScope.reload();
}
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class JSForm method checkModification.
@Override
public final void checkModification() {
// make copy if needed
if (!isCopy) {
setForm(application.getFlattenedSolution().createPersistCopy(getForm()));
application.getFormManager().addForm(getForm(), false);
// forms scope still uses the old copy of Script Providers
Form oldform = getForm();
List<IFormController> controllers = application.getFormManager().getCachedFormControllers(getForm());
for (IFormController formController : controllers) {
FormScope formScope = formController.getFormScope();
formScope.updateProviderswithCopy(oldform, getForm());
}
isCopy = true;
} else {
application.getFlattenedSolution().flushFlattendFormCache(getForm(), true);
}
getForm().setLastModified(System.currentTimeMillis());
application.getFlattenedSolution().registerChangedForm(getForm());
useFormCache = false;
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class NGFormManager method destroySolutionSettings.
protected void destroySolutionSettings(boolean reload) {
loginForm = null;
for (IFormController controller : createdFormControllers.values()) {
controller.destroy();
hideFormIfVisible(controller);
}
clearLeaseHistory();
possibleForms.clear();
scriptingReadonlyStates.clear();
// cleanup windows (containers)
NGRuntimeWindowManager wm = ((INGApplication) application).getRuntimeWindowManager();
wm.destroy(reload);
}
use of com.servoy.j2db.IFormController in project servoy-client by Servoy.
the class NGFormManager method showFormInContainer.
@Override
public IFormController showFormInContainer(String formName, IBasicMainContainer container, String title, boolean closeAll, String dialogName) {
if (loginForm != null && loginForm.getName() != formName) {
// not allowed to leave here...or show anything else than login form
return null;
}
// $NON-NLS-1$
if (formName == null)
throw new IllegalArgumentException(application.getI18NMessage("servoy.formManager.error.SettingVoidForm"));
IFormController currentMainShowingForm = container.getController();
boolean sameForm = (currentMainShowingForm != null && formName.equals(currentMainShowingForm.getName()));
if (sameForm && currentMainShowingForm.isFormVisible())
return leaseFormPanel(currentMainShowingForm.getName());
final Form f = possibleForms.get(formName);
if (f == null) {
return null;
}
try {
int access = application.getFlattenedSolution().getSecurityAccess(f.getUUID(), f.getImplicitSecurityNoRights() ? IRepository.IMPLICIT_FORM_NO_ACCESS : IRepository.IMPLICIT_FORM_ACCESS);
if (access != -1) {
boolean b_visible = ((access & IRepository.VIEWABLE) != 0);
if (!b_visible) {
// $NON-NLS-1$
application.reportWarningInStatus(application.getI18NMessage("servoy.formManager.warningAccessForm"));
return null;
}
}
// handle old panel
if (currentMainShowingForm != null) {
// leave forms in browse mode // TODO can this be set if notifyVisible returns false (current form is being kept)
if (application.getModeManager().getMode() != IModeManager.EDIT_MODE) {
application.getModeManager().setMode(IModeManager.EDIT_MODE);
}
IWebFormController fp = leaseFormPanel(currentMainShowingForm.getName());
if (fp != null && !sameForm) {
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
boolean ok = fp.notifyVisible(false, invokeLaterRunnables);
if (invokeLaterRunnables.size() > 0)
wrapInShowLoadingIndicator(invokeLaterRunnables);
Utils.invokeLater(application, invokeLaterRunnables);
// solution closed in onhide method of previous form?
if (application.getSolution() == null)
return null;
if (!ok) {
return fp;
}
}
}
// set main
IFormController tmpForm = currentMainShowingForm;
final IWebFormController fp = leaseFormPanel(formName);
currentMainShowingForm = fp;
if (fp != null) {
// test if solution is closed in the onload method.
if (application.getSolution() == null)
return null;
setCurrentControllerJS(fp);
// add to history
getHistory(container).add(fp.getName());
container.setController(fp);
// show panel as main
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
fp.notifyVisible(true, invokeLaterRunnables);
String titleText = title;
if (titleText == null)
titleText = f.getTitleText();
// $NON-NLS-1$
if (titleText == null || titleText.equals(""))
titleText = fp.getName();
// $NON-NLS-1$
if (NO_TITLE_TEXT.equals(titleText))
titleText = "";
container.setTitle(titleText);
fp.getFormUI().setParentWindowName(container.getContainerName());
if (invokeLaterRunnables.size() > 0)
wrapInShowLoadingIndicator(invokeLaterRunnables);
Utils.invokeLater(application, invokeLaterRunnables);
} else {
container.setController(null);
}
// $NON-NLS-1$
J2DBGlobals.firePropertyChange(this, "form", tmpForm, currentMainShowingForm);
return fp;
} catch (Exception e) {
Debug.error(e);
}
return null;
}
Aggregations