Package com.volantis.mcs.model.descriptor

Examples of com.volantis.mcs.model.descriptor.PropertyDescriptor


        addDescriptor(propertyDescriptor);
    }

    private PropertyIdentifier addDescriptor(PropertyDescriptor descriptor) {
        PropertyIdentifier identifier = descriptor.getIdentifier();
        PropertyDescriptor old = (PropertyDescriptor)
                propertyId2Descriptor.get(identifier);
        if (old != null) {
            throw new IllegalStateException(
                    "Duplicate property " + identifier);
        }
View Full Code Here


    public void complete(List propertyDescriptors) {
        this.propertyList = propertyDescriptors;
        this.propertyId2Descriptor = new HashMap();
        this.propertyName2Id = new HashMap();
        for (int i = 0; i < propertyList.size(); i++) {
            PropertyDescriptor descriptor = (PropertyDescriptor)
                    propertyList.get(i);
            PropertyIdentifier identifier = descriptor.getIdentifier();
            propertyId2Descriptor.put(identifier, descriptor);
            propertyName2Id.put(identifier.getName(), identifier);

        }
        this.complete = true;
View Full Code Here

                    while (it.hasNext()) {
                        StyleProperty details = (StyleProperty) it.next();
                        PropertyIdentifier identifier = ThemeModel.
                                getPropertyIdentifierForStyleProperty(details);
                        PropertyDescriptor descriptor =
                                typeDescriptor.getPropertyDescriptor(identifier);
                        propertyDescriptors.add(descriptor);
                    }

                    PropertyDescriptor[] descriptors = new PropertyDescriptor[propertyDescriptors.size()];
View Full Code Here

            List stylePropertyProxies = new ArrayList();
            BeanClassDescriptor descriptor = styleProperties.getBeanClassDescriptor();
            List propertyDescriptors = descriptor.getPropertyDescriptors();
            Iterator it = propertyDescriptors.iterator();
            while (it.hasNext()) {
                PropertyDescriptor propertyDescriptor = (PropertyDescriptor) it.next();
                Proxy property = styleProperties.getPropertyProxy(propertyDescriptor.getIdentifier());
                if (property.getModelObject() != null) {
                    stylePropertyProxies.add(property);
                }
            }
            return stylePropertyProxies.toArray();
View Full Code Here

        this.beanClassDescriptor = descriptor;
        property2Proxies = new HashMap();
    }

    public Proxy getPropertyProxy(PropertyIdentifier property) {
        PropertyDescriptor descriptor = getRequiredDescriptor(property);
        Proxy proxy = (Proxy) property2Proxies.get(descriptor);
        if (proxy == null) {
            proxy = createPropertyProxy(descriptor);
            property2Proxies.put(descriptor, proxy);
            ((InternalProxy) proxy).attach(this);
View Full Code Here

        return proxy;
    }

    public Object setPropertyProxy(
            PropertyIdentifier property, Proxy newProxy) {
        PropertyDescriptor descriptor = getRequiredDescriptor(property);
        InternalProxy oldProxy = (InternalProxy) property2Proxies.get(
                descriptor);

        // Do nothing if the proxies are the same.
        if (oldProxy != newProxy) {
View Full Code Here

        return beanClassDescriptor;
    }

    private PropertyDescriptor getRequiredDescriptor(
            PropertyIdentifier property) {
        PropertyDescriptor descriptor =
                beanClassDescriptor.getPropertyDescriptor(property);
        if (descriptor == null) {
            throw new IllegalArgumentException("Unknown property " + property);
        }
        return descriptor;
View Full Code Here

    }

    public Object getEmbeddedModelObject(Proxy proxy, boolean required) {

        // Get the property's model object.
        PropertyDescriptor descriptor = findPropertyDescriptor(proxy);
        Object propertyModelObject = getEmbeddedModelObject(descriptor,
                required);

        if (required && propertyModelObject == null) {
            // The model object for the property does not exist and the caller
            // requires it because it needs to modify it. Therefore, a new
            // model object needs to be created and associated with this
            // property.
            //
            // As the caller needs to modify the object it cannot be either
            // a primitive, unchangeable or abstract type.
            ModifiableClassDescriptor modifiable = (ModifiableClassDescriptor)
                    descriptor.getPropertyType();
            propertyModelObject = modifiable.createModelObject();
            setEmbeddedModelObject(proxy, propertyModelObject);
        }

        return propertyModelObject;
View Full Code Here

    }

    public Object setEmbeddedModelObject(
            Proxy proxy, Object newEmbeddedModelObject) {

        PropertyDescriptor descriptor = findPropertyDescriptor(proxy);
        PropertyAccessor accessor = descriptor.getPropertyAccessor();
        if (accessor == null) {
            throw new IllegalStateException("Cannot access property directly");
        }

        Object modelObject = getModelObject(true);
View Full Code Here

        // Populate the model object with copies of the model objects held
        // by each of the proxies.
        List list = beanClassDescriptor.getPropertyDescriptors();
        for (int i = 0; i < list.size(); i++) {
            PropertyDescriptor descriptor = (PropertyDescriptor) list.get(i);
            PropertyIdentifier identifier = descriptor.getIdentifier();
            PropertyAccessor accessor = descriptor.getPropertyAccessor();

            Proxy childProxy = getPropertyProxy(identifier);
            Object childObject = childProxy.copyModelObject();
            accessor.set(copy, childObject);
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.model.descriptor.PropertyDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.