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