Package org.apache.jetspeed.om.profile

Examples of org.apache.jetspeed.om.profile.Layout


        throws java.lang.IndexOutOfBoundsException
    {
        portlets.addElement(p);
        // STW make sure layout gets set
        int end = getEntryCount();
        Layout layout = p.getLayout();
        if(layout != null)
        {
            layout.setPosition(end);
            layout.setSize(-1);
        }
    }
View Full Code Here


                assertTrue(skinParam.getValue().equals("1"));
                skinParam = (Parameter)skinParams.next();
                assertTrue(skinParam.getName().equals("b"));
                assertTrue(skinParam.getValue().equals("2"));

                Layout layout = rootset.getLayout();
                assertNotNull(layout);
                assertTrue(layout.getName().equals("layout1"));
                assertTrue(layout.getSize() == 1);
                assertTrue(layout.getPosition() == 3);

                Iterator layoutParams = layout.getParameterIterator();
                assertNotNull(layoutParams);
                Parameter layoutParam = (Parameter)layoutParams.next();
                assertTrue(layoutParam.getName().equals("a"));
                assertTrue(layoutParam.getValue().equals("1"));
                layoutParam = (Parameter)layoutParams.next();
                assertTrue(layoutParam.getName().equals("b"));
                assertTrue(layoutParam.getValue().equals("2"));

                Control control = rootset.getControl();
                assertNotNull(control);
                Iterator controlParams = control.getParameterIterator();
                assertNotNull(controlParams);
                Parameter controlParam = (Parameter)controlParams.next();
                assertTrue(control.getName().equals("TabControl"));
                assertTrue(controlParam.getName().equals("a"));
                assertTrue(controlParam.getValue().equals("1"));
                controlParam = (Parameter)controlParams.next();
                assertTrue(controlParam.getName().equals("b"));
                assertTrue(controlParam.getValue().equals("2"));

                Controller controller = rootset.getController();
                assertNotNull(controller);
                Iterator controllerParams = controller.getParameterIterator();
                assertNotNull(controllerParams);
                Parameter controllerParam = (Parameter)controllerParams.next();

                assertTrue(controller.getName().equals("TabController"));
                assertTrue(controllerParam.getName().equals("a"));
                assertTrue(controllerParam.getValue().equals("1"));
                controllerParam = (Parameter)controllerParams.next();
                assertTrue(controllerParam.getName().equals("b"));
                assertTrue(controllerParam.getValue().equals("2"));

                Iterator entries = rootset.getEntriesIterator();
                assertNotNull(entries);
                Entry entry = (Entry)entries.next();
                assertTrue(entry.getParent().equals("LoggedInWelcome"));   
                assertTrue(entry.getId().equals("03"));   

                Layout elayout = entry.getLayout();
                assertNotNull(elayout);
                Iterator elayoutParams = elayout.getParameterIterator();
                assertNotNull(elayoutParams);
                Parameter elayoutParam = (Parameter)elayoutParams.next();
                assertTrue(elayoutParam.getName().equals("column"));
                elayoutParam = (Parameter)elayoutParams.next();
                assertTrue(elayoutParam.getName().equals("row"));
View Full Code Here

        boolean colFound = false;
        boolean rowFound = false;

        if (identityElement != null)
        {
            Layout layout = identityElement.getLayout();

            if (layout == null)
            {
                layout = new PsmlLayout();
                identityElement.setLayout(layout);
            }

            for (int i = 0; i < layout.getParameterCount(); i++)
            {
                Parameter p = layout.getParameter(i);

                if (p.getName().equals("column"))
                {
                    p.setValue(String.valueOf(col));
                    colFound = true;
                }
                else if (p.getName().equals("row"))
                {
                    p.setValue(String.valueOf(row));
                    rowFound = true;
                }
            }

            if (!colFound)
            {
                Parameter p = new PsmlParameter();
                p.setName("column");
                p.setValue(String.valueOf(col));
                layout.addParameter(p);
            }

            if (!rowFound)
            {
                Parameter p = new PsmlParameter();
                p.setName("row");
                p.setValue(String.valueOf(row));
                layout.addParameter(p);
            }
        }
    }
View Full Code Here

        int rowNum = 0;
        while (iterator.hasNext())
        {
            IdentityElement identityElement = (IdentityElement) iterator.next();

            Layout layout = identityElement.getLayout();

            if (layout != null)
            {
                for (int p = 0; p < layout.getParameterCount(); p++)
                {
                    Parameter prop = layout.getParameter(p);

                    try
                    {
                        if (prop.getName().equals("row"))
                        {
View Full Code Here

     * @param work list of un-positioned elements
     * @param columnCount Number of colum
     */
    protected static void addElement(IdentityElement element, List[] table, List work, int columnCount)
    {
            Layout layout = element.getLayout();
            int row = -1;
            int col = -1;

            if (layout != null)
            {
                try
                {
                    for (int p = 0; p < layout.getParameterCount(); p++)
                    {
                        Parameter prop = layout.getParameter(p);

                        if (prop.getName().equals("row"))
                        {
                            row = Integer.parseInt(prop.getValue());
                        }
View Full Code Here

            Portlets p = portlets.getPortlets(i);
            if (logger.isDebugEnabled())
            {
                logger.debug("RowColumnControllerAction: processing portlet: " + p.getTitle());
            }
            Layout layout = p.getLayout();
            if (layout == null)
            {
                // Pane should always have a layout with correct position
                if (logger.isDebugEnabled())
                {
                    logger.debug("RowColumnControllerAction: no layout, creating a new one");
                }
                layout = new PsmlLayout();
                layout.setPosition(i);
                p.setLayout(layout);
            }
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("RowColumnControllerAction: layout has position: " + pos);
                    }
                    if (pos >= 0 && pos < plist.size())
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    logger.error("Layout error", e);
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
                work.add(p);
            }
        }

        for (int i=0; i < portlets.getEntryCount(); i++)
        {
            Entry p = portlets.getEntry(i);
            Layout layout = p.getLayout();
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (pos>=0)
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
View Full Code Here

            {
                // first try explicit portlets position
                for(int i=0; i < set.getPortletsCount(); i++)
                {
                    Portlets p = set.getPortlets(i);
                    Layout layout = p.getLayout();
//
//                    if (layout == null)
//                    {
//                      Layout nl = new Layout ();
//                      nl.setPosition (String.valueOf(i));
//
//                    }
                    if ((layout!=null) && (layout.getPosition() != -1))
                    {

                        int lpos = (int)layout.getPosition();
                        if (lpos==position)
                        {
                            set.removePortlets(i);

                            updateLayoutPositions(set);

                            // MODIFIED: Save changes for wml profiles
                            //if (isWML)
                            //  doSave(data, null);

                            return;
                        }
                    }
                }

                // try explicit entry position
                for(int i=0; i < set.getEntryCount(); i++)
                {
                    Entry p = set.getEntry(i);
                    Layout layout = p.getLayout();

                    if ((layout!=null) && (layout.getPosition() != -1))
                    {
                        int lpos = (int)layout.getPosition();

                        if (lpos==position)
                        {
                            set.removeEntry(i);
View Full Code Here

        // Update the layout position based on the physical order within the sorted list
        int position = 0;
        for (Iterator iter = list.iterator(); iter.hasNext();)
        {
            Portlets pane = (Portlets) iter.next();
            Layout layout = pane.getLayout();
            layout.setPosition(position++);
        }
    }
View Full Code Here

        {
            int target = -1;

            Portlets set = profile.getDocument()
                                  .getPortletsById(customizedSet.getID());
            Layout targetLayout = null;
            Layout baseLayout = null;

            if (set != null)
            {
                // check if we can possibly move as requested and calculate
                // target position
                if ( moveUp )
                {
                    if ( (position >= set.getPortletsCount())
                         && (position >= set.getEntryCount()) ) return;
                    target = position + 1;
                }
                else
                {
                    if (position ==0) return;
                    target = position - 1;
                }

                // first find objects at explicit portlets position
                for(int i=0; i < set.getPortletsCount(); i++)
                {
                    if ((targetLayout!=null) && (baseLayout!=null)) break;

                    Portlets p = set.getPortlets(i);
                    Layout layout = p.getLayout();
                    if ((layout!=null)&&(layout.getPosition()!=-1))
                    {
                        int lpos = (int)layout.getPosition();
                        if ((baseLayout == null) && (lpos==position))
                        {
                            baseLayout = layout;
                        }

                        if ((targetLayout == null) && (lpos==target))
                        {
                            targetLayout = layout;
                        }
                    }
                }

                // try explicit entry position
                for(int i=0; i < set.getEntryCount(); i++)
                {
                    if ((targetLayout!=null) && (baseLayout!=null)) break;

                    Entry p = set.getEntry(i);
                    Layout layout = p.getLayout();
                    if ((layout!=null)&&(layout.getPosition()!=-1))
                    {
                        int lpos = (int)layout.getPosition();
                        if ((baseLayout == null) && (lpos==position))
                        {
                            baseLayout = layout;
                        }
View Full Code Here

            Portlets p = portlets.getPortlets(i);
            if (logger.isDebugEnabled())
            {
                logger.debug("RowColumnControllerAction: processing portlet: " + p.getTitle());
            }
            Layout layout = p.getLayout();
            if (layout == null)
            {
                // Pane should always have a layout with correct position
                if (logger.isDebugEnabled())
                {
                    logger.debug("RowColumnControllerAction: no layout, creating a new one");
                }
                layout = new PsmlLayout();
                layout.setPosition(i);
                p.setLayout(layout);
            }
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("RowColumnControllerAction: layout has position: " + pos);
                    }
                    if (pos >= 0 && pos < plist.size())
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    logger.error("Layout error", e);
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
                work.add(p);
            }
        }

        for (int i=0; i < portlets.getEntryCount(); i++)
        {
            Entry p = portlets.getEntry(i);
            Layout layout = p.getLayout();
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (pos>=0)
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.profile.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.