Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.Layout


            // Retrieve the layout type - canvas, montage or null.
            InternalLayoutContentBuilder content =
                    (InternalLayoutContentBuilder) getModelContent();
            LayoutType layoutType = null;
            if (content != null) {
                Layout layout = content.getLayout();
                if (layout != null) {
                    layoutType = layout.getType();
                }
            }

            if (layoutType == LayoutType.CANVAS) {
                // The variant is a canvas layout - disable montage controls
View Full Code Here


    private void updateLayoutModel() {
        ContentBuilder contentBuilder = getModelContent();
        if (contentBuilder != null) {
            InternalLayoutContentBuilder layoutContent =
                    (InternalLayoutContentBuilder) contentBuilder;
            Layout layout = layoutContent.getLayout();

            boolean changed = false;
            String defaultFragment = layout.getDefaultFragmentName();
            String defaultSegment = layout.getDefaultSegmentName();

            String newFragment = defaultFragmentCombo.getCombo().getText();
            if (!textMatchEmptyAsNull(newFragment, defaultFragment)) {
                layout.setDefaultFragmentName(newFragment);
                changed = true;
            }

            String newSegment = defaultSegmentCombo.getCombo().getText();
            if (!textMatchEmptyAsNull(newSegment, defaultSegment)) {
                layout.setDefaultSegmentName(newSegment);
                changed = true;
            }

            if (changed) {
                // Because we're not modifying this value through the interaction
View Full Code Here

                    // 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("");
                    }
                }
View Full Code Here

     */
    private void refreshTargets() {
        InternalLayoutContentBuilder builder =
                (InternalLayoutContentBuilder) getModelContent();
        if (builder != null) {
            Layout layout = builder.getLayout();
            if (layout != null) {
                // Preserve the current values before we update the input -
                // this is required because combo viewers handle changing inputs
                // badly, losing any pre-entered values.
                String defaultFragment = layout.getDefaultFragmentName();
                String defaultSegment = layout.getDefaultSegmentName();

                defaultFragmentCombo.setInput(layout);
                defaultSegmentCombo.setInput(layout);

                defaultFragmentCombo.getCombo().setText(
View Full Code Here

            targetType = type;
        }

        // Javadoc inherited
        public Object[] getElements(Object o) {
            Layout layout = (Layout) o;
            Collection values = DEFAULT_TARGET_FORMAT_VISITOR.
                    getValidNames(layout, targetType);
            Object[] elements = values.toArray();
            Arrays.sort(elements);
            return elements;
View Full Code Here

        String defaultSegment = null;
        if (contentProxy != null) {
            Object contentModel = contentProxy.getModelObject();
            if (contentModel != null &&
                    contentModel instanceof InternalLayoutContentBuilder) {
                Layout layout = ((InternalLayoutContentBuilder) contentModel).
                        getLayout();
                if (layout != null) {
                    defaultFragment = layout.getDefaultFragmentName();
                    defaultSegment = layout.getDefaultSegmentName();
                }
            }
        }

        XMLOutputter outputter = new XMLOutputter();
        String docString = outputter.outputString(document);
        byte[] bytes = null;
        try {
            bytes = docString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            EclipseCommonPlugin.handleError(ABPlugin.getDefault(), e);
        }
        final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
        final JiBXReader reader;
        try {
            reader = new JiBXReader(Class.forName(
                "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
            // a grid column. First the grid column count is updated then
            // the columns are removed. But a change event and layout
            // validation is triggered when the column count is altered. As
            // the model is in an invalid state it fails to read in
            // correctly.
            throw new IOException("Failed to read layout due to ArrayIndexOutOfBoundsException");
        }

        // If we have a valid content builder with layout (which should always
        // be the case) re-insert the data that was edited from the overview
        // page.
        if (contentBuilder instanceof InternalLayoutContentBuilder) {
            Layout layout = ((InternalLayoutContentBuilder) contentBuilder).getLayout();
            if (layout != null) {
                if (defaultFragment != null) {
                    layout.setDefaultFragmentName(defaultFragment);
                }

                if (defaultSegment != null) {
                    layout.setDefaultSegmentName(defaultSegment);
                }
            }
        }

        return contentBuilder;
View Full Code Here

                    getSelection()).getFirstElement();
            if (selected instanceof LayoutType) {
                type = (LayoutType) selected;
            }

            Layout layout = null;
            if (type == LayoutType.CANVAS) {
                layout = new CanvasLayout();
            } else if (type == LayoutType.MONTAGE) {
                layout = new MontageLayout(null);
            }
View Full Code Here

                if (type == VariantType.LAYOUT) {
                    InternalLayoutContentBuilder content =
                            (InternalLayoutContentBuilder)
                            variant.getContentBuilder();
                    if (content != null) {
                        Layout layout = content.getLayout();
                        if (layout != null) {
                            key = layout.getType().toString();
                        }
                    }
                } else {
                    key = type.toString();
                }
View Full Code Here

            return buffer;
        }

        // Javadoc inherited
        public RuntimeDeviceLayout getDeviceLayout() {
            Layout layout = createDeviceLayout();
            layout.setDefaultFormFragmentName("default");
            return new RuntimeLayoutAdapter("fred", layout, null, null);
        }
View Full Code Here

                if (type == VariantType.LAYOUT) {
                    InternalLayoutContentBuilder content =
                            (InternalLayoutContentBuilder)
                            variant.getContentBuilder();
                    if (content != null) {
                        Layout layout = content.getLayout();
                        if (layout != null) {
                            key = layout.getType().toString();
                        }
                    }
                } else {
                    key = type.toString();
                }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.layouts.Layout

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.