Search in sources :

Example 61 with FormController

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

the class WebTabPanel method notifyVisible.

public void notifyVisible(boolean visible, List<Runnable> invokeLaterRunnables) {
    if (currentForm == null && allTabs.size() > 0) {
        WebTabHolder holder = allTabs.get(0);
        setCurrentForm(holder.getPanel(), -1, invokeLaterRunnables);
    }
    if (currentForm != null && currentForm.getWebForm() != null) {
        FormController controller = currentForm.getWebForm().getController();
        // this is not needed when closing
        if (visible && parentData != null) {
            showFoundSet(currentForm, parentData, controller.getDefaultSortColumns());
            // Test if current one is there
            if (currentForm.isReady()) {
                if (WebTabPanel.this.get(currentForm.getWebForm().getId()) != null) {
                    // replace it
                    WebTabPanel.this.replace(currentForm.getWebForm());
                } else {
                    // else add it
                    WebTabPanel.this.add(currentForm.getWebForm());
                }
                recomputeTabSequence();
            }
        }
        controller.notifyVisible(visible, invokeLaterRunnables);
    }
}
Also used : FormController(com.servoy.j2db.FormController)

Example 62 with FormController

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

the class WebSplitPane method notifyResized.

public void notifyResized() {
    for (int i = 0; i < 2; i++) {
        if (webTabs[i] != null && webTabs[i].getPanel().isReady()) {
            WebForm webForm = webTabs[i].getPanel().getWebForm();
            FormController controller = webForm.getController();
            if (controller != null && webForm.isFormWidthHeightChanged()) {
                controller.notifyResized();
                webForm.clearFormWidthHeightChangedFlag();
            }
        }
    }
}
Also used : FormController(com.servoy.j2db.FormController) BasicFormController(com.servoy.j2db.BasicFormController) WebForm(com.servoy.j2db.server.headlessclient.WebForm) Point(java.awt.Point)

Example 63 with FormController

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

the class WebSplitPane method notifyVisibleForm.

private boolean notifyVisibleForm(boolean visible, int tabIdx, List<Runnable> invokeLaterRunnables) {
    if (webTabs[tabIdx] != null) {
        WebTabFormLookup fl = webTabs[tabIdx].getPanel();
        FormController controller = fl.getWebForm().getController();
        // this is not needed when closing
        if (visible) {
            if (parentData != null)
                showFoundSet(fl, parentData, controller.getDefaultSortColumns());
            // Test if current one is there
            if (fl.isReady()) {
                if (splitComponents[tabIdx].get(fl.getWebForm().getId()) != null) {
                    // replace it
                    splitComponents[tabIdx].replace(fl.getWebForm());
                } else {
                    // else add it
                    splitComponents[tabIdx].add(fl.getWebForm());
                }
                FormController fc = fl.getWebForm().getController();
                if (tabIdx == 1 && webTabs[0] != null)
                    fc.recomputeTabSequence(leftPanelLastTabIndex);
                else
                    fc.recomputeTabSequence(tabSequenceIndex);
            }
        }
        return controller.notifyVisible(visible, invokeLaterRunnables);
    }
    return false;
}
Also used : FormController(com.servoy.j2db.FormController) BasicFormController(com.servoy.j2db.BasicFormController)

Example 64 with FormController

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

the class WebSplitPane method showFoundSet.

private void showFoundSet(WebTabFormLookup flp, IRecordInternal parentState, List<SortColumn> sort) {
    deregisterSelectionListeners();
    if (!flp.isReady())
        return;
    FormController fp = flp.getWebForm().getController();
    if (fp != null && flp.getRelationName() != null) {
        IFoundSetInternal relatedFoundset = parentState == null ? null : parentState.getRelatedFoundSet(flp.getRelationName(), sort);
        registerSelectionListeners(parentState, flp.getRelationName());
        fp.loadData(relatedFoundset, null);
    }
}
Also used : FormController(com.servoy.j2db.FormController) BasicFormController(com.servoy.j2db.BasicFormController) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal)

Example 65 with FormController

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

the class SwingFormManager method fillScriptMenu.

// fill the scripts menu
@Override
public void fillScriptMenu() {
    JMenu menu = getScriptMenu();
    // Remove old script methods.
    menu.removeAll();
    FlattenedSolution sol = getApplication().getFlattenedSolution();
    if (sol.getSolution() == null)
        return;
    List<ScriptMenuItem> globalMenus = new ArrayList<ScriptMenuItem>();
    int menuCount = 1;
    Iterator<ScriptMethod> globalMethods = sol.getScriptMethods(true);
    while (globalMethods.hasNext()) {
        ScriptMethod sm = globalMethods.next();
        ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(ScriptVariable.SCOPES_DOT_PREFIX + sm.getScopeName(), sm.getName()), menuCount);
        if (item != null) {
            globalMenus.add(item);
            if (menuCount > 0 && menuCount < 9) {
                menuCount++;
            } else {
                menuCount = -1;
            }
            // just break after 50, doesn't make sense to have more in the menu..
            if (globalMenus.size() > 50)
                break;
        }
    }
    JMenu globalMenu = menu;
    if (// if big create sub menu for global methods
    globalMenus.size() > 20) {
        globalMenu = new JMenu(Messages.getString("servoy.formManager.menuGlobalMethods"));
        menu.add(globalMenu);
    }
    Iterator<ScriptMenuItem> it = globalMenus.iterator();
    while (it.hasNext()) {
        ScriptMenuItem item = it.next();
        globalMenu.add(item);
    }
    boolean insertSeparator = menu.getMenuComponentCount() > 0;
    FormController fp = getCurrentMainShowingFormController();
    if (fp != null) {
        int nformmethods = 0;
        Form form = fp.getForm();
        Iterator<ScriptMethod> formMethods = form.getScriptMethods(true);
        while (formMethods.hasNext()) {
            ScriptMethod sm = formMethods.next();
            ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(form.getName(), sm.getName()), -1);
            if (item != null) {
                if (insertSeparator) {
                    menu.add(new JSeparator());
                    insertSeparator = false;
                }
                nformmethods++;
                menu.add(item);
            }
        }
        if (form.getDataSource() != null) {
            insertSeparator |= nformmethods > 0;
            Iterator<ScriptMethod> foundsetMethods = fp.getApplication().getFlattenedSolution().getFoundsetMethods(fp.getDataSource(), true);
            while (foundsetMethods.hasNext()) {
                ScriptMethod sm = foundsetMethods.next();
                ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(form.getName(), sm.getName()), -1);
                if (item != null) {
                    if (insertSeparator) {
                        menu.add(new JSeparator());
                        insertSeparator = false;
                    }
                    menu.add(item);
                }
            }
        }
    }
    menu.setEnabled(menu.getMenuComponentCount() > 0);
}
Also used : FormController(com.servoy.j2db.FormController) BasicFormController(com.servoy.j2db.BasicFormController) ScriptMenuItem(com.servoy.j2db.smart.scripting.ScriptMenuItem) Form(com.servoy.j2db.persistence.Form) ArrayList(java.util.ArrayList) FlattenedSolution(com.servoy.j2db.FlattenedSolution) JSeparator(javax.swing.JSeparator) FunctionDefinition(com.servoy.j2db.scripting.FunctionDefinition) ScriptMethod(com.servoy.j2db.persistence.ScriptMethod) JMenu(javax.swing.JMenu)

Aggregations

FormController (com.servoy.j2db.FormController)70 FormManager (com.servoy.j2db.FormManager)15 Form (com.servoy.j2db.persistence.Form)13 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)12 RepositoryException (com.servoy.j2db.persistence.RepositoryException)10 Point (java.awt.Point)10 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)9 ArrayList (java.util.ArrayList)9 IFormController (com.servoy.j2db.IFormController)8 BasicFormController (com.servoy.j2db.BasicFormController)7 IForm (com.servoy.j2db.IForm)7 WebForm (com.servoy.j2db.server.headlessclient.WebForm)7 FlattenedSolution (com.servoy.j2db.FlattenedSolution)6 IFormUIInternal (com.servoy.j2db.IFormUIInternal)5 IDataProvider (com.servoy.j2db.persistence.IDataProvider)5 List (java.util.List)5 ApplicationException (com.servoy.j2db.ApplicationException)4 IMainContainer (com.servoy.j2db.IMainContainer)4 PrototypeState (com.servoy.j2db.dataprocessing.PrototypeState)4 IDataRenderer (com.servoy.j2db.ui.IDataRenderer)4