portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view database-edit.vm database-view.vm
Date Thu, 20 Jan 2005 21:14:44 GMT
taylor      2005/01/20 13:14:44

  Modified:    applications/gems/src/java/org/apache/portals/gems/browser
                        DatabaseBrowserIterator.java ActionParameter.java
                        BrowserPortlet.java DatabaseBrowserPortlet.java
               applications/demo/src/webapp/WEB-INF/view database-edit.vm
                        database-view.vm
  Log:
  http://issues.apache.org/jira/browse/JS2-197
  finished basic browser
  im going to close this issue and future features can be done on a per feature/issue basic
  
  this commit:
  - fixes bug in windowSize prefs
  - new functionality for navigate to beginning and end of view, and navigate to a row number
  
  Revision  Changes    Path
  1.3       +2 -1      jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserIterator.java
  
  Index: DatabaseBrowserIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DatabaseBrowserIterator.java	13 Jan 2005 06:13:39 -0000	1.2
  +++ DatabaseBrowserIterator.java	20 Jan 2005 21:14:44 -0000	1.3
  @@ -31,6 +31,7 @@
    */
   public class DatabaseBrowserIterator implements BrowserIterator
   {
  +    private static final long serialVersionUID = 1;    
   
       /**
        * Static initialization of the logger for this class
  
  
  
  1.2       +2 -1      jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/ActionParameter.java
  
  Index: ActionParameter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/ActionParameter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionParameter.java	31 Dec 2004 23:59:09 -0000	1.1
  +++ ActionParameter.java	20 Jan 2005 21:14:44 -0000	1.2
  @@ -26,6 +26,7 @@
    */
   public class ActionParameter implements Serializable
   {
  +    private static final long serialVersionUID = 1;    
   
       String name;
   
  
  
  
  1.4       +35 -7     jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserPortlet.java
  
  Index: BrowserPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserPortlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BrowserPortlet.java	20 Jan 2005 06:24:37 -0000	1.3
  +++ BrowserPortlet.java	20 Jan 2005 21:14:44 -0000	1.4
  @@ -95,6 +95,10 @@
   
       protected static final String PREVIOUS = "prev";
   
  +    protected static final String FIRST = "first";
  +
  +    protected static final String LAST = "last";
  +    
       protected static final String VELOCITY_NULL_ENTRY = "-";
   
       // portlet entry Id
  @@ -134,9 +138,7 @@
           PortletPreferences prefs = request.getPreferences();
   
           windowSize = Integer.parseInt(prefs.getValue(WINDOW_SIZE, "10"));
  -        next = start + windowSize;
  -        prev = start - windowSize;
  -
  +        
           try
           {
               if (iterator == null)
  @@ -146,6 +148,7 @@
                   readUserParameters(request, context);
                   getRows(request, sql, windowSize);
                   iterator = getBrowserIterator(request);
  +                start = 0;
               } 
               else
               {
  @@ -153,16 +156,30 @@
                   {
                       iterator.sort(sortColName);
                   }
  -                iterator.setTop(start);
               }
   
  +            resultSetSize = iterator.getResultSetSize();                    
  +            if (start >= resultSetSize)
  +            {
  +                if ((start - windowSize) > 0)
  +                    start = resultSetSize - windowSize;
  +                else
  +                    start = 0;            
  +            }        
  +            next = start + windowSize;
  +            prev = start - windowSize;
  +            if (prev < 0 && start > 0)
  +               prev = 0;
  +            iterator.setTop(start);
  +            
  +            
               readLinkParameters(request, context);
   
               if (iterator != null)
               {
                   resultSetSize = iterator.getResultSetSize();
   
  -                if (next < resultSetSize)
  +                if (next <= resultSetSize)
                   {
                       context.put(NEXT, String.valueOf(next));
                   }
  @@ -175,7 +192,8 @@
                   context.put(BROWSER_TITLE_ITERATOR, iterator
                           .getResultSetTitleList());
                   context.put(BROWSER_TABLE_SIZE, new Integer(resultSetSize));
  -
  +                context.put(WINDOW_SIZE, new Integer(windowSize));
  +                context.put(START, new Integer(start));
                   /*
                    * System.out.println("buildNormalContext Sort column name=
                    * "+sortColName); System.out.println("buildNormalContext
  @@ -301,7 +319,17 @@
               String startStr = request.getParameter(attrName);
               if (startStr != null && startStr.length() > 0)
               {
  -                start = Integer.parseInt(startStr);
  +                try
  +                {
  +                    start = Integer.parseInt(startStr);                    
  +                }
  +                catch (Exception e)
  +                {
  +                    if (iterator != null)
  +                        start = iterator.getTop();
  +                    else
  +                        start = 0;
  +                }
               } else if (start == -1 && iterator != null)
               {
                   start = iterator.getTop();
  
  
  
  1.7       +4 -4      jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserPortlet.java
  
  Index: DatabaseBrowserPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserPortlet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DatabaseBrowserPortlet.java	20 Jan 2005 06:24:37 -0000	1.6
  +++ DatabaseBrowserPortlet.java	20 Jan 2005 21:14:44 -0000	1.7
  @@ -289,7 +289,7 @@
       throws PortletException, IOException
       {
           response.setContentType("text/html");
  -        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "dbConnectTest");
  +        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "DatabaseBrowserPortlet",
"dbConnectTest");
           if (msg != null)
           {
               this.getContext(request).put("statusMsg", msg);            
  @@ -313,7 +313,7 @@
                       prefs.store();                    
                       getConnection(request);
                       StatusMessage msg = new StatusMessage("Connection made successfully.",
StatusMessage.SUCCESS);                    
  -                    PortletMessaging.publish(request, "dbConnectTest", msg);          
         
  +                    PortletMessaging.publish(request, "DatabaseBrowserPortlet", "dbConnectTest",
msg);                    
                   }
                   catch (Exception e)
                   {
  @@ -324,7 +324,7 @@
                           msg = msg + ", " + cause.getMessage();
                       }
                       StatusMessage sm = new StatusMessage(msg, StatusMessage.ERROR);
  -                    PortletMessaging.publish(request, "dbConnectTest", sm);
  +                    PortletMessaging.publish(request, "DatabaseBrowserPortlet", "dbConnectTest",
sm);
                   }
                   response.setPortletMode(PortletMode.EDIT);
                   return;
  
  
  
  1.3       +1 -1      jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-edit.vm
  
  Index: database-edit.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-edit.vm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- database-edit.vm	20 Jan 2005 06:24:37 -0000	1.2
  +++ database-edit.vm	20 Jan 2005 21:14:44 -0000	1.3
  @@ -99,7 +99,7 @@
     <tr>
       <th class="portlet-section-alternate"><font class="portlet-form-field-label">$MESSAGES.getString("label.window.size")</font></th>
       <td>
  -      <input type="input" name="windowSize" value="$!prefsMap.get('windowSize')" size="5"
maxlength="5" class="portlet-form-field-label"/> 
  +      <input type="input" name="WindowSize" value="$!prefsMap.get('WindowSize')" size="5"
maxlength="5" class="portlet-form-field-label"/> 
       </td>
     </tr>
     <tr>
  
  
  
  1.4       +43 -4     jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-view.vm
  
  Index: database-view.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-view.vm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- database-view.vm	20 Jan 2005 06:24:37 -0000	1.3
  +++ database-view.vm	20 Jan 2005 21:14:44 -0000	1.4
  @@ -108,25 +108,64 @@
         <td valign="middle" height="30">
           <div align="center">
             <form action="$renderResponse.createActionURL()" method="post">
  +          	<input type='hidden' name='db.browser.action' value='first'/>        
           
  +            <input class="jetdbButton" type="submit" value="<<">
  +            <input type="hidden" name="start" value="0">
  +          </form>
  +        </div>
  +      </td>  
  +      <td valign="middle" height="30">
  +        <div align="center">
  +          <form action="$renderResponse.createActionURL()" method="post">
             	<input type='hidden' name='db.browser.action' value='prev'/>         
          
  -            <input class="jetdbButton" type="submit" value="$MESSAGES.getString('dbprev')">
  +            <input class="jetdbButton" type="submit" value="<">
               <input type="hidden" name="start" value="$prev">
             </form>
           </div>
         </td>
  -    <td width="50">&nbsp; </td>
       #end
  +    #if ($tableSize > 0)
  +      <form action="$renderResponse.createActionURL()" method="post">
  +      <td valign="middle" height="30">
  +        <div align="center">
  +          	<input type='hidden' name='db.browser.action' value='change'/>       
            
  +            <input type="input" name='start' size='5' value="$start">
  +        </div>
  +      </td>  
  +      <td valign="middle" height="30">
  +        <div align="center">
  +            <input type="input" readonly size='10' value="of $tableSize">       
    
  +        </div>
  +      </td>  
  +      <td valign="middle" height="30">
  +        <div align="center">
  +            <input class="jetdbButton" type="submit" value="Go">            
  +        </div>
  +      </td>  
  +
  +      </form>
  +
  +      
  +    #end    
       #if ($next)
         <td valign="middle">
           <div align="center">
             <form action="$renderResponse.createActionURL()" method="post">
             	<input type='hidden' name='db.browser.action' value='next'/>         

  -            <input class="jetdbButton" type="submit" value="$MESSAGES.getString('dbnext')">
  +            <input class="jetdbButton" type="submit" value=">">
               <input type="hidden" name="start" value="$next">
             </form>
           </div>
         </td>
  -      <td width="50">&nbsp; </td>
  +      <td valign="middle" height="30">
  +        <div align="center">
  +          <form action="$renderResponse.createActionURL()" method="post">
  +          	<input type='hidden' name='db.browser.action' value='last'/>         
          
  +            <input class="jetdbButton" type="submit" value=">>">
  +            <input type="hidden" name="start" value="$tableSize">
  +          </form>
  +        </div>
  +      </td>  
       #end
       #if ($tableSize > 0)
         <td valign="middle">
  
  
  

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


Mime
View raw message