Package org.apache.jetspeed.layout.impl

Examples of org.apache.jetspeed.layout.impl.CoordinateImpl


        try
        {
            PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);

            Fragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));

            Coordinate a_oCoordinate = ppc.moveAbsolute(a_oFrag, new CoordinateImpl(
                    0, 0, 0, 1));

            assertEquals(a_oCoordinate.getOldCol(), 0);
            assertEquals(a_oCoordinate.getOldRow(), 0);
            assertEquals(a_oCoordinate.getNewCol(), 0);
            assertEquals(a_oCoordinate.getNewRow(), 1);

            // Should be the second fragment now that the first has been moved
            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 0));
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 1));
            assertEquals(a_oFrag.getId(), "1");
            assertEquals(a_oFrag.getName(), "frag1");
        } catch (PortletPlacementException e)
        {
View Full Code Here


        try
        {
            PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);

            Fragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 1));

            Coordinate a_oCoordinate = ppc.moveUp(a_oFrag);

            assertEquals(a_oCoordinate.getOldCol(), 0);
            assertEquals(a_oCoordinate.getOldRow(), 1);
            assertEquals(a_oCoordinate.getNewCol(), 0);
            assertEquals(a_oCoordinate.getNewRow(), 0);

            // Should be the second fragment since it was moved up
            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 0));
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 1));
            assertEquals(a_oFrag.getId(), "1");
            assertEquals(a_oFrag.getName(), "frag1");
        } catch (PortletPlacementException e)
        {
View Full Code Here

                            throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
                        }
                    }
                   
                    PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
                    Coordinate coordinate = new CoordinateImpl(0, 0, col, row);
                    ppc.moveAbsolute(contentFragment, coordinate);
                   
                    if (posHeight != -1.0f)
                    {
                        pageLayoutComponent.updatePosition(contentFragment, -1.0f, -1.0f, -1.0f, -1.0f, posHeight, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                    }
                   
                    // synchronize back to the page layout root fragment
                    contentPage = ppc.syncPageFragments(PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                    if (attach)
                      pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.NORMAL, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);                   
                }
                catch (Exception e)
                {
                    throw new WebApplicationException(e);
                }
            }
            else if (!StringUtils.isBlank(layoutFragmentId) && layoutFragmentId.equals("attach"))
            {
                pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.NORMAL, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);                   
            }           
        }
        else
        {
            float posX = NumberUtils.toFloat(posXParam, -1.0f);
            float posY = NumberUtils.toFloat(posYParam, -1.0f);
            float posZ = NumberUtils.toFloat(posZParam, -1.0f);
            float posWidth = NumberUtils.toFloat(posWidthParam, -1.0f);
            float posHeight = NumberUtils.toFloat(posHeightParam, -1.0f);
           
            try
            {
                pageLayoutComponent.updatePosition(contentFragment, posX, posY, posZ, posWidth, posHeight, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.DETACH, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                if (layoutFragmentId != null && layoutFragmentId.equals("detach"))
                {
                    // first time detach, reallocate column and move it to the back
                    ContentFragment layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), fragmentId);                   
                    if (layoutFragment == null)
                    {
                        throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
                    }                   
                    PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
                    int col = contentFragment.getLayoutColumn();
                    int row = ppc.getNumberRows((col <= 0) ? 0 : col - 1);
                    Coordinate coordinate = new CoordinateImpl(col, contentFragment.getLayoutRow(), col, row);
                    ppc.moveAbsolute(contentFragment, coordinate);
                    contentPage = ppc.syncPageFragments(PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                }
            }
            catch (Exception e)
View Full Code Here

            a_iNumRows = ppc.getNumberRows(1);
            assertEquals(a_iNumRows, 3);

            // Check the fragments
            ContentFragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));
            assertNotNull("null fragment found at 0,0", a_oFrag);
            assertEquals(a_oFrag.getId(), "1");
            assertEquals(a_oFrag.getName(), "frag1");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 1,
                    0, 1));
            assertNotNull("null fragment found at 0,1", a_oFrag);
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 0,
                    1, 0));
            assertNotNull("null fragment found at 1,0", a_oFrag);
            assertEquals(a_oFrag.getId(), "3");
            assertEquals(a_oFrag.getName(), "frag3");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 1,
                    1, 1));
            assertNotNull("null fragment found at 1,1", a_oFrag);
            assertEquals(a_oFrag.getId(), "4");
            assertEquals(a_oFrag.getName(), "frag4");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 2,
                    1, 2));
            assertNotNull("null fragment found at 1,2", a_oFrag);
            assertEquals(a_oFrag.getId(), "5");
            assertEquals(a_oFrag.getName(), "frag5");
View Full Code Here

        try
        {
            PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);

            ContentFragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));

            Coordinate a_oCoordinate = ppc.remove(a_oFrag);

            assertEquals(a_oCoordinate.getOldCol(), 0);
            assertEquals(a_oCoordinate.getOldRow(), 0);

            // Should be the second fragment now that the first has been deleted
            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 0));
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");
        } catch (PortletPlacementException e)
        {
View Full Code Here

        try
        {
            PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);

            ContentFragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));

            Coordinate a_oCoordinate = ppc.moveAbsolute(a_oFrag, new CoordinateImpl(
                    0, 0, 0, 1));

            assertEquals(a_oCoordinate.getOldCol(), 0);
            assertEquals(a_oCoordinate.getOldRow(), 0);
            assertEquals(a_oCoordinate.getNewCol(), 0);
            assertEquals(a_oCoordinate.getNewRow(), 1);

            // Should be the second fragment now that the first has been moved
            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 0));
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 1));
            assertEquals(a_oFrag.getId(), "1");
            assertEquals(a_oFrag.getName(), "frag1");
        } catch (PortletPlacementException e)
        {
View Full Code Here

        try
        {
            PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);

            ContentFragment a_oFrag = ppc
                    .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 1));

            Coordinate a_oCoordinate = ppc.moveUp(a_oFrag);

            assertEquals(a_oCoordinate.getOldCol(), 0);
            assertEquals(a_oCoordinate.getOldRow(), 1);
            assertEquals(a_oCoordinate.getNewCol(), 0);
            assertEquals(a_oCoordinate.getNewRow(), 0);

            // Should be the second fragment since it was moved up
            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 0));
            assertEquals(a_oFrag.getId(), "2");
            assertEquals(a_oFrag.getName(), "frag2");

            a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
                    0, 1));
            assertEquals(a_oFrag.getId(), "1");
            assertEquals(a_oFrag.getName(), "frag1");
        } catch (PortletPlacementException e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.layout.impl.CoordinateImpl

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.