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. |