Package com.volantis.mcs.build.themes.definitions

Examples of com.volantis.mcs.build.themes.definitions.ComputedReference


            } else {
                reference.setPropertyName(propertyName);
            }
        } else if (name.equals("computedRef")) {
            // This only works inside initialValue.
            ComputedReference reference = (ComputedReference)
                findObject(ComputedReference.class);
            if (reference == null) {
                System.out.println("Ignoring reference to computedRef");
            } else {

                Named propertyName = definitionsFactory.createProperty();
                pushObject(propertyName);
                Rules rules = definitionsFactory.createRules();
                pushObject(rules);
                processThemePropertyChildren(element);
                popObject();
                popObject();

                reference.setPropertyName(propertyName.getName());
                reference.setRules(rules.getRuleSet());
            }

        } else if (name.equals("rule")) {

            Rules ruleSet = (Rules) findObject(Rules.class);
View Full Code Here


        // Create a container for a property reference.
        PropertyReference reference = new PropertyReference();
        pushObject(reference);

        // Create a container for a computed reference.
        ComputedReference computedRef = new ComputedReference();
        pushObject(computedRef);

        // Process the children.
        processThemePropertyChildren(element);

        popObject();
        popObject();
        popObject();

        String computedPropertyRef = computedRef.getPropertyName();
        String propertyReference = reference.getPropertyName();
        Value initialValue = container.getValue();

        if ((propertyReference != null   && initialValue != null) ||
            (propertyReference != null   && computedPropertyRef != null) ||
            (computedPropertyRef != null && initialValue != null)) {
            throw new IllegalStateException(
                    "Only a property reference, computed reference" +
                        " or an initial value are allowed, not both");
        }

        Property property = (Property) findObject(Property.class);
        ValueSource source;
        if (initialValue != null) {
            source = new FixedValueSource(container.getValue());
            property.setInitialValue(container.getValue());
        } else if (propertyReference != null) {
            source = new PropertyValueSource(propertyReference);
        } else if (computedPropertyRef != null) {
            source = new ComputedValueSource(
                computedPropertyRef, computedRef.getRules());
        } else {
            source = new NullValueSource();
        }
        property.setInitialValueSource(source);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.build.themes.definitions.ComputedReference

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.