Search in sources :

Example 16 with IForm

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

the class CmdInvertRecords method doIt.

/*
 * _____________________________________________________________ The methods below override methods from superclass AbstractCmd
 */
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    try {
        // $NON-NLS-1$
        application.blockGUI(application.getI18NMessage("servoy.menuitem.invertRecords.status.text"));
        IFormManager fm = application.getFormManager();
        IForm dm = fm.getCurrentForm();
        dm.invertRecords();
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : IFormManager(com.servoy.j2db.IFormManager) IForm(com.servoy.j2db.IForm)

Example 17 with IForm

use of com.servoy.j2db.IForm 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);
}
Also used : FormController(com.servoy.j2db.FormController) Action(javax.swing.Action) SwingFormManager(com.servoy.j2db.smart.SwingFormManager) FormManager(com.servoy.j2db.FormManager) IForm(com.servoy.j2db.IForm)

Example 18 with IForm

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

the class CmdNewRecord method doIt.

/*
 * _____________________________________________________________ The methods below override methods from superclass AbstractCmd
 */
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    try {
        // $NON-NLS-1$
        application.blockGUI(application.getI18NMessage("servoy.menuitem.newRecord.status.text"));
        IFormManager fm = application.getFormManager();
        IForm dm = fm.getCurrentForm();
        if (dm != null) {
            dm.newRecord();
        }
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : IFormManager(com.servoy.j2db.IFormManager) IForm(com.servoy.j2db.IForm)

Example 19 with IForm

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

the class CmdOmitRecord method doIt.

/*
 * _____________________________________________________________ The methods below override methods from superclass AbstractCmd
 */
@Override
public UndoableEdit doIt(java.util.EventObject ae) {
    try {
        // $NON-NLS-1$
        application.blockGUI(application.getI18NMessage("servoy.menuitem.omitRecord.status.text"));
        IFormManager fm = application.getFormManager();
        IForm dm = fm.getCurrentForm();
        dm.omitRecord();
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : IFormManager(com.servoy.j2db.IFormManager) IForm(com.servoy.j2db.IForm)

Example 20 with IForm

use of com.servoy.j2db.IForm 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;
}
Also used : FormController(com.servoy.j2db.FormController) IFoundSet(com.servoy.j2db.dataprocessing.IFoundSet) FormManager(com.servoy.j2db.FormManager) IForm(com.servoy.j2db.IForm) HashSet(java.util.HashSet)

Aggregations

IForm (com.servoy.j2db.IForm)24 IFormManager (com.servoy.j2db.IFormManager)14 FormController (com.servoy.j2db.FormController)7 FormManager (com.servoy.j2db.FormManager)7 RepositoryException (com.servoy.j2db.persistence.RepositoryException)4 FlattenedSolution (com.servoy.j2db.FlattenedSolution)2 IScriptExecuter (com.servoy.j2db.IScriptExecuter)2 AbstractBase (com.servoy.j2db.persistence.AbstractBase)2 Form (com.servoy.j2db.persistence.Form)2 IDataProvider (com.servoy.j2db.persistence.IDataProvider)2 SwingFormManager (com.servoy.j2db.smart.SwingFormManager)2 IDisplayTagText (com.servoy.j2db.ui.IDisplayTagText)2 IStylePropertyChangesRecorder (com.servoy.j2db.ui.IStylePropertyChangesRecorder)2 RenderEventExecutor (com.servoy.j2db.ui.RenderEventExecutor)2 Pair (com.servoy.j2db.util.Pair)2 IOException (java.io.IOException)2 Map (java.util.Map)2 AbstractActiveSolutionHandler (com.servoy.j2db.AbstractActiveSolutionHandler)1 ApplicationException (com.servoy.j2db.ApplicationException)1 BasicFormController (com.servoy.j2db.BasicFormController)1