Update of /cvsroot/xdoclet/xdoclet2/src/java/xdoclet/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv12630/src/java/xdoclet/gui

Modified Files:
        BeanContextTreeModel.java ValueHolder.java 
        ValueHolderFactory.java 
Log Message:
Removed the need for xdoclet-plugin.xml. All metadata is now in generated BeanInfo.

Index: BeanContextTreeModel.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet2/src/java/xdoclet/gui/BeanContextTreeModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** BeanContextTreeModel.java   13 Mar 2003 18:20:26 -0000      1.1
--- BeanContextTreeModel.java   16 Mar 2003 17:06:56 -0000      1.2
***************
*** 3,17 ****
  import xdoclet.BeanContextSupportEx;
  
- import javax.swing.tree.TreeModel;
- import javax.swing.tree.TreePath;
- import javax.swing.event.TreeModelListener;
  import javax.swing.event.EventListenerList;
  import javax.swing.event.TreeModelEvent;
! import java.util.ArrayList;
! import java.util.List;
! import java.util.Iterator;
  import java.beans.beancontext.BeanContext;
- import java.beans.beancontext.BeanContextMembershipListener;
  import java.beans.beancontext.BeanContextMembershipEvent;
  
  /**
--- 3,19 ----
  import xdoclet.BeanContextSupportEx;
  
  import javax.swing.event.EventListenerList;
  import javax.swing.event.TreeModelEvent;
! import javax.swing.event.TreeModelListener;
! import javax.swing.tree.TreeModel;
! import javax.swing.tree.TreePath;
! 
  import java.beans.beancontext.BeanContext;
  import java.beans.beancontext.BeanContextMembershipEvent;
+ import java.beans.beancontext.BeanContextMembershipListener;
+ 
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.List;
  
  /**
***************
*** 26,31 ****
      private EventListenerList listenerList = new EventListenerList();
  
!     public BeanContextTreeModel( BeanContextSupportEx root ) {
          _root = root;
          // We want to be notified when the content of a node changes,
          // so we can notify our own listeners (typically JTrees).
--- 28,34 ----
      private EventListenerList listenerList = new EventListenerList();
  
!     public BeanContextTreeModel(BeanContextSupportEx root) {
          _root = root;
+ 
          // We want to be notified when the content of a node changes,
          // so we can notify our own listeners (typically JTrees).
***************
*** 38,47 ****
  
      public Object getChild(Object parent, int index) {
!         return new ArrayList((BeanContext)parent).get(index);
      }
  
      public int getChildCount(Object parent) {
!         if( parent instanceof BeanContext) {
!             return ((BeanContext)parent).size();
          } else {
              return 0;
--- 41,50 ----
  
      public Object getChild(Object parent, int index) {
!         return new ArrayList((BeanContext) parent).get(index);
      }
  
      public int getChildCount(Object parent) {
!         if (parent instanceof BeanContext) {
!             return ((BeanContext) parent).size();
          } else {
              return 0;
***************
*** 57,61 ****
  
      public int getIndexOfChild(Object parent, Object child) {
!         return new ArrayList((BeanContext)parent).indexOf(child);
      }
  
--- 60,64 ----
  
      public int getIndexOfChild(Object parent, Object child) {
!         return new ArrayList((BeanContext) parent).indexOf(child);
      }
  
***************
*** 68,123 ****
      }
  
!     private void fireTreeNodesInserted(Object source, Object[] path,
!                                         int[] childIndices,
!                                         Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length-2; i>=0; i-=2) {
!             if (listeners[i]==TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null)
!                     e = new TreeModelEvent(source, path,
!                                            childIndices, children);
!                 ((TreeModelListener)listeners[i+1]).treeNodesInserted(e);
              }
          }
      }
!     private void fireTreeNodesRemoved(Object source, Object[] path,
!                                         int[] childIndices,
!                                         Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length-2; i>=0; i-=2) {
!             if (listeners[i]==TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null)
!                     e = new TreeModelEvent(source, path,
!                                            childIndices, children);
!                 ((TreeModelListener)listeners[i+1]).treeNodesRemoved(e);
              }
          }
      }
  
!     private void fireTreeNodesChanged(Object source, Object[] path,
!                                         int[] childIndices,
!                                         Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length-2; i>=0; i-=2) {
!             if (listeners[i]==TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null)
!                     e = new TreeModelEvent(source, path,
!                                            childIndices, children);
!                 ((TreeModelListener)listeners[i+1]).treeNodesChanged(e);
              }
          }
--- 71,127 ----
      }
  
!     private void fireTreeNodesInserted(Object source, Object[] path, int[] 
childIndices, Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
+ 
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length - 2; i >= 0; i -= 2) {
!             if (listeners[i] == TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null) {
!                     e = new TreeModelEvent(source, path, childIndices, children);
!                 }
! 
!                 ((TreeModelListener) listeners[i + 1]).treeNodesInserted(e);
              }
          }
      }
! 
!     private void fireTreeNodesRemoved(Object source, Object[] path, int[] 
childIndices, Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
+ 
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length - 2; i >= 0; i -= 2) {
!             if (listeners[i] == TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null) {
!                     e = new TreeModelEvent(source, path, childIndices, children);
!                 }
! 
!                 ((TreeModelListener) listeners[i + 1]).treeNodesRemoved(e);
              }
          }
      }
  
!     private void fireTreeNodesChanged(Object source, Object[] path, int[] 
childIndices, Object[] children) {
          // Guaranteed to return a non-null array
          Object[] listeners = listenerList.getListenerList();
          TreeModelEvent e = null;
+ 
          // Process the listeners last to first, notifying
          // those that are interested in this event
!         for (int i = listeners.length - 2; i >= 0; i -= 2) {
!             if (listeners[i] == TreeModelListener.class) {
                  // Lazily create the event:
!                 if (e == null) {
!                     e = new TreeModelEvent(source, path, childIndices, children);
!                 }
! 
!                 ((TreeModelListener) listeners[i + 1]).treeNodesChanged(e);
              }
          }
***************
*** 129,158 ****
  
      private BeanContextSupportEx[] getPathToRoot(BeanContextSupportEx aNode, int 
depth) {
!         BeanContextSupportEx[]              retNodes;
!       // This method recurses, traversing towards the root in order
!       // size the array. On the way back, it fills in the nodes,
!       // starting from the root and working back to the original node.
  
          /* Check for null, in case someone passed in a null node, or
             they passed in an element that isn't rooted at root. */
!         if(aNode == null) {
!             if(depth == 0)
                  return null;
!             else
                  retNodes = new BeanContextSupportEx[depth];
!         }
!         else {
              depth++;
!             if(aNode == getRoot())
                  retNodes = new BeanContextSupportEx[depth];
!             else
                  retNodes = getPathToRoot(aNode.getParent(), depth);
              retNodes[retNodes.length - depth] = aNode;
          }
          return retNodes;
      }
  
      public void childrenAdded(BeanContextMembershipEvent bcme) {
-         System.out.println("childrenAdded:");
          // Make a List out of the source bean context so that
          // we can find indices.
--- 133,166 ----
  
      private BeanContextSupportEx[] getPathToRoot(BeanContextSupportEx aNode, int 
depth) {
!         BeanContextSupportEx[] retNodes;
! 
!         // This method recurses, traversing towards the root in order
!         // size the array. On the way back, it fills in the nodes,
!         // starting from the root and working back to the original node.
  
          /* Check for null, in case someone passed in a null node, or
             they passed in an element that isn't rooted at root. */
!         if (aNode == null) {
!             if (depth == 0) {
                  return null;
!             } else {
                  retNodes = new BeanContextSupportEx[depth];
!             }
!         } else {
              depth++;
! 
!             if (aNode == getRoot()) {
                  retNodes = new BeanContextSupportEx[depth];
!             } else {
                  retNodes = getPathToRoot(aNode.getParent(), depth);
+             }
+ 
              retNodes[retNodes.length - depth] = aNode;
          }
+ 
          return retNodes;
      }
  
      public void childrenAdded(BeanContextMembershipEvent bcme) {
          // Make a List out of the source bean context so that
          // we can find indices.
***************
*** 161,171 ****
          Object[] added = bcme.toArray();
          int[] indices = new int[added.length];
-         for( int i = 0; i < indices.length; i++ ) {
-             indices[i] = beanContextList.indexOf( added[i] );
-             System.out.println("  child: " + added[ i ] + ":" + indices[i] );
  
!             listenForBeanContextMembershipEvents((BeanContextSupportEx)added[i]);
          }
!         fireTreeNodesInserted(this, 
getPathToRoot((BeanContextSupportEx)bcme.getBeanContext()), indices, added );
      }
  
--- 169,180 ----
          Object[] added = bcme.toArray();
          int[] indices = new int[added.length];
  
!         for (int i = 0; i < indices.length; i++) {
!             indices[i] = beanContextList.indexOf(added[i]);
! 
!             listenForBeanContextMembershipEvents((BeanContextSupportEx) added[i]);
          }
! 
!         fireTreeNodesInserted(this, getPathToRoot((BeanContextSupportEx) 
bcme.getBeanContext()), indices, added);
      }
  
***************
*** 177,183 ****
      private void listenForBeanContextMembershipEvents(BeanContextSupportEx bean) {
          bean.addBeanContextMembershipListener(this);
!         for( Iterator children = bean.iterator(); children.hasNext(); ) {
              BeanContextSupportEx child = (BeanContextSupportEx) children.next();
!             listenForBeanContextMembershipEvents( child );
          }
      }
--- 186,194 ----
      private void listenForBeanContextMembershipEvents(BeanContextSupportEx bean) {
          bean.addBeanContextMembershipListener(this);
! 
!         for (Iterator children = bean.iterator(); children.hasNext();) {
              BeanContextSupportEx child = (BeanContextSupportEx) children.next();
! 
!             listenForBeanContextMembershipEvents(child);
          }
      }

Index: ValueHolder.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet2/src/java/xdoclet/gui/ValueHolder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ValueHolder.java    13 Mar 2003 18:20:29 -0000      1.1
--- ValueHolder.java    16 Mar 2003 17:06:56 -0000      1.2
***************
*** 1,4 ****
--- 1,5 ----
  package xdoclet.gui;
  
+ 
  /**
   * Interface to be implemented by classes that hold arbitrary values.
***************
*** 9,13 ****
  public interface ValueHolder {
      Object getValue();
      void setValue(Object o);
  }
- 
--- 10,14 ----
  public interface ValueHolder {
      Object getValue();
+ 
      void setValue(Object o);
  }

Index: ValueHolderFactory.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet2/src/java/xdoclet/gui/ValueHolderFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ValueHolderFactory.java     13 Mar 2003 18:20:33 -0000      1.1
--- ValueHolderFactory.java     16 Mar 2003 17:06:56 -0000      1.2
***************
*** 1,4 ****
--- 1,5 ----
  package xdoclet.gui;
  
+ 
  /**
   *



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to