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 Sat, 03 Aug 2002 16:10:41 GMT
paulsp      2002/08/03 09:10:41

  Modified:    src/java/org/apache/jetspeed/modules/actions/controllers
                        MultiColumnControllerAction.java
  Log:
  Housekeeping, as directed by checkStyle.  This involved adding space and
  removing imports.  No functional changes where made.
  
  Revision  Changes    Path
  1.16      +141 -129  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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MultiColumnControllerAction.java	3 Aug 2002 15:24:25 -0000	1.15
  +++ MultiColumnControllerAction.java	3 Aug 2002 16:10:41 -0000	1.16
  @@ -69,11 +69,8 @@
   import org.apache.jetspeed.portal.Portlet;
   import org.apache.jetspeed.portal.PortletSet;
   import org.apache.jetspeed.portal.PortletController;
  -import org.apache.jetspeed.portal.PortletControllerConfig;
  -import org.apache.jetspeed.portal.PanedPortletController;
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
   import org.apache.jetspeed.services.Registry;
  -import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.jetspeed.util.template.JetspeedLink;
   import org.apache.jetspeed.util.template.JetspeedLinkFactory;
   
  @@ -81,7 +78,6 @@
   import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.util.Log;
   import org.apache.turbine.util.RunData;
  -import org.apache.turbine.util.StringUtils;
   
   // Velocity Stuff
   import org.apache.velocity.context.Context;
  @@ -111,9 +107,9 @@
        * Subclasses must override this method to provide default behavior
        * for the portlet action
        */
  -    protected void buildNormalContext( PortletController controller,
  -                                       Context context,
  -                                       RunData rundata )
  +    protected void buildNormalContext(PortletController controller,
  +                                      Context context,
  +                                      RunData rundata)
       {
           try
           {
  @@ -130,7 +126,7 @@
               // not an integer or null, default to standarrd value
               colNum = 3;
           }
  -        context.put("colNum",String.valueOf(colNum));
  +        context.put("colNum", String.valueOf(colNum));
   
           //retrieve the size for each of the columns
           String sizes = controller.getConfig().getInitParameter("sizes");
  @@ -145,16 +141,16 @@
           Enumeration en = set.getPortlets();
           int row = 0;
           int col = 0;
  -        while(en.hasMoreElements())
  +        while (en.hasMoreElements())
           {
  -            Portlet p = (Portlet)en.nextElement();
  +            Portlet p = (Portlet) en.nextElement();
   
               PortletSet.Constraints
                   constraints = p.getPortletConfig().getConstraints();
   
  -            if ( (constraints != null)
  +            if ((constraints != null)
                    && (constraints.getColumn() != null)
  -                 && (constraints.getRow() != null) )
  +                 && (constraints.getRow() != null))
               {
                   col = constraints.getColumn().intValue();
                   if (col > colNum)
  @@ -169,17 +165,17 @@
                   }
               }
           }
  -        row = (int)Math.ceil(set.size() / colNum);
  +        row = (int) Math.ceil(set.size() / colNum);
           if (row > rowNum)
           {
               rowNum = row;
           }
   
  -        Log.debug("Controller calculated setSize "+set.size()+" row "+row+" colNum: "+colNum+
" rowNum: "+rowNum);
  +        Log.debug("Controller calculated setSize " + set.size() + " row " + row + " colNum:
" + colNum +  " rowNum: " + rowNum);
           // initialize the result position table and the work list
           List[] table = new List[colNum];
  -        List filler = Collections.nCopies(rowNum+1,null);
  -        for (int i=0; i < colNum; i++)
  +        List filler = Collections.nCopies(rowNum + 1, null);
  +        for (int i = 0; i < colNum; i++)
           {
               table[i] = new ArrayList();
               table[i].addAll(filler);
  @@ -189,21 +185,21 @@
   
           //position the constrained elements and keep a reference to the
           //others
  -        for (int i=0; i < set.size(); i++)
  +        for (int i = 0; i < set.size(); i++)
           {
               Portlet p = set.getPortletAt(i);
   
               PortletSet.Constraints
                   constraints = p.getPortletConfig().getConstraints();
   
  -            if ( (constraints != null)
  +            if ((constraints != null)
                    && (constraints.getColumn() != null)
                    && (constraints.getRow() != null) 
  -                 && (constraints.getColumn().intValue() < colNum) )
  +                 && (constraints.getColumn().intValue() < colNum))
               {
                   row = constraints.getRow().intValue();
                   col = constraints.getColumn().intValue();
  -                table[col].set(row,p);
  +                table[col].set(row, p);
               }
               else
               {
  @@ -212,30 +208,29 @@
           }
   
           //insert the unconstrained elements in the table
  -        Iterator i=work.iterator();
  -        for (row=0; row < rowNum; row++)
  +        Iterator i = work.iterator();
  +        for (row = 0; row < rowNum; row++)
           {
  -            for (col=0; i.hasNext() && (col < colNum); col++)
  +            for (col = 0; i.hasNext() && (col < colNum); col++)
               {
  -                if (table[col].get(row)==null)
  +                if (table[col].get(row) == null)
                   {
  -                    table[col].set(row,i.next());
  +                    table[col].set(row, i.next());
                   }
               }
           }
   
           // now cleanup any remaining null elements
  -        for(int j=0; j < table.length; j++)
  +        for (int j = 0; j < table.length; j++)
           {
               i = table[j].iterator();
  -            while(i.hasNext())
  +            while (i.hasNext())
               {
                   Object obj = i.next();
  -                if (obj==null)
  +                if (obj == null)
                   {
                       i.remove();
                   }
  -
               }
           }
   
  @@ -256,13 +251,13 @@
        * Subclasses must override this method to provide default behavior
        * for the portlet action
        */
  -    protected void buildCustomizeContext( PortletController controller,
  -                                          Context context,
  -                                          RunData rundata )
  +    protected void buildCustomizeContext(PortletController controller,
  +                                         Context context,
  +                                         RunData rundata)
       {
  -        JetspeedRunData jdata = (JetspeedRunData)rundata;
  +        JetspeedRunData jdata = (JetspeedRunData) rundata;
   
  -        super.buildCustomizeContext(controller,context,rundata);
  +        super.buildCustomizeContext(controller, context, rundata);
   
           List[] columns = null;
   
  @@ -278,7 +273,7 @@
               // not an integer or null, default to standarrd value
               colNum = 3;
           }
  -        context.put("colNum",String.valueOf(colNum));
  +        context.put("colNum", String.valueOf(colNum));
   
           //retrieve the size for each of the columns
           String sizes = controller.getConfig().getInitParameter("sizes");
  @@ -288,56 +283,56 @@
           String columnClasses = controller.getConfig().getInitParameter("col_classes");
           context.put("col_classes", getCellClasses(columnClasses));
   
  -        columns = (List[])rundata.getUser().getTemp("columns");
  -        PortletSet customizedSet = (PortletSet)jdata.getCustomized();
  +        columns = (List[]) rundata.getUser().getTemp("columns");
  +        PortletSet customizedSet = (PortletSet) jdata.getCustomized();
           Portlets set = jdata.getProfile()
                               .getDocument()
                               .getPortletsById(customizedSet.getID());
   
  -        Log.debug("MultiCol: columns "+columns+" set "+set);
  +        Log.debug("MultiCol: columns " + columns + " set " + set);
   
  -        if ((columns != null)&&(columns.length==colNum))
  +        if ((columns != null) && (columns.length == colNum))
           {
               int eCount = 0;
  -            for (int i=0; i < columns.length; i++)
  +            for (int i = 0; i < columns.length; i++)
               {
  -                eCount+=columns[i].size();
  +                eCount += columns[i].size();
               }
   
  -            Log.debug("MultiCol: eCount "+eCount+" setCount"+ set.getEntryCount()+" "+set.getPortletsCount());
  -            if (eCount != 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 ");
  -                columns = buildColumns(set,colNum);
  +                columns = buildColumns(set, colNum);
               }
   
           }
           else
           {
               Log.debug("MultiCol: rebuilding columns ");
  -            columns = buildColumns(set,colNum);
  +            columns = buildColumns(set, colNum);
           }
   
  -        rundata.getUser().setTemp("columns",columns);
  +        rundata.getUser().setTemp("columns", columns);
           context.put("portlets", columns);
   
           Map titles = new HashMap();
  -        for (int col=0; col < columns.length; col++)
  +        for (int col = 0; col < columns.length; col++)
           {
  -            for(int row=0; row < columns[col].size(); row++)
  +            for (int row = 0; row < columns[col].size(); row++)
               {
                   IdentityElement identityElement = (IdentityElement) columns[col].get(row);
                   MetaInfo metaInfo = identityElement.getMetaInfo();
                   if ((metaInfo != null) && (metaInfo.getTitle() != null))
                   {
  -                    titles.put(identityElement.getId(),metaInfo.getTitle());
  +                    titles.put(identityElement.getId(), metaInfo.getTitle());
                       continue;
                   }
   
                   if (identityElement instanceof Entry)
                   {
                       Entry entry = (Entry) identityElement;
  -                    PortletEntry pentry = (PortletEntry)Registry.getEntry(Registry.PORTLET,entry.getParent());
  +                    PortletEntry pentry = (PortletEntry) Registry.getEntry(Registry.PORTLET,
entry.getParent());
                       if ((pentry != null) && (pentry.getTitle() != null))
                       {
                           titles.put(entry.getId(), pentry.getTitle());
  @@ -348,7 +343,7 @@
                       continue;
                   }
                   
  -                if (identityElement instanceof Reference )
  +                if (identityElement instanceof Reference)
                   {
                       titles.put(identityElement.getId(), Localization.getString("CUSTOMIZER_REF_DEFAULTTITLE"));
                       continue;
  @@ -371,11 +366,11 @@
       {
           JetspeedLink jsLink = null;
           data.getUser().removeTemp("columns");
  -        ((JetspeedRunData)data).setCustomized(null);
  +        ((JetspeedRunData) data).setCustomized(null);
   
  -        if (((JetspeedRunData)data).getCustomized() == null)
  +        if (((JetspeedRunData) data).getCustomized() == null)
           {
  -            ((JetspeedRunData)data).setMode("default");
  +            ((JetspeedRunData) data).setMode("default");
   
               // bring logged on user to homepage via HTTP redirect
               try
  @@ -388,7 +383,8 @@
                       jsLink.addQueryData("mtype", mtype);
                   }
   
  -            } catch (Exception e)
  +            }
  +            catch (Exception e)
               {
                   Log.error(e);
               }
  @@ -400,12 +396,12 @@
   
       public void doSave(RunData data, Context context)
       {
  -        Profile profile = ((JetspeedRunData)data).getProfile();
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  +        Profile profile = ((JetspeedRunData) data).getProfile();
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
   
  -        for (int col=0; col < columns.length; col++)
  +        for (int col = 0; col < columns.length; col++)
           {
  -            for(int row=0; row < columns[col].size(); row++)
  +            for (int row = 0; row < columns[col].size(); row++)
               {
                   setPosition((IdentityElement) columns[col].get(row), col, row);
               }
  @@ -423,23 +419,26 @@
           }
           catch (Exception e)
           {
  -            Log.error("Error while saving profile",e);
  +            Log.error("Error while saving profile", e);
           }
   
  -        doCancel(data,context);
  +        doCancel(data, context);
       }
   
       public void doDelete(RunData data, Context context)
       {
  -        JetspeedRunData jdata = (JetspeedRunData)data;
  -        PortletSet customizedSet = (PortletSet)jdata.getCustomized();
  +        JetspeedRunData jdata = (JetspeedRunData) data;
  +        PortletSet customizedSet = (PortletSet) jdata.getCustomized();
   
  -        int col = data.getParameters().getInt("col",-1);
  -        int row = data.getParameters().getInt("row",-1);
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  -        if (columns == null) return;
  +        int col = data.getParameters().getInt("col", -1);
  +        int row = data.getParameters().getInt("row", -1);
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
  +        if (columns == null)
  +        {
  +            return;
  +        }
   
  -        if ( (col > -1) && (row > -1) )
  +        if ((col > -1) && (row > -1))
           {
               try
               {
  @@ -454,7 +453,7 @@
                   {
                       if (identityElement instanceof Entry)
                       {
  -                        for (int i=0; i < portlets.getEntryCount(); i++)
  +                        for (int i = 0; i < portlets.getEntryCount(); i++)
                           {
                               if (portlets.getEntry(i) == identityElement)
                               {
  @@ -464,7 +463,7 @@
                       }
                       else if (identityElement instanceof Reference)
                       {
  -                        for (int i=0; i < portlets.getReferenceCount(); i++)
  +                        for (int i = 0; i < portlets.getReferenceCount(); i++)
                           {
                               if (portlets.getReference(i) == identityElement)
                               {
  @@ -483,71 +482,84 @@
   
       public void doLeft(RunData data, Context context)
       {
  -        int col = data.getParameters().getInt("col",-1);
  -        int row = data.getParameters().getInt("row",-1);
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  -        if (columns==null) return;
  +        int col = data.getParameters().getInt("col", -1);
  +        int row = data.getParameters().getInt("row", -1);
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
  +        if (columns == null)
  +        {
  +            return;
  +        }
   
           if ((col > 0) && (row > -1))
           {
  -            move(columns, col, row, col-1, row);
  +            move(columns, col, row, col - 1, row);
           }
       }
   
       public void doRight(RunData data, Context context)
       {
  -        int col = data.getParameters().getInt("col",-1);
  -        int row = data.getParameters().getInt("row",-1);
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  -        if (columns==null) return;
  +        int col = data.getParameters().getInt("col", -1);
  +        int row = data.getParameters().getInt("row", -1);
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
  +        if (columns == null)
  +        {
  +            return;
  +        }
   
  -        if ((col > -1) && (row > -1) && (col < columns.length-1))
  +        if ((col > -1) && (row > -1) && (col < columns.length
- 1))
           {
  -            move(columns, col, row, col+1, row);
  +            move(columns, col, row, col + 1, row);
           }
       }
   
       public void doUp(RunData data, Context context)
       {
  -        int col = data.getParameters().getInt("col",-1);
  -        int row = data.getParameters().getInt("row",-1);
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  -        if (columns==null) return;
  +        int col = data.getParameters().getInt("col", -1);
  +        int row = data.getParameters().getInt("row", -1);
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
  +        if (columns == null)
  +        {
  +            return;
  +        }
   
           if ((col > -1) && (row > 0))
           {
  -            move(columns, col, row, col, row-1);
  +            move(columns, col, row, col, row - 1);
           }
       }
   
       public void doDown(RunData data, Context context)
       {
  -        int col = data.getParameters().getInt("col",-1);
  -        int row = data.getParameters().getInt("row",-1);
  -        List[] columns = (List[])data.getUser().getTemp("columns");
  -        if (columns==null) return;
  +        int col = data.getParameters().getInt("col", -1);
  +        int row = data.getParameters().getInt("row", -1);
  +        List[] columns = (List[]) data.getUser().getTemp("columns");
  +        if (columns == null)
  +        {
  +            return;
  +        }
   
  -        if ((col > -1) && (row > -1) && (row < columns[col].size()-1))
  +        if ((col > -1) && (row > -1) && (row < columns[col].size()
- 1))
           {
  -            move(columns, col, row, col, row+1);
  +            move(columns, col, row, col, row + 1);
           }
       }
   
       protected static void setPosition(IdentityElement identityElement, int col, int row)
       {
  -        boolean colFound=false,rowFound=false;
  +        boolean colFound = false;
  +        boolean rowFound = false;
   
           if (identityElement != null)
           {
               Layout layout = identityElement.getLayout();
   
  -            if (layout==null)
  +            if (layout == null)
               {
                   layout = new PsmlLayout();
                   identityElement.setLayout(layout);
               }
   
  -            for (int i=0; i < layout.getParameterCount(); i++)
  +            for (int i = 0; i < layout.getParameterCount(); i++)
               {
                   Parameter p = layout.getParameter(i);
   
  @@ -559,7 +571,7 @@
                   else if (p.getName().equals("row"))
                   {
                       p.setValue(String.valueOf(row));
  -                    rowFound=true;
  +                    rowFound = true;
                   }
               }
   
  @@ -588,19 +600,19 @@
           if ((oCol < cols.length) && (oRow < cols[oCol].size()))
           {
               obj = cols[oCol].get(oRow);
  -            if (obj!=null)
  +            if (obj != null)
               {
                   cols[oCol].remove(oRow);
               }
           }
   
  -        if (obj!=null)
  +        if (obj != null)
           {
               if (nCol < cols.length)
               {
                   if (nRow < cols[nCol].size())
                   {
  -                    cols[nCol].add(nRow,obj);
  +                    cols[nCol].add(nRow, obj);
                   }
                   else
                   {
  @@ -617,15 +629,15 @@
           int row = 0;
           int col = 0;
           int rowNum = 0;
  -        while(iterator.hasNext())
  +        while (iterator.hasNext())
           {
  -            Entry entry = (Entry)iterator.next();
  +            Entry entry = (Entry) iterator.next();
   
               Layout layout = entry.getLayout();
   
               if (layout != null)
               {
  -                for (int p=0; p < layout.getParameterCount(); p++)
  +                for (int p = 0; p < layout.getParameterCount(); p++)
                   {
                       Parameter prop = layout.getParameter(p);
   
  @@ -636,7 +648,7 @@
                               row = Integer.parseInt(prop.getValue());
                               if (row > rowNum)
                               {
  -                                rowNum =row;
  +                                rowNum = row;
                               }
                           }
                           else if (prop.getName().equals("column"))
  @@ -648,7 +660,7 @@
                               }
                           }
                       }
  -                    catch(Exception e)
  +                    catch (Exception e)
                       {
                           //ignore any malformed layout properties
                       }
  @@ -657,17 +669,17 @@
           }
   
           int sCount = set.getEntryCount();
  -        row = (sCount / colNum) +1;
  +        row = (sCount / colNum) + 1;
           if (row > rowNum)
           {
               rowNum = row;
           }
   
  -        Log.debug("Controller customize colNum: "+colNum+ " rowNum: "+rowNum);
  +        Log.debug("Controller customize colNum: " + colNum + " rowNum: " + rowNum);
           // initialize the result position table and the work list
           List[] table = new List[colNum];
  -        List filler = Collections.nCopies(rowNum+1,null);
  -        for (int i=0; i < colNum; i++)
  +        List filler = Collections.nCopies(rowNum + 1, null);
  +        for (int i = 0; i < colNum; i++)
           {
               table[i] = new ArrayList();
               table[i].addAll(filler);
  @@ -677,7 +689,7 @@
   
           //position the constrained elements and keep a reference to the
           //others
  -        for (int i=0; i < set.getEntryCount(); i++)
  +        for (int i = 0; i < set.getEntryCount(); i++)
           {
               Entry entry = set.getEntry(i);
               Layout layout = entry.getLayout();
  @@ -687,7 +699,7 @@
               {
                   try
                   {
  -                    for (int p=0; p < layout.getParameterCount(); p++)
  +                    for (int p = 0; p < layout.getParameterCount(); p++)
                       {
                           Parameter prop = layout.getParameter(p);
   
  @@ -701,16 +713,16 @@
                           }
                       }
                   }
  -                catch(Exception e)
  +                catch (Exception e)
                   {
                       //ignore any malformed layout properties
                   }
               }
   
  -            Log.debug("Constraints col "+col+" row "+row);
  -            if ( (row >= 0) && (col >= 0) && (col < colNum))
  +            Log.debug("Constraints col " + col + " row " + row);
  +            if ((row >= 0) && (col >= 0) && (col < colNum))
               {
  -                table[col].set(row,entry);
  +                table[col].set(row, entry);
               }
               else
               {
  @@ -729,35 +741,35 @@
           }
   
           // Add references
  -        for (int i=0; i < set.getReferenceCount(); i++)
  +        for (int i = 0; i < set.getReferenceCount(); i++)
           {
  -            work.add( set.getReference(i));
  +            work.add(set.getReference(i));
           }
   
           //insert the unconstrained elements in the table
  -        Iterator i=work.iterator();
  -        for (row=0; row < rowNum; row++)
  +        Iterator i = work.iterator();
  +        for (row = 0; row < rowNum; row++)
           {
  -            for (col=0; i.hasNext() && (col < colNum); col++)
  +            for (col = 0; i.hasNext() && (col < colNum); col++)
               {
  -                if (table[col].get(row)==null)
  +                if (table[col].get(row) == null)
                   {
  -                    Log.debug("Set portlet at col "+col+" row "+row);
  -                    table[col].set(row,i.next());
  +                    Log.debug("Set portlet at col " + col + " row " + row);
  +                    table[col].set(row, i.next());
                   }
               }
           }
   
           // now cleanup any remaining null elements
  -        for(int j=0; j < table.length; j++)
  +        for (int j = 0; j < table.length; j++)
           {
  -            Log.debug("Column "+j);
  +            Log.debug("Column " + j);
               i = table[j].iterator();
  -            while(i.hasNext())
  +            while (i.hasNext())
               {
                   Object obj = i.next();
  -                Log.debug("Element "+ obj);
  -                if (obj==null)
  +                Log.debug("Element " + obj);
  +                if (obj == null)
                   {
                       i.remove();
                   }
  @@ -778,9 +790,9 @@
       {
           List list = new Vector();
   
  -        if (sizelist!=null)
  +        if (sizelist != null)
           {
  -            StringTokenizer st = new StringTokenizer(sizelist,",");
  +            StringTokenizer st = new StringTokenizer(sizelist, ",");
               while (st.hasMoreTokens())
               {
                   list.add(st.nextToken());
  
  
  

--
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