Package org.apache.jetspeed.layout

Examples of org.apache.jetspeed.layout.PortletPlacementContext


        boolean success = true;
        Fragment placeFragment = null;
        if ( removeFromLayoutFragment != null )
        {
          Page page = requestContext.getPage();
            PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, removeFromLayoutFragment );
       
            placeFragment = placement.getFragmentById( moveFragmentId );
            if ( placeFragment == null )
            {
                success = false;
                resultMap.put( REASON, "Failed to find fragment to move to another layout for fragment id: " + moveFragmentId );
                return success;
            }
            placement.remove( placeFragment );
            page = placement.syncPageFragments();
            page.removeFragmentById( moveFragmentId );
        }
        if ( placeFragment != null )
        {
            return placeFragment( requestContext,
View Full Code Here


            return success;
        }
       
        // add fragment
        Page page = requestContext.getPage();
        PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, placeInLayoutFragment );
        //placement.add( placeFragment, getCoordinateFromParams( requestContext ) );
       
        success = moveInFragment( requestContext, placement, placeFragment, placeInLayoutFragment, resultMap, batch );

        return success;
View Full Code Here

                iRow = Integer.parseInt(row);
                resultMap.put(NEWROW, new Integer(iRow));
            }

            // Use the Portlet Placement Manager to accomplish the removal
            PortletPlacementContext placement = new PortletPlacementContextImpl(requestContext);
            Fragment fragment = pageManager.newFragment();
            fragment.setType(Fragment.PORTLET);
            fragment.setName(portletId);
            fragment.setLayoutColumn(iCol);
            fragment.setLayoutRow(iRow);
           
            Coordinate coordinate = placement.add(fragment, new CoordinateImpl(iCol, iRow, iCol, iRow));
            Page page = placement.syncPageFragments();                                               
           
            // TODO: this does not handle nested layouts           
            Fragment root = requestContext.getPage().getRootFragment();
            root.getFragments().add(fragment);           
            pageManager.updatePage(page);
View Full Code Here

                success = false;
                resultMap.put(REASON, "Insufficient access to edit page");
                return success;
            }
           
            PortletPlacementContext placement = new PortletPlacementContextImpl(requestContext);
            Fragment fragment = placement.getFragmentById(portletId);
            Coordinate returnCoordinate = null;

            // Only required for moveabs
            if (iMoveType == ABS)
            {
                String a_sCol = requestContext.getRequestParameter(COL);
                String a_sRow = requestContext.getRequestParameter(ROW);

                // Convert the col and row into integers
                int a_iCol = Integer.parseInt(a_sCol);
                int a_iRow = Integer.parseInt(a_sRow);

                Coordinate a_oCoordinate = new CoordinateImpl(0, 0, a_iCol,
                        a_iRow);
                returnCoordinate = placement.moveAbsolute(fragment, a_oCoordinate);
            }
            else if (iMoveType == LEFT)
            {
                returnCoordinate = placement.moveLeft(fragment);
            }
            else if (iMoveType == RIGHT)
            {
                returnCoordinate = placement.moveRight(fragment);
            }
            else if (iMoveType == UP)
            {
                returnCoordinate = placement.moveUp(fragment);
            }
            else if (iMoveType == DOWN)
            {
                returnCoordinate = placement.moveDown(fragment);
            }

            // synchronize back to the page layout root fragment
            Page page = placement.syncPageFragments();
           
            if (pageManager != null)
                pageManager.updatePage(page);
           
            // Use dummy values for now
View Full Code Here

                resultMap.put(REASON, "Insufficient access to edit page");
                return success;
            }
           
            // Use the Portlet Placement Manager to accomplish the removal
            PortletPlacementContext placement = new PortletPlacementContextImpl(requestContext);
            Fragment fragment = placement.getFragmentById(portletId);
            if (fragment == null)
            {
                success = false;
                resultMap.put(REASON, "Fragment not found");
                return success;               
View Full Code Here

           
            // Use the Portlet Placement Manager to accomplish the removal
            Page page = requestContext.getPage();
            Fragment root = page.getRootFragment();
            Fragment layoutContainerFragment = getParentFragmentById( portletId, root );
            PortletPlacementContext placement = null;
            Fragment fragment = null;
            if ( layoutContainerFragment != null )
            {
              placement = new PortletPlacementContextImpl( page, registry, layoutContainerFragment );
              fragment = placement.getFragmentById( portletId );
            }
            if ( fragment == null )
            {
                success = false;
                resultMap.put( REASON, "Fragment not found" );
                return success;               
            }
            placement.remove(fragment);
            page = placement.syncPageFragments();
            page.removeFragmentById( fragment.getId() );
            if (!batch)
            {
                if (pageManager != null)
                    pageManager.updatePage( page );
View Full Code Here

                                               moveToLayoutFragment,
                                               currentLayoutFragment ) ;
            }
            else
            {
              PortletPlacementContext placement = null;
              Page page = requestContext.getPage();
             
              if ( currentLayoutFragment == null )
                currentLayoutFragment = getParentFragmentById( moveFragmentId, page.getRootFragment() );
             
                if ( currentLayoutFragment != null )
                    placement = new PortletPlacementContextImpl( page, registry, currentLayoutFragment );
                else
                    placement = new PortletPlacementContextImpl( page, registry );
               
                Fragment fragment = placement.getFragmentById(moveFragmentId);
                if ( fragment == null )
                {
                    success = false;
                    resultMap.put( REASON, "Failed to find fragment for portlet id: " + moveFragmentId );
                    return success;
View Full Code Here

        boolean success = true;
        Fragment placeFragment = null;
        if ( removeFromLayoutFragment != null )
        {
          Page page = requestContext.getPage();
            PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, removeFromLayoutFragment );
       
            placeFragment = placement.getFragmentById( moveFragmentId );
            if ( placeFragment == null )
            {
                success = false;
                resultMap.put( REASON, "Failed to find fragment to move to another layout for fragment id: " + moveFragmentId );
                return success;
            }
            placement.remove( placeFragment );
            page = placement.syncPageFragments();
            page.removeFragmentById( moveFragmentId );
        }
        if ( placeFragment != null )
        {
            return placeFragment( requestContext,
View Full Code Here

            return success;
        }
       
        // add fragment
        Page page = requestContext.getPage();
        PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, placeInLayoutFragment );
        //placement.add( placeFragment, getCoordinateFromParams( requestContext ) );
       
        success = moveInFragment( requestContext, placement, placeFragment, placeInLayoutFragment, resultMap, batch );

        return success;
View Full Code Here

            if (layoutFragment == null)
            {
                layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), addedContentFragmentId);
            }
           
            PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
            // synchronize back to the page layout root fragment
            contentPage = ppc.syncPageFragments();
           
            return new ContentFragmentBean(contentFragment);
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.layout.PortletPlacementContext

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.