From: <emm...@us...> - 2008-10-30 14:28:14
|
Revision: 4113 http://fudaa.svn.sourceforge.net/fudaa/?rev=4113&view=rev Author: emmanuel_martin Date: 2008-10-30 14:27:59 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Correction de quelques bugs concernant le panel de visibilit?\195?\169. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/EditVisibilityAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -12,6 +12,7 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ebli.commun.EbliLib; @@ -40,8 +41,8 @@ } } - public BCalquePaletteInfo(final BArbreCalqueModel _m) { - super(); + public BCalquePaletteInfo(final BArbreCalqueModel _m, CtuluCommandManager _cmd) { + super(_cmd); treeModel_ = _m; treeModel_.addTreeSelectionListener(this); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -358,7 +358,7 @@ } public JComponent buildContentPane() { - return new BCalquePaletteInfo(pn_.getArbreCalqueModel()); + return new BCalquePaletteInfo(pn_.getArbreCalqueModel(), pn_.gisEditor_.getMng()); } }; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/EditVisibilityAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/EditVisibilityAction.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/EditVisibilityAction.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -9,6 +9,7 @@ import javax.swing.JComponent; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.edition.BPaletteEditVisibility; @@ -20,16 +21,18 @@ * 'visibilite' des g\xE9om\xE9tries. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class EditVisibilityAction extends EbliActionPaletteAbstract { - private BPaletteEditVisibility palette_; - private final BArbreCalqueModel treeModel_; + protected BPaletteEditVisibility palette_; + protected final BArbreCalqueModel treeModel_; + protected CtuluCommandManager cmd_; - public EditVisibilityAction(BArbreCalqueModel _treeModel) { + public EditVisibilityAction(BArbreCalqueModel _treeModel, CtuluCommandManager _cmd) { super(EbliResource.EBLI.getString("Edition visibilit\xE9"), CtuluResource.CTULU.getToolIcon("crystal22_visibilite"), "VISIBILITY_EDITION", true); treeModel_=_treeModel; + cmd_=_cmd; } /* @@ -40,7 +43,7 @@ @Override public JComponent buildContentPane() { if(palette_==null) - palette_=new BPaletteEditVisibility(treeModel_); + palette_=new BPaletteEditVisibility(treeModel_, cmd_); return palette_.getComponent(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -16,11 +16,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.EventObject; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; +import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTable; @@ -33,9 +36,11 @@ import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISZoneCollection; @@ -72,23 +77,24 @@ public class BPaletteEditVisibility extends BuPanel implements ListSelectionListener, ZSelectionListener, ZModelGeometryListener, TreeModelListener, BPalettePanelInterface, ActionListener, ChangeListener { // Attributs de fonctionnement - private final BArbreCalqueModel treeModel_; - private ZCalqueAffichageDonneesInterface[] calques_; - private ZCalqueAffichageDonneesInterface[] listenCalques_; - private final String allCalquesEntry_=EbliLib.getS("Tout les calques"); + protected final BArbreCalqueModel treeModel_; + protected ZCalqueAffichageDonneesInterface[] calques_; + protected ZCalqueAffichageDonneesInterface[] listenCalques_; + protected final String allCalquesEntry_=EbliLib.getS("Tous les calques"); /** * vrai quand une modification de la selection dans le tableau ou dans le * calque est en cours. Permet d'\xE9viter des r\xE9cursions \xE0 cause des listeners de * selections. */ - private boolean listenSelection=true; + protected boolean listenSelection=true; /** Vrai quand la visibilit\xE9 n'est pas en train d'\xEAtre chang\xE9 par le panel. */ - private boolean listenVisibility=true; + protected boolean listenVisibility=true; + protected CtuluCommandManager cmd_; // Composants graphiques - private final BuComboBox calque_; - private boolean onlyInvisible_; - private final CtuluTable table_; - private TableModel geomTableModel_; + protected final BuComboBox calque_; + protected boolean onlyInvisible_; + protected final CtuluTable table_; + protected TableModel geomTableModel_; /** * @param _treeModel @@ -96,7 +102,8 @@ * g\xE9om\xE9tries et pour avoir connaissance de la cr\xE9ation et de la * suppression de calque. */ - public BPaletteEditVisibility(BArbreCalqueModel _treeModel){ + public BPaletteEditVisibility(BArbreCalqueModel _treeModel, CtuluCommandManager _cmd){ + cmd_=_cmd; calques_=new ZCalqueAffichageDonneesInterface[0]; listenCalques_=new ZCalqueAffichageDonneesInterface[0]; treeModel_=_treeModel; @@ -236,6 +243,54 @@ } } + protected class GeomTableEditor extends AbstractCellEditor implements TableCellEditor, ChangeListener { + + private boolean value; + /** Compteur d'\xE9v\xE9nement. */ + private int a=1; + + /* (non-Javadoc) + * @see + * javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing + * .JTable, java.lang.Object, boolean, int, int) + */ + public Component getTableCellEditorComponent(JTable _table, Object _value, boolean _isSelected, int _row, int _column) { + value=(Boolean)_value; + JPanel pn=new JPanel(); + pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + pn.setBackground(Color.WHITE); + BuCheckBox cb=new BuCheckBox("", (Boolean)_value); + cb.addChangeListener(this); + cb.setBackground(Color.WHITE); + pn.add(cb); + return pn; + } + + /* (non-Javadoc) + * @see javax.swing.CellEditor#getCellEditorValue() + */ + public Object getCellEditorValue() { + return value; + } + + public boolean shouldSelectCell(EventObject anEvent){ + return false; + } + + /* (non-Javadoc) + * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) + */ + public void stateChanged(ChangeEvent e) { + value=!value; + // Un hack : il semble que la checkbox envoie 5 \xE9v\xE9nements \xE0 chaque click. + // Pour arr\xEAter l'\xE9dition automatiquement au bout d'un click, on teste sur + // le compteur de click. + if(a==0) + stopCellEditing(); + a=(a+1)%5; + } + } + /** * Place dans le comboBox de choix des calques les calques qui peuvent \xEAtre * choisis ainsi que l'entr\xE9e sp\xE9ciale 'tout les calques'. @@ -271,8 +326,16 @@ // Mise a jour du tableau if(calque_.getSelectedItem()==allCalquesEntry_) listenCalques_=calques_; - else - listenCalques_=new ZCalqueAffichageDonneesInterface[0]; + else{ + boolean found=false; + int i=-1; + while(!found&&++i<calques_.length) + found=calques_[i].getTitle().equals(calque_.getSelectedItem()); + if(found) + listenCalques_=new ZCalqueAffichageDonneesInterface[]{calques_[i]}; + else + listenCalques_=new ZCalqueAffichageDonneesInterface[0]; + } // Ajout de l'\xE9coute de tout les calques for(int i=0;i<listenCalques_.length;i++){ listenCalques_[i].addSelectionListener(this); @@ -291,9 +354,7 @@ ArrayList<Object[]> rows=new ArrayList<Object[]>(); for(int i=0;i<calques_.length;i++){ if(calques_[i].getTitle().equals(calque_.getSelectedItem())||calque_.getSelectedItem()==allCalquesEntry_){ - // Ecoute du model ZModeleGeometry model = (ZModeleGeometry)calques_[i].modeleDonnees(); - model.addModelListener(this); // Extraction des donn\xE9es utiles GISZoneCollection zone=model.getGeomData(); int indexTitre=zone.getIndiceOf(GISAttributeConstants.TITRE); @@ -309,6 +370,7 @@ table_.getColumnModel().getColumn(0).setCellRenderer(new GeomTableRenderer()); table_.getColumnModel().getColumn(1).setCellRenderer(new GeomTableRenderer()); table_.getColumnModel().getColumn(1).setPreferredWidth(25); + table_.getColumnModel().getColumn(1).setCellEditor(new GeomTableEditor()); } /** @@ -327,7 +389,7 @@ GISZoneCollection zone=((ZModeleGeometry)_calque.modeleDonnees()).getGeomData(); int indexVisibility=zone.getIndiceOf(GISAttributeConstants.VISIBILITE); if (indexVisibility!=-1) - zone.getModel(indexVisibility).setObject(_numGeom, _visibility==true ? GISAttributeConstants.ATT_VAL_TRUE:GISAttributeConstants.ATT_VAL_FALSE, null); + zone.getModel(indexVisibility).setObject(_numGeom, _visibility==true ? GISAttributeConstants.ATT_VAL_TRUE:GISAttributeConstants.ATT_VAL_FALSE, cmd_); listenVisibility=true; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -15,6 +15,7 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; @@ -55,6 +56,7 @@ public ZModeleGeometryDefault(GISZoneCollectionGeometry _zone) { geometries_=_zone; + geometries_.setListener(this); } public void getDomaineForGeometry(int _idxGeom, GrBoite _target) { @@ -212,7 +214,7 @@ /* (non-Javadoc) * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) */ - public void modifyProperty(String _key, Object _value, int[] _index) { + public void modifyProperty(String _key, Object _value, int[] _index, CtuluCommandManager _cmd) { if (_index!=null) { // Recherche de l'attribut d\xE9fini par _key boolean found=false; @@ -223,7 +225,7 @@ if (found) { int[] geometries=_index; for (int j=0; j<geometries.length; j++) - geometries_.getModel(i).setObject(geometries[j], _value, null); + geometries_.getModel(i).setObject(geometries[j], _value, _cmd); } } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -15,6 +15,7 @@ import javax.swing.table.AbstractTableModel; import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; @@ -351,8 +352,8 @@ /* (non-Javadoc) * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) */ - public void modifyProperty(String _key, Object _value, final int[] _index) { - super.modifyProperty(_key, _value, _index); + public void modifyProperty(String _key, Object _value, final int[] _index, CtuluCommandManager _cmd) { + super.modifyProperty(_key, _value, _index, _cmd); if (_index!=null&&_value!=null&&_key==CtuluLib.getS("Ferm\xE9")) { // Modification de la propri\xE9t\xE9 int[] indexPolylines=_index; @@ -367,7 +368,7 @@ else FuLog.error("ZModeleLigneBriseeDefault.modifyProperty : la valeur pour la propri\xE9t\xE9 'ferm\xE9' est inconnue donc intraitable."); // Remplacement de l'ancienne g\xE9om\xE9trie par la nouvelle - geometries_.setGeometry(indexPolyligne, newGeom, null); + geometries_.setGeometry(indexPolyligne, newGeom, _cmd); } } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -179,7 +179,7 @@ final BPaletteInfoAbstractAction info = new BPaletteInfoAbstractAction() { public JComponent buildContentPane() { - return new EGPaletteInfo(EGFillePanel.this); + return new EGPaletteInfo(EGFillePanel.this, null); } protected boolean mustBeUpdated() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -10,6 +10,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TreeSelectionEvent; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibMessage; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionEvent; @@ -26,7 +27,8 @@ EGFillePanel p_; - public EGPaletteInfo(final EGFillePanel _p) { + public EGPaletteInfo(final EGFillePanel _p, CtuluCommandManager _cmd) { + super(_cmd); _p.addListenerCourbePoint(this); _p.getModel().addModelListener(this); _p.getModel().addSelectionListener(this); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -25,6 +25,7 @@ import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gui.CtuluTableCellEditorProxy; import org.fudaa.ctulu.gui.CtuluValueEditorI; import org.fudaa.ebli.commun.EbliLib; @@ -96,8 +97,9 @@ * @param _key le nom de la propri\xE9t\xE9 * @param _newValue la nouvelle valeur de la prorpi\xE9t\xE9 * @param _index l'information pass\xE9 en param\xE8tre du put + * @param _cmd le gestionnaire de commande pour le undo/redo */ - void modifyProperty(String _key, Object _newValue, int[] _index); + void modifyProperty(String _key, Object _newValue, int[] _index, CtuluCommandManager _cmd); } /** @@ -279,7 +281,7 @@ rows_.get(_rowIndex).set(_columnIndex, _value); // Si la nouvelle valeur est consid\xE9r\xE9e comme valide par l'editeur, on appelle la m\xE9thode de callback if(rows_.get(_rowIndex).get(2)!=null&&((CtuluValueEditorI)rows_.get(_rowIndex).get(2)).isValid(_value)) - ((ModifyPropertyInfo)rows_.get(_rowIndex).get(4)).modifyProperty((String)rows_.get(_rowIndex).get(0), _value, (int[]) rows_.get(_rowIndex).get(5)); + ((ModifyPropertyInfo)rows_.get(_rowIndex).get(4)).modifyProperty((String)rows_.get(_rowIndex).get(0), _value, (int[]) rows_.get(_rowIndex).get(5), cmd_); } } @@ -294,8 +296,10 @@ protected JTable table_; protected transient PanelTableModel tableModel_; protected JTextField txtTitle_; + protected CtuluCommandManager cmd_; - public BPaletteInfo() { + public BPaletteInfo(CtuluCommandManager _cmd) { + cmd_=_cmd; setLayout(new BuBorderLayout()); txtTitle_ = new BuTextField(); final Font f = txtTitle_.getFont(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-10-30 10:49:01 UTC (rev 4112) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-10-30 14:27:59 UTC (rev 4113) @@ -163,7 +163,7 @@ arrayList.add(new CalqueGISEditionAction(getArbreCalqueModel().getTreeSelectionModel(), gisEditor_, getScene())); arrayList.add(new SceneRotationAction(getArbreCalqueModel().getTreeSelectionModel(), gisEditor_, gisEditor_.getSceneEditor(),getEbliFormatter())); arrayList.add(new SceneDeplacementAction(getArbreCalqueModel().getTreeSelectionModel(), gisEditor_.getSceneEditor(),getEbliFormatter(), getCalqueDeplacement())); - arrayList.add(new EditVisibilityAction(getArbreCalqueModel())); + arrayList.add(new EditVisibilityAction(getArbreCalqueModel(), mng_)); return (EbliActionInterface[]) arrayList.toArray(new EbliActionInterface[arrayList.size()]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |