portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers MultiColumnControllerAction.java
Date Sun, 11 Aug 2002 17:04:17 GMT
paulsp      2002/08/11 10:04:17

  Modified:    src/java/org/apache/jetspeed/modules/actions/controllers
                        MultiColumnControllerAction.java
  Log:
  Added support for many references
  
  Revision  Changes    Path
  1.19      +66 -50    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
  
  Index: MultiColumnControllerAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MultiColumnControllerAction.java	8 Aug 2002 02:57:11 -0000	1.18
  +++ MultiColumnControllerAction.java	11 Aug 2002 17:04:17 -0000	1.19
  @@ -299,7 +299,7 @@
                   eCount += columns[i].size();
               }
   
  -            Log.debug("MultiCol: eCount " + eCount + " setCount" + set.getEntryCount()
+ " " + set.getPortletsCount());
  +            Log.debug("MultiCol: eCount " + eCount + " setCount" + set.getEntryCount()
+ set.getPortletsCount());
               if (eCount != set.getEntryCount() + set.getPortletsCount())
               {
                   Log.debug("MultiCol: rebuilding columns ");
  @@ -607,7 +607,7 @@
       protected static void move(List[] cols, int oCol, int oRow, int nCol, int nRow)
       {
           Object obj = null;
  -
  +        
           if ((oCol < cols.length) && (oRow < cols[oCol].size()))
           {
               obj = cols[oCol].get(oRow);
  @@ -702,59 +702,13 @@
           //others
           for (int i = 0; i < set.getEntryCount(); i++)
           {
  -            Entry entry = set.getEntry(i);
  -            Layout layout = entry.getLayout();
  -            row = -1; 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());
  -                        }
  -                        else if (prop.getName().equals("column"))
  -                        {
  -                            col = Integer.parseInt(prop.getValue());
  -                        }
  -                    }
  -                }
  -                catch (Exception e)
  -                {
  -                    //ignore any malformed layout properties
  -                }
  -            }
  -
  -            Log.debug("Constraints col " + col + " row " + row);
  -            if ((row >= 0) && (col >= 0) && (col < colNum))
  -            {
  -                table[col].set(row, entry);
  -            }
  -            else
  -            {
  -                if (layout != null)
  -                {
  -                    // We got here because the column, as defined in the layout,
  -                    // is greater then the numner of columns. This usually 
  -                    // happens when the number of column has been decreased.
  -                    // Delete the offending layout.  It may be recreated with
  -                    // the correct values.
  -                    entry.setLayout(null);
  -                    layout = null;
  -                }
  -                work.add(entry);
  -            }
  +            addElement(set.getEntry(i), table, work, colNum);
           }
   
           // Add references
           for (int i = 0; i < set.getReferenceCount(); i++)
           {
  -            work.add(set.getReference(i));
  +            addElement(set.getReference(i), table, work, colNum);
           }
   
           //insert the unconstrained elements in the table
  @@ -827,6 +781,68 @@
           }
   
           return list;
  +    }
  +
  +    /**
  +     * Add an element to the "table" or "work" objects.  If the element is 
  +     * unconstrained, and the position is within the number of columns, then
  +     * the element is added to "table".  Othewise the element is added to "work"
  +     *
  +     * @param element to add
  +     * @param table of positioned elements
  +     * @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());
  +                        }
  +                        else if (prop.getName().equals("column"))
  +                        {
  +                            col = Integer.parseInt(prop.getValue());
  +                        }
  +                    }
  +                }
  +                catch (Exception e)
  +                {
  +                    //ignore any malformed layout properties
  +                }
  +            }
  +
  +            Log.debug("Constraints col " + col + " row " + row);
  +            if ((row >= 0) && (col >= 0) && (col < columnCount))
  +            {
  +                table[col].set(row, element);
  +            }
  +            else
  +            {
  +                if (layout != null)
  +                {
  +                    // We got here because the column, as defined in the layout,
  +                    // is greater then the numner of columns. This usually 
  +                    // happens when the number of column has been decreased.
  +                    // Delete the offending layout.  It may be recreated with
  +                    // the correct values.
  +                    element.setLayout(null);
  +                    layout = null;
  +                }
  +                work.add(element);
  +            }
  +        
       }
   
       protected void dumpColumns(List[] cols)
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message