Package com.volantis.mcs.policies.variants.content

Examples of com.volantis.mcs.policies.variants.content.ContentBuilder


    /**
     * Update the model from the layout content controls.
     */
    private void updateLayoutModel() {
        ContentBuilder contentBuilder = getModelContent();
        if (contentBuilder != null) {
            InternalLayoutContentBuilder layoutContent =
                    (InternalLayoutContentBuilder) contentBuilder;
            Layout layout = layoutContent.getLayout();

View Full Code Here


        VariantType type =
            (VariantType)selectedVariant.
                getPropertyProxy(PolicyModel.VARIANT_TYPE).getModelObject();

        ContentBuilder content =
            (ContentBuilder) selectedVariant.
                getPropertyProxy(PolicyModel.CONTENT).getModelObject();

        handlingEvents = false;

        setDefaultEnabledState();

        if (type == VariantType.NULL) {
            // We have a null asset
            setNullCheckbox(true);
            setEmbeddedCheckbox(false);
            setEmbeddedText("");
            setURLText("");
            setBaseURL("");
            setLayoutEnabled(false);
            setFragmentName("");
            setSegmentName("");
            setThemeEnabled(false);
        } else if (content == null) {
            // We have a normal but probably uninitialised asset
            setNullCheckbox(false);
            setEmbeddedCheckbox(false);
            setEmbeddedText("");
            setURLText("");
            setBaseURL("");
            setLayoutEnabled(false);
            setFragmentName("");
            setSegmentName("");
            setThemeEnabled(false);
        } else {
            // We have a normal asset
            ContentBuilderVisitor updateDisplayVisitor = new ContentBuilderVisitor() {
                public void visit(AutoURLSequenceBuilder content) {
                    // TODO later implement this
                }

                public void visit(EmbeddedContentBuilder content) {
                    setNullCheckbox(false);
                    setEmbeddedCheckbox(true);
                    setEmbeddedText(content.getData());
                    setURLText("");
                    setBaseURL("");
                    setLayoutEnabled(false);
                    setThemeEnabled(false);
                }

                public void visit(LayoutContentBuilder content) {
                    setNullCheckbox(false);
                    setEmbeddedCheckbox(false);
                    setEmbeddedText("");
                    setURLText("");
                    setBaseURL("");
                    setLayoutEnabled(true);
                    setThemeEnabled(false);

                    // Retrieve the default fragment/segment values where
                    // appropriate.
                    refreshTargets();

                    Layout layout = ((InternalLayoutContentBuilder)content).getLayout();
                    if (layout != null && layout.getDefaultFragmentName() != null) {
                        setFragmentName(layout.getDefaultFragmentName());
                    } else {
                        setFragmentName("");
                    }

                    if (layout != null && layout.getDefaultSegmentName() != null) {
                        setSegmentName(layout.getDefaultSegmentName());
                    } else {
                        setSegmentName("");
                    }
                }

                public void visit(ThemeContentBuilder content) {
                    setNullCheckbox(false);
                    setEmbeddedCheckbox(false);
                    setEmbeddedText("");
                    setURLText("");
                    setBaseURL("");
                    setLayoutEnabled(false);
                    setThemeEnabled(true);
                    boolean importParent = ((InternalThemeContentBuilder)content).getImportParent();
                    setImportParent(importParent);

                }

                public void visit(URLContentBuilder content) {
                    setNullCheckbox(false);
                    setEmbeddedCheckbox(false);
                    setEmbeddedText("");
                    setURLText(content.getURL());
                    setLayoutEnabled(false);
                    setThemeEnabled(false);
                    PolicyReference baseUrl = content.getBaseURLPolicyReference();
                    if (baseUrl != null && baseUrl.getName() != null) {
                        setBaseURL(baseUrl.getName());
                    } else {
                        setBaseURL("");
                    }

                    composite.setProperty(
                        PolicyModel.BASE_LOCATION, content.getBaseLocation());

                }
            };

            ((InternalContentBuilder) content).accept(updateDisplayVisitor);
View Full Code Here

     * exists, return null.
     *
     * @return The content builder for the currently selected variant
     */
    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) {
View Full Code Here

                boolean containsCSS = false;
                List builders = policy.getVariantBuilders();
                for (Object builderObject : builders) {
                    VariantBuilder builder = (VariantBuilder) builderObject;
                    if (builder.getVariantType() == VariantType.THEME) {
                        ContentBuilder variantContent =
                                builder.getContentBuilder();
                        InternalThemeContentBuilder themeContent =
                                (InternalThemeContentBuilder) variantContent;
                        if (themeContent.getStyleSheet() instanceof CSSStyleSheet) {
                            StyleSheet parsedStyleSheet =
View Full Code Here

            (IFile) variantBuilderProxyToIFile.get(variantBuilderProxy);
        if (layoutIFile == null) {

            final VariantBuilder variantBuilder =
                (VariantBuilder) variantBuilderProxy.getModelObject();
            ContentBuilder contentBuilder = variantBuilder.getContentBuilder();

            if (contentBuilder == null) {
                final InternalLayoutContentBuilder layoutBuilder =
                    InternalPolicyFactory.getInternalInstance().
                        createLayoutContentBuilder();
View Full Code Here

    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) {
View Full Code Here

                        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) {
View Full Code Here

                "com.volantis.mcs.policies.impl.variants.layout.LayoutContentBuilderImpl"));
        } catch (ClassNotFoundException e) {
            throw new ExtendedIOException(e);
        }
        final BinaryContentInput content = new BinaryContentInput(inputStream);
        ContentBuilder contentBuilder = null;
        try {
            contentBuilder =
                (ContentBuilder) reader.read(content, file.getName());
        } catch (ArrayIndexOutOfBoundsException e) {
            // HACK : This can happen if we are in the process of removing
View Full Code Here

        // Iterate over all the variantBuilders to activate any policy
        // references.
        List variantBuilders = variablePolicyBuilder.getVariantBuilders();
        for (Iterator i = variantBuilders.iterator(); i.hasNext();) {
            VariantBuilder builder = (VariantBuilder) i.next();
            ContentBuilder contentBuilder = builder.getContentBuilder();

            if (contentBuilder instanceof URLContentBuilder) {
                URLContentBuilder urlContentBuilder =
                        (URLContentBuilder) contentBuilder;
                PolicyReference reference =
View Full Code Here

TOP

Related Classes of com.volantis.mcs.policies.variants.content.ContentBuilder

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.