You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/11/14 16:23:52 UTC

cvs commit: xml-batik/sources/org/apache/batik/apps/svgbrowser LocalHistory.java

hillion     01/11/14 07:23:52

  Modified:    sources/org/apache/batik/apps/svgbrowser LocalHistory.java
  Log:
  Browser history's size now limited to 15.
  
  Revision  Changes    Path
  1.8       +12 -4     xml-batik/sources/org/apache/batik/apps/svgbrowser/LocalHistory.java
  
  Index: LocalHistory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/LocalHistory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LocalHistory.java	2001/04/19 15:10:34	1.7
  +++ LocalHistory.java	2001/11/14 15:23:52	1.8
  @@ -27,7 +27,7 @@
    * browser frame.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: LocalHistory.java,v 1.7 2001/04/19 15:10:34 hillion Exp $
  + * @version $Id: LocalHistory.java,v 1.8 2001/11/14 15:23:52 hillion Exp $
    */
   public class LocalHistory {
   
  @@ -164,10 +164,11 @@
           state = STABLE_STATE;
           if (++currentURI < visitedURIs.size()) {
               if (!visitedURIs.get(currentURI).equals(uri)) {
  -                for (int i = currentURI + 1; i + index < menu.getItemCount(); i++) {
  -                    JMenuItem mi = menu.getItem(index + i - 1);
  +                int len = menu.getItemCount();
  +                for (int i = len - 1; i >= index + currentURI + 1; i--) {
  +                    JMenuItem mi = menu.getItem(i);
                       group.remove(mi);
  -                    menu.remove(index + i - 1);
  +                    menu.remove(i);
                   }
                   visitedURIs = visitedURIs.subList(0, currentURI + 1);
               }
  @@ -176,6 +177,13 @@
               menu.remove(index + currentURI);
               visitedURIs.set(currentURI, uri);
           } else {
  +            if (visitedURIs.size() >= 15) {
  +                visitedURIs.remove(0);
  +                JMenuItem mi = menu.getItem(index);
  +                group.remove(mi);
  +                menu.remove(index);
  +                currentURI--;
  +            }
               visitedURIs.add(uri);
           }
   
  
  
  

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