use of com.servoy.j2db.FormManager in project servoy-client by Servoy.
the class SwingRuntimeWindow method doOldShowInDialog.
private void doOldShowInDialog(String formName, boolean closeAll, boolean legacyV3Behavior) {
FormManager fm = ((FormManager) getApplication().getFormManager());
IMainContainer currentModalDialogContainer = fm.getModalDialogContainer();
JSWindow parentJSWindow = getParent();
RuntimeWindow parentRuntimeWindow = null;
if (parentJSWindow != null && parentJSWindow.getImpl().isVisible())
parentRuntimeWindow = parentJSWindow.getImpl();
else {
Window dialogWindowOwner = getWindowFromMainContainer(currentModalDialogContainer);
if (dialogWindowOwner != null) {
IMainContainer currentContainer = fm.getCurrentContainer();
Window currentContainerWindow = getWindowFromMainContainer(currentContainer);
while (currentContainerWindow != null) {
if (dialogWindowOwner == currentContainerWindow) {
break;
}
currentContainerWindow = currentContainerWindow.getOwner();
}
if (currentContainerWindow == null) {
// if it never really was the owner (in the own chain of the dialog) then do just use the currentContainer.
currentModalDialogContainer = currentContainer;
}
}
parentRuntimeWindow = getApplication().getRuntimeWindowManager().getWindow(currentModalDialogContainer.getContainerName());
}
boolean windowModal = ((legacyV3Behavior && wrappedWindow == null) || getType() == JSWindow.MODAL_DIALOG);
Pair<Boolean, IMainContainer> p = createAndReparentDialogIfNeeded(fm, parentRuntimeWindow, windowModal);
boolean bringToFrontNeeded = p.getLeft().booleanValue();
IMainContainer previousModalContainer = p.getRight();
FormDialog sfd = (FormDialog) wrappedWindow;
IMainContainer container = sfd.getMainContainer();
// For none legacy the dialog must always be really closed
sfd.setCloseAll(closeAll || !legacyV3Behavior);
if (sfd.isVisible()) {
sfd.storeBounds();
}
final FormController fp = fm.showFormInMainPanel(formName, container, title, closeAll && legacyV3Behavior, windowName);
if (fp != null && fp.getName().equals(formName)) {
sfd.setModal(windowModal);
if (!sfd.isDisplayable() && isUndecorated()) {
sfd.setUndecorated(true);
sfd.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
// $NON-NLS-1$
if (Utils.isAppleMacOS())
sfd.getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);
}
applyOpacityAndTransparency(sfd, container, sfd.getContentPane(), sfd.isUndecorated());
if (windowModal) {
testAndSetJava6Modality(sfd);
// When a modal window is closed, the old modal window state will have to be restored...
// For example, when inside JS for an event you close a modal window and open another one,
// the new modal window must have as owner not the closed window, but the last opened modal window
// before the window just closed.
// This has to happen when setVisible(false) is called on the modal dialog. We cannot simply rely
// on executing this after sfd.setVisible(true) is unblocked, because then it will be executed
// after the new dialog is opened by java script. (because that execution continues as the next event on the EventThread)
sfd.setPreviousMainContainer(previousModalContainer, currentModalDialogContainer);
} else {
// If it is a none modal dialog, make sure the current container is reset to the currentMainContainer (== previous his parent)
// else it is switched a bit to early (if a developer shows 2 dialogs at once from a main container)
// the focus event of the FormDialog will set it correctly.
fm.setCurrentContainer(currentModalDialogContainer, currentModalDialogContainer.getName());
}
}
finalizeShowWindow(fp, formName, container, true, legacyV3Behavior, bringToFrontNeeded);
}
use of com.servoy.j2db.FormManager in project servoy-client by Servoy.
the class DataProviderEditor method setValue.
public void setValue(Object v) {
value = (String) v;
FormManager fm = (FormManager) application.getFormManager();
FormController fc = fm.getCurrentMainShowingFormController();
if (fc != null) {
Form form = fc.getForm();
if (form != null) {
try {
IDataProvider dp = application.getFlattenedSolution().getDataproviderLookup(null, form).getDataProvider(value);
showDataEx(dp);
} catch (Exception ex) {
Debug.error(ex);
}
}
}
}
use of com.servoy.j2db.FormManager in project servoy-client by Servoy.
the class CmdManager method ableFormRelatedFindActions.
public void ableFormRelatedFindActions(boolean enable) {
FormManager fm = (FormManager) application.getFormManager();
IForm[] visibleRootFormsInFind = (fm != null) ? fm.getVisibleRootFormsInFind() : null;
boolean thereAreUsableVisibleFormsInFind = ((visibleRootFormsInFind != null) && (visibleRootFormsInFind.length > 0));
// if there are visible forms that are still in find mode, even though enabled = false (for example
// when another form exits find mode - see unrelated tab panels) the actions must still remain enabled (although it is a strange case)
boolean shouldPerform = false;
if (thereAreUsableVisibleFormsInFind) {
for (IForm f : visibleRootFormsInFind) {
if (!(f instanceof FormController) || ((FormController) f).getForm() == null || ((FormController) f).getForm().getOnSearchCmdMethodID() >= 0) {
shouldPerform = true;
break;
}
}
} else {
shouldPerform = true;
}
// if we want to enable find actions we check for onsearchcmd of the form; if set to none, actions are not enabled
if (shouldPerform) {
// $NON-NLS-1$
Action cmdperformfind = actions.get("cmdperformfind");
if (cmdperformfind != null)
cmdperformfind.setEnabled(enable || thereAreUsableVisibleFormsInFind);
// $NON-NLS-1$
Action cmdreducefind = actions.get("cmdreducefind");
if (cmdreducefind != null)
cmdreducefind.setEnabled(enable || thereAreUsableVisibleFormsInFind);
// $NON-NLS-1$
Action cmdextendfind = actions.get("cmdextendfind");
if (cmdextendfind != null)
cmdextendfind.setEnabled(enable || thereAreUsableVisibleFormsInFind);
}
// this action must be enabled even if onsearchcmd is set to none...
// $NON-NLS-1$
Action cmdstopsearchfindall = actions.get("cmdstopsearchfindall");
if (cmdstopsearchfindall != null)
cmdstopsearchfindall.setEnabled(enable);
}
use of com.servoy.j2db.FormManager in project servoy-client by Servoy.
the class CmdPerformFind method doIt.
/*
* _____________________________________________________________ The methods below override methods from superclass AbstractCmd
*/
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
FormManager fm = (FormManager) application.getFormManager();
IForm[] rootFindModeForms = fm.getVisibleRootFormsInFind();
if (rootFindModeForms.length > 0) {
// if you have 2 visible forms in find that use the same foundset (paren + child tab on the same table)
HashSet<IFoundSet> processedFounsets = new HashSet<IFoundSet>();
// if you call performFind() on both of them you might get the "no results, modify last find" dialog twice...
for (IForm f : rootFindModeForms) {
// check for each form if it is still in find mode (as onSearchCmd on one form might stop find mode on others as well and we do not want to trigger onSearchCmd on the others
IFoundSet foundSet = f.getFoundSet();
boolean shouldPerform = f.isInFindMode() && (foundSet == null || !processedFounsets.contains(foundSet));
if (shouldPerform && f instanceof FormController && ((FormController) f).getForm() != null && ((FormController) f).getForm().getOnSearchCmdMethodID() < 0)
shouldPerform = false;
if (shouldPerform) {
processedFounsets.add(foundSet);
f.performFind(true, true, true);
// wants to continue find) then don't try to perform search any more find mode forms
if (f.isInFindMode())
break;
}
}
}
return null;
}
use of com.servoy.j2db.FormManager in project servoy-client by Servoy.
the class WebBaseSelectBox method fireOnRender.
public void fireOnRender(boolean force) {
if (scriptable != null) {
boolean isFocused = false;
IMainContainer currentContainer = ((FormManager) application.getFormManager()).getCurrentContainer();
if (currentContainer instanceof MainPage) {
isFocused = this.equals(((MainPage) currentContainer).getFocusedComponent());
}
if (force)
scriptable.getRenderEventExecutor().setRenderStateChanged();
scriptable.getRenderEventExecutor().fireOnRender(isFocused);
}
}
Aggregations