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/portlets CustomizeSetAction.java
Date Mon, 12 Aug 2002 01:16:54 GMT
paulsp      2002/08/11 18:16:54

  Modified:    src/java/org/apache/jetspeed/modules/actions/controllers
                        MultiColumnControllerAction.java
               src/java/org/apache/jetspeed/modules/actions/portlets
                        CustomizeSetAction.java
  Log:
  Customizer now allows many refrerence.
  
  Revision  Changes    Path
  1.20      +3 -3      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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- MultiColumnControllerAction.java	11 Aug 2002 17:04:17 -0000	1.19
  +++ MultiColumnControllerAction.java	12 Aug 2002 01:16:54 -0000	1.20
  @@ -369,7 +369,7 @@
           profile.setDocument(null);
           profile.getDocument();
           
  -        exitCustomizer( data, context);
  +        exitCustomizer(data, context);
       }
   
       private void exitCustomizer(RunData data, Context context)
  @@ -433,7 +433,7 @@
               Log.error("Error while saving profile", e);
           }
   
  -        exitCustomizer( data, context);
  +        exitCustomizer(data, context);
       }
   
       public void doDelete(RunData data, Context context)
  @@ -679,7 +679,7 @@
               }
           }
   
  -        int sCount = set.getEntryCount();
  +        int sCount = set.getEntryCount() + set.getPortletsCount();
           row = (sCount / colNum) + 1;
           if (row > rowNum)
           {
  
  
  
  1.26      +85 -8     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
  
  Index: CustomizeSetAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CustomizeSetAction.java	8 Aug 2002 04:05:16 -0000	1.25
  +++ CustomizeSetAction.java	12 Aug 2002 01:16:54 -0000	1.26
  @@ -103,6 +103,7 @@
   // Java imports
   import java.util.ArrayList;
   import java.util.TreeMap;
  +import java.util.LinkedList;
   import java.util.List;
   import java.util.Iterator;
   import java.util.Collections;
  @@ -302,6 +303,8 @@
           {
               Iterator psmlIterator = null;
               psmlIterator = Profiler.query(new QueryLocator(QueryLocator.QUERY_ALL));
  +            
  +            // Set Start and End
               int start = rundata.getParameters().getInt("start", 0);                
               int size = 15;
                   
  @@ -314,23 +317,97 @@
               {
                   // ignore
               }
  + 
  +
  +            // Only include entries in compatibale with the Media-type/Country/Language
  +            List psmlList = new LinkedList();
  +            Profile refProfile = null;
  +            int profileCounter = 0;
  +            while (psmlIterator.hasNext())
  +            {
  +                refProfile = (Profile) psmlIterator.next();
  +                
  +                if (refProfile.getMediaType() != null)
  +                {
  +                    if (profile.getMediaType().equals(refProfile.getMediaType()) == false)
  +                    {
  +                        continue;
  +                    }
  +                }
                   
  -//            int end = Math.min(start+size, portlets.size());
  -            int end = Math.min(start + size, 100);
  +                if (profile.getLanguage() != null)
  +                {
  +                    if (refProfile.getLanguage() != null)
  +                    {
  +                        if (profile.getLanguage().equals(refProfile.getLanguage()) == true)
  +                        {
  +                            if (profile.getCountry() != null)
  +                            {
  +                                if (refProfile.getCountry() != null)
  +                                {
  +                                    if (profile.getCountry().equals(refProfile.getCountry())
== false)
  +                                    {
  +                                        // Profile and Ref are different countries
  +                                        continue;
  +                                    }
  +                                }
  +                            }
  +                            else
  +                            {
  +                                if (refProfile.getCountry() != null)
  +                                {
  +                                    // Profile has no country and Ref has a country
  +                                    continue;
  +                                }
  +                            }
  +                        }
  +                        else
  +                        {
  +                            // Profile and Ref are different languages
  +                            continue;
  +                        }
  +                    }
  +                }
  +                else
  +                {
  +                    if (refProfile.getLanguage() != null)
  +                    {
  +                        // Profile has no Language and Ref has a country
  +                        continue;
  +                    }
  +                }
                   
  +                if (profile.getPath().equals(refProfile.getPath()) == true)
  +                {
  +                    // Do not allow Profile to reference it self
  +                    continue;
  +                }
  +                
  +                // Only add profiles to list that will be displayed
  +                if (profileCounter >= (start+size))
  +                {
  +                    break;
  +                }
  +                if (profileCounter >= start)
  +                {
  +                    psmlList.add(refProfile);
  +                }
  +                profileCounter++;
  +            }
  +               
  +            // Add Start to context
               if (start > 0)
               {
                   context.put("prev", String.valueOf(Math.max(start - size, 0)));
               }
                   
  -//            if (start + size < portlets.size() )
  -            if (start + size < 100)
  +            // Set end to context
  +            if ((size == psmlList.size()) && (psmlIterator.hasNext()))
               {
                   context.put("next", String.valueOf(start + size));
               }
  -                
  -            //context.put("browser", portlets.subList(start,end));
  -            context.put("psml", psmlIterator);
  +            
  +            context.put("psml", psmlList.iterator());
           }
           else // build context for layout mode
           {
  
  
  

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