Search in sources :

Example 1 with ITagResolver

use of com.servoy.base.util.ITagResolver in project servoy-client by Servoy.

the class WebAccordionPanel method showFoundSet.

protected 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);
    }
    ITagResolver resolver = getTagResolver(parentState);
    // refresh tab text
    for (int i = 0; i < allTabs.size(); i++) {
        WebTabHolder element = allTabs.get(i);
        if (element.getPanel() == flp) {
            element.refreshTagStrings(resolver);
            break;
        }
    }
}
Also used : FormController(com.servoy.j2db.FormController) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) ITagResolver(com.servoy.base.util.ITagResolver) Point(java.awt.Point)

Example 2 with ITagResolver

use of com.servoy.base.util.ITagResolver in project servoy-client by Servoy.

the class PartNode method getAggregatesFromRenderer.

private void getAggregatesFromRenderer(final List<AggregateVariable> aggregates, final Form f, DataRenderer a_renderer) throws RepositoryException {
    Map<IPersist, IDisplay> allFields = a_renderer.getFieldComponents();
    Iterator<IDisplay> it = allFields.values().iterator();
    while (it.hasNext()) {
        IDisplay display = it.next();
        if (display instanceof IDisplayData) {
            String dataProviderID = ((IDisplayData) display).getDataProviderID();
            if (dataProviderID != null) {
                IDataProvider dp = application.getFlattenedSolution().getDataproviderLookup(application.getFoundSetManager(), f).getDataProvider(dataProviderID);
                if (dp instanceof AggregateVariable) {
                    if (!aggregates.contains(dp))
                        aggregates.add((AggregateVariable) dp);
                }
            } else if (display instanceof IDisplayTagText) {
                String tagText = ((IDisplayTagText) display).getTagText();
                Text.processTags(tagText, new ITagResolver() {

                    public String getStringValue(String name) {
                        try {
                            IDataProvider dp = application.getFlattenedSolution().getDataproviderLookup(application.getFoundSetManager(), f).getDataProvider(name);
                            if (dp instanceof AggregateVariable) {
                                if (!aggregates.contains(dp))
                                    aggregates.add((AggregateVariable) dp);
                            }
                        } catch (Exception e) {
                            Debug.error(e);
                        }
                        return null;
                    }
                });
            }
        }
    }
}
Also used : IPersist(com.servoy.j2db.persistence.IPersist) ITagResolver(com.servoy.base.util.ITagResolver) IDisplay(com.servoy.j2db.dataprocessing.IDisplay) IDisplayData(com.servoy.j2db.dataprocessing.IDisplayData) IDataProvider(com.servoy.j2db.persistence.IDataProvider) AggregateVariable(com.servoy.j2db.persistence.AggregateVariable) IDisplayTagText(com.servoy.j2db.ui.IDisplayTagText) RepositoryException(com.servoy.j2db.persistence.RepositoryException)

Example 3 with ITagResolver

use of com.servoy.base.util.ITagResolver in project servoy-client by Servoy.

the class SpecialTabPanel method setRecord.

public void setRecord(IRecordInternal parentState, boolean stopEditing) {
    parentData = parentState;
    if (// enclosingComponent may already point to the next (uninitialised) form, see stateChanged()
    currentForm != null) {
        showFoundSet(currentForm, parentState, getDefaultSort());
    }
    ITagResolver resolver = getTagResolver(parentState);
    for (int i = 0; i < originalTabText.size(); i++) {
        String element = originalTabText.get(i);
        if (element != null) {
            enclosingComponent.setTitleAt(i, Text.processTags(element, resolver));
        }
    }
    for (int i = 0; i < originalTabTooltip.size(); i++) {
        String tooltip = originalTabTooltip.get(i);
        if (tooltip != null) {
            enclosingComponent.setToolTipTextAt(i, Text.processTags(tooltip, resolver));
        }
    }
}
Also used : ITagResolver(com.servoy.base.util.ITagResolver)

Example 4 with ITagResolver

use of com.servoy.base.util.ITagResolver in project servoy-client by Servoy.

the class WebTabPanel method showFoundSet.

protected 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);
    }
    ITagResolver resolver = getTagResolver(parentState);
    // refresh tab text
    for (int i = 0; i < allTabs.size(); i++) {
        WebTabHolder element = allTabs.get(i);
        if (element.getPanel() == flp) {
            element.refreshTagStrings(resolver);
            break;
        }
    }
}
Also used : FormController(com.servoy.j2db.FormController) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) ITagResolver(com.servoy.base.util.ITagResolver) Point(java.awt.Point)

Example 5 with ITagResolver

use of com.servoy.base.util.ITagResolver in project servoy-client by Servoy.

the class WebTabPanel method setRecord.

public void setRecord(IRecordInternal parentState, boolean stopEditing) {
    parentData = parentState;
    if (currentForm != null) {
        showFoundSet(currentForm, parentState, getDefaultSort());
    } else if (allTabs.size() > 0) {
        showFoundSet(allTabs.get(0).getPanel(), parentState, getDefaultSort());
    }
    ITagResolver resolver = getTagResolver(parentState);
    for (int i = 0; i < allTabs.size(); i++) {
        WebTabHolder element = allTabs.get(i);
        if (element.refreshTagStrings(resolver)) {
            getStylePropertyChanges().setChanged();
        }
    }
}
Also used : ITagResolver(com.servoy.base.util.ITagResolver) Point(java.awt.Point)

Aggregations

ITagResolver (com.servoy.base.util.ITagResolver)13 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)5 Point (java.awt.Point)5 FormController (com.servoy.j2db.FormController)3 IDisplayData (com.servoy.j2db.dataprocessing.IDisplayData)2 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)2 WebForm (com.servoy.j2db.server.headlessclient.WebForm)2 IJSFoundSet (com.servoy.base.scripting.api.IJSFoundSet)1 BasicFormController (com.servoy.j2db.BasicFormController)1 IApplication (com.servoy.j2db.IApplication)1 ServoyBeanState (com.servoy.j2db.component.ServoyBeanState)1 FoundSet (com.servoy.j2db.dataprocessing.FoundSet)1 IDisplay (com.servoy.j2db.dataprocessing.IDisplay)1 IDisplayRelatedData (com.servoy.j2db.dataprocessing.IDisplayRelatedData)1 ISwingFoundSet (com.servoy.j2db.dataprocessing.ISwingFoundSet)1 SortColumn (com.servoy.j2db.dataprocessing.SortColumn)1 DbIdentValue (com.servoy.j2db.dataprocessing.ValueFactory.DbIdentValue)1 IServoyAwareBean (com.servoy.j2db.dataui.IServoyAwareBean)1 AggregateVariable (com.servoy.j2db.persistence.AggregateVariable)1 IDataProvider (com.servoy.j2db.persistence.IDataProvider)1