Search in sources :

Example 56 with FormController

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

the class WebDataRenderer method getParentViewBgColor.

private String getParentViewBgColor() {
    if (parentView != null) {
        String rowBGColorCalculation = parentView.getRowBGColorScript();
        IRecordInternal rec = (IRecordInternal) getDefaultModelObject();
        if (rec != null && rec.getRawData() != null) {
            IFoundSetInternal parentFoundSet = rec.getParentFoundSet();
            int recIndex = parentFoundSet.getSelectedIndex();
            boolean isSelected = recIndex == parentFoundSet.getRecordIndex(rec);
            if (rowBGColorCalculation != null) {
                Object bg_color = null;
                if (rec.getRawData().containsCalculation(rowBGColorCalculation)) {
                    // data renderer is always on the selected index.
                    bg_color = parentFoundSet.getCalculationValue(rec, rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(recIndex), new Boolean(isSelected), null, null, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), null);
                } else {
                    try {
                        FormController currentForm = dataAdapterList.getFormController();
                        bg_color = currentForm.executeFunction(rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(parentFoundSet.getSelectedIndex()), new Boolean(isSelected), null, null, currentForm.getName(), rec, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), true, null, true, null);
                    } catch (Exception ex) {
                        Debug.error(ex);
                    }
                }
                if (bg_color != null && !(bg_color.toString().trim().length() == 0) && !(bg_color instanceof Undefined)) {
                    return bg_color.toString();
                }
            }
            if (parentView instanceof ISupportRowStyling) {
                ISupportRowStyling parentViewWithRowStyling = (ISupportRowStyling) parentView;
                IStyleSheet ss = parentViewWithRowStyling.getRowStyleSheet();
                IStyleRule style = isSelected ? parentViewWithRowStyling.getRowSelectedStyle() : null;
                if (style != null && style.getAttributeCount() == 0)
                    style = null;
                if (style == null) {
                    style = (recIndex % 2 == 0) ? parentViewWithRowStyling.getRowEvenStyle() : parentViewWithRowStyling.getRowOddStyle();
                }
                if (ss != null && style != null) {
                    return PersistHelper.createColorString(ss.getBackground(style));
                }
            }
        }
    }
    return null;
}
Also used : FormController(com.servoy.j2db.FormController) Undefined(org.mozilla.javascript.Undefined) ISupportRowStyling(com.servoy.j2db.ui.ISupportRowStyling) IStyleSheet(com.servoy.j2db.util.IStyleSheet) IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) Point(java.awt.Point) NoSuchElementException(java.util.NoSuchElementException) IStyleRule(com.servoy.j2db.util.IStyleRule)

Example 57 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 58 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 59 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 60 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)

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