Search in sources :

Example 1 with JSForm

use of com.servoy.j2db.scripting.solutionmodel.JSForm in project servoy-client by Servoy.

the class FormComponentPropertyType method getForm.

public Form getForm(Object formElementValue, FlattenedSolution fs) {
    Object formId = formElementValue;
    if (formId instanceof JSONObject) {
        formId = ((JSONObject) formId).optString("svy_form");
    }
    Form form = null;
    if (formId instanceof Integer) {
        form = fs.getForm(((Integer) formId).intValue());
    } else if (formId instanceof String || formId instanceof UUID) {
        // try first by name or uuid (FS caches by both)
        form = fs.getForm(formId.toString());
        if (form == null) {
            form = (Form) fs.searchPersist(formId.toString());
        }
    } else if (formId instanceof JSForm) {
        return ((JSForm) formId).getSupportChild();
    }
    return form;
}
Also used : JSONObject(org.json.JSONObject) JSForm(com.servoy.j2db.scripting.solutionmodel.JSForm) Form(com.servoy.j2db.persistence.Form) JSForm(com.servoy.j2db.scripting.solutionmodel.JSForm) JSONObject(org.json.JSONObject) UUID(com.servoy.j2db.util.UUID)

Example 2 with JSForm

use of com.servoy.j2db.scripting.solutionmodel.JSForm 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)

Aggregations

Form (com.servoy.j2db.persistence.Form)2 JSForm (com.servoy.j2db.scripting.solutionmodel.JSForm)2 ApplicationException (com.servoy.j2db.ApplicationException)1 BasicFormController (com.servoy.j2db.BasicFormController)1 IBasicFormManager (com.servoy.j2db.IBasicFormManager)1 UUID (com.servoy.j2db.util.UUID)1 JSONObject (org.json.JSONObject)1