Search in sources :

Example 31 with FormManager

use of com.servoy.j2db.FormManager in project servoy-client by Servoy.

the class CmdExtendFind method doIt.

/*
 * _____________________________________________________________ The methods below override methods from superclass AbstractCmd
 */
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    IFormManager fm = application.getFormManager();
    IForm cf = fm.getCurrentForm();
    if (cf != null && !cf.isInFindMode()) {
        cf = null;
    }
    if (cf == null) {
        IForm[] rfif = ((FormManager) fm).getVisibleRootFormsInFind();
        cf = rfif.length > 0 ? rfif[0] : null;
    // rfif.length > 1 would be a strange case where more than one visible form relation hierarchy is in find mode;
    // we choose the first one - I or should we use all of them?! this is an ansupported case anyway
    }
    if (cf != null) {
        cf.performFind(false, false, true);
    }
    return null;
}
Also used : IFormManager(com.servoy.j2db.IFormManager) IFormManager(com.servoy.j2db.IFormManager) FormManager(com.servoy.j2db.FormManager) IForm(com.servoy.j2db.IForm)

Example 32 with FormManager

use of com.servoy.j2db.FormManager in project servoy-client by Servoy.

the class CmdReduceFind method doIt.

/*
 * _____________________________________________________________ The methods below override methods from superclass AbstractCmd
 */
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    IFormManager fm = application.getFormManager();
    IForm cf = fm.getCurrentForm();
    if (cf != null && !cf.isInFindMode()) {
        cf = null;
    }
    if (cf == null) {
        IForm[] rfif = ((FormManager) fm).getVisibleRootFormsInFind();
        cf = rfif.length > 0 ? rfif[0] : null;
    // rfif.length > 1 would be a strange case where more than one visible form relation hierarchy is in find mode;
    // we choose the first one - I or should we use all of them?! this is an ansupported case anyway
    }
    if (cf != null) {
        cf.performFind(false, true, true);
    }
    return null;
}
Also used : IFormManager(com.servoy.j2db.IFormManager) IFormManager(com.servoy.j2db.IFormManager) FormManager(com.servoy.j2db.FormManager) IForm(com.servoy.j2db.IForm)

Example 33 with FormManager

use of com.servoy.j2db.FormManager in project servoy-client by Servoy.

the class CmdStopSearchFindAll method doIt.

@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    try {
        // $NON-NLS-1$
        application.blockGUI(application.getI18NMessage("servoy.menuitem.showAll.status.text"));
        FormManager fm = (FormManager) application.getFormManager();
        IForm[] rootFindModeForms = fm.getVisibleRootFormsInFind();
        for (IForm fc : rootFindModeForms) {
            fc.loadAllRecords();
        }
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : FormManager(com.servoy.j2db.FormManager) IForm(com.servoy.j2db.IForm)

Example 34 with FormManager

use of com.servoy.j2db.FormManager in project servoy-client by Servoy.

the class JSSolutionModel method removeGlobalMethod.

/**
 * Removes the specified global method.
 *
 * @sample
 * var m1 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod1(){application.output("Global Method 1");}');
 * var m2 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod2(){application.output("Global Method 2");}');
 *
 * var success = solutionModel.removeGlobalMethod('globals', 'myglobalmethod1');
 * if (success == false) application.output('!!! myglobalmethod1 could not be removed !!!');
 *
 * var list = solutionModel.getGlobalMethods('globals');
 * for (var i = 0; i < list.length; i++) {
 * 	application.output(list[i].code);
 * }
 *
 * @param scopeName the scope in which the method is declared
 * @param name the name of the global method to be removed
 * @return true if the removal was successful, false otherwise
 */
@JSFunction
public boolean removeGlobalMethod(String scopeName, String name) {
    FlattenedSolution fs = application.getFlattenedSolution();
    ScriptMethod sm = fs.getScriptMethod(scopeName, name);
    if (sm != null) {
        fs.deletePersistCopy(sm, false);
        if (application.getFormManager() instanceof FormManager)
            ((FormManager) application.getFormManager()).fillScriptMenu();
        return true;
    }
    return false;
}
Also used : FormManager(com.servoy.j2db.FormManager) FlattenedSolution(com.servoy.j2db.FlattenedSolution) ScriptMethod(com.servoy.j2db.persistence.ScriptMethod) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Example 35 with FormManager

use of com.servoy.j2db.FormManager in project servoy-client by Servoy.

the class FormDialog method closeWindow.

public void closeWindow() {
    if (!isModal()) {
        GraphicsDevice device = getGraphicsConfiguration().getDevice();
        if (device.getFullScreenWindow() == this) {
            // reset fullscreen window when dialog closes
            device.setFullScreenWindow(null);
            dispose();
            setUndecorated(false);
        }
    }
    storeBounds();
    boolean wasVisible = isVisible();
    setVisible(false);
    if (wasVisible) {
        FormManager fm = (FormManager) application.getFormManager();
        if (isModal()) {
            fm.setModalDialogContainer(previousModalContainer);
            fm.setCurrentContainer(previousMainContainer, previousMainContainer.getContainerName());
        } else {
            Window owner = getOwner();
            if (owner instanceof FormWindow) {
                // called from another dialog/window
                ((FormWindow) owner).setAsCurrentContainer();
            } else {
                // called from main panel
                ((FormManager) application.getFormManager()).setCurrentContainer(null, null);
            }
        }
        fm.fillScriptMenu();
    }
}
Also used : Window(java.awt.Window) FormWindow(com.servoy.j2db.FormWindow) GraphicsDevice(java.awt.GraphicsDevice) FormManager(com.servoy.j2db.FormManager) FormWindow(com.servoy.j2db.FormWindow)

Aggregations

FormManager (com.servoy.j2db.FormManager)49 IMainContainer (com.servoy.j2db.IMainContainer)21 FormController (com.servoy.j2db.FormController)15 MainPage (com.servoy.j2db.server.headlessclient.MainPage)13 IForm (com.servoy.j2db.IForm)7 Form (com.servoy.j2db.persistence.Form)5 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)4 RepositoryException (com.servoy.j2db.persistence.RepositoryException)4 IComponent (com.servoy.j2db.ui.IComponent)4 Component (java.awt.Component)4 ArrayList (java.util.ArrayList)4 FlattenedSolution (com.servoy.j2db.FlattenedSolution)3 FormWindow (com.servoy.j2db.FormWindow)3 IBasicFormManager (com.servoy.j2db.IBasicFormManager)3 IFormController (com.servoy.j2db.IFormController)3 IFormManager (com.servoy.j2db.IFormManager)3 ITable (com.servoy.j2db.persistence.ITable)3 SwingFormManager (com.servoy.j2db.smart.SwingFormManager)3 IFieldComponent (com.servoy.j2db.ui.IFieldComponent)3 ServoyException (com.servoy.j2db.util.ServoyException)3