Thread: [Ejtools-cvs] CVS: libraries/adwt/src/main/net/sourceforge/ejtools/awt BeanContextTreePanel.java,NON
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-04-28 20:20:11
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt In directory usw-pr-cvs1:/tmp/cvs-serv15459/libraries/adwt/src/main/net/sourceforge/ejtools/awt Added Files: BeanContextTreePanel.java Removed Files: BeanContextPanel.java Log Message: Change BeanContextPanel to BeanContextTreePanel --- NEW FILE: BeanContextTreePanel.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt; import java.awt.Container; import java.awt.Dimension; import java.beans.beancontext.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import net.sourceforge.ejtools.jmx.ObjectNameFinder; /** * Description of the Class * * @author letiembl * @created 19 octobre 2001 * @todo Javadoc to complete * @todo Import to clean */ public class BeanContextTreePanel extends JSplitPane implements ObjectNameFinder { /** Description of the Field */ protected BeanContextTreeView 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 s Description of Parameter */ public BeanContextTreePanel(BeanContext beancontext, String s) { super(1); if (s != null) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), s)); } tree = new BeanContextTreeView(beancontext); JScrollPane jscrollpane = new JScrollPane(tree); jscrollpane.setMinimumSize(new Dimension(300, 400)); jscrollpane.setPreferredSize(new Dimension(300, 400)); final JPanel dummyMsg = new JPanel(); dummyMsg.add(new JLabel("", 0)); setLeftComponent(jscrollpane); setRightComponent(dummyMsg); tree.addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent treeselectionevent) { final TreePath selPath = treeselectionevent.getNewLeadSelectionPath(); SwingUtilities.invokeLater( new Runnable() { public void run() { try { Object obj = ((DefaultMutableTreeNode) selPath.getLastPathComponent()).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) { } } }); } }); tree.getModel().addTreeModelListener( new TreeModelListener() { public void treeNodesChanged(TreeModelEvent treemodelevent) { } public void treeNodesInserted(TreeModelEvent treemodelevent) { } public void treeNodesRemoved(TreeModelEvent treemodelevent) { setRightComponent(dummyMsg); validate(); } public void treeStructureChanged(TreeModelEvent treemodelevent) { setRightComponent(dummyMsg); validate(); } }); } /** * Gets the tree attribute of the BeanContextPanel object * * @return The tree value */ public JTree getTree() { return tree; } /** * Description of the Method * * @param searchString Description of the Parameter */ public void searchObjectName(String objectName) { System.out.println("BeanContextPanel In searchReference(" + objectName+ ")"); tree.searchObjectName(objectName); } /** * Sets the showRoot attribute of the BeanContextPanel object * * @param flag The new showRoot value */ public void setShowRoot(boolean flag) { if (!flag) { tree.expandPath(tree.getPathForRow(0)); } tree.setRootVisible(flag); } } --- BeanContextPanel.java DELETED --- |