[Ejtools-cvs] libraries/adwt/src/main/org/ejtools/adwt AwtToolkit.java,1.4,1.5 BeanContextList.java,
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 10:42:46
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt In directory sc8-pr-cvs1:/tmp/cvs-serv19233/adwt/src/main/org/ejtools/adwt Modified Files: AwtToolkit.java BeanContextList.java BeanContextListModel.java BeanContextListPanel.java BeanContextTree.java BeanContextTreeModel.java BeanContextTreePanel.java GenericMethodDialog.java LookAndFeelUtil.java Log Message: Add more javadocs. Add package.html files. Index: AwtToolkit.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/AwtToolkit.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AwtToolkit.java 15 Sep 2003 22:37:12 -0000 1.4 --- AwtToolkit.java 13 Dec 2003 21:29:33 -0000 1.5 *************** *** 1,33 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Color; ! import java.awt.Font; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class AwtToolkit ! { ! /** Description of the Field */ ! public static Color DARK_BLUE = new Color(0, 0, 144); ! /** Description of the Field */ ! public static Color DARK_RED = new Color(144, 0, 0); ! ! /** Description of the Field */ ! public static Font FONT = new Font("SansSerif", Font.BOLD, 10); ! ! ! /** Constructor for AwtToolkit. */ ! private AwtToolkit() ! { ! super(); ! } ! } --- 1,33 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Color; ! import java.awt.Font; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class AwtToolkit ! { ! /** Description of the Field */ ! public static Color DARK_BLUE = new Color(0, 0, 144); ! /** Description of the Field */ ! public static Color DARK_RED = new Color(144, 0, 0); ! ! /** Description of the Field */ ! public static Font FONT = new Font("SansSerif", Font.BOLD, 10); ! ! ! /** Constructor for AwtToolkit. */ ! private AwtToolkit() ! { ! super(); ! } ! } Index: BeanContextList.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeanContextList.java 15 Sep 2003 22:37:12 -0000 1.1 --- BeanContextList.java 13 Dec 2003 21:29:33 -0000 1.2 *************** *** 1,29 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import javax.swing.JList; ! import javax.swing.ListModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextList extends JList ! { ! /** ! * Constructor for the BeanContextList object ! * ! * @param dataModel Description of the Parameter ! */ ! public BeanContextList(ListModel dataModel) ! { ! super(dataModel); ! } ! } --- 1,29 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import javax.swing.JList; ! import javax.swing.ListModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextList extends JList ! { ! /** ! * Constructor for the BeanContextList object ! * ! * @param dataModel Description of the Parameter ! */ ! public BeanContextList(ListModel dataModel) ! { ! super(dataModel); ! } ! } Index: BeanContextListModel.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextListModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeanContextListModel.java 15 Sep 2003 22:37:12 -0000 1.1 --- BeanContextListModel.java 13 Dec 2003 21:29:34 -0000 1.2 *************** *** 1,144 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextMembershipEvent; ! import java.beans.beancontext.BeanContextMembershipListener; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.ListModel; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextListModel implements ListModel, BeanContextMembershipListener ! { ! /** Description of the Field */ ! protected Collection listeners = new Vector(); ! /** Description of the Field */ ! protected BeanContext root; ! ! ! /** ! * Constructor for the BeanContextListModel object ! * ! * @param root Description of the Parameter ! */ ! public BeanContextListModel(BeanContext root) ! { ! this.root = root; ! this.root.addBeanContextMembershipListener(this); ! } ! ! ! /** ! * Adds a feature to the ListDataListener attribute of the ! * BeanContextListModel object ! * ! * @param l The feature to be added to the ListDataListener attribute ! */ ! public void addListDataListener(ListDataListener l) ! { ! this.listeners.add(l); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenAdded(BeanContextMembershipEvent bcme) ! { ! this.fireContentsChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenRemoved(BeanContextMembershipEvent bcme) ! { ! this.fireContentsChanged(); ! } ! ! ! /** ! * Gets the elementAt attribute of the BeanContextListModel object ! * ! * @param index Description of the Parameter ! * @return The elementAt value ! */ ! public Object getElementAt(int index) ! { ! int i = 0; ! Object result = null; ! for (Iterator it = this.root.iterator(); it.hasNext(); i++) ! { ! result = it.next(); ! if (i == index) ! { ! break; ! } ! result = null; ! } ! return result; ! } ! ! ! /** ! * Gets the size attribute of the BeanContextListModel object ! * ! * @return The size value ! */ ! public int getSize() ! { ! return root.size(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param l Description of the Parameter ! */ ! public void removeListDataListener(ListDataListener l) ! { ! this.listeners.remove(l); ! } ! ! ! /** Description of the Method */ ! protected void fireContentsChanged() ! { ! ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, this.root.size()); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! ListDataListener listener = (ListDataListener) copy[i]; ! listener.contentsChanged(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireIntervalAdded() { } ! ! ! /** Description of the Method */ ! protected void fireIntervalRemoved() { } ! } --- 1,144 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextMembershipEvent; ! import java.beans.beancontext.BeanContextMembershipListener; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.ListModel; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextListModel implements ListModel, BeanContextMembershipListener ! { ! /** Description of the Field */ ! protected Collection listeners = new Vector(); ! /** Description of the Field */ ! protected BeanContext root; ! ! ! /** ! * Constructor for the BeanContextListModel object ! * ! * @param root Description of the Parameter ! */ ! public BeanContextListModel(BeanContext root) ! { ! this.root = root; ! this.root.addBeanContextMembershipListener(this); ! } ! ! ! /** ! * Adds a feature to the ListDataListener attribute of the ! * BeanContextListModel object ! * ! * @param l The feature to be added to the ListDataListener attribute ! */ ! public void addListDataListener(ListDataListener l) ! { ! this.listeners.add(l); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenAdded(BeanContextMembershipEvent bcme) ! { ! this.fireContentsChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenRemoved(BeanContextMembershipEvent bcme) ! { ! this.fireContentsChanged(); ! } ! ! ! /** ! * Gets the elementAt attribute of the BeanContextListModel object ! * ! * @param index Description of the Parameter ! * @return The elementAt value ! */ ! public Object getElementAt(int index) ! { ! int i = 0; ! Object result = null; ! for (Iterator it = this.root.iterator(); it.hasNext(); i++) ! { ! result = it.next(); ! if (i == index) ! { ! break; ! } ! result = null; ! } ! return result; ! } ! ! ! /** ! * Gets the size attribute of the BeanContextListModel object ! * ! * @return The size value ! */ ! public int getSize() ! { ! return root.size(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param l Description of the Parameter ! */ ! public void removeListDataListener(ListDataListener l) ! { ! this.listeners.remove(l); ! } ! ! ! /** Description of the Method */ ! protected void fireContentsChanged() ! { ! ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, this.root.size()); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! ListDataListener listener = (ListDataListener) copy[i]; ! listener.contentsChanged(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireIntervalAdded() { } ! ! ! /** Description of the Method */ ! protected void fireIntervalRemoved() { } ! } Index: BeanContextListPanel.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextListPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BeanContextListPanel.java 15 Sep 2003 22:37:12 -0000 1.4 --- BeanContextListPanel.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,143 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Dimension; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! import javax.swing.BorderFactory; ! import javax.swing.JLabel; ! import javax.swing.JList; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JSplitPane; ! import javax.swing.ListModel; ! import javax.swing.SwingUtilities; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! import javax.swing.event.ListSelectionEvent; ! import javax.swing.event.ListSelectionListener; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextListPanel extends JSplitPane ! { ! /** Description of the Field */ ! protected JList list; ! ! ! /** ! * Constructor for the BeanContextListPanel object ! * ! * @param beancontext Description of Parameter ! */ ! public BeanContextListPanel(BeanContext beancontext) ! { ! this(beancontext, null); ! } ! ! ! /** ! * Constructor for the BeanContextListPanel object ! * ! * @param beancontext Description of Parameter ! * @param s Description of Parameter ! */ ! public BeanContextListPanel(BeanContext beancontext, String s) ! { ! super(1); ! if (s != null) ! { ! setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), s)); ! } ! list = new BeanContextListView(beancontext); ! JScrollPane jscrollpane = new JScrollPane(list); ! jscrollpane.setMinimumSize(new Dimension(200, 300)); ! jscrollpane.setPreferredSize(new Dimension(200, 300)); ! final JPanel dummyMsg = new JPanel(); ! dummyMsg.add(new JLabel("", 0)); ! setLeftComponent(jscrollpane); ! setRightComponent(dummyMsg); ! list.addListSelectionListener( ! new ListSelectionListener() ! { ! ! public void valueChanged(ListSelectionEvent e) ! { ! if (e.getValueIsAdjusting()) ! { ! return; ! } ! final int index = list.getSelectedIndex(); ! final ListModel model = list.getModel(); ! SwingUtilities.invokeLater( ! new Runnable() ! { ! ! public void run() ! { ! try ! { ! Object obj = ((BeanContextListView.ContextElement) model.getElementAt(index)).getUserObject(); ! if (obj instanceof BeanContextChildComponentProxy) ! { ! BeanContextChildComponentProxy beancontextchildcomponentproxy = (BeanContextChildComponentProxy) obj; ! setRightComponent(beancontextchildcomponentproxy.getComponent()); ! } ! else ! if (obj instanceof BeanContextContainerProxy) ! { ! BeanContextContainerProxy beancontextcontainerproxy = (BeanContextContainerProxy) obj; ! setRightComponent(beancontextcontainerproxy.getContainer()); ! } ! validate(); ! } ! catch (Exception _ex) ! { ! } ! } ! ! }); ! } ! ! }); ! list.getModel().addListDataListener( ! new ListDataListener() ! { ! ! public void contentsChanged(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! ! ! public void intervalAdded(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! ! ! public void intervalRemoved(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! }); ! } ! } ! --- 1,143 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Dimension; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! import javax.swing.BorderFactory; ! import javax.swing.JLabel; ! import javax.swing.JList; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JSplitPane; ! import javax.swing.ListModel; ! import javax.swing.SwingUtilities; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! import javax.swing.event.ListSelectionEvent; ! import javax.swing.event.ListSelectionListener; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextListPanel extends JSplitPane ! { ! /** Description of the Field */ ! protected JList list; ! ! ! /** ! * Constructor for the BeanContextListPanel object ! * ! * @param beancontext Description of Parameter ! */ ! public BeanContextListPanel(BeanContext beancontext) ! { ! this(beancontext, null); ! } ! ! ! /** ! * Constructor for the BeanContextListPanel object ! * ! * @param beancontext Description of Parameter ! * @param s Description of Parameter ! */ ! public BeanContextListPanel(BeanContext beancontext, String s) ! { ! super(1); ! if (s != null) ! { ! setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), s)); ! } ! list = new BeanContextListView(beancontext); ! JScrollPane jscrollpane = new JScrollPane(list); ! jscrollpane.setMinimumSize(new Dimension(200, 300)); ! jscrollpane.setPreferredSize(new Dimension(200, 300)); ! final JPanel dummyMsg = new JPanel(); ! dummyMsg.add(new JLabel("", 0)); ! setLeftComponent(jscrollpane); ! setRightComponent(dummyMsg); ! list.addListSelectionListener( ! new ListSelectionListener() ! { ! ! public void valueChanged(ListSelectionEvent e) ! { ! if (e.getValueIsAdjusting()) ! { ! return; ! } ! final int index = list.getSelectedIndex(); ! final ListModel model = list.getModel(); ! SwingUtilities.invokeLater( ! new Runnable() ! { ! ! public void run() ! { ! try ! { ! Object obj = ((BeanContextListView.ContextElement) model.getElementAt(index)).getUserObject(); ! if (obj instanceof BeanContextChildComponentProxy) ! { ! BeanContextChildComponentProxy beancontextchildcomponentproxy = (BeanContextChildComponentProxy) obj; ! setRightComponent(beancontextchildcomponentproxy.getComponent()); ! } ! else ! if (obj instanceof BeanContextContainerProxy) ! { ! BeanContextContainerProxy beancontextcontainerproxy = (BeanContextContainerProxy) obj; ! setRightComponent(beancontextcontainerproxy.getContainer()); ! } ! validate(); ! } ! catch (Exception _ex) ! { ! } ! } ! ! }); ! } ! ! }); ! list.getModel().addListDataListener( ! new ListDataListener() ! { ! ! public void contentsChanged(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! ! ! public void intervalAdded(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! ! ! public void intervalRemoved(ListDataEvent e) ! { ! list.clearSelection(); ! setRightComponent(dummyMsg); ! validate(); ! } ! }); ! } ! } ! Index: BeanContextTree.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextTree.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeanContextTree.java 15 Sep 2003 22:37:12 -0000 1.1 --- BeanContextTree.java 13 Dec 2003 21:29:34 -0000 1.2 *************** *** 1,137 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Component; ! ! import javax.swing.Icon; ! import javax.swing.JTree; ! import javax.swing.tree.DefaultTreeCellRenderer; ! import javax.swing.tree.TreePath; ! ! import org.ejtools.adwt.util.DefaultObjectRenderer; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.ObjectRenderer; ! import org.ejtools.adwt.util.ObjectSearcher; ! import org.ejtools.adwt.util.SearchableTreeModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextTree extends JTree implements ObjectSearcher ! { ! /** Description of the Field */ ! protected ObjectRenderer renderer = new DefaultObjectRenderer(); ! ! ! /** ! * Constructor for the BeanContextTree object ! * ! * @param newModel Description of the Parameter ! */ ! public BeanContextTree(SearchableTreeModel newModel) ! { ! super(newModel); ! ! this.setShowsRootHandles(true); ! this.setExpandsSelectedPaths(true); ! this.putClientProperty("JTree.lineStyle", "Angled"); ! ! this.setCellRenderer( ! new DefaultTreeCellRenderer() ! { ! public Component getTreeCellRendererComponent(JTree jtree, Object obj, boolean flag, boolean flag1, boolean flag2, int i, boolean flag3) ! { ! try ! { ! Icon leafIcon = null; ! Icon openIcon = null; ! Icon closedIcon = null; ! ! Icon newIcon = BeanContextTree.this.renderer.getIcon(obj); ! ! if (newIcon != null) ! { ! leafIcon = this.getLeafIcon(); ! openIcon = this.getOpenIcon(); ! closedIcon = this.getClosedIcon(); ! this.setLeafIcon(newIcon); ! this.setOpenIcon(newIcon); ! this.setClosedIcon(newIcon); ! } ! ! super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); ! ! if (newIcon != null) ! { ! this.setLeafIcon(leafIcon); ! this.setOpenIcon(openIcon); ! this.setClosedIcon(closedIcon); ! } ! ! return this; ! } ! catch (Exception e) ! { ! return super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); ! } ! } ! }); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! Object r = ((SearchableTreeModel) this.getModel()).find(o); ! if (r != null) ! { ! Object[] paths = (Object[]) r; ! TreePath path = new TreePath(paths); ! this.setSelectionPath(path); ! } ! return null; ! } ! ! ! /** Description of the Method */ ! public void selectRoot() ! { ! TreePath path = new TreePath(this.getModel().getRoot()); ! this.setSelectionPath(path); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTree object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! ((SearchableTreeModel) this.getModel()).setIndexer(indexer); ! } ! ! ! /** ! * Sets the renderer attribute of the BeanContextTree object ! * ! * @param renderer The new renderer value ! */ ! public void setRenderer(ObjectRenderer renderer) ! { ! this.renderer = renderer; ! } ! } --- 1,137 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Component; ! ! import javax.swing.Icon; ! import javax.swing.JTree; ! import javax.swing.tree.DefaultTreeCellRenderer; ! import javax.swing.tree.TreePath; ! ! import org.ejtools.adwt.util.DefaultObjectRenderer; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.ObjectRenderer; ! import org.ejtools.adwt.util.ObjectSearcher; ! import org.ejtools.adwt.util.SearchableTreeModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextTree extends JTree implements ObjectSearcher ! { ! /** Description of the Field */ ! protected ObjectRenderer renderer = new DefaultObjectRenderer(); ! ! ! /** ! * Constructor for the BeanContextTree object ! * ! * @param newModel Description of the Parameter ! */ ! public BeanContextTree(SearchableTreeModel newModel) ! { ! super(newModel); ! ! this.setShowsRootHandles(true); ! this.setExpandsSelectedPaths(true); ! this.putClientProperty("JTree.lineStyle", "Angled"); ! ! this.setCellRenderer( ! new DefaultTreeCellRenderer() ! { ! public Component getTreeCellRendererComponent(JTree jtree, Object obj, boolean flag, boolean flag1, boolean flag2, int i, boolean flag3) ! { ! try ! { ! Icon leafIcon = null; ! Icon openIcon = null; ! Icon closedIcon = null; ! ! Icon newIcon = BeanContextTree.this.renderer.getIcon(obj); ! ! if (newIcon != null) ! { ! leafIcon = this.getLeafIcon(); ! openIcon = this.getOpenIcon(); ! closedIcon = this.getClosedIcon(); ! this.setLeafIcon(newIcon); ! this.setOpenIcon(newIcon); ! this.setClosedIcon(newIcon); ! } ! ! super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); ! ! if (newIcon != null) ! { ! this.setLeafIcon(leafIcon); ! this.setOpenIcon(openIcon); ! this.setClosedIcon(closedIcon); ! } ! ! return this; ! } ! catch (Exception e) ! { ! return super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); ! } ! } ! }); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! Object r = ((SearchableTreeModel) this.getModel()).find(o); ! if (r != null) ! { ! Object[] paths = (Object[]) r; ! TreePath path = new TreePath(paths); ! this.setSelectionPath(path); ! } ! return null; ! } ! ! ! /** Description of the Method */ ! public void selectRoot() ! { ! TreePath path = new TreePath(this.getModel().getRoot()); ! this.setSelectionPath(path); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTree object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! ((SearchableTreeModel) this.getModel()).setIndexer(indexer); ! } ! ! ! /** ! * Sets the renderer attribute of the BeanContextTree object ! * ! * @param renderer The new renderer value ! */ ! public void setRenderer(ObjectRenderer renderer) ! { ! this.renderer = renderer; ! } ! } Index: BeanContextTreeModel.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextTreeModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeanContextTreeModel.java 15 Sep 2003 22:37:12 -0000 1.1 --- BeanContextTreeModel.java 13 Dec 2003 21:29:34 -0000 1.2 *************** *** 1,321 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextMembershipEvent; ! import java.beans.beancontext.BeanContextMembershipListener; ! import java.util.ArrayList; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.event.TreeModelEvent; ! import javax.swing.event.TreeModelListener; ! import javax.swing.tree.TreePath; ! ! import org.ejtools.adwt.util.DefaultObjectIndexer; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.SearchableTreeModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextTreeModel implements SearchableTreeModel, BeanContextMembershipListener ! { ! /** Description of the Field */ ! protected Collection contexts = new Vector(); ! /** Description of the Field */ ! protected ObjectIndexer indexer = new DefaultObjectIndexer(); ! /** Description of the Field */ ! protected Collection listeners = new Vector(); ! /** Root of the tree. */ ! protected BeanContext root; ! ! ! /** ! * Constructor for the BeanContextTreeModel object ! * ! * @param root Description of the Parameter ! */ ! public BeanContextTreeModel(BeanContext root) ! { ! this.root = root; ! this.root.addBeanContextMembershipListener(this); ! } ! ! ! /** ! * Adds a feature to the TreeModelListener attribute of the ! * BeanContextTreeModel object ! * ! * @param tml The feature to be added to the TreeModelListener attribute ! */ ! public void addTreeModelListener(TreeModelListener tml) ! { ! this.listeners.add(tml); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenAdded(BeanContextMembershipEvent bcme) ! { ! for (Iterator it = bcme.iterator(); it.hasNext(); ) ! { ! Object o = it.next(); ! if (o instanceof BeanContext) ! { ! BeanContext context = (BeanContext) o; ! if (!contexts.contains(context)) ! { ! contexts.add(context); ! context.addBeanContextMembershipListener(this); ! } ! } ! this.indexer.put(o, computePath(bcme.getBeanContext(), o)); ! } ! this.fireTreeStructureChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenRemoved(BeanContextMembershipEvent bcme) ! { ! for (Iterator it = bcme.iterator(); it.hasNext(); ) ! { ! Object o = it.next(); ! if (o instanceof BeanContext) ! { ! BeanContext context = (BeanContext) o; ! if (contexts.contains(context)) ! { ! context.removeBeanContextMembershipListener(this); ! contexts.remove(context); ! } ! } ! this.indexer.remove(o); ! } ! this.fireTreeStructureChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! return this.indexer.get(o); ! } ! ! ! /** ! * Gets the child attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @param index Description of the Parameter ! * @return The child value ! */ ! public Object getChild(Object parent, int index) ! { ! Collection c = (Collection) parent; ! int i = 0; ! Object result = null; ! for (Iterator it = c.iterator(); it.hasNext(); i++) ! { ! result = it.next(); ! if (i == index) ! { ! break; ! } ! result = null; ! } ! return result; ! } ! ! ! /** ! * Gets the childCount attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @return The childCount value ! */ ! public int getChildCount(Object parent) ! { ! Collection c = (Collection) parent; ! return c.size(); ! } ! ! ! /** ! * Gets the indexOfChild attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @param child Description of the Parameter ! * @return The indexOfChild value ! */ ! public int getIndexOfChild(Object parent, Object child) ! { ! Collection c = (Collection) parent; ! int i = 0; ! int index = -1; ! for (Iterator it = c.iterator(); it.hasNext(); i++) ! { ! if (it.next().equals(child)) ! { ! index = i; ! break; ! } ! } ! return index; ! } ! ! ! /** ! * Gets the root attribute of the BeanContextTreeModel object ! * ! * @return The root value ! */ ! public Object getRoot() ! { ! return this.root; ! } ! ! ! /** ! * Gets the leaf attribute of the BeanContextTreeModel object ! * ! * @param node Description of the Parameter ! * @return The leaf value ! */ ! public boolean isLeaf(Object node) ! { ! Collection c = (Collection) node; ! return (c.size() == 0); ! } ! ! ! /** ! * Description of the Method ! * ! * @param tml Description of the Parameter ! */ ! public void removeTreeModelListener(TreeModelListener tml) ! { ! this.listeners.remove(tml); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTreeModel object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! this.indexer = indexer; ! } ! ! ! /** ! * Description of the Method ! * ! * @param path Description of the Parameter ! * @param newValue Description of the Parameter ! */ ! public void valueForPathChanged(TreePath path, Object newValue) ! { ! throw new UnsupportedOperationException("Not yet implemented"); ! } ! ! ! /** ! * Description of the Method ! * ! * @param parent Description of the Parameter ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! protected Object[] computePath(BeanContext parent, Object o) ! { ! ArrayList paths = new ArrayList(); ! BeanContext current = parent; ! paths.add(parent); ! paths.add(o); ! while (this.root.equals(current.getBeanContext())) ! { ! current = current.getBeanContext(); ! paths.add(0, current); ! } ! return paths.toArray(); ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesChanged() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesChanged(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesInserted() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesInserted(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesRemoved() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesRemoved(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeStructureChanged() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeStructureChanged(event); ! } ! } ! } --- 1,321 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextMembershipEvent; ! import java.beans.beancontext.BeanContextMembershipListener; ! import java.util.ArrayList; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.event.TreeModelEvent; ! import javax.swing.event.TreeModelListener; ! import javax.swing.tree.TreePath; ! ! import org.ejtools.adwt.util.DefaultObjectIndexer; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.SearchableTreeModel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class BeanContextTreeModel implements SearchableTreeModel, BeanContextMembershipListener ! { ! /** Description of the Field */ ! protected Collection contexts = new Vector(); ! /** Description of the Field */ ! protected ObjectIndexer indexer = new DefaultObjectIndexer(); ! /** Description of the Field */ ! protected Collection listeners = new Vector(); ! /** Root of the tree. */ ! protected BeanContext root; ! ! ! /** ! * Constructor for the BeanContextTreeModel object ! * ! * @param root Description of the Parameter ! */ ! public BeanContextTreeModel(BeanContext root) ! { ! this.root = root; ! this.root.addBeanContextMembershipListener(this); ! } ! ! ! /** ! * Adds a feature to the TreeModelListener attribute of the ! * BeanContextTreeModel object ! * ! * @param tml The feature to be added to the TreeModelListener attribute ! */ ! public void addTreeModelListener(TreeModelListener tml) ! { ! this.listeners.add(tml); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenAdded(BeanContextMembershipEvent bcme) ! { ! for (Iterator it = bcme.iterator(); it.hasNext(); ) ! { ! Object o = it.next(); ! if (o instanceof BeanContext) ! { ! BeanContext context = (BeanContext) o; ! if (!contexts.contains(context)) ! { ! contexts.add(context); ! context.addBeanContextMembershipListener(this); ! } ! } ! this.indexer.put(o, computePath(bcme.getBeanContext(), o)); ! } ! this.fireTreeStructureChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcme Description of the Parameter ! */ ! public void childrenRemoved(BeanContextMembershipEvent bcme) ! { ! for (Iterator it = bcme.iterator(); it.hasNext(); ) ! { ! Object o = it.next(); ! if (o instanceof BeanContext) ! { ! BeanContext context = (BeanContext) o; ! if (contexts.contains(context)) ! { ! context.removeBeanContextMembershipListener(this); ! contexts.remove(context); ! } ! } ! this.indexer.remove(o); ! } ! this.fireTreeStructureChanged(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! return this.indexer.get(o); ! } ! ! ! /** ! * Gets the child attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @param index Description of the Parameter ! * @return The child value ! */ ! public Object getChild(Object parent, int index) ! { ! Collection c = (Collection) parent; ! int i = 0; ! Object result = null; ! for (Iterator it = c.iterator(); it.hasNext(); i++) ! { ! result = it.next(); ! if (i == index) ! { ! break; ! } ! result = null; ! } ! return result; ! } ! ! ! /** ! * Gets the childCount attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @return The childCount value ! */ ! public int getChildCount(Object parent) ! { ! Collection c = (Collection) parent; ! return c.size(); ! } ! ! ! /** ! * Gets the indexOfChild attribute of the BeanContextTreeModel object ! * ! * @param parent Description of the Parameter ! * @param child Description of the Parameter ! * @return The indexOfChild value ! */ ! public int getIndexOfChild(Object parent, Object child) ! { ! Collection c = (Collection) parent; ! int i = 0; ! int index = -1; ! for (Iterator it = c.iterator(); it.hasNext(); i++) ! { ! if (it.next().equals(child)) ! { ! index = i; ! break; ! } ! } ! return index; ! } ! ! ! /** ! * Gets the root attribute of the BeanContextTreeModel object ! * ! * @return The root value ! */ ! public Object getRoot() ! { ! return this.root; ! } ! ! ! /** ! * Gets the leaf attribute of the BeanContextTreeModel object ! * ! * @param node Description of the Parameter ! * @return The leaf value ! */ ! public boolean isLeaf(Object node) ! { ! Collection c = (Collection) node; ! return (c.size() == 0); ! } ! ! ! /** ! * Description of the Method ! * ! * @param tml Description of the Parameter ! */ ! public void removeTreeModelListener(TreeModelListener tml) ! { ! this.listeners.remove(tml); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTreeModel object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! this.indexer = indexer; ! } ! ! ! /** ! * Description of the Method ! * ! * @param path Description of the Parameter ! * @param newValue Description of the Parameter ! */ ! public void valueForPathChanged(TreePath path, Object newValue) ! { ! throw new UnsupportedOperationException("Not yet implemented"); ! } ! ! ! /** ! * Description of the Method ! * ! * @param parent Description of the Parameter ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! protected Object[] computePath(BeanContext parent, Object o) ! { ! ArrayList paths = new ArrayList(); ! BeanContext current = parent; ! paths.add(parent); ! paths.add(o); ! while (this.root.equals(current.getBeanContext())) ! { ! current = current.getBeanContext(); ! paths.add(0, current); ! } ! return paths.toArray(); ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesChanged() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesChanged(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesInserted() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesInserted(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeNodesRemoved() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeNodesRemoved(event); ! } ! } ! ! ! /** Description of the Method */ ! protected void fireTreeStructureChanged() ! { ! TreeModelEvent event = new TreeModelEvent(this, new TreePath(this.root)); ! Object[] copy = this.listeners.toArray(); ! for (int i = 0; i < copy.length; i++) ! { ! TreeModelListener listener = (TreeModelListener) copy[i]; ! listener.treeStructureChanged(event); ! } ! } ! } Index: BeanContextTreePanel.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/BeanContextTreePanel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BeanContextTreePanel.java 15 Sep 2003 22:37:12 -0000 1.8 --- BeanContextTreePanel.java 13 Dec 2003 21:29:34 -0000 1.9 *************** *** 1,165 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Dimension; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! import javax.swing.BorderFactory; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JSplitPane; ! import javax.swing.SwingUtilities; ! import javax.swing.event.TreeModelEvent; ! import javax.swing.event.TreeSelectionEvent; ! import javax.swing.event.TreeSelectionListener; ! import javax.swing.tree.TreePath; ! ! import org.apache.log4j.lf5.viewer.categoryexplorer.TreeModelAdapter; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.ObjectRenderer; ! import org.ejtools.adwt.util.ObjectSearcher; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BeanContextTreePanel extends JSplitPane implements ObjectSearcher ! { ! /** Description of the Field */ ! protected BeanContextTree tree; ! ! ! /** ! * Constructor for the BeanContextPanel object ! * ! * @param beancontext Description of Parameter ! */ ! public BeanContextTreePanel(BeanContext beancontext) ! { ! this(beancontext, null); ! } ! ! ! /** ! * Constructor for the BeanContextPanel object ! * ! * @param beancontext Description of Parameter ! * @param title Description of the Parameter ! */ ! public BeanContextTreePanel(BeanContext beancontext, String title) ! { ! super(JSplitPane.HORIZONTAL_SPLIT); ! if (title != null) ! { ! this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title)); ! } ! BeanContextTreeModel model = new BeanContextTreeModel(beancontext); ! this.tree = new BeanContextTree(model); ! ! JScrollPane jscrollpane = new JScrollPane(tree); ! jscrollpane.setMinimumSize(new Dimension(200, 200)); ! jscrollpane.setPreferredSize(new Dimension(300, 400)); ! ! final JPanel dummyMsg = new JPanel(); ! dummyMsg.add(new JLabel("")); ! ! this.setLeftComponent(jscrollpane); ! this.setRightComponent(dummyMsg); ! ! this.tree.addTreeSelectionListener( ! new TreeSelectionListener() ! { ! public void valueChanged(TreeSelectionEvent treeselectionevent) ! { ! final TreePath selPath = treeselectionevent.getNewLeadSelectionPath(); ! SwingUtilities.invokeLater( ! new Runnable() ! { ! public void run() ! { ! try ! { ! Object obj = selPath.getLastPathComponent(); ! if (obj instanceof BeanContextChildComponentProxy) ! { ! BeanContextChildComponentProxy beancontextchildcomponentproxy = (BeanContextChildComponentProxy) obj; ! BeanContextTreePanel.this.setRightComponent(beancontextchildcomponentproxy.getComponent()); ! } ! else if (obj instanceof BeanContextContainerProxy) ! { ! BeanContextContainerProxy beancontextcontainerproxy = (BeanContextContainerProxy) obj; ! BeanContextTreePanel.this.setRightComponent(beancontextcontainerproxy.getContainer()); ! } ! BeanContextTreePanel.this.validate(); ! } ! catch (Exception e) ! { ! // Ignore it ! } ! } ! }); ! } ! }); ! ! this.tree.getModel().addTreeModelListener( ! new TreeModelAdapter() ! { ! public void treeNodesRemoved(TreeModelEvent treemodelevent) ! { ! BeanContextTreePanel.this.selectRoot(); ! } ! }); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! return this.tree.find(o); ! } ! ! ! /** Description of the Method */ ! public void selectRoot() ! { ! this.tree.selectRoot(); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTreePanel2 object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! this.tree.setIndexer(indexer); ! } ! ! ! /** ! * Sets the renderer attribute of the BeanContextTreePanel object ! * ! * @param renderer The new renderer value ! */ ! public void setRenderer(ObjectRenderer renderer) ! { ! this.tree.setRenderer(renderer); ! } ! } --- 1,165 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Dimension; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! import javax.swing.BorderFactory; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JSplitPane; ! import javax.swing.SwingUtilities; ! import javax.swing.event.TreeModelEvent; ! import javax.swing.event.TreeSelectionEvent; ! import javax.swing.event.TreeSelectionListener; ! import javax.swing.tree.TreePath; ! ! import org.apache.log4j.lf5.viewer.categoryexplorer.TreeModelAdapter; ! import org.ejtools.adwt.util.ObjectIndexer; ! import org.ejtools.adwt.util.ObjectRenderer; ! import org.ejtools.adwt.util.ObjectSearcher; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BeanContextTreePanel extends JSplitPane implements ObjectSearcher ! { ! /** Description of the Field */ ! protected BeanContextTree tree; ! ! ! /** ! * Constructor for the BeanContextPanel object ! * ! * @param beancontext Description of Parameter ! */ ! public BeanContextTreePanel(BeanContext beancontext) ! { ! this(beancontext, null); ! } ! ! ! /** ! * Constructor for the BeanContextPanel object ! * ! * @param beancontext Description of Parameter ! * @param title Description of the Parameter ! */ ! public BeanContextTreePanel(BeanContext beancontext, String title) ! { ! super(JSplitPane.HORIZONTAL_SPLIT); ! if (title != null) ! { ! this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title)); ! } ! BeanContextTreeModel model = new BeanContextTreeModel(beancontext); ! this.tree = new BeanContextTree(model); ! ! JScrollPane jscrollpane = new JScrollPane(tree); ! jscrollpane.setMinimumSize(new Dimension(200, 200)); ! jscrollpane.setPreferredSize(new Dimension(300, 400)); ! ! final JPanel dummyMsg = new JPanel(); ! dummyMsg.add(new JLabel("")); ! ! this.setLeftComponent(jscrollpane); ! this.setRightComponent(dummyMsg); ! ! this.tree.addTreeSelectionListener( ! new TreeSelectionListener() ! { ! public void valueChanged(TreeSelectionEvent treeselectionevent) ! { ! final TreePath selPath = treeselectionevent.getNewLeadSelectionPath(); ! SwingUtilities.invokeLater( ! new Runnable() ! { ! public void run() ! { ! try ! { ! Object obj = selPath.getLastPathComponent(); ! if (obj instanceof BeanContextChildComponentProxy) ! { ! BeanContextChildComponentProxy beancontextchildcomponentproxy = (BeanContextChildComponentProxy) obj; ! BeanContextTreePanel.this.setRightComponent(beancontextchildcomponentproxy.getComponent()); ! } ! else if (obj instanceof BeanContextContainerProxy) ! { ! BeanContextContainerProxy beancontextcontainerproxy = (BeanContextContainerProxy) obj; ! BeanContextTreePanel.this.setRightComponent(beancontextcontainerproxy.getContainer()); ! } ! BeanContextTreePanel.this.validate(); ! } ! catch (Exception e) ! { ! // Ignore it ! } ! } ! }); ! } ! }); ! ! this.tree.getModel().addTreeModelListener( ! new TreeModelAdapter() ! { ! public void treeNodesRemoved(TreeModelEvent treemodelevent) ! { ! BeanContextTreePanel.this.selectRoot(); ! } ! }); ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! * @return Description of the Return Value ! */ ! public Object find(Object o) ! { ! return this.tree.find(o); ! } ! ! ! /** Description of the Method */ ! public void selectRoot() ! { ! this.tree.selectRoot(); ! } ! ! ! /** ! * Sets the indexer attribute of the BeanContextTreePanel2 object ! * ! * @param indexer The new indexer value ! */ ! public void setIndexer(ObjectIndexer indexer) ! { ! this.tree.setIndexer(indexer); ! } ! ! ! /** ! * Sets the renderer attribute of the BeanContextTreePanel object ! * ! * @param renderer The new renderer value ! */ ! public void setRenderer(ObjectRenderer renderer) ! { ! this.tree.setRenderer(renderer); ! } ! } Index: GenericMethodDialog.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/GenericMethodDialog.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenericMethodDialog.java 15 Sep 2003 22:37:12 -0000 1.4 --- GenericMethodDialog.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,225 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt; ! ! import java.awt.Component; ! import java.awt.Dimension; ! import java.awt.Frame; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.beans.MethodDescriptor; ! import java.beans.ParameterDescriptor; ! import java.beans.PropertyEditor; ! import java.beans.PropertyEditorManager; ! import java.lang.reflect.InvocationTargetException; ! import java.util.Vector; ! ! import javax.swing.JButton; ! import javax.swing.JDialog; ! import javax.swing.JLabel; ! import javax.swing.JOptionPane; ! import javax.swing.JPanel; ! ! import com.dreambean.awt.GenericPropertyCustomizer; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class GenericMethodDialog extends JDialog ! implements ActionListener ! { ! /** Description of the Field */ ! protected Vector editors; ! /** Description of the Field */ ! protected MethodDescriptor md; ! /** Description of the Field */ ! protected Object obj; ! ! ! /** Constructor for GenericMethodDialog. */ ! public GenericMethodDialog() ! { ! super(); ! } ! ! ! /** ! *Constructor for the GenericMethodDialog object ! * ! * @param obj1 Description of the Parameter ! * @param methoddescriptor Description of the Parameter ! * @param frame Description of the Parameter ! */ ! public GenericMethodDialog(Object obj1, MethodDescriptor methoddescriptor, F... [truncated message content] |