Package com.volantis.mcs.interaction

Examples of com.volantis.mcs.interaction.ListProxy


     *
     * @param type   The fallback policy type
     * @param policy The new value
     */
    private void setFallbackPolicy(PolicyType type, String policy) {
        ListProxy alternatePolicies =
                (ListProxy) ((BeanProxy) context.getInteractionModel()).
                        getPropertyProxy(PolicyModel.ALTERNATE_POLICIES);
        int size = alternatePolicies.size();
        for (int i = size - 1; i >= 0; i--) {
            PolicyReference reference = (PolicyReference)
                    alternatePolicies.getItemProxy(i).getModelObject();
            if (reference.getExpectedPolicyType().equals(type)) {
                Operation removeOp = alternatePolicies
                        .prepareRemoveProxyItemOperation(
                                alternatePolicies.getItemProxy(i));
                context.executeOperation(removeOp);
            }
        }

        // Do not add an empty policy value as this is illlegal
        if (policy != null && policy.trim().length() > 0) {
            PolicyReference newReference = PolicyFactory.getDefaultInstance().
                    createPolicyReference(policy, type);
            Operation addOp =
                    alternatePolicies
                            .prepareAddModelItemOperation(newReference);
            context.executeOperation(addOp);
        }
    }
View Full Code Here


        if (previouslySelectedBuilder == null) {
            context.setSelectedVariant(null);
        } else {
            BeanProxy modelProxy = (BeanProxy) context.getInteractionModel();
            ListProxy variants = (ListProxy)
                    modelProxy.getPropertyProxy(PolicyModel.VARIANTS);
            boolean setSelection = false;
            for (int i = 0; !setSelection && i < variants.size(); i++) {
                VariantBuilder builder = (VariantBuilder)
                        variants.getItemProxy(i).getModelObject();
                if (previouslySelectedBuilder.equals(builder)) {
                    context.setSelectedVariant((BeanProxy) variants.getItemProxy(i));
                    setSelection = true;
                }
            }

            if (!setSelection) {
View Full Code Here

        viewer.setLabelProvider(dlp);
        BeanProxy policy = (BeanProxy) context.getInteractionModel();

        if (policy != null) {
            ListProxy deviceThemes = (ListProxy)
                    policy.getPropertyProxy(PolicyModel.VARIANTS);
            viewer.setInput(deviceThemes);
        }

        createActions();
View Full Code Here

        if (previouslySelectedBuilder == null) {
            context.setSelectedVariant(null);
        } else {
            BeanProxy modelProxy = (BeanProxy) context.getInteractionModel();
            ListProxy variants = (ListProxy)
                    modelProxy.getPropertyProxy(PolicyModel.VARIANTS);
            boolean setSelection = false;
            for (int i = 0; !setSelection && i < variants.size(); i++) {
                VariantBuilder builder = (VariantBuilder)
                        variants.getItemProxy(i).getModelObject();
                if (previouslySelectedBuilder.equals(builder)) {
                    context.setSelectedVariant((BeanProxy) variants.getItemProxy(i));
                    setSelection = true;
                }
            }

            if (!setSelection) {
View Full Code Here

         * @return The text to display in the specified column
         */
        private String getColumnTextRule(BeanProxy rule, int i) {
            String stringValue = "";
            if (i == COLUMN_PROPERTY) {
                ListProxy proxy = (ListProxy) rule.getPropertyProxy(Rule.SELECTORS);
                List list = (List) proxy.getModelObject();
                stringValue = selectorToString(list);
            }
            return stringValue;
        }
View Full Code Here

         */
        private synchronized void populateParentMap(BeanProxy variant) {
            parents = new HashMap();
           
           
             ListProxy rules = getRulesFromVariant(variant);
             if (rules != null) {
                 for (int i = 0; i < rules.size(); i++) {
                     BeanProxy rule = (BeanProxy) rules.getItemProxy(i);
                     Object[] styleProperties = getStylePropertyProxies(
                             (BeanProxy) rule.getPropertyProxy(
                                     Rule.STYLE_PROPERTIES));
                     for (int j = 0; j < styleProperties.length; j++) {
                         parents.put(styleProperties[j], rule);
View Full Code Here

         * @param variant The variant for which to retrieve the rules
         * @return A list proxy representing the rules, or null if none can be
         *         found.
         */
        private ListProxy getRulesFromVariant(BeanProxy variant) {
            ListProxy rules = null;

            BaseProxy content = (BaseProxy)
                    variant.getPropertyProxy(PolicyModel.CONTENT);
            BeanProxy themeContent = (BeanProxy) content.getConcreteProxy();
            if (themeContent != null) {
View Full Code Here

            return proxy.getModelObject() instanceof Rule;
        }

        // Javadoc inherited
        public Object[] getElements(Object o) {
            ListProxy rules = getRulesFromVariant((BeanProxy) o);
            Object[] elements = null;
            if (rules == null) {
                elements = new Object[0];
            } else {
                elements = new Object[rules.size()];
                for (int i = 0; i < rules.size(); i++) {
                    elements[i] = rules.getItemProxy(i);
                }
            }
            return elements;
        }
View Full Code Here

                categoryTargets.add(next);
            }
        }

        BeanProxy targetedSelection = (BeanProxy) getSelectionProxy();
        ListProxy categories = (ListProxy) targetedSelection.getPropertyProxy(PolicyModel.CATEGORY_REFERENCES);
        Operation setCategories = categories.prepareSetModelObjectOperation(categoryTargets);
        ListProxy devices = (ListProxy) targetedSelection.getPropertyProxy(PolicyModel.DEVICE_REFERENCES);
        Operation setDevices = devices.prepareSetModelObjectOperation(deviceTargets);

        // TODO later Should be merged into a compound operation for future undo implementation
        context.executeOperation(setCategories);
        context.executeOperation(setDevices);
    }
View Full Code Here

        BeanProxy beanItemProxy = (BeanProxy) proxy;
        component = new BeanComponent(gui, beanItemProxy);
    }

    public void visit(ListClassDescriptor descriptor) {
        ListProxy listItemProxy = (ListProxy) proxy;
        component = new ListComponent(gui, listItemProxy);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.interaction.ListProxy

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.