Package com.volantis.mcs.interaction

Examples of com.volantis.mcs.interaction.Proxy


                SelectionPolicyType policyType =
                        (SelectionPolicyType) descriptor.getPolicyType();
                context.setCategoryValues(policyType.getKeywords());

                BeanProxy model = (BeanProxy) context.getInteractionModel();
                Proxy categorisationScheme = model.getPropertyProxy(
                        PolicyModel.CATEGORISATION_SCHEME);

                if (!ObjectHelper.equals(policyName,
                        categorisationScheme.getModelObject())) {
                    Operation setSchemeOp = categorisationScheme
                            .prepareSetModelObjectOperation(policyName);
                    context.executeOperation(setSchemeOp);
                }
            }
        });

        BeanProxy model = (BeanProxy) context.getInteractionModel();
        final Proxy categorisationScheme =
                model.getPropertyProxy(PolicyModel.CATEGORISATION_SCHEME);
        String selectedPolicy = (String) categorisationScheme.getModelObject();
        if (selectedPolicy != null) {
            combo.setSelection(new StructuredSelection(selectedPolicy));
            PolicyDescriptor descriptor = (PolicyDescriptor)
                    namesToDescriptors.get(selectedPolicy);
            SelectionPolicyType policyType =
                    (SelectionPolicyType) descriptor.getPolicyType();
            context.setCategoryValues(policyType.getKeywords());
        }

        categorisationScheme.addListener(new InteractionEventListenerAdapter() {
            protected void interactionEvent(InteractionEvent event) {
                String selectedPolicy =
                        (String) categorisationScheme.getModelObject();
                if (selectedPolicy != null) {
                    combo.setSelection(new StructuredSelection(selectedPolicy));
                    PolicyDescriptor descriptor = (PolicyDescriptor)
                            namesToDescriptors.get(selectedPolicy);
                    SelectionPolicyType policyType =
View Full Code Here


                    (ListProxy) ((BeanProxy) context.getInteractionModel()).
                            getPropertyProxy(PolicyModel.ALTERNATE_POLICIES);
            int size = alternatePolicies.size();

            for (int i = 0; i < size; i++) {
                Proxy itemProxy = alternatePolicies.getItemProxy(i);
                Object modelObject = itemProxy.getModelObject();
                PolicyReference ref = (PolicyReference) modelObject;
                Text text = (Text) typesToTextComponents
                        .get(ref.getExpectedPolicyType());
                text.setText(ref.getName());
            }
View Full Code Here

    }

    protected String getToolTipText(Item item) {
        String toolTip = null;

        Proxy proxy = mapper.dataFromItem(item);

        if (proxy != null) {
            List diagnostics = proxy.getDiagnostics();
            if (diagnostics != null && !diagnostics.isEmpty()) {
                ProxyDiagnostic diag = (ProxyDiagnostic) diagnostics.get(0);
                toolTip = diag.getMessage().toString();
            }
        }
View Full Code Here

     * @param odomRoot The ODOM root element representing the content
     */
    private void odomNodeChanged(BeanProxy variantProxy, ODOMElement odomRoot) {
        if (!variantProxy.isReadOnly()) {
            try {
                Proxy contentProxy =
                        variantProxy.getPropertyProxy(PolicyModel.CONTENT);
                ContentBuilder content =
                        documentToBuilder(odomRoot.getDocument(), contentProxy);
                contentProxy.setModelObject(content);
                fireLayoutChanged(
                        ((InternalLayoutContentBuilder) content).getLayout());
            } catch (IOException re) {
                // EclipseCommonPlugin.handleError(ABPlugin.getDefault(), re);
            }
View Full Code Here

                    final Set entries = variantBuilderProxyToRootElement.entrySet();
                    for (Iterator iter = entries.iterator(); iter.hasNext(); ) {
                        final Map.Entry entry = (Map.Entry) iter.next();
                        final BeanProxy variantBuilderProxy =
                            (BeanProxy) entry.getKey();
                        final Proxy contentBuilderProxy =
                            variantBuilderProxy.getPropertyProxy(PolicyModel.CONTENT);
                        if (VariantType.NULL == variantBuilderProxy.getPropertyProxy(
                                PolicyModel.VARIANT_TYPE).getModelObject()) {
                            contentBuilderProxy.setModelObject(null);
                        } else if (!contentBuilderProxy.isReadOnly()) {
                            final ODOMElement element = (ODOMElement) entry.getValue();
                            final ContentBuilder contentBuilder = documentToBuilder(
                                    element.getDocument(), contentBuilderProxy);
                            contentBuilderProxy.setModelObject(contentBuilder);
                        }
                    }
                } catch (IOException e) {
                    throw new PolicyFileAccessException(e);
                }
View Full Code Here

    // Javadoc inherited
    public void init(IEditorSite iEditorSite, IEditorInput iEditorInput)
            throws PartInitException {
        super.init(iEditorSite, iEditorInput);

        final Proxy proxy = getContext().getInteractionModel();

        if (proxy != null) {
            proxy.addDiagnosticListener(
                new DiagnosticListener() {
                    public void diagnosticsChanged(DiagnosticEvent event) {
                        alertsActionsSection.updateErrorStatus();
                    }
                }
View Full Code Here

    public Object[] getElements(Object proxy) {
        if (proxy instanceof ListProxy) {
            ListProxy listProxy = (ListProxy) proxy;
            Object[] values = new Object[listProxy.size()];
            for (int i = 0; i < values.length; i++) {
                Proxy itemProxy = listProxy.getItemProxy(i);
                values[i] =
                        returnModel ? itemProxy.getModelObject() : itemProxy;
                // Null values are not permitted, so we use a special value to
                // indicate null.
                if (values[i] == null) {
                    values[i] = NULL_VALUE;
                }
View Full Code Here

            };

    public void setVariant(BeanProxy deviceTheme) {
        boolean nullType = false;
        if (deviceTheme != null) {
            Proxy type = deviceTheme.getPropertyProxy(PolicyModel.VARIANT_TYPE);
            nullType = VariantType.NULL == type.getModelObject();
        }

        Object oldInput = ruleTable.getInput();
        if (oldInput != null && oldInput instanceof Proxy) {
            Proxy oldRules = (Proxy) oldInput;
            oldRules.removeListener(tableRefresher);
            oldRules.removeDiagnosticListener(tableRefresher);
        }
        ruleTable.setInput(null);

        if (!nullType && deviceTheme != null) {
            BaseProxy content = (BaseProxy) deviceTheme.getPropertyProxy(PolicyModel.CONTENT);
            BeanProxy concreteContent = (BeanProxy) content.getConcreteProxy();
            if (concreteContent == null && !content.isReadOnly()) {
                ThemeContentBuilder contentModel =
                        InternalPolicyFactory.getInternalInstance().createThemeContentBuilder();
                content.setModelObject(contentModel);
                concreteContent = (BeanProxy) content.getConcreteProxy();
            }

            if (concreteContent != null) {
                BeanProxy styleSheet = (BeanProxy) concreteContent.
                        getPropertyProxy(ThemeModel.STYLE_SHEET);
                Proxy rules = styleSheet.getPropertyProxy(ThemeModel.RULES);
                ruleTable.setInput(rules);
                rules.addListener(tableRefresher, true);
                rules.addDiagnosticListener(tableRefresher);
            }
        }
    }
View Full Code Here

            public String getColumnText(Object o, int i) {
                BeanProxy ruleProxy = (BeanProxy) o;
                String returnValue = null;
                if (i == COLUMN_SELECTOR) {
                    // Selectors
                    Proxy selectorsProxy =
                            ruleProxy.getPropertyProxy(Rule.SELECTORS);
                    Object model = selectorsProxy.getModelObject();
                    returnValue = selectorListToText((List) model);
                } else if (i == COLUMN_ORDER) {
                    // Order
                    ListProxy rules = (ListProxy) getSelectedStyleSheetProxy().
                            getPropertyProxy(ThemeModel.RULES);
                    int index = rules.getItemProxyIndex(ruleProxy);
                    // Indices start at 0, but humans expect 1...
                    returnValue = String.valueOf(index + 1);
                }
                return returnValue;
            }

            public void addListener(ILabelProviderListener iLabelProviderListener) {
            }

            public void dispose() {
            }

            public boolean isLabelProperty(Object o, String s) {
                return true;
            }

            public void removeListener(ILabelProviderListener iLabelProviderListener) {
            }
        };
        ruleTable.setLabelProvider(labelProvider);

        CellEditor editors [] = new CellEditor[2];
        editors[0] = new TextCellEditor(table);

        ruleTable.setCellEditors(editors);
        ruleTable.setColumnProperties(new String[]{"selectors", "order"});
        ruleTable.setCellModifier(new ICellModifier() {
            public boolean canModify(Object o, String s) {
                return "selectors".equals(s);
            }

            public Object getValue(Object o, String s) {
                Object value = null;
                // Only selectors are modifiable, so ignore all other settings
                if ("selectors".equals(s)) {
                    List selectors = ruleProxyToSelectorList((BeanProxy) o);
                    value = selectorListToText(selectors);
                }
                return value;
            }

            public void modify(Object tableItem, String columnName, Object newValue) {
                if ("selectors".equals(columnName)) {
                    TableItem item = (TableItem) tableItem;
                    BeanProxy ruleProxy = (BeanProxy) item.getData();
                    String oldValue = labelProvider.getColumnText(ruleProxy, COLUMN_SELECTOR);
                    if (!oldValue.equals(newValue)) {
                        List parsed =
                                CSS_PARSER.parseSelectorGroup((String) newValue);
                        ListProxy selectorsProxy = (ListProxy) ruleProxy.getPropertyProxy(Rule.SELECTORS);
                        Operation setList = selectorsProxy.prepareSetModelObjectOperation(parsed);
                        context.executeOperation(setList);
                    }
                }
            }
        });
View Full Code Here

                ListProxy rules = (ListProxy) getSelectedStyleSheetProxy().
                        getPropertyProxy(ThemeModel.RULES);
                IStructuredSelection selection =
                        (IStructuredSelection) ruleTable.getSelection();
                if (!selection.isEmpty()) {
                    Proxy selected = (Proxy) selection.getFirstElement();
                    Operation delOp =
                            rules.prepareRemoveProxyItemOperation(selected);
                    context.executeOperation(delOp);
               
                    refreshRuleTable();
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.