Package com.volantis.mcs.interaction

Examples of com.volantis.mcs.interaction.Proxy


                        Iterator it = category.getProperties().iterator();
                        while (it.hasNext()) {
                            StyleProperty details = (StyleProperty) it.next();
                            PropertyIdentifier identifier = ThemeModel.
                                getPropertyIdentifierForStyleProperty(details);
                            Proxy propertyProxy =
                                    stylePropertiesProxy.getPropertyProxy(identifier);
                            PropertyValue value =
                                ThemeFactory.getDefaultInstance().
                                    createPropertyValue(
                                        details, THEME_FACTORY.getInherit());
                            propertyProxy.setModelObject(value);
                        }
                    }
                    stylePropertiesProxyReceiver.setProxy(stylePropertiesProxy);
                }
            }
        };

        priorityAction = new ResourceAction(
                    ThemesMessages.getResourceBundle(),
                    RESOURCE_PREFIX + "allToImportant.") {
            // Javadoc inherited
            public void run() {
                ISelection selection = categoryTreeViewer.getSelection();
                if (selection instanceof IStructuredSelection) {
                    BeanProxy stylePropertiesProxy =
                            (BeanProxy) stylePropertiesProxyProvider.getProxy();
                    IStructuredSelection structuredSelection =
                            (IStructuredSelection) selection;
                    Iterator categories = structuredSelection.iterator();
                    while (categories.hasNext()) {
                        StyleCategory category = (StyleCategory) categories.next();
                        Iterator it = category.getProperties().iterator();
                        while (it.hasNext()) {
                            StyleProperty details = (StyleProperty) it.next();
                            PropertyIdentifier identifier = ThemeModel.
                                getPropertyIdentifierForStyleProperty(details);
                            Proxy propertyProxy =
                                    stylePropertiesProxy.getPropertyProxy(identifier);
                            PropertyValue value = (PropertyValue) propertyProxy.getModelObject();
                            if (value != null) {
                                value = ThemeFactory.getDefaultInstance().
                                    createPropertyValue(value.getProperty(),
                                        value.getValue(), Priority.IMPORTANT);
                                propertyProxy.setModelObject(value);
                            }
                        }
                    }
                    stylePropertiesProxyReceiver.setProxy(stylePropertiesProxy);
                }
View Full Code Here


     * selected variant. Toggles variant type between NULL and the default
     * type specified in the context object.
     */
    private void updateVariantType() {
        BeanProxy selectedVariant = context.getSelectedVariant();
        Proxy variantType = selectedVariant.getPropertyProxy(PolicyModel.VARIANT_TYPE);
        if (nullCheckbox.getSelection()) {
            variantType.setModelObject(VariantType.NULL);
        } else {
            VariantType defaultType = context.getDefaultVariantType();
            variantType.setModelObject(defaultType);
        }
    }
View Full Code Here

    /**
     * Update the theme model from the GUI.
     */
    private void updateThemeModel() {
        BaseProxy baseContentProxy = (BaseProxy) context.getSelectedVariant().getPropertyProxy(PolicyModel.CONTENT);
        Proxy contentProxy = baseContentProxy.getConcreteProxy();
        if (contentProxy != null) {
            BeanProxy contentBeanProxy = (BeanProxy) contentProxy;
            Proxy importParent = contentBeanProxy.getPropertyProxy(ThemeModel.IMPORT_PARENT_DEVICE_THEME);
            importParent.setModelObject(Boolean.valueOf(importParentCheckbox.getSelection()));
        } else {
            // add a content builder to avoid "variant no content
            final ThemeContentBuilder contentBuilder =
                InternalPolicyFactory.getInternalInstance().
                    createThemeContentBuilder();
View Full Code Here

     * @param content The new content for the current variant
     */
    private void setModelContent(ContentBuilder content) {
        BeanProxy selectedVariant = context.getSelectedVariant();
        if (selectedVariant != null) {
            Proxy contentProxy = selectedVariant.getPropertyProxy(PolicyModel.CONTENT);
            Operation setContent = contentProxy.prepareSetModelObjectOperation(content);
            context.executeOperation(setContent);
        }
    }
View Full Code Here

     */
    private ContentBuilder getModelContent() {
        ContentBuilder contentBuilder = null;
        BeanProxy selectedVariant = context.getSelectedVariant();
        if (selectedVariant != null) {
            Proxy contentProxy = selectedVariant.getPropertyProxy(PolicyModel.CONTENT);
            Object model = contentProxy.getModelObject();
            if (model instanceof ContentBuilder) {
                contentBuilder = (ContentBuilder) model;
            }
        }
        return contentBuilder;
View Full Code Here

    public void setPolicyBuilder(PolicyBuilder newBuilder) {
        // Get the previously selected variant builder so that we can attempt
        // to reselect it after the change.
        PolicyEditorContext context = (PolicyEditorContext) getContext();
        Proxy previousSelectedProxy = context.getSelectedVariant();
        VariantBuilder previouslySelectedBuilder =
                previousSelectedProxy == null ?
                null : (VariantBuilder) previousSelectedProxy.getModelObject();

        Proxy policyProxy = getContext().getInteractionModel();
        policyProxy.setReadWriteState(ReadWriteState.READ_WRITE);
        // Because the merge process may have modified the existing model
        // directly before calling this method, we must force the proxy's
        // structure to be updated to ensure new variants are added and
        // appropriate change events are fired.
        policyProxy.setModelObject(newBuilder, true);
        try {
            context.getPolicyFileAccessor().updatePolicyProxyState(
                    policyProxy, context.getProject());
        } catch (PolicyFileAccessException pfae) {
            EclipseCommonPlugin.logError(ABPlugin.getDefault(),
View Full Code Here

            PolicyFileAccessor policyFileAccessor = getPolicyFileAccessor();

            // Load the policy and grow the proxy
            PolicyBuilder policy = policyFileAccessor.loadPolicy(file);
            policy = preProcessPolicy(policy);
            final Proxy proxy = policyFileAccessor.wrapPolicy(policy,
                    getModelDescriptor(), getProject());

            // Revalidate the model on all changes
            proxy.validate();
            proxy.addListener(
                new InteractionEventListenerAdapter() {
                    protected void interactionEvent(InteractionEvent event) {
                        if (event.isOriginator ()) {
                            proxy.validate();
                        }
                    }

                    // The read-only state changing does not require any
                    // re-validation.
                    public void readOnlyStateChanged(ReadOnlyStateChangedEvent event) {
                    }
                }, true
            );

            proxy.addDiagnosticListener(new DiagnosticListener() {
                public void diagnosticsChanged(DiagnosticEvent event) {
                    reportErrors();
                }
            });
View Full Code Here

        });
    }

    private void registerChangeListeners(Proxy oldSelection, Proxy selection) {
        if (oldSelection != null && oldSelection instanceof BeanProxy) {
            Proxy type = ((BeanProxy)
                    oldSelection).getPropertyProxy(PolicyModel.CONTENT);
            type.removeListener(changeListener);
        }

        if (selection != null && selection instanceof BeanProxy) {
            Proxy type = ((BeanProxy)
                    selection).getPropertyProxy(PolicyModel.CONTENT);
            type.addListener(changeListener, false);
        }
    }
View Full Code Here

        if (selectedVariant == null) {
            displayAreaLayout.topControl = messagePage;
        } else {
            // Disable design for null types
            Proxy type = ((BeanProxy) selectedVariant).
                    getPropertyProxy(PolicyModel.VARIANT_TYPE);
            boolean nullType = VariantType.NULL == type.getModelObject();

            if (nullType) {
                displayAreaLayout.topControl = nullVariantPage;
            } else {
                // TODO better This is silly - try again...
View Full Code Here

                    new PropertiesCompositeChangeListener() {
                        public void propertyChanged(
                                PropertiesComposite composite,
                                PropertyDescriptor property,
                                Object newValue) {
                            Proxy propertyProxy = ((BeanProxy) context.
                                    getInteractionModel()).getPropertyProxy(
                                    property.getIdentifier());
                            Operation setOp = propertyProxy.
                                    prepareSetModelObjectOperation(newValue);
                            context.executeOperation(setOp);
                        }
                    });
        }
View Full Code Here

TOP

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

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.