Package org.apache.jetspeed.om.page.psml

Examples of org.apache.jetspeed.om.page.psml.FragmentImpl


     * @return fragment
     */
    public Fragment newFragment()
    {
        // FragmentImpl requires generated ids
        FragmentImpl fragment = (FragmentImpl)super.newFragment();
        fragment.setId(generator.getNextPeid());
        return fragment;
    }
View Full Code Here


    }

    public Fragment newPortletFragment()
    {
        // FragmentImpl requires generated ids
        FragmentImpl fragment = (FragmentImpl)super.newFragment();
        fragment.setType(Fragment.PORTLET);
        fragment.setId(generator.getNextPeid());
        return fragment;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.jetspeed.aggregator.Aggregator#build(org.apache.jetspeed.request.RequestContext)
     */
    public void build(RequestContext context) throws JetspeedException, IOException
    {
        ContentFragment fragment = new ContentFragmentImpl(new FragmentImpl(), new HashMap()); // TODO: fragment factory
        fragment.setType(Fragment.PORTLET);
        fragment.setName(context.getRequestParameter(PortalReservedParameters.PORTLET));
        String entity = context.getRequestParameter(PortalReservedParameters.PORTLET_ENTITY);
        if (entity == null)
        {
View Full Code Here

     * @return fragment
     */
    public Fragment newFragment()
    {
        // FragmentImpl requires generated ids
        FragmentImpl fragment = (FragmentImpl)super.newFragment();
        fragment.setId(generator.getNextPeid());
        return fragment;
    }
View Full Code Here

    }

    public Fragment newPortletFragment()
    {
        // FragmentImpl requires generated ids
        FragmentImpl fragment = (FragmentImpl)super.newFragment();
        fragment.setType(Fragment.PORTLET);
        fragment.setId(generator.getNextPeid());
        return fragment;
    }
View Full Code Here

    private Page buildBasePage()
    {
        PageImpl page = new PageImpl();
        page.setId("MyPageID");

        FragmentImpl frag = new FragmentImpl();
        frag.setId("Frag1");
        frag.setType(Fragment.LAYOUT);

        page.setRootFragment(frag);

        return page;
    }
View Full Code Here

        BaseFragmentElement rootFragmentElement = page.getRootFragment();
        assertTrue(rootFragmentElement instanceof Fragment);
        Fragment root = (Fragment)rootFragmentElement;
        assertNotNull(root.getFragments());

        FragmentImpl frag1 = new FragmentImpl();
        frag1.setId("F1");
        frag1.setType(Fragment.PORTLET);
        frag1.setName("Portlet1");
        root.getFragments().add(frag1);

        FragmentImpl frag2 = new FragmentImpl();
        frag2.setId("F2");
        frag2.setType(Fragment.LAYOUT);
        frag2.setName("TwoColumns");
        frag2.setDecorator("test");

        FragmentImpl frag3 = new FragmentImpl();
        frag3.setId("F3");
        frag3.setType(Fragment.PORTLET);
        frag3.setName("Portlet3");
        frag3.setDecorator("test");
        frag3.setState("minimized");
        frag2.getFragments().add(frag3);
        root.getFragments().add(frag2);

        //Check the construct
        assertTrue(root.getFragments().size()==2);
        Iterator i = root.getFragments().iterator();
        FragmentImpl f = (FragmentImpl)i.next();
        assertNotNull(f);
        assertTrue(f.getName().equals("Portlet1"));
        assertTrue(f.getType().equals(Fragment.PORTLET));
        assertTrue(f.getId().equals("F1"));
        assertNull(f.getTitle());
        assertNull(f.getDecorator());
        assertNull(f.getState());
        assertTrue(f.getFragments().size()==0);
        f = (FragmentImpl)i.next();
        assertNotNull(f);
        assertTrue(f.getName().equals("TwoColumns"));
        assertTrue(f.getType().equals(Fragment.LAYOUT));
        assertTrue(f.getFragments().size()==1);
        assertTrue(f.getDecorator().equals("test"));
        assertTrue(f.getFragments().size()==1);
        i = f.getFragments().iterator();
        frag1 = (FragmentImpl)i.next();
        assertNotNull(frag1);
        assertTrue(frag1.getName().equals("Portlet3"));
        assertTrue(frag1.getType().equals(Fragment.PORTLET));

        //Now change the inner child to a new portlet
        frag2 = new FragmentImpl();
        frag2.setId("FR4");
        frag2.setType(Fragment.PORTLET);
        frag2.setName("P4");

        frag3 = (FragmentImpl)page.getFragmentById("F3");
        assertNotNull(frag3);
        f.getFragments().remove(frag3);
        frag3 = (FragmentImpl)page.getFragmentById("F3");
        assertNull(frag3);
        f.getFragments().add(frag2);
        assertTrue(f.getFragments().size()==1);
        f = (FragmentImpl)f.getFragments().get(0);
        assertNotNull(f);
        assertTrue(f.getName().equals("P4"));
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.psml.FragmentImpl

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.