Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.Form


        formFrag1.setName("formFrag1");

        FormFragment formFrag2 = new FormFragment(canvasLayout);
        formFrag2.setName("formFrag2");

        Form form = new Form(canvasLayout);
        form.setName("form");
        form.addFormFragment(formFrag1);
        form.addFormFragment(formFrag2);
        form.setParent(innerFrag);

        Grid grid = new Grid(canvasLayout);
        grid.setRows(2);
        grid.setColumns(1);
        grid.setParent(form);
View Full Code Here


        // Activate the device layout.
        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(canvasLayout);
        pageContext.setDeviceLayout(runtimeDeviceLayout);

        final Form form = new Form(canvasLayout);
        form.setName("form");
        pageContext.setForm(form);
        FormInstance formInstance = new FormInstance(
                NDimensionalIndex.ZERO_DIMENSIONS);
        formInstance.setFormat(form);
        pageContext.setFormatInstance(formInstance);
View Full Code Here

     */
    public void testGetInitialValue() throws Exception {
        // a) Expect null as the result
        XFTextInputAttributes attributes = new XFTextInputAttributes();
        FormInstance formInstance = new FormInstance(NDimensionalIndex.ZERO_DIMENSIONS);
        final Form form = new Form(null);
        formInstance.setFormat(form);
        attributes.setFormData(formInstance);

        TestMarinerRequestContext requestContext = new TestMarinerRequestContext();
        ContextInternals.setEnvironmentContext(requestContext,
                new TestEnvironmentContext());

        TestMarinerPageContext pageContext = new TestMarinerPageContext();
        FormDescriptor fd = new FormDescriptor();
        String formSpecifier =
                pageContext.getFormDataManager().getFormSpecifier(fd);
        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        pageContext.pushRequestContext(requestContext);
        protocol.setMarinerPageContext(pageContext);

        String result = protocol.getInitialValue(attributes);
        assertEquals(null, result);

        // b) Expect 'Test' as the result
        attributes.setInitial("Test");
        result = protocol.getInitialValue(attributes);
        assertEquals("Test", result);

        // c) Expect value of textComponentID as the result.
        attributes.setInitial(new LiteralTextAssetReference("foobar"));
        result = protocol.getInitialValue(attributes);
        assertEquals("foobar", result);

        // d) Expect the value of textComponentID (since sessionContext.
        // getAttribute  return null).
        attributes.setInitial(new LiteralTextAssetReference("foobar"));
        final XFFormAttributes formAttributes = new XFFormAttributes();
        formAttributes.setFormSpecifier(formSpecifier);
        attributes.setFormAttributes(formAttributes);       
        form.addFormFragment(new FormFragment(null));
        result = protocol.getInitialValue(attributes);
        assertEquals("foobar", result);
    }
View Full Code Here

    int checkPaneInstances(
            MarinerPageContext pageContext,
            String captionPaneName,
            String entryPaneName) throws PAPIException {

        Form form;
        if (inline()) {
            form = null;
        } else {
            form = (Form) ((FormInstance) formAttributes.getFormData())
                    .getFormat();
        }

        if (logger.isDebugEnabled()) {
            logger.debug(
                    "Checking panes " + captionPaneName + " " + entryPaneName);
        }

        // Look up the caption pane instance if it has been specified.
        captionPaneInstance = lookupPaneInstance(
                pageContext, form, captionPaneName, captionPaneInstance);

        // Look up the entry pane instance if it has been specified.
        entryPaneInstance = lookupPaneInstance(
                pageContext, form, entryPaneName, entryPaneInstance);

        if ((captionPaneName == null) && (entryPaneName == null)) {
            // Neither have been specified so use the current pane if this is being
            // rendered inline, otherwise use the forms default pane.
            Pane pane;
            if (form == null) {
                pane = pageContext.getCurrentPane();
            } else {
                pane = form.getDefaultPane();
            }

            // If the pane exists then use it for both caption and entry pane.
            if (pane != null) {
                captionPaneName = entryPaneName = pane.getName();
View Full Code Here

            return true;
        }

        // This field is inside a form so make sure that it is in the current form
        // fragment.
        Form form = (Form) ((FormInstance) formAttributes.getFormData())
                .getFormat();
        if (form.isFragmented()) {
            if (logger.isDebugEnabled()) {
                logger.debug("Enclosing form is fragmented.");
            }

            FormFragment fragment = paneInstance.getFormat().
View Full Code Here

    // javadoc inherited
    public void render(final FormatRendererContext context, final FormatInstance instance)
            throws RendererException {
        try {
            if (!instance.isEmpty()) {
                Form form = (Form)instance.getFormat();

                Format child = form.getChildAt(0);

                // If there is no child then there is nothing to write.
                if (child == null) {
                    return;
                }
View Full Code Here

        final XFImplicitAttributes attributes =
                (XFImplicitAttributes) ProtocolIntegrationTestHelper.
                provideAttributes(XFImplicitAttributes.class);

        XFFormAttributes formAttributes = new XFFormAttributes();
        Form form = new Form(new CanvasLayout());
        attributes.setFormAttributes(formAttributes);

        final VolantisProtocol protocol = getProtocol();

        MethodInvoker invoker = new MethodInvoker() {
View Full Code Here

        XFFormAttributes attributes = (XFFormAttributes) papiAttributes;

        // Try and find the form with the specified name, if it could not be
        // found then return and skip the element body.
        String formName = attributes.getName();
        Form form = pageContext.getForm(formName);
        if (form == null) {
            skipped = true;
            return SKIP_ELEMENT_BODY;
        }
View Full Code Here

    }

    // Javadoc inherited from super class.
    protected boolean isEmptyImpl() {

        Form form = (Form) format;

        // This instance is only empty if all the buffers are empty and all the
        // children are empty too.
        if (preambleBuffer != null && !preambleBuffer.isEmpty()) {
            return false;
        }
        if (contentBuffer != null && !contentBuffer.isEmpty()) {
            return false;
        }
        if (postambleBuffer != null && !postambleBuffer.isEmpty()) {
            return false;
        }

        Format child = form.getChildAt(0);
        if (child != null) {
            return context.isFormatEmpty(child);
        }

        return true;
View Full Code Here

    // ------------------------------------------------------------------------

    // Javadoc inherited from super class.
    public final void writeOpenForm(FormAttributes attributes) {

        Form form = attributes.getForm();
        FormInstance formInstance = (FormInstance)context.getFormatInstance(
            form,
            NDimensionalIndex.ZERO_DIMENSIONS);

        // Push the form's content buffer on the stack of output buffers.
View Full Code Here

TOP

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

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.