Search in sources :

Example 6 with BasicFormController

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

the class RuntimeWindow method showObject.

public void showObject(Object form) throws ServoyException {
    String f = null;
    if (form instanceof BasicFormController) {
        f = ((BasicFormController) form).getName();
    } else if (form instanceof FormScope) {
        f = ((FormScope) form).getFormController().getName();
    } else if (form instanceof FormController.JSForm) {
        f = ((FormController.JSForm) form).getFormPanel().getName();
    } else if (form instanceof String) {
        f = (String) form;
    } else if (form instanceof JSForm) {
        f = ((JSForm) form).getName();
    }
    if (f != null) {
        Form frm = application.getFlattenedSolution().getForm(f);
        IBasicFormManager fm = application.getFormManager();
        if (frm == null && fm.isPossibleForm(f))
            frm = fm.getPossibleForm(f);
        if (!application.getFlattenedSolution().formCanBeInstantiated(frm)) {
            // abstract form
            throw new ApplicationException(ServoyException.ABSTRACT_FORM, new Object[] { f });
        }
        show(f);
    }
}
Also used : ApplicationException(com.servoy.j2db.ApplicationException) JSForm(com.servoy.j2db.scripting.solutionmodel.JSForm) Form(com.servoy.j2db.persistence.Form) JSForm(com.servoy.j2db.scripting.solutionmodel.JSForm) IBasicFormManager(com.servoy.j2db.IBasicFormManager) BasicFormController(com.servoy.j2db.BasicFormController)

Example 7 with BasicFormController

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

the class DataAdapterList method updateParentContainer.

private void updateParentContainer(IWebFormController relatedController, String relationName, boolean visible) {
    if (((BasicFormController) relatedController).isDestroyed())
        return;
    if (visible) {
        WebFormComponent parentContainer = null;
        Collection<WebComponent> components = formController.getFormUI().getComponents();
        for (WebComponent component : components) {
            // legacy behavior
            Object tabs = component.getProperty("tabs");
            if (tabs instanceof List && ((List) tabs).size() > 0) {
                List tabsList = (List) tabs;
                for (Object element : tabsList) {
                    Map<String, Object> tab = (Map<String, Object>) element;
                    if (tab != null) {
                        String relation = tab.get("relationName") != null ? tab.get("relationName").toString() : null;
                        Object form = tab.get("containsFormId");
                        if (Utils.equalObjects(form, relatedController.getName()) && Utils.equalObjects(relation, relationName)) {
                            parentContainer = (WebFormComponent) component;
                            break;
                        }
                    }
                }
            }
        }
        // // for non legacy components, wait for client to set correct parent; do not set null
        if (parentContainer != null || !relatedController.getForm().isResponsiveLayout()) {
            relatedController.getFormUI().setParentContainer(parentContainer);
        }
    }
}
Also used : WebComponent(org.sablo.WebComponent) JSONObject(org.json.JSONObject) BaseWebObject(org.sablo.BaseWebObject) ServoyJSONObject(com.servoy.j2db.util.ServoyJSONObject) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) WeakHashMap(java.util.WeakHashMap) BasicFormController(com.servoy.j2db.BasicFormController)

Aggregations

BasicFormController (com.servoy.j2db.BasicFormController)7 ApplicationException (com.servoy.j2db.ApplicationException)3 IBasicFormManager (com.servoy.j2db.IBasicFormManager)3 Form (com.servoy.j2db.persistence.Form)3 ServoyJSONObject (com.servoy.j2db.util.ServoyJSONObject)2 Rectangle (java.awt.Rectangle)2 JSONObject (org.json.JSONObject)2 ScriptableObject (org.mozilla.javascript.ScriptableObject)2 BaseWebObject (org.sablo.BaseWebObject)2 IJSFoundSet (com.servoy.base.scripting.api.IJSFoundSet)1 ITagResolver (com.servoy.base.util.ITagResolver)1 FireCollector (com.servoy.j2db.dataprocessing.FireCollector)1 FoundSet (com.servoy.j2db.dataprocessing.FoundSet)1 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)1 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)1 PrototypeState (com.servoy.j2db.dataprocessing.PrototypeState)1 IDataProvider (com.servoy.j2db.persistence.IDataProvider)1 Relation (com.servoy.j2db.persistence.Relation)1 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 JSForm (com.servoy.j2db.scripting.solutionmodel.JSForm)1