From: <had...@us...> - 2008-08-11 07:49:20
|
Revision: 3755 http://fudaa.svn.sourceforge.net/fudaa/?rev=3755&view=rev Author: hadouxad Date: 2008-08-11 07:49:27 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Resolution du FIXME: lorsque la widget est selectionnee, son state est a isselected: test poru recuperer les widgets selectionnees: myWidget.getState().isSelected Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 07:43:50 UTC (rev 3754) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 07:49:27 UTC (rev 3755) @@ -49,13 +49,13 @@ public final static int ALIGNCENTERVERTICAL=3; public final static int ALIGNTOP=4; public final static int ALIGNBOTTOM=5; - + int typeAlignement_; - + //liste des positions precedentes pour chaque widgets List<Point> listPreviousPositions_; - + public EbliWidgetActionAlign(EbliScene _scene, int _typeAlignement) { super(); // TODO Auto-generated constructor stub @@ -76,8 +76,8 @@ * methode qui recalcule la nouvelle position par rapport a la scene et a l alignement choisiT. */ private Point calculeNewLocation(Point _previousLocation,Dimension _dimensionWidget,Dimension _dimensionScene){ - - + + switch(typeAlignement_){ case ALIGNLEFT: return new Point(0,_previousLocation.y); case ALIGNRIGHT: return new Point(_dimensionScene.width-_dimensionWidget.width,_previousLocation.y); @@ -85,17 +85,17 @@ case ALIGNCENTERVERTICAL: return new Point(_previousLocation.x,_dimensionScene.height/2 -_dimensionWidget.height/2); case ALIGNTOP: return new Point(_previousLocation.x,0); case ALIGNBOTTOM: return new Point(_previousLocation.x,_dimensionScene.height-_dimensionWidget.height); - - + + default: return _previousLocation; } - - + + } - -private Point calculeNewLocation(Point _previousLocation,Rectangle _dimensionWidget,Dimension _dimensionScene){ - - + + private Point calculeNewLocation(Point _previousLocation,Rectangle _dimensionWidget,Dimension _dimensionScene){ + + switch(typeAlignement_){ case ALIGNLEFT: return new Point(0,_previousLocation.y); case ALIGNRIGHT: return new Point(_dimensionScene.width-_dimensionWidget.width,_previousLocation.y); @@ -103,15 +103,15 @@ case ALIGNCENTERVERTICAL: return new Point(_previousLocation.x,_dimensionScene.height/2 -_dimensionWidget.height/2); case ALIGNTOP: return new Point(_previousLocation.x,0); case ALIGNBOTTOM: return new Point(_previousLocation.x,_dimensionScene.height-_dimensionWidget.height); - - + + default: return _previousLocation; } - - + + } - + private String traduct(int _align){ switch(typeAlignement_){ case ALIGNLEFT: return "\xE0 gauche"; @@ -120,50 +120,56 @@ case ALIGNCENTERVERTICAL: return "centr\xE9 vertical"; case ALIGNTOP: return "en haut"; case ALIGNBOTTOM: return "en bas"; - - + + default: return ""; } } - + /** * action alignement qui realise l alignements de tous les composants */ public void alignComponents(){ - + //-- reinitialisation de la liste des historique des positions --// listPreviousPositions_=new ArrayList<Point>(); + + //-- recuperation de la liste des widgets selectionnees --// - //-- recuperation de la liste des widgets selectionnees --// - //FIXME comment recuperer les nodes uniquements selectionnes? la je recupere tout... Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); - + //-- parcours des nodes for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ - + EbliNode currentNode=it.next(); if(currentNode!=null && currentNode.isMovable()){ - //-- enregistrement de la previous position --// - listPreviousPositions_.add(currentNode.getPreferedLocation()); - - //-- calcul de la nouvelle position du node en fonction de l alignement choisi --// - Point newLocation=calculeNewLocation(currentNode.getCreator().getWidget().getLocation(), currentNode.getCreator().getWidget().getBounds(),scene_.getView().getSize()); - - //-- tentative de modification de la position du node --// - currentNode.setPreferedLocation(newLocation); - - currentNode.getCreator().getWidget().revalidate(); - currentNode.getCreator().getWidget().repaint(); + + //-- deplacement que si la widget est selectionnee --// + if(currentNode.getCreator().getWidget().getState().isSelected()){ + + //-- enregistrement de la previous position --// + listPreviousPositions_.add(currentNode.getPreferedLocation()); + + //-- calcul de la nouvelle position du node en fonction de l alignement choisi --// + Point newLocation=calculeNewLocation(currentNode.getCreator().getWidget().getLocation(), currentNode.getCreator().getWidget().getBounds(),scene_.getView().getSize()); + + //-- tentative de modification de la position du node --// + currentNode.setPreferedLocation(newLocation); + + currentNode.getCreator().getWidget().revalidate(); + currentNode.getCreator().getWidget().repaint(); + + } } - + } //-- rafraichissement de la scene --// scene_.refresh(); - - + + } - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |