Search in sources :

Example 1 with RuntimeSplitPane

use of com.servoy.j2db.ui.scripting.RuntimeSplitPane in project servoy-client by Servoy.

the class ComponentFactory method createSplitPane.

private static IComponent createSplitPane(IApplication application, Form form, TabPanel meta, IScriptExecuter el) {
    RuntimeSplitPane scriptable = new RuntimeSplitPane(application.getItemFactory().createChangesRecorder(), application);
    ISplitPane splitPane = application.getItemFactory().createSplitPane(scriptable, getWebID(form, meta), meta.getTabOrientation());
    scriptable.setComponent(splitPane, meta);
    applyBasicComponentProperties(application, splitPane, meta, getStyleForBasicComponent(application, meta, form));
    try {
        int index = 0;
        Iterator<IPersist> it = meta.getTabs();
        while (it.hasNext() && index < 2) {
            Tab tab = (Tab) it.next();
            Form f = application.getFlattenedSolution().getForm(tab.getContainsFormID());
            if (f != null) {
                IFormLookupPanel flp = splitPane.createFormLookupPanel(tab.getName(), tab.getRelationName(), f.getName());
                if (index < 1)
                    splitPane.setLeftForm(flp);
                else
                    splitPane.setRightForm(flp);
                index++;
            }
        }
    } catch (Exception ex) {
        Debug.error(ex);
    }
    splitPane.setDividerLocation(meta.getTabOrientation() == TabPanel.SPLIT_HORIZONTAL ? splitPane.getSize().width / 2 : splitPane.getSize().height / 2);
    if (el != null && meta.getOnChangeMethodID() > 0) {
        splitPane.setOnDividerChangeMethodCmd((Integer.toString(meta.getOnChangeMethodID())));
        splitPane.addScriptExecuter(el);
    }
    return splitPane;
}
Also used : ISplitPane(com.servoy.j2db.ui.ISplitPane) Tab(com.servoy.j2db.persistence.Tab) IPersist(com.servoy.j2db.persistence.IPersist) IForm(com.servoy.j2db.IForm) Form(com.servoy.j2db.persistence.Form) RuntimeSplitPane(com.servoy.j2db.ui.scripting.RuntimeSplitPane) JSONException(org.json.JSONException) IOException(java.io.IOException) RepositoryException(com.servoy.j2db.persistence.RepositoryException) IFormLookupPanel(com.servoy.j2db.ui.IFormLookupPanel)

Aggregations

IForm (com.servoy.j2db.IForm)1 Form (com.servoy.j2db.persistence.Form)1 IPersist (com.servoy.j2db.persistence.IPersist)1 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 Tab (com.servoy.j2db.persistence.Tab)1 IFormLookupPanel (com.servoy.j2db.ui.IFormLookupPanel)1 ISplitPane (com.servoy.j2db.ui.ISplitPane)1 RuntimeSplitPane (com.servoy.j2db.ui.scripting.RuntimeSplitPane)1 IOException (java.io.IOException)1 JSONException (org.json.JSONException)1