Package com.volantis.mcs.interaction

Examples of com.volantis.mcs.interaction.Proxy


                PropertyIdentifier identifier = descriptor.getIdentifier();
                if (identifier == PolicyModel.CONVERSION_MODE) {
                    updateImagePreserveControlState((ImageConversionMode) newValue);
                }

                Proxy propertyProxy = metadataProxy.getPropertyProxy(descriptor.getIdentifier());
                Operation setValue = propertyProxy.prepareSetModelObjectOperation(newValue);
                context.executeOperation(setValue);
            }
        }
    }
View Full Code Here


        BeanProxy oldVariant =
                (BeanProxy) (event == null ? null : event.getOldSelection());
        BeanProxy newVariant = context.getSelectedVariant();

        Proxy oldType = null;
        if (oldVariant != null) {
            oldVariant.removeListener(readOnlyListener);

            oldType = oldVariant.getPropertyProxy(PolicyModel.VARIANT_TYPE);
            oldType.removeListener(typeListener);
        }

        if (newVariant == null) {
            composite.clear();
            setEnabled(false);
        } else {

            // Assume that all the controls are enabled.
            setEnabled(true);

            // The variant type has changed then make sure that the controls
            // are enabled properly.
            Proxy newType =
                newVariant.getPropertyProxy(PolicyModel.VARIANT_TYPE);
            boolean newTypeIsNull = newType.getModelObject() == VariantType.NULL;

            BeanProxy metadata = getMetadataProxy();

            if (metadata == null || newTypeIsNull) {
                composite.clear();
                setEnabled(false);
            } else {
                composite.updateFromProxy(metadata);

                // Update the state of the image preserve controls if
                // necessary.
                ImageConversionMode conversionMode = (ImageConversionMode)
                        composite.getProperty(PolicyModel.CONVERSION_MODE);
                if (conversionMode != null) {
                    updateImagePreserveControlState(conversionMode);
                }
            }

            // Note: Enable state should not be set to true after this point
            // as otherwise it blows away the work done in
            // updateImagePreserveControls.

            // If the variant is read only then disable all controls.
            if (newVariant.isReadOnly()) {
                setEnabled(false);
            }

            newVariant.addListener(readOnlyListener, false);
            newType.addListener(typeListener, false);
        }

        handlingPropertyChanges = true;
    }
View Full Code Here

            if (metadataBase != null) {
                metadataProxy = (BeanProxy) metadataBase.getConcreteProxy();
                // If we have no concrete metadata, create an empty one of the
                // appropriate type unless the data is read only or the variant
                // type precludes this.
                Proxy typeProxy = selectedVariant.getPropertyProxy(PolicyModel.VARIANT_TYPE);
                if (metadataProxy == null && !metadataBase.isReadOnly() &&
                        typeProxy.getModelObject() != VariantType.NULL) {
                    MetaDataBuilder metaDataBuilder = getDefaultMetaDataBuilder();
                    metadataBase.setModelObject(metaDataBuilder);

                    // Now that we've set a concrete model object, we should
                    // have a concrete proxy.
View Full Code Here

                InteractionFactory interactionFactory =
                        InteractionFactory.getDefaultInstance();
                InteractionModel interactionModel = interactionFactory
                        .createInteractionModel(PolicyModel.MODEL_DESCRIPTOR);

                Proxy proxy = interactionModel.createProxyForModelObject(theme);
                proxy.validate();
                new ResourceDiagnosticsAdapter(resource).
                        setDiagnostics(proxy.getDiagnostics());

            }
        } catch (CoreException e) {
            e.printStackTrace();
            EclipseCommonPlugin.handleError(ControlsPlugin.getDefault(), e);
View Full Code Here

     */
    private void selectionPropertyChanged(PropertyDescriptor descriptor,
                                          Object newValue) {
        if (handlingEvents) {
            PropertyIdentifier identifier = descriptor.getIdentifier();
            Proxy selectionProxy = getSelectionProxy();
            if (selectionProxy instanceof BeanProxy) {
                BeanProxy selectionBeanProxy = (BeanProxy) selectionProxy;
                if (selectionBeanProxy != null &&
                        selectionBeanProxy.getBeanClassDescriptor().
                        getPropertyDescriptor(identifier) != null) {
                    Proxy propertyProxy =
                            selectionBeanProxy.getPropertyProxy(identifier);
                    Operation setValue = propertyProxy.
                            prepareSetModelObjectOperation(newValue);
                    context.executeOperation(setValue);
                }
            }
        }
View Full Code Here

            }

            if (newVariant == null) {
                setEnabledClearIfDisabled(false);
            } else {
                Proxy selection = ((BaseProxy)
                        newVariant.getPropertyProxy(PolicyModel.SELECTION))
                        .getConcreteProxy();

                SelectionBuilder builder = null;
                if (selection == null) {
                    composite.clear();
                } else {
                    builder = (SelectionBuilder) selection.getModelObject();
                    if (builder instanceof GenericImageSelectionBuilder) {
                        composite.updateFromProxy((BeanProxy) selection);
                    }
                }
View Full Code Here

     * Gets the selection proxy for the currently selected variant.
     *
     * @return The selection proxy, or null if none exists
     */
    private Proxy getSelectionProxy() {
        Proxy selectionProxy = null;
        BeanProxy selectedVariant = context.getSelectedVariant();
        if (selectedVariant != null) {
            BaseProxy selectionBase = (BaseProxy) selectedVariant.getPropertyProxy(PolicyModel.SELECTION);
            if (selectionBase != null) {
                selectionProxy = selectionBase.getConcreteProxy();
View Full Code Here

                    if (event.isOriginator ()) {
                        context.setDirty(true);
                    }
                }
            };
            Proxy proxy = context.getInteractionModel();
            proxy.addListener(listener, true);
        } catch (PolicyFileAccessException pfae) {
            String errorMessage = file.exists() ? LOAD_ERROR_MESSAGE :
                    MISSING_FILE_MESSAGE;
            throw new PartInitException(errorMessage);
        } catch (NullPointerException npe) {
View Full Code Here

        }

        Class modelClass = modelObject.getClass();
        TypeDescriptor descriptor =
                modelDescriptor.getTypeDescriptorStrict(modelClass);
        Proxy proxy = createProxyForType(descriptor);
        proxy.setModelObject(modelObject);
        return proxy;
    }
View Full Code Here

        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

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.