Search in sources :

Example 6 with Portal

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

the class ScrollResponseHeaderContainer method onDragEnd.

public void onDragEnd(JSDNDEvent event) {
    int onDragEndID = 0;
    if (cellview instanceof Portal) {
        Portal cellviewPortal = (Portal) cellview;
        onDragEndID = cellviewPortal.getOnDragEndMethodID();
    } else {
        onDragEndID = fc.getForm().getOnDragEndMethodID();
    }
    if (onDragEndID > 0) {
        // $NON-NLS-1$
        fc.executeFunction(Integer.toString(onDragEndID), new Object[] { event }, false, null, false, "onDragEndMethodID");
    }
}
Also used : Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) Point(java.awt.Point)

Example 7 with Portal

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

the class ScrollResponseHeaderContainer method initializeComponent.

@SuppressWarnings("nls")
private void initializeComponent(final Component c, AbstractBase view, IPersist element) {
    if (dal != null && dal.isDestroyed()) {
        Debug.error("Trying to initialize a component: " + c + " of " + view + " element: " + element + " that is in a destroyed tableview", new RuntimeException());
        return;
    }
    if (// Don't know any other place for this
    view instanceof Portal && c instanceof IDisplayData) {
        String id = ((IDisplayData) c).getDataProviderID();
        if (id != null && !ScopesUtils.isVariableScope(id) && id.startsWith(((Portal) view).getRelationName() + '.')) {
            ((IDisplayData) c).setDataProviderID(id.substring(((Portal) cellview).getRelationName().length() + 1));
        }
    }
    if (!isListViewMode() && c instanceof WebDataCheckBox) {
        // $NON-NLS-1$
        ((WebDataCheckBox) c).setText("");
    }
    if (element != null) {
        // apply to this cell the state of the columnIdentifier IComponent, do keep the location that is set by the tableview when creating these components the first time.
        // for listview this is the location to use.
        Point loc = ((IComponent) c).getLocation();
        int height = ((IComponent) c).getSize().height;
        PropertyCopy.copyElementProps((IComponent) elementToColumnIdentifierComponent.get(element), (IComponent) c);
        if (!isListViewMode()) {
            ((IComponent) c).setLocation(loc);
            // it shouldn't be possible to change the height
            if (c instanceof IScriptableProvider) {
                IScriptable so = ((IScriptableProvider) c).getScriptObject();
                if (so instanceof IRuntimeComponent) {
                    IRuntimeComponent ic = (IRuntimeComponent) so;
                    if (ic.getHeight() != height) {
                        ic.setSize(ic.getWidth(), height);
                    }
                }
            }
        }
    } else {
        // $NON-NLS-1$
        Debug.log("Cannot find the IPersist element for cell " + c.getMarkupId());
    }
    if (c instanceof IDisplayData) {
        IDisplayData cdd = (IDisplayData) c;
        if (!(dal != null && dal.getFormScope() != null && cdd.getDataProviderID() != null && // skip for form variables
        dal.getFormScope().get(cdd.getDataProviderID()) != Scriptable.NOT_FOUND)) {
            cdd.setValidationEnabled(validationEnabled);
        }
    } else if (c instanceof IDisplayRelatedData) {
        ((IDisplayRelatedData) c).setValidationEnabled(validationEnabled);
    } else if (c instanceof IServoyAwareBean) {
        ((IServoyAwareBean) c).setValidationEnabled(validationEnabled);
    }
    addClassToCellComponent(c);
    if (// the check could be extended against IDelegate<?>
    c instanceof WebDataCompositeTextField) {
        Object delegate = ((WebDataCompositeTextField) c).getDelegate();
        if (delegate instanceof Component) {
            // make sure that this class is added accordingly in TemplateGenerator as a style selector containing relevant properties
            addClassToCellComponent((Component) delegate);
        }
    }
    if (c instanceof ISupportValueList) {
        ISupportValueList idVl = (ISupportValueList) elementToColumnIdentifierComponent.get(element);
        IValueList list;
        if (idVl != null && (list = idVl.getValueList()) != null) {
            ValueList valuelist = application.getFlattenedSolution().getValueList(list.getName());
            if (valuelist != null && valuelist.getValueListType() == IValueListConstants.CUSTOM_VALUES) {
                ((ISupportValueList) c).setValueList(list);
            }
        }
    }
    applyClientProperties(c, element);
}
Also used : ValueList(com.servoy.j2db.persistence.ValueList) DBValueList(com.servoy.j2db.dataprocessing.DBValueList) ISupportValueList(com.servoy.j2db.ui.ISupportValueList) IValueList(com.servoy.j2db.dataprocessing.IValueList) IComponent(com.servoy.j2db.ui.IComponent) ISupportValueList(com.servoy.j2db.ui.ISupportValueList) Point(java.awt.Point) Point(java.awt.Point) IScriptable(com.servoy.j2db.scripting.IScriptable) IDisplayRelatedData(com.servoy.j2db.dataprocessing.IDisplayRelatedData) IServoyAwareBean(com.servoy.j2db.dataui.IServoyAwareBean) Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) IDisplayData(com.servoy.j2db.dataprocessing.IDisplayData) IRuntimeComponent(com.servoy.j2db.ui.runtime.IRuntimeComponent) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider) IComponent(com.servoy.j2db.ui.IComponent) AbstractRuntimeBaseComponent(com.servoy.j2db.ui.scripting.AbstractRuntimeBaseComponent) BaseComponent(com.servoy.j2db.persistence.BaseComponent) GraphicalComponent(com.servoy.j2db.persistence.GraphicalComponent) IFieldComponent(com.servoy.j2db.ui.IFieldComponent) Component(org.apache.wicket.Component) IPortalComponent(com.servoy.j2db.ui.IPortalComponent) IRuntimeComponent(com.servoy.j2db.ui.runtime.IRuntimeComponent) IValueList(com.servoy.j2db.dataprocessing.IValueList)

Example 8 with Portal

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

the class SortableCellViewHeaders method isReorderableOrResizable.

private boolean isReorderableOrResizable() {
    if (// $NON-NLS-1$
    Utils.getAsBoolean(application.getRuntimeProperties().get("useAJAX"))) {
        boolean isReorderable = false;
        boolean isResizable = false;
        Iterator<IPersist> iter = cellview.getAllObjects();
        while (iter.hasNext()) {
            IPersist element = iter.next();
            if (element instanceof ISupportAnchors) {
                int anchors = ((ISupportAnchors) element).getAnchors();
                isResizable = ((anchors & IAnchorConstants.EAST) == IAnchorConstants.EAST) && ((anchors & IAnchorConstants.WEST) == IAnchorConstants.WEST);
                isResizable = isResizable && (!(cellview instanceof Portal) || ((Portal) cellview).getResizable());
                if (isResizable)
                    return true;
                isReorderable = !(((anchors & IAnchorConstants.NORTH) == IAnchorConstants.NORTH) && ((anchors & IAnchorConstants.SOUTH) == IAnchorConstants.SOUTH));
                isReorderable = isReorderable && (!(cellview instanceof Portal) || ((Portal) cellview).getReorderable());
                if (isReorderable)
                    return true;
            }
        }
    }
    return false;
}
Also used : ISupportAnchors(com.servoy.j2db.persistence.ISupportAnchors) IPersist(com.servoy.j2db.persistence.IPersist) Portal(com.servoy.j2db.persistence.Portal)

Example 9 with Portal

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

the class FlattenedSolution method getDataproviderLookup.

public IDataProviderLookup getDataproviderLookup(IFoundSetManagerInternal foundSetManager, final IPersist p) {
    IDataProviderLookup retval = null;
    synchronized (this) {
        if (dataProviderLookups == null)
            dataProviderLookups = new HashMap<IPersist, IDataProviderLookup>();
        retval = dataProviderLookups.get(p);
        if (retval != null)
            return retval;
    }
    if (p instanceof Form) {
        ITable t = null;
        try {
            if (foundSetManager == null) {
                t = getTable(((Form) p).getDataSource());
            } else {
                t = foundSetManager.getTable(((Form) p).getDataSource());
            }
        } catch (RepositoryException e) {
            Debug.error(e);
        }
        retval = new FormAndTableDataProviderLookup(this, (Form) p, t);
    } else if (p instanceof Portal) {
        ITable t = null;
        Relation[] relations = getRelationSequence(((Portal) p).getRelationName());
        if (relations == null) {
            return null;
        }
        t = getTable(relations[relations.length - 1].getForeignDataSource());
        retval = new FormAndTableDataProviderLookup(this, (Form) p.getParent(), t);
    } else // solution
    {
        retval = new IDataProviderLookup() {

            public IDataProvider getDataProvider(String id) throws RepositoryException {
                return getGlobalDataProvider(id);
            }

            public Table getTable() throws RepositoryException {
                return null;
            }
        };
    }
    synchronized (this) {
        dataProviderLookups.put(p, retval);
    }
    return retval;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Form(com.servoy.j2db.persistence.Form) FlattenedForm(com.servoy.j2db.persistence.FlattenedForm) Portal(com.servoy.j2db.persistence.Portal) ITable(com.servoy.j2db.persistence.ITable) RepositoryException(com.servoy.j2db.persistence.RepositoryException) IDataProviderLookup(com.servoy.j2db.persistence.IDataProviderLookup)

Example 10 with Portal

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

the class ComponentFactory method createComponentEx.

protected static IComponent createComponentEx(IApplication application, Form form, IPersist meta, IDataProviderLookup dataProviderLookup, IScriptExecuter el, boolean printing) {
    IComponent comp = null;
    switch(meta.getTypeID()) {
        case IRepository.FIELDS:
            comp = createField(application, form, (Field) meta, dataProviderLookup, el, printing);
            break;
        case IRepository.GRAPHICALCOMPONENTS:
            comp = createGraphicalComponent(application, form, (GraphicalComponent) meta, el, dataProviderLookup);
            break;
        case IRepository.RECTSHAPES:
            comp = createRectangle(application, form, (RectShape) meta);
            break;
        case IRepository.PORTALS:
            comp = createPortal(application, form, (Portal) meta, dataProviderLookup, el, printing);
            break;
        case IRepository.PARTS:
            comp = createPart(application, (Part) meta);
            break;
        case IRepository.TABPANELS:
            TabPanel tabPanelMeta = (TabPanel) meta;
            int orient = tabPanelMeta.getTabOrientation();
            if (orient == TabPanel.SPLIT_HORIZONTAL || orient == TabPanel.SPLIT_VERTICAL)
                comp = createSplitPane(application, form, tabPanelMeta, el);
            else
                comp = createTabPanel(application, form, tabPanelMeta, el);
            break;
        case IRepository.BEANS:
            comp = createBean(application, form, (Bean) meta, null);
            break;
        case IRepository.WEBCOMPONENTS:
            comp = createWebComponentPlaceholder(application, form, (WebComponent) meta);
            break;
        default:
            Debug.error("ComponentFactory:unkown type " + meta.getTypeID() + ", uuid: " + meta.getUUID() + ", parent:" + meta.getParent());
            IStandardLabel label = application.getItemFactory().createLabel(getWebID(form, meta), "ComponentFactory:unkown type " + meta.getTypeID());
            label.setSize(new Dimension(200, 20));
            comp = label;
    }
    if (comp instanceof JComponent) {
        ((JComponent) comp).putClientProperty("Id", ComponentFactory.getWebID(form, meta));
    }
    return comp;
}
Also used : ITabPanel(com.servoy.j2db.ui.ITabPanel) TabPanel(com.servoy.j2db.persistence.TabPanel) RuntimeTabPanel(com.servoy.j2db.ui.scripting.RuntimeTabPanel) RectShape(com.servoy.j2db.persistence.RectShape) IComponent(com.servoy.j2db.ui.IComponent) GraphicalComponent(com.servoy.j2db.persistence.GraphicalComponent) JComponent(javax.swing.JComponent) Dimension(java.awt.Dimension) IStandardLabel(com.servoy.j2db.ui.IStandardLabel) IServoyAwareBean(com.servoy.j2db.dataui.IServoyAwareBean) Bean(com.servoy.j2db.persistence.Bean) RuntimeMediaField(com.servoy.j2db.ui.scripting.RuntimeMediaField) RuntimeDataLookupField(com.servoy.j2db.ui.scripting.RuntimeDataLookupField) Field(com.servoy.j2db.persistence.Field) RuntimeDataField(com.servoy.j2db.ui.scripting.RuntimeDataField) AbstractRuntimeField(com.servoy.j2db.ui.scripting.AbstractRuntimeField) WebComponent(com.servoy.j2db.persistence.WebComponent) Part(com.servoy.j2db.persistence.Part) Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal)

Aggregations

Portal (com.servoy.j2db.persistence.Portal)25 Point (java.awt.Point)13 RuntimePortal (com.servoy.j2db.ui.scripting.RuntimePortal)10 Form (com.servoy.j2db.persistence.Form)6 IPersist (com.servoy.j2db.persistence.IPersist)6 GraphicalComponent (com.servoy.j2db.persistence.GraphicalComponent)5 Field (com.servoy.j2db.persistence.Field)4 IFormElement (com.servoy.j2db.persistence.IFormElement)4 IForm (com.servoy.j2db.IForm)3 IServoyAwareBean (com.servoy.j2db.dataui.IServoyAwareBean)3 AbstractBase (com.servoy.j2db.persistence.AbstractBase)3 BaseComponent (com.servoy.j2db.persistence.BaseComponent)3 Bean (com.servoy.j2db.persistence.Bean)3 Part (com.servoy.j2db.persistence.Part)3 RepositoryException (com.servoy.j2db.persistence.RepositoryException)3 WebForm (com.servoy.j2db.server.headlessclient.WebForm)3 IComponent (com.servoy.j2db.ui.IComponent)3 ISupportAnchors (com.servoy.j2db.persistence.ISupportAnchors)2 ISupportName (com.servoy.j2db.persistence.ISupportName)2 TabPanel (com.servoy.j2db.persistence.TabPanel)2