You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <emm...@us...> - 2008-10-28 16:49:00
|
Revision: 4104 http://fudaa.svn.sourceforge.net/fudaa/?rev=4104&view=rev Author: emmanuel_martin Date: 2008-10-28 16:48:50 +0000 (Tue, 28 Oct 2008) Log Message: ----------- La palette de propri?\195?\169t?\195?\169s reste ?\195?\160 jour lors de modifications effectu?\195?\169es via d'autres interfaces. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-28 15:55:12 UTC (rev 4103) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-28 16:48:50 UTC (rev 4104) @@ -136,21 +136,17 @@ } /** - * Permet d'ajouter ou de remplacer un des \xE9diteurs utilis\xE9. Le remplacement - * ne peut se faire que si l'ancien \xE9diteur n'est pas en cours d'utilisation. - * - * @param _indexRow : l'index de la ligne \xE0 ajouter ou remplacer - * @param _editor : le nouvel \xE9diteur - * @return vrai si l'ajout/ remplacement a \xE9t\xE9 effectu\xE9, faux sinon - */ - public boolean putEditor(Integer _indexRow, TableCellEditor _editor){ - if(!editable_||_indexRow!=currentIndex_){ - mapEditors_.put(_indexRow, _editor); - return true; - } - else - return false; - } + * Permet d'ajouter ou de remplacer un des \xE9diteurs utilis\xE9. + * + * @param _indexRow : l'index de la ligne \xE0 ajouter ou remplacer + * @param _editor : le nouvel \xE9diteur + */ + public void putEditor(Integer _indexRow, TableCellEditor _editor){ + if(editable_&&_indexRow==currentIndex_){ + cancelCellEditing(); + } + mapEditors_.put(_indexRow, _editor); + } /** * Supprime tout les editeurs. 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-28 15:55:12 UTC (rev 4103) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-28 16:48:50 UTC (rev 4104) @@ -13,14 +13,18 @@ import javax.swing.event.TreeSelectionListener; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.gis.AttributeListener; +import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.palette.BPaletteInfo; + +import com.vividsolutions.jts.geom.Geometry; /** * Un panel affichant les infos envoyes par TrPanelInfoSender. * @author deniger * @version $Id: BCalquePaletteInfo.java,v 1.7 2007-05-04 13:49:43 deniger Exp $ */ -public class BCalquePaletteInfo extends BPaletteInfo implements TreeSelectionListener, ZSelectionListener { +public class BCalquePaletteInfo extends BPaletteInfo implements TreeSelectionListener, ZSelectionListener, AttributeListener { private ArrayList<ZCalqueAffichageDonneesInterface> calqueWithGeometriesSelected_; private BArbreCalqueModel treeModel_; @@ -96,12 +100,22 @@ if (isAvailable()) { if (_evt.getSource().getLayerSelection()!=null&&_evt.getSource().getLayerSelection().getNbSelectedIndex()>0 ||_evt.getSource().getLayerSelectionMulti()!=null&&_evt.getSource().getLayerSelectionMulti().getNbSelectedItem()>0) { - if (!calqueWithGeometriesSelected_.contains(_evt.getSource())) + if (!calqueWithGeometriesSelected_.contains(_evt.getSource())){ calqueWithGeometriesSelected_.add(_evt.getSource()); + ZModeleDonnees model=_evt.getSource().modeleDonnees(); + if(model instanceof ZModeleGeometry) + ((ZModeleGeometry)model).addAttributeListener(this); + model.addGeometryListener(this); + } } else { - if (calqueWithGeometriesSelected_.contains(_evt.getSource())) + if (calqueWithGeometriesSelected_.contains(_evt.getSource())){ calqueWithGeometriesSelected_.remove(_evt.getSource()); + ZModeleDonnees model=_evt.getSource().modeleDonnees(); + if(model instanceof ZModeleGeometry) + ((ZModeleGeometry)model).removeAttributeListener(this); + model.removeGeometryListener(this); + } } updateTableModel(); } @@ -110,12 +124,24 @@ public void updateState() { if (isAvailable()) { + // Supression des \xE9coutes sur les calques et des calques + for(int i=0;i<calqueWithGeometriesSelected_.size();i++){ + ZModeleDonnees model=calqueWithGeometriesSelected_.get(i).modeleDonnees(); + if(model instanceof ZModeleGeometry) + ((ZModeleGeometry)model).removeAttributeListener(this); + model.removeGeometryListener(this); + } calqueWithGeometriesSelected_.clear(); - // R\xE9cup\xE9ration des calques ayant une selection + // R\xE9cup\xE9ration des calques ayant une selection et ajout des \xE9coutes ZCalqueAffichageDonneesInterface[] calques=getCalques(); for (int i=0; i<calques.length; i++) - if (calques[i].getLayerSelection()!=null&&calques[i].getLayerSelection().getNbSelectedIndex()>0) + if (calques[i].getLayerSelection()!=null&&calques[i].getLayerSelection().getNbSelectedIndex()>0){ calqueWithGeometriesSelected_.add(calques[i]); + ZModeleDonnees model=calques[i].modeleDonnees(); + if(model instanceof ZModeleGeometry) + ((ZModeleGeometry)model).addAttributeListener(this); + model.addGeometryListener(this); + } // Mise \xE0 jour du tableau des informations updateTableModel(); } @@ -127,4 +153,28 @@ if (isAvailable()&&calqueWithGeometriesSelected_.size()==0) updateTableModel(); } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.gis.AttributeListener#attributeAction(java.lang.Object, int, org.fudaa.ctulu.gis.GISAttributeInterface, int) + */ + public void attributeAction(Object _source, int att, GISAttributeInterface _att, int _action) { + if (isAvailable()) + updateTableModel(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.gis.AttributeListener#attributeValueChangeAction(java.lang.Object, int, org.fudaa.ctulu.gis.GISAttributeInterface, int, java.lang.Object) + */ + public void attributeValueChangeAction(Object _source, int att, GISAttributeInterface _att, int geom, Object value) { + if (isAvailable()) + updateTableModel(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.gis.GeometryListener#geometryAction(java.lang.Object, int, com.vividsolutions.jts.geom.Geometry, int) + */ + public void geometryAction(Object _source, int geom, Geometry _geom, int _action) { + if (isAvailable()) + updateTableModel(); + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-28 15:55:22
|
Revision: 4103 http://fudaa.svn.sourceforge.net/fudaa/?rev=4103&view=rev Author: emmanuel_martin Date: 2008-10-28 15:55:12 +0000 (Tue, 28 Oct 2008) Log Message: ----------- Mise en place de la palette de visibilit?\195?\169 ; modification dans le design des listeners de calque de model et de gisZone. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayBoolean.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDouble.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDoubleImmutable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayObject.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionBooleanAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListBoolean.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeListener.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanArray.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanList.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleArray.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleList.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerArray.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerList.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectArray.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectList.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPolygone.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPolyligne.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/H2dNodalPropertiesMngAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/H2dParallelogrammeManager.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/reflux/H2dRefluxElementProperty.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/reflux/H2dRefluxNodalPropertiesMng.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/reflux/H2dRefluxSICourant2D.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2DRubarDiffusionModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2DRubarFrictionModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarApportSpatialMng.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarDonneesBrutes.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarElementPropertyAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarOuvrage.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarOuvrageElementaireBreche.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarOuvrageElementaireDeversoir.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarOuvrageMng.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/rubar/H2dRubarParameters.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/telemac/H2dTelemacSeuilMng.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/h2d/telemac/H2dTelemacSourceMng.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonnees.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonneesVide.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnesAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleFlecheForGrille.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.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/ZModelePointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/lido/editor/LidoProfilEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/model/Mv3DFrontierData.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/model/MvEdgeModelDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileLayerModelForCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dLevel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dTrace.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dCloud.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dConstraintLine.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dContour.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dDirectionLine.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLevel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dMultiPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dProfile.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dZone.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigLineSingleModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 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/wizard/FSIgImageWizartStepCalageUI.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalageLogic.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiFlecheModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiProfilModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoModelEltDataAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/reflux/TrBcNodeLayer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacSourceModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/org/fudaa/fudaa/tr/TestJSave.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/AttributeListener.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GeometryListener.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 Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneListener.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayBoolean.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayBoolean.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayBoolean.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -65,7 +65,7 @@ list_ = new boolean[_nb]; } - protected void fireObjectChanged(){ + protected void fireObjectChanged(int _indexGeom, Object _newValue){ } @@ -114,7 +114,7 @@ } list_ = CtuluLibArray.copy(_m.list_); if (_throwEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } @@ -134,7 +134,7 @@ list_[i] = _m.getValue(i); } if (_throwEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDouble.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDouble.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDouble.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -139,7 +139,7 @@ list_ = CtuluLibArray.copy(_m.list_); r_ = _m.r_; if (_throwEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } @@ -153,7 +153,7 @@ list_ = _m.list_.toNativeArray(); r_ = _m.r_; if (_throwEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDoubleImmutable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDoubleImmutable.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayDoubleImmutable.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -189,7 +189,7 @@ return Arrays.equals(this.list_, _a.list_); } - protected void fireObjectChanged() {} + protected void fireObjectChanged(int _indexGeom, Object _newValue) {} public void initWith(final CtuluCollection _model, final boolean _throwEvent) {} Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayObject.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayObject.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluArrayObject.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -42,7 +42,7 @@ list_ = CtuluLibArray.copy(_init); } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue) { // System.err.println("overload " + getClass().getName() + ".firePointChanged"); } @@ -81,7 +81,7 @@ public void initWith(final CtuluCollection _array, final boolean _fireEvent) { list_ = _array.getObjectValues(); if (_fireEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } @@ -92,7 +92,7 @@ public void initWith(final CtuluArrayObject _array, final boolean _fireEvent) { list_ = _array.getObjectValues(); if (_fireEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } @@ -103,7 +103,7 @@ public void initWith(final CtuluListObject _array, final boolean _fireEvent) { list_ = _array.getObjectValues(); if (_fireEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionAbstract.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionAbstract.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -23,7 +23,7 @@ */ protected CtuluCollectionAbstract() {} - protected void fireObjectChanged() {} + protected void fireObjectChanged(int _indexGeom, Object _newValue) {} public boolean addAllObject(final Object _dataArray, final CtuluCommandContainer _c) { return false; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionBooleanAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionBooleanAbstract.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionBooleanAbstract.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -188,7 +188,7 @@ return set(_i, _newV, null); } - protected abstract void fireObjectChanged(); + protected abstract void fireObjectChanged(int _indexGeom, Object _newValue); /** * @param _i l'indice a modifier @@ -203,7 +203,7 @@ } final boolean old = getValue(_i); internalSet(_i, _newB); - fireObjectChanged(); + fireObjectChanged(_i, old); if (_c != null) { _c.addCmd(new CommandSet(_newB, old, _i)); } @@ -248,7 +248,7 @@ _c.addCmd(new CommandSetsOneDouble(_newB, old, CtuluLibArray.copy(_i))); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } @@ -300,7 +300,7 @@ _c.addCmd(new CommandSets(CtuluLibArray.copy(_newV), old, CtuluLibArray.copy(_i))); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -252,7 +252,7 @@ /** * Appele qui si des doubles sont modifies avec un set. */ - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue) { } @@ -268,7 +268,7 @@ } r_ = null; if (_throwEvent) { - fireObjectChanged(); + fireObjectChanged(-1, null); } } @@ -368,7 +368,7 @@ } final double old = getValue(_i); internalSet(_i, _newV); - fireObjectChanged(); + fireObjectChanged(_i, _newV); if (_c != null) { _c.addCmd(new CommandSet(_newV, old, _i)); } @@ -415,7 +415,7 @@ _c.addCmd(new CommandSetsOneDouble(_newV, old, CtuluLibArray.copy(_i))); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } @@ -468,7 +468,7 @@ _c.addCmd(new CommandSets(CtuluLibArray.copy(_newV), old, CtuluLibArray.copy(_i))); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } @@ -515,7 +515,7 @@ r |= internalSet(i, _val); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } if (r && _cmd != null) { _cmd.addCmd(new CommandSetAll(memento)); @@ -560,7 +560,7 @@ _cmd.addCmd(new CommandSetAll(memento)); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -35,12 +35,12 @@ public void redo() { internalSet(idx_, newV_); - fireObjectChanged(); + fireObjectChanged(idx_, newV_); } public void undo() { internalSet(idx_, oldV_); - fireObjectChanged(); + fireObjectChanged(idx_, oldV_); } } @@ -96,7 +96,7 @@ */ protected CtuluCollectionObjectAbstract() {} - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue) { // System.err.println("overload " + getClass().getName() + ".firePointChanged"); } @@ -191,7 +191,7 @@ } final Object old = getValueAt(_i); internalSet(_i, _newObj); - fireObjectChanged(); + fireObjectChanged(_i, _newObj); if (_c != null) { _c.addCmd(new CommandSet(_newObj, old, _i)); } @@ -224,7 +224,7 @@ } } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } if (r && _c != null) { _c.addCmd(new CommandSetsOneValue(_newV, old, _i)); @@ -271,7 +271,7 @@ _c.addCmd(new CommandSets(_newV, old, _i)); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); } return r; } @@ -291,7 +291,7 @@ r |= internalSet(i, _v); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); if (_cmd != null) { _cmd.addCmd(new CtuluCommand() { @@ -320,7 +320,7 @@ r |= internalSet(i, _v[i]); } if (r) { - fireObjectChanged(); + fireObjectChanged(-1, null); if (_cmd != null) { _cmd.addCmd(new CtuluCommand() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListBoolean.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListBoolean.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListBoolean.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -43,12 +43,12 @@ } else { internalAdd(idx_, newValue_); } - fireObjectAdded(); + fireObjectAdded(idx_, newValue_); } public void undo() { internalRemove(idx_); - fireObjectRemoved(); + fireObjectRemoved(idx_, newValue_); } } @@ -65,12 +65,12 @@ public void redo() { internalRemove(idx_); - fireObjectRemoved(); + fireObjectRemoved(idx_, oldValue_); } public void undo() { internalAdd(idx_, oldValue_); - fireObjectAdded(); + fireObjectAdded(idx_, oldValue_); } } @@ -85,13 +85,13 @@ public void redo() { internalRemoveAll(); - fireObjectRemoved(); + fireObjectRemoved(-1, null); } public void undo() { initWith(mementoRemoveAll_, false); // cas particulier ou il faut envoye un evt - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -133,7 +133,7 @@ public void undo() { initWith(memento_, false); // cas particulier ou il faut envoye un evt - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -189,26 +189,26 @@ public final boolean setAll(final Object _v) { if (_v instanceof Boolean) { Collections.fill(list_, _v); - fireObjectChanged(); + fireObjectChanged(-1, null); return true; } return false; } - protected void fireObjectAdded() { - // System.err.println("overload " + getClass().getName() + ".firePointAdded"); + protected void fireObjectAdded(int _newIdx, Object _newGeom) { + // System.err.println("overload " + getClass().getName() + ".firePointAdded"); } - protected void fireObjectChanged() { - // System.err.println("overload " + getClass().getName() + ".firePointChanged"); + protected void fireObjectChanged(int _indexGeom, Object _newValue) { + // System.err.println("overload " + getClass().getName() + ".firePointChanged"); } - protected void fireObjectRemoved() { - // System.err.println("overload " + getClass().getName() + ".firePointRemoved"); + protected void fireObjectRemoved(int _oldIdx, Object _oldGeom) { + // System.err.println("overload " + getClass().getName() + ".firePointRemoved"); } - protected void fireObjectStructureChanged() { - // System.err.println("overload " + getClass().getName() + ".firePointStructureChanged"); + protected void fireObjectStructureChanged(int _idx, Object _geom) { + // System.err.println("overload " + getClass().getName() + ".firePointStructureChanged"); } protected void initWith(final CtuluListBoolean _m) { @@ -254,7 +254,7 @@ final void initWith(final CtuluListBoolean _m, final boolean _throwEvent) { list_ = new ArrayList(_m.list_); if (_throwEvent) { - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -274,7 +274,7 @@ for (int i = 0; i < n; i++) { insert(_idx[i], _values[i]); } - fireObjectAdded(); + fireObjectAdded(-1, null); return true; } @@ -288,7 +288,7 @@ if (_cmd != null) { _cmd.addCmd(new CommandAdd(list_.size() - 1, _boolean)); } - fireObjectAdded(); + fireObjectAdded(list_.size() - 1, _boolean); return true; } return false; @@ -307,7 +307,7 @@ public void redo() { list_.add(newValue_); - fireObjectAdded(); + fireObjectAdded(idxBefore_, newValue_); } public void undo() { @@ -400,7 +400,7 @@ _c.addCmd(new CommandAdd(_i, _x)); } - fireObjectAdded(); + fireObjectAdded(_i, _x); return true; } return false; @@ -415,7 +415,7 @@ if (_c != null) { _c.addCmd(new CommandRemove(_i, old)); } - fireObjectRemoved(); + fireObjectRemoved(_i, old); return true; } @@ -491,7 +491,7 @@ _cmd.addCmd(new CommandRemoveDangerous(oldV, newIdx)); } } - fireObjectRemoved(); + fireObjectRemoved(-1, null); return true; } return false; @@ -512,7 +512,7 @@ if (_c != null) { _c.addCmd(new CommandRemoveAll(createMemento)); } - fireObjectRemoved(); + fireObjectRemoved(-1, null); } /** Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -19,6 +19,8 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; +import com.vividsolutions.jts.geom.Geometry; + /** * Une classe permettant de gerer un vecteur de double. Fonctionnalites sup: <br> * Undo/Redo Max/min enregistrer automatiquement @@ -91,7 +93,7 @@ } else { internalAdd(idx_, newValue_); } - fireObjectAdded(); + fireObjectAdded(idx_, newValue_); } /** @@ -99,7 +101,7 @@ */ public void undo() { internalRemove(idx_); - fireObjectRemoved(); + fireObjectRemoved(idx_, newValue_); } } @@ -120,7 +122,7 @@ */ public void redo() { list_.addAll(Arrays.asList(newValue_)); - fireObjectAdded(); + fireObjectAdded(-1, null); } /** @@ -128,7 +130,7 @@ */ public void undo() { CtuluLibArray.remove(list_, idxBefore_, newValue_.length); - fireObjectRemoved(); + fireObjectRemoved(-1, null); } } @@ -149,7 +151,7 @@ */ public void redo() { internalRemove(idx_); - fireObjectRemoved(); + fireObjectRemoved(idx_, oldValue_); } /** @@ -157,7 +159,7 @@ */ public void undo() { internalAdd(idx_, oldValue_); - fireObjectAdded(); + fireObjectAdded(idx_, oldValue_); } } @@ -172,13 +174,13 @@ public void redo() { internalRemoveAll(); - fireObjectRemoved(); + fireObjectRemoved(-1, null); } public void undo() { initWith(memento_, false); // cas particulier ou il faut envoye un evt - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -215,12 +217,13 @@ public void redo() { remove(idx_); + fireObjectRemoved(-1, null); } public void undo() { initWith(memento_, false); // cas particulier ou il faut envoye un evt - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -277,19 +280,19 @@ list_ = new ArrayList(_nb); } - protected void fireObjectAdded() { + protected void fireObjectAdded(int _newIdx, Object _newGeom) { // System.err.println("overload " + getClass().getName() + ".firePointAdded"); } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _oldIdx, Object _oldGeom) { // System.err.println("overload " + getClass().getName() + ".firePointChanged"); } - protected void fireObjectRemoved() { + protected void fireObjectRemoved(int _oldIdx, Object _oldGeom) { // System.err.println("overload " + getClass().getName() + ".firePointRemoved"); } - protected void fireObjectStructureChanged() { + protected void fireObjectStructureChanged(int _idx, Object _geom) { // System.err.println("overload " + getClass().getName() + ".firePointStructureChanged"); } @@ -320,14 +323,14 @@ public void initWith(final CtuluListObject _m, final boolean _throwEvent) { list_ = new ArrayList(_m.list_); if (_throwEvent) { - fireObjectAdded(); + fireObjectAdded(-1, null); } } public void initWith(final CtuluArrayObject _m, final boolean _throwEvent) { list_ = new ArrayList(Arrays.asList(_m.list_)); if (_throwEvent) { - fireObjectAdded(); + fireObjectAdded(-1, null); } } @@ -347,7 +350,7 @@ for (int i = 0; i < n; i++) { insert(_idx[i], _values[i]); } - fireObjectAdded(); + fireObjectAdded(-1, null); return true; } @@ -371,7 +374,7 @@ cmd.addCmd(new CommandAdd(list_.size() - 1, _obj)); _cmd.addCmd(cmd.getSimplify()); } - fireObjectAdded(); + fireObjectAdded(list_.size()-1, _obj); return true; } return false; @@ -398,7 +401,7 @@ cmd.addCmd(new CommandAddAll(idx, _obj)); _cmd.addCmd(cmd.getSimplify()); } - fireObjectAdded(); + fireObjectAdded(-1, null); } return true; } @@ -449,7 +452,7 @@ _c.addCmd(cmd.getSimplify()); } - fireObjectAdded(); + fireObjectAdded(_i, _x); return true; } return false; @@ -470,7 +473,7 @@ cmd.addCmd(new CommandRemove(_i, old)); _c.addCmd(cmd.getSimplify()); } - fireObjectRemoved(); + fireObjectRemoved(_i, list_.get(_i)); return true; } @@ -551,7 +554,7 @@ commandComposite.addCmd(new CommandRemoveDangerous(oldV, iToRemove)); } } - fireObjectRemoved(); + fireObjectRemoved(-1, null); if (_cmd != null && commandComposite != null) { _cmd.addCmd(commandComposite.getSimplify()); } @@ -585,7 +588,7 @@ if (_c != null && cmd != null) { _c.addCmd(cmd.getSimplify()); } - fireObjectRemoved(); + fireObjectRemoved(-1, null); } protected void internActionCleared(final CtuluCommandContainer _c) { Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/AttributeListener.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/AttributeListener.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/AttributeListener.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -0,0 +1,66 @@ +/* + * @creation 24 oct. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ctulu.gis; + +/** + * Cette interface permet l'\xE9coute des changements concernant les attributs des + * g\xE9om\xE9tries. Les changements sont : l'ajout d'un attribut, la suppression d'un + * attribut et le changement d'une valeur d'un attribut. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public interface AttributeListener extends GeometryListener { + + /** Action indiquant l'ajout d'un attribut dans le conteneur d'attributs. */ + public static final int ATTRIBUTE_ACTION_ADD=0; + /** + * Action indiquant la supression d'un attribut dans le conteneur d'attributs. + */ + public static final int ATTRIBUTE_ACTION_REMOVE=1; + + /** + * M\xE9thode appel\xE9e lorsqu'une action d'ajout ou de suppression est effectu\xE9e + * sur un attribut. + * + * @param _source + * L'instance appelant attributeAction. + * @param _indexAtt + * L'index de l'attribut. Si l'action est l'ajout d'un attribut, + * l'index est valide. Si l'action est la supression, l'index + * correspond \xE0 l'ancienne emplacement et donc n'est plus valide. Si + * \xE9gale \xE0 -1, tout les attributs ont pu \xEAtre modifi\xE9s. + * @param _att + * L'attribut concern\xE9. Si null tout les attributs ont pu \xEAtre + * modifi\xE9s. + * @param _action + * L'action effectu\xE9e sur la g\xE9om\xE9trie. Voir les ATTRIBUTE_ACTION_*. + */ + public void attributeAction(Object _source, int _indexAtt, GISAttributeInterface _att, int _action); + + /** + * M\xE9thode appel\xE9e lorsqu'une action de modification de la valeur d'un + * attribut est effectu\xE9e. + * + * @param _source + * L'instance appelant attributeValueChangeAction. + * @param _indexAtt + * L'index de l'attribut. Si \xE9gale \xE0 -1, tout les attributs ont pu + * \xEAtre modifi\xE9s. + * @param _att + * L'attribut concern\xE9. Si null tout les attributs ont pu \xEAtre + * modifi\xE9s. + * @param _indexGeom + * La g\xE9om\xE9trie concern\xE9e. Si \xE9gale \xE0 -1, toutes les g\xE9om\xE9tries ont + * pu \xEAtre modifi\xE9es. + * @param _newValue + * La nouvelle valeur de l'attribut pour la g\xE9om\xE9trie indiqu\xE9e. Si + * null toutes les g\xE9om\xE9tries ont pu \xEAtre modifi\xE9es. + */ + public void attributeValueChangeAction(Object _source, int _indexAtt, GISAttributeInterface _att, int _indexGeom, Object _newValue); +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/AttributeListener.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeListener.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeListener.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeListener.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -8,13 +8,29 @@ package org.fudaa.ctulu.gis; /** + * Cette interface concerne la communication entre les models d'attributs et la + * GISZoneCollection. Pour la communication entre la GISZoneCollection et le + * reste du monde, voir AttributeListener dans le m\xEAme package. + * * @author Fred Deniger - * @version $Id: GISAttributeListener.java,v 1.3 2006-02-09 08:59:28 deniger Exp $ + * @version $Id: GISAttributeListener.java,v 1.3 2006-02-09 08:59:28 deniger Exp + * $ */ public interface GISAttributeListener { /** - * @param _src l'attribut source de l'evt + * M\xE9thode appel\xE9e lorsqu'une action de modification de la valeur d'un + * attribut est effectu\xE9e. + * + * @param _att + * L'attribut concern\xE9. Si null tout les attributs ont pu \xEAtre + * modifi\xE9s. + * @param _indexGeom + * La g\xE9om\xE9trie concern\xE9e. Si \xE9gale \xE0 -1, toutes les g\xE9om\xE9tries ont + * pu \xEAtre modifi\xE9es. + * @param _newValue + * La nouvelle valeur de l'attribut pour la g\xE9om\xE9trie indiqu\xE9e. Si + * null toutes les g\xE9om\xE9tries ont pu \xEAtre modifi\xE9es. */ - void gisDataChanged(GISAttributeInterface _src); + public void gisDataChanged(GISAttributeInterface _att, int _indexGeom, Object _newValue); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanArray.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanArray.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanArray.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -128,9 +128,9 @@ return new GISAttributeModelBooleanArray(newList, this); } - protected void fireObjectChanged(){ + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanList.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanList.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelBooleanList.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -48,9 +48,9 @@ attribute_ = _attr; } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleArray.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleArray.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleArray.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -150,9 +150,9 @@ attribute_ = _attr; } - protected void fireObjectChanged(){ + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleList.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleList.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelDoubleList.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -75,9 +75,9 @@ super(_init); } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerArray.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerArray.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerArray.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -117,9 +117,9 @@ return new GISAttributeModelIntegerArray(newList, this); } - protected void fireDataChanged(){ + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerList.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerList.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelIntegerList.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -119,9 +119,9 @@ protected transient GISAttributeListener listener_; - protected void fireDataChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectArray.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectArray.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectArray.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -128,9 +128,9 @@ return new GISAttributeModelObjectArray(finalList, this); } - protected void fireObjectChanged(){ + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectList.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectList.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeModelObjectList.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -123,9 +123,9 @@ return new GISAttributeModelObjectList(newList, this); } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _indexGeom, Object _newValue){ if (listener_ != null) { - listener_.gisDataChanged(attribute_); + listener_.gisDataChanged(attribute_, _indexGeom, _newValue); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -10,12 +10,21 @@ import java.util.List; import java.util.TreeSet; -import com.vividsolutions.jts.geom.*; -import com.vividsolutions.jts.util.Assert; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.collection.CtuluListObject; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateFilter; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.CoordinateSequenceComparator; +import com.vividsolutions.jts.geom.Dimension; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryComponentFilter; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.GeometryFilter; +import com.vividsolutions.jts.util.Assert; + /** * @author Fred Deniger * @version $Id: GISCollection.java,v 1.18 2007-01-10 08:58:47 deniger Exp $ @@ -28,24 +37,24 @@ super(_nb); } - protected void fireObjectAdded() { + protected void fireObjectAdded(int _newIdx, Object _newGeom) { GISCollection.this.geometryChanged(); - GISCollection.this.fireObjectAdded(); + GISCollection.this.fireGeometryAdded(_newIdx, (Geometry) _newGeom); } - protected void fireObjectChanged() { + protected void fireObjectChanged(int _oldIdx, Object _oldGeom) { GISCollection.this.geometryChanged(); - GISCollection.this.fireObjectChanged(); + GISCollection.this.fireGeometryReplaced(_oldIdx, (Geometry) _oldGeom); } - protected void fireObjectRemoved() { + protected void fireObjectRemoved(int _oldIdx, Object _oldGeom) { GISCollection.this.geometryChanged(); - GISCollection.this.fireObjectRemoved(); + GISCollection.this.fireGeometryRemoved(_oldIdx, (Geometry) _oldGeom); } - protected void fireObjectStructureChanged() { + protected void fireObjectStructureChanged(int _idx, Object _geom) { GISCollection.this.geometryChanged(); - GISCollection.this.fireObjectStructureChanged(); + GISCollection.this.fireGeometryStructureChanged(_idx, (Geometry) _geom); } protected List getList() { @@ -80,7 +89,8 @@ protected GISObjectContainer geometry_; - protected transient GISZoneListener listener_; + /** Une instance \xE9coutant les actions effectu\xE9e sur les objets g\xE9om\xE9triques. */ + private transient GeometryListener geometryListener_; public GISCollection() { this(GISGeometryFactory.INSTANCE, 20); @@ -141,10 +151,26 @@ } - protected void fireObjectAdded() {} + protected void fireGeometryAdded(int _newIdx, Geometry _newGeom) { + if (geometryListener_!=null) + geometryListener_.geometryAction(this, _newIdx, _newGeom, GeometryListener.GEOMETRY_ACTION_ADD); + } - protected void fireObjectChanged() {} + protected void fireGeometryRemoved(int _oldIdx, Geometry _oldGeom) { + if (geometryListener_!=null) + geometryListener_.geometryAction(this, _oldIdx, _oldGeom, GeometryListener.GEOMETRY_ACTION_REMOVE); + } + protected void fireGeometryReplaced(int _oldIdx, Geometry _oldGeom) { + if (geometryListener_!=null) + geometryListener_.geometryAction(this, _oldIdx, _oldGeom, GeometryListener.GEOMETRY_ACTION_REPLACE); + } + + protected void fireGeometryStructureChanged(int _idx, Geometry _geom) { + if (geometryListener_!=null) + geometryListener_.geometryAction(this, _idx, _geom, GeometryListener.GEOMETRY_ACTION_STRUCTURE_CHANGE); + } + protected Envelope computeEnvelopeInternal() { final Envelope e = new Envelope(); final int n = getNumGeometries(); @@ -157,10 +183,6 @@ return e; } - protected void fireObjectRemoved() {} - - protected void fireObjectStructureChanged() {} - protected void internActionCleared(final CtuluCommandContainer _c) {} protected void internActionPointAdded(final List _values, final CtuluCommandContainer _c, final int _nbValues) {} @@ -171,8 +193,8 @@ protected void internActionPointRemoved(final int[] _i, final CtuluCommandContainer _c) {} - protected final void setListener(final GISZoneListener _listener) { - listener_ = _listener; + public void setGeometryListener(final GeometryListener _geometryListener) { + geometryListener_=_geometryListener; } public boolean accept(final GISVisitor _v) { @@ -331,8 +353,8 @@ return sum; } - public GISZoneListener getListener() { - return listener_; + public GeometryListener getGeometryListener() { + return geometryListener_; } public int getNumGeometries() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -153,7 +153,7 @@ * @param _attr les attributs * @return une zone correctement initialis\xE9e */ - public static GISZoneCollectionLigneBrisee createPolyligne(final GISZoneListener _listener, + public static GISZoneCollectionLigneBrisee createPolyligne(final AttributeListener _listener, final GISAttributeInterface[] _attr) { final GISZoneCollectionLigneBrisee zone = new GISZoneCollectionLigneBrisee(_listener); zone.initAttributes(_attr); @@ -166,7 +166,7 @@ * @param _attr les attributs * @return une zone correctement initialis\xE9e */ - public static GISZoneCollectionPoint createPoint(final GISZoneListener _listener, final GISAttributeInterface[] _attr) { + public static GISZoneCollectionPoint createPoint(final AttributeListener _listener, final GISAttributeInterface[] _attr) { final GISZoneCollectionPoint zone = new GISZoneCollectionPoint(_listener); zone.initAttributes(_attr); return zone; @@ -178,7 +178,7 @@ * @param _attr les attributs * @return une zone correctement initialis\xE9e */ - public static GISZoneCollectionLigneBrisee createLigneBrisee(final GISZoneListener _listener, + public static GISZoneCollectionLigneBrisee createLigneBrisee(final AttributeListener _listener, final GISAttributeInterface[] _attr) { final GISZoneCollectionLigneBrisee zone = new GISZoneCollectionLigneBrisee(_listener); zone.initAttributes(_attr); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -31,7 +31,7 @@ * @author Fred Deniger * @version $Id: GISZoneCollection.java,v 1.16.6.4 2008-03-26 16:46:43 bmarchan Exp $ */ -public abstract class GISZoneCollection extends GISCollectionData implements GISAttributeListener, GISDataModel { +public abstract class GISZoneCollection extends GISCollection implements GISAttributeListener, GISDataModel { private String title_; @@ -50,6 +50,8 @@ protected boolean badIdxAttZ_=true; /** La liste d'attribut a chang\xE9 : L'acc\xE8s direct \xE0 l'indice de mod\xE8le depuis un type doit \xEAtre remis \xE0 jour. */ protected boolean attListHasChanged_=true; + /** Une instance \xE9coutant les actions effectu\xE9e sur les attributs des g\xE9om\xE9tries. */ + private AttributeListener attributeListener_; protected boolean isGeomModifiable_ = true; @@ -76,39 +78,45 @@ super(_nbObject); } + /** + * R\xE9serv\xE9 au modelDonn\xE9es pour \xE9couter sa GISZone + * + * Pour des raisons de compatibilit\xE9s, le listener est ajout\xE9 comme attribute + * listener ET geometry listener. + * + * @param _attributeListener + */ + public void setAttributeListener(AttributeListener _attributeListener){ + attributeListener_=_attributeListener; + setGeometryListener(_attributeListener); + } + + public AttributeListener getAttributeListener(){ + return attributeListener_; + } + public long getId() { return -1; } - protected void fireAttributesChanged(final GISAttributeInterface _att) { - if (listener_ != null) { - listener_.attributeChanged(this, _att); - } + protected void fireAttributeAdded(int _newIdx, GISAttributeInterface _newAtt){ + if(attributeListener_!=null) + attributeListener_.attributeAction(this, _newIdx, _newAtt, AttributeListener.ATTRIBUTE_ACTION_ADD); } - - protected final void fireObjectAdded() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.INSERT); - } + + protected void fireAttributeRemoved(int _oldIdx, GISAttributeInterface _oldAtt){ + if(attributeListener_!=null) + attributeListener_.attributeAction(this, _oldIdx, _oldAtt, AttributeListener.ATTRIBUTE_ACTION_REMOVE); } - - protected final void fireObjectChanged() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.UPDATE); + + protected void fireAttributeValueChanged(int _idxAtt, GISAttributeInterface _att, int _idxGeom, Object _newValue){ + if (attributeListener_ != null) { + attributeListener_.attributeValueChangeAction(this, _idxAtt, _att, _idxGeom, _newValue); } } - - protected final void fireObjectRemoved() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.DELETE); - } - + + public void gisDataChanged(GISAttributeInterface _att, int _indexGeom, Object _newValue){ + fireAttributeValueChanged(getIndiceOf(_att), _att, _indexGeom, _newValue); } - - protected final void fireObjectStructureChanged() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.ALL); - } - } - + protected void fireTitleChanged() { } @@ -167,7 +175,7 @@ attListHasChanged_=true; final GISAttributeModelListener[] old = attr_; attr_ = _att; - fireAttributesChanged(null); + fireAttributeValueChanged(-1, null, -1, null); if (_cmd != null) { _cmd.addCmd(new CtuluCommand() { @@ -177,7 +185,6 @@ public void undo() { initAttributes(old, null); - } }); @@ -187,6 +194,10 @@ } + /** + * @param _i l'indice des valeur + * @return true si cree + */ protected boolean isDataCreated(final int _i) { return attr_ != null && attr_.length > _i && attr_[_i] != null; } @@ -409,17 +420,12 @@ getModel(_idxAtt).setObject(_idxGeom, _data, _cmd); } - public void gisDataChanged(final GISAttributeInterface _src) { - if (listener_ != null) { - listener_.dataChanged(_src, this); - } - } - /** * Mise a jour des listeners et du listener principal. A utiliser lors de la restauration uniquement. */ - public void initListeners(final GISZoneListener _listener) { - super.setListener(_listener); + public void initListeners(final AttributeListener _listener) { + setGeometryListener(_listener); + setAttributeListener(_listener); updateListeners(); } @@ -606,18 +612,18 @@ } } attr_ = newAtt; - fireAttributesChanged(null); + fireAttributeValueChanged(-1, null, -1, null); if (_cmd != null) { _cmd.addCmd(new CtuluCommand() { public void redo() { attr_ = newAtt; - fireAttributesChanged(null); + fireAttributeValueChanged(-1, null, -1, null); } public void undo() { attr_ = old; - fireAttributesChanged(null); + fireAttributeValueChanged(-1, null, -1, null); } }); @@ -661,4 +667,125 @@ */ public abstract void updateListeners(); + protected void internActionCleared(final CtuluCommandContainer _c) { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + getData(i).removeAll(_c); + } + + } + + /** + * Cette action est appele apres que le point ait \xE9t\xE9 ajout\xE9. + */ + protected void internActionPointAdded(final List _l, final CtuluCommandContainer _c, final int _nbValues) { + if (_l == null) { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + // si la valeur est cree, on ajoute automatiquement une valeur + if (isDataCreated(i)) { + final CtuluCollection model = getData(i); + final Object defau = getDefaultValuesObject(i); + if (_nbValues == 1) { + model.addObject(defau, _c); + } else { + final Object[] newObject = new Object[_nbValues]; + Arrays.fill(newObject, defau); + model.addAllObject(newObject, _c); + } + } + } + } else { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + Object o = _l.get(i); + // si o est null et les donn\xE9es ne sont pas creees on fait rien + if ((o != null) || isDataCreated(i)) { + if (isDataCreated(i)) { + if (o == null) { + if (_nbValues == 1) { + o = getDefaultValuesObject(i); + } else { + o = new Object[_nbValues]; + Arrays.fill((Object[]) o, getDefaultValuesObject(i)); + } + } + // la liste de donn\xE9es est deja cree, on ajoute + if (_nbValues > 1) { + getData(i).addAllObject(o, _c); + } else { + getData(i).addObject(o, _c); + } + + } else { + // la liste est cree automatiquement + // elle fait deja la taille du nombre de point + if (_nbValues > 1) { + final int[] idx = new int[_nbValues]; + final int max = getNumGeometries() - 1; + + for (int k = _nbValues - 1; k >= 0; k--) { + idx[k] = max - k; + } + if (o == null) { + getData(i).setObject(idx, getDefaultValuesObject(i), _c); + } else { + getData(i).setAllObject(idx, (Object[]) o, _c); + } + } else { + if (o == null) { + o = getDefaultValuesObject(i); + } + getData(i).setObject(getNumGeometries() - 1, o, _c); + } + } + } + } + } + + } + + protected void internActionPointInserted(final int _i, final List _l, final CtuluCommandContainer _c) { + if (_l == null) { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + if (isDataCreated(i)) { + getData(i).insertObject(_i, null, _c); + } + } + } else { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + Object o = _l.get(i); + if ((o != null) || isDataCreated(i)) { + if (isDataCreated(i)) { + if (o == null) { + o = getDefaultValuesObject(i); + } + // la liste de donn\xE9es est deja cree, on ajoute + getData(i).insertObject(_i, o, _c); + } else { + if (o == null) { + o = getDefaultValuesObject(i); + } + // la liste est cree automatiquement + // elle fait deja la taille du nombre de point + getData(i).setObject(_i, o, _c); + } + } + } + } + + } + + protected void internActionPointRemoved(final int _i, final CtuluCommandContainer _c) { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + if (isDataCreated(i)) { + getData(i).remove(_i, _c); + } + } + } + + protected void internActionPointRemoved(final int[] _i, final CtuluCommandContainer _c) { + for (int i = getNbAttributes() - 1; i >= 0; i--) { + if (isDataCreated(i)) { + getData(i).remove(_i, _c); + } + } + } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2008-10-28 12:17:05 UTC (rev 4102) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2008-10-28 15:55:12 UTC (rev 4103) @@ -11,10 +11,6 @@ import java.util.Arrays; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Geometry; - import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLib; @@ -24,6 +20,10 @@ import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.collection.CtuluCollectionDouble; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; + /** * Une collection pour les g\xE9om\xE9tries quelconques. * @@ -39,14 +39,14 @@ /** * @param _listener le listener */ - public GISZoneCollectionGeometry(final GISZoneListener _listener) { + public GISZoneCollectionGeometry(final AttributeListener _listener) { this(10, _listener); } /** * @param _listener le listener */ - public GISZoneCollectionGeometry(final GISZoneListener _listener, final GISZoneCollectionGeometry _col) { + public GISZoneCollectionGeometry(final AttributeListener _listener, final GISZoneCollectionGeometry _col) { this(10, _listener); if (_col != null) { for (int i = 0; i < _col.getNumGe... [truncated message content] |
From: <had...@us...> - 2008-10-28 13:42:55
|
Revision: 4102 http://fudaa.svn.sourceforge.net/fudaa/?rev=4102&view=rev Author: hadouxad Date: 2008-10-28 12:17:05 +0000 (Tue, 28 Oct 2008) Log Message: ----------- - Mise en page de la doc prepro Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_fr.odt Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/howTo_rubar_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/howTo_rubar_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/howTo_rubar_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/howTo_rubar_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/howTo_telemac_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/howTo_telemac_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/howTo_telemac_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/howTo_telemac_fr.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_en.pdf branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_fr.pdf Modified: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.odt =================================================================== (Binary files differ) Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.pdf =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.odt =================================================================== (Binary files differ) Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.pdf =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.pdf =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_en.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.pdf =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/howTo_reflux_fr.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.odt =================================================================== (Binary files differ) Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.pdf =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.odt =================================================================== (Binary files differ) Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.pdf =================================================================== --- branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.pdf (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.pdf 2008-10-28 12:17:05 UTC (rev 4102) @@ -0,0 +1,11347 @@ +%PDF-1.4 +%äüöß +2 0 obj +<</Length 3 0 R/Filter/FlateDecode>> +stream +x\x9C\x8DUM\x8B\xDB0\xBD\xFBW\xE8\xBC`\x8C!\x89\x93\xD2 +\xF4\xB0\xF4\xD4v\xA5iٽ\xEC\xDF\xEFӌl9i6\x81mi>ߛ\x91\x876\xAFճ!C\xF8\xF2\xBDoZ\xD39nz\xF3\xF2\xDD|\xBE3\xBF+6i\xBD\xFC\xA8|h\xA2\xB1]\xE3\x8Dgj\xAC\x89\x9D\x87 Ԟ\xEE\xD4Զ\xC7*tD\xDFB\xF5\xF8\xCD\xDC\xE0\xC0\x9A\xE3\xD3@<V\xFBc\xF5pa\xC0\xF0\xED\x8C\xF7)\xB1\xB0\xA6M\x8FɄ\xB2Ԓ\xC3\xF2c\xED +\x{1780E0}\xBF?\\xF5ɡ Ƶ\xA1\xF8\xB4N}Ʊ\x86\xF5f\xB4m\xC7\xCF\xDD\xE8\x9Aƺh\x9FN\xE9\x93IU&\xDD0\x89\xE5\xB6X\xEC s\x90\xB1W}U ≣\xF8\x97(\xDC%龸\xECD \xA3\x9F\x8F6\xD9@l\xB7oA~9\x9C\xB3\V\xF2i5\xC26!\x85\x8B` +\xC1ؤ +m\xB1v4\xD1\xEF \xFB\xDD\xED0\xAEC\xAD3\x81s\xA0 \xC9\xEE\x88g\xD6\xC2\xC0{\xD0\xD3\xF1M\xECP\x96\x8B\xC4 .\x89\xD3TX\xB6\x927H\xB6 +\x87Q\xFC\xB1\xEE\x91?D\xEDX\xC7\xF4\xE52\x8E\xA8h\xA2\xD7*JȔ\xD0\xC9Td\xECg,Z(\x89h\xA5Tm/q]v!\xA0@\x9C\xEC:\x95Iv\xBD\xF2\xDCζE#\xC7q\xA0\xFDv\x9A\xD48Qf\x9E\xE6\xE1\xC0\xE0cBg\xD5\xDDP0é\x94T\xAB\xBBlN\x87B\xF0\xB0d\xDF\xCF\xD2\xC5Ik(1ڗ\xA0|\xB8Y\xBB>6\xDD\xDE\xE8\xC8\xD7\xF4K\xD2\xDF1U4\xA7\x82Mԫ\xA2\xA5JI\x9Ea\xB0<\xD7@8,\xB9B\xC3B\xA7z\xEB\xBE\\x84\xC5D\x9C98\xE3M)uAglY\xE4\x97)*ʹ*\xF3%c\x9Ch\xADG\xA3_\xA3\xC0\xCA\xEF'\xB9\xB1\xADf嬛/\xA8\xF4K\xEE\xA9m\xD5jR\xCB9-\xB7\xEAĂA\xF9\xE8J\x8F\xCD\xF7_\xBA`\xD8iit\x9A\xB4;Wd+s\x85?\xB9y+\x84\x9C1\xAE\xD0}=U\x84\xC9\xF0\x9A%\xDFUdj\xC6O\xE3d\xACMo\xD9\xFC2\x9F\xE0`i&.P\x9E%\xBF\x9D$*\xB01M\xA35\x9E\xB8\xE6\xF2=\xBB\xC3<\x8Aو\x96ɤ\x92\xF0\x96\xC4\xF5@pU\x82a\xF4\xAF\xE4\xC1\x80J\x83ͷOLJ\xCC\xAF)ʸ|Ng^`\xBA4L\x8BvHLݿ?93\xFD1p\xF5\x8E$\x94 +endstream +endobj + +3 0 obj +709 +endobj + +4 0 obj +<</Type/XObject/Subtype/Image/Width 28 /Height 28 /BitsPerComponent 8 /Length 5 0 R +/Filter/FlateDecode/ColorSpace/DeviceRGB +/SMask 6 0 R +>> +stream +x\x9C}\x93[O\U\xC7\xFF\x9Fc\xCE|\x8E>\xC4\xD0>\x81\x89jL\x8C\xB1\x83\xBDQj[+\xCAmZ(\x97rNI\xEA\x9B6\xB6&>X1@¥\x82ȥ\xB4\xDC\xE6vfΙ3g\xA6\x92\xD8\xD7^\xFB\xEC\xE1\x8CE\x93\xC5f\xCD\xDA{\xFF\xF6]N\xB0\x81\x90, ɖP\x91,\xB0\xCDvx\xF6\xAC\xE3\xBC\xD2u\xC8\xF0\x8D\x8C:\x9Eb'\xA5\x8C|\x8B\xFEv\xF9\xD6 \xC6!:\x9DcZ xl\xB1_\x87絮g\xE7T\x93\x8ARt\xE5&Ę\xB3\xEC |
From: <had...@us...> - 2008-10-27 19:49:42
|
Revision: 4101 http://fudaa.svn.sourceforge.net/fudaa/?rev=4101&view=rev Author: hadouxad Date: 2008-10-27 19:49:31 +0000 (Mon, 27 Oct 2008) Log Message: ----------- Plusieurs mise a jours dont celles ci - Syst?\195?\168me de d?\195?\169placement revue; notion de frame sattelite qui se d?\195?\169place en effectuant la m?\195?\170me translation que leur widget parente. - Syst?\195?\168me de zoom ok: lors de la fusion, le zoom du calque initial est conserv?\195?\169. - Correction de plusieurs bugs Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/MoveAction.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliAlignWithMoveStrategyProvider.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -7,7 +7,7 @@ import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; -import org.fudaa.ebli.visuallibrary.actions.EbliAlignWithMoveStrategyProvider; +import org.fudaa.ebli.visuallibrary.resizestrategy.EbliAlignWithMoveStrategyProvider; import org.fudaa.ebli.visuallibrary.resizestrategy.EbliWidgetActionFactory; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; import org.jdesktop.swingx.JXTreeTable; @@ -50,7 +50,7 @@ .getVisu(), false); final EbliAlignWithMoveStrategyProvider sp = new EbliAlignWithMoveStrategyProvider(widgetCollector, scene_ .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); - alignWithMoveAction = ActionFactory.createMoveAction(sp, sp); + alignWithMoveAction = EbliWidgetActionFactory.createMoveAction(sp, sp); // alignWithResizeAction = // ActionFactory.createAlignWithResizeAction(scene_.getVisu(), Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -521,5 +521,22 @@ if (isGrouped()) return ((EbliWidget) this.getParentBordure().getParentWidget()).getId(); else return EbliWidgetGroup.NOGROUP; } + + + /** + * Methode qui indique si lq widget a des sattelites, ie des widgets qui + * doivent etre deplacees avec. + * + * @return + */ + public boolean hasSattelite() { + return false; + } + + public List<EbliWidget> getSattelite() { + return null; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -259,5 +259,12 @@ public boolean canFont() { return intern_.canFont(); } + public boolean hasSattelite() { + return intern_.hasSattelite(); + } + public List<EbliWidget> getSattelite() { + return intern_.getSattelite(); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -98,7 +98,7 @@ } - private void constructMenuDupliquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { + protected void constructMenuDupliquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { final JMenuItem menuItem1 = _popup.add(EbliResource.EBLI.getString("Dupliquer la frame")); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -106,7 +106,7 @@ public void actionPerformed(final ActionEvent e) { // -- liste des nodes candidats pour le UNdo/redo --// ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); - duplication(listeNodeUndo); + duplication(listeNodeUndo, widget_.getEbliScene()); cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, widget_.getEbliScene())); } @@ -118,7 +118,7 @@ * * @return le node duplique */ - public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo) { + public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo, EbliScene sceneDestination) { // -- recuperation du node a dupliquer --// final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); @@ -129,8 +129,8 @@ // duplique.setPreferedLocation(nouvellePosition); // -- ajout dans la scene --// - if (duplique != null && widget_.getScene() != null) { - widget_.getEbliScene().addNode(duplique); + if (duplique != null && sceneDestination != null) { + sceneDestination.addNode(duplique); // -- duplication des map de property graphique de la widget --// duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); @@ -143,6 +143,7 @@ // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); + sceneDestination.refresh(); } postActionDuplication(n, duplique); @@ -237,7 +238,7 @@ } - private void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { + protected void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { final JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem.addActionListener(new ActionListener() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -4,9 +4,17 @@ */ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; +import java.util.ArrayList; +import java.util.List; + import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetUngroupAction; +import org.netbeans.api.visual.widget.Widget; /** * @author deniger @@ -31,4 +39,50 @@ final EbliNode n = (EbliNode) getWidget().getEbliScene().findObject(getWidget()); _menu.add(new EbliWidgetUngroupAction(getWidget().getEbliScene(), n, isFusionCalque)); } + + /** + * Duplication de groupe. + */ + public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo, final EbliScene sceneDestination) { + final ArrayList<EbliNode> nodeToGroup = new ArrayList<EbliNode>(); + final List<Widget> children = new ArrayList<Widget>(widget_.getIntern().getChildren()); + for (final Widget widget : children) { + final Point p = widget.getLocation(); + final Point toScene = widget_.convertLocalToScene(p); + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget); + + // -- duplication du node dans la scene --// + EbliNode duplic = n.duplicate(null); + // listeNodeUndo.add(duplic); + + duplic.setPreferedSize(widget.getPreferredSize()); + nodeToGroup.add(duplic); + final Point nouvellePosition = new Point(toScene.x, (toScene.y + widget_.getIntern().getClientArea().height)); + duplic.setPreferedLocation(nouvellePosition); + sceneDestination.addNode(duplic); + sceneDestination.refresh(); + } + + // -- on rejoue un groupement des node a grouper --// + final EbliNode nodeGroup = new EbliWidgetGroupAction(sceneDestination).groupWidgets(nodeToGroup); + // listeNodeUndo.add(nodeGroup); + + // -- undo global --// + sceneDestination.getCmdMng().addCmd(new CtuluCommand() { + + public void undo() { + EbliWidgetUngroupAction.degroupObjects(sceneDestination, nodeGroup); + new CommandeDuplicate(nodeToGroup, widget_.getEbliScene()).undo(); + } + + public void redo() { + new CommandeDuplicate(nodeToGroup, widget_.getEbliScene()).redo(); + new EbliWidgetGroupAction(sceneDestination).groupWidgets(nodeToGroup); + } + }); + + + return nodeGroup; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -6,7 +6,12 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.ebli.visuallibrary.graphe.WidgetLegendeManager; /** * commande qui effectue un undo/redo sur la suppression. @@ -76,6 +81,30 @@ if(location_.size()>i) location =location_.get(i); undoUnit(node, location); + + // -- gerer cas particulier des legendes, il faut les rattacher a leur + // widget origine --// + if (node.getWidget().getIntern() instanceof EbliWidgetCalqueLegende) { + + //on recherche la widget calque correspondante + for(int j = 0; j < nodeSupprime_.size(); j++){ + EbliNode nodeVue=nodeSupprime_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetVueCalque) { + ((EbliWidgetVueCalque) nodeVue.getWidget().getIntern()).nodeLegende = node; + } + } + } else if (node.getWidget().getIntern() instanceof WidgetLegendeManager.WidgetCalqueLegende) { + + // on recherche la widget graphe correspondante + for (int j = 0; j < nodeSupprime_.size(); j++) { + EbliNode nodeVue = nodeSupprime_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetGraphe) { + ((EbliWidgetGraphe) nodeVue.getWidget().getIntern()).setNodeLegende((EbliNodeDefault) node); + } + } + } + + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -6,7 +6,12 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.ebli.visuallibrary.graphe.WidgetLegendeManager; /** * action qui permet de faire le undo/redo sur le changement de scene du node. @@ -45,6 +50,27 @@ sceneDepart_.refresh(); sceneDestination_.addNode(node); sceneDestination_.refresh(); + // -- gerer cas particulier des legendes, il faut les rattacher a leur + // widget origine --// + if (node.getWidget().getIntern() instanceof EbliWidgetCalqueLegende) { + + // on recherche la widget calque correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetVueCalque) { + ((EbliWidgetVueCalque) nodeVue.getWidget().getIntern()).nodeLegende = node; + } + } + } else if (node.getWidget().getIntern() instanceof WidgetLegendeManager.WidgetCalqueLegende) { + + // on recherche la widget graphe correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetGraphe) { + ((EbliWidgetGraphe) nodeVue.getWidget().getIntern()).setNodeLegende((EbliNodeDefault) node); + } + } + } } } @@ -59,6 +85,28 @@ if (previsouLocation_.size() > cpt) node.getWidget().setPreferredLocation(node.getWidget().convertSceneToLocal(previsouLocation_.get(cpt++))); sceneDepart_.refresh(); + // -- gerer cas particulier des legendes, il faut les rattacher a leur + // widget origine --// + if (node.getWidget().getIntern() instanceof EbliWidgetCalqueLegende) { + + // on recherche la widget calque correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetVueCalque) { + ((EbliWidgetVueCalque) nodeVue.getWidget().getIntern()).nodeLegende = node; + } + } + } else if (node.getWidget().getIntern() instanceof WidgetLegendeManager.WidgetCalqueLegende) { + + // on recherche la widget graphe correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetGraphe) { + ((EbliWidgetGraphe) nodeVue.getWidget().getIntern()).setNodeLegende((EbliNodeDefault) node); + } + } + } + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -5,8 +5,13 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.ebli.visuallibrary.graphe.WidgetLegendeManager; /** * Command undo/redo pour le duplicate de widget. @@ -31,6 +36,30 @@ for (final Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { final EbliNode node = it.next(); redo(node.getWidget(), node); + + // -- gerer cas particulier des legendes, il faut les rattacher a leur + // widget origine --// + if (node.getWidget().getIntern() instanceof EbliWidgetCalqueLegende) { + + // on recherche la widget calque correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetVueCalque) { + ((EbliWidgetVueCalque) nodeVue.getWidget().getIntern()).nodeLegende = node; + } + } + } else if (node.getWidget().getIntern() instanceof WidgetLegendeManager.WidgetCalqueLegende) { + + // on recherche la widget graphe correspondante + for (int j = 0; j < nodeDuplique_.size(); j++) { + EbliNode nodeVue = nodeDuplique_.get(j); + if (nodeVue.getWidget().getIntern() instanceof EbliWidgetGraphe) { + ((EbliWidgetGraphe) nodeVue.getWidget().getIntern()).setNodeLegende((EbliNodeDefault) node); + } + } + } + + } } @@ -45,7 +74,7 @@ widget.getEbliScene().addNode(nodeDuplique); // -- raffraichissement de la scene --// - scene_.refresh(); + widget.getEbliScene().refresh(); } public void undo() { @@ -61,7 +90,7 @@ widget.getEbliScene().removeNode(nodeDuplique); // -- raffraichissement de la scene --// - scene_.refresh(); + widget.getEbliScene().refresh(); } } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliAlignWithMoveStrategyProvider.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliAlignWithMoveStrategyProvider.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliAlignWithMoveStrategyProvider.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -1,101 +0,0 @@ -/** - * Licence GPL - * Copyright Genesis - */ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Point; - -import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.netbeans.api.visual.action.AlignWithMoveDecorator; -import org.netbeans.api.visual.action.AlignWithWidgetCollector; -import org.netbeans.api.visual.action.MoveProvider; -import org.netbeans.api.visual.action.MoveStrategy; -import org.netbeans.api.visual.widget.LayerWidget; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider; - -/** - * @author deniger - */ -public class EbliAlignWithMoveStrategyProvider implements MoveStrategy, MoveProvider { - - final AlignWithMoveStrategyProvider alignProvider_; - - public EbliAlignWithMoveStrategyProvider(final AlignWithWidgetCollector collector, - final LayerWidget interractionLayer, final AlignWithMoveDecorator decorator, final boolean outerBounds) { - alignProvider_ = new AlignWithMoveStrategyProvider(collector, interractionLayer, decorator, outerBounds); - } - - /** - * @param _widget - * @return - * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#getOriginalLocation(org.netbeans.api.visual.widget.Widget) - */ - public Point getOriginalLocation(final Widget _widget) { - return getWidgetToMove(_widget).getPreferredLocation(); - } - - /** - * @see org.netbeans.modules.visual.action.AlignWithSupport#hide() - */ - public void hide() { - alignProvider_.hide(); - } - - /** - * @param _widget - * @param _originalLocation - * @param _suggestedLocation - * @return - * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#locationSuggested(org.netbeans.api.visual.widget.Widget, - * java.awt.Point, java.awt.Point) - */ - public Point locationSuggested(final Widget _widget, final Point _originalLocation, final Point _suggestedLocation) { - return alignProvider_.locationSuggested(getWidgetToMove(_widget), _originalLocation, _suggestedLocation); - } - - /** - * @param _widget - * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#movementFinished(org.netbeans.api.visual.widget.Widget) - */ - public void movementFinished(final Widget _widget) { - alignProvider_.movementFinished(getWidgetToMove(_widget)); - } - - /** - * @param _widget - * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#movementStarted(org.netbeans.api.visual.widget.Widget) - */ - public void movementStarted(final Widget _widget) { - alignProvider_.movementStarted(getWidgetToMove(_widget)); - } - - /** - * @param _widget - * @param _location - * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#setNewLocation(org.netbeans.api.visual.widget.Widget, - * java.awt.Point) - */ - public void setNewLocation(final Widget _widget, final Point _location) { - getWidgetToMove(_widget).setPreferredLocation(_location); - } - - /** - * @see org.netbeans.modules.visual.action.AlignWithSupport#show() - */ - public void show() { - alignProvider_.show(); - } - - /** - * @param widget - */ - public static EbliWidget getWidgetToMove(final Widget widget) { - final EbliWidget w = (EbliWidget) widget; - final EbliWidget group = w.getGroup(); - if (group != null) { return group; } - return w; - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -75,7 +75,7 @@ // -- duplication du node --// - EbliNode node = currentNode.getWidget().getController().duplication(listeNodeUndo); + EbliNode node = currentNode.getWidget().getController().duplication(listeNodeUndo, sceneDestination_); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -11,6 +11,7 @@ import java.awt.event.ActionEvent; import java.awt.geom.Rectangle2D; import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -70,7 +71,7 @@ return n; } - private EbliNode groupWidgets(final Set _selectedObjects) { + public EbliNode groupWidgets(final Collection _selectedObjects) { final EbliWidgetGroup parent = new EbliWidgetGroup(scene_); // parent.setController(new EbliWidgetControllerMenuOnly(parent)); parent.setLayout(new GroupLayout()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -36,6 +36,7 @@ import org.fudaa.ebli.palette.PaletteEditAction; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; @@ -67,8 +68,8 @@ Map<BCalque,CalqueLegendeWidgetAdapter> legendeWidget_=new HashMap<BCalque, CalqueLegendeWidgetAdapter>(); - - + + BuMenuBar menuCalque_; JComponent panelTreeCalque_; @@ -147,13 +148,13 @@ // -- on ajoute le noeud legende come commande undo --// listeNodeUndo.add(controllerDuDuplique.getNodeLegende()); - + } - + // -- commande undo/redo --// // cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, // widget_.getEbliScene())); - + controllerDuDuplique.setDescription(getDescription()); // -- construction des actions sans passer par la frame fille --// @@ -161,39 +162,39 @@ } - - public EbliNode duplication(ArrayList<EbliNode> listeNodeUndo) { - // -- recuperation du node a dupliquer --// - final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + public EbliNode duplication(ArrayList<EbliNode> listeNodeUndo, EbliScene sceneDestination) { - // duplication du node en question - final EbliNode duplique = n.duplicate(null); + // -- recuperation du node a dupliquer --// + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - // nouvelle position a cote de son predecesseur - // duplique.setPreferedLocation(nouvellePosition); + // duplication du node en question + final EbliNode duplique = n.duplicate(null); - // -- ajout dans la scene --// - if (duplique != null && widget_.getScene() != null) { - widget_.getEbliScene().addNode(duplique); + // -- redimensionnement du duplicata --// + ((EbliWidgetCreatorVueCalque) duplique.getCreator()).initSize(getVisuPanel().getVueCalque().getCalque().getSize()); - // -- duplication des map de property graphique de la widget --// - duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); - // -- duplication de la taille --// - duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); + // -- ajout dans la scene --// + if (duplique != null && sceneDestination != null) { + sceneDestination.addNode(duplique); - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); - postActionDuplication(n, duplique, listeNodeUndo); - } + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + sceneDestination.refresh(); + postActionDuplication(n, duplique, listeNodeUndo); + } return duplique; - } + } - - - + + + public boolean hasLegende() { if (getNodeLegende() == null) return false; @@ -205,61 +206,63 @@ if (widget_.getEbliScene() != null) { // position a cote de la widget graphe -// final Point nouvellePosition = new Point((widget_.getLocation().x), (int) (widget_.getLocation().y + widget_ -// .getBounds().height * 1.2)); + // final Point nouvellePosition = new Point((widget_.getLocation().x), + // (int) (widget_.getLocation().y + widget_ + // .getBounds().height * 1.2)); -// if (!hasLegende()) { + // if (!hasLegende()) { - - BCalque calqueActif=widgetCalque_.calquePanel_.getCalqueActif(); - if(calqueActif!=null && calqueActif instanceof BCalqueAffichage){ + + BCalque calqueActif = widgetCalque_.calquePanel_.getCalqueActif(); + if (calqueActif != null && calqueActif instanceof BCalqueAffichage) { if (this.legendeWidget_.get(calqueActif) == null) { //legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); - legendeWidget_.put(widgetCalque_.calquePanel_.getCalqueActif(), (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend()); - - - CalqueLegendeWidgetAdapter legendeAdapter=this.legendeWidget_.get(calqueActif); - - // -- creation de la legende - final Point positionLegende = new Point(); - if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { - positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; - positionLegende.y = widget_.getPreferredLocation().y; - setNodeLegende(legendeAdapter.createLegende(positionLegende, widget_.getEbliScene(), widget_.getId(),calqueActif)); + legendeWidget_.put(widgetCalque_.calquePanel_.getCalqueActif(), + (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend()); + + CalqueLegendeWidgetAdapter legendeAdapter = this.legendeWidget_.get(calqueActif); + + // -- creation de la legende + final Point positionLegende = new Point(); + if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { + positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; + positionLegende.y = widget_.getPreferredLocation().y; + setNodeLegende(legendeAdapter.createLegende(positionLegende, widget_.getEbliScene(), widget_.getId(), + calqueActif)); + } + widget_.getEbliScene().refresh(); } - widget_.getEbliScene().refresh(); - } - } -// } else if (getNodeLegende().hasWidget()) -// // -- cas ou la legende existe mais est cach\xE9e --// -// getNodeLegende().getWidget().setVisible(true); + } + // } else if (getNodeLegende().hasWidget()) + // // -- cas ou la legende existe mais est cach\xE9e --// + // getNodeLegende().getWidget().setVisible(true); - - + + // GrapheWidget.this.addChild(widgetLegende); } } public void suppression(final ArrayList<EbliNode> listeNodeUndo, ArrayList<Point> listLocation) { - final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - listeNodeUndo.add(n); - listLocation.add(widget_.convertLocalToScene(widget_.getLocation())); - // -- on prend la location du node au moment de la suppression pour - // pouvoir la retablir dans le undo --// - // n.setPreferedLocation(widget_.getPreferredLocation()); - + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + listeNodeUndo.add(n); + listLocation.add(widget_.convertLocalToScene(widget_.getLocation())); + // -- on prend la location du node au moment de la suppression pour + // pouvoir la retablir dans le undo --// + // n.setPreferedLocation(widget_.getPreferredLocation()); - // -- on enleve le node de la scene --// - widget_.getEbliScene().removeNode(n); - // -- on supprime le node legende associe --// - if (hasLegende()) { - listeNodeUndo.add(widgetCalque_.nodeLegende); + // -- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); + + // -- on supprime le node legende associe --// + if (hasLegende()) { + listeNodeUndo.add(widgetCalque_.nodeLegende); listLocation.add(widgetCalque_.convertLocalToScene(widgetCalque_.nodeLegende.getWidget().getLocation())); - widget_.getEbliScene().removeNode(widgetCalque_.nodeLegende); - legendeWidget_ = null; - // final CtuluCommand commande1= new CommandSupprimer(n, + widget_.getEbliScene().removeNode(widgetCalque_.nodeLegende); + legendeWidget_ = null; + // final CtuluCommand commande1= new CommandSupprimer(n, // widget_.getEbliScene(), // widget_.convertLocalToScene(widget_.getLocation())); // final CtuluCommand commande2= new @@ -284,15 +287,15 @@ // } // // }); - } - - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); + } - } + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); - + } + + @Override protected void constructMenuMasquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { final JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer l'objet")); @@ -392,8 +395,8 @@ } public CalqueLegendeWidgetAdapter getLegendeWidget(BCalque calqueSelectionne) { - if(calqueSelectionne==null) - return null; + if (calqueSelectionne == null) + return null; return legendeWidget_.get(calqueSelectionne); } @@ -464,6 +467,18 @@ return panelTreeCalque_; } + + BSelecteurListComboBox comboVar_; + + public void majComboVar() { + //-- on retire le listener si il existe --// + if (comboVar_ == null) + return; + getVisuPanel().getArbreCalqueModel().getTreeSelectionModel().removeTreeSelectionListener(comboVar_); + getVisuPanel().getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(comboVar_); + comboVar_.setPalettePanelTarget(getVisuPanel().getArbreCalqueModel().getSelectedCalque()); + } + /** * Obtient la toolbar specifique au calque * @@ -487,23 +502,22 @@ toolbarCalque_.add(new PaletteEditAction(getVisuPanel().getArbreCalqueModel().getTreeSelectionModel())); // -- ajout des comboBox des variables --// - BSelecteurListComboBox combo = new BSelecteurListComboBox(); + comboVar_ = new BSelecteurListComboBox(); // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change - getVisuPanel().getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(combo); - combo.setPalettePanelTarget(getVisuPanel().getArbreCalqueModel().getSelectedCalque()); + majComboVar(); // combo.setPalettePanelTarget(listselector.getTarget()); - combo.setMinimumSize(combo.getPreferredSize()); - combo.setMaximumSize(combo.getPreferredSize()); + comboVar_.setMinimumSize(comboVar_.getPreferredSize()); + comboVar_.setMaximumSize(comboVar_.getPreferredSize()); // ajout combobox - toolbarCalque_.add(combo); + toolbarCalque_.add(comboVar_); // -- ajout des combo des pas de temps --// final EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(getVisuPanel().getArbreCalqueModel() .getTreeSelectionModel(), true); // pour activer l'action chooserT.setSelected(true); - combo = (BSelecteurListComboBox) chooserT.buildContentPane(); + BSelecteurListComboBox combo = (BSelecteurListComboBox) chooserT.buildContentPane(); chooserT.updateBeforeShow(); combo.setMaximumSize(combo.getPreferredSize()); combo.setMinimumSize(combo.getPreferredSize()); @@ -512,6 +526,9 @@ toolbarCalque_.add(combo); } + // -- mise a jour de la combo de variables pour le cas ou l on ajoute des + // var dans editer les var + majComboVar(); return toolbarCalque_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -3,12 +3,11 @@ import java.awt.Dimension; import java.awt.Point; import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.calque.ZebliCalquePersist; import org.fudaa.ebli.geometrie.GrBoite; @@ -97,7 +96,16 @@ public EbliWidgetWithBordure getBordure() { return res; } - + + public void initSize(final Dimension rec) { + final BCalque[] tousCalques = calque_.getVueCalque().getCalque().getTousCalques(); + calque_.getVueCalque().setSize(rec.width, rec.height); + // calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); + calque_.getVueCalque().getCalque().setSize(rec.width, rec.height); + for (int i = 0; i < tousCalques.length; i++) { + tousCalques[i].setSize(rec.width, rec.height); + } + } /** * parametre qui n est rensginee que dans le cas d une duplication. Sinon c est cree des le debut avec le bon * ebliwidgetCalqueLegende qui va. Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -52,13 +52,48 @@ * Il faut le faire dans l'ordre inverse afin de pr\xE9server le zoom de la widget initiale. */ public void synchronyseZoom(){ - //-- on conserve le zoom du calque initial et on l'appllique avant de synchronizer les zooms --// - EbliWidgetVueCalque calqueInitialeZoom=listeWidgetCalque_.get(listeWidgetCalque_.size()-1); - final GrBoite boite = calqueInitialeZoom.getViewBoite(); - calqueInitialeZoom.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); - calqueInitialeZoom.calquePanel_.getVueCalque().changeRepere(calqueInitialeZoom.calquePanel_, boite, 0, 0); + // -- on met a jour le modele de zoom pour toutes les filles en prenant le + // dernier widget (= la widget temoin) + GrBoite boite = null; + ZEbliCalquesPanel pn = null; + for (int i = listeWidgetCalque_.size() - 1; i >= 0; i--) { + EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); + if (boite == null) { + boite = vue.getViewBoite(); + + pn = vue.calquePanel_; + } + // } else if (vue.getViewBoite() != null) { + // boite.ajuste(vue.getViewBoite()); + // // vue.calquePanel_.getVueCalque().changeRepere(vue.calquePanel_, + // boite, + // // 0, 0); + // vue.image = null; + // vue.repaint(); + // } + vue.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); + vue.image = null; + vue.repaint(); + + } + if (boite != null) { + // -- on force le redimensionnement de la widget calque initiale avec le + // meme zoom + // -- le fait de faire appel a ceci mettra a jour les zooms de toutes les + // autres widgets + pn.getVueCalque().changeRepere(pn, boite, 0, 0); + } + // synchronizer les zooms --// + // EbliWidgetVueCalque + // calqueInitialeZoom=listeWidgetCalque_.get(listeWidgetCalque_.size()-1); + // final GrBoite boite = calqueInitialeZoom.getViewBoite(); + // calqueInitialeZoom.calquePanel_.getVueCalque().addPropertyChangeListener( + // "repere", this); + // calqueInitialeZoom.calquePanel_.getVueCalque().changeRepere( + // calqueInitialeZoom.calquePanel_, boite, 0, 0); + // for(int i=0;i<listeWidgetCalque_.size();i++){ // //-- mise a jour de la boite pour le calque originel (le reste suivra) --// // listeWidgetCalque_.get(i).calquePanel_.getVueCalque().changeRepere(listeWidgetCalque_.get(i).calquePanel_, boite, 0, 0); @@ -67,12 +102,13 @@ // } getEbliScene().refresh(); // -- ajout du listener des calques sur this --// - - for(int i=0;i<listeWidgetCalque_.size()-1;i++){ - EbliWidgetVueCalque widgetCalque=listeWidgetCalque_.get(i); - widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); - } + // for (int i = 0; i < listeWidgetCalque_.size(); i++) { + // EbliWidgetVueCalque widgetCalque=listeWidgetCalque_.get(i); + //widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere" + // , this); + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -42,8 +42,11 @@ ZEbliCalquesPanel calquePanel_; - public EbliNode nodeLegende = null; + + + public EbliNode nodeLegende = null; + Window frame_; BufferedImage image; @@ -85,6 +88,11 @@ } + + public ZEbliCalquesPanel getCalquePanel() { + return calquePanel_; + } + public BuPanel createEditorComponent( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget) { return calquePanel_; @@ -254,4 +262,21 @@ return cq != null && cq.isVisible(); } + public boolean hasSattelite() { + if (getCalqueController().hasLegende()) + return true; + return false; + } + + public List<EbliWidget> getSattelite() { + if (!hasSattelite()) + return null; + List<EbliWidget> liste = new ArrayList<EbliWidget>(); + + liste.add(getCalqueController().getNodeLegende().getWidget()); + + return liste; + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -19,7 +19,6 @@ import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; -import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; @@ -28,11 +27,13 @@ import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; @@ -140,7 +141,7 @@ } - public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo) { + public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo, EbliScene sceneDestination) { // -- recuperation du node a dupliquer --// final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); @@ -152,8 +153,8 @@ // duplique.setPreferedLocation(nouvellePosition); // -- ajout dans la scene --// - if (duplique != null && widget_.getScene() != null) { - widget_.getEbliScene().addNode(duplique); + if (duplique != null && sceneDestination != null) { + sceneDestination.addNode(duplique); // -- duplication des map de property graphique de la widget --// duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); @@ -164,7 +165,7 @@ // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); - + sceneDestination.refresh(); postActionDuplication(n, duplique, listeNodeUndo); @@ -288,21 +289,52 @@ return widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende()); } + + + + /** + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il + * n a aucun effet. + * + * @param _popup + */ + public void constructPopupMenuBaseGraphique(final JPopupMenu _popup) { + + final JMenuItem menuItem4 = _popup.add(EbliResource.EBLI.getString("Configuration graphique")); + menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); + // BuResource.BU.getIcon("configurer") + menuItem4.addActionListener(new ActionListener() { + + public void actionPerformed(final ActionEvent e) { + EbliWidget found = null;// widget_; + + if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordureSingle) + found = (EbliWidget) widget_.getParentWidget(); + else + found = widget_; + EbliWidgetActionConfigure.configure(found); + } + + }); + } + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { - final Point positionLegende = new Point(); - if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { - positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; - positionLegende.y = widget_.getPreferredLocation().y; - - } - + if (!hasLegende()) { // -- creation d'un node legende --// widgetGraphe_.setNodeLegende(new EbliNodeDefault()); + final Point positionLegende = new Point(); + if (widget_.getParentBordure().getBounds() != null && widget_.getParentBordure().getLocation() != null) { + positionLegende.x = widget_.getParentBordure().getLocation().x + widget_.getParentBordure().getBounds().width + + 20; + positionLegende.y = widget_.getParentBordure().getLocation().y; + widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); + } + // -- non de la legende --// widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); @@ -310,7 +342,7 @@ widget_.getId()); widgetGraphe_.getNodeLegende().setCreator(creator); - widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); + // widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); widget_.getEbliScene().addNode(widgetGraphe_.getNodeLegende()); widgetGraphe_.getNodeLegende().setPreferedSize(widgetGraphe_.getNodeLegende().getWidget().getPreferredSize()); @@ -355,7 +387,8 @@ // -- creation du menu config de la courbe - _popup.add(new EGConfigureActionPalette(((EbliWidgetGraphe) widget_).getGraphe().getModel())); + // _popup.add(new EGConfigureActionPalette(((EbliWidgetGraphe) + // widget_).getGraphe().getModel())); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -6,8 +6,10 @@ import java.awt.Rectangle; import java.awt.Window; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.fudaa.ctulu.image.CtuluLibImage; @@ -63,7 +65,8 @@ // public void setGraphe(EGGraphe graphe) { // this.graphe_ = graphe; // } - + EbliWidgetControllerGraphe controllerGraphe_; + public EbliWidgetGraphe(final EbliScene scene, final Point preferredLocation, final EGFillePanel _pn) { super(scene); panelGraphe_ = _pn; @@ -72,7 +75,8 @@ panelGraphe_.getGraphe().getModel().addModelListener(this); // --ajout du controller specifique au graphe --// - this.setController(new EbliWidgetControllerGraphe(this, nodeLegende)); + controllerGraphe_ = new EbliWidgetControllerGraphe(this, nodeLegende); + this.setController(controllerGraphe_); } @@ -269,4 +273,21 @@ return false; } + public boolean hasSattelite() { + if (controllerGraphe_.hasLegende()) + return true; + return false; + } + + public List<EbliWidget> getSattelite() { + if (!hasSattelite()) + return null; + List<EbliWidget> liste = new ArrayList<EbliWidget>(); + + liste.add(getNodeLegende().getWidget()); + + return liste; + + } + } Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java (from rev 4099, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliAlignWithMoveStrategyProvider.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -0,0 +1,115 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.resizestrategy; + +import java.awt.Point; + +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.action.AlignWithMoveDecorator; +import org.netbeans.api.visual.action.AlignWithWidgetCollector; +import org.netbeans.api.visual.action.MoveProvider; +import org.netbeans.api.visual.action.MoveStrategy; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider; + +/** + * @author deniger + */ +public class EbliAlignWithMoveStrategyProvider implements MoveStrategy, MoveProvider { + + final AlignWithMoveStrategyProvider alignProvider_; + + public EbliAlignWithMoveStrategyProvider(final AlignWithWidgetCollector collector, + final LayerWidget interractionLayer, final AlignWithMoveDecorator decorator, final boolean outerBounds) { + alignProvider_ = new AlignWithMoveStrategyProvider(collector, interractionLayer, decorator, outerBounds); + } + + /** + * @param _widget + * @return + * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#getOriginalLocation(org.netbeans.api.visual.widget.Widget) + */ + public Point getOriginalLocation(final Widget _widget) { + return getWidgetToMove(_widget).getPreferredLocation(); + } + + /** + * @see org.netbeans.modules.visual.action.AlignWithSupport#hide() + */ + public void hide() { + alignProvider_.hide(); + } + + /** + * @param _widget + * @param _originalLocation + * @param _suggestedLocation + * @return + * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#locationSuggested(org.netbeans.api.visual.widget.Widget, + * java.awt.Point, java.awt.Point) + */ + public Point locationSuggested(final Widget _widget, final Point _originalLocation, final Point _suggestedLocation) { + return alignProvider_.locationSuggested(getWidgetToMove(_widget), _originalLocation, _suggestedLocation); + } + + /** + * @param _widget + * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#movementFinished(org.netbeans.api.visual.widget.Widget) + */ + public void movementFinished(final Widget _widget) { + alignProvider_.movementFinished(getWidgetToMove(_widget)); + } + + /** + * @param _widget + * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#movementStarted(org.netbeans.api.visual.widget.Widget) + */ + public void movementStarted(final Widget _widget) { + alignProvider_.movementStarted(getWidgetToMove(_widget)); + } + + /** + * @param _widget + * @param _location + * @see org.netbeans.modules.visual.action.AlignWithMoveStrategyProvider#setNewLocation(org.netbeans.api.visual.widget.Widget, + * java.awt.Point) + */ + public void setNewLocation(final Widget _widget, final Point _location) { + Point oldLocation = getWidgetToMove(_widget).getLocation(); + getWidgetToMove(_widget).setPreferredLocation(_location); + + // -- cas particulier pour les widgets sattelites --// + EbliWidget ebliwidget = (EbliWidget) _widget; + if (ebliwidget.hasSattelite()) { + // -- on deplace ses widget sattelite a la location relative a leur + // location d'origine --// + for (EbliWidget satt : ebliwidget.getSattelite()) { + int translationX = _location.x - oldLocation.x; + int translationY = _location.y - oldLocation.y; + Point newLocationSatt = new Point(satt.getLocation().x + translationX, satt.getLocation().y + translationY); + satt.setPreferredLocation(newLocationSatt); + } + } + } + + /** + * @see org.netbeans.modules.visual.action.AlignWithSupport#show() + */ + public void show() { + alignProvider_.show(); + } + + /** + * @param widget + */ + public static EbliWidget getWidgetToMove(final Widget widget) { + final EbliWidget w = (EbliWidget) widget; + final EbliWidget group = w.getGroup(); + if (group != null) { return group; } + return w; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java 2008-10-27 13:11:41 UTC (rev 4100) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -2,14 +2,20 @@ import java.awt.BasicStroke; import java.awt.Color; +import java.awt.Point; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.AlignWithMoveDecorator; import org.netbeans.api.visual.action.AlignWithWidgetCollector; +import org.netbeans.api.visual.action.MoveProvider; +import org.netbeans.api.visual.action.MoveStrategy; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.ConnectionWidget; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.action.MoveAction; import org.netbeans.modules.visual.action.SingleLayerAlignWithWidgetCollector; /** @@ -22,6 +28,31 @@ public class EbliWidgetActionFactory { + private static final MoveProvider MOVE_PROVIDER_SATTELITTE = new MoveProvider() { + public void movementStarted(Widget widget) { + } + + public void movementFinished(Widget widget) { + } + + public Point getOriginalLocation(Widget widget) { + return widget.getPreferredLocation(); + } + + public void setNewLocation(Widget widget, Point location) { + widget.setPreferredLocation(location); + // -- cas particulier pour les widgets sattelites --// + EbliWidget ebliwidget = (EbliWidget) widget; + if (ebliwidget.hasSattelite()) { + // -- on deplace ses widget sattelite a la location relative a leur + // location d'origine --// + for (EbliWidget satt : ebliwidget.getSattelite()) { + satt.setPreferredLocation(location); + } + } + + } + }; private static final BasicStroke STROKE = new BasicStroke(1.0f, BasicStroke.JOIN_BEVEL, BasicStroke.CAP_BUTT, 5.0f, new float[] { 6.0f, 3.0f }, 0.0f); @@ -52,4 +83,11 @@ return ActionFactory.createResizeAction(sp, sp); } + public static WidgetAction createMoveAction(MoveStrategy strategy, MoveProvider provider) { + return new MoveAction(strategy != null ? strategy : ActionFactory.createFreeMoveStrategy(), + provider != null ? provider : MOVE_PROVIDER_SATTELITTE); + } + + + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/MoveAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/MoveAction.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/MoveAction.java 2008-10-27 19:49:31 UTC (rev 4101) @@ -0,0 +1,90 @@ +package org.fudaa.ebli.visuallibrary.resizestrategy; + +import java.awt.Point; +import java.awt.event.MouseEvent; + +import org.netbeans.api.visual.action.MoveProvider; +import org.netbeans.api.visual.action.MoveStrategy; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.Widget; + +/** + * Classe moveAction specifique aux widget. (pour certaines widget sattellites, + * leur deplacement doit etre aussi r\xE9alis\xE9) + * + * @author Adrien Hadoux + * + */ +public class MoveAction extends WidgetAction.LockedAdapter { + + + + + private MoveStrategy strategy; + private MoveProvider provider; + + private Widget movingWidget ... [truncated message content] |
From: <bma...@us...> - 2008-10-27 13:11:52
|
Revision: 4100 http://fudaa.svn.sourceforge.net/fudaa/?rev=4100&view=rev Author: bmarchan Date: 2008-10-27 13:11:41 +0000 (Mon, 27 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java 2008-10-26 21:50:16 UTC (rev 4099) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java 2008-10-27 13:11:41 UTC (rev 4100) @@ -26,7 +26,7 @@ public BPaletteInfoAbstractAction() { super(EbliLib.getS("Propri\xE9t\xE9s"), EbliResource.EBLI.getIcon("info"), "INFOS"); setPaletteResizable(true); - putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Propri\xE9t\xE9s des les objets s\xE9lectionn\xE9s")); + putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Propri\xE9t\xE9s des objets s\xE9lectionn\xE9s")); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('i')); putValue(EbliActionInterface.SECOND_KEYSTROKE, KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-10-26 21:52:40
|
Revision: 4099 http://fudaa.svn.sourceforge.net/fudaa/?rev=4099&view=rev Author: bmarchan Date: 2008-10-26 21:50:16 +0000 (Sun, 26 Oct 2008) Log Message: ----------- Correctif pour un undo/redo fonctionnel. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -176,10 +176,11 @@ /** * @param _panel le panneau des calques */ - public ZEditorDefault(final ZEbliCalquesPanel _panel, final ZSceneEditor _editor) { + protected ZEditorDefault(final ZEbliCalquesPanel _panel, final ZSceneEditor _editor) { super(); panel_ = _panel; sceneEditor_=_editor; + setMng(new CtuluCommandManager()); // panel_.addKeyListener(this); buildDeletesAction(); EbliLib.updateMapKeyStroke(_panel, getDeleteActions()); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,7 +1,7 @@ /* * @file MvVisuPanel.java * @creation 6 f\xE9vr. 2004 - * @modification $Date: 2008-01-17 11:42:49 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -59,7 +59,7 @@ * element, etc.) et des services associ\xE9s. * * @author deniger - * @version $Id: MvVisuPanel.java,v 1.5.6.1 2008-01-17 11:42:49 bmarchan Exp $ + * @version $Id$ */ public class MvVisuPanel extends FSigVisuPanel implements MvIsoPaintersSource { @@ -201,7 +201,8 @@ } protected FSigEditor createGisEditor() { - return new FSigEditor(this, getCmdMng()) { + FSigEditor editor= + new FSigEditor(this) { public GISPolygone[] getEnglobPolygone() { final EfFrontierInterface frontiers = MvVisuPanel.this.getGridGroup().getGrid().getFrontiers(); @@ -211,6 +212,8 @@ return frontiers.getExternRing(MvVisuPanel.this.getGridGroup().getGrid()); } }; + mng_=editor.getMng(); + return editor; } /** Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,6 +1,6 @@ /* * @creation 28 janv. 08 - * @modification $Date: 2008/05/13 12:10:06 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... @@ -45,7 +45,7 @@ /** * Un manager pour l'\xE9dition des calques SIG. * @author Bertrand Marchand - * @version $Id: MdlEditionManager.java,v 1.1.2.8 2008/05/13 12:10:06 bmarchan Exp $ + * @version $Id$ */ public class MdlEditionManager extends FSigEditor { @@ -54,8 +54,8 @@ * @param _panel * @param _cmd */ - public MdlEditionManager(MdlVisuPanel _panel, CtuluCommandManager _cmd) { - super(_panel, new MdlSceneEditor(_panel,_panel.getScene()), _cmd); + public MdlEditionManager(MdlVisuPanel _panel) { + super(_panel, new MdlSceneEditor(_panel,_panel.getScene())); } /** Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,6 +1,6 @@ /* * @creation 7 juin 07 - * @modification $Date: 2008/05/13 12:10:21 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -41,7 +41,7 @@ * Le panneau de visu 2D des donn\xE9es du modeleur au travers des calques. Contient le composant vue * des calques + le composant d'affichage des coordonn\xE9es + le composant d'affichage du mode de selection * @author fred deniger - * @version $Id: MdlVisuPanel.java,v 1.1.2.6 2008/05/13 12:10:21 bmarchan Exp $ + * @version $Id$ */ public class MdlVisuPanel extends FSigVisuPanel { @@ -64,7 +64,9 @@ } protected FSigEditor createGisEditor() { - return new MdlEditionManager(this, getCmdMng()); + FSigEditor editor=new MdlEditionManager(this); + mng_=editor.getMng(); + return editor; } public FSigLayerGroup getGroupGIS() { Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -68,17 +68,17 @@ /** * @param _panel */ - public FSigEditor(final ZEbliCalquesPanel _panel, final ZSceneEditor _editor, final CtuluCommandManager _cmd) { + public FSigEditor(final ZEbliCalquesPanel _panel, final ZSceneEditor _editor) { super(_panel,_editor); - setMng(_cmd); +// setMng(_cmd); } /** * @param _panel */ - public FSigEditor(final ZEbliCalquesPanel _panel, final CtuluCommandManager _cmd) { + public FSigEditor(final ZEbliCalquesPanel _panel) { super(_panel); - setMng(_cmd); +// setMng(_cmd); } public void dataChanged(final GISAttributeInterface _attribute, final GISCollectionData _data) { 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-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,6 +1,6 @@ /** * @creation 6 f\xE9vr. 2004 - * @modification $Date: 2008-05-13 12:11:01 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -43,11 +43,11 @@ * les calques SIG et des services associ\xE9s. * * @author Fred Deniger - * @version $Id: FSigVisuPanel.java,v 1.2.4.3 2008-05-13 12:11:01 bmarchan Exp $ + * @version $Id$ */ public abstract class FSigVisuPanel extends ZEbliCalquesPanel implements CtuluUndoRedoInterface { - private final CtuluCommandManager mng_; + protected CtuluCommandManager mng_; FSigAttibuteTypeManager attMng_; @@ -67,7 +67,7 @@ public FSigVisuPanel(final BGroupeCalque _gcMain, final FudaaCommonImplementation _impl) { super(_gcMain, new FSigVisuPanelController(_impl)); impl_ = _impl; - mng_ = new CtuluCommandManager(); +// mng_ = new CtuluCommandManager(); setModeVisible(true); setEbliFormatter(new EbliFormatter()); gisEditor_.setUi(getImpl()); @@ -111,7 +111,9 @@ } protected ZEditorDefault createGisEditor() { - return new FSigEditor(this, getCmdMng()); + ZEditorDefault editor=new FSigEditor(this); + mng_=editor.getMng(); + return editor; } protected BuMenu[] createSpecificMenus(final String _title) { Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,6 +1,6 @@ /* * @creation 6 avr. 2005 - * @modification $Date: 2008-05-13 12:10:38 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... @@ -54,7 +54,7 @@ /** * @author Fred Deniger - * @version $Id: TrGisProjectEditor.java,v 1.19.6.2 2008-05-13 12:10:38 bmarchan Exp $ + * @version $Id$ */ public class TrGisProjectEditor extends FSigEditor { @@ -62,7 +62,7 @@ * @param _panel */ public TrGisProjectEditor(final TrVisuPanelEditor _panel) { - super(_panel,_panel.getCmdMng()); + super(_panel); } protected final TrVisuPanelEditor getTrPanel() { Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-10-26 20:18:54 UTC (rev 4098) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-10-26 21:50:16 UTC (rev 4099) @@ -1,6 +1,6 @@ /* * @creation 6 avr. 2005 - * @modification $Date: 2007-06-14 12:01:41 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... @@ -69,7 +69,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public abstract class TrVisuPanelEditor extends TrVisuPanel { @@ -164,7 +164,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public abstract class EditPropertiesFromGeom extends EditPropertiesAbstract { @@ -181,7 +181,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class SiEditGeomAction extends EditPropertiesFromGeom { @@ -197,7 +197,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class NodalEditGeomAction extends EditPropertiesFromGeom { @@ -212,7 +212,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class NodalEditAction extends EditProperties { @@ -232,7 +232,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class SiEditAction extends EditProperties { @@ -253,7 +253,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class ElementEditAction extends EditProperties { @@ -273,7 +273,7 @@ /** * @author Fred Deniger - * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ + * @version $Id$ */ public class ElementEditGeomAction extends EditPropertiesFromGeom { @@ -422,7 +422,9 @@ } public FSigEditor createGisEditor() { - return new TrGisProjectEditor(this); + FSigEditor editor=new TrGisProjectEditor(this); + mng_=editor.getMng(); + return editor; } /** Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-10-26 20:18:59
|
Revision: 4098 http://fudaa.svn.sourceforge.net/fudaa/?rev=4098&view=rev Author: bmarchan Date: 2008-10-26 20:18:54 +0000 (Sun, 26 Oct 2008) Log Message: ----------- Correctif pour que La GISZoneCollection cr?\195?\169?\195?\169e corresponde au mod?\195?\168le Modified Paths: -------------- 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/calque/edition/ZModeleLigneBriseeEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 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-26 13:58:25 UTC (rev 4097) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-26 20:18:54 UTC (rev 4098) @@ -45,9 +45,13 @@ * Constructeur */ public ZModeleGeometryDefault() { - geometries_=new GISZoneCollectionGeometry(); + this(new GISZoneCollectionGeometry()); } + public ZModeleGeometryDefault(GISZoneCollectionGeometry _zone) { + geometries_=_zone; + } + public void getDomaineForGeometry(int _idxGeom, GrBoite _target) { if (geometries_ == null || geometries_.getNumGeometries() == 0) { return; 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-26 13:58:25 UTC (rev 4097) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-26 20:18:54 UTC (rev 4098) @@ -236,14 +236,15 @@ } } - public ZModeleLigneBriseeDefault() {} + public ZModeleLigneBriseeDefault() { + this(new GISZoneCollectionLigneBrisee()); + } /** * @param _zone la zone: non copiee */ public ZModeleLigneBriseeDefault(final GISZoneCollectionLigneBrisee _zone) { - // ne pas changer cela - geometries_ = _zone; + super(_zone); } public final boolean containsPolygone() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2008-10-26 13:58:25 UTC (rev 4097) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2008-10-26 20:18:54 UTC (rev 4098) @@ -43,7 +43,9 @@ */ public class ZModeleLigneBriseeEditable extends ZModeleLigneBriseeDefault{ - public ZModeleLigneBriseeEditable() {} + public ZModeleLigneBriseeEditable() { + this(new GISZoneCollectionLigneBrisee()); + } public ZModeleLigneBriseeEditable(final GISZoneCollectionLigneBrisee _zone) { super(_zone); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-26 13:58:25 UTC (rev 4097) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-26 20:18:54 UTC (rev 4098) @@ -222,8 +222,7 @@ * @param _zone la zone: non copiee */ public ZModeleMultiPointEditable(final GISZoneCollectionMultiPoint _zone) { - // ne pas changer cela - geometries_ = _zone; + super(_zone); } public BuTable createValuesTable(final ZCalqueAffichageDonneesInterface _layer) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-26 13:58:30
|
Revision: 4097 http://fudaa.svn.sourceforge.net/fudaa/?rev=4097&view=rev Author: hadouxad Date: 2008-10-26 13:58:25 +0000 (Sun, 26 Oct 2008) Log Message: ----------- - Mise en place du bool?\195?\169en pour les resizes - Changement de tous les noms des fichier avec ceux de Didier (?\195?\169limination des doublons des titres des trpostlayoutfille auto) - Mise en place du lecteur du projet plus souple: si il ne peut pas lire certains fichiers il continue - Mise en place d'un rapport d erreurs lors du chargement du projet, ce rapport est affich?\195?\169 a la fin du chargement -Mise en place de la doc dans le projet aide - Les documents html ont ?\195?\169t?\195?\169 convertis en doc openoffice 3.0 AUTOPORTANT (pratique pour les modifier et les commiter), il faut donc penser ?\195?\160 passer les images sous la moulinette gimp pour les optimiser... Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/README.txt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_fr.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_en.odt branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_fr.odt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistanceErrorManager.java Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/README.txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/README.txt (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/README.txt 2008-10-26 13:58:25 UTC (rev 4097) @@ -0,0 +1,30 @@ +Doc r\xE9alis\xE9e \xE0 l'a\xE9ide d'openoffice 3.0 + + +****TIPS**** + + +Proc\xE9dure conversion: +- ouvrir fichier html avec opeenoffice +- exporter au format openoffice (choix 1 document ...) +- ouvrir l'export +- mettre l'affichage classique: decocher web pour avoir les pages +- retirer les liens des images poru avoir tout en un fichier autoportant +- enregistrer au format odt + + +Pour enregistrer les images \xE0 l'int\xE9rieur du doc et ne pas conserver les liens comme par d\xE9fautlt; +Edition / Liens... / Rompre les liens +=> Force \xE0 rompre tous les liens et enregistre les images dans le doc +WARNING: si on utilise ce proc\xE9d\xE9, penser \xE0 optimiser les tailles images avec gimp ou autre logiciel dessin vectoriel + + +** TODO ** + +Doc pre: +- Mettre des sommaires visualisable par le cutuluPdfviewer +- Refondre graphiquement (tableaux, titree, mise en page...) + +Doc post: +- Mettre a jour avec la doc actuelle +- garder la meme presentation visuelle \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_en.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/post/post_fr.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_en.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/reflux/reflux_fr.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_en.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_en.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_fr.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/rubar/rubar_fr.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_en.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_en.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_fr.odt =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/aide/src/prepro/doc_pdf/telemac/telemac_fr.odt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -26,7 +26,7 @@ final private WidgetAction alignWithResizeAction; - final private WidgetAction alignWithResizeActionProportionnal; + // final private WidgetAction alignWithResizeActionProportionnal; Set<EbliWidgetEditModeListener> listeners_ = new HashSet<EbliWidgetEditModeListener>(); BuMenuBar menuCalque_ = null; @@ -57,12 +57,11 @@ // scene_.getInteractionLayer(), ActionFactory // .createDefaultAlignWithMoveDecorator(), false); - alignWithResizeActionProportionnal = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_ + alignWithResizeAction = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_ .getVisu(), scene_ .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); - alignWithResizeAction = alignWithResizeActionProportionnal; - + rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); // -- ajoute l'action du zoom ( ctrl + clic) scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); @@ -73,9 +72,9 @@ } - public WidgetAction getAlignWithResizeActionProportionnal() { - return alignWithResizeActionProportionnal; - } +// public WidgetAction getAlignWithResizeActionProportionnal() { +// return alignWithResizeActionProportionnal; +// } public boolean isEditable() { return false; @@ -171,9 +170,9 @@ return alignWithResizeAction; } - public WidgetAction getProportionnalResizeAction() { - return alignWithResizeActionProportionnal; - } +// public WidgetAction getProportionnalResizeAction() { +// return alignWithResizeActionProportionnal; +// } public BuToolBar getToolbarComponent() { return null; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -353,7 +353,7 @@ if (canMove_) widget_.getActions().addAction(actionMove_); // -- action mis de cote poru le debut \xE9ais reference indispensable --// - actionResizeProportionel_ = widget_.getEbliScene().getController().getProportionnalResizeAction(); + // actionResizeProportionel_ = widget_.getEbliScene().getController().getProportionnalResizeAction(); } @@ -468,14 +468,14 @@ /** * Passe du resize classique au resize proportionnel */ - public void switchToResizeProportionnal() { - if (!canResize_) - return; - if (actionResize_ != null && actionResizeProportionel_ != null) - widget_.getActions().removeAction(actionResize_); - - widget_.getActions().addAction(actionResizeProportionel_); - } +// public void switchToResizeProportionnal() { +// if (!canResize_) +// return; +// if (actionResize_ != null && actionResizeProportionel_ != null) +// widget_.getActions().removeAction(actionResize_); +// +// widget_.getActions().addAction(actionResizeProportionel_); +// } public void switchToResizeClassical() { if (!canResize_) Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -75,7 +75,7 @@ final EbliWidgetController controller = controll; if (resizeProportionnel_) { - controller.switchToResizeProportionnal(); + //controller.switchToResizeProportionnal(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); widget_.getController().isProportional = true; // -- enregistrement de la commande undoRedo --// @@ -83,13 +83,13 @@ cmd_.addCmd(new CtuluCommand(){ public void redo() { - controller.switchToResizeProportionnal(); + // controller.switchToResizeProportionnal(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); widget_.getController().isProportional = true; } public void undo() { - controller.switchToResizeClassical(); + // controller.switchToResizeClassical(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); widget_.getController().isProportional = false; } @@ -98,7 +98,7 @@ } } else { - controller.switchToResizeClassical(); + //controller.switchToResizeClassical(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); widget_.getController().isProportional = false; // -- enregistrement de la commande undoRedo --// @@ -106,13 +106,13 @@ cmd_.addCmd(new CtuluCommand(){ public void redo() { - controller.switchToResizeClassical(); + // controller.switchToResizeClassical(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); widget_.getController().isProportional = false; } public void undo() { - controller.switchToResizeProportionnal(); + // controller.switchToResizeProportionnal(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); widget_.getController().isProportional = true; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -5,6 +5,7 @@ import java.awt.Rectangle; import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.AlignWithMoveDecorator; import org.netbeans.api.visual.action.AlignWithWidgetCollector; import org.netbeans.api.visual.action.ResizeProvider; @@ -22,199 +23,202 @@ public class AlignWithResizeProportionalStrategy extends AlignWithSupport implements ResizeStrategy, ResizeProvider { - private boolean outerBounds; + private boolean outerBounds; - public AlignWithResizeProportionalStrategy(AlignWithWidgetCollector collector, LayerWidget interractionLayer, - AlignWithMoveDecorator decorator, boolean outerBounds) { - super(collector, interractionLayer, decorator); - this.outerBounds = outerBounds; - } + public AlignWithResizeProportionalStrategy(AlignWithWidgetCollector collector, LayerWidget interractionLayer, + AlignWithMoveDecorator decorator, boolean outerBounds) { + super(collector, interractionLayer, decorator); + this.outerBounds = outerBounds; + } - public Rectangle boundsSuggested(Widget widget, Rectangle originalBounds, Rectangle suggestedBounds, - ControlPoint controlPoint) { - final double wDivParH = CtuluLibImage.getRatio(originalBounds.width, originalBounds.height); - final double hDivParW = CtuluLibImage.getRatio(originalBounds.height, originalBounds.width); - Insets insets = widget.getBorder().getInsets(); - int minx = insets.left + insets.right; - int miny = insets.top + insets.bottom; + public Rectangle boundsSuggested(Widget widget, Rectangle originalBounds, Rectangle suggestedBounds, + ControlPoint controlPoint) { + final double wDivParH = CtuluLibImage.getRatio(originalBounds.width, originalBounds.height); + final double hDivParW = CtuluLibImage.getRatio(originalBounds.height, originalBounds.width); + Insets insets = widget.getBorder().getInsets(); + int minx = insets.left + insets.right; + int miny = insets.top + insets.bottom; - // double coefficientProportionnalite = (suggestedBounds.width * 1.0) / - // (suggestedBounds.height * 1.0); - // if (coefficientProportionnalite == 0) - // coefficientProportionnalite = 1; - int oldWidht = suggestedBounds.width; - int oldHeight = suggestedBounds.height; + // double coefficientProportionnalite = (suggestedBounds.width * 1.0) / + // (suggestedBounds.height * 1.0); + // if (coefficientProportionnalite == 0) + // coefficientProportionnalite = 1; - suggestedBounds = widget.convertLocalToScene(suggestedBounds); + suggestedBounds = widget.convertLocalToScene(suggestedBounds); - Point suggestedLocation, point; - int tempx, tempy; + Point suggestedLocation, point; + int tempx, tempy; - switch (controlPoint) { - case BOTTOM_CENTER: - suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y - + suggestedBounds.height); - if (!outerBounds) - suggestedLocation.y -= insets.bottom; + switch (controlPoint) { + case BOTTOM_CENTER: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y + + suggestedBounds.height); + if (!outerBounds) + suggestedLocation.y -= insets.bottom; - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, + false); - if (!outerBounds) - point.y += insets.bottom; + if (!outerBounds) + point.y += insets.bottom; - suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); - break; - case BOTTOM_LEFT: - suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height); - if (!outerBounds) { - suggestedLocation.y -= insets.bottom; - suggestedLocation.x += insets.left; - } + break; + case BOTTOM_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height); + if (!outerBounds) { + suggestedLocation.y -= insets.bottom; + suggestedLocation.x += insets.left; + } - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); - if (!outerBounds) { - point.y += insets.bottom; - point.x -= insets.left; - } + if (!outerBounds) { + point.y += insets.bottom; + point.x -= insets.left; + } - suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); - tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); - suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; - suggestedBounds.x = tempx; - break; - case BOTTOM_RIGHT: - suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y - + suggestedBounds.height); - if (!outerBounds) { - suggestedLocation.y -= insets.bottom; - suggestedLocation.x -= insets.right; - } + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case BOTTOM_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y + + suggestedBounds.height); + if (!outerBounds) { + suggestedLocation.y -= insets.bottom; + suggestedLocation.x -= insets.right; + } - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); - if (!outerBounds) { - point.y += insets.bottom; - point.x += insets.right; - } + if (!outerBounds) { + point.y += insets.bottom; + point.x += insets.right; + } - suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); - suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); - break; - case CENTER_LEFT: - suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height / 2); - if (!outerBounds) - suggestedLocation.x += insets.left; + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + case CENTER_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height / 2); + if (!outerBounds) + suggestedLocation.x += insets.left; - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, + false); - if (!outerBounds) - point.x -= insets.left; + if (!outerBounds) + point.x -= insets.left; - tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); - suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; - suggestedBounds.x = tempx; - break; - case CENTER_RIGHT: - suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y - + suggestedBounds.height / 2); - if (!outerBounds) - suggestedLocation.x -= insets.right; + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case CENTER_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y + + suggestedBounds.height / 2); + if (!outerBounds) + suggestedLocation.x -= insets.right; - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, + false); - if (!outerBounds) - point.x += insets.right; + if (!outerBounds) + point.x += insets.right; - suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); - break; - case TOP_CENTER: - suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y); - if (!outerBounds) - suggestedLocation.y += insets.top; + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + case TOP_CENTER: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y); + if (!outerBounds) + suggestedLocation.y += insets.top; - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, + false); - if (!outerBounds) - point.y -= insets.top; + if (!outerBounds) + point.y -= insets.top; - tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); - suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; - suggestedBounds.y = tempy; - break; - case TOP_LEFT: - suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y); - if (!outerBounds) { - suggestedLocation.y += insets.top; - suggestedLocation.x += insets.left; - } + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; + break; + case TOP_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y); + if (!outerBounds) { + suggestedLocation.y += insets.top; + suggestedLocation.x += insets.left; + } - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); - if (!outerBounds) { - point.y -= insets.top; - point.x -= insets.left; - } + if (!outerBounds) { + point.y -= insets.top; + point.x -= insets.left; + } - tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); - suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; - suggestedBounds.y = tempy; + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; - tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); - suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; - suggestedBounds.x = tempx; - break; - case TOP_RIGHT: - suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y); - if (!outerBounds) { - suggestedLocation.y += insets.top; - suggestedLocation.x -= insets.right; - } + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case TOP_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y); + if (!outerBounds) { + suggestedLocation.y += insets.top; + suggestedLocation.x -= insets.right; + } - point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, - false); + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); - if (!outerBounds) { - point.y -= insets.top; - point.x += insets.right; - } + if (!outerBounds) { + point.y -= insets.top; + point.x += insets.right; + } - tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); - suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; - suggestedBounds.y = tempy; + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; - suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); - break; - } + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + } - // -- proportions respectees --// - // double coeff = ((double) suggestedBounds.height) / ((double) oldHeight); - if (suggestedBounds.height != originalBounds.height) { - suggestedBounds.width = (int) (wDivParH * suggestedBounds.height); - } - if (suggestedBounds.width != originalBounds.width) { - suggestedBounds.height = (int) (hDivParW * suggestedBounds.width); - } + if(widget instanceof EbliWidget){ + boolean isProportionnal= ((EbliWidget)widget).getController().isProportional; + if(isProportionnal){ + // -- proportions respectees --// + // double coeff = ((double) suggestedBounds.height) / ((double) oldHeight); + if (suggestedBounds.height != originalBounds.height) { + suggestedBounds.width = (int) (wDivParH * suggestedBounds.height); + } + if (suggestedBounds.width != originalBounds.width) { + suggestedBounds.height = (int) (hDivParW * suggestedBounds.width); + } + } - return widget.convertSceneToLocal(suggestedBounds); - } + } + return widget.convertSceneToLocal(suggestedBounds); + } - public void resizingStarted(Widget widget) { - show(); - } + public void resizingStarted(Widget widget) { + show(); + } - public void resizingFinished(Widget widget) { - hide(); - } + public void resizingFinished(Widget widget) { + hide(); + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -56,6 +56,23 @@ return res; } + + public void elimineDoublonNomsLayout(){ + List<TrPostLayoutFille> liste=getAllLayoutFille(); + + for(int i=0;i<liste.size();i++){ + int cpt=1; + for(int j=i; j<liste.size();j++){ + if(liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)){ + + liste.get(j).previousTitleFrame+="_"+(cpt++); + } + } + + } + + } + /** * @return la fenetre layout active. */ Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistanceErrorManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistanceErrorManager.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistanceErrorManager.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -0,0 +1,101 @@ +package org.fudaa.fudaa.tr.post.persist; + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.fudaa.tr.common.TrResource; + + +/** + * Manager qui indique toutes les erreurs qui se sont produites pendant le chargement. + * @author Adrien Hadoux + * + */ +public class TrPostPersistanceErrorManager { + + + java.util.List<String> listeMessageError=new ArrayList<String>(); + + public void addMessageError(String message){ + listeMessageError.add(message); + } + + public void clear(){ + + listeMessageError.clear(); + } + + private class ModeleTableError extends DefaultTableModel{ + + + java.util.List<String> listeMessageError_; + + public ModeleTableError(List<String> listeMessage) { + + + listeMessageError_ = listeMessage; + } + + @Override + public int getColumnCount() { + // TODO Auto-generated method stub + return 1; + } + + @Override + public String getColumnName(int column) { + // TODO Auto-generated method stub + return "Messages"; + } + + @Override + public int getRowCount() { + // TODO Auto-generated method stub + return listeMessageError_.size(); + } + + @Override + public Object getValueAt(int row, int column) { + // TODO Auto-generated method stub + return listeMessageError_.get(row); + } + + + } + + public void showDialog(CtuluUI ui){ + if(listeMessageError.size()==0){ + ui.message(TrResource.getS("Chargement termin\xE9"), TrResource.getS("Chargement termin\xE9 avec succ\xE8s"), false); + + return; + } + + JTable table=new JTable(new DefaultTableModel(listeMessageError.toArray(),listeMessageError.size())); + final Frame f = CtuluLibSwing.getFrameAncestorHelper(ui.getParentComponent()); + JDialog dialog_ = new JDialog(f); + dialog_.setModal(true); + dialog_.setTitle("Chargement termin\xE9"); + final JPanel container = new JPanel(new BorderLayout()); + container.add(new JScrollPane(table), BorderLayout.CENTER); + + container.add(new JLabel( TrResource.getS("Chargement termin\xE9 avec erreur(s)")),BorderLayout.NORTH); + dialog_.setContentPane(container); + dialog_.setLocationRelativeTo(ui.getParentComponent()); + dialog_.setSize(300,200); + dialog_.setVisible(true); + + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-24 20:42:43 UTC (rev 4096) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-26 13:58:25 UTC (rev 4097) @@ -50,6 +50,7 @@ import org.fudaa.fudaa.tr.post.actions.TrPostActionFusionCalques; import org.netbeans.api.visual.widget.Widget; +import com.memoire.fu.FuLib; import com.memoire.fu.FuLog; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; @@ -73,18 +74,19 @@ * Point d'entr\xE9e poru charger un projet repertoire. Continet le path du directory. Cela permet de placer ce fichier * n'importe ou sur le ddur et de pouvoir charger le projet. Peut etre g\xE9r\xE9 comem un raccourcis. */ - public static final String setupProject = "setup" + EXTENSION; + public static final String setupProject = "setup";// + EXTENSION; /** * Fichier qui d\xE9crit tous les contenu layout sauvegard\xE9s Et noms des balises importantes */ - public final static String INFOSCENE = "InfoLayout" + EXTENSION; + public final static String INFOSCENE = "info_layout";//"InfoLayout" + EXTENSION; public final static String BALISESCENES = "LayoutList"; /** * Fichier qui d\xE9crit int\xE9gralement le contenu d'une scene */ - public final static String DESCRIPTORSCENE = "layout"; + public final static String EXTENSION_REPLAYOUT=".LAY"; + public final static String DESCRIPTORSCENE = "desc_frame"; public static String ATTRIBUTESCENE = "LAYOUT"; /** @@ -93,7 +95,13 @@ //public final static String DESCRIPTORSOURCE = "sources" + EXTENSION; public final static String BALISESOURCES = "SourcesList"; public static String ATTRIBUTESOURCE = "FICHIER"; - public final static String FileWidgetNames = "FramesNames"+ EXTENSION; + public final static String FileWidgetNames = "nom_frame";//"FramesNames"+ EXTENSION; + + + public final static String REP_VAR="VARIABLES"; + public final static String REP_CALQUES="CALQUES"; + public final static String REP_GRAPHES="GRAPHES"; + public final static String REP_TEXTES="TEXTES"; /** * Le projet a persiter */ @@ -108,10 +116,9 @@ TrPostCommonImplementation ui_; - //-- elements de base tagg\xE9s par xstream pour etre plus explicites dans les fichiers --// + TrPostPersistanceErrorManager managerError=new TrPostPersistanceErrorManager(); - public TrPostPersistenceManager(final TrPostProjet projet) { super(); trprojet_ = projet; @@ -335,16 +342,14 @@ out.writeObject(XmlCommentaire.getCommentaireLayout()); // -- g\xE9n\xE9ration du xml pour la scene --// - final int nbFichiersToGenrate = trprojet_.impl_.getAllLayoutFille().size(); + List<TrPostLayoutFille> listeFilles=trprojet_.impl_.getAllLayoutFille(); + final int nbFichiersToGenrate = listeFilles.size(); out.writeInt(nbFichiersToGenrate); for (int i = 0; i < nbFichiersToGenrate; i++) { // creation du fichier de desciption des scenes dans le repertoire de meme nom. - String nomFichierLayout = /* - * projet_.getAbsolutePath() + File.separator - * + - */DESCRIPTORSCENE + (i + 1) + EXTENSION + File.separator + DESCRIPTORSCENE + (i + 1) - + EXTENSION; + String nomLayout=FuLib.clean(listeFilles.get(i).previousTitleFrame); + String nomFichierLayout = nomLayout + EXTENSION_REPLAYOUT + File.separator + DESCRIPTORSCENE ; out.writeObject(new LayoutDescriptor(nomFichierLayout)); @@ -376,6 +381,11 @@ * @throws ClassNotFoundException */ public List<String> loadDescriptorScenes(final File file) { + + if(!file.canRead()){ + managerError.addMessageError("FilePath "+file.getPath()+" du descriptor introuvable"); + return new ArrayList<String>(); + } // -- outputstream du xstream --// final List<String> listeFiles = new ArrayList<String>(); ObjectInputStream in = null; @@ -407,6 +417,7 @@ } catch (final FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); + managerError.addMessageError("infolayout: path "+file.getPath()+" invalide. Impossible de charger des layouts"); } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -615,6 +626,8 @@ // -- tentative de chargement du source dans le multi-projet --// multiProjectActivator.active(f, trprojet_.impl_, listeCouplesIdSources.get(i).IdSource); } + }else{ + managerError.addMessageError("setup: path "+path+" invalide. Fichier r\xE9sultat non charg\xE9"); } } } @@ -714,7 +727,7 @@ if (savePersistDirectory(saveAs)) { // -- etape 1: creation du repertoire des graphe et calques --// - final String pathVariables = projet_.getAbsolutePath() + File.separator + "Variables"; + final String pathVariables = projet_.getAbsolutePath() + File.separator + REP_VAR; try { File fileVar = new File(pathVariables); @@ -756,12 +769,13 @@ final String title = fille.previousTitleFrame; final EbliScene scene = fille.getScene(); if (listFilles.size() != 0) progression("Cr\xE9ation du fichier du layout " + title, 20 + 70 / listFilles.size()); - file = new File(projet_.getAbsolutePath() + File.separator + DESCRIPTORSCENE + cpt + EXTENSION); + String nomLayout=FuLib.clean(fille.previousTitleFrame)+ EXTENSION_REPLAYOUT ; + file = new File(projet_.getAbsolutePath() + File.separator + nomLayout); // -- sauvegarde du persitant --// parametres.put("dimensions", fille.getSize()); parametres.put("location", fille.getLocation()); parametres.put("scene", scene); - savePersitSceneXml(scene, title, file, parametres, listeNomsComposants,cpt); + savePersitSceneXml(scene, title, file, parametres, listeNomsComposants,cpt,nomLayout); cpt++; } @@ -860,13 +874,16 @@ * @return */ public boolean loadProject(final boolean executeByExplorer, final File explorerFile) { - + managerError.clear(); + //-- on elimine les doublons potentiels des frames layouts --// + ui_.elimineDoublonNomsLayout(); + progression("Lecture du r\xE9pertoire", 10); // -- etape 1 lecture du repertoire global ou du fichier param --// if (loadPersistDirectory(executeByExplorer, explorerFile)) { File file; - final String pathVariables = projet_.getAbsolutePath() + File.separator + "Variables"; + final String pathVariables = projet_.getAbsolutePath() + File.separator + REP_VAR; try { new File(pathVariables).mkdir(); } catch (final Exception e) { @@ -898,8 +915,6 @@ file = new File(projet_.getAbsolutePath() + File.separator + FileWidgetNames); final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms = loadNomsFrames(file); - int cpt = 1; - for (final String fichier : listeFichiers) { file = new File(fichier); if (listeFichiers.size() != 0) progression("chargement du fichier " + fichier, 30 + 70 / listeFichiers.size()); @@ -909,8 +924,8 @@ // -- sauvegarde du persitant --// trprojet_.getImpl().addInternalFrame(postFrame); - String nomRepertoireLayout=DESCRIPTORSCENE + (cpt++) + EXTENSION; - loadPersitSceneXml(file, postFrame, parametres, listeCouplesNoms,nomRepertoireLayout); + + loadPersitSceneXml(file, postFrame, parametres, listeCouplesNoms); } // -- etape 6; lecture des variables --// @@ -918,7 +933,8 @@ loadVariables(pathVariables); progression("", 100); - ui_.message(TrResource.getS("Chargement termin\xE9"), TrResource.getS("Chargement termin\xE9 avec succ\xE8s"), false); + managerError.showDialog(ui_); + //ui_.message(TrResource.getS("Chargement termin\xE9"), TrResource.getS("Chargement termin\xE9 avec succ\xE8s"), false); return true; @@ -959,7 +975,7 @@ private void fillMapWithDataPath(final Map parametres,String repertoireLayout){ final String pathGraphes = projet_.getAbsolutePath() + File.separator + repertoireLayout + File.separator - + "Graphes"; + + REP_GRAPHES; try { File fichierGraphes = new File(pathGraphes); if (fichierGraphes.isDirectory()) { @@ -973,7 +989,7 @@ FuLog.debug("Le repertoire des graphes existe deja"); } final String pathCalques = projet_.getAbsolutePath() + File.separator + repertoireLayout + File.separator - + "Calques"; + + REP_CALQUES; try { File fichierCalques = new File(pathCalques); if (fichierCalques.isDirectory()) { @@ -987,7 +1003,7 @@ FuLog.debug("Le repertoire des calques existe deja"); } - final String pathText = projet_.getAbsolutePath() + File.separator + repertoireLayout + File.separator + "Textes"; + final String pathText = projet_.getAbsolutePath() + File.separator + repertoireLayout + File.separator + REP_TEXTES; try { File fichierText = new File(pathText); if (fichierText.isDirectory()) { @@ -1016,17 +1032,17 @@ * @throws IOException */ private void savePersitSceneXml(final EbliScene scene, final String title, File file, final Map parametres, - final List<EbliWidgetSerializeXml.CoupleNomId> listeNomsComposants,int cpt) { + final List<EbliWidgetSerializeXml.CoupleNomId> listeNomsComposants,int cpt,String titreRepertoireLayout) { // -- creation du repertoire du layout layoutN.POST--// file.mkdir(); // -- remplissage de la map avec les r\xE9pertoires calques/graphes/textes --// - fillMapWithDataPath(parametres, DESCRIPTORSCENE + cpt + EXTENSION); + fillMapWithDataPath(parametres, titreRepertoireLayout); // -- mise en place du fichier decrivant le contenu du layout --// - file = new File(file.getAbsolutePath() + File.separator + DESCRIPTORSCENE + cpt + EXTENSION); + file = new File(file.getAbsolutePath() + File.separator + DESCRIPTORSCENE);//DESCRIPTORSCENE + cpt + EXTENSION); // -- outputstream du xstream --// ObjectOutputStream out = null; @@ -1119,11 +1135,17 @@ * @throws InstantiationException */ private void loadPersitSceneXml(final File file, final TrPostLayoutFille fille, final Map parametres, - final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms,String repertoireLayout) { - + final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms) { + + if(!file.canRead()){ + managerError.addMessageError("Repertoire layout introuvable, "+file.getPath()+" incorrect"); + return; + } + + String nomRepertoireLayout=file.getPath().substring(0,file.getPath().lastIndexOf(DESCRIPTORSCENE) ); final EbliScene scenToUpdate = fille.getScene(); parametres.put("scene", scenToUpdate); - parametres.put("pathLayout", projet_.getAbsolutePath()+ File.separator +repertoireLayout); + parametres.put("pathLayout", nomRepertoireLayout); // -- inputstream du xstream --// ObjectInputStream in = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-24 20:42:48
|
Revision: 4096 http://fudaa.svn.sourceforge.net/fudaa/?rev=4096&view=rev Author: hadouxad Date: 2008-10-24 20:42:43 +0000 (Fri, 24 Oct 2008) Log Message: ----------- Mise a jour des buges et refactorisation de plusieurs trucs Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-10-24 20:42:43 UTC (rev 4096) @@ -623,4 +623,6 @@ X s\xE9lectionn\xE9:=Selected X: Interpolation Fusion=Fusion interpolation Bloquer la taille et la position de la frame=Lock the size and the location of the frame -D\xE9bloquer la taille et la position de la frame=Unlock the size and the location of the frame \ No newline at end of file +D\xE9bloquer la taille et la position de la frame=Unlock the size and the location of the frame +Redimensionnement classique de la taille de la frame=Classical resize of the frame +Redimensionner proportionnellement la taille de la frame=Proportional resizing of the frame Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -8,6 +8,7 @@ import javax.swing.ListSelectionModel; import org.fudaa.ebli.visuallibrary.actions.EbliAlignWithMoveStrategyProvider; +import org.fudaa.ebli.visuallibrary.resizestrategy.EbliWidgetActionFactory; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.HighlighterFactory; @@ -25,6 +26,8 @@ final private WidgetAction alignWithResizeAction; + final private WidgetAction alignWithResizeActionProportionnal; + Set<EbliWidgetEditModeListener> listeners_ = new HashSet<EbliWidgetEditModeListener>(); BuMenuBar menuCalque_ = null; @@ -49,9 +52,17 @@ .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); alignWithMoveAction = ActionFactory.createMoveAction(sp, sp); - alignWithResizeAction = ActionFactory.createAlignWithResizeAction(scene_.getVisu(), scene_.getInteractionLayer(), + // alignWithResizeAction = + // ActionFactory.createAlignWithResizeAction(scene_.getVisu(), + // scene_.getInteractionLayer(), ActionFactory + // .createDefaultAlignWithMoveDecorator(), false); + + alignWithResizeActionProportionnal = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_ + .getVisu(), scene_ + .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); - + alignWithResizeAction = alignWithResizeActionProportionnal; + rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); // -- ajoute l'action du zoom ( ctrl + clic) scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); @@ -62,6 +73,10 @@ } + public WidgetAction getAlignWithResizeActionProportionnal() { + return alignWithResizeActionProportionnal; + } + public boolean isEditable() { return false; } @@ -152,10 +167,14 @@ return rectangularSelection_; } - public WidgetAction getReisizeAction() { + public WidgetAction getResizeAction() { return alignWithResizeAction; } + public WidgetAction getProportionnalResizeAction() { + return alignWithResizeActionProportionnal; + } + public BuToolBar getToolbarComponent() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -22,6 +22,7 @@ import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionResize; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -51,6 +52,8 @@ */ WidgetAction actionMove_; WidgetAction actionResize_; + WidgetAction actionResizeProportionel_; + WidgetAction actionSelect_; protected boolean canDuplicate_ = true; protected boolean canMove_ = true; @@ -95,45 +98,56 @@ } - protected void constructMenuDupliquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { + private void constructMenuDupliquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { final JMenuItem menuItem1 = _popup.add(EbliResource.EBLI.getString("Dupliquer la frame")); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); menuItem1.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { + // -- liste des nodes candidats pour le UNdo/redo --// + ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); + duplication(listeNodeUndo); + cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, widget_.getEbliScene())); + } - // -- recuperation du node a dupliquer --// - final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + }); + } - // duplication du node en question - final EbliNode duplique = n.duplicate(null); + /** + * Action de duplication des nodes + * + * @return le node duplique + */ + public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo) { + // -- recuperation du node a dupliquer --// + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - // nouvelle position a cote de son predecesseur - // duplique.setPreferedLocation(nouvellePosition); + // duplication du node en question + final EbliNode duplique = n.duplicate(null); - // -- ajout dans la scene --// - if (duplique != null && widget_.getScene() != null) { - widget_.getEbliScene().addNode(duplique); + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); - // -- duplication des map de property graphique de la widget --// - duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); - // -- duplication de la taille --// - duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); + // -- ajout dans la scene --// + if (duplique != null && widget_.getScene() != null) { + widget_.getEbliScene().addNode(duplique); - // -- ajout de la commande undo/redo --// - final ArrayList<EbliNode> ln = new ArrayList<EbliNode>(); - ln.add(duplique); - cmd_.addCmd(new CommandeDuplicate(ln, widget_.getEbliScene())); + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); - } + // -- ajout de la commande undo/redo --// + listeNodeUndo.add(duplique); + - postActionDuplication(n, duplique); + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + } - } - - }); + postActionDuplication(n, duplique); + + return duplique; } /** @@ -187,7 +201,19 @@ _popup.add(boutonBloque); } + + + public AbstractButton boutonProportion = null; + public boolean isProportional = false; + + public void constructMenuResizeProportional(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { + final EbliWidgetActionSimple actionBloque = new EbliWidgetActionResize.Proportional(widget_); + boutonProportion = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); + _popup.add(boutonProportion); + } + + public void excecuteBlockOrDeblock() { if (boutonBloque == null) { final EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); @@ -211,32 +237,47 @@ } - protected void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { + private void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { final JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { + // -- liste des nodes candidats pour le UNdo/redo --// + ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); + ArrayList<Point> listeLocationUndo = new ArrayList<Point>(); + + + suppression(listeNodeUndo,listeLocationUndo); + cmd_.addCmd(new CommandSupprimer(listeNodeUndo, widget_.getEbliScene(),listeLocationUndo)); + + } - final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + }); + } - // -- on prend la location du node au moment de la suppression pour - // pouvoir la retablir dans le undo --// - // n.setPreferedLocation(widget_.getPreferredLocation()); - // -- on enregistre la commande undo redo --// - cmd_ - .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + /** + * Methode sp\xE9cifique a chaque node. par exemple les graphes et calques + * suppriment automatiquement leur l\xE9gende. + */ + public void suppression(final ArrayList<EbliNode> listeNodeUndo, ArrayList<Point> listeLocation) { - // -- on enleve le node de la scene --// - widget_.getEbliScene().removeNode(n); + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + listeNodeUndo.add(n); + listeLocation.add(n.getWidget().getLocation()); + // -- on prend la location du node au moment de la suppression pour + // pouvoir la retablir dans le undo --// + // n.setPreferedLocation(widget_.getPreferredLocation()); + // -- on enregistre la commande undo redo --// + - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); + // -- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); - } - - }); + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); } + /** * Methode de construction des menus de base @@ -262,6 +303,7 @@ _popup.addSeparator(); constructMenuMasquer(_popup, cmd_); constructMenuBloquer(_popup, cmd_); + constructMenuResizeProportional(_popup, cmd_); constructMenuSupprimer(_popup, cmd_); if (canDuplicate_) { _popup.addSeparator(); @@ -302,13 +344,17 @@ actionSelect_ = widget_.getEbliScene().createSelectAction(); widget_.getActions().addAction(actionSelect_); - actionResize_ = widget_.getEbliScene().getController().getReisizeAction(); + actionResize_ = widget_.getEbliScene().getController().getResizeAction(); if (canResize_) widget_.getActions().addAction(actionResize_); widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); actionMove_ = widget_.getEbliScene().getController().getMoveAction(); if (canMove_) widget_.getActions().addAction(actionMove_); + + // -- action mis de cote poru le debut \xE9ais reference indispensable --// + actionResizeProportionel_ = widget_.getEbliScene().getController().getProportionnalResizeAction(); + } public boolean fonctionsAlreadySpecified() { @@ -418,7 +464,28 @@ canResize_ = true; } + + /** + * Passe du resize classique au resize proportionnel + */ + public void switchToResizeProportionnal() { + if (!canResize_) + return; + if (actionResize_ != null && actionResizeProportionel_ != null) + widget_.getActions().removeAction(actionResize_); + + widget_.getActions().addAction(actionResizeProportionel_); + } + public void switchToResizeClassical() { + if (!canResize_) + return; + if (actionResizeProportionel_ != null && actionResize_ != null) + widget_.getActions().removeAction(actionResizeProportionel_); + widget_.getActions().addAction(actionResize_); + } + + public WidgetAction getActionMove() { return actionMove_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -1,6 +1,8 @@ package org.fudaa.ebli.visuallibrary.actions; import java.awt.Point; +import java.util.ArrayList; +import java.util.List; import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -13,38 +15,68 @@ */ public class CommandSupprimer implements CtuluCommand { - EbliNode nodeSupprime_; + List<EbliNode> nodeSupprime_; EbliScene scene_; - Point location_; + List<Point> location_; - public CommandSupprimer(final EbliNode nodeSupprime_, final EbliScene scene_, final Point _location) { + public CommandSupprimer(final EbliNode nodeSupprime, final EbliScene scene, final Point _location) { super(); - this.nodeSupprime_ = nodeSupprime_; - this.scene_ = scene_; - location_ = _location; + nodeSupprime_ = new ArrayList<EbliNode>(); + nodeSupprime_.add(nodeSupprime); + + this.scene_ = scene; + location_=new ArrayList<Point>(); + + location_.add( _location); } - public void redo() { + + public CommandSupprimer(final List<EbliNode> listeNode, final EbliScene scene, final List<Point> listeLocations) { + super(); + nodeSupprime_=listeNode; + location_ = listeLocations; + this.scene_ = scene; + } + + public void redoUnit(EbliNode nodeSupprime) { // --rattachement du node dans la scene --// - scene_.removeNode(nodeSupprime_); + scene_.removeNode(nodeSupprime); // -- raffraichissement de la scene --// scene_.refresh(); } - public void undo() { + public void undoUnit(EbliNode nodeSupprime, Point location) { // -- de nouveau suppression du node dans la scene --// - scene_.addNode(nodeSupprime_); + scene_.addNode(nodeSupprime); // -- repositionnement originel de la widget --// - nodeSupprime_.getWidget().setPreferredLocation(nodeSupprime_.getWidget().convertSceneToLocal(location_)); + nodeSupprime.getWidget().setPreferredLocation(nodeSupprime.getWidget().convertSceneToLocal(location)); // -- raffraichissement de la scene --// scene_.refresh(); } + + public void redo() { + for (int i = 0; i < nodeSupprime_.size(); i++) { + EbliNode node = nodeSupprime_.get(i); + redoUnit(node); + } + } + + public void undo() { + for (int i = 0; i < nodeSupprime_.size(); i++) { + EbliNode node=nodeSupprime_.get(i); + Point location=new Point(); + if(location_.size()>i) + location =location_.get(i); + undoUnit(node, location); + } + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -1,16 +1,16 @@ package org.fudaa.ebli.visuallibrary.actions; +import java.util.Collection; import java.util.Iterator; -import java.util.Set; import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; public class CommandUndoRedoPaste implements CtuluCommand { - Set<EbliNode> nodesPasted_; + Collection<EbliNode> nodesPasted_; - public CommandUndoRedoPaste(final Set<EbliNode> _nodesPasted) { + public CommandUndoRedoPaste(final Collection<EbliNode> _nodesPasted) { super(); nodesPasted_ = _nodesPasted; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.actions; +import java.awt.Point; import java.util.ArrayList; import java.util.Iterator; @@ -15,17 +16,25 @@ public class CommandeChangeWidgetScene implements CtuluCommand { ArrayList<EbliNode> nodeDuplique_; - + ArrayList<Point> previsouLocation_; + ArrayList<Point> newLocation_; + EbliScene sceneDepart_; EbliScene sceneDestination_; - public CommandeChangeWidgetScene(final ArrayList<EbliNode> nodeDuplique_, final EbliScene sceneDep, - final EbliScene sceneDest) { + public CommandeChangeWidgetScene(final ArrayList<EbliNode> nodeDuplique, final EbliScene sceneDep, + final EbliScene sceneDest, ArrayList<Point> previsouLocation) { super(); - this.nodeDuplique_ = nodeDuplique_; + this.nodeDuplique_ = nodeDuplique; this.sceneDepart_ = sceneDep; sceneDestination_ = sceneDest; - + previsouLocation_ = previsouLocation; + + newLocation_ = new ArrayList<Point>(); + for (EbliNode node : nodeDuplique_) { + newLocation_.add(node.getWidget().getLocation()); + } + } public void redo() { @@ -41,11 +50,14 @@ public void undo() { // -- redo unitaire execute pour chaque node dupliques --// + int cpt = 0; for (final Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { final EbliNode node = it.next(); sceneDestination_.removeNode(node); sceneDestination_.refresh(); sceneDepart_.addNode(node); + if (previsouLocation_.size() > cpt) + node.getWidget().setPreferredLocation(node.getWidget().convertSceneToLocal(previsouLocation_.get(cpt++))); sceneDepart_.refresh(); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -49,7 +49,7 @@ final ArrayList<EbliNode> listeNodeADupliquer = new ArrayList<EbliNode>(); - final ArrayList<EbliNode> listeNouveauxNodes = new ArrayList<EbliNode>(); + ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); // -- parcours des nodes for (final Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { @@ -68,36 +68,48 @@ } sceneDestination_ = selectionneSceneNode(); - + // -- duplication des noeuds saisis --// for (final Iterator<EbliNode> it = listeNodeADupliquer.iterator(); it.hasNext();) { final EbliNode currentNode = it.next(); // -- duplication du node --// - final EbliNode node = currentNode.duplicate(null); - if (node != null) { + + EbliNode node = currentNode.getWidget().getController().duplication(listeNodeUndo); - // -- ajout du node dans la scene --// - sceneDestination_.addNode(node); - - node.getWidget().getController().postActionDuplication(currentNode, node); - node.getWidget().getController().setDescription(currentNode.getWidget().getController().getDescription()); - // -- ajout du noeud --// - listeNouveauxNodes.add(node); - - // -- duplication des map de property graphique de la widget --// - node.getWidget().setPropGraphique(currentNode.getWidget().duplicateGraphicalProperties()); - // -- duplication de la taille --// - node.getWidget().setPreferredBounds(currentNode.getWidget().getPreferredBounds()); - - // -- rafraichissement de la scene --// - sceneDestination_.refresh(); - - } + + + // final EbliNode node = currentNode.duplicate(null); + // if (node != null) { + // + // // -- ajout du node dans la scene --// + // sceneDestination_.addNode(node); + // + // node.getWidget().getController().postActionDuplication(currentNode, + // node); + //node.getWidget().getController().setDescription(currentNode.getWidget(). + // getController().getDescription()); + // // -- ajout du noeud --// + // listeNouveauxNodes.add(node); + // + // // -- duplication des map de property graphique de la widget --// + // node.getWidget().setPropGraphique(currentNode.getWidget(). + // duplicateGraphicalProperties()); + // // -- duplication de la taille --// + // node.getWidget().setPreferredBounds(currentNode.getWidget(). + // getPreferredBounds()); + // + // // -- rafraichissement de la scene --// + // sceneDestination_.refresh(); + // + // } } - + + + cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, sceneDestination_)); // -- creation de l action undo/redo pour les nodes --// - cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, sceneDestination_)); + // cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, + // sceneDestination_)); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionResize.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -0,0 +1,133 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.event.ActionEvent; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; +import org.fudaa.ebli.visuallibrary.EbliWidgetController; + +/** + * Action qui resize les widgets proportionnellement + * + * @author Adrien Hadoux + */ +public class EbliWidgetActionResize extends EbliWidgetActionSimple { + + private static final long serialVersionUID = 1L; + + final CtuluCommandContainer cmd_; + boolean resizeProportionnel_ = true; + EbliWidget widget_; + + public EbliWidgetActionResize(final String name, final Icon ic, final String id, + final EbliWidget _widget, + final boolean proportionnel) { + super(_widget.getEbliScene(), name, ic, id); + + widget_ = _widget; + cmd_ = _widget.getEbliScene().getCmdMng(); + resizeProportionnel_ = proportionnel; + } + + @SuppressWarnings("serial") + public static class Proportional extends EbliWidgetActionResize { + + public Proportional(final EbliWidget _widget) { + super(EbliResource.EBLI.getString("Resize proportionnel"), EbliResource.EBLI.getIcon("lock_16"), + "RESIZEPEWIDGET", + _widget, true); + setDefaultToolTip(EbliResource.EBLI.getString("Redimensionner proportionnellement la taille de la frame")); + + } + + } + + @SuppressWarnings("serial") + public static class Classical extends EbliWidgetActionResize { + + public Classical(final EbliWidget _widget) { + super(EbliResource.EBLI.getString("Resize classique"), EbliResource.EBLI.getIcon("unblock_16"), "RESIZEEWIDGET", + _widget, false); + setDefaultToolTip(EbliResource.EBLI.getString("Redimensionnement classique de la taille de la frame")); + + } + + } + + @Override + public void actionPerformed(final ActionEvent e) { + + EbliWidgetController controll; + + if (widget_ instanceof EbliWidgetBordureSingle) { + + controll = ((EbliWidgetBordureSingle) widget_).getBordureController(); + } else if (widget_.getParentWidget() instanceof EbliWidgetBordureSingle) { + controll = ((EbliWidgetBordureSingle) widget_.getParentWidget()).getBordureController(); + } else + controll = widget_.getController(); + + final EbliWidgetController controller = controll; + + if (resizeProportionnel_) { + controller.switchToResizeProportionnal(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); + widget_.getController().isProportional = true; + // -- enregistrement de la commande undoRedo --// + if (cmd_ != null) { + cmd_.addCmd(new CtuluCommand(){ + + public void redo() { + controller.switchToResizeProportionnal(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); + widget_.getController().isProportional = true; + } + + public void undo() { + controller.switchToResizeClassical(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); + widget_.getController().isProportional = false; + } + + }); + + } + } else { + controller.switchToResizeClassical(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); + widget_.getController().isProportional = false; + // -- enregistrement de la commande undoRedo --// + if (cmd_ != null) { + cmd_.addCmd(new CtuluCommand(){ + + public void redo() { + controller.switchToResizeClassical(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Proportional(widget_)); + widget_.getController().isProportional = false; + } + + public void undo() { + controller.switchToResizeProportionnal(); + widget_.getController().boutonProportion.setAction(new EbliWidgetActionResize.Classical(widget_)); + widget_.getController().isProportional = true; + } + + }); + } + } + // -- rafraichissement de la scene --// + scene_.refresh(); + + + + + + } + +} + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -18,7 +18,6 @@ import javax.swing.JScrollPane; import javax.swing.JSplitPane; -import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluResource; @@ -42,7 +41,6 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; -import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import com.memoire.bu.BuMenuBar; @@ -130,19 +128,32 @@ /** * Methode a surcharger si on veut effectuer un traitement particulier apres duplication du widget. */ - @Override - public void postActionDuplication(final EbliNode node, final EbliNode duplique) { + public void postActionDuplication(final EbliNode node, final EbliNode duplique, ArrayList<EbliNode> listeNodeUndo) { + listeNodeUndo.add(duplique); // -- il faut verifier que les le node a bien une legende sinon on n ajoute // pas de legende pour le dupliqu\xE9 --// EbliWidgetControllerCalque controllerDuDuplique = null; - if (duplique.getWidget() instanceof EbliWidgetBordureSingle) controllerDuDuplique = (EbliWidgetControllerCalque) ((EbliWidget) duplique - .getWidget().getChildren().get(0)).getController(); - else controllerDuDuplique = (EbliWidgetControllerCalque) (duplique.getWidget()).getController(); + EbliWidgetVueCalque widgetCalqueDuplic; + if (duplique.getWidget() instanceof EbliWidgetBordureSingle) + widgetCalqueDuplic = (EbliWidgetVueCalque) ((EbliWidget) duplique.getWidget().getChildren().get(0)); + else + widgetCalqueDuplic = (EbliWidgetVueCalque) (duplique.getWidget()); + controllerDuDuplique = (EbliWidgetControllerCalque) widgetCalqueDuplic.getController(); // -- on ajoute la legende apres duplication --// - if (getNodeLegende() != null && widget_.getEbliScene().isObject(getNodeLegende()) && this.legendeWidget_ != null) controllerDuDuplique - .ajoutLegende(); + if (getNodeLegende() != null && widget_.getEbliScene().isObject(getNodeLegende()) && this.legendeWidget_ != null) { + // -- on ajoute la legende --// + controllerDuDuplique.ajoutLegende(); + // -- on ajoute le noeud legende come commande undo --// + listeNodeUndo.add(controllerDuDuplique.getNodeLegende()); + + } + + // -- commande undo/redo --// + // cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, + // widget_.getEbliScene())); + controllerDuDuplique.setDescription(getDescription()); // -- construction des actions sans passer par la frame fille --// @@ -150,6 +161,39 @@ } + + public EbliNode duplication(ArrayList<EbliNode> listeNodeUndo) { + + // -- recuperation du node a dupliquer --// + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + // duplication du node en question + final EbliNode duplique = n.duplicate(null); + + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); + + // -- ajout dans la scene --// + if (duplique != null && widget_.getScene() != null) { + widget_.getEbliScene().addNode(duplique); + + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + postActionDuplication(n, duplique, listeNodeUndo); + } + return duplique; + } + + + + + public boolean hasLegende() { if (getNodeLegende() == null) return false; @@ -196,16 +240,11 @@ } } - @Override - protected void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { - final JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem.addActionListener(new ActionListener() { + public void suppression(final ArrayList<EbliNode> listeNodeUndo, ArrayList<Point> listLocation) { - public void actionPerformed(final ActionEvent e) { - final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - + listeNodeUndo.add(n); + listLocation.add(widget_.convertLocalToScene(widget_.getLocation())); // -- on prend la location du node au moment de la suppression pour // pouvoir la retablir dans le undo --// // n.setPreferedLocation(widget_.getPreferredLocation()); @@ -216,40 +255,43 @@ // -- on supprime le node legende associe --// if (hasLegende()) { + listeNodeUndo.add(widgetCalque_.nodeLegende); + listLocation.add(widgetCalque_.convertLocalToScene(widgetCalque_.nodeLegende.getWidget().getLocation())); widget_.getEbliScene().removeNode(widgetCalque_.nodeLegende); legendeWidget_ = null; - - final CtuluCommand commande1= new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation())); - final CtuluCommand commande2= new CommandSupprimer(widgetCalque_.nodeLegende, widget_.getEbliScene(), widget_.convertLocalToScene(widgetCalque_.nodeLegende.getWidget().getLocation())); - cmd_.addCmd(new CtuluCommand(){ - - @Override - public void redo() { - // TODO Auto-generated method stub - commande1.redo(); - commande2.redo(); - } - - @Override - public void undo() { - // TODO Auto-generated method stub - commande1.undo(); - commande2.undo(); - } - - }); + // final CtuluCommand commande1= new CommandSupprimer(n, + // widget_.getEbliScene(), + // widget_.convertLocalToScene(widget_.getLocation())); + // final CtuluCommand commande2= new + // CommandSupprimer(widgetCalque_.nodeLegende, widget_.getEbliScene(), + // widget_ + // .convertLocalToScene(widgetCalque_.nodeLegende.getWidget().getLocation + // ())); + // cmd_.addCmd(new CtuluCommand(){ + // + // + // public void redo() { + // // TODO Auto-generated method stub + // commande1.redo(); + // commande2.redo(); + // } + // + // + // public void undo() { + // // TODO Auto-generated method stub + // commande1.undo(); + // commande2.undo(); + // } + // + // }); } - else{ - // -- on enregistre la commande undo redo unitaire --// - cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); - } + // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); } - }); - } + @Override protected void constructMenuMasquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -13,7 +13,6 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; -import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluLibSwing; @@ -33,7 +32,6 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; -import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import com.memoire.bu.BuMenuBar; @@ -112,32 +110,77 @@ /** * Methode a surcharger si on veut effectuer un traitement particulier apres duplication du widget. */ - @Override - public void postActionDuplication(final EbliNode node, final EbliNode duplique) { + public void postActionDuplication(final EbliNode node, final EbliNode duplique, ArrayList<EbliNode> listeNodeUndo) { + listeNodeUndo.add(duplique); // -- il faut verifier que les le node a bien une legende sinon on n ajoute // pas de legende pour le dupliqu\xE9 --// EbliWidgetControllerGraphe controllerDuDuplique = null; - if (duplique.getWidget() instanceof EbliWidgetBordureSingle) controllerDuDuplique = (EbliWidgetControllerGraphe) ((EbliWidget) duplique - .getWidget().getChildren().get(0)).getController(); - else controllerDuDuplique = (EbliWidgetControllerGraphe) (duplique.getWidget()).getController(); + EbliWidgetGraphe widgetGrapheDuplic; + if (duplique.getWidget() instanceof EbliWidgetBordureSingle) + widgetGrapheDuplic = (EbliWidgetGraphe) ((EbliWidget) duplique.getWidget().getChildren().get(0)); + else + widgetGrapheDuplic = (EbliWidgetGraphe) (duplique.getWidget()); + + controllerDuDuplique = (EbliWidgetControllerGraphe) widgetGrapheDuplic.getController(); + // -- on ajoute la legende apres duplication --// - if (widgetGraphe_.getNodeLegende() != null) controllerDuDuplique.ajoutLegende(); - + + if (widgetGraphe_.getNodeLegende() != null) { + controllerDuDuplique.ajoutLegende(); + + listeNodeUndo.add(widgetGrapheDuplic.getNodeLegende()); + + } + // -- commande undo/redo --// + // cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, + // widget_.getEbliScene())); controllerDuDuplique.setDescription(getDescription()); } + + + public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo) { - @Override - protected void constructMenuSupprimer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { - final JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem.addActionListener(new ActionListener() { + // -- recuperation du node a dupliquer --// + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - public void actionPerformed(final ActionEvent e) { + // duplication du node en question + final EbliNode duplique = n.duplicate(null); + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); + + // -- ajout dans la scene --// + if (duplique != null && widget_.getScene() != null) { + widget_.getEbliScene().addNode(duplique); + + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); + + + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + postActionDuplication(n, duplique, listeNodeUndo); + + + } + return duplique; + } + + + + + + public void suppression(final ArrayList<EbliNode> listeNodeUndo, ArrayList<Point> listLocation) { + final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - + listeNodeUndo.add(n); + listLocation.add(widget_.convertLocalToScene(widget_.getLocation())); // -- on prend la location du node au moment de la suppression pour // pouvoir la retablir dans le undo --// // n.setPreferedLocation(widget_.getPreferredLocation()); @@ -148,37 +191,43 @@ // -- on supprime le node legende associe --// if (hasLegende()) { + listeNodeUndo.add(widgetGraphe_.getNodeLegende()); + listLocation.add(widget_.convertLocalToScene(widgetGraphe_.getNodeLegende().getWidget().getLocation())); widget_.getEbliScene().removeNode(widgetGraphe_.getNodeLegende()); - final CtuluCommand commande1=new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation())); - final CtuluCommand commande2= new CommandSupprimer(widgetGraphe_.getNodeLegende(), widget_.getEbliScene(), widget_.convertLocalToScene(widgetGraphe_.getNodeLegende().getWidget().getLocation())); - cmd_.addCmd(new CtuluCommand(){ - - @Override - public void redo() { - // TODO Auto-generated method stub - commande1.redo(); - commande2.redo(); - } - - @Override - public void undo() { - // TODO Auto-generated method stub - commande1.undo(); - commande2.undo(); - } - - }); - }else{ - // -- on enregistre la commande undo redo unitaire --// - cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + + + // final CtuluCommand commande1=new CommandSupprimer(n, + // widget_.getEbliScene(), + // widget_.convertLocalToScene(widget_.getLocation())); + // final CtuluCommand commande2= new + // CommandSupprimer(widgetGraphe_.getNodeLegende(), + // widget_.getEbliScene(), + // widget_.convertLocalToScene(widgetGraphe_.getNodeLegende + // ().getWidget().getLocation())); + // cmd_.addCmd(new CtuluCommand(){ + // + // + // public void redo() { + // // TODO Auto-generated method stub + // commande1.redo(); + // commande2.redo(); + // } + // + // + // public void undo() { + // // TODO Auto-generated method stub + // commande1.undo(); + // commande2.undo(); + // } + // + // }); } // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); } - }); - } + @Override protected void constructMenuMasquer(final JPopupMenu _popup, final CtuluCommandContainer cmd_) { Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -0,0 +1,220 @@ +package org.fudaa.ebli.visuallibrary.resizestrategy; + +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; + +import org.fudaa.ctulu.image.CtuluLibImage; +import org.netbeans.api.visual.action.AlignWithMoveDecorator; +import org.netbeans.api.visual.action.AlignWithWidgetCollector; +import org.netbeans.api.visual.action.ResizeProvider; +import org.netbeans.api.visual.action.ResizeStrategy; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.action.AlignWithSupport; + +/** + * Strat\xE9gie poru le resize proportionnel + * + * @author Adrien Hadoux + * + */ + +public class AlignWithResizeProportionalStrategy extends AlignWithSupport implements ResizeStrategy, ResizeProvider { + + private boolean outerBounds; + + public AlignWithResizeProportionalStrategy(AlignWithWidgetCollector collector, LayerWidget interractionLayer, + AlignWithMoveDecorator decorator, boolean outerBounds) { + super(collector, interractionLayer, decorator); + this.outerBounds = outerBounds; + } + + public Rectangle boundsSuggested(Widget widget, Rectangle originalBounds, Rectangle suggestedBounds, + ControlPoint controlPoint) { + final double wDivParH = CtuluLibImage.getRatio(originalBounds.width, originalBounds.height); + final double hDivParW = CtuluLibImage.getRatio(originalBounds.height, originalBounds.width); + Insets insets = widget.getBorder().getInsets(); + int minx = insets.left + insets.right; + int miny = insets.top + insets.bottom; + + // double coefficientProportionnalite = (suggestedBounds.width * 1.0) / + // (suggestedBounds.height * 1.0); + // if (coefficientProportionnalite == 0) + // coefficientProportionnalite = 1; + int oldWidht = suggestedBounds.width; + int oldHeight = suggestedBounds.height; + + suggestedBounds = widget.convertLocalToScene(suggestedBounds); + + Point suggestedLocation, point; + int tempx, tempy; + + switch (controlPoint) { + case BOTTOM_CENTER: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y + + suggestedBounds.height); + if (!outerBounds) + suggestedLocation.y -= insets.bottom; + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, + false); + + if (!outerBounds) + point.y += insets.bottom; + + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + + break; + case BOTTOM_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height); + if (!outerBounds) { + suggestedLocation.y -= insets.bottom; + suggestedLocation.x += insets.left; + } + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); + + if (!outerBounds) { + point.y += insets.bottom; + point.x -= insets.left; + } + + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case BOTTOM_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y + + suggestedBounds.height); + if (!outerBounds) { + suggestedLocation.y -= insets.bottom; + suggestedLocation.x -= insets.right; + } + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); + + if (!outerBounds) { + point.y += insets.bottom; + point.x += insets.right; + } + + suggestedBounds.height = Math.max(miny, point.y - suggestedBounds.y); + + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + case CENTER_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y + suggestedBounds.height / 2); + if (!outerBounds) + suggestedLocation.x += insets.left; + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, + false); + + if (!outerBounds) + point.x -= insets.left; + + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case CENTER_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y + + suggestedBounds.height / 2); + if (!outerBounds) + suggestedLocation.x -= insets.right; + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, false, false, + false); + + if (!outerBounds) + point.x += insets.right; + + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + case TOP_CENTER: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width / 2, suggestedBounds.y); + if (!outerBounds) + suggestedLocation.y += insets.top; + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, false, true, false, + false); + + if (!outerBounds) + point.y -= insets.top; + + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; + break; + case TOP_LEFT: + suggestedLocation = new Point(suggestedBounds.x, suggestedBounds.y); + if (!outerBounds) { + suggestedLocation.y += insets.top; + suggestedLocation.x += insets.left; + } + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); + + if (!outerBounds) { + point.y -= insets.top; + point.x -= insets.left; + } + + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; + + tempx = Math.min(point.x, suggestedBounds.x + suggestedBounds.width - minx); + suggestedBounds.width = suggestedBounds.x + suggestedBounds.width - tempx; + suggestedBounds.x = tempx; + break; + case TOP_RIGHT: + suggestedLocation = new Point(suggestedBounds.x + suggestedBounds.width, suggestedBounds.y); + if (!outerBounds) { + suggestedLocation.y += insets.top; + suggestedLocation.x -= insets.right; + } + + point = super.locationSuggested(widget, new Rectangle(suggestedLocation), suggestedLocation, true, true, false, + false); + + if (!outerBounds) { + point.y -= insets.top; + point.x += insets.right; + } + + tempy = Math.min(point.y, suggestedBounds.y + suggestedBounds.height - miny); + suggestedBounds.height = suggestedBounds.y + suggestedBounds.height - tempy; + suggestedBounds.y = tempy; + + suggestedBounds.width = Math.max(minx, point.x - suggestedBounds.x); + break; + } + + // -- proportions respectees --// + // double coeff = ((double) suggestedBounds.height) / ((double) oldHeight); + if (suggestedBounds.height != originalBounds.height) { + suggestedBounds.width = (int) (wDivParH * suggestedBounds.height); + } + if (suggestedBounds.width != originalBounds.width) { + suggestedBounds.height = (int) (hDivParW * suggestedBounds.width); + } + + return widget.convertSceneToLocal(suggestedBounds); + } + + public void resizingStarted(Widget widget) { + show(); + } + + public void resizingFinished(Widget widget) { + hide(); + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -0,0 +1,55 @@ +package org.fudaa.ebli.visuallibrary.resizestrategy; + +import java.awt.BasicStroke; +import java.awt.Color; + +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.AlignWithMoveDecorator; +import org.netbeans.api.visual.action.AlignWithWidgetCollector; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.ConnectionWidget; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.modules.visual.action.SingleLayerAlignWithWidgetCollector; + +/** + * Customisation apr rapport a l'usine ActionFactory de visulalibrary de + * creation des actions des widgets. Rajout des resize proportionnels + * + * @author Adrien Hadoux + * + */ + +public class EbliWidgetActionFactory { + + + private static final BasicStroke STROKE = new BasicStroke(1.0f, BasicStroke.JOIN_BEVEL, BasicStroke.CAP_BUTT, 5.0f, + new float[] { 6.0f, 3.0f }, 0.0f); + + private static final AlignWithMoveDecorator ALIGN_WITH_MOVE_DECORATOR_DEFAULT = new AlignWithMoveDecorator() { + public ConnectionWidget createLineWidget(Scene scene) { + ConnectionWidget widget = new ConnectionWidget(scene); + widget.setStroke(STROKE); + widget.setForeground(Color.BLUE); + return widget; + } + }; + + + public static WidgetAction createAlignWithProportionnalResizeAction(LayerWidget collectionLayer, LayerWidget interractionLayer, + AlignWithMoveDecorator decorator, boolean outerBounds) { + assert collectionLayer != null; + return createAlignWithProportionnalResizeAction(new SingleLayerAlignWithWidgetCollector(collectionLayer, outerBounds), + interractionLayer, decorator != null ? decorator : ALIGN_WITH_MOVE_DECORATOR_DEFAULT, outerBounds); + } + + public static WidgetAction createAlignWithProportionnalResizeAction(AlignWithWidgetCollector collector, + LayerWidget interractionLayer, AlignWithMoveDecorator decorator, boolean outerBounds) { + assert collector != null && interractionLayer != null && decorator != null; + AlignWithResizeProportionalStrategy sp = new AlignWithResizeProportionalStrategy(collector, interractionLayer, + decorator, + outerBounds); + return ActionFactory.createResizeAction(sp, sp); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -25,7 +25,6 @@ import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetController; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerInterface; import org.fudaa.ebli.visuallibrary.EbliWidgetEditModeListener; @@ -342,36 +341,41 @@ public void paste() { // Point locationSouris = this.getMousePosition(); - - // JOptionPane.showMessageDialog(null, "paste(): nb elements " + - // nodesCopyied.size()); - final Set<EbliNode> newNodes = new HashSet<EbliNode>(); + ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); + // --recuperation des noeuds copies --// if (projet_.nodesCopyied != null) { for (final Iterator<EbliNode> it = projet_.nodesCopyied.iterator(); it.hasNext();) { final EbliNode node = it.next(); // --duplication du node --// - final EbliNode nouveauNode = node.duplicate(null); + node.getWidget().getController().duplication(listeNodeUndo); - getScene().addNode(nouveauNode); + // final EbliNode nouveauNode = node.duplicate(null); + // + // getScene().addNode(nouveauNode); + // + //nouveauNode.getWidget().getController().setDescription(node.getWidget( + // ).getController().getDescription()); + // newNodes.add(nouveauNode); + // // -- duplication des map de property graphique de la widget --// + // node.getWidget().setPropGraphique(node.getWidget(). + // duplicateGraphicalProperties()); + // // -- duplication de la taille --// + //node.getWidget().setPreferredBounds(node.getWidget().getPreferredBounds + // ()); + // final Point newLocation = + // nouveauNode.getWidget().getPreferredLocation(); + // newLocation.x += 30; + // newLocation.y += 30; + // + // nouveauNode.getWidget().setPreferredLocation(newLocation); - nouveauNode.getWidget().getController().setDescription(node.getWidget().getController().getDescription()); - newNodes.add(nouveauNode); - // -- duplication des map de property graphique de la widget --// - node.getWidget().setPropGraphique(node.getWidget().duplicateGraphicalProperties()); - // -- duplication de la taille --// - node.getWidget().setPreferredBounds(node.getWidget().getPreferredBounds()); - final Point newLocation = nouveauNode.getWidget().getPreferredLocation(); - newLocation.x += 30; - newLocation.y += 30; - - nouveauNode.getWidget().setPreferredLocation(newLocation); - } // --creation de la commande undo/redo --// - if (newNodes.size() != 0) getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); + if (listeNodeUndo.size() != 0) + getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(listeNodeUndo)); // reinitialisation de la liste projet_.nodesCopyied = null; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChangeSceneForWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChangeSceneForWidget.java 2008-10-24 16:18:06 UTC (rev 4095) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChangeSceneForWidget.java 2008-10-24 20:42:43 UTC (rev 4096) @@ -1,5 +1,6 @@ package org.fudaa.fudaa.tr.post.actions; +import java.awt.Point; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; @@ -56,34 +57,47 @@ final EbliScene sceneDestination = selectionneSceneNode(); if (sceneDestination == null) return; - // -- changement des noeuds saisis des noeuds saisis --// + ArrayList<EbliNode> listeNodeUndo=new ArrayList<EbliNode>(); +... [truncated message content] |
From: <bma...@us...> - 2008-10-24 16:18:15
|
Revision: 4095 http://fudaa.svn.sourceforge.net/fudaa/?rev=4095&view=rev Author: bmarchan Date: 2008-10-24 16:18:06 +0000 (Fri, 24 Oct 2008) Log Message: ----------- Chgts mineurs pour visualisation correcte dans Panneau propri?\195?\169t?\195?\169s Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.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 Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java 2008-10-24 16:15:52 UTC (rev 4094) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java 2008-10-24 16:18:06 UTC (rev 4095) @@ -42,7 +42,7 @@ private String[] reelChoices_; private boolean useInteger_; - private final String undefineValue_="< " + CtuluLib.getS("Ind\xE9fini") + " >"; + private final String undefineValue_="<" + CtuluLib.getS("Mixte") + ">"; /** * Dans le cas o\xF9 dChoices est null, reelChoices sera \xE9galement affich\xE9. 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-24 16:15:52 UTC (rev 4094) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-24 16:18:06 UTC (rev 4095) @@ -75,7 +75,7 @@ nbGeomSelected+=calques[i].getLayerSelection().getNbSelectedIndex(); } if(nbGeomSelected>0) - tableModel_.put(EbliLib.getS("nombre total de s\xE9lections"), Integer.toString(nbGeomSelected)+"/"+Integer.toString(nbGeom)); + tableModel_.put(EbliLib.getS("Nombre total de s\xE9lections"), Integer.toString(nbGeomSelected)+"/"+Integer.toString(nbGeom)); // Informations relatives aux calques switch (calqueWithGeometriesSelected_.size()) { case 0: Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java 2008-10-24 16:15:52 UTC (rev 4094) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java 2008-10-24 16:18:06 UTC (rev 4095) @@ -1,7 +1,7 @@ /** * @file ZModeleDonnees.java * @creation 2002-10-8 - * @modification $Date: 2008-01-24 10:18:59 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -15,7 +15,7 @@ * Une interface de base pour tous les modeles. Tous les modeles doivent founir le domaine de leurs * donnees et les contours. * - * @version $Id: ZModeleDonnees.java,v 1.14.8.1 2008-01-24 10:18:59 bmarchan Exp $ + * @version $Id$ * @author Fred Deniger */ public interface ZModeleDonnees { @@ -23,8 +23,8 @@ BuTable createValuesTable(ZCalqueAffichageDonneesInterface _layer); /** - * Renseigne les informations sur les objets du mod\xE8le associ\xE9 au calque sp\xE9cifi\xE9. Elles seront affich\xE9es dans le panneau - * d'information. + * Renseigne les propri\xE9t\xE9s sur les objets du mod\xE8le associ\xE9 au calque sp\xE9cifi\xE9. Elles seront affich\xE9es dans le panneau + * des propri\xE9t\xE9s. * * @param _d Le tableau a renseigner, sous la forme cl\xE9-valeur. * @param _layer Le calque associ\xE9 au mod\xE8le. Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleDonnees.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id 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-24 16:15:52 UTC (rev 4094) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-24 16:18:06 UTC (rev 4095) @@ -168,14 +168,14 @@ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(value==null) - value="< "+EbliLib.getS("Ind\xE9fini")+" >"; + value="<"+EbliLib.getS("Mixte")+">"; return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } }; _d.put(attr.getLongName(), value, attr.getEditor(), renderer, this, geometriesSelected); } else - _d.put(attr.getLongName(), value==null?"< "+EbliLib.getS("Ind\xE9fini")+" >":value.toString()); + _d.put(attr.getLongName(), value==null?"<"+EbliLib.getS("Mixte")+">":value.toString()); } } } 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-24 16:15:52 UTC (rev 4094) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-24 16:18:06 UTC (rev 4095) @@ -331,7 +331,7 @@ _d.put(CtuluLib.getS("Ferm\xE9"), value, new CtuluValueEditorChoice(new String[]{CtuluLib.getS("vrai"), CtuluLib.getS("faux")}, null), null, this, selectedIdx); else - _d.put(CtuluLib.getS("Ferm\xE9"), value!=null ? value.toString():"< "+CtuluLib.getS("Ind\xE9fini")+" >"); + _d.put(CtuluLib.getS("Ferm\xE9"), value!=null ? value.toString():"<"+CtuluLib.getS("Mixte")+">"); // Calcul de la longueur et de l'aire for (int i=0; i<selectedIdx.length; i++) { final LineString s=(LineString)getGeomData().getGeometry(selectedIdx[i]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-10-24 16:16:07
|
Revision: 4094 http://fudaa.svn.sourceforge.net/fudaa/?rev=4094&view=rev Author: bmarchan Date: 2008-10-24 16:15:52 +0000 (Fri, 24 Oct 2008) Log Message: ----------- Correction position nom des lignes directrices. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2008-10-24 15:53:49 UTC (rev 4093) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2008-10-24 16:15:52 UTC (rev 4094) @@ -102,7 +102,9 @@ for (int il=0; il<idxline.size(); il++) { if (attNameLines==-1 || (name=(String)lines.getValue(attNameLines,idxline.get(il)))==null || name.length()>3) name="D"+idxline.get(il); + writer.setSpaceBefore(false); writer.stringField(4, name); + writer.setSpaceBefore(true); writer.stringField(3, ""); writer.stringField(2, numbFmt.format(str.getOrdinate(k, 2))); writer.stringField(1, numbFmt.format(str.getOrdinate(k, 1))); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-24 15:54:01
|
Revision: 4093 http://fudaa.svn.sourceforge.net/fudaa/?rev=4093&view=rev Author: emmanuel_martin Date: 2008-10-24 15:53:49 +0000 (Fri, 24 Oct 2008) Log Message: ----------- remplacement du param?\195?\168tre Object _data par int[] _index dans BPaletteInfo.InfoData.put Modified Paths: -------------- 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/palette/BPaletteInfo.java 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-23 16:30:33 UTC (rev 4092) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-24 15:53:49 UTC (rev 4093) @@ -172,7 +172,7 @@ return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } }; - _d.put(attr.getLongName(), value, attr.getEditor(), renderer, this, new Object[]{attr.getID(), geometriesSelected}); + _d.put(attr.getLongName(), value, attr.getEditor(), renderer, this, geometriesSelected); } else _d.put(attr.getLongName(), value==null?"< "+EbliLib.getS("Ind\xE9fini")+" >":value.toString()); @@ -203,20 +203,18 @@ /* (non-Javadoc) * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) */ - public void modifyProperty(String _key, Object _value, Object _data) { - if (_data!=null) { - if (_data instanceof int[]) { - // Recherche de l'attribut d\xE9fini par _key - boolean found=false; - int i=-1; - while (!found&&++i<geometries_.getNbAttributes()) - found=geometries_.getAttribute(i).getLongName().equals(_key); - // Modification de cet attribut - if (found) { - int[] geometries=(int[]) _data; - for (int j=0; j<geometries.length; j++) - geometries_.getModel(i).setObject(geometries[j], _value, null); - } + public void modifyProperty(String _key, Object _value, int[] _index) { + if (_index!=null) { + // Recherche de l'attribut d\xE9fini par _key + boolean found=false; + int i=-1; + while (!found&&++i<geometries_.getNbAttributes()) + found=geometries_.getAttribute(i).getLongName().equals(_key); + // Modification de cet attribut + if (found) { + int[] geometries=_index; + for (int j=0; j<geometries.length; j++) + geometries_.getModel(i).setObject(geometries[j], _value, null); } } } 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-23 16:30:33 UTC (rev 4092) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-24 15:53:49 UTC (rev 4093) @@ -350,11 +350,11 @@ /* (non-Javadoc) * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) */ - public void modifyProperty(String _key, Object _value, final Object _data) { - super.modifyProperty(_key, _value, _data); - if (_data!=null&&_value!=null&&_key==CtuluLib.getS("Ferm\xE9")&&_data instanceof int[]) { + public void modifyProperty(String _key, Object _value, final int[] _index) { + super.modifyProperty(_key, _value, _index); + if (_index!=null&&_value!=null&&_key==CtuluLib.getS("Ferm\xE9")) { // Modification de la propri\xE9t\xE9 - int[] indexPolylines=(int[])_data; + int[] indexPolylines=_index; for (int i=0; i<indexPolylines.length; i++) { int indexPolyligne=indexPolylines[i]; // Cr\xE9ation de la nouvelle g\xE9om\xE9trie 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-23 16:30:33 UTC (rev 4092) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-24 15:53:49 UTC (rev 4093) @@ -64,10 +64,9 @@ * @param _owner l'object qui sera appel\xE9 (via modifyProperty) pour que * la modification soit prise en compte. Si null l'attribut est * consid\xE9r\xE9 comme non modifiable. - * @param _data autorise \xE0 passer une information (ou un tableau d'informations) - * qui sera redonn\xE9 \xE0 modifyProperty. + * @param _index un tableau de int contenant les index des g\xE9om\xE9tries \xE0 modifier. */ - void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, Object _data); + void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, int[] _data); void setTitle(String _title); @@ -96,9 +95,9 @@ * fournie \xE0 InfoData. * @param _key le nom de la propri\xE9t\xE9 * @param _newValue la nouvelle valeur de la prorpi\xE9t\xE9 - * @param _data l'information pass\xE9 en param\xE8tre du put + * @param _index l'information pass\xE9 en param\xE8tre du put */ - void modifyProperty(String _key, Object _newValue, Object _data); + void modifyProperty(String _key, Object _newValue, int[] _index); } /** @@ -249,7 +248,7 @@ * javax.swing.table.TableCellRenderer, * org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo) */ - public void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, Object _data) { + public void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, int[] _index) { if (_key==null) throw new IllegalArgumentException("_key et _value doivent \xEAtre non null."); ArrayList<Object> row=new ArrayList<Object>(); @@ -258,7 +257,7 @@ row.add(2, _editor); row.add(3, _renderer); row.add(4, _owner); - row.add(5, _data); + row.add(5, _index); rows_.add(row); if(onlyOneGeometry_) editor_.putEditor(rows_.size()-1, _editor.createTableEditorComponent()); @@ -280,7 +279,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, 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)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-23 16:30:44
|
Revision: 4092 http://fudaa.svn.sourceforge.net/fudaa/?rev=4092&view=rev Author: hadouxad Date: 2008-10-23 16:30:33 +0000 (Thu, 23 Oct 2008) Log Message: ----------- Correction de tout plein de bugs Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorDblFleche.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -152,8 +152,8 @@ /** * Cote d'eau. */ - public static final H2dVariableType COTE_EAU = new H2dVariableType(H2dResource.getS("Cote eau"), "SL", "zw") { - + // public static final H2dVariableType COTE_EAU = new H2dVariableType(H2dResource.getS("Cote eau"), "SL", "zw") { + public static final H2dVariableType COTE_EAU = new H2dVariableType(H2dResource.getS("Surface libre"), "SL", "zw") { public boolean canBeTransient() { return true; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -18,6 +18,7 @@ import javax.swing.JScrollPane; import javax.swing.JSplitPane; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluResource; @@ -208,18 +209,40 @@ // -- on prend la location du node au moment de la suppression pour // pouvoir la retablir dans le undo --// // n.setPreferedLocation(widget_.getPreferredLocation()); - // -- on enregistre la commande undo redo --// - cmd_ - .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + // -- on enleve le node de la scene --// widget_.getEbliScene().removeNode(n); // -- on supprime le node legende associe --// - if (widgetCalque_.nodeLegende != null) { + if (hasLegende()) { widget_.getEbliScene().removeNode(widgetCalque_.nodeLegende); legendeWidget_ = null; + + final CtuluCommand commande1= new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation())); + final CtuluCommand commande2= new CommandSupprimer(widgetCalque_.nodeLegende, widget_.getEbliScene(), widget_.convertLocalToScene(widgetCalque_.nodeLegende.getWidget().getLocation())); + cmd_.addCmd(new CtuluCommand(){ + + @Override + public void redo() { + // TODO Auto-generated method stub + commande1.redo(); + commande2.redo(); + } + + @Override + public void undo() { + // TODO Auto-generated method stub + commande1.undo(); + commande2.undo(); + } + + }); } + else{ + // -- on enregistre la commande undo redo unitaire --// + cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + } // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -22,103 +22,133 @@ */ public final class EbliWidgetFusionCalques extends EbliWidgetGroup implements PropertyChangeListener { - public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); + public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); - public EbliWidgetFusionCalques(final EbliScene _scene) { - super(_scene); - // calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( - // "versReel", listener); + public EbliWidgetFusionCalques(final EbliScene _scene) { + super(_scene); + // calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( + // "versReel", listener); - } + } - public void addChildCalque(final EbliWidget child) { + public void addChildCalque(final EbliWidget child) { - addChild(child); + addChild(child); - final EbliWidgetVueCalque widgetCalque = (EbliWidgetVueCalque) child.getIntern(); - listeWidgetCalque_.add(widgetCalque); + final EbliWidgetVueCalque widgetCalque = (EbliWidgetVueCalque) child.getIntern(); + listeWidgetCalque_.add(widgetCalque); - // -- ajout du listener des calques sur this --// - widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); - // widgetCalque.calquePanel_.getVueCalque().getAbstractCalque(). - // addPropertyChangeListener("versReel", this); - } - boolean noCyclePropertieChange = true; - public void propertyChange(final PropertyChangeEvent _evt) { + // widgetCalque.calquePanel_.getVueCalque().getAbstractCalque(). + // addPropertyChangeListener("versReel", this); - if (!noCyclePropertieChange) return; - noCyclePropertieChange = false; - // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( - // _source, _boite, _rapide) - final BVueCalque vueCalque = (BVueCalque) _evt.getSource(); - final GrBoite boite = vueCalque.getViewBoite(); - for (final Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { - final EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); - if (widget.calquePanel_.getVueCalque() != vueCalque) { - widget.calquePanel_.getVueCalque().changeRepere(widget.calquePanel_, boite, 0, 0); - } - widget.image = null; - widget.repaint(); - } - noCyclePropertieChange = true; - getEbliScene().refresh(); - } + } + boolean noCyclePropertieChange = true; - /** - * Surcharge de la methode de ebli, utilisse pour virer les property change listener - */ - @Override - public void removePropertyChangeListenerFormWidget(final EbliWidget child) { - EbliWidgetVueCalque widgetCalque; - if (child instanceof EbliWidgetVueCalque) widgetCalque = (EbliWidgetVueCalque) child; - else widgetCalque = (EbliWidgetVueCalque) ((EbliWidget) child.getChildren().get(0)).getIntern(); - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("repere", this); + /** + * Methode a appelee a la fin des ajout de widget pour synchroniser les zooms de tous les calques du groupe. + * Il faut le faire dans l'ordre inverse afin de pr\xE9server le zoom de la widget initiale. + */ + public void synchronyseZoom(){ + //-- on conserve le zoom du calque initial et on l'appllique avant de synchronizer les zooms --// + EbliWidgetVueCalque calqueInitialeZoom=listeWidgetCalque_.get(listeWidgetCalque_.size()-1); + final GrBoite boite = calqueInitialeZoom.getViewBoite(); + calqueInitialeZoom.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); + calqueInitialeZoom.calquePanel_.getVueCalque().changeRepere(calqueInitialeZoom.calquePanel_, boite, 0, 0); + + +// for(int i=0;i<listeWidgetCalque_.size();i++){ +// //-- mise a jour de la boite pour le calque originel (le reste suivra) --// +// listeWidgetCalque_.get(i).calquePanel_.getVueCalque().changeRepere(listeWidgetCalque_.get(i).calquePanel_, boite, 0, 0); +// listeWidgetCalque_.get(i).image = null; +// listeWidgetCalque_.get(i).repaint(); +// } + getEbliScene().refresh(); + // -- ajout du listener des calques sur this --// + + for(int i=0;i<listeWidgetCalque_.size()-1;i++){ + EbliWidgetVueCalque widgetCalque=listeWidgetCalque_.get(i); + widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); + } - } + } - ZCalqueSondeSynchroniserFusion managerSondesFusion_; + - /** - * Methode a appeler a la fin de la creation de la sonde fusion pour ajouter l action sonde fusion dans chaque - * calques. - */ - public void synchroniseSondeFusion() { + public void propertyChange(final PropertyChangeEvent _evt) { - // -- creation du manager de sonde fusion qui synchronise toute ses sondes - // --// - managerSondesFusion_ = new ZCalqueSondeSynchroniserFusion(); + if (!noCyclePropertieChange) return; + noCyclePropertieChange = false; + // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( + // _source, _boite, _rapide) + final BVueCalque vueCalque = (BVueCalque) _evt.getSource(); + final GrBoite boite = vueCalque.getViewBoite(); + for (final Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { + final EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); + if (widget.calquePanel_.getVueCalque() != vueCalque) { + widget.calquePanel_.getVueCalque().changeRepere(widget.calquePanel_, boite, 0, 0); + } + widget.image = null; + widget.repaint(); + } + noCyclePropertieChange = true; + getEbliScene().refresh(); + } - for (final EbliWidgetVueCalque widget : listeWidgetCalque_) { - final ZEbliCalquesPanel panel = widget.calquePanel_; + /** + * Surcharge de la methode de ebli, utilisse pour virer les property change listener + */ + @Override + public void removePropertyChangeListenerFormWidget(final EbliWidget child) { + EbliWidgetVueCalque widgetCalque; + if (child instanceof EbliWidgetVueCalque) widgetCalque = (EbliWidgetVueCalque) child; + else widgetCalque = (EbliWidgetVueCalque) ((EbliWidget) child.getChildren().get(0)).getIntern(); + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("repere", this); - // -- il faut initialiser les actions specifiques si pas deja fait pour - // activer les interactions--// - panel.getController().initSpecificActions(); + } - // --recuperation de la sonde du calque --// - final ZCalqueSondeInteraction sonde = panel.getController().getCalqueSondeInteraction(); + ZCalqueSondeSynchroniserFusion managerSondesFusion_; - // -- ajout de la sonde dans le manager - managerSondesFusion_.addZCalqueSondeInteraction(sonde, widget); - } - // -- ajout dans les toolbars de tous les calques de la meme action --// - // for (EbliWidgetVueCalque widget : listeWidgetCalque_) { - // - // ((EbliWidgetControllerCalque) - // widget.getController()).getToolbarComponent().add( - // new CalqueActionSonde(sondeFusion)); - // - // } - } + /** + * Methode a appeler a la fin de la creation de la sonde fusion pour ajouter l action sonde fusion dans chaque + * calques. + */ + public void synchroniseSondeFusion() { - /** - * Methode a appeler au ungroup ou undo sur la fusion. Desynchronise les sondes des calques. - */ - public void desynchroniseSondeFusion() { - managerSondesFusion_.removeAllListenningSonde(); - } + // -- creation du manager de sonde fusion qui synchronise toute ses sondes + // --// + managerSondesFusion_ = new ZCalqueSondeSynchroniserFusion(); + for (final EbliWidgetVueCalque widget : listeWidgetCalque_) { + final ZEbliCalquesPanel panel = widget.calquePanel_; + + // -- il faut initialiser les actions specifiques si pas deja fait pour + // activer les interactions--// + panel.getController().initSpecificActions(); + + // --recuperation de la sonde du calque --// + final ZCalqueSondeInteraction sonde = panel.getController().getCalqueSondeInteraction(); + + // -- ajout de la sonde dans le manager + managerSondesFusion_.addZCalqueSondeInteraction(sonde, widget); + } + // -- ajout dans les toolbars de tous les calques de la meme action --// + // for (EbliWidgetVueCalque widget : listeWidgetCalque_) { + // + // ((EbliWidgetControllerCalque) + // widget.getController()).getToolbarComponent().add( + // new CalqueActionSonde(sondeFusion)); + // + // } + } + + /** + * Methode a appeler au ungroup ou undo sur la fusion. Desynchronise les sondes des calques. + */ + public void desynchroniseSondeFusion() { + managerSondesFusion_.removeAllListenningSonde(); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -40,210 +40,218 @@ public class EbliWidgetVueCalque extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel> { - ZEbliCalquesPanel calquePanel_; + ZEbliCalquesPanel calquePanel_; - public EbliNode nodeLegende = null; + public EbliNode nodeLegende = null; - Window frame_; + Window frame_; - BufferedImage image; - public GrBoite initZoom_; + BufferedImage image; + public GrBoite initZoom_; - BuPanel conteneurEditor; + BuPanel conteneurEditor; - // GrBoite zoom_; - public EbliWidgetVueCalque(final EbliScene _scene, final ZEbliCalquesPanel _vue) { - this(_scene, _vue, null); + // GrBoite zoom_; + public EbliWidgetVueCalque(final EbliScene _scene, final ZEbliCalquesPanel _vue) { + this(_scene, _vue, null); - } + } - /** - * TODO a am\xE9liorer avec une Map - * - * @param _scene - * @param _vue - * @param _initZoom - */ - public EbliWidgetVueCalque(final EbliScene _scene, final ZEbliCalquesPanel _vue, final GrBoite _initZoom) { - super(_scene); - calquePanel_ = _vue; - initZoom_ = _initZoom; - calquePanel_.setBorder(null); + /** + * TODO a am\xE9liorer avec une Map + * + * @param _scene + * @param _vue + * @param _initZoom + */ + public EbliWidgetVueCalque(final EbliScene _scene, final ZEbliCalquesPanel _vue, final GrBoite _initZoom) { + super(_scene); + calquePanel_ = _vue; + initZoom_ = _initZoom; + calquePanel_.setBorder(null); - setPreferredSize(new Dimension(500, 400)); - initSize(new Rectangle(0, 0, 500, 400)); - calquePanel_.getArbreCalqueModel().getObservable().addObserver(new Observer() { + setPreferredSize(new Dimension(500, 400)); + initSize(new Rectangle(0, 0, 500, 400)); + calquePanel_.getArbreCalqueModel().getObservable().addObserver(new Observer() { - public void update(final Observable _o, final Object _arg) { - if (!isInEditMode() && "t".equals(_arg)) { - image = null; - // repaint(); - } + public void update(final Observable _o, final Object _arg) { + if (!isInEditMode() && "t".equals(_arg)) { + image = null; + // repaint(); + } - } - }); + } + }); - } + } - public BuPanel createEditorComponent( - final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget) { - return calquePanel_; - } + public BuPanel createEditorComponent( + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget) { + return calquePanel_; + } - /** - * appel\xE9 lors de la fermeture de l editeur. Il faut redessiner la widget. - */ - public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - final Widget widget, final BuPanel editor, final boolean commit) { - editingStop(); - // zoom_ = calquePanel_.getVueCalque().getViewBoite(); - image = null; + /** + * appel\xE9 lors de la fermeture de l editeur. Il faut redessiner la widget. + */ + public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + final Widget widget, final BuPanel editor, final boolean commit) { + editingStop(); + // zoom_ = calquePanel_.getVueCalque().getViewBoite(); + image = null; - getEbliScene().refresh(); - // calquePanel_.setBorder(BuBorders.EMPTY1111); - this.repaint(); - } + getEbliScene().refresh(); + // calquePanel_.setBorder(BuBorders.EMPTY1111); + this.repaint(); + } - /** - * @return une interface non null si la widget peut etre animee - */ - @Override - public EbliAnimatedInterface getAnimatedInterface() { - if (calquePanel_ instanceof EbliAnimatedInterface) return (EbliAnimatedInterface) calquePanel_; - return null; - } + /** + * @return une interface non null si la widget peut etre animee + */ + @Override + public EbliAnimatedInterface getAnimatedInterface() { + if (calquePanel_ instanceof EbliAnimatedInterface) return (EbliAnimatedInterface) calquePanel_; + return null; + } - @Override - public Color getColorFond() { - return null; - } + @Override + public Color getColorFond() { + return null; + } - private void initSize(final Rectangle rec) { - final BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); - calquePanel_.getVueCalque().setSize(rec.width, rec.height); - // calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); - calquePanel_.getVueCalque().getCalque().setSize(rec.width, rec.height); - for (int i = 0; i < tousCalques.length; i++) { - tousCalques[i].setSize(rec.width, rec.height); - } - } + private void initSize(final Rectangle rec) { + final BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); + calquePanel_.getVueCalque().setSize(rec.width, rec.height); + // calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); + calquePanel_.getVueCalque().getCalque().setSize(rec.width, rec.height); + for (int i = 0; i < tousCalques.length; i++) { + tousCalques[i].setSize(rec.width, rec.height); + } + } - public GrBoite getViewBoite() { - return calquePanel_.getVueCalque().getViewBoite(); - } + public GrBoite getViewBoite() { + return calquePanel_.getVueCalque().getViewBoite(); + } - public EbliWidgetControllerCalque getCalqueController() { - return (EbliWidgetControllerCalque) getController(); - } + public EbliWidgetControllerCalque getCalqueController() { + return (EbliWidgetControllerCalque) getController(); + } - boolean first_ = true; + boolean first_ = true; - @SuppressWarnings("unchecked") - @Override - protected void paintWidget() { + @SuppressWarnings("unchecked") + @Override + protected void paintWidget() { - final Rectangle rec = getClientArea(); - rec.width -= 1; - rec.height -= 1; - final Graphics2D g = getGraphics(); + final Rectangle rec = getClientArea(); - if (frame_ == null) { - initSize(rec); - if (first_) { - first_ = false; - if (initZoom_ != null && initZoom_.getDeltaX() > 0 && initZoom_.getDeltaY() > 0) { - calquePanel_.getVueCalque().changeRepere(this, initZoom_); - initZoom_ = null; - } else calquePanel_.restaurer(); - } - // if (zoom_ != null) { - // // image=null; - // calquePanel_.getVueCalque().changeRepere(this, zoom_); - // - // } else calquePanel_.restaurer(); - } - // mode edition - if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { - FuLog.debug("EWI: recreate image"); - final Map params = new HashMap(); - CtuluLibImage.setCompatibleImageAsked(params); - // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - image = calquePanel_.produceImage(rec.width, rec.height, params); - } - g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); - } + rec.width -= 1; + rec.height -= 1; - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, - final BuPanel editor) { - return null; - } + if(rec.width>0 && rec.height>0){ + final Graphics2D g = getGraphics(); - public Rectangle getInitialEditorComponentBounds( - final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, - final BuPanel editor, final Rectangle viewBounds) { - return convertLocalToScene(getClientArea()); - } + if (frame_ == null) { + initSize(rec); + if (first_) { + first_ = false; + if (initZoom_ != null && initZoom_.getDeltaX() > 0 && initZoom_.getDeltaY() > 0) { + calquePanel_.getVueCalque().changeRepere(this, initZoom_); + initZoom_ = null; + } else calquePanel_.restaurer(); + } + // if (zoom_ != null) { + // // image=null; + // calquePanel_.getVueCalque().changeRepere(this, zoom_); + // + // } else calquePanel_.restaurer(); + } - public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - final Widget widget, final BuPanel editor) { - editingStart(); - calquePanel_.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); - } + // mode edition + if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + FuLog.debug("EWI: recreate image"); + final Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - // public void setColorFond(Color newColor) { - // couleurFond = newColor; - // repaint(); - // } - // - // public void update(Observable _o, Object _arg) { - // image = null; - // getEbliScene().refresh(); - // } - @Override - public boolean canRotate() { - return false; - } + image = calquePanel_.produceImage(rec.width, rec.height, params); - @Override - public boolean canColorForeground() { - return false; - } + } + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); - @Override - public boolean canColorBackground() { - return false; - } + } + } - @Override - public boolean canTraceLigneModel() { - return false; - } + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, + final BuPanel editor) { + return null; + } - @Override - public boolean canFont() { - return false; - } + public Rectangle getInitialEditorComponentBounds( + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, + final BuPanel editor, final Rectangle viewBounds) { + return convertLocalToScene(getClientArea()); + } - @Override - public List<EbliWidgetAnimatedItem> getAnimatedItems() { - final BCalque[] cqs = calquePanel_.getVueCalque().getCalque().getTousCalques(); - final List<EbliWidgetAnimatedItem> res = new ArrayList<EbliWidgetAnimatedItem>(20); - for (int i = 0; i < cqs.length; i++) { - if (cqs[i].isVisible() && cqs[i] instanceof EbliAnimationAdapterInterface) { - res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], getId(), cqs[i].getName(), - cqs[i].getTitle())); - } - } - return res; - } + public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + final Widget widget, final BuPanel editor) { + editingStart(); + calquePanel_.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); + } - @Override - public boolean isAnimatedItemAlive(final String _id) { - final BCalque cq = calquePanel_.getVueCalque().getCalque().getCalqueParNom(_id); - return cq != null && cq.isVisible(); - } + // public void setColorFond(Color newColor) { + // couleurFond = newColor; + // repaint(); + // } + // + // public void update(Observable _o, Object _arg) { + // image = null; + // getEbliScene().refresh(); + // } + @Override + public boolean canRotate() { + return false; + } + @Override + public boolean canColorForeground() { + return false; + } + + @Override + public boolean canColorBackground() { + return false; + } + + @Override + public boolean canTraceLigneModel() { + return false; + } + + @Override + public boolean canFont() { + return false; + } + + @Override + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + final BCalque[] cqs = calquePanel_.getVueCalque().getCalque().getTousCalques(); + final List<EbliWidgetAnimatedItem> res = new ArrayList<EbliWidgetAnimatedItem>(20); + for (int i = 0; i < cqs.length; i++) { + if (cqs[i].isVisible() && cqs[i] instanceof EbliAnimationAdapterInterface) { + res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], getId(), cqs[i].getName(), + cqs[i].getTitle())); + } + } + return res; + } + + @Override + public boolean isAnimatedItemAlive(final String _id) { + final BCalque cq = calquePanel_.getVueCalque().getCalque().getCalqueParNom(_id); + return cq != null && cq.isVisible(); + } + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorDblFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorDblFleche.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorDblFleche.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -0,0 +1,45 @@ +package org.fudaa.ebli.visuallibrary.creator; + +import java.awt.Shape; +import java.awt.geom.GeneralPath; +import java.awt.geom.Rectangle2D; +import java.util.Map; + +/** + * Creation de la double fleche. + * @author Adrien Hadoux + * + */ + +public class ShapeCreatorDblFleche implements ShapeCreator { + + public Shape createShapeFor(final Rectangle2D.Float rec, final Map options, final float largeurTrait) { + final Float ratioHeadW = (Float) options.get("arrow.ratioHeadW"); + final Float ratioBaseH = (Float) options.get("arrow.ratioBaseH"); + final float rb = ratioBaseH == null ? 0.3f : ratioBaseH.floatValue(); + final float rh = ratioHeadW == null ? 0.3f : ratioHeadW.floatValue(); + final float middleH = rec.y + rec.height / 2f; + final float hauteurBase = rec.height * rb; + final float largeurHead = rec.width * rh; + final GeneralPath path = new GeneralPath(); + //-- debut pointe fleche --// + path.moveTo(rec.x+ largeurTrait / 2, middleH ); + path.lineTo(rec.x +largeurHead,rec.y+ largeurTrait / 2); + path.lineTo(rec.x +largeurHead, middleH - hauteurBase / 2); + + //-- fleche classique --// + path.lineTo(rec.x + rec.width - largeurHead, middleH - hauteurBase / 2); + path.lineTo(rec.x + rec.width - largeurHead, rec.y + largeurTrait / 2); + path.lineTo(rec.x + rec.width - largeurTrait / 2, middleH); + path.lineTo(rec.x + rec.width - largeurHead, rec.y + rec.height - largeurTrait / 2); + path.lineTo(rec.x + rec.width - largeurHead, middleH + hauteurBase / 2); + + //--fin fleche + path.lineTo(rec.x+largeurHead, middleH + hauteurBase / 2); + path.lineTo(rec.x+largeurHead, rec.y + rec.height - largeurTrait / 2); + path.lineTo(rec.x+ largeurTrait / 2, middleH); + + path.closePath(); + return path; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -13,6 +13,7 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluLibSwing; @@ -140,17 +141,36 @@ // -- on prend la location du node au moment de la suppression pour // pouvoir la retablir dans le undo --// // n.setPreferedLocation(widget_.getPreferredLocation()); - // -- on enregistre la commande undo redo --// - cmd_ - .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + // -- on enleve le node de la scene --// widget_.getEbliScene().removeNode(n); // -- on supprime le node legende associe --// - if (widgetGraphe_.getNodeLegende() != null) { + if (hasLegende()) { widget_.getEbliScene().removeNode(widgetGraphe_.getNodeLegende()); + final CtuluCommand commande1=new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation())); + final CtuluCommand commande2= new CommandSupprimer(widgetGraphe_.getNodeLegende(), widget_.getEbliScene(), widget_.convertLocalToScene(widgetGraphe_.getNodeLegende().getWidget().getLocation())); + cmd_.addCmd(new CtuluCommand(){ + @Override + public void redo() { + // TODO Auto-generated method stub + commande1.redo(); + commande2.redo(); + } + + @Override + public void undo() { + // TODO Auto-generated method stub + commande1.undo(); + commande2.undo(); + } + + }); + }else{ + // -- on enregistre la commande undo redo unitaire --// + cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); } // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -102,7 +102,7 @@ final Rectangle rec = getClientArea(); final Graphics2D g = getGraphics(); // g.translate(rec.x, rec.y); - + if(rec.width>0 && rec.height>0){ if (frame_ == null) { getGraphe().setSize(rec.width - 1, rec.height - 1); // getGraphe().computeMarges(g); @@ -119,7 +119,7 @@ } g.drawImage(imageGraphe, rec.x, rec.y, rec.width - 1, rec.height - 1, null); - + } // g.translate(-rec.x, -rec.y); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -26,243 +26,280 @@ */ public class WidgetLegendeManager { - // public static int LENGHT_PER_LEGENDE = 15; - // public static int WIDTH_PER_LEGENDEICON = 100; - // public static int WIDTH_PER_LEGENDETEXT = 120; - // public static int MAX_BORDURE = 12; + // public static int LENGHT_PER_LEGENDE = 15; + // public static int WIDTH_PER_LEGENDEICON = 100; + // public static int WIDTH_PER_LEGENDETEXT = 120; + // public static int MAX_BORDURE = 12; - // public static Dimension createSizeForWidget(int _nbLibelles){ - // return new Dimension(WIDTH_PER_LEGENDEICON + WIDTH_PER_LEGENDETEXT, _nbLibelles - // * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); - // } + // public static Dimension createSizeForWidget(int _nbLibelles){ + // return new Dimension(WIDTH_PER_LEGENDEICON + WIDTH_PER_LEGENDETEXT, _nbLibelles + // * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + // } - /** - * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font - */ - public static class WidgetCalqueLegende extends EbliWidget { + /** + * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font + */ + public static class WidgetCalqueLegende extends EbliWidget { - Font oldFont_; + Font oldFont_; - public WidgetCalqueLegende(final EbliScene scene, final boolean _controller) { - super(scene, _controller); - oldFont_ = getFormeFont(); - } + public WidgetCalqueLegende(final EbliScene scene, final boolean _controller) { + super(scene, _controller); + oldFont_ = getFormeFont(); + } - protected Rectangle resizeMaxLegende() { - this.getGraphics().setFont(getFormeFont()); - int maxHeight = 0; - int maxWidth = 0; - // -- mise a jour de la widget avec la nouvelle font - final List<Widget> listePlage = getChildren(); - for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - final Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { - final EbliWidget new_widget = (EbliWidget) widget; + protected Rectangle resizeMaxLegende() { + this.getGraphics().setFont(getFormeFont()); + int maxHeight = 0; + int maxWidth = 0; + // -- mise a jour de la widget avec la nouvelle font + final List<Widget> listePlage = getChildren(); + for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + final Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { + final EbliWidget new_widget = (EbliWidget) widget; - EbliWidgetTitle tw = null; + EbliWidgetTitle tw = null; - if (new_widget.getChildren().get(0) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget - .getChildren().get(0); - else if (new_widget.getChildren().get(1) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget - .getChildren().get(1); + if (new_widget.getChildren().get(0) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget + .getChildren().get(0); + else if (new_widget.getChildren().get(1) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget + .getChildren().get(1); - if (tw != null) { - // -- recuperation des tailles des font pour les textes saisies + if (tw != null) { + // -- recuperation des tailles des font pour les textes saisies - final FontMetrics ftm = this.getGraphics().getFontMetrics(); + final FontMetrics ftm = this.getGraphics().getFontMetrics(); - final int newWidth = ftm.stringWidth(tw.intern_.getLabel()); - final int newHeight = ftm.getHeight(); - if (maxWidth < newWidth) maxWidth = newWidth; - maxHeight = newHeight; - } - } + final int newWidth = ftm.stringWidth(tw.intern_.getLabel()); + final int newHeight = ftm.getHeight(); + if (maxWidth < newWidth) maxWidth = newWidth; + maxHeight = newHeight; + } + } - } - final Rectangle newBounds = new Rectangle(); - newBounds.height /* + */= maxHeight; - newBounds.width /* + */= maxWidth; + } + final Rectangle newBounds = new Rectangle(); + newBounds.height /* + */= maxHeight; + newBounds.width /* + */= maxWidth; - return newBounds; - } + return newBounds; + } + + + boolean suppressionOccured=false; + + public void majSuppression(){ + suppressionOccured=true; + repaint(); + } + - @Override - protected void paintWidget() { + @Override + protected void paintWidget() { - // -- mise a jour de la fonte que si il y a eu une modification --// - if (oldFont_ != getFormeFont()) { + // -- mise a jour de la fonte que si il y a eu une modification --// + if (oldFont_ != getFormeFont() || suppressionOccured) { + suppressionOccured=false; + // -- calcul des max height et width pour resize les composants --// + final Rectangle newBounds = resizeMaxLegende(); - // -- calcul des max height et width pour resize les composants --// - final Rectangle newBounds = resizeMaxLegende(); + // -- mise a jour de la widget avec la nouvelle font + final List<Widget> listePlage = getChildren(); + for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + final Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { + final EbliWidget new_widget = (EbliWidget) widget; - // -- mise a jour de la widget avec la nouvelle font - final List<Widget> listePlage = getChildren(); - for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - final Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { - final EbliWidget new_widget = (EbliWidget) widget; + EbliWidgetLine lw = null; + EbliWidgetTitle tw = null; - EbliWidgetLine lw = null; - EbliWidgetTitle tw = null; + if (new_widget.getChildren().get(0) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget + .getChildren().get(0); + else tw = (EbliWidgetTitle) new_widget.getChildren().get(0); - if (new_widget.getChildren().get(0) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget - .getChildren().get(0); - else tw = (EbliWidgetTitle) new_widget.getChildren().get(0); + if (new_widget.getChildren().get(1) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget + .getChildren().get(1); + else tw = (EbliWidgetTitle) new_widget.getChildren().get(1); + if (lw != null && tw != null) { - if (new_widget.getChildren().get(1) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget - .getChildren().get(1); - else tw = (EbliWidgetTitle) new_widget.getChildren().get(1); - if (lw != null && tw != null) { + tw.getIntern_().setFont(getFormeFont()); - tw.getIntern_().setFont(getFormeFont()); + // resize du composant texte + final Rectangle internBounds = tw.getIntern_().getBounds(); + // internBounds.height += (getFormeFont().getSize() - + // oldFont_.getSize()) * 2; + // internBounds.width += (getFormeFont().getSize() - + // oldFont_.getSize()) * 12; + internBounds.width = newBounds.width; + internBounds.height = (newBounds.height); + tw.getIntern_().setPreferredBounds(internBounds); - // resize du composant texte - final Rectangle internBounds = tw.getIntern_().getBounds(); - // internBounds.height += (getFormeFont().getSize() - - // oldFont_.getSize()) * 2; - // internBounds.width += (getFormeFont().getSize() - - // oldFont_.getSize()) * 12; - internBounds.width = newBounds.width; - internBounds.height = (newBounds.height); - tw.getIntern_().setPreferredBounds(internBounds); + // resize pour le logo: forme carr\xE9 + final Rectangle boundsLogo = lw.getBounds(); + // boundsLogo.height = internBounds.height; + // boundsLogo.width = internBounds.height; + boundsLogo.height = (newBounds.height); + boundsLogo.width = (newBounds.height); + lw.setPreferredBounds(boundsLogo); - // resize pour le logo: forme carr\xE9 - final Rectangle boundsLogo = lw.getBounds(); - // boundsLogo.height = internBounds.height; - // boundsLogo.width = internBounds.height; - boundsLogo.height = (newBounds.height); - boundsLogo.width = (newBounds.height); - lw.setPreferredBounds(boundsLogo); + } + } - } - } + } + // Resize de la widget - } - // Resize de la widget + // Rectangle newBounds = getParentWidget().getBounds(); + // newBounds.height += (listePlage.size() + 1) * + // (getFormeFont().getSize() - oldFont_.getSize()) * 2; + // newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * + // 12; + // getParentWidget().setPreferredBounds(newBounds); + final Rectangle newBoundConteneurs = getParentWidget().getBounds(); + newBoundConteneurs.height = (int) ((listePlage.size() + 1) * newBounds.height * 1.5);// ( + newBoundConteneurs.width = (int) (newBounds.width * 1.5); + getParentWidget().setPreferredBounds(newBoundConteneurs); + getEbliScene().refresh(); + oldFont_ = getFormeFont(); - // Rectangle newBounds = getParentWidget().getBounds(); - // newBounds.height += (listePlage.size() + 1) * - // (getFormeFont().getSize() - oldFont_.getSize()) * 2; - // newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * - // 12; - // getParentWidget().setPreferredBounds(newBounds); - final Rectangle newBoundConteneurs = getParentWidget().getBounds(); - newBoundConteneurs.height = (int) ((listePlage.size() + 1) * newBounds.height * 1.5);// ( - newBoundConteneurs.width = (int) (newBounds.width * 1.5); - getParentWidget().setPreferredBounds(newBoundConteneurs); - getEbliScene().refresh(); - oldFont_ = getFormeFont(); + } - } + } - } + @Override + public boolean canRotate() { + return false; + } - @Override - public boolean canRotate() { - return false; - } + @Override + public boolean canColorForeground() { + return false; + } - @Override - public boolean canColorForeground() { - return false; - } + @Override + public boolean canColorBackground() { + return true; + } - @Override - public boolean canColorBackground() { - return true; - } + @Override + public boolean canTraceLigneModel() { + return false; + } - @Override - public boolean canTraceLigneModel() { - return false; - } + @Override + public boolean canFont() { + return true; + } - @Override - public boolean canFont() { - return true; - } + } - } + /** + * Creation de la legende + * + * @param g + * @param scene + * @param PreferredLocation peut etre null + * @return + */ + public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { + final EGCourbe[] cs = g.getModel().getCourbes(); + final WidgetCalqueLegende res = new WidgetCalqueLegende(scene, false); + res.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5));// a + // modifier + // pour + // setter + // le gap + // res.setLayout(new OverlayLayout()); + for (int i = 0; i < cs.length; i++) { + final EbliWidget line = new EbliWidget(scene); + line.setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); - /** - * Creation de la legende - * - * @param g - * @param scene - * @param PreferredLocation peut etre null - * @return - */ - public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { - final EGCourbe[] cs = g.getModel().getCourbes(); - final WidgetCalqueLegende res = new WidgetCalqueLegende(scene, false); - res.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5));// a - // modifier - // pour - // setter - // le gap - // res.setLayout(new OverlayLayout()); - for (int i = 0; i < cs.length; i++) { - final EbliWidget line = new EbliWidget(scene); - line.setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); + // creation de la widget titre + final EbliWidgetTitle tw = new EbliWidgetTitle(scene, cs[i], null); - // creation de la widget titre - final EbliWidgetTitle tw = new EbliWidgetTitle(scene, cs[i], null); + // creation de la widget ligne + final EbliWidgetLine lw = new EbliWidgetLine(scene, cs[i], null); + line.setUseBorder(false); + lw.setUseBorder(false); + tw.setUseBorder(false); - // creation de la widget ligne - final EbliWidgetLine lw = new EbliWidgetLine(scene, cs[i], null); - line.setUseBorder(false); - lw.setUseBorder(false); - tw.setUseBorder(false); + lw.setEnabled(false); + line.addChild(lw); + line.addChild(tw); + res.addChild(line); - lw.setEnabled(false); - line.addChild(lw); - line.addChild(tw); - res.addChild(line); + // -- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els + // l\xE9gendes --// + g.getModel().addModelListener(new EGGrapheModelListener() { - // -- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els - // l\xE9gendes --// - g.getModel().addModelListener(new EGGrapheModelListener() { + public void structureChanged() { + if(g.getModel().contains(lw.cb_)){ + line.repaint(); + tw.majLabel(); + }else{ + //-- il faut supprimer --// + res.removeChild(line); + res.majSuppression(); + } - public void structureChanged() { - line.repaint(); - tw.majLabel(); + } - } + public void courbeContentChanged(final EGObject _c, final boolean restore) { + if(g.getModel().contains(lw.cb_)){ + line.repaint(); + tw.majLabel(); + }else{ + //-- il faut supprimer --// + res.removeChild(line); + res.majSuppression(); + } + } - public void courbeContentChanged(final EGObject _c, final boolean restore) { - line.repaint(); - tw.majLabel(); + public void courbeAspectChanged(final EGObject _c, final boolean _visibil) { + if(g.getModel().contains(lw.cb_)){ + line.repaint(); + tw.majLabel(); + }else{ + //-- il faut supprimer --// + res.removeChild(line); + res.majSuppression(); + } + } - } + public void axeContentChanged(final EGAxe _c) { + if(g.getModel().contains(lw.cb_)){ + line.repaint(); + tw.majLabel(); + }else{ + //-- il faut supprimer --// + res.removeChild(line); + res.majSuppression(); + } + } - public void courbeAspectChanged(final EGObject _c, final boolean _visibil) { - line.repaint(); - tw.majLabel(); + public void axeAspectChanged(final EGAxe _c) { + if(g.getModel().contains(lw.cb_)){ + line.repaint(); + tw.majLabel(); + }else{ + //-- il faut supprimer --// + res.removeChild(line); + res.majSuppression(); + } + } + }); - } + } - public void axeContentChanged(final EGAxe _c) { - line.repaint(); - tw.majLabel(); - } + res.setController(new EbliWidgetControllerMenuOnly(res, false)); - public void axeAspectChanged(final EGAxe _c) { - line.repaint(); - tw.majLabel(); - } - }); + // -- prendre en compte le resize automatique --// + res.oldFont_ = new Font("Helvetica", Font.BOLD, 40); + res.repaint(); - } + return res; + } - res.setController(new EbliWidgetControllerMenuOnly(res, false)); - - // -- prendre en compte le resize automatique --// - res.oldFont_ = new Font("Helvetica", Font.BOLD, 40); - res.repaint(); - - return res; - } - } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -51,6 +51,7 @@ import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorShape; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorTextLabel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorDblFleche; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; @@ -319,7 +320,21 @@ return nodeFleche; } + + public EbliNode addDblFleche() { + // -- ajout du rectangle --// + final EbliNodeDefault nodeFleche = new EbliNodeDefault(); + nodeFleche.setTitle("Double Fleche"); + nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorDblFleche())); + nodeFleche.setPreferedSize(new Dimension(100, 50)); + nodeFleche.setPreferedLocation(new Point(350, 125)); + // ajout du node au layout + addNode(nodeFleche); + + return nodeFleche; + } + /** * Methode generique d ajout d un node widget a la scene. * @@ -405,7 +420,7 @@ .getToolIcon("crystal_bu_scrollpane_corner"), "WIDGETDBLFLECHE") { @Override public void actionPerformed(final ActionEvent _evt) { - addFleche(); + addDblFleche(); } }); // -- palette Ellipse --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -500,7 +500,7 @@ */ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// - return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(_src.getFile()); + return "Fichier: " + formatFichier(_src.getFile())+" |"+formatName(_src.getTitle()) ; } public String formatFichier(final File file) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -337,6 +337,8 @@ // parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); } + + final EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); parent.setGroup(true); @@ -350,7 +352,8 @@ // -- synchronisation des sondes des fusions --// parent.synchroniseSondeFusion(); - + //-- synchronisation du zoom --// + parent.synchronyseZoom(); scene_.addNode(node); if (pn != null && boite != null) { pn.getVueCalque().changeRepere(pn, boite, 0, 0); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-23 11:14:24 UTC (rev 4091) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-23 16:30:33 UTC (rev 4092) @@ -438,7 +438,7 @@ final List<TrPostUserVariableSaver> liste = new XmlArrayList(new VariablesStreamStrategy(new File(path),trprojet_.listeSrc_)); - if (init) clearDatas(liste); + //if (init) clearDatas(liste); return liste; } @@ -446,9 +446,10 @@ private void clearDatas(final List<TrPostUserVariableSaver> list) { // CtuluRemoveContentDirectory.contentDirectoryRemover(getDirectoryCurves()); if (list == null) return; - while (list.size() != 0) - list.remove(0); - + for(Iterator<TrPostUserVariableSaver> it=list.iterator();it.hasNext();){ + it.next(); + it.remove(); + } } /** @@ -674,7 +675,12 @@ // -- etape 1: creation du repertoire des graphe et calques --// final String pathVariables = projet_.getAbsolutePath() + File.separator + "Variables"; try { - new File(pathVariables).mkdir(); + File fileVar= new File(pathVariables); + + if(fileVar.isDirectory()){ + CtuluRemoveContentDirectory.contentDirectoryRemover(fileVar); + }else + fileVar.mkdir(); } catch (final Exception e) { // pas grave on continue FuLog.debug("Le repertoire des variables existe deja"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-23 11:18:45
|
Revision: 4091 http://fudaa.svn.sourceforge.net/fudaa/?rev=4091&view=rev Author: hadouxad Date: 2008-10-23 11:14:24 +0000 (Thu, 23 Oct 2008) Log Message: ----------- - phase correction bug Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -1,33 +1,27 @@ package org.fudaa.ctulu.pdf; import java.awt.BorderLayout; -import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import javax.swing.BorderFactory; -import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; -import javax.swing.JScrollPane; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUI; import com.memoire.bu.BuPanel; -import com.sun.pdfview.PDFFile; /** - * Fenetre viewer pdf custom + * Fenetre viewer pdf custom. Utilise un CtuluPanelPdfViewer + * * @author Adrien Hadoux - * + * */ public class CtuluFramePdfCustomViewer extends JFrame{ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -21,20 +21,19 @@ import java.util.ArrayList; import java.util.List; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.trace.TraceLigne; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + /** * Un calque d'affichage d'une grille. * @@ -65,7 +64,8 @@ vue_ = _vue; setDestructible(false); setTitle(EbliLib.getS("Grille")); - setForeground(new Color(204, 153, 0)); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); } public int getNbXGraduations() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -1,12 +1,15 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Graphics2D; import java.awt.Insets; +import java.awt.Rectangle; import java.util.HashMap; import java.util.List; import java.util.Map; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimatedItem; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; @@ -81,13 +84,16 @@ return intern_.isInEditMode_; } + OverlayLayoutGap layout_; + public EbliWidgetBordureSingle(final EbliWidget _intern, final boolean canMove, final boolean canResize) { super(_intern.getEbliScene(), false); intern_ = _intern; insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); - setLayout(new OverlayLayoutGap(insets_)); + layout_ = new OverlayLayoutGap(insets_); + setLayout(layout_); // -- ajout du child --// addChild(intern_); @@ -100,6 +106,44 @@ this.setController(controllerBordure_); } + + protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + + final Graphics2D g = getGraphics(); + + final Rectangle rec = getClientArea(); + + g.translate(rec.x, rec.y); + + final TraceLigne l = new TraceLigne(getTraceLigneModel()); + + // // --test on autorise que si son widget fils le permet --// + if (this.getIntern().canColorBackground()) { + getGraphics().setColor(getColorFond()); + getGraphics().fillRect(0, 0, (int) (rec.width - l.getEpaisseur()), (int) (rec.height - l.getEpaisseur())); + } + + l.setCouleur(getColorContour()); + l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l + .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* + * , rec.width + */); + + g.translate(-rec.x, -rec.y); + + // setBackground(getColorFond()); + + // layout_.justify(intern_); + insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); + + layout_ = new OverlayLayoutGap(insets_); + setLayout(layout_); + revalidate(); + + } + public Insets createInset(final int epaisseur) { return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -13,6 +13,7 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; /** * Classe qui permet de dessinner des shapes. @@ -90,7 +91,7 @@ // Il faut prendre en compte l'epaisseur de la ligne final Rectangle2D.Float rec = new Rectangle2D.Float(ep / 2, ep / 2, recInit.width - ep, recInit.height - ep); Shape shape = shaper_.createShapeFor(rec, options_, ep); - if (getRotation() != 0) { + if (getRotation() != 0 && !(shaper_ instanceof ShapeCreatorLine)) { AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); shape = tr.createTransformedShape(shape); final Rectangle2D newBound = shape.getBounds2D(); @@ -101,6 +102,10 @@ shape = AffineTransform.getScaleInstance(wRatio, hRatio).createTransformedShape(shape); tr = AffineTransform.getTranslateInstance(ep / 2, ep / 2); shape = tr.createTransformedShape(shape); + } else if (getRotation() != 0) { + // cas line + AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); + shape = tr.createTransformedShape(shape); } if (fg_ != null) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -150,6 +150,8 @@ } public boolean hasLegende() { + if (getNodeLegende() == null) + return false; return widget_.getEbliScene().isObject(getNodeLegende()); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -0,0 +1,26 @@ +package org.fudaa.ebli.visuallibrary.creator; + +import java.awt.Shape; +import java.awt.geom.Line2D; +import java.awt.geom.Rectangle2D.Float; +import java.util.Map; + +/** + * ShapeCreator pour les lignes classiques. + * + * @author Adrien Hadoux + * + */ +public class ShapeCreatorLine implements ShapeCreator { + + public Shape createShapeFor(Float _rec, Map _options, float _largeurTrait) { + // final GeneralPath path = new GeneralPath(); + // path.moveTo(_rec.x, _rec.y + _rec.height / 2f); + // path.lineTo(_rec.x + _rec.width, _rec.y + _rec.height / 2f); + // + // path.closePath(); + // return path; + return new Line2D.Float(_rec.x, _rec.y + _rec.height / 2f, _rec.x + _rec.width, _rec.y + _rec.height / 2f); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -169,8 +169,10 @@ public void actionPerformed(final ActionEvent e) { // -- si la widget a une bordure c'est la bordure que l on masque --// - final EbliWidget widgetUndo1 = widget_.getParentBordure(); - final EbliWidget widgetUndo2 = widgetGraphe_.getNodeLegende().getWidget().getParentBordure(); + final EbliWidget widgetGrapheBordure = widget_.getParentBordure(); + EbliWidget widgetLegendeBordure = null; + if(widgetGraphe_.getNodeLegende()!=null) + widgetLegendeBordure = widgetGraphe_.getNodeLegende().getWidget().getParentBordure(); // EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); // if (n.getCreator().getBordure() != null) { @@ -180,7 +182,7 @@ // widgetUndo1 = n.getCreator().getBordure(); // // } else { - widgetUndo1.setVisible(false); + widgetGrapheBordure.setVisible(false); // widgetUndo1 = widget_; // } @@ -191,14 +193,17 @@ // widgetUndo2 = widgetGraphe_.getNodeLegende().getCreator().getBordure(); // } else { // widgetGraphe_.getNodeLegende().getWidget().setVisible(false); - // - widgetUndo2.setVisible(false); + // + if(widgetLegendeBordure!=null) + widgetLegendeBordure.setVisible(false); // } // -- creation des comamndes undo/redo pour le masquage --// final ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); - listeWidget.add(widgetUndo1); - listeWidget.add(widgetUndo2); + listeWidget.add(widgetGrapheBordure); + + if(widgetLegendeBordure!=null) + listeWidget.add(widgetLegendeBordure); cmd_.addCmd(new CommandMasquer(listeWidget)); @@ -208,6 +213,9 @@ } public boolean hasLegende() { + if (widgetGraphe_.getNodeLegende() == null) + return false; + return widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -9,7 +9,9 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.netbeans.api.visual.model.ObjectScene; @@ -91,21 +93,26 @@ listeWidgetUndo.add(((EbliNode) getUserObject()).getWidget()); // -- cas particulier si il s agit d un calque ou d un graphe, on masque - // les sous fils --// + // aussi + if ((((EbliNode) getUserObject()).getWidget()) instanceof EbliWidgetBordureSingle && (((EbliNode) getUserObject()).getWidget()).getChildren() != null) { if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { final EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getWidget()) .getChildren().get(0); + if (((EbliWidgetControllerCalque) wid.getController()).hasLegende()) { wid.nodeLegende.getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.nodeLegende.getWidget()); + } } else if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetGraphe) { final EbliWidgetGraphe wid = (EbliWidgetGraphe) (((EbliNode) getUserObject()).getWidget()).getChildren() .get(0); + if (((EbliWidgetControllerGraphe) wid.getController()).hasLegende()) { wid.getNodeLegende().getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.getNodeLegende().getWidget()); + } } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -53,6 +53,7 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.actions.TrPostActionChangeSceneForWidget; @@ -261,6 +262,19 @@ return nodeLegende; } + public EbliNode addLigne() { + // -- ajout du rectangle --// + final EbliNodeDefault nodeLigne = new EbliNodeDefault(); + nodeLigne.setTitle("Ligne"); + nodeLigne.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorLine())); + nodeLigne.setPreferedSize(new Dimension(200, 100)); + nodeLigne.setPreferedLocation(new Point(350, 125)); + // ajout du node au layout + addNode(nodeLigne); + + return nodeLigne; + } + public EbliNode addCercle() { // -- ajout du rectangle --// final EbliNodeDefault nodeCercle = new EbliNodeDefault(); @@ -367,6 +381,15 @@ // TODO a revoir _l.add(new EbliWidgetActiontextEditor(getSceneCourante())); + // -- ligne --// + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Ligne"), EbliResource.EBLI.getToolIcon("trait"), + "WIDGETLINE") { + @Override + public void actionPerformed(final ActionEvent _evt) { + addLigne(); + } + }); + // -- palette fleche --// _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), EbliResource.EBLI.getToolIcon("crystal_bu_link"), "WIDGETFLECHE") { @@ -375,6 +398,16 @@ addFleche(); } }); + + // -- palette double fleche --// + // crystal_bu_scrollpane_corner.png + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Double Fleche"), EbliResource.EBLI + .getToolIcon("crystal_bu_scrollpane_corner"), "WIDGETDBLFLECHE") { + @Override + public void actionPerformed(final ActionEvent _evt) { + addFleche(); + } + }); // -- palette Ellipse --// _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Ellipse"), EbliResource.EBLI.getToolIcon("ellip"), "WIDGETELLIPSE") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-23 10:37:10
|
Revision: 4090 http://fudaa.svn.sourceforge.net/fudaa/?rev=4090&view=rev Author: emmanuel_martin Date: 2008-10-23 09:39:33 +0000 (Thu, 23 Oct 2008) Log Message: ----------- Ajout de donn?\195?\169es dans le panel d'information (renomm?\195?\169 en panel de propri?\195?\169t?\195?\169s), certaines de ces propri?\195?\169t?\195?\169s sont ?\195?\169ditables. Ces modifications ne concernent que les calques du modeleur. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorDouble.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorI.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorInteger.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorString.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueTimeEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.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/calque/edition/ZModeleMultiPointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacFrontierNumberIteratorAbstract.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -689,21 +689,17 @@ FuLog.trace("toPolygone : Nombre de point minimum non respect\xE9."); return null; } - boolean ferme = coord.getCoordinate(0)==seq.getCoordinate(coord.size()-1); + boolean ferme = coord.getCoordinate(0).equals(seq.getCoordinate(coord.size()-1)); if(ferme&&seq.size()==2){ FuLog.trace("toPolygone : Nombre de point minimum non respect\xE9."); return null; } - if(!ferme){ - seq=new CoordinateArraySequence(seq.size()+1); + if(ferme){ + seq=new CoordinateArraySequence(seq.size()-1); // recopie - for(int i=0;i<coord.size();i++) + for(int i=0;i<coord.size()-1;i++) for(int j=0;j<3;j++) seq.setOrdinate(i, j, coord.getOrdinate(i, j)); - // Fermeture - for(int i=0;i<3;i++) - seq.setOrdinate(seq.size()-1, i, seq.getOrdinate(0, i)); - } return GISGeometryFactory.INSTANCE.createLineString(seq); } @@ -720,7 +716,7 @@ FuLog.trace("toPolygone : Nombre de point minimum non respect\xE9."); return null; } - boolean ferme = coord.getCoordinate(0)==seq.getCoordinate(coord.size()-1); + boolean ferme = coord.getCoordinate(0).equals(seq.getCoordinate(coord.size()-1)); if(ferme&&seq.size()==3){ FuLog.trace("toPolygone : Nombre de point minimum non respect\xE9."); return null; @@ -734,7 +730,6 @@ // Fermeture for(int i=0;i<3;i++) seq.setOrdinate(seq.size()-1, i, seq.getOrdinate(0, i)); - } return GISGeometryFactory.INSTANCE.createLinearRing(seq); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -152,6 +152,22 @@ return false; } + /** + * Supprime tout les editeurs. + */ + public void clear(){ + mapEditors_.clear(); + editable_=false; + } + + /** + * Supprime si il est d\xE9fini l'editeur situ\xE9 \xE0 l'index _rowIndex + * @param _rowIndex : l'index de l'\xE9diteur \xE0 supprimer + */ + public void remove(int _rowIndex){ + mapEditors_.remove(_rowIndex); + } + /* (non-Javadoc) * @see javax.swing.CellEditor#cancelCellEditing() */ Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorChoice.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -11,15 +11,15 @@ import java.util.Arrays; import javax.swing.DefaultCellEditor; -import javax.swing.JComboBox; import javax.swing.JComponent; +import javax.swing.JTable; import javax.swing.table.TableCellEditor; -import com.memoire.bu.BuComboBox; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; +import com.memoire.bu.BuComboBox; + /** * @author fred deniger * @version $Id: CtuluValueEditorChoice.java,v 1.5 2007-03-23 17:16:16 deniger Exp $ @@ -42,6 +42,7 @@ private String[] reelChoices_; private boolean useInteger_; + private final String undefineValue_="< " + CtuluLib.getS("Ind\xE9fini") + " >"; /** * Dans le cas o\xF9 dChoices est null, reelChoices sera \xE9galement affich\xE9. @@ -79,11 +80,11 @@ public JComponent createCommonEditorComponent() { String[] elements; if(displayChoices_!=null) - elements = displayChoices_; + elements=displayChoices_; else elements=reelChoices_; final String[] extendedChoices = new String[elements.length + 1]; - extendedChoices[elements.length] = "< " + CtuluLib.getS("Ind\xE9fini") + " >"; + extendedChoices[elements.length] = undefineValue_; System.arraycopy(elements, 0, extendedChoices, 0, elements.length); BuComboBox bu = new BuComboBox(extendedChoices); bu.setSelectedIndex(elements.length); @@ -106,12 +107,54 @@ else { return new DefaultCellEditor(cb) { public Object getCellEditorValue() { - return reelChoices_[cb.getSelectedIndex()]; + if(cb.getSelectedIndex()==-1) + return null; + else + return reelChoices_[cb.getSelectedIndex()]; } }; } } + public TableCellEditor createCommonTableEditorComponent() { + final BuComboBox cb = (BuComboBox) createCommonEditorComponent(); + if (useInteger_) { + return new DefaultCellEditor(cb) { + public Object getCellEditorValue() { + return new Integer(cb.getSelectedIndex()); + } + }; + } + else { + return new DefaultCellEditor(cb) { + /* (non-Javadoc) + * @see javax.swing.DefaultCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) + */ + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if(displayChoices_!=null){ + // R\xE9cup\xE9ration de l'index de la valeur dans reelChoices_ + boolean found=false; + int i=-1; + while(!found&&++i<reelChoices_.length) + found=reelChoices_[i].equals(value); + if(found) + value=displayChoices_!=null?displayChoices_[i]:value; + else + value=undefineValue_; + } + return super.getTableCellEditorComponent(table, value, isSelected, row, column); + } + public Object getCellEditorValue() { + if(cb.getSelectedIndex()<0||cb.getSelectedIndex()>=reelChoices_.length) + return cb.getSelectedItem(); + else + return reelChoices_[cb.getSelectedIndex()]; + } + }; + } + } + public int getSelectedIdx(final Component _c) { return ((BuComboBox) _c).getSelectedIndex(); } @@ -154,7 +197,10 @@ } public boolean isValid(final Object _o) { - return true; + if(_o instanceof String&&!_o.equals(undefineValue_)) + return true; + else + return false; } public String getValidationMessage() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorDouble.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorDouble.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorDouble.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -105,6 +105,10 @@ public TableCellEditor createTableEditorComponent() { return new BuTableCellEditor((BuTextField) createEditorComponent()); } + + public TableCellEditor createCommonTableEditorComponent() { + return new BuTableCellEditor((BuTextField) createCommonEditorComponent()); + } public final CtuluNumberFormatI getFormatter() { return formatter_; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorI.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorI.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorI.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -42,6 +42,8 @@ JComponent createCommonEditorComponent(); TableCellEditor createTableEditorComponent(); + + TableCellEditor createCommonTableEditorComponent(); boolean isValueValidFromComponent(Component _comp); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorInteger.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorInteger.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorInteger.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -83,6 +83,10 @@ return new BuTableCellEditor((BuTextField) createEditorComponent()); } + public TableCellEditor createCommonTableEditorComponent() { + return new BuTableCellEditor((BuTextField) createCommonEditorComponent()); + } + public Class getDataClass() { return String.class; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorString.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorString.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueEditorString.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -66,8 +66,6 @@ return isValid(_o.toString()); } - - public JComponent createCommonEditorComponent() { return createEditorComponent(); } @@ -88,6 +86,10 @@ return new BuTableCellEditor((BuTextField) createEditorComponent()); } + public TableCellEditor createCommonTableEditorComponent(){ + return new BuTableCellEditor((BuTextField) createCommonEditorComponent()); + } + public JComponent createEditorComponent(){ final BuTextField r = new BuTextField(); r.setColumns(10); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueTimeEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueTimeEditor.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluValueTimeEditor.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -104,7 +104,34 @@ }; } + + public TableCellEditor createCommonTableEditorComponent() { + return new BuTableCellEditor((BuTextField) createCommonEditorComponent()) { + public Component getTableCellEditorComponent(final JTable _table, final Object _value, final boolean _selected, + final int _row, final int _column) { + final Component r = super.getTableCellEditorComponent(_table, _value, _selected, _row, _column); + r.requestFocusInWindow(); + return r; + } + + public boolean isCellEditable(final EventObject _evt) { + if (_evt instanceof MouseEvent) { + return ((MouseEvent) _evt).getClickCount() >= 2; + } + return true; + } + + public boolean stopCellEditing() { + if (getCellEditorValue() == null) { + return false; + } + return super.stopCellEditing(); + } + + }; + } + public String getFinalString(final double _s) { if (fmt_ == null) { return Integer.toString((int) _s); 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-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -87,14 +87,15 @@ tableModel_.fireTableDataChanged(); break; default: - tableModel_.setTitle(EbliLib.getS("Selection Multicalque")); + tableModel_.setTitle(EbliLib.getS("Selection Multiple")); } updateSize(); } public void selectionChanged(final ZSelectionEvent _evt) { if (isAvailable()) { - if (_evt.getSource().getLayerSelection()!=null&&_evt.getSource().getLayerSelection().getNbSelectedIndex()>0) { + if (_evt.getSource().getLayerSelection()!=null&&_evt.getSource().getLayerSelection().getNbSelectedIndex()>0 + ||_evt.getSource().getLayerSelectionMulti()!=null&&_evt.getSource().getLayerSelectionMulti().getNbSelectedItem()>0) { if (!calqueWithGeometriesSelected_.contains(_evt.getSource())) calqueWithGeometriesSelected_.add(_evt.getSource()); } 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-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -7,18 +7,27 @@ */ package org.fudaa.ebli.calque.edition; +import java.awt.Component; + +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; + import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZModeleGeometry; +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo; import com.memoire.bu.BuTable; -import com.memoire.fu.FuLog; import com.vividsolutions.jts.geom.CoordinateSequence; import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Geometry; @@ -29,7 +38,7 @@ * @author Bertrand Marchand * @version $Id$ */ -public class ZModeleGeometryDefault implements ZModeleGeometry { +public class ZModeleGeometryDefault implements ZModeleGeometry, ModifyPropertyInfo { protected GISZoneCollectionGeometry geometries_; /** @@ -106,7 +115,111 @@ return null; } - public void fillWithInfo(InfoData _d, ZCalqueAffichageDonneesInterface _layer) {} + public void fillWithInfo(InfoData _d, ZCalqueAffichageDonneesInterface _layer) { + // Selection en mode geom\xE9trie + if (_layer.getLayerSelection()!=null&&_layer.getLayerSelection().getNbSelectedIndex()>0) { + if (_layer.getLayerSelection().getNbSelectedIndex()==1) { + _d.setOnlyOneGeometry(true); + _d.setTitle(EbliLib.getS("G\xE9om\xE9trie")); + // Informations sur le calque + _d.put(EbliLib.getS("Calque"), _layer.getTitle()); + // Ajout des attributs et des valeurs de la g\xE9om\xE9trie selectionn\xE9e + int geometrySelected=_layer.getLayerSelection().getSelectedIndex()[0]; + for (int i=0; i<geometries_.getNbAttributes(); i++) { + GISAttributeInterface attr=geometries_.getAttribute(i); + // Si l'attribut nom est d\xE9fini, il est utilis\xE9 pour le titre et + // remplace celui pr\xE9c\xE9dement d\xE9fini + if (attr==GISAttributeConstants.TITRE) + _d.setTitle(EbliLib.getS("Objet")+" : "+geometries_.getValue(i, geometrySelected).toString()); + // Ajout de l'information au tableau + if (!attr.isAtomicValue()&&attr.isUserVisible()) + if (attr.isEditable()) + _d.put(attr.getLongName(), geometries_.getValue(i, geometrySelected), attr.getEditor(), + null, this, new int[]{geometrySelected}); + else + _d.put(attr.getLongName(), geometries_.getValue(i, geometrySelected).toString()); + } + } + else { + _d.setOnlyOneGeometry(false); + // Informations sur les g\xE9om\xE9tries selectionn\xE9es + _d.setTitle(EbliLib.getS("Selection Multiple")); + // Informations sur le calque + _d.put(EbliLib.getS("Calque"), _layer.getTitle()); + // Ajout des attributs et des valeurs de la g\xE9om\xE9trie selectionn\xE9e + int[] geometriesSelected=_layer.getLayerSelection().getSelectedIndex(); + for (int i=0; i<geometries_.getNbAttributes(); i++) { + GISAttributeInterface attr=geometries_.getAttribute(i); + // Ajout de l'information au tableau + if (!attr.isAtomicValue()&&attr.isUserVisible()){ + // D\xE9termine la valeur commune aux g\xE9om\xE9tries selectionn\xE9es + Object value; + boolean sameValues=true; + int j=0; + while(sameValues&&++j<geometriesSelected.length) + sameValues=geometries_.getValue(i, geometriesSelected[j-1]).equals(geometries_.getValue(i, geometriesSelected[j])); + if(sameValues) + value=geometries_.getValue(i, geometriesSelected[0]); + else + value=null; + // Ajout de cette valeur + if (attr.isEditable()){ + TableCellRenderer renderer=new DefaultTableCellRenderer(){ + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, + int row, int column) { + if(value==null) + value="< "+EbliLib.getS("Ind\xE9fini")+" >"; + return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + } + }; + _d.put(attr.getLongName(), value, attr.getEditor(), renderer, this, new Object[]{attr.getID(), geometriesSelected}); + } + else + _d.put(attr.getLongName(), value==null?"< "+EbliLib.getS("Ind\xE9fini")+" >":value.toString()); + } + } + } + } + // Selection en mode sommet + else if (_layer.getLayerSelectionMulti()!=null&&_layer.getLayerSelectionMulti().getNbSelectedItem()>0) { + if (_layer.getLayerSelectionMulti().getNbSelectedItem()==1) { + _d.setTitle(EbliLib.getS("Sommet")); + // Informations sur le calque + _d.put(EbliLib.getS("Calque"), _layer.getTitle()); + } + else { + // Informations sur les g\xE9om\xE9tries selectionn\xE9es + _d.setTitle(EbliLib.getS("Calque")+" : "+_layer.getTitle()); + // Informations sur le calque + _d.put(EbliLib.getS("Calque"), _layer.getTitle()); + } + } + // Pas de selection + else + // Informations sur le calque + _d.setTitle(EbliLib.getS("Calque")+" : "+_layer.getTitle()); + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) + */ + public void modifyProperty(String _key, Object _value, Object _data) { + if (_data!=null) { + if (_data instanceof int[]) { + // Recherche de l'attribut d\xE9fini par _key + boolean found=false; + int i=-1; + while (!found&&++i<geometries_.getNbAttributes()) + found=geometries_.getAttribute(i).getLongName().equals(_key); + // Modification de cet attribut + if (found) { + int[] geometries=(int[]) _data; + for (int j=0; j<geometries.length; j++) + geometries_.getModel(i).setObject(geometries[j], _value, null); + } + } + } + } public GrBoite getDomaine() { if (geometries_ == null || geometries_.getNumGeometries() == 0) { 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-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -21,14 +21,17 @@ import org.fudaa.ctulu.collection.CtuluCollection; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISAttributeModel; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ctulu.gui.CtuluTable; +import org.fudaa.ctulu.gui.CtuluValueEditorChoice; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.ebli.calque.dessin.DeForme; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -266,69 +269,109 @@ } public void fillWithInfo(final InfoData _d, final ZCalqueAffichageDonneesInterface _layer) { - _d.setTitle(_layer.getTitle()); - if (_layer.isSelectionEmpty()) { + // Selection vide : information sur le calque + if (_layer.isSelectionEmpty()) _d.put(EbliLib.getS("Nombre de lignes"), CtuluLibString.getString(getNombre())); - return; - } - - final int nbLigneTotal = getNombre(); - final ZCalqueLigneBrisee layer = (ZCalqueLigneBrisee) _layer; - if (layer.isAtomicMode()) { - final int nb = layer.getLayerSelectionMulti().getNbListSelected(); - - _d.put(EbliLib.getS("Nombre de lignes s\xE9lectionn\xE9es"), CtuluLibString.getString(nb) + '/' + nbLigneTotal); - if (nb == 1) { - final TIntObjectIterator it = layer.getLayerSelectionMulti().getIterator(); - it.advance(); - final int idxPoly = it.key(); - final CtuluListSelectionInterface list = (CtuluListSelectionInterface) it.value(); - _d.setTitle(EbliLib.getS("Ligne bris\xE9e {0}", CtuluLibString.getString(idxPoly + 1))); - final int nbPoint = list.getNbSelectedIndex(); - _d.put(EbliLib.getS("Nombre de sommets s\xE9lectionn\xE9s"), CtuluLibString.getString(nbPoint) + '/' - + getGeomData().getGeometry(idxPoly).getNumPoints()); - // filleWithInfo(idxPoly, _d); - if (nbPoint == 1) { - final int idxPt = list.getMaxIndex(); - _d.put(EbliLib.getS("Indice du sommet s\xE9lectionn\xE9"), CtuluLibString.getString(idxPt + 1)); - final Coordinate c = ((LineString) getGeomData().getGeometry(idxPoly)).getCoordinateSequence().getCoordinate( - idxPt); - _d.put("X:", Double.toString(c.x)); - _d.put("Y:", Double.toString(c.y)); - fillWithAtomicInfo(idxPoly, idxPoly, _d); + // Selection non vide : information relative \xE0 la selection + else { + final ZCalqueLigneBrisee layer=(ZCalqueLigneBrisee)_layer; + if (layer.isAtomicMode()) { + final int nb=layer.getLayerSelectionMulti().getNbListSelected(); + _d.put(EbliLib.getS("Nombre de lignes s\xE9lectionn\xE9es"), CtuluLibString.getString(nb)+'/'+getNombre()); + super.fillWithInfo(_d, _layer); + if (nb==1) { + final TIntObjectIterator it=layer.getLayerSelectionMulti().getIterator(); + it.advance(); + final int idxPoly=it.key(); + final CtuluListSelectionInterface list=(CtuluListSelectionInterface)it.value(); + final int nbPoint=list.getNbSelectedIndex(); + _d.put(EbliLib.getS("Nombre de sommets s\xE9lectionn\xE9s"), CtuluLibString.getString(nbPoint)+'/' + +getGeomData().getGeometry(idxPoly).getNumPoints()); + if (nbPoint==1) { + final int idxPt=list.getMaxIndex(); + _d.put(EbliLib.getS("Indice du sommet s\xE9lectionn\xE9"), CtuluLibString.getString(idxPt+1)); + final Coordinate c=((LineString)getGeomData().getGeometry(idxPoly)).getCoordinateSequence().getCoordinate(idxPt); + _d.put("X:", Double.toString(c.x)); + _d.put("Y:", Double.toString(c.y)); + fillWithAtomicInfo(idxPoly, idxPoly, _d); + } } } - } else { - final int nb = layer.getLayerSelection().getNbSelectedIndex(); - _d.put(EbliLib.getS("Nombre de lignes s\xE9lectionn\xE9es"), CtuluLibString.getString(nb) + '/' + nbLigneTotal); - if (nb == 1) { - final int idxPoly = layer.getLayerSelection().getMaxIndex(); - _d.setTitle(EbliLib.getS("Ligne bris\xE9e {0}", CtuluLibString.getString(idxPoly + 1))); - _d.put(CtuluLib.getS("Ferm\xE9"), isGeometryFermee(idxPoly) ? CtuluLib.getS("vrai") : CtuluLib.getS("faux")); - _d.put(CtuluLib.getS("Valid"), getGeomData().getGeometry(idxPoly).isValid() ? CtuluLib.getS("vrai") : CtuluLib - .getS("faux")); - fillWithInfo(idxPoly, _d); - } else if (nb > 1) { - double length = 0; - double area = 0; - final int max = layer.getLayerSelection().getMaxIndex(); - for (int i = layer.getLayerSelection().getMinIndex(); i <= max; i++) { - if (layer.getLayerSelection().isSelected(i)) { - final LineString s = (LineString) getGeomData().getGeometry(i); - length += s.getLength(); - if (s.isClosed()) { - area += s.getArea(); - } + else { + final int nb=layer.getLayerSelection().getNbSelectedIndex(); + _d.put(EbliLib.getS("Nombre de lignes s\xE9lectionn\xE9es"), CtuluLibString.getString(nb)+'/'+getNombre()); + super.fillWithInfo(_d, _layer); + if (nb==1) { + final int idxPoly=layer.getLayerSelection().getMaxIndex(); + if (_layer.isEditable()&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) + _d.put(CtuluLib.getS("Ferm\xE9"), isGeometryFermee(idxPoly) ? CtuluLib.getS("vrai"):CtuluLib.getS("faux"), + new CtuluValueEditorChoice(new String[]{CtuluLib.getS("vrai"), CtuluLib.getS("faux")}, null), null, this, + new int[]{idxPoly}); + else + _d.put(CtuluLib.getS("Ferm\xE9"), isGeometryFermee(idxPoly) ? CtuluLib.getS("vrai"):CtuluLib.getS("faux")); + _d.put(CtuluLib.getS("Valide"), getGeomData().getGeometry(idxPoly).isValid() ? CtuluLib.getS("vrai"):CtuluLib + .getS("faux")); + fillWithInfo(idxPoly, _d); + } + else if (nb>1) { + double length=0; + double area=0; + final int[] selectedIdx=layer.getLayerSelection().getSelectedIndex(); + // Propri\xE9t\xE9 ferm\xE9 + Object value; + boolean sameValues=true; + int j=0; + while (sameValues&&++j<selectedIdx.length) + sameValues=isGeometryFermee(selectedIdx[j])==isGeometryFermee(selectedIdx[j-1]); + if (sameValues) + value=isGeometryFermee(selectedIdx[0]) ? CtuluLib.getS("vrai"):CtuluLib.getS("faux"); + else + value=null; + if (_layer.isEditable()&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) + _d.put(CtuluLib.getS("Ferm\xE9"), value, new CtuluValueEditorChoice(new String[]{CtuluLib.getS("vrai"), + CtuluLib.getS("faux")}, null), null, this, selectedIdx); + else + _d.put(CtuluLib.getS("Ferm\xE9"), value!=null ? value.toString():"< "+CtuluLib.getS("Ind\xE9fini")+" >"); + // Calcul de la longueur et de l'aire + for (int i=0; i<selectedIdx.length; i++) { + final LineString s=(LineString)getGeomData().getGeometry(selectedIdx[i]); + length+=s.getLength(); + if (s.isClosed()) + area+=s.getArea(); } + _d.put(EbliLib.getS("Longueur cumul\xE9e"), Double.toString(length)); + if (area>0) + _d.put(EbliLib.getS("Surface cumul\xE9e"), Double.toString(area)); } - _d.put(EbliLib.getS("Longueur cumul\xE9e"), Double.toString(length)); - if (area > 0) { - _d.put(EbliLib.getS("Surface cumul\xE9e"), Double.toString(area)); - } } } } + /* (non-Javadoc) + * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) + */ + public void modifyProperty(String _key, Object _value, final Object _data) { + super.modifyProperty(_key, _value, _data); + if (_data!=null&&_value!=null&&_key==CtuluLib.getS("Ferm\xE9")&&_data instanceof int[]) { + // Modification de la propri\xE9t\xE9 + int[] indexPolylines=(int[])_data; + for (int i=0; i<indexPolylines.length; i++) { + int indexPolyligne=indexPolylines[i]; + // Cr\xE9ation de la nouvelle g\xE9om\xE9trie + Geometry newGeom=null; + if (_value==CtuluLib.getS("vrai")) + newGeom=GISLib.toPolygone(((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(indexPolyligne)).getCoordinateSequence()); + else if (_value==CtuluLib.getS("faux")) + newGeom=GISLib.toPolyligne(((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(indexPolyligne)).getCoordinateSequence()); + 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); + } + } + } + + public final GISZoneCollectionLigneBrisee getGeomData() { return (GISZoneCollectionLigneBrisee)geometries_; } @@ -382,21 +425,13 @@ } protected void fillWithInfo(final int _idxLigne, final InfoData _d) { - final GISZoneCollection model = getGeomData(); final LineString s = (LineString) getGeomData().getGeometry(_idxLigne); - _d.put(EbliLib.getS("Nombre de sommets"), CtuluLibString.getString(s.isClosed() ? s.getNumPoints() - 1 : s - .getNumPoints())); _d.put(CtuluLib.getS("Longueur"), Double.toString(s.getLength())); - if (s.isClosed()) { + if (s.isClosed()){ + _d.put(EbliLib.getS("Nombre de sommets"), CtuluLibString.getString(s.getNumPoints() - 1)); _d.put(CtuluLib.getS("Surface"), Double.toString(s.getArea())); } - final int nbAtt = model.getNbAttributes(); - for (int i = 0; i < nbAtt; i++) { - if (model.getAttribute(i).isUserVisible() && !model.getAttribute(i).isAtomicValue() - && model.getDataModel(i) != null && model.getDataModel(i).getObjectValueAt(_idxLigne) != null) { - _d.put(model.getAttribute(i).getName(), model.getDataModel(i).getObjectValueAt(_idxLigne).toString()); - } - } - + else + _d.put(EbliLib.getS("Nombre de sommets"), CtuluLibString.getString(s.getNumPoints())); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -245,48 +245,44 @@ } public void fillWithInfo(final InfoData _d, final ZCalqueAffichageDonneesInterface _layer) { - _d.setTitle(_layer.getTitle()); - if (_layer.isSelectionEmpty()) { + // Selection vide : information sur le calque + if (_layer.isSelectionEmpty()) _d.put(EbliLib.getS("Nombre de semis"), CtuluLibString.getString(getNombre())); - return; - } - - final int nbLigneTotal = getNombre(); - final ZCalqueMultiPointEditable layer = (ZCalqueMultiPointEditable) _layer; - if (layer.isAtomicMode()) { - final int nb = layer.getLayerSelectionMulti().getNbListSelected(); - - _d.put(EbliLib.getS("Nombre de semis s\xE9lectionn\xE9es"), CtuluLibString.getString(nb) + '/' + nbLigneTotal); - if (nb == 1) { - final TIntObjectIterator it = layer.getLayerSelectionMulti().getIterator(); - it.advance(); - final int idxPoly = it.key(); - final CtuluListSelectionInterface list = (CtuluListSelectionInterface) it.value(); - _d.setTitle(EbliLib.getS("Semis {0}", CtuluLibString.getString(idxPoly + 1))); - final int nbPoint = list.getNbSelectedIndex(); - _d.put(EbliLib.getS("Nombre de sommets s\xE9lectionn\xE9s"), CtuluLibString.getString(nbPoint) + '/' - + getGeomData().getGeometry(idxPoly).getNumPoints()); - // filleWithInfo(idxPoly, _d); - if (nbPoint == 1) { - final int idxPt = list.getMaxIndex(); - _d.put(EbliLib.getS("Indice du sommet s\xE9lectionn\xE9"), CtuluLibString.getString(idxPt + 1)); - final Coordinate c = ((GISMultiPoint) getGeomData().getGeometry(idxPoly)).getCoordinates()[idxPt]; - _d.put("X:", Double.toString(c.x)); - _d.put("Y:", Double.toString(c.y)); - fillWithAtomicInfo(idxPoly, idxPoly, _d); + // Selection non vide : information relative \xE0 la selection + else { + final ZCalqueMultiPointEditable layer=(ZCalqueMultiPointEditable)_layer; + if (layer.isAtomicMode()) { + final int nb=layer.getLayerSelectionMulti().getNbListSelected(); + _d.put(EbliLib.getS("Nombre de semis s\xE9lectionn\xE9es"), CtuluLibString.getString(nb)+'/'+getNombre()); + super.fillWithInfo(_d, _layer); + if (nb==1) { + final TIntObjectIterator it=layer.getLayerSelectionMulti().getIterator(); + it.advance(); + final int idxPoly=it.key(); + final CtuluListSelectionInterface list=(CtuluListSelectionInterface)it.value(); + final int nbPoint=list.getNbSelectedIndex(); + _d.put(EbliLib.getS("Nombre de sommets s\xE9lectionn\xE9s"), CtuluLibString.getString(nbPoint)+'/' + +getGeomData().getGeometry(idxPoly).getNumPoints()); + if (nbPoint==1) { + final int idxPt=list.getMaxIndex(); + _d.put(EbliLib.getS("Indice du sommet s\xE9lectionn\xE9"), CtuluLibString.getString(idxPt+1)); + final Coordinate c=((GISMultiPoint)getGeomData().getGeometry(idxPoly)).getCoordinates()[idxPt]; + _d.put("X:", Double.toString(c.x)); + _d.put("Y:", Double.toString(c.y)); + fillWithAtomicInfo(idxPoly, idxPoly, _d); + } } } - } - else { - final int nb = layer.getLayerSelection().getNbSelectedIndex(); - _d.put(EbliLib.getS("Nombre de semis s\xE9lectionn\xE9es"), CtuluLibString.getString(nb) + '/' + nbLigneTotal); - if (nb == 1) { - final int idxPoly = layer.getLayerSelection().getMaxIndex(); - _d.setTitle(EbliLib.getS("Semis {0}", CtuluLibString.getString(idxPoly + 1))); - _d.put(CtuluLib.getS("Valid"), getGeomData().getGeometry(idxPoly).isValid() ? CtuluLib.getS("vrai") : CtuluLib - .getS("faux")); - fillWithInfo(idxPoly, _d); - } else if (nb > 1) { + else { + final int nb=layer.getLayerSelection().getNbSelectedIndex(); + _d.put(EbliLib.getS("Nombre de semis s\xE9lectionn\xE9es"), CtuluLibString.getString(nb)+'/'+getNombre()); + super.fillWithInfo(_d, _layer); + if (nb==1) { + final int idxPoly=layer.getLayerSelection().getMaxIndex(); + _d.setTitle(EbliLib.getS("Semis {0}", CtuluLibString.getString(idxPoly+1))); + _d.put(CtuluLib.getS("Valid"), getGeomData().getGeometry(idxPoly).isValid() ? CtuluLib.getS("vrai"):CtuluLib.getS("faux")); + fillWithInfo(idxPoly, _d); + } } } } @@ -333,16 +329,8 @@ } protected void fillWithInfo(final int _idxLigne, final InfoData _d) { - final GISZoneCollection model = getGeomData(); final Geometry s = (Geometry) getGeomData().getGeometry(_idxLigne); _d.put(EbliLib.getS("Nombre de sommets"), CtuluLibString.getString(s.getNumPoints())); - final int nbAtt = model.getNbAttributes(); - for (int i = 0; i < nbAtt; i++) { - if (model.getAttribute(i).isUserVisible() && !model.getAttribute(i).isAtomicValue() - && model.getDataModel(i) != null && model.getDataModel(i).getObjectValueAt(_idxLigne) != null) { - _d.put(model.getAttribute(i).getName(), model.getDataModel(i).getObjectValueAt(_idxLigne).toString()); - } - } } /** 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-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -26,6 +26,7 @@ import javax.swing.table.TableCellRenderer; import org.fudaa.ctulu.gui.CtuluTableCellEditorProxy; +import org.fudaa.ctulu.gui.CtuluValueEditorI; import org.fudaa.ebli.commun.EbliLib; import com.memoire.bu.BuBorderLayout; @@ -57,17 +58,28 @@ /** * Permet d'ajouter une information \xE9ditable au tableau. * @param _key le nom de la propri\xE9t\xE9, doit \xEAtre non vide - * @param _value la valeur de la propri\xE9t\xE9, doit \xEAtre non null + * @param _value la valeur de la propri\xE9t\xE9, peut \xEAtre null * @param _editor l'\xE9diteur, si null l'\xE9diteur par defaut sera utilis\xE9 * @param _renderer le renderer, si null le renderer par defaut sera utilis\xE9 * @param _owner l'object qui sera appel\xE9 (via modifyProperty) pour que * la modification soit prise en compte. Si null l'attribut est * consid\xE9r\xE9 comme non modifiable. + * @param _data autorise \xE0 passer une information (ou un tableau d'informations) + * qui sera redonn\xE9 \xE0 modifyProperty. */ - void put(String _key, Object _value, TableCellEditor _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner); + void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, Object _data); void setTitle(String _title); + /** + * Indique si le tableau contient des valeurs agr\xE9g\xE9es (donc + * venant de plusieurs g\xE9om\xE9tries) ou des valeurs unique (venant + * d'une seul g\xE9om\xE9trie). Selon le cas createCommonEditorComponent + * ou createEditorComponent sera appell\xE9. + * @param _value + */ + public void setOnlyOneGeometry(boolean _value); + boolean isTitleSet(); } @@ -84,8 +96,9 @@ * fournie \xE0 InfoData. * @param _key le nom de la propri\xE9t\xE9 * @param _newValue la nouvelle valeur de la prorpi\xE9t\xE9 + * @param _data l'information pass\xE9 en param\xE8tre du put */ - void modifyProperty(String _key, Object _newValue); + void modifyProperty(String _key, Object _newValue, Object _data); } /** @@ -96,12 +109,14 @@ /** * Chaque ligne est organis\xE9 suivant ce model : nom (string), valeur - * (object), editeor (TableCellEditor), renderer (TableCellRenderer), owner - * (ModifyPropertyInfo). + * (object), editor (TableCellEditor), renderer (TableCellRenderer), owner + * (ModifyPropertyInfo), data (Object). */ private ArrayList<ArrayList<Object>> rows_; /** L'editor du tableau. */ private CtuluTableCellEditorProxy editor_; + /** vrai si le model ne d\xE9crit qu'une seul g\xE9om\xE9trie en ce moment. */ + private boolean onlyOneGeometry_; private class PanelTableRenderer extends DefaultTableCellRenderer { /* (non-Javadoc) @@ -111,8 +126,15 @@ int _column) { if(rows_.get(_row).get(3)!=null) return ((TableCellRenderer) rows_.get(_row).get(3)).getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); - else - return super.getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); + else{ + Component comp=super.getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); + // Si la ligne n'est pas \xE9ditable, elle est gris\xE9e. + if(rows_.get(_row).get(4)==null) + comp.setEnabled(false); + else + comp.setEnabled(true); + return comp; + } } } @@ -123,13 +145,16 @@ public TableCellEditor getEditor(){ if (editor_==null) { HashMap<Integer, TableCellEditor> editors=new HashMap<Integer, TableCellEditor>(); - // R\xE9cup\xE9ration des \xE9ditors + // R\xE9cup\xE9ration des \xE9diteurs for (int i=0; i<rows_.size(); i++) // Si owner est renseign\xE9 if (rows_.get(i).get(4)!=null) { // Si l'editor est renseign\xE9 if (rows_.get(i).get(3)!=null) - editors.put(i, (TableCellEditor)rows_.get(i).get(3)); + if(onlyOneGeometry_) + editors.put(i, ((CtuluValueEditorI)rows_.get(i).get(2)).createTableEditorComponent()); + else + editors.put(i, ((CtuluValueEditorI)rows_.get(i).get(2)).createCommonTableEditorComponent()); } else editors.put(i, null); @@ -150,11 +175,34 @@ else return false; } - + public PanelTableModel() { rows_=new ArrayList<ArrayList<Object>>(); + onlyOneGeometry_=false; } - + + public void setOnlyOneGeometry(boolean _value){ + if(onlyOneGeometry_!=_value){ + onlyOneGeometry_=_value; + editor_.clear(); + // R\xE9g\xE9n\xE9ration de l'editeur + for (int i=0; i<rows_.size(); i++) + // Si owner est renseign\xE9 + if (rows_.get(i).get(4)!=null) { + // Si l'editor est renseign\xE9 + if (rows_.get(i).get(3)!=null) + if(onlyOneGeometry_) + editor_.putEditor(i, ((CtuluValueEditorI)rows_.get(i).get(2)).createTableEditorComponent()); + else + editor_.putEditor(i, ((CtuluValueEditorI)rows_.get(i).get(2)).createCommonTableEditorComponent()); + } + else + editor_.putEditor(i, null); + // Ajout du choix par defaut + editor_.putEditor(-1, new DefaultCellEditor(new BuTextField())); + } + } + public void clear() { rows_.clear(); } @@ -188,6 +236,7 @@ row.add(2, null); row.add(3, null); row.add(4, null); + row.add(5, null); rows_.add(row); editor_.putEditor(rows_.size()-1, null); } @@ -200,8 +249,8 @@ * javax.swing.table.TableCellRenderer, * org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo) */ - public void put(String _key, Object _value, TableCellEditor _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner) { - if (_key==null||_value==null) + public void put(String _key, Object _value, CtuluValueEditorI _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner, Object _data) { + if (_key==null) throw new IllegalArgumentException("_key et _value doivent \xEAtre non null."); ArrayList<Object> row=new ArrayList<Object>(); row.add(0, _key); @@ -209,8 +258,12 @@ row.add(2, _editor); row.add(3, _renderer); row.add(4, _owner); + row.add(5, _data); rows_.add(row); - editor_.putEditor(rows_.size()-1, _editor); + if(onlyOneGeometry_) + editor_.putEditor(rows_.size()-1, _editor.createTableEditorComponent()); + else + editor_.putEditor(rows_.size()-1, _editor.createCommonTableEditorComponent()); } public void setTitle(final String _title) { @@ -225,7 +278,9 @@ return; if (rows_.get(_rowIndex).get(_columnIndex)!=_value&&rows_.get(_rowIndex).get(4)!=null) { rows_.get(_rowIndex).set(_columnIndex, _value); - ((ModifyPropertyInfo)rows_.get(_rowIndex).get(4)).modifyProperty((String)rows_.get(_rowIndex).get(0), _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, rows_.get(_rowIndex).get(5)); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfoAbstractAction.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -24,9 +24,9 @@ public abstract class BPaletteInfoAbstractAction extends EbliActionPaletteAbstract { public BPaletteInfoAbstractAction() { - super(EbliLib.getS("Information"), EbliResource.EBLI.getIcon("info"), "INFOS"); + super(EbliLib.getS("Propri\xE9t\xE9s"), EbliResource.EBLI.getIcon("info"), "INFOS"); setPaletteResizable(true); - putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Informations sur les objets s\xE9lectionn\xE9s")); + putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Propri\xE9t\xE9s des les objets s\xE9lectionn\xE9s")); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('i')); putValue(EbliActionInterface.SECOND_KEYSTROKE, KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0)); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacFrontierNumberIteratorAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacFrontierNumberIteratorAbstract.java 2008-10-22 17:30:54 UTC (rev 4089) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacFrontierNumberIteratorAbstract.java 2008-10-23 09:39:33 UTC (rev 4090) @@ -108,6 +108,10 @@ public final TableCellEditor createTableEditorComponent() { return null; } + + public final TableCellEditor createCommonTableEditorComponent() { + return null; + } public final String currentLabel() { super.currentLabel(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-22 17:31:00
|
Revision: 4089 http://fudaa.svn.sourceforge.net/fudaa/?rev=4089&view=rev Author: hadouxad Date: 2008-10-22 17:30:54 +0000 (Wed, 22 Oct 2008) Log Message: ----------- - modifier la pr?\195?\169sentation des donn?\195?\169es - virer fichier setup - transformer fichier source.post en setup.post - ajouter path relatif et absolu au fichiers r?\195?\169sultats et tester les 2 possibilit?\195?\169s - ajouter des commentaires dans les fichiers qui seront explicatifs balise README (j'ai pas trouv?\195?\169 le moyen de faire des <!-- -->) - tests avec les @XStreamAlias("type") pour que les balises soient plus parlantes .... (pour que ce soit + propre encore Il faudrait ?\195?\169crire ses propres converter ) - int?\195?\169grer le viewer pdf Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer_src.zip branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java branches/Prepro-0.92-SNAPSHOT/ctulu/test/org/fudaa/ctulu/TestCtuluPdf.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/LayoutDescriptor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/XmlCommentaire.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/XstreamListLayoutDescriptor.java Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer.jar =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer_src.zip =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/PDFRenderer_src.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt 2008-10-21 15:38:05 UTC (rev 4088) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt 2008-10-22 17:30:54 UTC (rev 4089) @@ -267,4 +267,7 @@ Constantes=Constants Ajouter un nouvel \xE9l\xE9ment=Add an new item Ins\xE9rer un nouveau \xE9l\xE9ment=Insert a new item -Supprimer les \xE9l\xE9ments s\xE9lectionn\xE9s=Delete selected items \ No newline at end of file +Supprimer les \xE9l\xE9ments s\xE9lectionn\xE9s=Delete selected items +Erreur fichier inexistant= Error file is missing +Erreur lors de la lecture du fichier= Error while reading the file +Chapitres=Chapters \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -0,0 +1,127 @@ +package org.fudaa.ctulu.pdf; + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JScrollPane; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluUI; + +import com.memoire.bu.BuPanel; +import com.sun.pdfview.PDFFile; + +/** + * Fenetre viewer pdf custom + * @author Adrien Hadoux + * + */ +public class CtuluFramePdfCustomViewer extends JFrame{ + + CtuluPanelPdfViewer pdfViewer; + CtuluUI ui_; + BuPanel outlinePanel; + BuPanel thumbscrollContainer; + public CtuluFramePdfCustomViewer(String title,boolean useThumbs,CtuluUI ui){ + this(title,useThumbs,null,ui); + + } + + public CtuluFramePdfCustomViewer(String title,boolean useThumbs, File pdfFile,CtuluUI ui){ + super(title) ; + ui_=ui; + init(useThumbs,pdfFile); + + } + + + /** + * initialisation du lecteur de pdf. + * @param useThumbs + * @param initFile + */ + private void init(boolean useThumbs,File initFile){ + this.setLayout(new BorderLayout()); + outlinePanel=new BuPanel(); + outlinePanel.setBorder(BorderFactory.createTitledBorder("Pages")); + thumbscrollContainer=new BuPanel(); + thumbscrollContainer.setBorder(BorderFactory.createTitledBorder(CtuluResource.CTULU.getString("Chapitres"))); + + pdfViewer=new CtuluPanelPdfViewer(useThumbs,ui_,outlinePanel,thumbscrollContainer); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent evt) { + pdfViewer.doQuit(); + } + }); + + //-- menus --// + JMenuBar mb = new JMenuBar(); + JMenu file = new JMenu("File"); + file.add(pdfViewer.openAction); + file.add(pdfViewer.closeAction); + file.addSeparator(); + file.add(pdfViewer.pageSetupAction); + file.add(pdfViewer.printAction); + file.addSeparator(); + file.add(pdfViewer.quitAction); + mb.add(file); + JMenu view = new JMenu("View"); + JMenu zoom = new JMenu("Zoom"); + zoom.add(pdfViewer.zoomInAction); + zoom.add(pdfViewer.zoomOutAction); + zoom.add(pdfViewer.fitInWindowAction); + zoom.setEnabled(false); + view.add(zoom); + view.add(pdfViewer.fullScreenAction); + + if (pdfViewer.doThumb) { + view.addSeparator(); + view.add(pdfViewer.thumbAction); + } + + mb.add(view); + setJMenuBar(mb); + + + + + this.add(pdfViewer,BorderLayout.CENTER); + + this.add(outlinePanel,BorderLayout.EAST); + this.add(thumbscrollContainer,BorderLayout.WEST); + + + setSize(650,650); + outlinePanel.setSize(100,650); + thumbscrollContainer.setSize(100,650); + if(initFile!=null){ + //-- tentative de transformation en pdf --// + try { + pdfViewer.openFile(initFile); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + ui_.error(CtuluResource.CTULU.getString("Erreur fichier inexistant")); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + ui_.error(CtuluResource.CTULU.getString("Erreur lors de la lecture du fichier")); + } + } + + } +} Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -0,0 +1,1054 @@ +package org.fudaa.ctulu.pdf; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.geom.Rectangle2D; +import java.awt.print.Book; +import java.awt.print.PageFormat; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.awt.Toolkit; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.net.Socket; +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.util.Date; +import java.util.HashMap; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.JTextField; +import javax.swing.JToggleButton; +import javax.swing.JToolBar; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.filechooser.FileFilter; +import javax.swing.SwingUtilities; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluUI; + +import com.memoire.bu.BuPanel; +import com.sun.pdfview.Flag; +import com.sun.pdfview.FullScreenWindow; +import com.sun.pdfview.OutlineNode; +import com.sun.pdfview.PDFDestination; +import com.sun.pdfview.PDFFile; +import com.sun.pdfview.PDFObject; +import com.sun.pdfview.PDFPage; +import com.sun.pdfview.PDFPrintPage; +import com.sun.pdfview.PDFViewer; +import com.sun.pdfview.PageChangeListener; +import com.sun.pdfview.PagePanel; +import com.sun.pdfview.ThumbPanel; +import com.sun.pdfview.action.GoToAction; +import com.sun.pdfview.action.PDFAction; +import java.lang.reflect.InvocationTargetException; +/** + * Classe qui g\xE9n\xE8re un panel disposant de toutes les fonctionnalit\xE9 du lecteur pdf. + * Ce panel s'autosuffie pour la gestion des pdfs + * + * Il a \xE9t\xE9 modifi\xE9 pour int\xE9grer le panel d'outline sur le cot\xE9 droit et les d\xE9filement d images sur le cot\xE9 gauche. + * + * Gestion et visualisation des chapitres. + * @author Adrien Hadoux + * + */ +public class CtuluPanelPdfViewer extends BuPanel implements KeyListener, TreeSelectionListener, PageChangeListener{ + + + + + public final static String TITLE = " PDF Viewer"; + CtuluUI ui_; + /** The current PDFFile */ + PDFFile curFile; + /** the name of the current document */ + String docName; + /** The split between thumbs and page */ + //JSplitPane split; + /**Panel outline **/ + BuPanel outlinePanel; + /** container du thumbdefiler **/ + BuPanel thumbscrollContainer; + /** The thumbnail scroll pane */ + JScrollPane thumbscroll; + /** The thumbnail display */ + ThumbPanel thumbs; + /** The page display */ + PagePanel page; + /** The full screen page display, or null if not in full screen mode */ + PagePanel fspp; + + // Thread anim; + /** The current page number (starts at 0), or -1 if no page */ + int curpage = -1; + /** the full screen button */ + JToggleButton fullScreenButton; + /** the current page number text field */ + JTextField pageField; + /** the full screen window, or null if not in full screen mode */ + FullScreenWindow fullScreen; + /** the root of the outline, or null if there is no outline */ + OutlineNode outline = null; + /** The page format for printing */ + PageFormat pformat = PrinterJob.getPrinterJob().defaultPage(); + /** true if the thumb panel should exist at all */ + boolean doThumb = true; + /** flag to indicate when a newly added document has been announced */ + Flag docWaiter; + /** a thread that pre-loads the next page for faster response */ + PagePreparer pagePrep; + /** the window containing the pdf outline, or null if one doesn't exist */ + JDialog olf; + /** the document menu */ + JMenu docMenu; + + /** + * utility method to get an icon from the resources of this class + * @param name the name of the icon + * @return the icon, or null if the icon wasn't found. + */ + + + + public Icon getIcon(String name) { + Icon icon = null; + URL url = null; + try { + url = PDFViewer.class.getResource(name); + + icon = new ImageIcon(url); + if (icon == null) { + System.out.println("Couldn't find " + url); + } + } catch (Exception e) { + System.out.println("Couldn't find " + getClass().getName() + "/" + name); + e.printStackTrace(); + } + return icon; + } + + /// FILE MENU + Action openAction = new AbstractAction("Open...") { + + public void actionPerformed(ActionEvent evt) { + doOpen(); + } + }; + Action pageSetupAction = new AbstractAction("Page setup...") { + + public void actionPerformed(ActionEvent evt) { + doPageSetup(); + } + }; + Action printAction = new AbstractAction("Print...", getIcon("gfx/print.gif")) { + + public void actionPerformed(ActionEvent evt) { + doPrint(); + } + }; + Action closeAction = new AbstractAction("Close") { + + public void actionPerformed(ActionEvent evt) { + doClose(); + } + }; + Action quitAction = new AbstractAction("Quit") { + + public void actionPerformed(ActionEvent evt) { + doQuit(); + } + }; + + class ZoomAction extends AbstractAction { + + double zoomfactor = 1.0; + + public ZoomAction(String name, double factor) { + super(name); + zoomfactor = factor; + } + + public ZoomAction(String name, Icon icon, double factor) { + super(name, icon); + zoomfactor = factor; + } + + public void actionPerformed(ActionEvent evt) { + doZoom(zoomfactor); + } + } + ZoomAction zoomInAction = new ZoomAction("Zoom in", + getIcon("gfx/zoomin.gif"), + 2.0); + ZoomAction zoomOutAction = new ZoomAction("Zoom out", + getIcon("gfx/zoomout.gif"), + 0.5); + Action zoomToolAction = new AbstractAction("", getIcon("gfx/zoom.gif")) { + + public void actionPerformed(ActionEvent evt) { + doZoomTool(); + } + }; + Action fitInWindowAction = new AbstractAction("Fit in window", + getIcon("gfx/fit.gif")) { + + public void actionPerformed(ActionEvent evt) { + doFitInWindow(); + } + }; + + class ThumbAction extends AbstractAction + implements PropertyChangeListener { + + boolean isOpen = true; + + public ThumbAction() { + super("Hide thumbnails"); + } + + public void propertyChange(PropertyChangeEvent evt) { + int v = ((Integer) evt.getNewValue()).intValue(); + if (v <= 1) { + isOpen = false; + putValue(ACTION_COMMAND_KEY, "Show thumbnails"); + putValue(NAME, "Show thumbnails"); + } else { + isOpen = true; + putValue(ACTION_COMMAND_KEY, "Hide thumbnails"); + putValue(NAME, "Hide thumbnails"); + } + } + + public void actionPerformed(ActionEvent evt) { + doThumbs(!isOpen); + } + } + ThumbAction thumbAction = new ThumbAction(); + Action fullScreenAction = new AbstractAction("Full screen", + getIcon("gfx/fullscrn.gif")) { + + public void actionPerformed(ActionEvent evt) { + doFullScreen((evt.getModifiers() & evt.SHIFT_MASK) != 0); + } + }; + Action nextAction = new AbstractAction("Next", getIcon("gfx/next.gif")) { + + public void actionPerformed(ActionEvent evt) { + doNext(); + } + }; + Action firstAction = new AbstractAction("First", getIcon("gfx/first.gif")) { + + public void actionPerformed(ActionEvent evt) { + doFirst(); + } + }; + Action lastAction = new AbstractAction("Last", getIcon("gfx/last.gif")) { + + public void actionPerformed(ActionEvent evt) { + doLast(); + } + }; + Action prevAction = new AbstractAction("Prev", getIcon("gfx/prev.gif")) { + + public void actionPerformed(ActionEvent evt) { + doPrev(); + } + }; + + /** + * Create a new PDFViewer based on a user, with or without a thumbnail + * panel. + * @param useThumbs true if the thumb panel should exist, false if not. + */ + public CtuluPanelPdfViewer(boolean useThumbs,CtuluUI ui,BuPanel outlinePanel,BuPanel thumbscrollContainer) { + ui_=ui; + doThumb = useThumbs; + this.outlinePanel=outlinePanel; + this.thumbscrollContainer=thumbscrollContainer; + init(); + } + + /** + * Initialize this PDFViewer by creating the GUI. + */ + protected void init() { + setSize(600,600); + page = new PagePanel(); + page.addKeyListener(this); + + if (doThumb) { + //split = new JSplitPane(split.HORIZONTAL_SPLIT); + // split.addPropertyChangeListener(split.DIVIDER_LOCATION_PROPERTY, + // thumbAction); + // split.setOneTouchExpandable(true); + thumbs = new ThumbPanel(null); + thumbscroll = new JScrollPane(thumbs, + thumbscroll.VERTICAL_SCROLLBAR_ALWAYS, + thumbscroll.HORIZONTAL_SCROLLBAR_NEVER); + // split.setLeftComponent(thumbscroll); + //split.setRightComponent(page); + thumbscrollContainer.add(thumbscroll, BorderLayout.CENTER); + } + //else { + add(page, BorderLayout.CENTER); + //} + + //-- ajout du panel outline --// + //outlinePanel=new BuPanel(); + //this.add(outlinePanel,BorderLayout.EAST); + //outlinePanel.setBorder(BorderFactory.createTitledBorder("Outline")); + JToolBar toolbar = new JToolBar(); + toolbar.setFloatable(false); + + JButton jb; + + jb = new JButton(firstAction); + jb.setText(""); + toolbar.add(jb); + jb = new JButton(prevAction); + jb.setText(""); + toolbar.add(jb); + pageField = new JTextField("-", 3); + // pageField.setEnabled(false); + pageField.setMaximumSize(new Dimension(45, 32)); + pageField.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + doPageTyped(); + } + }); + toolbar.add(pageField); + jb = new JButton(nextAction); + jb.setText(""); + toolbar.add(jb); + jb = new JButton(lastAction); + jb.setText(""); + toolbar.add(jb); + + toolbar.add(Box.createHorizontalGlue()); + + fullScreenButton = new JToggleButton(fullScreenAction); + fullScreenButton.setText(""); + toolbar.add(fullScreenButton); + fullScreenButton.setEnabled(true); + + toolbar.add(Box.createHorizontalGlue()); + + JToggleButton jtb; + ButtonGroup bg = new ButtonGroup(); + + jtb = new JToggleButton(zoomToolAction); + jtb.setText(""); + bg.add(jtb); + toolbar.add(jtb); + jtb = new JToggleButton(fitInWindowAction); + jtb.setText(""); + bg.add(jtb); + jtb.setSelected(true); + toolbar.add(jtb); + + toolbar.add(Box.createHorizontalGlue()); + + jb = new JButton(printAction); + jb.setText(""); + toolbar.add(jb); + + add(toolbar, BorderLayout.NORTH); + + setEnabling(); + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + int x = (screen.width - getWidth()) / 2; + int y = (screen.height - getHeight()) / 2; + setLocation(x, y); + if (SwingUtilities.isEventDispatchThread()) { + show(); + } else { + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + show(); + } + }); + } catch (InvocationTargetException ie) { + // ignore + } catch (InterruptedException ie) { + // ignore + } + } + } + + /** + * Changes the displayed page, desyncing if we're not on the + * same page as a presenter. + * @param pagenum the page to display + */ + public void gotoPage(int pagenum) { + if (pagenum < 0) { + pagenum = 0; + } else if (pagenum >= curFile.getNumPages()) { + pagenum = curFile.getNumPages() - 1; + } + forceGotoPage(pagenum); + } + + /** + * Changes the displayed page. + * @param pagenum the page to display + */ + public void forceGotoPage(int pagenum) { + if (pagenum <= 0) { + pagenum = 0; + } else if (pagenum >= curFile.getNumPages()) { + pagenum = curFile.getNumPages() - 1; + } +// System.out.println("Going to page " + pagenum); + curpage = pagenum; + + // update the page text field + pageField.setText(String.valueOf(curpage + 1)); + + // fetch the page and show it in the appropriate place + PDFPage pg = curFile.getPage(pagenum + 1); + if (fspp != null) { + fspp.showPage(pg); + fspp.requestFocus(); + } else { + page.showPage(pg); + page.requestFocus(); + } + + // update the thumb panel + if (doThumb) { + thumbs.pageShown(pagenum); + } + + // stop any previous page prepper, and start a new one + if (pagePrep != null) { + pagePrep.quit(); + } + pagePrep = new PagePreparer(pagenum); + pagePrep.start(); + + setEnabling(); + } + + /** + * A class to pre-cache the next page for better UI response + */ + class PagePreparer extends Thread { + + int waitforPage; + int prepPage; + + /** + * Creates a new PagePreparer to prepare the page after the current + * one. + * @param waitforPage the current page number, 0 based + */ + public PagePreparer(int waitforPage) { + setDaemon(true); + + this.waitforPage = waitforPage; + this.prepPage = waitforPage + 1; + } + + public void quit() { + waitforPage = -1; + } + + public void run() { + Dimension size = null; + Rectangle2D clip = null; + + // wait for the current page + // System.out.println("Preparer waiting for page " + (waitforPage + 1)); + if (fspp != null) { + fspp.waitForCurrentPage(); + size = fspp.getCurSize(); + clip = fspp.getCurClip(); + } else if (page != null) { + page.waitForCurrentPage(); + size = page.getCurSize(); + clip = page.getCurClip(); + } + + if (waitforPage == curpage) { + // don't go any further if the user changed pages. + // System.out.println("Preparer generating page " + (prepPage + 2)); + PDFPage pdfPage = curFile.getPage(prepPage + 1, true); + if (pdfPage != null && waitforPage == curpage) { + // don't go any further if the user changed pages + // System.out.println("Generating image for page " + (prepPage + 2)); + + pdfPage.getImage(size.width, size.height, clip, null, true, true); + // System.out.println("Generated image for page "+ (prepPage+2)); + } + } + } + } + + /** + * Enable or disable all of the actions based on the current state. + */ + public void setEnabling() { + boolean fileavailable = curFile != null; + boolean pageshown = ((fspp != null) ? fspp.getPage() != null : page.getPage() != null); + boolean printable = fileavailable && curFile.isPrintable(); + + pageField.setEnabled(fileavailable); + printAction.setEnabled(printable); + closeAction.setEnabled(fileavailable); + fullScreenAction.setEnabled(pageshown); + prevAction.setEnabled(pageshown); + nextAction.setEnabled(pageshown); + firstAction.setEnabled(fileavailable); + lastAction.setEnabled(fileavailable); + zoomToolAction.setEnabled(pageshown); + fitInWindowAction.setEnabled(pageshown); + zoomInAction.setEnabled(pageshown); + zoomOutAction.setEnabled(pageshown); + } + + /** + * Open a specific pdf file. Creates a DocumentInfo from the file, + * and opens that. + * @param file the file to open + */ + public void openFile(File file) throws IOException { + // first open the file for random access + RandomAccessFile raf = new RandomAccessFile(file, "r"); + + // extract a file channel + FileChannel channel = raf.getChannel(); + + // now memory-map a byte-buffer + ByteBuffer buf = + channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); + + // create a PDFFile from the data + PDFFile newfile = null; + try { + newfile = new PDFFile(buf); + } catch (IOException ioe) { + openError(file.getPath() + " doesn't appear to be a PDF file."); + return; + } + + // Now that we're reasonably sure this document is real, close the + // old one. + doClose(); + + // set up our document + this.curFile = newfile; + docName = file.getName(); + + + // set up the thumbnails + if (doThumb) { + thumbs = new ThumbPanel(curFile); + thumbs.addPageChangeListener(this); + thumbscroll.getViewport().setView(thumbs); + thumbscroll.getViewport().setBackground(Color.gray); + } + + setEnabling(); + + // display page 1. + forceGotoPage(0); + + // if the PDF has an outline, display it. + try { + outline = curFile.getOutline(); + } catch (IOException ioe) { + } + if (outline != null) { + if (outline.getChildCount() > 0) { +// olf = new JDialog();// "Outline" +// olf.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); +// olf.setLocation(this.getLocation()); + JTree jt = new JTree(outline); + jt.setRootVisible(false); + jt.addTreeSelectionListener(this); + JScrollPane jsp = new JScrollPane(jt); + + //-- ajout dans le outline panel --// + outlinePanel.add(jsp); + this.revalidate(); + + +// olf.getContentPane().add(jsp); +// olf.pack(); +// olf.setVisible(true); + } else { + if (olf != null) { + olf.setVisible(false); + olf = null; + } + } + } + } + + /** + * Display a dialog indicating an error. + */ + public void openError(String message) { + JOptionPane.showMessageDialog(/*split*/this, message, "Error opening file", + JOptionPane.ERROR_MESSAGE); + } + + /** + * A file filter for PDF files. + */ + FileFilter pdfFilter = new FileFilter() { + + public boolean accept(File f) { + return f.isDirectory() || f.getName().endsWith(".pdf"); + } + + public String getDescription() { + return "Choose a PDF file"; + } + }; + private File prevDirChoice; + + /** + * Ask the user for a PDF file to open from the local file system + */ + public void doOpen() { + try { + JFileChooser fc = new JFileChooser(); + fc.setCurrentDirectory(prevDirChoice); + fc.setFileFilter(pdfFilter); + fc.setMultiSelectionEnabled(false); + int returnVal = fc.showOpenDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + try { + prevDirChoice = fc.getSelectedFile(); + openFile(fc.getSelectedFile()); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + } catch (Exception e) { + JOptionPane.showMessageDialog(/*split*/this, + "Opening files from your local " + + "disk is not available\nfrom the " + + "Java Web Start version of this " + + "program.\n", + "Error opening directory", + JOptionPane.ERROR_MESSAGE); + e.printStackTrace(); + } + } + + /** + * Open a local file, given a string filename + * @param name the name of the file to open + */ + public void doOpen(String name) { + try { + openFile(new File(name)); + } catch (IOException ioe) { + } + } + + /** + * Posts the Page Setup dialog + */ + public void doPageSetup() { + PrinterJob pjob = PrinterJob.getPrinterJob(); + pformat = pjob.pageDialog(pformat); + } + + /** + * A thread for printing in. + */ + class PrintThread extends Thread { + + PDFPrintPage ptPages; + PrinterJob ptPjob; + + public PrintThread(PDFPrintPage pages, PrinterJob pjob) { + ptPages = pages; + ptPjob = pjob; + } + + public void run() { + try { + ptPages.show(ptPjob); + ptPjob.print(); + } catch (PrinterException pe) { + JOptionPane.showMessageDialog(CtuluPanelPdfViewer.this, + "Printing Error: " + pe.getMessage(), + "Print Aborted", + JOptionPane.ERROR_MESSAGE); + } + ptPages.hide(); + } + } + + /** + * Print the current document. + */ + public void doPrint() { + PrinterJob pjob = PrinterJob.getPrinterJob(); + pjob.setJobName(docName); + Book book = new Book(); + PDFPrintPage pages = new PDFPrintPage(curFile); + book.append(pages, pformat, curFile.getNumPages()); + + pjob.setPageable(book); + if (pjob.printDialog()) { + new PrintThread(pages, pjob).start(); + } + } + + /** + * Close the current document. + */ + public void doClose() { + if (thumbs != null) { + thumbs.stop(); + } + if (olf != null) { + olf.setVisible(false); + olf = null; + } + if (doThumb) { + thumbs = new ThumbPanel(null); + thumbscroll.getViewport().setView(thumbs); + } + + setFullScreenMode(false, false); + page.showPage(null); + curFile = null; + + setEnabling(); + } + + /** + * Shuts down all known threads. This ought to cause the JVM to quit + * if the PDFViewer is the only application running. + */ + public void doQuit() { + // if (thumbs != null) { + // thumbs.stop(); + // } + doClose(); + + } + + /** + * Turns on zooming + */ + public void doZoomTool() { + if (fspp == null) { + page.useZoomTool(true); + } + } + + /** + * Turns off zooming; makes the page fit in the window + */ + public void doFitInWindow() { + if (fspp == null) { + page.useZoomTool(false); + page.setClip(null); + } + } + + /** + * Shows or hides the thumbnails by moving the split pane divider + */ + public void doThumbs(boolean show) { + if (show) { + /*split.setDividerLocation((int) thumbs.getPreferredSize().width + + (int) thumbscroll.getVerticalScrollBar(). + getWidth() + 4);*/ + thumbscrollContainer.removeAll(); + this.revalidate(); + } else { + //split.setDividerLocation(0); + thumbscrollContainer.add(thumbscroll); + this.revalidate(); + } + } + + /** + * Enter full screen mode + * @param force true if the user should be prompted for a screen to + * use in a multiple-monitor setup. If false, the user will only be + * prompted once. + */ + public void doFullScreen(boolean force) { + setFullScreenMode(fullScreen == null, force); + } + + public void doZoom(double factor) { + } + // public void doOpenMeetingDoc(DocumentInfo doc) { + // } + + /** + * Goes to the next page + */ + public void doNext() { + gotoPage(curpage + 1); + } + + /** + * Goes to the previous page + */ + public void doPrev() { + gotoPage(curpage - 1); + } + + /** + * Goes to the first page + */ + public void doFirst() { + gotoPage(0); + } + + /** + * Goes to the last page + */ + public void doLast() { + gotoPage(curFile.getNumPages() - 1); + } + + /** + * Goes to the page that was typed in the page number text field + */ + public void doPageTyped() { + int pagenum = -1; + try { + pagenum = Integer.parseInt(pageField.getText()) - 1; + } catch (NumberFormatException nfe) { + } + if (pagenum >= curFile.getNumPages()) { + pagenum = curFile.getNumPages() - 1; + } + if (pagenum >= 0) { + if (pagenum != curpage) { + gotoPage(pagenum); + } + } else { + pageField.setText(String.valueOf(curpage)); + } + } + + /** + * Runs the FullScreenMode change in another thread + */ + class PerformFullScreenMode implements Runnable { + + boolean force; + + public PerformFullScreenMode(boolean forcechoice) { + force = forcechoice; + } + + public void run() { + fspp = new PagePanel(); + fspp.setBackground(Color.black); + page.showPage(null); + fullScreen = new FullScreenWindow(fspp, force); + fspp.addKeyListener(CtuluPanelPdfViewer.this); + gotoPage(curpage); + fullScreenAction.setEnabled(true); + } + } + + /** + * Starts or ends full screen mode. + * @param full true to enter full screen mode, false to leave + * @param force true if the user should be prompted for a screen + * to use the second time full screen mode is entered. + */ + public void setFullScreenMode(boolean full, boolean force) { + // curpage= -1; + if (full && fullScreen == null) { + fullScreenAction.setEnabled(false); + new Thread(new PerformFullScreenMode(force)).start(); + fullScreenButton.setSelected(true); + } else if (!full && fullScreen != null) { + fullScreen.close(); + fspp = null; + fullScreen = null; + gotoPage(curpage); + fullScreenButton.setSelected(false); + } + } + + + + /** + * Handle a key press for navigation + */ + public void keyPressed(KeyEvent evt) { + int code = evt.getKeyCode(); + if (code == evt.VK_LEFT) { + doPrev(); + } else if (code == evt.VK_RIGHT) { + doNext(); + } else if (code == evt.VK_UP) { + doPrev(); + } else if (code == evt.VK_DOWN) { + doNext(); + } else if (code == evt.VK_HOME) { + doFirst(); + } else if (code == evt.VK_END) { + doLast(); + } else if (code == evt.VK_PAGE_UP) { + doPrev(); + } else if (code == evt.VK_PAGE_DOWN) { + doNext(); + } else if (code == evt.VK_SPACE) { + doNext(); + } else if (code == evt.VK_ESCAPE) { + setFullScreenMode(false, false); + } + } + + /** + * Combines numeric key presses to build a multi-digit page number. + */ + class PageBuilder implements Runnable { + + int value = 0; + long timeout; + Thread anim; + static final long TIMEOUT = 500; + + /** add the digit to the page number and start the timeout thread */ + public synchronized void keyTyped(int keyval) { + value = value * 10 + keyval; + timeout = System.currentTimeMillis() + TIMEOUT; + if (anim == null) { + anim = new Thread(this); + anim.start(); + } + } + + /** + * waits for the timeout, and if time expires, go to the specified + * page number + */ + public void run() { + long now, then; + synchronized (this) { + now = System.currentTimeMillis(); + then = timeout; + } + while (now < then) { + try { + Thread.sleep(timeout - now); + } catch (InterruptedException ie) { + } + synchronized (this) { + now = System.currentTimeMillis(); + then = timeout; + } + } + synchronized (this) { + gotoPage(value - 1); + anim = null; + value = 0; + } + } + } + PageBuilder pb = new PageBuilder(); + + public void keyReleased(KeyEvent evt) { + } + + /** + * gets key presses and tries to build a page if they're numeric + */ + public void keyTyped(KeyEvent evt) { + char key = evt.getKeyChar(); + if (key >= '0' && key <= '9') { + int val = key - '0'; + pb.keyTyped(val); + } + } + + /** + * Someone changed the selection of the outline tree. Go to the new + * page. + */ + public void valueChanged(TreeSelectionEvent e) { + if (e.isAddedPath()) { + OutlineNode node = (OutlineNode) e.getPath().getLastPathComponent(); + if (node == null) { + return; + } + + try { + PDFAction action = node.getAction(); + if (action == null) { + return; + } + + if (action instanceof GoToAction) { + PDFDestination dest = ((GoToAction) action).getDestination(); + if (dest == null) { + return; + } + + PDFObject page = dest.getPage(); + if (page == null) { + return; + } + + int pageNum = curFile.getPageNumber(page); + if (pageNum >= 0) { + gotoPage(pageNum); + } + } + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + } + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ctulu/test/org/fudaa/ctulu/TestCtuluPdf.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/test/org/fudaa/ctulu/TestCtuluPdf.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/test/org/fudaa/ctulu/TestCtuluPdf.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -0,0 +1,85 @@ +package org.fudaa.ctulu; + +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; + +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ctulu.pdf.CtuluFramePdfCustomViewer; + + +import com.sun.pdfview.PDFFile; +import com.sun.pdfview.PDFPage; +import com.sun.pdfview.PDFViewer; +import com.sun.pdfview.PagePanel; + +/** + * classe de test poru voir le fonctionnement du renderer de pdf + * pour plus d exemples : https://pdf-renderer.dev.java.net/examples.html + * @author Adrien Hadoux + * + */ +public class TestCtuluPdf { + + public static void setup() throws IOException { + + //set up the frame and panel + javax.swing.JFrame frame = new JFrame("PDF Test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + PagePanel panel = new PagePanel(); + frame.add(panel); + frame.pack(); + frame.setVisible(true); + + //load a pdf from a byte buffer + CtuluFileChooser chooser=new CtuluFileChooser(true); + int reponse=chooser.showOpenDialog(frame); + if(reponse!=JFileChooser.APPROVE_OPTION) + return; + File file = chooser.getSelectedFile(); + + + RandomAccessFile raf = new RandomAccessFile(file, "r"); + FileChannel channel = raf.getChannel(); + ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, + 0, channel.size()); + PDFFile pdffile = new PDFFile(buf); + + // show the first page + PDFPage page = pdffile.getPage(0); + panel.showPage(page); + + + + } + + + public static void afficheViewerCompletement(){ + + // PDFViewer viewer=new PDFViewer(true); + // viewer.setVisible(true); + CtuluFramePdfCustomViewer viewer=new CtuluFramePdfCustomViewer("Test viewer",true,null); + viewer.setVisible(true); + // viewer.setSize(400,400); + } + + public static void main(final String[] args) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + + TestCtuluPdf.afficheViewerCompletement(); + + } + }); + } + } + + + + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-21 15:38:05 UTC (rev 4088) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -18,6 +18,8 @@ import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorClassLoader; +import com.thoughtworks.xstream.annotations.XStreamAlias; + /** * Classe utilisation pour la serialization des donn\xE9es widget * @@ -36,7 +38,9 @@ } } - + @XStreamAlias("warning") + String warning="ID unique"; + /** * Important: l'id de la widget pour avoir des references . */ Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/LayoutDescriptor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/LayoutDescriptor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/LayoutDescriptor.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -0,0 +1,16 @@ +package org.fudaa.fudaa.tr.post.persist; + +/** + * classe utiliseer pour donner des noms potable poru le xml parser + * @author Adrien Hadoux + * + */ +public class LayoutDescriptor { + + public String pathRelatifLayout; + + public LayoutDescriptor(String pathRelatifLayout) { + super(); + this.pathRelatifLayout = pathRelatifLayout; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-21 15:38:05 UTC (rev 4088) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -9,6 +9,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -51,6 +52,8 @@ import com.memoire.fu.FuLog; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.io.xml.DomDriver; import com.thoughtworks.xstream.persistence.FileStreamStrategy; import com.thoughtworks.xstream.persistence.XmlArrayList; @@ -90,7 +93,7 @@ /** * Attributs pour le ficheirs des sources */ - public final static String DESCRIPTORSOURCE = "sources" + EXTENSION; + //public final static String DESCRIPTORSOURCE = "sources" + EXTENSION; public final static String BALISESOURCES = "SourcesList"; public static String ATTRIBUTESOURCE = "FICHIER"; public final static String FileWidgetNames = "FramesNames"+ EXTENSION; @@ -107,6 +110,11 @@ File projet_; TrPostCommonImplementation ui_; + + //-- elements de base tagg\xE9s par xstream pour etre plus explicites dans les fichiers --// + + + public TrPostPersistenceManager(final TrPostProjet projet) { super(); trprojet_ = projet; @@ -214,84 +222,101 @@ } else { // -- tentative d'ouverture du projet --// - ObjectInputStream in = null; - try { - in = getParser().createObjectInputStream(new FileReader(fichierSetup)); + + //-- on a le chemin vers le fichier setup.POST, il suffit d4enlever le no; du fichier et on obtient le che;in du rep total --// + String path=fichierSetup.getAbsolutePath(); + path=path.substring(0, path.lastIndexOf(this.setupProject)); + + //-- verification que le fichier est bien un repertoire --// + File candidat=new File(path); + + if(candidat.isDirectory()){ + projet_=candidat; + return true; + }else + return false; + + +// ObjectInputStream in = null; +// try { +// in = getParser().createObjectInputStream(new FileReader(fichierSetup)); +// +// // -- Recuperation du path du projet --// +// final String pathRelatifProjet = (String) in.readObject(); +// final String pathAbsoluProjet = (String) in.readObject(); +// +// if (pathRelatifProjet == null) { +// try { +// in.close(); +// return false; +// } catch (final IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// messageError(false); +// } +// } +// +// //-- tetative de recollage du path relatif avec le path du fichier du chooser --// +// File fichierDirectory=CtuluLibFile.getAbsolutePathnameTo(fichierSetup, new File(pathRelatifProjet)); +// +// if(fichierDirectory!=null && fichierDirectory.canRead()){ +// projet_=fichierDirectory; +// } +// else +// projet_ = new File(pathAbsoluProjet); +// try { +// in.close(); +// return true; +// } catch (final IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// messageError(false); +// in.close(); +// return false; +// } +// +// } catch (final FileNotFoundException eft) { +// // TODO Auto-generated catch block +// eft.printStackTrace(); +// try { +// in.close(); +// } catch (final IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// return false; +// +// } catch (final IOException eft) { +// // TODO Auto-generated catch block +// eft.printStackTrace(); +// messageError(false); +// try { +// in.close(); +// } catch (final IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// return false; +// +// } catch (final ClassNotFoundException eft) { +// // TODO Auto-generated catch block +// eft.printStackTrace(); +// messageError(false); +// try { +// in.close(); +// } catch (final IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// return false; +// } - // -- Recuperation du path du projet --// - final String pathRelatifProjet = (String) in.readObject(); - final String pathAbsoluProjet = (String) in.readObject(); - - if (pathRelatifProjet == null) { - try { - in.close(); - return false; - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - messageError(false); - } - } - - //-- tetative de recollage du path relatif avec le path du fichier du chooser --// - File fichierDirectory=CtuluLibFile.getAbsolutePathnameTo(fichierSetup, new File(pathRelatifProjet)); - - if(fichierDirectory!=null && fichierDirectory.canRead()){ - projet_=fichierDirectory; - } - else - projet_ = new File(pathAbsoluProjet); - try { - in.close(); - return true; - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - messageError(false); - in.close(); - return false; - } - - } catch (final FileNotFoundException eft) { - // TODO Auto-generated catch block - eft.printStackTrace(); - try { - in.close(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return false; - - } catch (final IOException eft) { - // TODO Auto-generated catch block - eft.printStackTrace(); - messageError(false); - try { - in.close(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return false; - - } catch (final ClassNotFoundException eft) { - // TODO Auto-generated catch block - eft.printStackTrace(); - messageError(false); - try { - in.close(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return false; - } - } } + + /** * Fichier qui cree le fichier qui indique les diff\xE9rents fichiers layout a lire. Cela permettra pour la lecture de * proposer de charger ou non certains layout @@ -301,21 +326,30 @@ */ public void saveDescriptorScenes(final File file) { // -- outputstream du xstream --// - ObjectOutputStream out = null; - try { - out = getParser().createObjectOutputStream(new FileWriter(file)); - + + //-- ecriture de la classe xstream + ObjectOutputStream out = null; + try { + out = getParser().createObjectOutputStream(new FileWriter(file)); + + //-- readme --// + out.writeObject(XmlCommentaire.getCommentaireLayout()); + // -- g\xE9n\xE9ration du xml pour la scene --// final int nbFichiersToGenrate = trprojet_.impl_.getAllLayoutFille().size(); + out.writeInt(nbFichiersToGenrate); for (int i = 0; i < nbFichiersToGenrate; i++) { // creation du fichier de desciption des scenes dans le repertoire de meme nom. - final String nomFichierLayout =/* projet_.getAbsolutePath() + File.separator +*/ DESCRIPTORSCENE + (i + 1) + String nomFichierLayout=/* projet_.getAbsolutePath() + File.separator +*/ DESCRIPTORSCENE + (i + 1) + EXTENSION+ File.separator + DESCRIPTORSCENE + (i + 1) + EXTENSION; - out.writeObject(nomFichierLayout); - } - + out.writeObject(new LayoutDescriptor(nomFichierLayout)); + + + + } + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -343,20 +377,31 @@ // -- outputstream du xstream --// final List<String> listeFiles = new ArrayList<String>(); ObjectInputStream in = null; + try { + in = getParser().createObjectInputStream(new FileReader(file)); + int nbFichiersToGenrate ; + //-- lecture readme --// + Object debutFichier= in.readObject(); + + if(debutFichier instanceof XmlCommentaire) // -- g\xE9n\xE9ration du xml pour la scene --// - final int nbFichiersToGenrate = in.readInt(); - + nbFichiersToGenrate = in.readInt(); + else + nbFichiersToGenrate = ((Integer) debutFichier).intValue(); for (int i = 0; i < nbFichiersToGenrate; i++) { - //-- recuperation du path relatif vers le fichier de la scene --// - String pathRelatif=(String) in.readObject(); - // creation du fichier de desciption des scenes +// //-- recuperation du path relatif vers le fichier de la scene --// + String pathRelatif=((LayoutDescriptor) in.readObject()).pathRelatifLayout; +// // creation du fichier de desciption des scenes final String nomFichierLayout = projet_.getAbsolutePath()+File.separator+pathRelatif; listeFiles.add(nomFichierLayout); } + + // descriptor=(XstreamListLayoutDescriptor) in.readObject(); + } catch (final FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -379,6 +424,7 @@ } return listeFiles; + } /** @@ -439,6 +485,9 @@ } } + + + /** * Methode qui g\xE9n\xE8re le fichier contenant toutes les sources ouverts. * @@ -455,7 +504,11 @@ // -- g\xE9n\xE9ration du xml pour la scene --// try { out = getParser().createObjectOutputStream(new FileWriter(file)); - out.writeInt(trprojet_.listeSrc_.size()); + + //-- redame --// + out.writeObject(XmlCommentaire.getCommentaireSources()); + int nbElements=trprojet_.listeSrc_.size(); + out.writeInt(nbElements); final List<TrPostSourcePersist> listeCouplesIdSources = new ArrayList<TrPostSourcePersist>(); final List<TrPostUserVariableSaver> listeVar = getPersitantVariablesList(pathVariables, true); @@ -466,7 +519,7 @@ final File f = src.getFile(); //out.writeObject(f.getAbsolutePath()); trprojet_.deliverSourceId(src); - listeCouplesIdSources.add(new TrPostSourcePersist(src)); + listeCouplesIdSources.add(new TrPostSourcePersist(src,projet_)); // -- sauveagrde de la variable correspondante --// final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); listeVar.add(var); @@ -510,30 +563,46 @@ // -- recuperation du multiSourceActivator--// final TrPostMultiSourceActivator multiProjectActivator = new TrPostMultiSourceActivator(trprojet_); + //-- lecture des commentaires --// + Object debutFichier=in.readObject(); + int nbSources ; + if(!(debutFichier instanceof XmlCommentaire)){ + nbSources=((Integer)debutFichier).intValue(); + }else // -- lecture nb sources pour les sources --// - final int nbSources = in.readInt(); + nbSources= in.readInt(); //-- lecture de la liste des objets source perssitant --// final List<TrPostSourcePersist> listeCouplesIdSources = (List<TrPostSourcePersist>) in.readObject(); for (int i = 0; i < nbSources; i++) { - //final String path = (String) in.readObject(); - final String path =listeCouplesIdSources.get(i).pathSource; - if (path != null) { + //-- tentative de lecture du path relatif --// + String path=CtuluLibFile.getAbsolutePathnameTo(projet_, new File(listeCouplesIdSources.get(i).pathRelatifSource)).getPath(); + // String path =projet_.getAbsolutePath()+listeCouplesIdSources.get(i).pathRelatifSource; + File f = new File(path); + if (path != null && f!=null && f.canRead()) { if (trprojet_.isSourceLoaded(path)) { trprojet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); } else { - final File f = new File(path); // -- tentative de chargement du source dans le multi-projet --// - multiProjectActivator.active(f, trprojet_.impl_,listeCouplesIdSources.get(i).IdSource); - // -- notify aux observers --// - // trprojet_.notifyObservers(); - // --ajout des variables user au source --// - - } + } } + else{ + //-- tentative 2 avec le path absolu --// + path =listeCouplesIdSources.get(i).pathSource; + f = new File(path); + if (path != null && f!=null && f.canRead()) { + if (trprojet_.isSourceLoaded(path)) { + trprojet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), + TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); + } else { + // -- tentative de chargement du source dans le multi-projet --// + multiProjectActivator.active(f, trprojet_.impl_,listeCouplesIdSources.get(i).IdSource); + } + } + } } } catch (final FileNotFoundException e) { @@ -616,12 +685,12 @@ // -- sauvegarde du projet setup --// - saveSetup(projet_.getAbsolutePath()); + // saveSetup(projet_.getAbsolutePath()); File file; // -- etape 2 sauvegarde du fichier contenant tous les sources ouverts progression("Cr\xE9ation du fichier descripteur de sources", 15); - file = new File(projet_.getAbsolutePath() + File.separator + DESCRIPTORSOURCE); + file = new File(projet_.getAbsolutePath() + File.separator + setupProject); saveSourceAndVariables(file, pathVariables); // -- etape 3 sauvegarde des ebliscene unitairement --// @@ -682,6 +751,10 @@ ObjectOutputStream out = null; try { out = getParser().createObjectOutputStream(new FileWriter(file)); + + //--readme --// + out.writeObject(XmlCommentaire.getCommentaireName()); + out.writeObject(liste); } catch (final IOException e) { e.printStackTrace(); @@ -706,17 +779,22 @@ public List<EbliWidgetSerializeXml.CoupleNomId> loadNomsFrames(final File file) { List<EbliWidgetSerializeXml.CoupleNomId> liste = null; // -- outputstream du xstream --// - ObjectInputStream out = null; + ObjectInputStream in = null; try { - out = getParser().createObjectInputStream(new FileReader(file)); - liste = (List<CoupleNomId>) out.readObject(); + in = getParser().createObjectInputStream(new FileReader(file)); + //--readme --// + Object debuTfichier=in.readObject(); + if(debuTfichier instanceof XmlCommentaire) + liste = (List<CoupleNomId>) in.readObject(); + else + liste= (List<CoupleNomId>)debuTfichier; } catch (final IOException e) { e.printStackTrace(); } catch (final ClassNotFoundException e) { e.printStackTrace(); } finally { try { - out.close(); + in.close(); return liste; } catch (final IOException e) { e.printStackTrace(); @@ -749,7 +827,7 @@ // -- etape 2 sauvegarde du fichier contenant tous les sources ouverts progression("Chargement du fichier descripteur de sources", 15); - file = new File(projet_.getAbsolutePath() + File.separator + DESCRIPTORSOURCE); + file = new File(projet_.getAbsolutePath() + File.separator + setupProject); loadSource(file); // -- etape 3: sauvegarde du fichier de descriptions des layout @@ -820,6 +898,11 @@ xstream.alias("GROUPE", EbliWidgetGroupSerializeXml.class); xstream.alias("FRAMESNAME", EbliWidgetSerializeXml.CoupleNomId.class); xstream.alias("SOURCE", TrPostSourcePersist.class); + xstream.alias("LAYOUTDESCRIPTOR", LayoutDescriptor.class); + xstream.alias("README", XmlCommentaire.class); + // xstream.addImplicitCollection(EbliWidgetSerializeXml.CoupleNomId.class, "FRAMENAME"); + // xstream.alias( "NbElements",Integer.class); + return xstream; } @@ -1019,12 +1102,12 @@ // lecture xml de l objet final EbliWidgetSerializeXml widgetXml = (EbliWidgetSerializeXml) in.readObject(); - + if(!widgetXml.isLinked()){ // generation de la widget dans la scene parametres.put("nodeName", getNodeName(listeCouplesNoms, widgetXml.getId())); final EbliNode node = widgetXml.generateWidgetInScene(parametres, scenToUpdate); - if(!widgetXml.isLinked()){ + // ajout des noeuds a ajouter dans la selection if (widgetXml.isSelected()) listeNodeSelect.add(node); @@ -1136,5 +1219,11 @@ } } + + + public void writeCommentaire(OutputStream out){ + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java 2008-10-21 15:38:05 UTC (rev 4088) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -1,7 +1,12 @@ package org.fudaa.fudaa.tr.post.persist; +import java.io.File; + +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.fudaa.tr.post.TrPostSource; +import com.thoughtworks.xstream.annotations.XStreamAlias; + /** * Couple path source/ID * qui sera persist\xE9 en xml. @@ -12,23 +17,26 @@ */ public class TrPostSourcePersist { + @XStreamAlias("warning") + String warning="ID unique"; String IdSource; String pathSource; - + String pathRelatifSource; public TrPostSourcePersist(){} /** - * Constructeur utilis\xE9 prou la cr\xE9ation de la donn\xE9e persistante. + * Constructeur utilis\xE9 pour la cr\xE9ation de la donn\xE9e persistante. * @param source */ - public TrPostSourcePersist(TrPostSource source){ - fillDataWithSource(source); + public TrPostSourcePersist(TrPostSource source,File projectDirectory){ + fillDataWithSource(source,projectDirectory); } - public void fillDataWithSource(TrPostSource source){ + public void fillDataWithSource(TrPostSource source,File projectDirectory){ IdSource=source.getId(); pathSource=source.getFile().getAbsolutePath(); + pathRelatifSource=CtuluLibFile.getRelativePathnameTo(projectDirectory,source.getFile()).getPath(); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/XmlCommentaire.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/XmlCommentaire.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/XmlCommentaire.java 2008-10-22 17:30:54 UTC (rev 4089) @@ -0,0 +1,41 @@ +package org.fudaa.fudaa.tr.post.persist; + +import org.fudaa.fudaa.tr.Tr; +import org.fudaa.fudaa.tr.common.TrResource; + + + +/** + * Classe qui contient un commentaire, est ecrit mais non lu + * @author Adrien Hadoux + * + */ +public class XmlCommentaire { + + String readme; + + public XmlCommentaire(String readme) { + super(); + this.readme = readme; + } + + public static XmlCommentaire getCommentaireSources(){ + String buff=TrResource.getS("Fichier listant tous les fichiers r\xE9sultats. Pour modifier un fichier, modifier le chemin contenu dans balise pathSource (le contenu de pathRelatif n'a pas besoin d'etrre modifie).")+ + TrResource.getS("Pour ajouter un fichier de r\xE9sultat dans le projet, copier/coller d... [truncated message content] |
From: <had...@us...> - 2008-10-21 15:38:09
|
Revision: 4088 http://fudaa.svn.sourceforge.net/fudaa/?rev=4088&view=rev Author: hadouxad Date: 2008-10-21 15:38:05 +0000 (Tue, 21 Oct 2008) Log Message: ----------- - Gestion des path relatifs et absolu du setup.POST ce qui permet de d?\195?\169placer le r?\195?\169pertoire projet ou l'on souhaite! cela fonctionne toujours! - Gestion des noms explicites pour les variables - Correction bug: cas ou les l?\195?\169gendes sont enregistr?\195?\169es dans le fichier xml avant les calques/graphes, ca plantait car les l?\195?\169gendes ont besoin des graphes/calques pour se construire - Tests sous linux ok - Proposition de sauvegarde lors de la fermeture du logiciel Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/VariablesStreamStrategy.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-21 12:36:25 UTC (rev 4087) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-21 15:38:05 UTC (rev 4088) @@ -14,6 +14,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorClassLoader; @@ -182,6 +183,23 @@ return newNode; } + + public boolean isLinked(){ + String className=type; + if(type==null) + return true; + if (className.startsWith("class ")) ; + className = className.substring("class ".length()); + + if( className.equals(EbliWidgetCreatorLegende.class.getName())) + return true; + else + if( className.equals(org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende.class.getName())) + return true; + return false; + + } + public String getTitle() { return title; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-10-21 12:36:25 UTC (rev 4087) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-10-21 15:38:05 UTC (rev 4088) @@ -122,14 +122,17 @@ public boolean saveAndCloseProjet(final ProgressionInterface _interface) { if (c_ != null) { - if (c_.isModified()) { - final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); - if (i == JOptionPane.CANCEL_OPTION) { - return false; - } else if (i != JOptionPane.NO_OPTION) { - c_.save(this, _interface); + + // -- enregistrement sauce widget --// + final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); + if (i == JOptionPane.CANCEL_OPTION) { + return false; + } + if (i != JOptionPane.NO_OPTION) { + c_.getManager().saveProject(false); + //c_.save(this, _interface); } - } + c_.close(); c_ = null; SwingUtilities.invokeLater(new Runnable() { @@ -143,6 +146,9 @@ } }); } + + + return true; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-21 12:36:25 UTC (rev 4087) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-21 15:38:05 UTC (rev 4088) @@ -81,6 +81,7 @@ import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuTable; import com.memoire.bu.BuVerticalLayout; +import com.memoire.fu.FuLib; import com.memoire.fu.FuLog; /** @@ -1259,6 +1260,16 @@ if(src.getId()==null){ String uniqueId=CtuluLibGenerator.getInstance().deliverUniqueStringId(src.getFile().getName()); src.setId(uniqueId); + }else{ + + //-- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// + String nameFormate=FuLib.clean(src.getFile().getName()); + String id=src.getId(); + if(!id.startsWith(nameFormate)){ + String uniqueId=CtuluLibGenerator.getInstance().deliverUniqueStringId(src.getFile().getName()); + src.setId(uniqueId); + } + } return src.getId(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-21 12:36:25 UTC (rev 4087) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-21 15:38:05 UTC (rev 4088) @@ -219,8 +219,10 @@ in = getParser().createObjectInputStream(new FileReader(fichierSetup)); // -- Recuperation du path du projet --// - final String pathProjet = (String) in.readObject(); - if (pathProjet == null) { + final String pathRelatifProjet = (String) in.readObject(); + final String pathAbsoluProjet = (String) in.readObject(); + + if (pathRelatifProjet == null) { try { in.close(); return false; @@ -230,7 +232,15 @@ messageError(false); } } - projet_ = new File(pathProjet); + + //-- tetative de recollage du path relatif avec le path du fichier du chooser --// + File fichierDirectory=CtuluLibFile.getAbsolutePathnameTo(fichierSetup, new File(pathRelatifProjet)); + + if(fichierDirectory!=null && fichierDirectory.canRead()){ + projet_=fichierDirectory; + } + else + projet_ = new File(pathAbsoluProjet); try { in.close(); return true; @@ -380,7 +390,7 @@ */ List<TrPostUserVariableSaver> getPersitantVariablesList(final String path, final boolean init) { - final List<TrPostUserVariableSaver> liste = new XmlArrayList(new FileStreamStrategy(new File(path))); + final List<TrPostUserVariableSaver> liste = new XmlArrayList(new VariablesStreamStrategy(new File(path),trprojet_.listeSrc_)); if (init) clearDatas(liste); @@ -407,7 +417,13 @@ try { final File fichier = new File(projet + File.separator + setupProject); out = getParser().createObjectOutputStream(new FileWriter(fichier)); + + //--enregistrement du path relatif --// + File pathRelatif=CtuluLibFile.getRelativePathnameTo(fichier, projet_); + out.writeObject(pathRelatif.getPath()); + //-- enregistrement du path absolu --// out.writeObject(projet); + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -996,6 +1012,8 @@ // --// final HashMap<String, HashSet<Object>> listeGroupToPerform = new HashMap<String, HashSet<Object>>(); + List<EbliWidgetSerializeXml> listeWidgetLinked=new ArrayList<EbliWidgetSerializeXml>(); + // -- r\xE9cup\xE9ration via xml des eblinode/widgets --// for (int i = 0; i < sceneXml.getNbFrames(); i++) { @@ -1005,7 +1023,8 @@ // generation de la widget dans la scene parametres.put("nodeName", getNodeName(listeCouplesNoms, widgetXml.getId())); final EbliNode node = widgetXml.generateWidgetInScene(parametres, scenToUpdate); - + + if(!widgetXml.isLinked()){ // ajout des noeuds a ajouter dans la selection if (widgetXml.isSelected()) listeNodeSelect.add(node); @@ -1021,8 +1040,36 @@ listeGroupToPerform.get(idGroup).add(node); } + + } + else{ + //-- on ajoute la widget liee a la liste des widget a cree au final--// + listeWidgetLinked.add(widgetXml); + } + } + //--On executre les widgets liees --// + for (EbliWidgetSerializeXml widgetXml:listeWidgetLinked) { + // generation de la widget dans la scene + parametres.put("nodeName", getNodeName(listeCouplesNoms, widgetXml.getId())); + final EbliNode node = widgetXml.generateWidgetInScene(parametres, scenToUpdate); + // ajout des noeuds a ajouter dans la selection + if (widgetXml.isSelected()) listeNodeSelect.add(node); + + // ajout de la creation d'un groupe + if (!widgetXml.getIdGroup().equals(EbliWidgetGroup.NOGROUP)) { + // il y a un group a prendre en compte d'id + final String idGroup = widgetXml.getIdGroup(); + if (listeGroupToPerform.get(idGroup) == null) { + // on init + listeGroupToPerform.put(idGroup, new HashSet<Object>()); + } + // on ajoute l'objet node pour la widget + listeGroupToPerform.get(idGroup).add(node); + } + } + // -- lecture des groupes --// // -- ecriture des groupes --// final int nbGroups = in.readInt(); Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/VariablesStreamStrategy.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/VariablesStreamStrategy.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/VariablesStreamStrategy.java 2008-10-21 15:38:05 UTC (rev 4088) @@ -0,0 +1,226 @@ +package org.fudaa.fudaa.tr.post.persist; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.fudaa.fudaa.tr.post.TrPostSource; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.StreamException; +import com.thoughtworks.xstream.persistence.FileStreamStrategy; +import com.thoughtworks.xstream.persistence.StreamStrategy; + + +/** + * Classe qui surcharge FileStreamStrategy de xstream pour g\xE9rer les noms des ficheirs \xE0 sa propre sauce. + * Les fichiers seront de la forme nomFIchier_KEY.xml + * @author Adrien Hadoux + * + */ +public class VariablesStreamStrategy implements StreamStrategy{ + + + List<TrPostSource> listeSourcesAssociees_; + private final FilenameFilter filter; + + private final XStream xstream; + + private final File baseDirectory; + + public VariablesStreamStrategy(File baseDirectory,List<TrPostSource> listeSourcesAssociees) { + this(baseDirectory, new XStream(),listeSourcesAssociees); + } + + public VariablesStreamStrategy(File baseDirectory, XStream xstream,List<TrPostSource> listeSourcesAssociees) { + + listeSourcesAssociees_=listeSourcesAssociees; + + this.baseDirectory = baseDirectory; + this.xstream = xstream; + this.filter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return new File(dir, name).isFile() && isValid(dir, name); + } + }; + } +// public VariablesStreamStrategy(File baseDirectory,List<TrPostSource> listeSourcesAssociees) { +// super(baseDirectory); +// // TODO Auto-generated constructor stub +// listeSourcesAssociees_=listeSourcesAssociees; +// } + + /** + * Il faut extraire la clef du nom du fichier. + * Les fichiers seront toujours de la forme + * nomFIchier_KEY.xml + */ + + protected String extractKey(String name) { + // TODO Auto-generated method stub + String val=name.substring(name.lastIndexOf("_"), name.length() - 4); + return val; + + } + + /** + * Genere le nom du fichier a partir du nom de la source associ\xE9e a la variable et de l'indice + */ + + protected String getName(Object key) { + // TODO Auto-generated method stub + int value= Integer.parseInt(key.toString()); + + String val=listeSourcesAssociees_.get(value).getId()+"_"+key.toString()+".xml"; + + return val; + //return super.getName(key); + } + + + + + + protected boolean isValid(File dir, String name) { + return name.endsWith(".xml"); + } + + + + class XmlMapEntriesIterator implements Iterator { + + private File[] files = baseDirectory.listFiles(filter); + + private int position = -1; + + private File current = null; + + public boolean hasNext() { + return position + 1 < files.length; + } + + public void remove() { + if (current == null) { + throw new IllegalStateException(); + } + // removes without loading + current.delete(); + } + + public Object next() { + return new Map.Entry() { + + private File file = current = files[++position]; + + private String key = extractKey(file.getName()); + + public Object getKey() { + return key; + } + + public Object getValue() { + return readFile(file); + } + + public Object setValue(Object value) { + return put(key, value); + } + + public boolean equals(Object obj) { + if (!(obj instanceof Entry)) { + return false; + } + Entry e2 = (Entry) obj; + // TODO local cache value instead of calling getValue twice + return (key == null ? e2.getKey() == null : key.equals(e2 + .getKey())) + && (getValue() == null ? e2.getValue() == null + : getValue().equals(e2.getValue())); + } + + }; + } + + } + + private void writeFile(File file, Object value) { + try { + OutputStream os = new FileOutputStream(file); + try { + this.xstream.toXML(value, os); + } finally { + os.close(); + } + } catch (IOException e) { + throw new StreamException(e); + } + } + + private File getFile(String filename) { + return new File(this.baseDirectory, filename); + } + + private Object readFile(File file) { + try { + InputStream is = new FileInputStream(file); + try { + return this.xstream.fromXML(is); + } finally { + is.close(); + } + } catch (FileNotFoundException e) { + // not found... file.exists might generate a sync problem + return null; + } catch (IOException e) { + throw new StreamException(e); + } + } + + + public Object put(Object key, Object value) { + Object oldValue = get(key); + String filename = getName(key); + writeFile(new File(baseDirectory, filename), value); + return oldValue; + } + + public Iterator iterator() { + return new XmlMapEntriesIterator(); + } + + public int size() { + return baseDirectory.list(filter).length; + } + + public boolean containsKey(Object key) { + // faster lookup + File file = getFile(getName(key)); + return file.exists(); + } + + public Object get(Object key) { + return readFile(getFile(getName(key))); + } + + public Object remove(Object key) { + // faster lookup + File file = getFile(getName(key)); + Object value = null; + if (file.exists()) { + value = readFile(file); + file.delete(); + } + return value; + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-21 12:36:33
|
Revision: 4087 http://fudaa.svn.sourceforge.net/fudaa/?rev=4087&view=rev Author: emmanuel_martin Date: 2008-10-21 12:36:25 +0000 (Tue, 21 Oct 2008) Log Message: ----------- mise en place de l'architecture permettant de de modifier les valeurs dans le tableau d'information. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-21 09:05:18 UTC (rev 4086) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCellEditorProxy.java 2008-10-21 12:36:25 UTC (rev 4087) @@ -24,20 +24,20 @@ * map. * * tableau : le tableau doit avoir le m\xEAme nombre de case que le nombre de ligne - * dans le tableau \xE0 \xE9diter. Si se n'est pas le cas, les cellules - * suppl\xE9mentaires seront consid\xE9r\xE9es comme non \xE9ditable. Il est possible que + * dans le tableau \xE0 \xE9diter. Si ce n'est pas le cas, les cellules + * suppl\xE9mentaires seront consid\xE9r\xE9es comme non \xE9ditable. Il est possible de * donner des valeurs null dans le tableau, il sera alors consid\xE9r\xE9 que la * cellule n'est pas \xE9ditable. * * map : l'avantage de la map par rapport au tableau est de ne renseigner que - * les lignes voulus. Il est possible de donner un index par defaut. Cette index + * les lignes voulues. Il est possible de donner un index par defaut. Cet index * servira \xE0 retourner l'editeur par defaut si il n'y en a pas de d\xE9fini \xE0 - * l'index demand\xE9. Si aucune instance n'est renseign\xE9 pour l'index par defaut, + * l'index demand\xE9. Si aucune instance n'est renseign\xE9e pour l'index par defaut, * les cases seront consid\xE9r\xE9es comme non \xE9ditable. Comme le tableau, la valeur * null pour un \xE9diteur signifie que la cellule n'est pas \xE9ditable. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class CtuluTableCellEditorProxy extends AbstractCellEditor implements TableCellEditor, CellEditorListener { @@ -47,6 +47,12 @@ private final int defaultIndex_; /** L'index utilis\xE9 actuellement. */ private int currentIndex_; + /** + * Vrai si la valeur courant est \xE9ditable. On ne peut pas se passer de cette + * variable en donnant une valeur sp\xE9ciale \xE0 currentIndex_ car defaultIndex_ + * peut prendre toutes les valeurs possibles. + */ + private boolean editable_; /** * Si le tableau n'est pas assez grand, null sera retourn\xE9 par la method @@ -65,6 +71,7 @@ mapEditors_=new HashMap<Integer, TableCellEditor>(); defaultIndex_=-1; currentIndex_=-1; + editable_=false; for (int i=0; i<_editors.length; i++) mapEditors_.put(i, _editors[i]); } @@ -87,6 +94,7 @@ throw new IllegalArgumentException("_editors de doit pas \xEAtre null."); defaultIndex_=_defaultChoice; currentIndex_=-1; + editable_=false; mapEditors_=_editors; } @@ -95,43 +103,60 @@ */ public Component getTableCellEditorComponent(JTable _table, Object _value, boolean _isSelected, int _row, int _column) { // Suppression de l'\xE9coute d'\xE9venement sur l'ancien editeur - if(currentIndex_!=-1) + if (editable_) mapEditors_.get(currentIndex_).removeCellEditorListener(this); + editable_=true; // Actualisation de currentIndex_ - if(mapEditors_.containsKey(_row)) - if(mapEditors_.get(_row)!=null) + if (mapEditors_.containsKey(_row)) + if (mapEditors_.get(_row)!=null) // Cas normal currentIndex_=_row; - else{ + else // Cas o\xF9 la cellule n'est pas \xE9ditable - currentIndex_=-1; - return null; - } - else if(mapEditors_.containsKey(defaultIndex_)) + editable_=false; + else if (mapEditors_.containsKey(defaultIndex_)) // Cas o\xF9 l'editeur n'est pas renseign\xE9 : on utilise la valeur par defaut - if(mapEditors_.get(defaultIndex_)!=null) + if (mapEditors_.get(defaultIndex_)!=null) // Cas normal de l'utilisation de l'editeur par defaut currentIndex_=defaultIndex_; - else{ + else // Cas o\xF9 l'index par defaut pointe sur null - currentIndex_=-1; - return null; - } - else{ + editable_=false; + else // Cas o\xF9 la valeur par defaut n'existe pas : la case est non \xE9ditable - currentIndex_=-1; + editable_=false; + if (editable_) { + // Ajout de l'\xE9coute d'\xE9venement sur le nouvel \xE9diteur et transfert + // d'appelle + mapEditors_.get(currentIndex_).addCellEditorListener(this); + return mapEditors_.get(currentIndex_).getTableCellEditorComponent(_table, _value, _isSelected, _row, _column); + } + else return null; + } + + /** + * Permet d'ajouter ou de remplacer un des \xE9diteurs utilis\xE9. Le remplacement + * ne peut se faire que si l'ancien \xE9diteur n'est pas en cours d'utilisation. + * + * @param _indexRow : l'index de la ligne \xE0 ajouter ou remplacer + * @param _editor : le nouvel \xE9diteur + * @return vrai si l'ajout/ remplacement a \xE9t\xE9 effectu\xE9, faux sinon + */ + public boolean putEditor(Integer _indexRow, TableCellEditor _editor){ + if(!editable_||_indexRow!=currentIndex_){ + mapEditors_.put(_indexRow, _editor); + return true; } - // Ajout de l'\xE9coute d'\xE9venement sur le nouvel \xE9diteur et transfert d'appelle - mapEditors_.get(currentIndex_).addCellEditorListener(this); - return mapEditors_.get(currentIndex_).getTableCellEditorComponent(_table, _value, _isSelected, _row, _column); + else + return false; } - + /* (non-Javadoc) * @see javax.swing.CellEditor#cancelCellEditing() */ public void cancelCellEditing() { - if(currentIndex_!=-1) + if(editable_) mapEditors_.get(currentIndex_).cancelCellEditing(); } @@ -139,7 +164,7 @@ * @see javax.swing.CellEditor#getCellEditorValue() */ public Object getCellEditorValue() { - if(currentIndex_!=-1) + if(editable_) return mapEditors_.get(currentIndex_).getCellEditorValue(); return null; } @@ -148,7 +173,7 @@ * @see javax.swing.CellEditor#isCellEditable(java.util.EventObject) */ public boolean isCellEditable(EventObject _anEvent) { - if(currentIndex_!=-1) + if(editable_) return mapEditors_.get(currentIndex_).isCellEditable(_anEvent); return true; } @@ -157,7 +182,7 @@ * @see javax.swing.CellEditor#shouldSelectCell(java.util.EventObject) */ public boolean shouldSelectCell(EventObject _anEvent) { - if(currentIndex_!=-1) + if(editable_) return mapEditors_.get(currentIndex_).shouldSelectCell(_anEvent); return true; } @@ -166,7 +191,7 @@ * @see javax.swing.CellEditor#stopCellEditing() */ public boolean stopCellEditing() { - if(currentIndex_!=-1) + if(editable_) return mapEditors_.get(currentIndex_).stopCellEditing(); return true; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-10-21 09:05:18 UTC (rev 4086) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-10-21 12:36:25 UTC (rev 4087) @@ -111,7 +111,7 @@ public void fillWithInfo(final InfoData _m) { if (_m != null) { final BCalque[] cqs = getCalques(); - _m.setTitle(getTitle()); + _m.setTitle(EbliLib.getS("Calque : ") + getTitle()); _m.put(EbliLib.getS("Nombre de calques"), cqs == null ? CtuluLibString.ZERO : CtuluLibString .getString(cqs.length)); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2008-10-21 09:05:18 UTC (rev 4086) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2008-10-21 12:36:25 UTC (rev 4087) @@ -227,7 +227,7 @@ if (modeleDonnees() != null) { modeleDonnees().fillWithInfo(_d, this); if (!_d.isTitleSet()) { - _d.setTitle(getTitle()); + _d.setTitle(EbliLib.getS("Calque : ") + getTitle()); } } } 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-21 09:05:18 UTC (rev 4086) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-21 12:36:25 UTC (rev 4087) @@ -12,8 +12,9 @@ import java.awt.Font; import java.awt.FontMetrics; import java.util.ArrayList; -import java.util.List; +import java.util.HashMap; +import javax.swing.DefaultCellEditor; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; @@ -21,15 +22,17 @@ import javax.swing.SwingConstants; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableColumnModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import org.fudaa.ctulu.gui.CtuluTableCellEditorProxy; +import org.fudaa.ebli.commun.EbliLib; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuTextField; -import org.fudaa.ebli.commun.EbliLib; - /** * Un panel affichant les infos envoyes. * @@ -44,30 +47,116 @@ */ public interface InfoData { + /** + * Permet d'ajouter une propri\xE9t\xE9 non \xE9ditable. + * @param _key le nom de la propri\xE9t\xE9 + * @param _value la valeur de la propri\xE9t\xE9 + */ void put(String _key, String _value); + /** + * Permet d'ajouter une information \xE9ditable au tableau. + * @param _key le nom de la propri\xE9t\xE9, doit \xEAtre non vide + * @param _value la valeur de la propri\xE9t\xE9, doit \xEAtre non null + * @param _editor l'\xE9diteur, si null l'\xE9diteur par defaut sera utilis\xE9 + * @param _renderer le renderer, si null le renderer par defaut sera utilis\xE9 + * @param _owner l'object qui sera appel\xE9 (via modifyProperty) pour que + * la modification soit prise en compte. Si null l'attribut est + * consid\xE9r\xE9 comme non modifiable. + */ + void put(String _key, Object _value, TableCellEditor _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner); + void setTitle(String _title); boolean isTitleSet(); } /** - * @author Fred Deniger + * Interface allant de pair avec InfoData. Elle indique que la m\xE9thode modifyProperty + * est impl\xE9ment\xE9, permettant ainsi de r\xE9percuter les modification du tableau sur + * l'objet concern\xE9. + * @author Emmanuel MARTIN + * @version $Id:$ + */ + public interface ModifyPropertyInfo { + /** + * M\xE9thode appell\xE9e lors de la modification de la valeur de la propri\xE9t\xE9 + * fournie \xE0 InfoData. + * @param _key le nom de la propri\xE9t\xE9 + * @param _newValue la nouvelle valeur de la prorpi\xE9t\xE9 + */ + void modifyProperty(String _key, Object _newValue); + } + + /** + * @author Fred Deniger, Emmanuel Martin * @version $Id: BPaletteInfo.java,v 1.9 2006-09-19 14:55:51 deniger Exp $ */ public final class PanelTableModel extends AbstractTableModel implements InfoData { - private List<String> name_; - private List<String> value_; - + /** + * Chaque ligne est organis\xE9 suivant ce model : nom (string), valeur + * (object), editeor (TableCellEditor), renderer (TableCellRenderer), owner + * (ModifyPropertyInfo). + */ + private ArrayList<ArrayList<Object>> rows_; + /** L'editor du tableau. */ + private CtuluTableCellEditorProxy editor_; + + private class PanelTableRenderer extends DefaultTableCellRenderer { + /* (non-Javadoc) + * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) + */ + public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected, boolean _hasFocus, int _row, + int _column) { + if(rows_.get(_row).get(3)!=null) + return ((TableCellRenderer) rows_.get(_row).get(3)).getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); + else + return super.getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); + } + } + + public TableCellRenderer getRenderer(){ + return new PanelTableRenderer(); + } + + public TableCellEditor getEditor(){ + if (editor_==null) { + HashMap<Integer, TableCellEditor> editors=new HashMap<Integer, TableCellEditor>(); + // R\xE9cup\xE9ration des \xE9ditors + for (int i=0; i<rows_.size(); i++) + // Si owner est renseign\xE9 + if (rows_.get(i).get(4)!=null) { + // Si l'editor est renseign\xE9 + if (rows_.get(i).get(3)!=null) + editors.put(i, (TableCellEditor)rows_.get(i).get(3)); + } + else + editors.put(i, null); + // Ajout du choix par defaut + editors.put(-1, new DefaultCellEditor(new BuTextField())); + // Construction de l'editor mandataire + editor_=new CtuluTableCellEditorProxy(editors, -1); + } + return editor_; + } + + /* (non-Javadoc) + * @see javax.swing.table.AbstractTableModel#isCellEditable(int, int) + */ + public boolean isCellEditable(int rowIndex, int columnIndex) { + if(columnIndex==1) + return true; + else + return false; + } + public PanelTableModel() { - name_ = new ArrayList<String>(); - value_ = new ArrayList<String>(); + rows_=new ArrayList<ArrayList<Object>>(); } public void clear() { - name_.clear(); - value_.clear(); + rows_.clear(); } public int getColumnCount() { @@ -75,38 +164,73 @@ } public String getColumnName(final int _column) { - if (_column == 0) { + if (_column==0) { return EbliLib.getS("Nom"); } return EbliLib.getS("Valeur"); } - - public String getLine(final int _row) { - return (String) name_.get(_row) + ": " + (String) tableModel_.value_.get(_row); - } - + public int getRowCount() { - return name_.size(); + return rows_.size(); } public Object getValueAt(final int _row, final int _col) { - if (_col == 0) { - return name_.get(_row); - } - return value_.get(_row); + if (_row<0||_col<0||_row>=rows_.size()||_col>getColumnCount()) + return null; + else + return rows_.get(_row).get(_col); } - public void put(final String _n, final String _v) { - name_.add(_n); - value_.add(_v); + public void put(final String _name, final String _value) { + ArrayList<Object> row=new ArrayList<Object>(); + row.add(0, _name); + row.add(1, _value); + row.add(2, null); + row.add(3, null); + row.add(4, null); + rows_.add(row); + editor_.putEditor(rows_.size()-1, null); } + /* + * (non-Javadoc) + * + * @see org.fudaa.ebli.palette.BPaletteInfo.InfoData#put(java.lang.String, + * java.lang.Object, javax.swing.table.TableCellEditor, + * javax.swing.table.TableCellRenderer, + * org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo) + */ + public void put(String _key, Object _value, TableCellEditor _editor, TableCellRenderer _renderer, ModifyPropertyInfo _owner) { + if (_key==null||_value==null) + throw new IllegalArgumentException("_key et _value doivent \xEAtre non null."); + ArrayList<Object> row=new ArrayList<Object>(); + row.add(0, _key); + row.add(1, _value); + row.add(2, _editor); + row.add(3, _renderer); + row.add(4, _owner); + rows_.add(row); + editor_.putEditor(rows_.size()-1, _editor); + } + public void setTitle(final String _title) { txtTitle_.setText(_title); } + /* (non-Javadoc) + * @see javax.swing.table.AbstractTableModel#setValueAt(java.lang.Object, int, int) + */ + public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { + if(_rowIndex<0||_rowIndex>=rows_.size()||_columnIndex<0||_columnIndex>getColumnCount()) + return; + if (rows_.get(_rowIndex).get(_columnIndex)!=_value&&rows_.get(_rowIndex).get(4)!=null) { + rows_.get(_rowIndex).set(_columnIndex, _value); + ((ModifyPropertyInfo)rows_.get(_rowIndex).get(4)).modifyProperty((String)rows_.get(_rowIndex).get(0), _value); + } + } + public boolean isTitleSet() { - return txtTitle_.getText() != null && txtTitle_.getText().trim().length() > 0; + return txtTitle_.getText()!=null&&txtTitle_.getText().trim().length()>0; } } @@ -128,23 +252,13 @@ setPreferredSize(new Dimension(300, 200)); tableModel_ = new PanelTableModel(); table_ = new JTable(tableModel_); + table_.getColumnModel().getColumn(1).setCellRenderer(tableModel_.getRenderer()); + table_.getColumnModel().getColumn(1).setCellEditor(tableModel_.getEditor()); table_.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); final JScrollPane sp = new BuScrollPane(table_); sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); add(sp, BuBorderLayout.CENTER); - final DefaultTableCellRenderer render = new DefaultTableCellRenderer() { - - public Component getTableCellRendererComponent(final JTable _table, final Object _value, - final boolean _isSelected, final boolean _hasFocus, final int _row, final int _column) { - Component r = super.getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column); - setToolTipText(tableModel_.getLine(_row)); - return r; - } - }; - final TableColumnModel colModel = table_.getColumnModel(); - colModel.getColumn(0).setCellRenderer(render); - colModel.getColumn(1).setCellRenderer(render); } protected final void updateSize() { @@ -190,7 +304,7 @@ } public final void setAvailable(final boolean _isAvailable) { - isAvailable_ = _isAvailable; + isAvailable_=_isAvailable; } public abstract void updateState(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-21 09:39:14
|
Revision: 4086 http://fudaa.svn.sourceforge.net/fudaa/?rev=4086&view=rev Author: emmanuel_martin Date: 2008-10-21 09:05:18 +0000 (Tue, 21 Oct 2008) Log Message: ----------- correction d'un bug sur l'edition dans le prepro via le double click Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2008-10-21 08:36:50 UTC (rev 4085) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2008-10-21 09:05:18 UTC (rev 4086) @@ -40,11 +40,10 @@ } protected boolean editionAsked() { -// if (getScene() != null) { - return editor_.edit()!=null; -// return true; -// } -// return false; + String message = editor_.edit(); + if(message!=null) + FuLog.trace("EBL : ZCalqueSelectionInteractionSimple : "+message); + return message!=null; } /** Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-21 08:36:50 UTC (rev 4085) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-21 09:05:18 UTC (rev 4086) @@ -725,7 +725,7 @@ ZCalqueAffichageDonneesInterface[] calques=panel_.getScene().getAllLayers(); ArrayList<ZCalqueAffichageDonneesInterface> claquesWithSelectedObjects=new ArrayList<ZCalqueAffichageDonneesInterface>(); for (int i=0; i<calques.length; i++) - if (!calques[i].isSelectionEmpty()&&calques[i] instanceof ZCalqueEditable) + if (!calques[i].isSelectionEmpty()) claquesWithSelectedObjects.add(calques[i]); // Verification du le nombre de calques contenant des selections if (claquesWithSelectedObjects.size()==0) @@ -734,27 +734,32 @@ ui_.warn("Information", "La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition.", false); return EbliLib.getS("La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition."); } - ZCalqueEditable calque=(ZCalqueEditable)claquesWithSelectedObjects.get(0); - - // G\xE9n\xE9ration d'une boite d'\xE9dition selon le type de selection et d'\xE9dition \\ - if (((ZCalqueEditable)calque).isAtomicMode()) - editVertexObject(calque); - else if (calque.isOnlyOneObjectSelected()) - // Une seule g\xE9om\xE9trie est \xE0 \xE9diter - editSingleObject(calque); + if (!(claquesWithSelectedObjects.get(0) instanceof ZCalqueEditable)) + // Calque n'impl\xE9mentant pas l'interface ZCalqueEditable, donc on le laisse g\xE9rer son \xE9dition. + claquesWithSelectedObjects.get(0).editSelected(); else { - // Plusieurs g\xE9om\xE9tries sont \xE0 \xE9diter - CtuluDialogPanel pn=null; - if (calque.getModelEditable().getGeomData() instanceof GISZoneCollectionPoint) - pn=GISGuiBuilder.buildFor((GISZoneCollectionPoint)calque.getModelEditable().getGeomData(), calque.getLayerSelection() - .getSelectedIndex(), getMng()); - else - pn=GISGuiBuilder.buildForGlobAtt(calque.getModelEditable().getGeomData(), calque.getLayerSelection().getSelectedIndex(), - getMng()); - if (pn==null) - getUi().message(calque.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), true); - else - pn.afficheModale(getFrame(), calque.getTitle()); + ZCalqueEditable calque=(ZCalqueEditable)claquesWithSelectedObjects.get(0); + // G\xE9n\xE9ration d'une boite d'\xE9dition selon le type de selection et + // d'\xE9dition \\ + if (((ZCalqueEditable)calque).isAtomicMode()) + editVertexObject(calque); + else if (calque.isOnlyOneObjectSelected()) + // Une seule g\xE9om\xE9trie est \xE0 \xE9diter + editSingleObject(calque); + else { + // Plusieurs g\xE9om\xE9tries sont \xE0 \xE9diter + CtuluDialogPanel pn=null; + if (calque.getModelEditable().getGeomData() instanceof GISZoneCollectionPoint) + pn=GISGuiBuilder.buildFor((GISZoneCollectionPoint)calque.getModelEditable().getGeomData(), calque.getLayerSelection() + .getSelectedIndex(), getMng()); + else + pn=GISGuiBuilder.buildForGlobAtt(calque.getModelEditable().getGeomData(), calque.getLayerSelection().getSelectedIndex(), + getMng()); + if (pn==null) + getUi().message(calque.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), true); + else + pn.afficheModale(getFrame(), calque.getTitle()); + } } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-21 09:36:33
|
Revision: 4085 http://fudaa.svn.sourceforge.net/fudaa/?rev=4085&view=rev Author: emmanuel_martin Date: 2008-10-21 08:36:50 +0000 (Tue, 21 Oct 2008) Log Message: ----------- pr?\195?\169 commit sur la modification du panel d'information 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/BGroupeCalque.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.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-20 16:31:59 UTC (rev 4084) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-10-21 08:36:50 UTC (rev 4085) @@ -7,12 +7,13 @@ */ package org.fudaa.ebli.calque; +import java.util.ArrayList; + import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import org.fudaa.ctulu.CtuluLibMessage; import org.fudaa.ctulu.CtuluLibString; - +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.palette.BPaletteInfo; /** * Un panel affichant les infos envoyes par TrPanelInfoSender. @@ -21,63 +22,108 @@ */ public class BCalquePaletteInfo extends BPaletteInfo implements TreeSelectionListener, ZSelectionListener { - BCalque layer_; - BArbreCalqueModel m_; + private ArrayList<ZCalqueAffichageDonneesInterface> calqueWithGeometriesSelected_; + private BArbreCalqueModel treeModel_; - /** - * - */ + private class CalqueVisitor implements BCalqueVisitor { + private ArrayList<ZCalqueAffichageDonneesInterface> calques=new ArrayList<ZCalqueAffichageDonneesInterface>(); + public boolean visit(BCalque _cq) { + if(_cq instanceof ZCalqueAffichageDonneesInterface) + calques.add((ZCalqueAffichageDonneesInterface)_cq); + return true; + } + public ZCalqueAffichageDonneesInterface[] getCalques(){ + return calques.toArray(new ZCalqueAffichageDonneesInterface[0]); + } + } + public BCalquePaletteInfo(final BArbreCalqueModel _m) { super(); - m_ = _m; - m_.addTreeSelectionListener(this); + treeModel_ = _m; + treeModel_.addTreeSelectionListener(this); + + calqueWithGeometriesSelected_=new ArrayList<ZCalqueAffichageDonneesInterface>(); + ZCalqueAffichageDonneesInterface[] calques = getCalques(); + for(int i=0;i<calques.length;i++) + calques[i].addSelectionListener(this); } - /** - * + * @return les calques de type ZCalqueAffichageDonneesInterface contenus dans l'arbre de calque. */ - public void selectionChanged(final ZSelectionEvent _evt){ - if (isAvailable() && (_evt.getSource() == layer_) && layer_ != null) { - txtTitle_.setText(CtuluLibString.EMPTY_STRING); - tableModel_.clear(); - layer_.fillWithInfo(tableModel_); + private ZCalqueAffichageDonneesInterface[] getCalques(){ + CalqueVisitor visitor=new CalqueVisitor(); + treeModel_.getRootCalque().apply(visitor); + return visitor.getCalques(); + } + + /** + * Met \xE0 jour les informations contenues dans le tableau. + */ + private void updateTableModel(){ + // Suppression des anciennes informations + txtTitle_.setText(CtuluLibString.EMPTY_STRING); + tableModel_.clear(); + // Ajout des nouvelles informations \\ + // Informations g\xE9n\xE9rales + ZCalqueAffichageDonneesInterface[] calques = getCalques(); + int nbGeom=0; + int nbGeomSelected=0; + for(int i=0;i<calques.length;i++){ + nbGeom+=calques[i].modeleDonnees().getNombre(); + if(calques[i].getLayerSelection()!=null) + nbGeomSelected+=calques[i].getLayerSelection().getNbSelectedIndex(); + } + if(nbGeomSelected>0) + tableModel_.put(EbliLib.getS("nombre total de s\xE9lections"), Integer.toString(nbGeomSelected)+"/"+Integer.toString(nbGeom)); + // Informations relatives aux calques + switch (calqueWithGeometriesSelected_.size()) { + case 0: + treeModel_.getSelectedCalque().fillWithInfo(tableModel_); tableModel_.fireTableDataChanged(); - updateSize(); - + break; + case 1: + calqueWithGeometriesSelected_.get(0).fillWithInfo(tableModel_); + tableModel_.fireTableDataChanged(); + break; + default: + tableModel_.setTitle(EbliLib.getS("Selection Multicalque")); } + updateSize(); } - - public void updateState(){ - if (!isAvailable()) { - return; - } - if (CtuluLibMessage.DEBUG) { - CtuluLibMessage.debug(getClass().getName() + " maj info"); - } - final BCalque newLa= m_.getSelectedCalque(); - if (newLa != layer_) { - if (layer_ != null) { - layer_.removeSelectionListener(this); + public void selectionChanged(final ZSelectionEvent _evt) { + if (isAvailable()) { + if (_evt.getSource().getLayerSelection()!=null&&_evt.getSource().getLayerSelection().getNbSelectedIndex()>0) { + if (!calqueWithGeometriesSelected_.contains(_evt.getSource())) + calqueWithGeometriesSelected_.add(_evt.getSource()); } - if (newLa != null) { - newLa.addSelectionListener(this); + else { + if (calqueWithGeometriesSelected_.contains(_evt.getSource())) + calqueWithGeometriesSelected_.remove(_evt.getSource()); } + updateTableModel(); } - layer_ = newLa; - tableModel_.clear(); - txtTitle_.setText(CtuluLibString.EMPTY_STRING); - if (layer_ != null) { - layer_.fillWithInfo(tableModel_); - } - tableModel_.fireTableDataChanged(); - updateSize(); } - public void valueChanged(final TreeSelectionEvent _e){ + + public void updateState() { if (isAvailable()) { - updateState(); + calqueWithGeometriesSelected_.clear(); + // R\xE9cup\xE9ration des calques ayant une selection + ZCalqueAffichageDonneesInterface[] calques=getCalques(); + for (int i=0; i<calques.length; i++) + if (calques[i].getLayerSelection()!=null&&calques[i].getLayerSelection().getNbSelectedIndex()>0) + calqueWithGeometriesSelected_.add(calques[i]); + // Mise \xE0 jour du tableau des informations + updateTableModel(); } } + + + + public void valueChanged(final TreeSelectionEvent _e) { + if (isAvailable()&&calqueWithGeometriesSelected_.size()==0) + updateTableModel(); + } } \ No newline at end of file Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-10-20 16:31:59 UTC (rev 4084) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-10-21 08:36:50 UTC (rev 4085) @@ -111,6 +111,7 @@ public void fillWithInfo(final InfoData _m) { if (_m != null) { final BCalque[] cqs = getCalques(); + _m.setTitle(getTitle()); _m.put(EbliLib.getS("Nombre de calques"), cqs == null ? CtuluLibString.ZERO : CtuluLibString .getString(cqs.length)); } 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-20 16:31:59 UTC (rev 4084) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-10-21 08:36:50 UTC (rev 4085) @@ -57,12 +57,12 @@ */ public final class PanelTableModel extends AbstractTableModel implements InfoData { - private List name_; - private List value_; + private List<String> name_; + private List<String> value_; public PanelTableModel() { - name_ = new ArrayList(); - value_ = new ArrayList(); + name_ = new ArrayList<String>(); + value_ = new ArrayList<String>(); } public void clear() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-20 16:32:09
|
Revision: 4084 http://fudaa.svn.sourceforge.net/fudaa/?rev=4084&view=rev Author: hadouxad Date: 2008-10-20 16:31:59 +0000 (Mon, 20 Oct 2008) Log Message: ----------- l?\195?\169gende calques sauvegarde - Persistance des l?\195?\169gendes fonctionne - On peut enregistrer une l?\195?\169gende par calque de type calqueAffichage - Modif structure des sauvegardes de projet - Tous les fichiers layouts sont enregistr?\195?\169s dans un r?\195?\169pertoire layoutN.POST - A l'int?\195?\169rieur sont contenus les dossier graphes,calques et texte - Enregistrement des path relatif pour tout sauf pour les sources (path abosolu vers les fichier de r?\195?\169sultats) - Refactorisation du syst?\195?\168me de sauvegarde des variables: les fichiers portent un nom parlant du source ID. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -99,6 +99,8 @@ ZEbliCalquesPanel calque=((EbliWidgetControllerCalque) widget.getController()).getVisuPanel(); data.indiceCalqueCible= calque.getArbreCalqueModel().getIndexOfChild(calque.getArbreCalqueModel().getRoot(), calqueCible_); + if(data.indiceCalqueCible==-1) + data.indiceCalqueCible=0; } @@ -118,14 +120,16 @@ final EbliScene scene = (EbliScene) parameters.get("scene"); // -- recherche de la widget qui contient l'id et rejouer l'action ajouter legende --// //-- recuperation du calque --// - EbliWidget widget=scene.findById(IdPossessor_); + EbliWidget widget=scene.findById(idCalque); if(widget !=null && widget.getController() instanceof EbliWidgetControllerCalque){ ZEbliCalquesPanel calque=((EbliWidgetControllerCalque) widget.getController()).getVisuPanel(); //-- recuperation du bon calque --// calqueCible_= (BCalque) calque.getArbreCalqueModel().getChild(calque.getArbreCalqueModel().getRoot(), indexCalque); IdPossessor_=idCalque; - g=new BCalqueLegendePanel((BCalqueAffichage) calqueCible_,calqueCible_.getTitle()); + //g=new BCalqueLegendePanel((BCalqueAffichage) calqueCible_,calqueCible_.getTitle()); + BCalqueLegendePanel legendePanel=((CalqueLegendeWidgetAdapter)calque.getCqLegend()).legendePanel_; + g=legendePanel; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.Map; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.calque.ZebliCalquePersist; import org.fudaa.ebli.geometrie.GrBoite; @@ -135,8 +136,8 @@ (new ZebliCalquePersist(pathUnique)).savePersitCalqueXml(getCalque(),parameters); } - - return pathUnique; + String pathRelative=CtuluLibFile.getRelativeFile(new File(pathUnique), new File((String)parameters.get("pathLayout")), 4); + return pathRelative; } public void setPersistData(Object data, Map parameters) { @@ -144,7 +145,7 @@ //il faut reconstruire le PersistenceManager par reflexion et c'est lui qui produire le ZEbliCalquesPanel if (data == null) calque_ = new ZEbliCalquesPanel(null); else { - String pathCalque = (String) data; + String pathCalque = (String)parameters.get("pathLayout")+File.separator+(String) data; calque_ = (new ZebliCalquePersist(pathCalque)).loadPersitCalqueXml(parameters); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorTextEditor.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorTextEditor.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -10,6 +10,7 @@ import java.io.InputStreamReader; import java.util.Map; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; @@ -94,7 +95,10 @@ writer = new FileWriter(contenu); writer.write(editorPane_.getDocumentText()); writer.close(); - return contenu.getAbsolutePath(); + + String pathRelative=CtuluLibFile.getRelativeFile(contenu, new File((String)parameters.get("pathLayout")), 4); + + return pathRelative; } return null; } catch (final IOException e) { @@ -109,7 +113,7 @@ if (data == null) return; try { - final File contenu = new File((String) data); + final File contenu = new File((String)parameters.get("pathLayout")+File.separator+(String) data); final InputStream ips = new FileInputStream(contenu); final InputStreamReader ipsr = new InputStreamReader(ips); final BufferedReader br = new BufferedReader(ipsr); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.Map; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheModel; @@ -125,8 +126,8 @@ // TODO Auto-generated catch block e.printStackTrace(); } - - return pathUnique; + String pathRelative=CtuluLibFile.getRelativeFile(new File(pathUnique), new File((String)parameters.get("pathLayout")), 4); + return pathRelative; } public void setPersistData(final Object data, final Map parameters) { @@ -134,7 +135,7 @@ EGGrapheModel modele = null; if (data == null) modele = new EGGrapheTreeModel(); else { - final String pathGraphe = (String) data; + final String pathGraphe = (String)parameters.get("pathLayout")+File.separator+(String) data; try { pn_ = new EGFillePanel(new EGGraphePersist(pathGraphe).loadPersitGrapheXml(parameters)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -83,7 +83,7 @@ JComponent right_; JComponent[] tools_; - String previousTitleFrame = getTitle(); + public String previousTitleFrame = getTitle(); /** * Toolbar modifiable qui se met a jour selon la selection de la widget. */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-20 13:23:25 UTC (rev 4083) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-20 16:31:59 UTC (rev 4084) @@ -21,6 +21,7 @@ import javax.swing.JInternalFrame; import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.CtuluRemoveContentDirectory; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluFileChooser; @@ -92,7 +93,7 @@ public final static String DESCRIPTORSOURCE = "sources" + EXTENSION; public final static String BALISESOURCES = "SourcesList"; public static String ATTRIBUTESOURCE = "FICHIER"; - public final static String FileWidgetNames = "FramesNames"; + public final static String FileWidgetNames = "FramesNames"+ EXTENSION; /** * Le projet a persiter */ @@ -298,9 +299,10 @@ final int nbFichiersToGenrate = trprojet_.impl_.getAllLayoutFille().size(); out.writeInt(nbFichiersToGenrate); for (int i = 0; i < nbFichiersToGenrate; i++) { - // creation du fichier de desciption des scenes - final String nomFichierLayout = projet_.getAbsolutePath() + File.separator + DESCRIPTORSCENE + (i + 1) - + EXTENSION; + // creation du fichier de desciption des scenes dans le repertoire de meme nom. + final String nomFichierLayout =/* projet_.getAbsolutePath() + File.separator +*/ DESCRIPTORSCENE + (i + 1) + + EXTENSION+ File.separator + DESCRIPTORSCENE + (i + 1) + EXTENSION; + out.writeObject(nomFichierLayout); } @@ -338,8 +340,11 @@ final int nbFichiersToGenrate = in.readInt(); for (int i = 0; i < nbFichiersToGenrate; i++) { - // creation du fichier de desciption des scenes - final String nomFichierLayout = (String) in.readObject(); + + //-- recuperation du path relatif vers le fichier de la scene --// + String pathRelatif=(String) in.readObject(); + // creation du fichier de desciption des scenes + final String nomFichierLayout = projet_.getAbsolutePath()+File.separator+pathRelatif; listeFiles.add(nomFichierLayout); } } catch (final FileNotFoundException e) { @@ -582,53 +587,18 @@ if (savePersistDirectory(saveAs)) { // -- etape 1: creation du repertoire des graphe et calques --// - final String pathGraphes = projet_.getAbsolutePath() + File.separator + "Graphes"; - try { - File fichierGraphes=new File(pathGraphes); - if(fichierGraphes.isDirectory()){ - //-- on le nettoie --// - CtuluRemoveContentDirectory.contentDirectoryRemover(fichierGraphes); - - }else - fichierGraphes.mkdir(); - } catch (final Exception e) { - // pas grave on continue - FuLog.debug("Le repertoire des graphes existe deja"); - } - final String pathCalques = projet_.getAbsolutePath() + File.separator + "Calques"; - try { - File fichierCalques=new File(pathCalques); - if(fichierCalques.isDirectory()){ - //-- on le nettoie --// - CtuluRemoveContentDirectory.contentDirectoryRemover(fichierCalques); - - }else - fichierCalques.mkdir(); - } catch (final Exception e) { - // pas grave on continue - FuLog.debug("Le repertoire des calques existe deja"); - } - final String pathVariables = projet_.getAbsolutePath() + File.separator + "Variables"; - try { - new File(pathVariables).mkdir(); - } catch (final Exception e) { - // pas grave on continue - FuLog.debug("Le repertoire des variables existe deja"); - } - final String pathText = projet_.getAbsolutePath() + File.separator + "Textes"; - try { - File fichierText=new File(pathText); - if(fichierText.isDirectory()){ - //-- on le nettoie --// - CtuluRemoveContentDirectory.contentDirectoryRemover(fichierText); - - }else - fichierText.mkdir(); - } catch (final Exception e) { - // pas grave on continue - FuLog.debug("Le repertoire des textes existe deja"); - } - + final String pathVariables = projet_.getAbsolutePath() + File.separator + "Variables"; + try { + new File(pathVariables).mkdir(); + } catch (final Exception e) { + // pas grave on continue + FuLog.debug("Le repertoire des variables existe deja"); + } + + + + + // -- sauvegarde du projet setup --// saveSetup(projet_.getAbsolutePath()); @@ -641,18 +611,15 @@ // -- etape 3 sauvegarde des ebliscene unitairement --// progression("Cr\xE9ation des fichiers layout", 20); - // -- creation des params pour les datas --// - parametres.put("path", projet_.getAbsolutePath()); - parametres.put("pathGraphes", pathGraphes); - parametres.put("pathCalques", pathCalques); - parametres.put("pathTexte", pathText); + // -- creation de la list des noms des widgets final List<EbliWidgetSerializeXml.CoupleNomId> listeNomsComposants = new ArrayList<CoupleNomId>(); int cpt = 1; final List<TrPostLayoutFille> listFilles = trprojet_.impl_.getAllLayoutFille(); for (final TrPostLayoutFille fille : listFilles) { - final String title = fille.getTitle(); + //-- on ne recupere le getTitle de la frame pour eviter le cas : je recup le titre du path du ficheir resultata si je suis en mode edit de graphe ou calque.... --// + final String title = fille.previousTitleFrame; final EbliScene scene = fille.getScene(); if (listFilles.size() != 0) progression("Cr\xE9ation du fichier du layout " + title, 20 + 70 / listFilles.size()); file = new File(projet_.getAbsolutePath() + File.separator + DESCRIPTORSCENE + cpt + EXTENSION); @@ -660,7 +627,7 @@ parametres.put("dimensions", fille.getSize()); parametres.put("location", fille.getLocation()); parametres.put("scene", scene); - savePersitSceneXml(scene, title, file, parametres, listeNomsComposants); + savePersitSceneXml(scene, title, file, parametres, listeNomsComposants,cpt); cpt++; } @@ -788,7 +755,7 @@ file = new File(projet_.getAbsolutePath() + File.separator + FileWidgetNames); final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms = loadNomsFrames(file); - final int cpt = 1; + int cpt = 1; for (final String fichier : listeFichiers) { file = new File(fichier); @@ -799,7 +766,8 @@ // -- sauvegarde du persitant --// trprojet_.getImpl().addInternalFrame(postFrame); - loadPersitSceneXml(file, postFrame, parametres, listeCouplesNoms); + String nomRepertoireLayout=DESCRIPTORSCENE + (cpt++) + EXTENSION; + loadPersitSceneXml(file, postFrame, parametres, listeCouplesNoms,nomRepertoireLayout); } // -- etape 6; lecture des variables --// @@ -839,14 +807,76 @@ return xstream; } + + private void fillMapWithDataPath(final Map parametres,String repertoireLayout){ + final String pathGraphes = projet_.getAbsolutePath()+ File.separator +repertoireLayout+ File.separator + "Graphes"; + try { + File fichierGraphes=new File(pathGraphes); + if(fichierGraphes.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierGraphes); + + }else + fichierGraphes.mkdir(); + } catch (final Exception e) { + // pas grave on continue + FuLog.debug("Le repertoire des graphes existe deja"); + } + final String pathCalques = projet_.getAbsolutePath()+ File.separator+repertoireLayout + File.separator + "Calques"; + try { + File fichierCalques=new File(pathCalques); + if(fichierCalques.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierCalques); + + }else + fichierCalques.mkdir(); + } catch (final Exception e) { + // pas grave on continue + FuLog.debug("Le repertoire des calques existe deja"); + } + + final String pathText = projet_.getAbsolutePath()+ File.separator+repertoireLayout+ File.separator + "Textes"; + try { + File fichierText=new File(pathText); + if(fichierText.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierText); + + }else + fichierText.mkdir(); + } catch (final Exception e) { + // pas grave on continue + FuLog.debug("Le repertoire des textes existe deja"); + } + // -- creation des params pour les datas --// + parametres.put("path", projet_.getAbsolutePath()); + parametres.put("pathLayout", projet_.getAbsolutePath()+ File.separator +repertoireLayout); + parametres.put("pathGraphes", pathGraphes); + parametres.put("pathCalques", pathCalques); + parametres.put("pathTexte", pathText); + + } + + /** * Utilise xstream pour serializer les parametres scene, widget * * @throws IOException */ - private void savePersitSceneXml(final EbliScene scene, final String title, final File file, final Map parametres, - final List<EbliWidgetSerializeXml.CoupleNomId> listeNomsComposants) { + private void savePersitSceneXml(final EbliScene scene, final String title, File file, final Map parametres, + final List<EbliWidgetSerializeXml.CoupleNomId> listeNomsComposants,int cpt) { + + //-- creation du repertoire du layout layoutN.POST--// + file.mkdir(); + + //-- remplissage de la map avec les r\xE9pertoires calques/graphes/textes --// + fillMapWithDataPath(parametres,DESCRIPTORSCENE + cpt + EXTENSION); + + //-- mise en place du fichier decrivant le contenu du layout --// + file=new File(file.getAbsolutePath()+ File.separator + DESCRIPTORSCENE + cpt + EXTENSION); + // -- outputstream du xstream --// ObjectOutputStream out = null; try { @@ -938,11 +968,12 @@ * @throws InstantiationException */ private void loadPersitSceneXml(final File file, final TrPostLayoutFille fille, final Map parametres, - final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms) { + final List<EbliWidgetSerializeXml.CoupleNomId> listeCouplesNoms,String repertoireLayout) { final EbliScene scenToUpdate = fille.getScene(); parametres.put("scene", scenToUpdate); - + parametres.put("pathLayout", projet_.getAbsolutePath()+ File.separator +repertoireLayout); + // -- inputstream du xstream --// ObjectInputStream in = null; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-10-20 13:23:36
|
Revision: 4083 http://fudaa.svn.sourceforge.net/fudaa/?rev=4083&view=rev Author: bmarchan Date: 2008-10-20 13:23:25 +0000 (Mon, 20 Oct 2008) Log Message: ----------- Edition possible sur tout objet selectionn?\195?\169, m?\195?\170me quand l'objet selectionn?\195?\169 n'est pas dans le calque selectionn?\195?\169. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorInterface.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.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/ZCalqueSelectionInteractionAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -31,6 +31,7 @@ import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ebli.calque.edition.ZEditorDefault; import org.fudaa.ebli.commun.EbliActionMap; import org.fudaa.ebli.commun.EbliEnum; import org.fudaa.ebli.commun.EbliLib; @@ -126,6 +127,9 @@ /** La scene */ private ZScene scene_=null; + + /** L'editeur par defaut (pour la commande Edit notamment) */ + protected ZEditorDefault editor_=null; public final ZSelectionTrace getTrace() { return trace_; @@ -342,6 +346,10 @@ protected boolean editionAsked() { return false; } + + public void setEditor(ZEditorDefault _editor) { + editor_=_editor; + } /** * Methode invoquee quand on lache un bouton de la souris. <br> Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -16,6 +16,7 @@ import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ebli.calque.edition.ZEditorDefault; import org.fudaa.ebli.commun.EbliSelectionMode; import org.fudaa.ebli.commun.EbliSelectionState; import org.fudaa.ebli.geometrie.GrBoite; @@ -30,7 +31,7 @@ public class ZCalqueSelectionInteractionSimple extends ZCalqueSelectionInteractionAbstract { // private ZCalqueAffichageDonneesInterface zcalquesActif_; - + /** * Cr\xE9ation d'un calque de s\xE9lection sans objets s\xE9lectionnables. */ @@ -40,7 +41,7 @@ protected boolean editionAsked() { // if (getScene() != null) { - return internalGetScene().editSelected(); + return editor_.edit()!=null; // return true; // } // return false; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -390,11 +390,14 @@ } controller_ = _controller; controller_.setView(this); - + scene_=new ZScene(gcDonnees_,controller_.getCqSelectionI()); scene_.setRestrictedToCalqueActif(true); scene_.addSelectionListener(this); modelArbre_.addTreeModelListener(scene_); + + gisEditor_=createGisEditor(); + controller_.getCqSelectionI().setEditor(gisEditor_); } protected ZEditorDefault createGisEditor() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -642,15 +642,6 @@ } } - public boolean editSelected() { - FuLog.warning("ZScene.editSelected() bad implementation"); - if (cqActif_ != null && cqActif_ instanceof ZCalqueAffichageDonneesInterface) { - ((ZCalqueAffichageDonneesInterface)cqActif_).editSelected(); - return true; - } - return false; - } - /** * Peut \xEAtre de taille = 0. Pas null. * @return Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -48,7 +48,7 @@ } public String editSelected() { - return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(this); + return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(); } private void addPoint(final int _ligneIdx, final int _idxBefore, final double _x, final double _y, final CtuluCommandContainer _cmd) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -50,7 +50,7 @@ } public String editSelected() { - return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(this); + return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(); } // /** Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -127,7 +127,7 @@ } public String editSelected() { - return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(this); + return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -720,18 +720,7 @@ sceneEditor_.setMng(_mng); } - public void editSelectedLayer() { - if (isEditable(getSupport().getCalqueActif())) { - edit(getSupport().getCalqueActif()); - } - } - - /** - * Contrairement \xE0 ce que laisse penser le prototype, cette fonction lance - * l'\xE9dition des g\xE9om\xE9tries quelque soit le calque dans lequel les g\xE9om\xE9tries - * sont selectionn\xE9. Le param\xE8tre _target, n'est pas utilis\xE9. - */ - public String edit(final Object _target) { + public String edit() { // R\xE9cup\xE9ration des calques contenant des g\xE9om\xE9tries selectionn\xE9es \\ ZCalqueAffichageDonneesInterface[] calques=panel_.getScene().getAllLayers(); ArrayList<ZCalqueAffichageDonneesInterface> claquesWithSelectedObjects=new ArrayList<ZCalqueAffichageDonneesInterface>(); @@ -743,20 +732,16 @@ return EbliLib.getS("La s\xE9lection courante est vide"); else if (claquesWithSelectedObjects.size()>1){ ui_.warn("Information", "La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition.", false); - /*BuInternalFrame i = new BuInternalFrame("Information", false, true, false, false); - i.add(new BuLabel("La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition.")); - i.setVisible(true); - i.*/ return EbliLib.getS("La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition."); } ZCalqueEditable calque=(ZCalqueEditable)claquesWithSelectedObjects.get(0); // G\xE9n\xE9ration d'une boite d'\xE9dition selon le type de selection et d'\xE9dition \\ if (((ZCalqueEditable)calque).isAtomicMode()) - editVertexObject((ZCalqueEditable)calque); + editVertexObject(calque); else if (calque.isOnlyOneObjectSelected()) // Une seule g\xE9om\xE9trie est \xE0 \xE9diter - editSingleObject((ZCalqueEditable)claquesWithSelectedObjects.get(0)); + editSingleObject(calque); else { // Plusieurs g\xE9om\xE9tries sont \xE0 \xE9diter CtuluDialogPanel pn=null; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorInterface.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorInterface.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorInterface.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -27,11 +27,10 @@ boolean isEditable(final Object _target); /** - * Edition pour la cible donn\xE9e. L'edition peutr concerner la cible elle m\xEAme ou ce qu'elle contient. - * @param _target La cible editable. + * Edition pour la selection quelque soit le calque selectionn\xE9. * @return Une information sur le deroulement de l'op\xE9ration d'edition. Si null, tout s'est bien pass\xE9. */ - String edit(final Object _target); + String edit(); /** * @param _o la cible * @param _palette la palette associ\xE9e Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -324,7 +324,7 @@ } public void actionPerformed(final ActionEvent _e) { - editSelectedLayer(); + edit(); } public void updateStateBeforeShow() { 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-20 09:47:19 UTC (rev 4082) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-10-20 13:23:25 UTC (rev 4083) @@ -70,7 +70,6 @@ mng_ = new CtuluCommandManager(); setModeVisible(true); setEbliFormatter(new EbliFormatter()); - gisEditor_ = createGisEditor(); gisEditor_.setUi(getImpl()); // Le calque des infos. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-20 09:52:21
|
Revision: 4082 http://fudaa.svn.sourceforge.net/fudaa/?rev=4082&view=rev Author: emmanuel_martin Date: 2008-10-20 09:47:19 +0000 (Mon, 20 Oct 2008) Log Message: ----------- am?\195?\169lioration mineur et correction de bugs dans le wizard d'import du modeleur Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadBERReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadPROReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadSEMReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/telemac/io/SinusxReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImport.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImportStepDestination.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -386,19 +386,20 @@ public final boolean addAll(final Object[] _obj, final List _o, final CtuluCommandContainer _cmd) { if (canAdd(_obj)) { - final int idx = list_.size(); - list_.addAll(Arrays.asList(_obj)); - CtuluCommandCompositeInverse cmd = null; - if (_cmd != null) { - cmd = new CtuluCommandCompositeInverse(); + if (_obj.length>0) { + final int idx=list_.size(); + list_.addAll(Arrays.asList(_obj)); + CtuluCommandCompositeInverse cmd=null; + if (_cmd!=null) { + cmd=new CtuluCommandCompositeInverse(); + } + internActionPointAdded(_o, cmd, _obj.length); + if (_cmd!=null&&cmd!=null) { + cmd.addCmd(new CommandAddAll(idx, _obj)); + _cmd.addCmd(cmd.getSimplify()); + } + fireObjectAdded(); } - internActionPointAdded(_o, cmd, _obj.length); - if (_cmd != null && cmd != null) { - cmd.addCmd(new CommandAddAll(idx, _obj)); - _cmd.addCmd(cmd.getSimplify()); - } - - fireObjectAdded(); return true; } return false; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadBERReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadBERReader.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadBERReader.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -70,7 +70,7 @@ private synchronized GISZoneCollectionLigneBrisee readBerges() { GISZoneCollectionLigneBrisee polys = new GISZoneCollectionLigneBrisee(); polys.setAttributes(new GISAttribute[]{GISAttributeConstants.BATHY}, null); - if(polys.getAttributeIsZ()!=null) + if(polys.getAttributeIsZ()==null) polys.setAttributeIsZ(GISAttributeConstants.BATHY); polys.setTitle(name_, null); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadPROReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadPROReader.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadPROReader.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -73,7 +73,7 @@ private synchronized GISZoneCollectionLigneBrisee readProfils() { GISZoneCollectionLigneBrisee polys = new GISZoneCollectionLigneBrisee(); polys.setAttributes(new GISAttribute[]{GISAttributeConstants.BATHY, GISAttributeConstants.TITRE}, null); - if(polys.getAttributeIsZ()!=null) + if(polys.getAttributeIsZ()==null) polys.setAttributeIsZ(GISAttributeConstants.BATHY); polys.setTitle(name_, null); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadSEMReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadSEMReader.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/ReflucadSEMReader.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -68,7 +68,7 @@ private synchronized GISZoneCollectionPoint readSemis() { GISZoneCollectionPoint pts = new GISZoneCollectionPoint(); pts.setAttributes(new GISAttribute[]{GISAttributeConstants.BATHY}, null); - if(pts.getAttributeIsZ()!=null) + if(pts.getAttributeIsZ()==null) pts.setAttributeIsZ(GISAttributeConstants.BATHY); pts.setTitle(name_, null); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -148,7 +148,7 @@ final GISZoneCollectionLigneBrisee zligs = new GISZoneCollectionLigneBrisee(null); zligs.addAllLineStringClosedOrNode((LineString[]) lignes.toArray(new LineString[lignes.size()]), null); zligs.setAttributes(new GISAttributeInterface[] { GISAttributeConstants.BATHY, GISAttributeConstants.TITRE, GISAttributeConstants.NATURE}, null); - if(zligs.getAttributeIsZ()!=null) + if(zligs.getAttributeIsZ()==null) zligs.setAttributeIsZ(GISAttributeConstants.BATHY); zligs.postImport(0); @@ -177,7 +177,7 @@ zdirs.addAllLineStringClosedOrNode(ldirs, null); zdirs.setAttributes(new GISAttributeInterface[] { GISAttributeConstants.BATHY, GISAttributeConstants.TITRE, GISAttributeConstants.NATURE}, null); - if(zdirs.getAttributeIsZ()!=null) + if(zdirs.getAttributeIsZ()==null) zdirs.setAttributeIsZ(GISAttributeConstants.BATHY); zdirs.postImport(0); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/telemac/io/SinusxReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/telemac/io/SinusxReader.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/telemac/io/SinusxReader.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -216,7 +216,7 @@ analyze_.addWarn(H2dResource.getS("Profils non g\xE9r\xE9s"), in_.getLineNumber()); pt = defZone.createPointContainer(); pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; // pt.setTitle("profil", null); @@ -226,13 +226,13 @@ ptDefZone = defZone.createPointContainer(); pt = ptDefZone; pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; } else { pt = defZone.createPointContainer(); pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; // pt.setTitle(name_ + " " + (idx++), null); @@ -242,7 +242,7 @@ analyze_.addWarn(H2dResource.getS("TYPE inconnu : assimil\xE9 a un semis"), in_.getLineNumber()); pt = defZone.createPointContainer(); pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; // pt.setTitle(H2dResource.getS("type inconnu"), null); @@ -254,14 +254,14 @@ ptDefZone = defZone.createPointContainer(); pt = ptDefZone; pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; name=name_+" "+(idx); } else { pt = defZone.createPointContainer(); pt.setAttributes(attPts, null); - if(pt.getAttributeIsZ()!=null) + if(pt.getAttributeIsZ()==null) pt.setAttributeIsZ(GISAttributeConstants.BATHY); idx++; name=name_+" "+(idx); @@ -355,7 +355,7 @@ if (_polygones == null) { _polygones = _defZone.createPolygoneContainer(); _polygones.setAttributes(atts, null); - if(_polygones.getAttributeIsZ()!=null) + if(_polygones.getAttributeIsZ()==null) _polygones.setAttributeIsZ(GISAttributeConstants.BATHY); } _polyligneXyz.add(_polyligneXyz.getQuick(0)); @@ -370,7 +370,7 @@ if (_polylignes == null) { _polylignes = _defZone.createPolyligneContainer(); _polylignes.setAttributes(atts, null); - if(_polylignes.getAttributeIsZ()!=null) + if(_polylignes.getAttributeIsZ()==null) _polylignes.setAttributeIsZ(GISAttributeConstants.BATHY); } if (_niveau) Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImport.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImport.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImport.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -52,7 +52,6 @@ import org.fudaa.fudaa.sig.FSigGeomSrcData; import org.fudaa.fudaa.sig.FSigLib; import org.fudaa.fudaa.sig.wizard.FSigFileLoaderPanel; -import org.fudaa.fudaa.sig.wizard.FSigWizardImportHelper; import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuGlassPaneStop; @@ -283,14 +282,17 @@ } public String getStepText() { - if (super.current_ == 0) { - final StringBuffer r = new StringBuffer(); - r.append(CtuluLibString.LINE_SEP + FSigLib.getS("Les formats des fichiers sont choisis en fonction des extensions.")); - r.append(CtuluLibString.LINE_SEP + FSigLib.getS("Il est possible de les modifier dans la colonne 'Format'.")); - r.append(CtuluLibString.LINE_SEP + FSigLib.getS("La derni\xE8re colonne permet de sp\xE9cifier la tra\xE7abilit\xE9 des fichiers.")); - return r.toString(); + final StringBuffer r=new StringBuffer(); + if (super.current_==0) { + r.append(FSigLib.getS("Les formats des fichiers sont choisis en fonction des extensions.")); + r.append(CtuluLibString.LINE_SEP+FSigLib.getS("Il est possible de les modifier dans la colonne 'Format'.")); + r.append(CtuluLibString.LINE_SEP+FSigLib.getS("La derni\xE8re colonne permet de sp\xE9cifier la tra\xE7abilit\xE9 des fichiers.")); } - return FSigLib.getS("Pr\xE9ciser les calques et les attributs \xE0 modifier"); + else if (super.current_==1) { + r.append(FSigLib.getS("Pr\xE9ciser les calques et les attributs \xE0 modifier")); + r.append(CtuluLibString.LINE_SEP+FSigLib.getS("Le cadre 'Attributs' permet de mapper les attributs lus avec les attributs permis par le calque choisi dans le tableau.")); + } + return r.toString(); } public String getStepTitle() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImportStepDestination.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImportStepDestination.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlWizardImportStepDestination.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -22,6 +22,7 @@ import javax.swing.AbstractCellEditor; import javax.swing.JPanel; import javax.swing.JTable; +import javax.swing.UIManager; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ListSelectionEvent; @@ -195,12 +196,20 @@ public class ImportTableRenderer implements TableCellRenderer { public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected, boolean _hasFocus, int _row, int _column) { + Color selectionBackground = UIManager.getColor("Table.selectionBackground"); + JPanel pn=new JPanel(); + pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + if(_isSelected) + pn.setBackground(selectionBackground); + else + pn.setBackground(Color.WHITE); + if (_column==2) { - JPanel pn=new JPanel(); - pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - pn.setBackground(Color.WHITE); BuCheckBox cb=new BuCheckBox("", (Boolean)_value); - cb.setBackground(Color.WHITE); + if(_isSelected) + cb.setBackground(selectionBackground); + else + cb.setBackground(Color.WHITE); pn.add(cb); return pn; } @@ -210,20 +219,26 @@ value=FSigLib.getS(value); BuLabel lbl =new BuLabel(value); lbl.setHorizontalAlignment(BuLabel.CENTER); - return lbl; + if(_isSelected) + lbl.setBackground(selectionBackground); + pn.add(lbl); + return pn; } else if (_column==1){ BuLabel lbl =new BuLabel(_value.toString()); lbl.setHorizontalAlignment(BuLabel.CENTER); - return lbl; + if(_isSelected) + lbl.setBackground(selectionBackground); + pn.add(lbl); + return pn; } else { BuLabel lbl =new BuLabel(_value.toString()); lbl.setHorizontalAlignment(BuLabel.CENTER); - if(_isSelected){ - lbl.setText("<html><b>"+lbl.getText()+"</b></html>"); - } - return lbl; + if(_isSelected) + lbl.setBackground(selectionBackground); + pn.add(lbl); + return pn; } } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java 2008-10-17 17:12:25 UTC (rev 4081) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java 2008-10-20 09:47:19 UTC (rev 4082) @@ -169,7 +169,7 @@ t_.getColumnModel().getColumn(1).setCellEditor(new ComboCellEditor(renderer)); } - final String ignoreObject_ = FSigLib.getS("Ignorer"); + final String ignoreObject_ = FSigLib.getS("< Ignorer >"); /** * @return la table utilisee pour editer les correspondance source->destination @@ -207,10 +207,10 @@ final GISAttributeInterface[] attributes = (GISAttributeInterface[]) srcClassDestValid_.get(src_[_row] .getDataClass()); cbModel_.removeAllElements(); + cbModel_.addElement(ignoreObject_); if (_value != null && !_value.equals(ignoreObject_)) { cbModel_.addElement(_value); } - cbModel_.addElement(ignoreObject_); if (attributes != null) { for (int i = 0; i < attributes.length; i++) { if (CtuluLibArray.findObjectEgalEgal(FSigExportImportAttributesMapper.this.model_.selectedAttributes_, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-17 17:12:37
|
Revision: 4081 http://fudaa.svn.sourceforge.net/fudaa/?rev=4081&view=rev Author: hadouxad Date: 2008-10-17 17:12:25 +0000 (Fri, 17 Oct 2008) Log Message: ----------- - Meilleure gestion des id des sources: plus coh?\195?\169rent, g?\195?\169r?\195?\169 par le trpostprojet, ajoute le nom du fichier r?\195?\169sultat a la var al?\195?\169atoire - Gestion des groupes et fusion des calques. Les 2 sont bien g?\195?\169r?\195?\169es - Gestion du nettoyage du r?\195?\169pertoire de sauvegarde poru les ?\195?\169crasements de sauvegarde avec donn?\195?\169es diff?\195?\169rentes. - Gestion de plusieurs l?\195?\169gendes pour un seul calque - Gestion de la persistance des l?\195?\169gendes calques - Plus gros travail fourni que pour les graphes - Enregistrement du type de calque dont la l?\195?\169gende est construite Le chargement des l?\195?\169gendes est foireux pour le moment.... Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibGenerator.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModelPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetGroupSerializeXml.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibGenerator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibGenerator.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibGenerator.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -4,6 +4,8 @@ import java.util.Calendar; import java.util.List; +import com.memoire.fu.FuLib; + /** * Generateur d'Id uniques en singleton. * Gere des contraintes (id ajout\xE9s, retir\xE9s) @@ -121,6 +123,12 @@ return ""+deliverUniqueId(); } + + public String deliverUniqueStringId(String name){ + + return FuLib.clean(name)+deliverUniqueId(); + } + /** * Clear la liste des contraintes */ Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -40,8 +40,7 @@ listing = Finit.listFiles(); - // tant qu'il y a des sous repertoires .... - while (listing.length > 0) { + // poiur chaque sous repertoire ... for (int i = 0; i < listing.length; i++) { // ...on verifie si c'est des fichier ... @@ -53,12 +52,13 @@ + b); } // si c'est un repertoire on demare une methode... -// else{ -// // on demare la methode -// removeDirectoryContentRecursivly(listing[i]); -// } + else{ + // on demare la methode + removeDirectoryContentRecursivly(listing[i]); + listing[i].delete(); + } } - } + } @@ -86,6 +86,10 @@ removeDirectoryContentRecursivly(listing2[i]); } } + + //-- on finit par supprimer le directory, sinon loop infinie garantie! --// + ToDel.delete(); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -12,6 +12,7 @@ import javax.swing.JPanel; import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.palette.BPalettePlageInterface; @@ -39,196 +40,196 @@ @SuppressWarnings("serial") public class CalqueLegendeWidgetAdapter extends BCalqueLegende { - /** - * Mananger statique qui se charge de creer \xE9a widget associee au calque. - * - * @param _calqueLegende le panel legende qui sera recopie version widget - * @param _scene la scene - * @return la widfget de la legende. - */ - public static EbliWidgetCalqueLegende updateLegendeWidget(final EbliWidgetCalqueLegende _widgetLegende, - final BCalqueLegendePanel _calqueLegende, final EbliScene _scene) { + /** + * Mananger statique qui se charge de creer \xE9a widget associee au calque. + * + * @param _calqueLegende le panel legende qui sera recopie version widget + * @param _scene la scene + * @return la widfget de la legende. + */ + public static EbliWidgetCalqueLegende updateLegendeWidget(final EbliWidgetCalqueLegende _widgetLegende, + final BCalqueLegendePanel _calqueLegende, final EbliScene _scene) { - // --creation de la widget conteneur --// - BPalettePlageInterface listeplages = null; - // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, - // _calqueLegende); - _widgetLegende.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); - _widgetLegende.setBorder(BorderFactory.createEmptyBorder(10)); + // --creation de la widget conteneur --// + BPalettePlageInterface listeplages = null; + // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, + // _calqueLegende); + _widgetLegende.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); + _widgetLegende.setBorder(BorderFactory.createEmptyBorder(10)); - if (_calqueLegende != null) { - final Component[] listeC = _calqueLegende.getComponents(); + if (_calqueLegende != null) { + final Component[] listeC = _calqueLegende.getComponents(); - for (int i = 0; i < listeC.length; i++) { - final Component c = listeC[i]; - if (c instanceof JLabel) { + for (int i = 0; i < listeC.length; i++) { + final Component c = listeC[i]; + if (c instanceof JLabel) { - final LabelWidget titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(((JLabel) c).getText()); - titre.setEnabled(true); - titre.setFont(c.getFont()); - _widgetLegende.addChild(titre); - } + final LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) c).getText()); + titre.setEnabled(true); + titre.setFont(c.getFont()); + _widgetLegende.addChild(titre); + } - if (c instanceof BPalettePlageLegende) { + if (c instanceof BPalettePlageLegende) { - final BPalettePlageLegende pal = (BPalettePlageLegende) c; + final BPalettePlageLegende pal = (BPalettePlageLegende) c; - // --recuperation de la liste des plages --// - listeplages = pal.getModel(); + // --recuperation de la liste des plages --// + listeplages = pal.getModel(); + if(listeplages!=null){ + // --creation du titre --// + LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(listeplages.getTitre()); + titre.setFont(pal.getFont()); + titre.setEnabled(true); + _widgetLegende.addChild(titre); + final LabelWidget sstitre = new LabelWidget(_scene); + sstitre.setAlignment(Alignment.CENTER); + titre.setFont(pal.getFont()); + sstitre.setVerticalAlignment(VerticalAlignment.CENTER); + sstitre.setLabel(listeplages.getSousTitre()); + sstitre.setEnabled(true); + _widgetLegende.addChild(sstitre); + final Widget ws = new Widget(_scene); + ws.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 5)); + if (listeplages.getNbPlages() != 0) { + for (int j = 0; j < listeplages.getNbPlages(); j++) { - // --creation du titre --// - LabelWidget titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(listeplages.getTitre()); - titre.setFont(pal.getFont()); - titre.setEnabled(true); - _widgetLegende.addChild(titre); - final LabelWidget sstitre = new LabelWidget(_scene); - sstitre.setAlignment(Alignment.CENTER); - titre.setFont(pal.getFont()); - sstitre.setVerticalAlignment(VerticalAlignment.CENTER); - sstitre.setLabel(listeplages.getSousTitre()); - sstitre.setEnabled(true); - _widgetLegende.addChild(sstitre); - final Widget ws = new Widget(_scene); - ws.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 5)); - if (listeplages.getNbPlages() != 0) { - for (int j = 0; j < listeplages.getNbPlages(); j++) { + final BPlageInterface plage = listeplages.getPlageInterface(j); - final BPlageInterface plage = listeplages.getPlageInterface(j); + // -- ajout d'une widget plage --// + final EbliWidgetPlage lw = new EbliWidgetPlage(_scene, plage, null); - // -- ajout d'une widget plage --// - final EbliWidgetPlage lw = new EbliWidgetPlage(_scene, plage, null); + lw.setUseBorder(false); + lw.setEnabled(true); - lw.setUseBorder(false); - lw.setEnabled(true); + ws.addChild(lw); - ws.addChild(lw); + } + } else { + // liste des plages est vide il s agit d une autre legende + final Component[] lcomp = pal.getComponents(); + for (int j = 0; j < lcomp.length; j++) { + final Component co = lcomp[j]; - } - } else { - // liste des plages est vide il s agit d une autre legende - final Component[] lcomp = pal.getComponents(); - for (int j = 0; j < lcomp.length; j++) { - final Component co = lcomp[j]; + if (co instanceof JPanel) { + final JPanel panel = (JPanel) co; - if (co instanceof JPanel) { - final JPanel panel = (JPanel) co; + for (int k = 0; k < panel.getComponents().length; k++) { - for (int k = 0; k < panel.getComponents().length; k++) { + if (panel.getComponents()[k] instanceof JLabel) { + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); + titre.setEnabled(true); + ws.addChild(titre); + } else if (panel.getComponents()[k] instanceof JList) { + final JList jlst = (JList) panel.getComponents()[k]; + for (int g = 0; g < jlst.getModel().getSize(); g++) { + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel((String) jlst.getModel().getElementAt(g)); + titre.setEnabled(true); + ws.addChild(titre); + } - if (panel.getComponents()[k] instanceof JLabel) { - titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); - titre.setEnabled(true); - ws.addChild(titre); - } else if (panel.getComponents()[k] instanceof JList) { - final JList jlst = (JList) panel.getComponents()[k]; - for (int g = 0; g < jlst.getModel().getSize(); g++) { - titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel((String) jlst.getModel().getElementAt(g)); - titre.setEnabled(true); - ws.addChild(titre); - } + } - } + } - } + } - } + } - } + } + _widgetLegende.addChild(ws); + _widgetLegende.setLegendsWidget(ws); + }//fin du if listeplage==null + } + } - } - _widgetLegende.addChild(ws); - _widgetLegende.setLegendsWidget(ws); - } + _widgetLegende.setController(new EbliWidgetControllerLegendeCalque(_widgetLegende)); - } + // -- prendre en compte le resize automatique --// + _widgetLegende.getEbliScene().refresh(); + // _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); - _widgetLegende.setController(new EbliWidgetControllerLegendeCalque(_widgetLegende)); + return _widgetLegende; + } else { + FuLog.warning("createLegendeWidget retourne widget null"); + return null; + } + } - // -- prendre en compte le resize automatique --// - _widgetLegende.getEbliScene().refresh(); - // _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + // public static Dimension createSizeForWidget(int _nbLibelles) { + // return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + // } - return _widgetLegende; - } else { - FuLog.warning("createLegendeWidget retourne widget null"); - return null; - } - } + public static void reconstructWidget(EbliWidgetCalqueLegende widgetLegende_, + final BCalqueLegendePanel _calqueLegende, final EbliScene _scene/* , BArbreCalqueModel model */) { - // public static Dimension createSizeForWidget(int _nbLibelles) { - // return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); - // } + final EbliWidgetWithBordure parent = (EbliWidgetWithBordure) widgetLegende_.getParentWidget(); - public static void reconstructWidget(EbliWidgetCalqueLegende widgetLegende_, - final BCalqueLegendePanel _calqueLegende, final EbliScene _scene/* , BArbreCalqueModel model */) { + widgetLegende_ = updateLegendeWidget(widgetLegende_, _calqueLegende, _scene); - final EbliWidgetWithBordure parent = (EbliWidgetWithBordure) widgetLegende_.getParentWidget(); + parent.repaint(); - widgetLegende_ = updateLegendeWidget(widgetLegende_, _calqueLegende, _scene); + } - parent.repaint(); + BCalqueLegendePanel legendePanel_; - } + EbliScene scene_; - BCalqueLegendePanel legendePanel_; + public EbliScene getScene() { + return scene_; + } - EbliScene scene_; + public void setScene(final EbliScene _scene) { + scene_ = _scene; + } - public EbliScene getScene() { - return scene_; - } + public CalqueLegendeWidgetAdapter(final EbliScene _scene, final BArbreCalqueModel model) { + super(); + scene_ = _scene; + // modelTreeCalque_ = model; - public void setScene(final EbliScene _scene) { - scene_ = _scene; - } + } - public CalqueLegendeWidgetAdapter(final EbliScene _scene, final BArbreCalqueModel model) { - super(); - scene_ = _scene; - // modelTreeCalque_ = model; + /** + * override de calqueLegende qui recupere le panel legende associe + */ + @Override + protected void addLegendToPanel(final BCalqueLegendePanel _pnLeg) { - } + legendePanel_ = _pnLeg; - /** - * override de calqueLegende qui recupere le panel legende associe - */ - @Override - protected void addLegendToPanel(final BCalqueLegendePanel _pnLeg) { + // createLegende(); + } - legendePanel_ = _pnLeg; + /** + * cree la legende en widget. + * + * @return EbliNode cree ajoute a la scene. + */ + public EbliNode createLegende(final Point _location, final EbliScene _scene, final String id,BCalque calqueCible) { + setScene(_scene); + final EbliNodeDefault def = new EbliNodeDefault(); + def.setPreferedLocation(_location); + // def.setPreferedSize(new Dimension(150, 250)); + def.setCreator(new EbliWidgetCreatorLegende(legendePanel_, id,calqueCible)); + def.setTitle("L\xE9gende calque"); + // TODO non stable + _scene.addNode(def); + _scene.refresh(); - // createLegende(); - } + return def; + } - /** - * cree la legende en widget. - * - * @return EbliNode cree ajoute a la scene. - */ - public EbliNode createLegende(final Point _location, final EbliScene _scene, final String id) { - setScene(_scene); - final EbliNodeDefault def = new EbliNodeDefault(); - def.setPreferedLocation(_location); - // def.setPreferedSize(new Dimension(150, 250)); - def.setCreator(new EbliWidgetCreatorLegende(legendePanel_, id)); - def.setTitle("L\xE9gende calque"); - // TODO non stable - _scene.addNode(def); - _scene.refresh(); - - return def; - } - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -5,8 +5,10 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.swing.JComponent; import javax.swing.JLabel; @@ -20,6 +22,8 @@ import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueAffichage; import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; @@ -60,8 +64,12 @@ /** * widget de la legende */ - CalqueLegendeWidgetAdapter legendeWidget_; + //CalqueLegendeWidgetAdapter legendeWidget_; + Map<BCalque,CalqueLegendeWidgetAdapter> legendeWidget_=new HashMap<BCalque, CalqueLegendeWidgetAdapter>(); + + + BuMenuBar menuCalque_; JComponent panelTreeCalque_; @@ -153,23 +161,34 @@ // final Point nouvellePosition = new Point((widget_.getLocation().x), (int) (widget_.getLocation().y + widget_ // .getBounds().height * 1.2)); - if (!hasLegende()) { +// if (!hasLegende()) { - if (this.legendeWidget_ == null) { - legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); - } + + BCalque calqueActif=widgetCalque_.calquePanel_.getCalqueActif(); + if(calqueActif!=null && calqueActif instanceof BCalqueAffichage){ + if (this.legendeWidget_.get(calqueActif) == null) { + //legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); + legendeWidget_.put(widgetCalque_.calquePanel_.getCalqueActif(), (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend()); + + + CalqueLegendeWidgetAdapter legendeAdapter=this.legendeWidget_.get(calqueActif); + // -- creation de la legende final Point positionLegende = new Point(); if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; positionLegende.y = widget_.getPreferredLocation().y; - setNodeLegende(legendeWidget_.createLegende(positionLegende, widget_.getEbliScene(), widget_.getId())); + setNodeLegende(legendeAdapter.createLegende(positionLegende, widget_.getEbliScene(), widget_.getId(),calqueActif)); } widget_.getEbliScene().refresh(); - } else if (getNodeLegende().hasWidget()) - // -- cas ou la legende existe mais est cach\xE9e --// - getNodeLegende().getWidget().setVisible(true); + } + } +// } else if (getNodeLegende().hasWidget()) +// // -- cas ou la legende existe mais est cach\xE9e --// +// getNodeLegende().getWidget().setVisible(true); + + // GrapheWidget.this.addChild(widgetLegende); } } @@ -305,8 +324,10 @@ return widgetCalque_.calquePanel_; } - public CalqueLegendeWidgetAdapter getLegendeWidget() { - return legendeWidget_; + public CalqueLegendeWidgetAdapter getLegendeWidget(BCalque calqueSelectionne) { + if(calqueSelectionne==null) + return null; + return legendeWidget_.get(calqueSelectionne); } /** @@ -440,8 +461,8 @@ return labelTrace_; } - public void setLegendeWidget(final CalqueLegendeWidgetAdapter _legendeWidget) { - this.legendeWidget_ = _legendeWidget; + public void setLegendeWidget(final CalqueLegendeWidgetAdapter _legendeWidget,BCalque calqueActif) { + this.legendeWidget_.put(calqueActif, _legendeWidget); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -3,8 +3,11 @@ import java.awt.Font; import java.util.Map; +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueAffichage; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -13,6 +16,8 @@ import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; import org.netbeans.api.visual.widget.Widget; +import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException; + /** * Creator pour les legendes des calques * @@ -20,81 +25,114 @@ */ public class EbliWidgetCreatorLegende implements EbliWidgetCreator { - BCalqueLegendePanel g; - // EbliWidget res; - /** - * L'id de la widget qui a declench\xE9 la legende - */ - private String IdPossessor_; - EbliWidgetWithBordure res; + BCalqueLegendePanel g; - // BArbreCalqueModel modelTreeCalque_; + /** + * La cible de la llegende. + * Ce calque appartient au panelde calque. + * Cela permet de g\xE9n\xE9rer une legende par calque + */ + BCalque calqueCible_; + // EbliWidget res; + /** + * L'id de la widget qui a declench\xE9 la legende + */ + private String IdPossessor_; + EbliWidgetWithBordure res; - public EbliWidgetCreatorLegende(final BCalqueLegendePanel g, final String id/* , BArbreCalqueModel model */) { - super(); - this.g = g; - IdPossessor_ = id; - // modelTreeCalque_ = model; - } + // BArbreCalqueModel modelTreeCalque_; - public EbliWidgetCreatorLegende() { + public EbliWidgetCreatorLegende(final BCalqueLegendePanel g, final String id,BCalque calqueCible) { + super(); + this.g = g; + IdPossessor_ = id; + calqueCible_=calqueCible; + // modelTreeCalque_ = model; + } - } + public EbliWidgetCreatorLegende() { - public BCalqueLegendePanel getG() { - return g; - } + } - public void setG(final BCalqueLegendePanel g) { - this.g = g; - } + public BCalqueLegendePanel getG() { + return g; + } - public EbliWidget create(final EbliScene _scene) { - final EbliWidgetCalqueLegende widgetLegende = CalqueLegendeWidgetAdapter.updateLegendeWidget( - new EbliWidgetCalqueLegende(_scene, false, g), g, _scene); - res = new EbliWidgetBordureSingle(widgetLegende, true, true); - widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); - widgetLegende.updateFont(widgetLegende.getFormeFont()); - return res; - } + public void setG(final BCalqueLegendePanel g) { + this.g = g; + } - public EbliWidget getWidget() { - return res; - } + public EbliWidget create(final EbliScene _scene) { + final EbliWidgetCalqueLegende widgetLegende = CalqueLegendeWidgetAdapter.updateLegendeWidget( + new EbliWidgetCalqueLegende(_scene, false, g), g, _scene); + res = new EbliWidgetBordureSingle(widgetLegende, true, true); + widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + widgetLegende.updateFont(widgetLegende.getFormeFont()); + return res; + } - public EbliNode duplicate(final EbliNode _nodeAdupliquer) { - return null; - } + public EbliWidget getWidget() { + return res; + } - public EbliWidgetWithBordure getBordure() { - return res; - } + public EbliNode duplicate(final EbliNode _nodeAdupliquer) { + return null; + } - public Object getPersistData(final Map parameters) { - // -- pour le moment on se contente juste de rejouer la legende --// - return IdPossessor_; - } + public EbliWidgetWithBordure getBordure() { + return res; + } - public void setPersistData(final Object data, final Map parameters) { - if (data == null) g = new BCalqueLegendePanel(new BCalqueLegende(), "empty"); - else { - final String idCalque = (String) data; + public static class CoupleData{ + public String idPosessor; + public int indiceCalqueCible=0; + } - final EbliScene scene = (EbliScene) parameters.get("scene"); - // -- recherche de la widget qui contient l'id et rejouer l'action ajouter legende --// - for (final Widget widget : scene.getLayerVisu().getChildren()) { - EbliWidget candidat = null; - if (widget instanceof EbliWidgetBordureSingle) candidat = ((EbliWidgetBordureSingle) widget).getIntern(); - else candidat = (EbliWidget) widget; + public Object getPersistData(final Map parameters) { + CoupleData data=new CoupleData(); + //-- on recupere l'indice du calque de la legende --// + data.idPosessor=IdPossessor_; - if (candidat.getId().equals(idCalque)) { - // --on a le bon, on rejoue la legende --// - ((EbliWidgetControllerCalque) candidat.getController()).ajoutLegende(); - return; - } - } - } + //-- recuperation du calque --// + EbliWidget widget=getWidget().getEbliScene().findById(IdPossessor_); + if(widget !=null && widget.getController() instanceof EbliWidgetControllerCalque){ + ZEbliCalquesPanel calque=((EbliWidgetControllerCalque) widget.getController()).getVisuPanel(); - } + data.indiceCalqueCible= calque.getArbreCalqueModel().getIndexOfChild(calque.getArbreCalqueModel().getRoot(), calqueCible_); + } + + return data; + } + + + public void setPersistData(final Object data, final Map parameters) { + if (data == null) g = new BCalqueLegendePanel(new BCalqueLegende(), "empty"); + else { + CoupleData datas=(CoupleData) data; + if(data !=null){ + String idCalque = (String) datas.idPosessor; + int indexCalque=datas.indiceCalqueCible; + + if(idCalque!=null){ + final EbliScene scene = (EbliScene) parameters.get("scene"); + // -- recherche de la widget qui contient l'id et rejouer l'action ajouter legende --// + //-- recuperation du calque --// + EbliWidget widget=scene.findById(IdPossessor_); + if(widget !=null && widget.getController() instanceof EbliWidgetControllerCalque){ + ZEbliCalquesPanel calque=((EbliWidgetControllerCalque) widget.getController()).getVisuPanel(); + + //-- recuperation du bon calque --// + calqueCible_= (BCalque) calque.getArbreCalqueModel().getChild(calque.getArbreCalqueModel().getRoot(), indexCalque); + IdPossessor_=idCalque; + g=new BCalqueLegendePanel((BCalqueAffichage) calqueCible_,calqueCible_.getTitle()); + } + + + } + } + } + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -54,8 +54,8 @@ positionLegende.x = _dest.getLocation().x + _dest.getIntern().getPreferredSize().width + 5; positionLegende.y = _dest.getPreferredLocation().y; EbliWidgetVueCalque vue = (EbliWidgetVueCalque) _dest.getIntern(); - vue.nodeLegende = _legende.createLegende(positionLegende, _legende.getScene(), getBordure().getIntern().getId()); - ((EbliWidgetControllerCalque) vue.getController()).setLegendeWidget(_legende); + vue.nodeLegende = _legende.createLegende(positionLegende, _legende.getScene(), getBordure().getIntern().getId(),calque_.getCalqueActif()); + ((EbliWidgetControllerCalque) vue.getController()).setLegendeWidget(_legende,calque_.getCalqueActif()); } public EbliWidget create(EbliScene _scene) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -12,6 +12,7 @@ import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; import org.netbeans.api.visual.widget.Widget; /** @@ -19,7 +20,7 @@ * * @author Adrien Hadoux */ -public final class EbliWidgetFusionCalques extends EbliWidget implements PropertyChangeListener { +public final class EbliWidgetFusionCalques extends EbliWidgetGroup implements PropertyChangeListener { public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetGroupSerializeXml.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetGroupSerializeXml.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetGroupSerializeXml.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -0,0 +1,49 @@ +package org.fudaa.ebli.visuallibrary.persist; + +import java.awt.Dimension; +import java.awt.Point; +import java.util.Map; + +import org.fudaa.ebli.visuallibrary.EbliNode; + +/** + * Classe utilisation pour la serialization des donn\xE9es widget groupes + * + * @author Adrien Hadoux + */ +public class EbliWidgetGroupSerializeXml extends EbliWidgetSerializeXml{ + + /** + * Indique si le groupe est une fusion ou pas + */ + boolean isFusion; + + public EbliWidgetGroupSerializeXml(EbliNode node, Map parameters,boolean isFusion) { + super(node, parameters); + // TODO Auto-generated constructor stub + this.isFusion=isFusion; + } + + + + /** + * Methode qui met a jour les infos du groupe. + * Pour des raisons de conception, ce groupe ne se cr\xE9e pas \xE0 ce niveau, car il est sp\xE9cialis\xE9 (peut etre groupe classique, ou groupe de calque ou autre. + * @param nodeGroup + */ + public void updateGroup(EbliNode nodeGroup){ + nodeGroup.setTitle(getTitle()); + nodeGroup.getWidget().setPreferredLocation(new Point(getX(), getY())); + nodeGroup.getWidget().setPreferredSize(new Dimension(getWidth(), getHeight())); + } + + public boolean isFusion() { + return isFusion; + } + + public void setFusion(boolean isFusion) { + this.isFusion = isFusion; + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -87,7 +87,7 @@ } - private void fillInfoWith(final EbliNode node, final Map parameters) { + protected void fillInfoWith(final EbliNode node, final Map parameters) { EbliWidget widget; if (node.getWidget() instanceof EbliWidgetBordureSingle) { widget = (EbliWidget) node.getWidget().getChildren().get(0); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -40,10 +40,5 @@ FudaaCourbeTimeListModel getTimeModel(); void profilPanelCreated(MvProfileFillePanel _panel, ProgressionInterface _prog, String _title); - - /** - * TODO a enlever car ne doit pas dependre de Tr - */ - TrPostSource getDataSource(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -684,6 +684,9 @@ } + //-- duplication du target --// + duplic.target_=this.target_; + return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModelPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModelPersist.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModelPersist.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -19,15 +19,15 @@ public class MvProfileTreeModelPersist { public String type; - + public String idSource; - + LineString initLineNode; LineString initLineMesh; - + public MvProfileTreeModelPersist(){} - - + + /** * Methode qui remplit le model en param d'entr\xE9es avec les datas de cette classe. * @param model @@ -37,33 +37,38 @@ model.tester_=new MvProfileCoteTester(); model.initLineNode=initLineNode; model.initLineMesh=initLineMesh; - - + + //-- donnees specifiques propres au projet charg\xE9 --// TrPostProjet projet=(TrPostProjet) param.get("TrPostProjet"); if(projet!=null){ - TrPostSource src=projet.findSourceById(this.idSource); - if(src!=null){ - //-- creation du mvprofiletarget --// - model.target_=TrPostProfileAction.createProfileAdapter(src, projet) ; - model.timeModel_ = model.target_.getTimeModel(); + if(this.idSource!=null){ + TrPostSource src=projet.findSourceById(this.idSource); + if(src!=null){ + //-- creation du mvprofiletarget --// + model.target_=TrPostProfileAction.createProfileAdapter(src, projet) ; + model.timeModel_ = model.target_.getTimeModel(); + + } } - + + } } - } - - /** - * TODO a enlever car ne doit pas dependre de Tr - */ + /** + * TODO a enlever car ne doit pas dependre de Tr + */ + /** * Methode qui remplit cetet classe a partir du modele fourni en entree. */ public void fillDataWithModel(MvProfileTreeModel model){ type="Courbe spatiale"; //-- recuperer la source du mvprofile --// - TrPostSource src=model.target_.getDataSource(); - idSource=src.getId(); + if(model.target_.getData() instanceof TrPostSource){ + TrPostSource src=(TrPostSource) model.target_.getData(); + idSource=src.getId(); + } initLineNode=model.initLineNode; initLineMesh=model.initLineMesh; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -250,7 +250,7 @@ // -- ajout du rectangle --// final EbliNodeDefault nodeLegende = new EbliNodeDefault(); nodeLegende.setTitle("Legende calque"); - nodeLegende.setCreator(new EbliWidgetCreatorLegende(legende.getLegendePanel(0), "x")); + nodeLegende.setCreator(new EbliWidgetCreatorLegende(legende.getLegendePanel(0), "x",null)); nodeLegende.setPreferedSize(new Dimension(200, 100)); nodeLegende.setPreferedLocation(new Point(350, 125)); // ajout du node au layout Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -106,7 +106,14 @@ public void active(final File _f, final TrPostCommonImplementation _impl){ - active(_f,_impl,CtuluLibGenerator.getInstance().deliverUniqueStringId()); + + String uniqueId; + if(_impl.c_!=null) + uniqueId=_impl.c_.deliverSourceId(_f.getName()); + else + uniqueId=CtuluLibGenerator.getInstance().deliverUniqueStringId(); + + active(_f,_impl,uniqueId); } /** Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -33,6 +33,7 @@ import org.fudaa.ctulu.CtuluAnalyze; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibGenerator; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluTaskDelegate; @@ -1249,7 +1250,30 @@ else return null; } + /** + * Genere et affecte a la source l'id. + * @param src + * @return + */ + public String deliverSourceId(TrPostSource src){ + if(src.getId()==null){ + String uniqueId=CtuluLibGenerator.getInstance().deliverUniqueStringId(src.getFile().getName()); + src.setId(uniqueId); + } + return src.getId(); + + } + /** + * genere uniquement l id. + * @param name + * @return + */ + public String deliverSourceId(String name){ + String uniqueId=CtuluLibGenerator.getInstance().deliverUniqueStringId(name); + + return uniqueId; + } public boolean isModified() { return modifyState_.isModified(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -104,10 +104,13 @@ EGGraphe graphe=((EbliWidgetCreatorGraphe)node.getCreator()).getGraphe(); if(graphe.getModel() instanceof MvProfileTreeModel){ MvProfileTreeModel model=(MvProfileTreeModel) graphe.getModel() ; - if(model.target_.getDataSource()!=null && model.target_.getDataSource()==src) + if(model.target_.getData() !=null && model.target_.getData() instanceof TrPostSource){ + TrPostSource sourceGraphe=(TrPostSource) model.target_.getData(); + if(sourceGraphe==src) //-- on degage cette widget --// listTodelete.add(node); } + } } } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -1409,13 +1409,13 @@ } private String id_; - protected String generateId() { - return CtuluLibGenerator.getInstance().deliverUniqueStringId(); - } +// protected String generateId() { +// return CtuluLibGenerator.getInstance().deliverUniqueStringId(); +// } public String getId(){ - if(id_==null) - id_=generateId(); +// if(id_==null) +// id_=generateId(); return id_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -11,6 +11,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -38,6 +39,7 @@ import org.fudaa.ebli.visuallibrary.EbliLookFeel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerForGroup; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; @@ -101,6 +103,20 @@ ((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion = true; } } + + + /** + * Constructeur minimaliste qui r\xE9alise directement la fusion sans passer par un \xE9v\xE8nement. + * Il faut appeler la methode performGroupFusion avec la liste des claques a fusionner + * @param scene + * @param projet + */ + public TrPostActionFusionCalques(final EbliScene scene, final TrPostProjet projet){ + super(scene, TrResource.getS("Fusion avec un autre calque"), CtuluResource.CTULU.getIcon("cible"), + "ADDPOINTWIDGET"); + projet_ = projet; + } + /** * remplissage de la combo avec les graphes disponibles et compatibles @@ -193,7 +209,7 @@ } /** - * Methode qui: merge le graphe choisi dans la combo avec el ndoe actuel degage le node choisi de la scene remet a + * Methode qui: merge le calque choisi dans la combo avec el ndoe actuel degage le node choisi de la scene remet a * jour al combo actuelle */ private void mergeCalques() { @@ -220,22 +236,11 @@ // // public void act() { // final ProgressionInterface prog = new ProgressionBuAdapter(this); - final EbliNode fusion = groupWidgetsFusion(listeToMerge); + performGroupFusion(listeToMerge); + + - // -- undo/redo --// - getScene().getCmdMng().addCmd(new CtuluCommand() { - public void undo() { - - // -- degroupe et desynchronise le tout --// - EbliWidgetUngroupAction.degroupObjectsFromFusion(getScene(), fusion); - } - - public void redo() { - groupWidgetsFusion(listeToMerge); - } - }); - // } // }.start(); // ; @@ -245,7 +250,28 @@ } - private EbliNode groupWidgetsFusion(final ArrayList<EbliNode> _selectedObjects) { + + public EbliNode performGroupFusion(final Collection listeToMerge) { + final EbliNode fusion = groupWidgetsFusion(listeToMerge); + + // -- undo/redo --// + getScene().getCmdMng().addCmd(new CtuluCommand() { + + public void undo() { + + // -- degroupe et desynchronise le tout --// + EbliWidgetUngroupAction.degroupObjectsFromFusion(getScene(), fusion); + } + + public void redo() { + groupWidgetsFusion(listeToMerge); + } + }); + + return fusion; + } + + private EbliNode groupWidgetsFusion(final Collection<EbliNode> _selectedObjects) { final EbliWidgetFusionCalques parent = new EbliWidgetFusionCalques(scene_); // -- il faut des gaps suffisants pour deplacer la widget et avoir le menu Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-17 16:14:29 UTC (rev 4080) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-10-17 17:12:25 UTC (rev 4081) @@ -21,6 +21,7 @@ import javax.swing.JInternalFrame; import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluRemoveContentDirectory; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; @@ -30,7 +31,9 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.fudaa.ebli.visuallibrary.persist.EbliSceneSerializeXml; +import org.fudaa.ebli.visuallibrary.persist.EbliWidgetGroupSerializeXml; import org.fudaa.ebli.visuallibrary.persist.EbliWidgetSerializeXml; import org.fudaa.ebli.visuallibrary.persist.EbliWidgetSerializeXml.CoupleNomId; import org.fudaa.fudaa.tr.common.TrLib; @@ -42,6 +45,7 @@ import org.fudaa.fudaa.tr.post.TrPostSource; import org.fudaa.fudaa.tr.post.TrPostSourceAbstract; import org.fudaa.fudaa.tr.post.TrPostUserVariableSaver; +import org.fudaa.fudaa.tr.post.actions.TrPostActionFusionCalques; import org.netbeans.api.visual.widget.Widget; import com.memoire.fu.FuLog; @@ -440,6 +444,7 @@ final TrPostSource src = it.next(); final File f = src.getFile(); //out.writeObject(f.getAbsolutePath()); + trprojet_.deliverSourceId(src); listeCouplesIdSources.add(new TrPostSourcePersist(src)); // -- sauveagrde de la variable correspondante --// final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); @@ -579,14 +584,26 @@ // -- etape 1: creation du repertoire des graphe et calques --// final String pathGraphes = projet_.getAbsolutePath() + File.separator + "Graphes"; try { - new File(pathGraphes).mkdir(); + File fichierGraphes=new File(pathGraphes); + if(fichierGraphes.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierGraphes); + + }else + fichierGraphes.mkdir(); } catch (final Exception e) { // pas grave on continue FuLog.debug("Le repertoire des graphes existe deja"); } final String pathCalques = projet_.getAbsolutePath() + File.separator + "Calques"; try { - new File(pathCalques).mkdir(); + File fichierCalques=new File(pathCalques); + if(fichierCalques.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierCalques); + + }else + fichierCalques.mkdir(); } catch (final Exception e) { // pas grave on continue FuLog.debug("Le repertoire des calques existe deja"); @@ -600,7 +617,13 @@ } final String pathText = projet_.getAbsolutePath() + File.separator + "Textes"; try { - new File(pathText).mkdir(); + File fichierText=new File(pathText); + if(fichierText.isDirectory()){ + //-- on le nettoie --// + CtuluRemoveContentDirectory.contentDirectoryRemover(fichierText); + + }else + fichierText.mkdir(); } catch (final Exception e) { // pas grave on continue FuLog.debug("Le repertoire des textes existe deja"); @@ -810,6 +833,7 @@ // -- creation des alias pour que ce soit + parlant dans le xml file --// xstream.alias("LAYOUT", EbliSceneSerializeXml.class); xstream.alias("FRAME", EbliWidgetSerializeXml.class); + xstream.alias("GROUPE", EbliWidgetGroupSerializeXml.class); xstream.alias("FRAMESNAME", EbliWidgetSerializeXml.CoupleNomId.class); xstream.alias("SOURCE", TrPostSourcePersist.class); return xstream; @@ -838,16 +862,16 @@ final Iterator<Widget> it = scene.getLayerVisu().getChildren().iterator(); // -- creation d une liste particuliere pour les groupes--// - final List<EbliWidgetSerializeXml> listeGroupes = new ArrayList<EbliWidgetSerializeXml>(); + final List<EbliWidgetGroupSerializeXml> listeGroupes = new ArrayList<EbliWidgetGroupSerializeXml>(); while (it.hasNext()) { final Widget widget = it.next(); - if (widget instanceof EbliWidgetGroup) { + if (widget instanceof EbliWidgetGroup /*|| widget instanceof EbliWidgetFusionCalques*/) { // -- cas widget group, il faut recuper ses child --// final EbliNode nodeGroupe = (EbliNode) scene.findObject(widget); // ecriture de l objet - if (nodeGroupe != null) listeGroupes.add(new EbliWidgetSerializeXml(nodeGroupe, parametres)); + if (nodeGroupe != null) listeGroupes.add(new EbliWidgetGroupSerializeXml(nodeGroupe, parametres,( widget instanceof EbliWidgetFusionCalques))); for (final Widget child : widget.getChildren()) { final EbliNode node = (EbliNode) scene.findObject(child); @@ -868,7 +892,7 @@ // -- ecriture des groupes --// out.writeInt(listeGroupes.size()); - for (final EbliWidgetSerializeXml serializeGroupe : listeGroupes) { + for (final EbliWidgetGroupSerializeXml serializeGroupe : listeGroupes) { out.writeObject(serializeGroupe); } @@ -971,10 +995,10 @@ // -- lecture des groupes --// // -- ecriture des groupes --// final int nbGroups = in.readInt(); - final HashMap<String, EbliWidgetSerializeXml> listeGroupes = new HashMap<String, EbliWidgetSerializeXml>(); + final HashMap<String, EbliWidgetGroupSerializeXml> listeGroupes = new HashMap<String, EbliWidgetGroupSerializeXml>(); for (int i = 0; i < nbGroups; i++) { - final EbliWidgetSerializeXml group = (EbliWidgetSerializeXml) in.readObject(); + final EbliWidgetGroupSerializeXml group = (EbliWidgetGroupSerializeXml) in.readObject(); listeGroupes.put(group.getId(), group); } @@ -983,17 +1007,21 @@ for (final String idGroup : listeGroupToPerform.keySet()) { // --l'idGroup est jetable, on ne le sauvegarde pas --// final HashSet<Object> listeToGroup = listeGroupToPerform.get(idGroup); - final EbliNode nodeGroup = new EbliWidgetGroupAction(scenToUpdate).performGroup(listeToGroup); + EbliNode nodeGroup =null; // -- on met a jour le ebliNode avec les infos du groupe sauv\xE9 --// - final EbliWidgetSerializeXml infoGroup = listeGroupes.get(idGroup); + final EbliWidgetGroupSerializeXml infoGroup = listeGroupes.get(idGroup); + if(!infoGroup.isFusion()) + nodeGroup= new EbliWidgetGroupAction(scenToUpdate).performGroup(listeToGroup); + else + nodeGroup= new TrPostActionFusionCalques(scenToUpdate,trprojet_).performGroupFusion(listeToGroup); + if (infoGroup != null) { - nodeGroup.setTitle(infoGroup.getTitle()); - nodeGroup.getWidget().setPreferredLocation(new Point(infoGroup.getX(), infoGroup.getY())); - nodeGroup.getWidget().setPreferredSize(new Dimension(infoGroup.getWidth(), infoGroup.getHeight())); + infoGroup.updateGroup(nodeGroup); } } + // -- on ajoute les noeuds selectionnes a ebliScene --// scenToUpdate.setSelectedObjects(listeNodeSelect); // mise a jour de la scene This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-10-17 16:14:39
|
Revision: 4080 http://fudaa.svn.sourceforge.net/fudaa/?rev=4080&view=rev Author: emmanuel_martin Date: 2008-10-17 16:14:29 +0000 (Fri, 17 Oct 2008) Log Message: ----------- La boite d'edition de g?\195?\169om?\195?\169trie est acc?\195?\169ssible d?\195?\168s qu'une g?\195?\169om?\195?\169trie est selectionn?\195?\169e, m?\195?\170me si celle ci est dans un calque diff?\195?\169rent de celui selectionn?\195?\169. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-17 15:17:26 UTC (rev 4079) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-10-17 16:14:29 UTC (rev 4080) @@ -13,10 +13,9 @@ import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.Vector; +import java.util.ArrayList; import javax.swing.AbstractButton; import javax.swing.Action; @@ -36,6 +35,7 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueClickInteraction; import org.fudaa.ebli.calque.ZCalqueClikInteractionListener; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -53,6 +53,9 @@ import org.fudaa.ebli.trace.TraceIcon; import com.memoire.bu.BuDesktop; +import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPopupWindow; import com.memoire.bu.BuResource; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; @@ -723,38 +726,50 @@ } } + /** + * Contrairement \xE0 ce que laisse penser le prototype, cette fonction lance + * l'\xE9dition des g\xE9om\xE9tries quelque soit le calque dans lequel les g\xE9om\xE9tries + * sont selectionn\xE9. Le param\xE8tre _target, n'est pas utilis\xE9. + */ public String edit(final Object _target) { - if (!isEditable(_target)) { - return EbliLib.getS("Non \xE9ditable"); - } - final ZCalqueEditable ed = (ZCalqueEditable) _target; - if (ed.isSelectionEmpty()) { + // R\xE9cup\xE9ration des calques contenant des g\xE9om\xE9tries selectionn\xE9es \\ + ZCalqueAffichageDonneesInterface[] calques=panel_.getScene().getAllLayers(); + ArrayList<ZCalqueAffichageDonneesInterface> claquesWithSelectedObjects=new ArrayList<ZCalqueAffichageDonneesInterface>(); + for (int i=0; i<calques.length; i++) + if (!calques[i].isSelectionEmpty()&&calques[i] instanceof ZCalqueEditable) + claquesWithSelectedObjects.add(calques[i]); + // Verification du le nombre de calques contenant des selections + if (claquesWithSelectedObjects.size()==0) return EbliLib.getS("La s\xE9lection courante est vide"); + else if (claquesWithSelectedObjects.size()>1){ + ui_.warn("Information", "La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition.", false); + /*BuInternalFrame i = new BuInternalFrame("Information", false, true, false, false); + i.add(new BuLabel("La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition.")); + i.setVisible(true); + i.*/ + return EbliLib.getS("La selection dans plusieurs calques n'est pas g\xE9r\xE9e par la fen\xEAtre d'\xE9dition."); } - if (ed.isAtomicMode()) { - editVertexObject(ed); - return null; - } - final ZCalqueAffichageDonnees calque = (ZCalqueAffichageDonnees) ed; - if (calque.isOnlyOneObjectSelected()) { - editSingleObject(ed); - } else { - - CtuluDialogPanel pn = null; - if (ed.getModelEditable().getGeomData() instanceof GISZoneCollectionPoint) { - - pn = GISGuiBuilder.buildFor((GISZoneCollectionPoint) ed.getModelEditable().getGeomData(), ed - .getLayerSelection().getSelectedIndex(), getMng()); - } else { - pn = GISGuiBuilder.buildForGlobAtt(ed.getModelEditable().getGeomData(), ed.getLayerSelection() + ZCalqueEditable calque=(ZCalqueEditable)claquesWithSelectedObjects.get(0); + + // G\xE9n\xE9ration d'une boite d'\xE9dition selon le type de selection et d'\xE9dition \\ + if (((ZCalqueEditable)calque).isAtomicMode()) + editVertexObject((ZCalqueEditable)calque); + else if (calque.isOnlyOneObjectSelected()) + // Une seule g\xE9om\xE9trie est \xE0 \xE9diter + editSingleObject((ZCalqueEditable)claquesWithSelectedObjects.get(0)); + else { + // Plusieurs g\xE9om\xE9tries sont \xE0 \xE9diter + CtuluDialogPanel pn=null; + if (calque.getModelEditable().getGeomData() instanceof GISZoneCollectionPoint) + pn=GISGuiBuilder.buildFor((GISZoneCollectionPoint)calque.getModelEditable().getGeomData(), calque.getLayerSelection() .getSelectedIndex(), getMng()); - } - if (pn == null) { - getUi().message(ed.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), true); - } else { - pn.afficheModale(getFrame(), ed.getTitle()); - } - + else + pn=GISGuiBuilder.buildForGlobAtt(calque.getModelEditable().getGeomData(), calque.getLayerSelection().getSelectedIndex(), + getMng()); + if (pn==null) + getUi().message(calque.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), true); + else + pn.afficheModale(getFrame(), calque.getTitle()); } return null; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-17 15:17:26 UTC (rev 4079) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java 2008-10-17 16:14:29 UTC (rev 4080) @@ -10,6 +10,7 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -330,9 +331,13 @@ if (Fu.DEBUG && FuLog.isDebug()) { FuLog.debug("FTR gis target= " + FSigEditor.this.getTarget()); } - final BCalque cq = getSupport().getCalqueActif(); - super.setEnabled(FSigEditor.this.isEditable(cq) && (cq instanceof ZCalqueAffichageDonneesInterface) && - !((ZCalqueAffichageDonneesInterface)cq).isSelectionEmpty()); + // R\xE9cup\xE9ration des calques contenant des g\xE9om\xE9tries selectionn\xE9es \\ + ZCalqueAffichageDonneesInterface[] calques=getSupport().getAllLayers(); + ArrayList<ZCalqueAffichageDonneesInterface> claquesWithSelectedObjects=new ArrayList<ZCalqueAffichageDonneesInterface>(); + for (int i=0; i<calques.length; i++) + if (!calques[i].isSelectionEmpty()&&calques[i] instanceof ZCalqueEditable) + claquesWithSelectedObjects.add(calques[i]); + super.setEnabled(claquesWithSelectedObjects.size()>0); } public String getEnableCondition() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |