Index: buix/src/java/org/codelutin/buix/Buix.java diff -u buix/src/java/org/codelutin/buix/Buix.java:1.46 buix/src/java/org/codelutin/buix/Buix.java:1.47 --- buix/src/java/org/codelutin/buix/Buix.java:1.46 Wed Aug 11 14:47:17 2004 +++ buix/src/java/org/codelutin/buix/Buix.java Wed Aug 11 16:30:23 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin -* @version $Revision: 1.46 $ +* @version $Revision: 1.47 $ * -* Mise a jour: $Date: 2004/08/11 14:47:17 $ -* par : $Author: bpoussin $ +* Mise a jour: $Date: 2004/08/11 16:30:23 $ +* par : $Author: mazelier $ */ package org.codelutin.buix; @@ -295,6 +295,8 @@ new BuixTreeSelectionControler(clipBoardTree, clipBoardTreeModel, selectionModel); + selectionModel.addListener(propertiesPanel); + allPropertiesModel = new BeanPropertiesTableModel(null); selectionModel.addListener(allPropertiesModel); allProperties.setModel(allPropertiesModel); @@ -824,32 +826,6 @@ */ public void selectionChanged(BuixSelectionEvent e){ this.bean = e.getComponent(); - /* BB */ - try{ -// DefaultBeanInfoResolver resolver = new DefaultBeanInfoResolver(); -// BeanInfo beanInfo = resolver.getBeanInfo(bean); - - PropertyDescriptor [] props = null; - if(bean instanceof LayoutManager){ - LayoutInfo layoutInfo = LayoutIntrospector.getLayoutInfo(bean.getClass()); - props = layoutInfo.getPropertyDescriptors(); - }else{ - BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); - props = beanInfo.getPropertyDescriptors(); - } - ArrayList filteredProps = new ArrayList(); - for(int i=0; i * Copyright Code Lutin - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ * - * Mise a jour: $Date: 2004/08/11 14:47:17 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2004/08/11 16:30:23 $ + * par : $Author: mazelier $ */ package org.codelutin.buix; @@ -67,8 +67,6 @@ import javax.swing.WindowConstants; -import com.l2fprod.common.propertysheet.PropertySheet; -import com.l2fprod.common.propertysheet.PropertySheetPanel; import com.l2fprod.common.swing.UserPreferences; /** @@ -81,7 +79,7 @@ protected WidgetShelves widgetShelves = null; protected JTree tree = null; /* BB */ - protected PropertySheetPanel propertiesPanel; + protected BuixPropertySheetPanel propertiesPanel; /* BB */ protected JTable allProperties = null; protected JTable selectionProperties = null; @@ -113,7 +111,7 @@ return tree; } /* BB */ - public PropertySheetPanel getPropertiesPanel() { + public BuixPropertySheetPanel getPropertiesPanel() { return propertiesPanel; } /* BB */ @@ -310,10 +308,7 @@ /* BB */ /* creation de la nouvelle table de toutes les proprietes*/ - propertiesPanel = new PropertySheetPanel(); - propertiesPanel.setDescriptionVisible(true); - propertiesPanel.setSortingProperties(true); - propertiesPanel.setSortingCategories(true); + propertiesPanel = new BuixPropertySheetPanel(); /* BB */ /* creation de la table de toutes les proprietes*/ Index: buix/src/java/org/codelutin/buix/BuixPropertySheetPanel.java diff -u /dev/null buix/src/java/org/codelutin/buix/BuixPropertySheetPanel.java:1.1 --- /dev/null Wed Aug 11 16:30:28 2004 +++ buix/src/java/org/codelutin/buix/BuixPropertySheetPanel.java Wed Aug 11 16:30:23 2004 @@ -0,0 +1,95 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * BuixPropertiesSheetPanel.java + * + * Created: Aug 11, 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/08/11 16:30:23 $ + * par : $Author: mazelier $ + */ + +package org.codelutin.buix; + +import com.l2fprod.common.propertysheet.PropertySheet; +import com.l2fprod.common.propertysheet.PropertySheetPanel; +import java.beans.PropertyDescriptor; +import java.beans.Introspector; +import java.util.ArrayList; +import org.codelutin.buix.layoutinfo.LayoutIntrospector; +import org.codelutin.buix.layoutinfo.LayoutInfo; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.BeanInfo; +import java.awt.LayoutManager; + +public class BuixPropertySheetPanel extends PropertySheetPanel implements PropertyChangeListener, BuixSelectionListener { // BuixPropertiesSheetPanel + + protected Object bean; + protected boolean isInit = false; + + public BuixPropertySheetPanel(){ + super(); + setDescriptionVisible(true); + setSortingProperties(true); + setSortingCategories(true); + addPropertySheetChangeListener(this); + } + + public void propertyChange(PropertyChangeEvent evt){ + if (! isInit){ + writeToObject(bean); + } + } + + public void selectionChanged(BuixSelectionEvent e){ + try{ + isInit = true; + this.bean = e.getComponent(); + + PropertyDescriptor [] props = null; + if(bean instanceof LayoutManager){ + LayoutInfo layoutInfo = LayoutIntrospector.getLayoutInfo(bean.getClass()); + props = layoutInfo.getPropertyDescriptors(); + }else{ + BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); + props = beanInfo.getPropertyDescriptors(); + } + ArrayList filteredProps = new ArrayList(); + for(int i=0; i