You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <had...@us...> - 2008-08-18 07:11:56
|
Revision: 3810 http://fudaa.svn.sourceforge.net/fudaa/?rev=3810&view=rev Author: hadouxad Date: 2008-08-18 07:12:03 +0000 (Mon, 18 Aug 2008) Log Message: ----------- - widget qui permet de cr?\195?\169er une image movable, resizable, de la dupliquer et la supprimer - widget editor text html Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -42,6 +42,8 @@ duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); } else if (creator instanceof EbliWidgetCreatorShape) { duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); + } else if (creator instanceof EbliWidgetCreatorImage) { + duplique.setCreator(new EbliWidgetCreatorImage(((EbliWidgetCreatorImage) getCreator()).getG())); } else { // instance pas identifie, impossible de dupliquer return null; Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,41 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Image; + +/** + * Creator de la widget image. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorImage implements EbliWidgetCreator { + + Image image_; + EbliWidgetImage res; + + public EbliWidgetCreatorImage(Image g) { + super(); + this.image_ = g; + } + + public Image getG() { + return image_; + } + + public void setG(Image g) { + this.image_ = g; + } + + public EbliWidget create(EbliScene _scene) { + + res = new EbliWidgetImage(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,41 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; + +/** + * creator Editeur de texte widget. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorTextEditor implements EbliWidgetCreator { + + CtuluHtmlEditorPanel editorPane_; + EbliWidgetTextEditor res; + + public EbliWidgetCreatorTextEditor(CtuluHtmlEditorPanel g) { + super(); + this.editorPane_ = g; + } + + public CtuluHtmlEditorPanel getG() { + return editorPane_; + } + + public void setG(CtuluHtmlEditorPanel g) { + this.editorPane_ = g; + } + + public EbliWidget create(EbliScene _scene) { + + res = new EbliWidgetTextEditor(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,35 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.image.ImageObserver; + +public class EbliWidgetImage extends EbliWidget implements ImageObserver { + + Image image; + + public EbliWidgetImage(EbliScene scene, Image _img) { + super(scene); + image = _img; + } + + + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + // -- dessin de l'image --// + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, this); + } + + + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + repaint(); + return true; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,128 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.util.EnumSet; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.Widget; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuPanel; + +public class EbliWidgetTextEditor extends EbliWidget implements InplaceEditorProvider<BuPanel> { + + // contenu du texte + String content_ = "Double-cliquez pour \xE9diter"; + + // editeur de texte + CtuluHtmlEditorPanel editorPane_ = new CtuluHtmlEditorPanel(); + // ComponentWidget widget; + BuPanel conteneur = null; + + public EbliWidgetTextEditor(EbliScene scene, CtuluHtmlEditorPanel content) { + super(scene); + editorPane_ = content; + + // widget = new ComponentWidget(scene, editorPane_) { + // public void notifyStateChanged(ObjectState previousState, ObjectState + // newState) { + // + // setBorder(getScene().getLookFeel().getBorder(newState)); + // } + // }; + // + // setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); + // addChild(widget); + // + // -- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + + } + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + decoupeEcriture(editorPane_.getDocumentText(), g); + } + + /** + * Methode qui redessine l edition de texte proprement. + * + * @param text + * de l editeur html + * @param g + */ + public void decoupeEcriture(String text, Graphics2D g) { + + int espaceLignes = 10; + + if(text==null || text.length()==0) + return; + + Rectangle rec = getClientArea(); + int indiceDep=0; + int espaceAffichable = Math.min((int) (rec.width / 5), text.length()); + + for (int i = 0; indiceDep + espaceAffichable < text.length(); i++) { + g.drawString(text.substring(indiceDep, indiceDep + espaceAffichable), rec.x, rec.y + i * espaceLignes); + indiceDep = indiceDep + espaceAffichable; + + } + + + } + + + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + //--creation du panel ekitcore + if(conteneur==null){ + conteneur=new BuPanel(new BuBorderLayout()); + + Rectangle rec = getClientArea(); + editorPane_.setSize(rec.width, rec.height); + editorPane_.setPreferredSize(new Dimension(rec.width, rec.height)); + conteneur.setPreferredSize(new Dimension(rec.width, rec.height)); + + conteneur.add(editorPane_, BuBorderLayout.CENTER); + conteneur.add(editorPane_.getToolBar(true), BuBorderLayout.NORTH); + conteneur.add(editorPane_.getMenuBar()); + + } + + + return conteneur; + + + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, + Rectangle viewBounds) { + return null; + } + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + } + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorImage; + +import com.memoire.bu.BuFileChooser; +import com.memoire.bu.BuResource; + +/** + * Action qui permet de creer une widget image. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionImageChooser extends EbliActionSimple { + + EbliScene scene_; + + public EbliWidgetActionImageChooser(EbliScene _widget) { + super(EbliLib.getS("Ins\xE9rer une image"), BuResource.BU.getIcon("crystal_image"), "INSERTIONIMAGE"); + scene_ = _widget; + } + + + public void actionPerformed(ActionEvent e) { + + BuFileChooser chooser = new BuFileChooser(/* System.getProperty("user.dir") */); + + int rep = chooser.showOpenDialog(scene_.getView()); + + if (rep == BuFileChooser.APPROVE_OPTION) { + Image img = Toolkit.getDefaultToolkit().getImage(chooser.getSelectedFile().getAbsolutePath()); + + // -- creation de la widget et ajout dans la scene --// + EbliNodeDefault nodeImage = new EbliNodeDefault(); + nodeImage.setTitle(" " + chooser.getSelectedFile()); + nodeImage.setCreator(new EbliWidgetCreatorImage(img)); + nodeImage.setPreferedSize(new Dimension(200, 200)); + nodeImage.setPreferedLocation(new Point(270, 225)); + scene_.addNode(nodeImage); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + } + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,48 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextEditor; + +import com.memoire.bu.BuResource; + +/** + * Classe qui genere une widget editeur de texte. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActiontextEditor extends EbliActionSimple { + + EbliScene scene_; + + public EbliWidgetActiontextEditor(EbliScene _widget) { + super(EbliLib.getS("Ins\xE9rer une texte"), BuResource.BU.getIcon("crystal_fonte"), "INSERTIONTEXTE"); + scene_ = _widget; + } + + public void actionPerformed(ActionEvent e) { + + + // -- creation de la widget et ajout dans la scene --// + EbliNodeDefault nodeText = new EbliNodeDefault(); + nodeText.setTitle("Texte"); + nodeText.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); + nodeText.setPreferedSize(new Dimension(200, 200)); + nodeText.setPreferedLocation(new Point(270, 225)); + scene_.addNode(nodeText); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -220,23 +220,23 @@ // TODO Auto-generated method stub } - - public void setColorContour(Color newColor){ - couleurContour=newColor; - repaint(); - } - - public Color getColorContour(){ - return couleurContour; - } - - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - - public Color getColorFond(){ - return couleurFond; - } + + // public void setColorContour(Color newColor){ + // couleurContour=newColor; + // repaint(); + // } + // + // public Color getColorContour(){ + // return couleurContour; + // } + // + // public void setColorFond(Color newColor){ + // couleurFond=newColor; + // repaint(); + // } + // + // public Color getColorFond(){ + // return couleurFond; + // } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -59,7 +59,9 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionFont; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; @@ -442,8 +444,11 @@ bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MIN)); bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MAX)); + bar.add(new EbliWidgetActionImageChooser(scene)); + bar.add(new EbliWidgetActiontextEditor(scene)); + p.doLayout(); // -- creation de l action pour les fonts --// @@ -453,5 +458,8 @@ bar.add(actionFont.getFonts()); bar.add(actionFont.getSizeFonts()); + + + } } \ No newline at end of file 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-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -35,6 +35,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -237,6 +238,8 @@ addRectangle(); } }); + + _l.add(new EbliWidgetActionImageChooser(getScene())); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-15 16:42:35
|
Revision: 3809 http://fudaa.svn.sourceforge.net/fudaa/?rev=3809&view=rev Author: hadouxad Date: 2008-08-15 16:42:44 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Maj icones Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-15 16:32:08 UTC (rev 3808) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-15 16:42:44 UTC (rev 3809) @@ -25,7 +25,8 @@ public EbliWidgetActionBackGround(EbliScene _scene){ - super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_arriereplan"), "BACKGROUND"); + super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), + "BACKGROUND"); scene_=_scene; cmd_ = _scene.getCmdMng(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-15 16:32:08 UTC (rev 3808) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-15 16:42:44 UTC (rev 3809) @@ -25,7 +25,8 @@ public EbliWidgetActionForeGround(EbliScene _scene){ - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_analyser"), "FORGROUND"); + super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), + "FORGROUND"); scene_=_scene; cmd_ = _scene.getCmdMng(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java 2008-08-15 16:32:08 UTC (rev 3808) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java 2008-08-15 16:42:44 UTC (rev 3809) @@ -32,17 +32,21 @@ CtuluCommandContainer cmd_; public EbliWidgetActionRetaillage(EbliScene _scene, int _typeRetaillage) { - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_resize"), "FORGROUND"); + super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); // -- type retailage --// typeRetaillage_ = _typeRetaillage; scene_ = _scene; cmd_=_scene.getCmdMng(); - if(_typeRetaillage==RETAIILLAGE_MAX) + if (_typeRetaillage == RETAIILLAGE_MAX) { putValue(NAME, "Resize max"); - else + setIcon(CtuluResource.CTULU.getIcon("crystal_rangericones")); + } else { putValue(NAME, "Resize min"); + setIcon(CtuluResource.CTULU.getIcon("crystal_rangerpalettes")); + + } } private static final long serialVersionUID = 1L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-15 16:32:06
|
Revision: 3808 http://fudaa.svn.sourceforge.net/fudaa/?rev=3808&view=rev Author: hadouxad Date: 2008-08-15 16:32:08 +0000 (Fri, 15 Aug 2008) Log Message: ----------- - Action retaillage Min et Max + Undo/redo g?\195?\169r?\195?\169 - Gestion de toutes les properties graphique des widget dans une map - Gestion de la duplication des propri?\195?\169t?\195?\169s graphiques lors de la duplication d elements - Actions de configurations des propri?\195?\169t?\195?\169es graphiques toutes impl?\195?\169ment?\195?\169es en utilisant els BConfigureInterfaces: selection de la widget+ clic sur configuration - modifications des traceligneModels ( trait, taille) - modification des couleurs de contours - modification des couleurs de remplissage - modification de la fonte (pour le rectangle qui contient du texte c'est ok) - modification de la rotation - Gestion des Undo/ redo sur les proprietes graphiques ! (sur les map de composants graphiques) toutes les undo/redo sont ok (rotation, couleur contour, fond, tracelignemodel, font) - Refontes des fonction des popumenu des widgets: - Masquer, configuration, duplication, suppression - Creation des undo/redo pour les arrieres/avant plans il faudrait que l arbre tienne compte des changements des widgets dans la sc?\195?\168ne pour repositionner son ordre - Refonte du rectangle qui contient le texte , il peut ?\195?\170tre modifie comme les elbiShape sauf la rotation -integration dans prepro Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.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/EbliWidgetRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.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/EbliWidgetActionFont.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -15,12 +15,11 @@ import javax.swing.JComponent; import javax.swing.JDialog; -import com.memoire.bu.BuButton; - import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuButton; + /** * @author fred deniger * @version $Id: BSelecteurFont.java,v 1.4 2007-05-22 14:19:05 deniger Exp $ @@ -48,7 +47,7 @@ } - BuButton bt_ = new BuButton(); + public BuButton bt_ = new BuButton(); public BSelecteurFont(final String _property) { super(_property); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -18,7 +18,7 @@ */ public class BSelecteurSlider extends BSelecteurAbstract implements ChangeListener { - final JSlider slider_; + public final JSlider slider_; public BSelecteurSlider(final String _property, final int _min, final int _max) { this(_property, new JSlider(_min, _max)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -46,9 +46,13 @@ // instance pas identifie, impossible de dupliquer return null; } - + + + + + // recopie des tailles duplique.setPreferedSize(getPreferedSize()); - + // -- calcul nouvelle position Point nouvellePosition = new Point(getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget() .getLocation().y + getCreator().getWidget().getClientArea().height)); 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-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -6,8 +6,10 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; +import java.util.HashMap; import java.util.Map; +import javax.swing.JDialog; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -15,10 +17,11 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; -import org.fudaa.ebli.controle.BConfigurePaletteTargetInterface; -import org.fudaa.ebli.controle.BSelecteurInterface; -import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.controle.BSelecteurTargetInterface; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; +import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.model.ObjectState; @@ -30,71 +33,147 @@ * @author Adrien Hadoux * */ -public class EbliWidget extends Widget implements BConfigurePaletteTargetInterface, BSelecteurTargetInterface { +public class EbliWidget extends Widget implements BSelecteurTargetInterface { private EbliScene scene_; - Map propGraphique; + /** + * Map contenant tous les objets graphiques de la widget generique. key: + * lineModel => le lignemodel du ebliWidget. key: color => couleur de fond. + * + */ + public Map propGraphique; + + + /** + * Liste des clef utilisees pour les composants graphiques + */ + public final static String LINEMODEL = "lineModel"; + public final static String COLORCONTOUR = "ColorContour"; + public final static String COLORFOND = "colorFond"; + public final static String ROTATION = "rotation"; + public final static String FONT = "font"; + + private boolean useBorder_ = true; + /** + * retourne la liste des interfaces configurees. + * + * @return + */ public BConfigurableInterface[] getConfigureInterfaces() { return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib - .getS("Affichage")) }; + .getS("Affichage")) /* + * , new + * BConfigurableComposite(getSingleConfigureInterface + * (), EbliLib.getS("Gizmo caca")) + */}; } + + /** + * Retourne une interface widgetConfigure qui permet de gerer les interfaces a + * creer + * + * @return + */ private BConfigurableInterface getSingleConfigureInterface() { - // return new EGCourbeConfigureTarget.Display(this) - return new BConfigurableInterface() { + + // -- retourne l interface qui va bien qui permet de creer les composants + // graphiques correspondant --// + return new WidgetConfigure(this); - public void stopConfiguration() { - } - - public BSelecteurTargetInterface getTarget() { - return EbliWidget.this; - } - - public BSelecteurInterface[] createSelecteurs() { - return new BSelecteurInterface[] { new BSelecteurLineModel() }; - } - - public String getTitle() { - return "test"; - } - - public BConfigurableInterface[] getSections() { - return null; - } - }; - } - public BSelecteurTargetInterface getVisibleTitleTarget() { - // FIXME voir EGObjectConfigureVisibleTarget(this) - return null; - } + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { // voir EGObject + } - + + // useless public Object getMin(String _key) { return null; } - + // useless public Object getMoy(String _key) { return null; } + /** + * Retourne l objet correspondant a la clef: retourne l objet graphique + * correspondant depuis la map d objets graphiques de la widget. + */ public Object getProperty(String _key) { + + System.err.println("suis dans getProperty key= " + _key); + + // -- cas particulier si il s agit de la rotation --// + // -- il faut transformer les degres en radian --// + if (_key.equals(ROTATION)) { + + double radian = getRotation(); + int degre = (int) (radian * 180 / Math.PI); + return new Integer(degre); + + } + + return propGraphique.get(_key); - // return new TraceLigneModel(); } public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { } + /** + * Methode directement appelee apres modification des parametres renvoye par + * le getproperty. Ajoute les anciens parametres dans la commande undo/redo. + */ public boolean setProperty(String _key, Object prop) { - return false; + + System.err.println("Je suis rentre dans setProperty key= " + _key); + + + + + // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour + // l ancien lignemodel --// + if (_key.equals(LINEMODEL)) { + getTraceLigneModel().updateData((TraceLigneModel) prop); + prop = getTraceLigneModel(); + } else if (_key.equals(ROTATION) && prop instanceof Integer) { + // -- cas particulier si il s agit de la rotation --// + // -- il faut transformer les degres en radian --// + int degre = ((Integer) prop).intValue(); + double radian = degre * Math.PI / 180; + prop = new Double(radian); + + } + + // -- creation de la commande undo/redo --// + CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); + + // -- ajout de la widget en question ainsi que la oldpropertie --// + undoRedo.addWidget(this); + undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); + + // --mise a jout de la map de proprietes --// + propGraphique.put(_key, prop); + + // -- ajout de la nouvelle propertie --// + undoRedo.addNewPropertie(propGraphique); + + // -- enregistrement de la commande undo/redo --// + if (getEbliScene().cmdMng_ != null) { + getEbliScene().cmdMng_.addCmd(undoRedo); + } + + // -- mise a jour des parametres de la map --// + refreshMyProperties(); + + return true; } public boolean isTitleModifiable() { @@ -109,6 +188,28 @@ public EbliWidget(EbliScene scene) { super(scene); setScene_(scene); + + //-- remplisage de la map de propriete grahiques --// + propGraphique = new HashMap<String, Object>(); + + // -- ajout du traceligneModel utilise par les filles--// + propGraphique.put(LINEMODEL, new TraceLigneModel()); + + // -- ajout de la couleur de fond par default blanc--// + propGraphique.put(COLORFOND, Color.WHITE); + + // -- ajout de la couleur de contour par default black--// + propGraphique.put(COLORCONTOUR, Color.BLACK); + + // -- ajout de la font par default--// + propGraphique.put(FONT, new Font("Helvetica.Italic", Font.PLAIN, 12)); + + // -- ajout de l angle de rotation par default PI --// + propGraphique.put(ROTATION, Math.PI); + + + + //-- construction des actions --// getActions().addAction(scene.createSelectAction()); getActions().addAction(ActionFactory.createResizeAction()); getActions().addAction(scene.createWidgetHoverAction()); @@ -128,6 +229,46 @@ * @param _popup */ public void constructPopupMenuBase(JPopupMenu _popup) { + + JMenuItem menuItem4 = _popup.add("Configuration graphique"); + menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); + // BuResource.BU.getIcon("configurer") + menuItem4.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget found = EbliWidget.this; + + BConfigurePalette palette = new BConfigurePalette(false); + + BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setModal(true); + d.setTitle("Configuration graphique"); + d.setContentPane(palette); + + d.pack(); + d.setVisible(true); + + } + + }); + + JMenuItem menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget.this.setVisible(false); + + } + + }); + + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -146,10 +287,15 @@ // -- ajout dans la scene --// if (duplique != null && EbliWidget.this.getScene() != null) { EbliWidget.this.getEbliScene().addNode(duplique); - // info debug widget duplique - //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator(). - // getWidget().getPreferredBounds()); + + // -- duplication des map de property graphique de la widget --// + duplique.getCreator().getWidget().propGraphique = n.getCreator().getWidget().duplicateGraphicalProperties(); + // -- duplication de la taille --// + duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + + + // -- raffraichissement de la scene --// EbliWidget.this.getEbliScene().refresh(); } @@ -157,7 +303,14 @@ } }); - JMenuItem menuItem2 = _popup.add("Fermer l'objet"); + + + + + + + + JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem2.addActionListener(new ActionListener() { @@ -172,18 +325,7 @@ } }); - - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - EbliWidget.this.setVisible(false); - - } - - }); + } /** @@ -242,31 +384,79 @@ } /** - * Methode a surcharger pour la recuperation des colors - * - * @param newColor + * Methode qui raffraichis les proprietes de la widget. */ - public void setColorContour(Color newColor) { + public void refreshMyProperties() { + getEbliScene().refresh(); + } + + + public Map duplicateGraphicalProperties() { + + Map mapDupliquee = new HashMap<String, Object>(); + + + + mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); + mapDupliquee.put(COLORCONTOUR, getColorContour()); + mapDupliquee.put(COLORFOND, getColorFond()); + mapDupliquee.put(ROTATION, getRotation()); + mapDupliquee.put(FONT, getFormeFont()); + + + return mapDupliquee; } + + /** + * Retourne les proprietes de la map. + */ + public TraceLigneModel getTraceLigneModel() { + return (TraceLigneModel) propGraphique.get(LINEMODEL); + } + + public void setTraceLigneModel(TraceLigneModel _l) { + propGraphique.put(LINEMODEL, _l); + } + + + + + public void setColorContour(Color newColor) { + propGraphique.put(COLORCONTOUR, newColor); + } + public Color getColorContour() { - return null; + return (Color) propGraphique.get(COLORCONTOUR); } public void setColorFond(Color newColor) { - + propGraphique.put(COLORFOND, newColor); } public Color getColorFond() { - return null; + return (Color) propGraphique.get(COLORFOND); } + + public double getRotation() { + if (propGraphique.get(ROTATION) instanceof Integer) + propGraphique.put(ROTATION, new Double((Integer) propGraphique.get(ROTATION))); + return (Double) propGraphique.get(ROTATION); + } + + public void setRotation(double rotation) { + propGraphique.put(ROTATION, rotation); + } + + public Font getFormeFont() { - return null; + return (Font) propGraphique.get(FONT); + } public void setFormeFont(Font newFont) { - + propGraphique.put(FONT, newFont); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,16 +1,13 @@ package org.fudaa.ebli.visuallibrary; -import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; -import java.awt.Shape; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; import org.netbeans.api.visual.action.ActionFactory; - import org.netbeans.api.visual.action.TextFieldInplaceEditor; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.LabelWidget; @@ -32,8 +29,7 @@ int largeurBorder = 15; int espaceInterieur = 5; - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; + public Font fontForme; /** @@ -51,7 +47,8 @@ intern = new LabelWidget(_scene); intern.setVerticalAlignment(VerticalAlignment.CENTER); intern.setAlignment(Alignment.CENTER); - + intern.setFont(getFormeFont()); + intern.setLabel(label); //-- layout du texte --// @@ -88,25 +85,35 @@ } protected void paintWidget() { - Graphics2D g = getGraphics(); + + // -- mise a jour de la fonte que si il y a eu une modification --// + if (intern.getFont() != getFormeFont()) + intern.setFont(getFormeFont()); + if (intern.getForeground() != getColorContour()) + intern.setForeground(getColorContour()); + + + Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); //-- couleur de fond --// - g.setColor(couleurFond); - g.fillRect(0, 0, rec.width, rec.height); + // g.setColor(getColorFond()); + // g.fillRect(0, 0, rec.width, rec.height); g.translate(rec.x, rec.y); // la ligne - TraceLigne l = new TraceLigne(); - l.setCouleur(couleurContour); - l.setEpaisseur(largeurBorder); - // l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); - l.dessineRectangle(g, l.getEpaisseur() / 2, l.getEpaisseur() / 2, - rec.width - l.getEpaisseur(), rec.height - l.getEpaisseur()); + TraceLigne l = new TraceLigne(getTraceLigneModel()); + l.setCouleur(getColorContour()); + + l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), + (int) (rec.width - l + .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); + g.translate(-rec.x, -rec.y); @@ -115,6 +122,7 @@ } public String getText(Widget widget) { + return ((LabelWidget) widget).getLabel(); } @@ -130,38 +138,13 @@ } - public void setColorContour(Color newColor){ - couleurContour=newColor; - intern.setForeground(couleurContour); - repaint(); - } + + - public Color getColorContour(){ - return couleurContour; - } - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - public Color getColorFond(){ - return couleurFond; - } - public Font getFormeFont(){ - return fontForme; - } - public void setFormeFont(Font newFont){ - fontForme=newFont; - intern.setFont(fontForme); - intern.revalidate(); - revalidate(); - repaint(); - - } - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -13,7 +13,6 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; -import org.netbeans.api.visual.widget.Scene; /** * Classe qui permet de dessinner des shapes. @@ -25,35 +24,36 @@ Map options_; ShapeCreator shaper_; - double rotation_; + // double rotation_; - public Color couleurFond=Color.white; - public Color couleurContour=Color.black; + - public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, couleurContour);//pour l'exempls + // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, + // couleurContour);//pour l'exempls /** * @return the rotation_ */ - public double getRotation() { - return rotation_; - } + // public double getRotation() { + // return rotation_; + // } + // + // /** + // * @param rotation_ the rotation_ to set + // */ + // public void setRotation(double rotation_) { + // this.rotation_ = rotation_; + // // Dimension dim = getPreferredSize(); + // // if (dim != null) { + // // Shape rec = new Rectangle(0, 0, dim.width, dim.height); + // // AffineTransform tr = AffineTransform.getRotateInstance(dim.width / 2, + // dim.height / 2, rotation_); + // // Rectangle bounds2 = tr.createTransformedShape(rec).getBounds(); + // // dim.height = bounds2.height; + // // dim.width = bounds2.width; + // // setPreferredSize(dim); + // // } + // } - /** - * @param rotation_ the rotation_ to set - */ - public void setRotation(double rotation_) { - this.rotation_ = rotation_; - // Dimension dim = getPreferredSize(); - // if (dim != null) { - // Shape rec = new Rectangle(0, 0, dim.width, dim.height); - // AffineTransform tr = AffineTransform.getRotateInstance(dim.width / 2, dim.height / 2, rotation_); - // Rectangle bounds2 = tr.createTransformedShape(rec).getBounds(); - // dim.height = bounds2.height; - // dim.width = bounds2.width; - // setPreferredSize(dim); - // } - } - public EbliWidgetShape (EbliScene scene, ShapeCreator _shaper, Map _options) { super(scene); super.setCheckClipping(true); @@ -62,6 +62,10 @@ options_.putAll(_options); } shaper_ = _shaper; + + // --mise a jour de la propriete graphique du traceligneModel de la map --// + propGraphique.put("lineModel", new TraceLigneModel(TraceLigne.LISSE, 5, getColorContour())); + } /** @@ -73,17 +77,22 @@ Rectangle recInit = getClientArea(); // AffineTransform oldTr = g.getTransform(); - - TraceLigne tl = new TraceLigne(tl_); + // -- creation du traceligne --// + TraceLigne tl = new TraceLigne(getTraceLigneModel()); + + // -- mise a jour de la couleur du contour --// + getTraceLigneModel().setCouleur(getColorContour()); + + AffineTransform oldTr = g.getTransform(); g.translate(recInit.x, recInit.y); - float ep = tl_.getEpaisseur(); + float ep = tl.getEpaisseur(); //Il faut prendre en compte l'epaisseur de la ligne Rectangle2D.Float rec = new Rectangle2D.Float(ep / 2, ep / 2, recInit.width - ep, recInit.height - ep); Shape shape = shaper_.createShapeFor(rec, options_, ep); - if (rotation_ != 0) { - AffineTransform tr = AffineTransform.getRotateInstance(rotation_, rec.getCenterX(), rec.getCenterY()); + if (getRotation() != 0) { + AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); shape = tr.createTransformedShape(shape); Rectangle2D newBound = shape.getBounds2D(); double wRatio = rec.width / newBound.getWidth(); @@ -100,7 +109,7 @@ g.setPaint(fg_); //--couleur de fond --// - g.setColor(couleurFond); + g.setColor(getColorFond()); g.fill(shape); @@ -120,45 +129,33 @@ return fg_; } + /** - * @return the tl_ - */ - public TraceLigneModel getTraceLigneModel() { - return tl_; - } - - /** * @param _fg the fg to set */ public void setFg(Paint _fg) { this.fg_ = _fg; } - /** - * @param _tl the tl_ to set - */ - public void setTraceLigneModel(TraceLigneModel _tl) { - this.tl_ = _tl; - } - public void setColorContour(Color newColor){ - couleurContour=newColor; - tl_.setCouleur(newColor); - repaint(); - } - - public Color getColorContour(){ - return couleurContour; - } +// public void setColorContour(Color newColor){ + // couleurContour=newColor; + // getTraceLigneModel().setCouleur(newColor); + // repaint(); + // } + // + // public Color getColorContour(){ + // return couleurContour; + // } + // + // public void setColorFond(Color newColor){ + // couleurFond=newColor; + // repaint(); + // } + // + // public Color getColorFond(){ + // return couleurFond; + // } - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - - public Color getColorFond(){ - return couleurFond; - } - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Classe qui permet de faire un undo redo sur le front/back + * + * @author Adrien Hadoux + * + */ +public class CommandBringToFront implements CtuluCommand { + + List<EbliWidget> widgets_; + + public CommandBringToFront(List<EbliWidget> widgets_) { + super(); + this.widgets_ = widgets_; + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToFront(); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToBack(); + + } + refreshScene(); + } + +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,60 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; - -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - - -public class CommandColorContour implements CtuluCommand { - - - List<Color> oldColor; - Color newColor; - java.util.List<EbliWidget> widgets_; - - - - public CommandColorContour(List<EbliWidget> listeWidget, - List<Color> oldColor,Color newColor) { - super(); - this.widgets_ = listeWidget; - this.newColor = newColor; - this.oldColor = oldColor; - if (widgets_.size() != oldColor.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorContour(oldColor.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorContour(newColor); - - } - refreshScene(); - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,59 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - - -public class CommandColorFond implements CtuluCommand { - - - List<Color> oldColor; - Color newColor; - java.util.List<EbliWidget> widgets_; - - - - public CommandColorFond(List<EbliWidget> listeWidget, - List<Color> oldColor,Color newColor) { - super(); - this.widgets_ = listeWidget; - this.newColor = newColor; - this.oldColor = oldColor; - if (widgets_.size() != oldColor.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorFond(oldColor.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorFond(newColor); - - } - refreshScene(); - } - -} \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,64 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; -import java.awt.Font; -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - -/** - * Commande pour le undo redo sur les fontes - * @author Adrien Hadoux - * - */ -public class CommandFont implements CtuluCommand { - - - List<Font> oldFonts; - Font newFont; - java.util.List<EbliWidget> widgets_; - - - - public CommandFont(List<EbliWidget> listeWidget, - List<Font> oldFont,Font newFont) { - super(); - this.widgets_ = listeWidget; - this.newFont = newFont; - this.oldFonts = oldFont; - if (widgets_.size() != oldFont.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setFormeFont(oldFonts.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setFormeFont(newFont); - - } - refreshScene(); - } - -} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,58 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Rectangle; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Commande pour le undo redo sur les retaillages. + * + * @author Adrien Hadoux + * + */ +public class CommandRetaillage implements CtuluCommand { + + List<Rectangle> oldRectangles; + Rectangle newRectangle; + java.util.List<EbliWidget> widgets_; + + public CommandRetaillage(List<EbliWidget> listeWidget, List<Rectangle> oldRectangle, Rectangle newRectangle) { + super(); + this.widgets_ = listeWidget; + this.newRectangle = newRectangle; + this.oldRectangles = oldRectangle; + if (widgets_.size() != oldRectangle.size()) + throw new IllegalArgumentException("list must ahava the same size"); + + } + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setPreferredBounds(oldRectangles.get(i)); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setPreferredBounds(newRectangle); + + } + refreshScene(); + } + +} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Classe qui permet de faire un undo redo sur le front/back + * + * @author Adrien Hadoux + * + */ +public class CommandeBringToBack implements CtuluCommand { + + List<EbliWidget> widgets_; + + public CommandeBringToBack(List<EbliWidget> widgets_) { + super(); + this.widgets_ = widgets_; + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToBack(); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToFront(); + + } + refreshScene(); + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,89 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + + +/** + * Command undo/redo sur toutes les proprietes graphiques des widgets. + * + * @author Adrien Hadoux + * + */ +public class CommandeUndoRedoGraphicalProperties implements CtuluCommand { + + List<Map<String, Object>> oldGraphicalProperties; + List<Map<String, Object>> newGraphicalProperties; + + java.util.List<EbliWidget> widgets_; + + + + public CommandeUndoRedoGraphicalProperties(List<Map<String, Object>> newGraphicalProperties, + List<Map<String, Object>> oldGraphicalProperties, List<EbliWidget> widgets_) { + super(); + this.newGraphicalProperties = newGraphicalProperties; + this.oldGraphicalProperties = oldGraphicalProperties; + this.widgets_ = widgets_; + } + + /** + * constructeur sans parametre. il faudra par la suite ajouter des old et new + * graphical properties + */ + public CommandeUndoRedoGraphicalProperties() { + widgets_ = new ArrayList<EbliWidget>(); + oldGraphicalProperties = new ArrayList<Map<String, Object>>(); + newGraphicalProperties = new ArrayList<Map<String, Object>>(); + } + + + public void addWidget(EbliWidget w) { + widgets_.add(w); + } + + public void addOldPropertie(Map oldProperty) { + oldGraphicalProperties.add(oldProperty); + } + + public void addNewPropertie(Map newProperty) { + newGraphicalProperties.add(newProperty); + } + + public void undo() { + + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).propGraphique = oldGraphicalProperties.get(i); + + } + refreshScene(); + + + } + + public void redo() { + + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).propGraphique = newGraphicalProperties.get(i); + + } + refreshScene(); + } + + + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,17 +1,17 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.awt.Point; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.Iterator; import java.util.Set; -import javax.swing.AbstractAction; - +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; /** * classe qui permet de placer les widgets selectionnes en arriere plan. @@ -21,11 +21,14 @@ public class EbliWidgetActionBackGround extends EbliActionSimple{ EbliScene scene_; + CtuluCommandContainer cmd_; + public EbliWidgetActionBackGround(EbliScene _scene){ super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_arriereplan"), "BACKGROUND"); scene_=_scene; + cmd_ = _scene.getCmdMng(); putValue(NAME,"Arri\xE8re plan"); } @@ -34,42 +37,47 @@ public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub - - //-- recuperation de la liste des nodes de la scene --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); - //-- parcours des nodes - for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + + //-- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); - EbliNode currentNode=it.next(); - if(currentNode!=null && currentNode.isMovable()){ + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + //-- parcours des nodes + for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ - //-- deplacement a l arriere plan que si la widget est selectionnee --// - if(currentNode.getCreator().getWidget().getState().isSelected()){ - - - //-- on ajoute au premierplan tous les autres widget sauf currentnode --// - for(Iterator<EbliNode> it2=listeNode.iterator();it2.hasNext();){ - - //-- recuperation du node - EbliNode foregroundNode=it2.next(); - - if(foregroundNode!=null && foregroundNode != currentNode && foregroundNode.isMovable() ) - - //-- ajout au premier plan du node --// - scene_.getVisu().addChild(foregroundNode.getCreator().getWidget()); - - } - - //-- rafraichissement de la scene --// - scene_.refresh(); - - - } - } + EbliNode currentNode=it.next(); + if(currentNode!=null && currentNode.isMovable()){ - } + + //-- ajout au premier plan du node --// + // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); + + currentNode.getCreator().getWidget().bringToBack(); + + listeWidget.add(currentNode.getCreator().getWidget()); + + //-- rafraichissement de la scene --// + scene_.refresh(); + + + + } + + } + + // -- enregistrement de la commande undoRedo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandeBringToBack(listeWidget)); + } + + + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -7,10 +7,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.Icon; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -52,68 +51,70 @@ - public void actionPerformed(ActionEvent e) { - - - - //-- choix de la couleur par l utilisateur --// - Color couleur = BuColorChooser.showDialog(null,"Couleur du fond",Color.white); - if(couleur != null){ - - //on met a joru les couleurs pour toutes les widgets selectionnees --// - - //-- recupere les anciennes color --// - List<Color> oldColor=new ArrayList<Color>(); ; - - //-- nouvelle couleur --// - - Color newColor=couleur; - - //-- liste des widget selectionnees --// - java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); - - //-- liste des nodes selectionnes --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ - - - for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + public void actionPerformed(ActionEvent e) { - EbliNode currentNode = it.next(); - - if(currentNode.hasWidget()){ - - EbliWidget widget=currentNode.getCreator().getWidget(); - //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// - - //-- test pour savoir si le widget gere le colorcontour --// - if(widget.getColorFond()!=null){ - - //-- ajout pour les undo redo - listeWidget.add(widget); - oldColor.add(widget.getColorFond()); - - //-- mise a jour de la nouvelle couleur --// - widget.setColorFond(newColor); - - - - } - - } - } - //-- rafraichissement de la scene --// - scene_.refresh(); - - //-- ajout de l action undo redo --// - if (cmd_ != null) { - cmd_.addCmd(new CommandColorFond(listeWidget, oldColor, newColor)); - - } + // -- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null, "Couleur de fond", Color.black); + if (couleur != null) { - - - } - + // on met a joru les couleurs pour toutes les widgets selectionnees --// + + // -- recupere les anciennes graphical properties --// + List<Map<String, Object>> oldGraphicalProperties = new ArrayList<Map<String, Object>>(); + + + // -- liste des nouvelles graphical properties --// + List<Map<String, Object>> newGraphicalProperties = new ArrayList<Map<String, Object>>(); + + + // -- nouvelle couleur --// + + Color newColor = couleur; + + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + // -- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + + if (currentNode.hasWidget()) { + + EbliWidget widget = currentNode.getCreator().getWidget(); + + // -- test pour savoir si le widget gere le colorcontour --// + if (widget.getColorFond() != null) { + + // -- ajout pour les undo redo + listeWidget.add(widget); + oldGraphicalProperties.add(widget.duplicateGraphicalProperties()); + + // -- mise a jour de la nouvelle couleur --// + widget.setColorFond(newColor); + + // -- ajout de la nouvelle graphicalProperty --// + newGraphicalProperties.add(widget.propGraphique); + + } + + } + } + // -- rafraichissement de la scene --// + scene_.refresh(); + + if (cmd_ != null) { + cmd_ + .addCmd(new CommandeUndoRedoGraphicalProperties(newGraphicalProperties, oldGraphicalProperties, listeWidget)); + + } + + + + } + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -6,10 +6,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.Icon; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -61,9 +60,12 @@ //on met a joru les couleurs pour toutes les widgets selectionnees --// - //-- recupere les anciennes color --// - List<Color> oldColor=new ArrayList<Color>(); ; + //-- recupere les anciennes graphical properties --// + List<Map<String, Object>> oldGraphicalProperties=new ArrayList<Map<String, Object>>(); ; + //-- liste des nouvelles graphical properties --// + List<Map<String, Object>> newGraphicalProperties=new ArrayList<Map<String, Object>>(); ; + //-- nouvelle couleur --// Color newColor=couleur; @@ -82,18 +84,20 @@ if(currentNode.hasWidget()){ EbliWidget widget=currentNode.getCreator().getWidget(); - //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + //-- test pour savoir si le widget gere le colorcontour --// if(widget.getColorContour()!=null){ //-- ajout pour les undo redo listeWidget.add(widget); - oldColor.add(widget.getColorContour()); + oldGraphicalProperties.add(widget.duplicateGraphicalProperties()); //-- mise a jour de la nouvelle couleur --// widget.setColorContour(newColor); + //-- ajout de la nouvelle graphicalProperty --// + newGraphicalProperties.add(widget.propGraphique); } @@ -103,10 +107,12 @@ //-- rafraichissement de la scene --// scene_.refresh(); - //-- ajout de l action undo redo --// + if (cmd_ != null) { - cmd_.addCmd(new CommandColorContour(listeWidget, oldColor, newColor)); - + cmd_ + .addCmd(new CommandeUndoRedoGraphicalProperties(newGraphicalProperties, oldGraphicalProperties, listeWidget)); + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -10,12 +10,19 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; -import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.model.ObjectScene; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuResource; +/** + * Action qui permet de configurer les composants en ouvrant les interfaces qui + * vont bien. Ouvre la dialog de choix des composants + * + * @author Adrien Hadoux + * + */ public class EbliWidgetActionConfigure extends EbliActionSimple { ObjectScene scene_; @@ -29,24 +36,37 @@ * */ public void actionPerformed(ActionEvent e) { - EbliWidgetShape found = findWidget(); + EbliWidget found = findWidget(); if (found != null) { BConfigurePalette palette = new BConfigurePalette(false); - BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); + + // -- creation du composite avec le configure qui genere les interfaces + // necessaires --// + // BConfigurableComposite cmp = new BConfigurableComposite(new + // WidgetConfigure(found), "test"); + + BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + + palette.setTargetConf(cmp); JDialog d = new JDialog(); + d.setModal(true); + d.setTitle("Configuration graphique"); d.setContentPane(palette); + d.pack(); d.setVisible(true); } } - EbliWidgetShape findWidget() { + EbliWidget findWidget() { Set objs = scene_.getSelectedObjects(); for (Iterator iterator = objs.iterator(); iterator.hasNext();) { Object object = iterator.next(); Widget w = scene_.findWidget(object); - if (w instanceof EbliWidgetShape) { return (EbliWidgetShape) w; } + if (w instanceof EbliWidget) { + return (EbliWidget) w; + } } return null; 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-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,14 +1,11 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.awt.Point; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.swing.AbstractAction; - import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -76,6 +73,13 @@ //-- ajout du node dans la scene --// scene_.addNode(node); + + // -- duplication des map de property graphique de la widget --// + node.getCreator().getWidget().propGraphique = currentNode.getCreator().getWidget() + .duplicateGraphicalProperties(); + // -- duplication de la taille --// + node.getCreator().getWidget().setPreferredBounds(currentNode.getCreator().getWidget().getPreferredBounds()); + //-- rafraichissement de la scene --// scene_.refresh(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,28 +1,22 @@ package org.fudaa.ebli.visuallibrary.actions; -import com.memoire.bu.BuColorChooser; -import com.memoire.bu.BuComboBox; -import com.memoire.bu.BuPanel; - -import java.awt.Color; +import java.awt.Font; import java.awt.GraphicsEnvironment; -import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.JComboBox; - import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ebli.commun.EbliActionSimple; -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 com.memoire.bu.BuComboBox; + /** * Classe qui gere un petit panel permettant de changer la police. Style * logiciel windows. @@ -39,6 +33,12 @@ */ BuComboBox fonts; + BuComboBox sizeFonts; + + public BuComboBox getSizeFonts() { + return sizeFonts; + } + /** * scene. */ @@ -51,19 +51,22 @@ // -- creation de la combobox --// GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); - Font envfonts[] = gEnv.getAllFonts(); - ArrayList<Font> listeFont = new ArrayList<Font>(); - for (int i = 1; i < envfonts.length; i++) { - listeFont.add(envfonts[i]); - } - fonts = new BuComboBox(listeFont.toArray()); + + fonts = new BuComboBox(gEnv.getAvailableFontFamilyNames()); fonts.addActionListener(this); - + + sizeFonts=new BuComboBox(); + int cpt = 8; + while(cpt<100) + sizeFonts.addItem(""+cpt++); + sizeFonts.addActionListener(this); } public BuComboBox getFonts() { return fonts; } + + public void setFonts(BuComboBox fonts) { this.fonts = fonts; @@ -78,12 +81,21 @@ // -- choix de la fontpar l utilisateur --// - // -- recuperation de la font - java.util.List<Font> oldFonts = new ArrayList<Font>(); - // on met a jour les font pour toutes les widgets selectionnees --// - Font newFont = (Font) fonts.getSelectedItem(); + // -- recuperation de la fonte choisie --// + Font newFont = new Font((String) fonts.getSelectedItem(), Font.BOLD, Integer.parseInt((String) sizeFonts + .getSelectedItem())); + // on met a jour les couleurs pour toutes les widgets selectionnees --// + + // -- recupere les anciennes graphical properties --// + List<Map<String, Object>> oldGraphicalProperties = new ArrayList<Map<String, Object>>(); + + // -- liste des nouvelles graphical properties... [truncated message content] |
From: <de...@us...> - 2008-08-14 21:42:35
|
Revision: 3807 http://fudaa.svn.sourceforge.net/fudaa/?rev=3807&view=rev Author: deniger Date: 2008-08-14 21:42:43 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Corrections bogues Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.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/tree/EbliWidgetCellRendererBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.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/TrPostProjet.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -29,7 +29,6 @@ // FIXME cree un methode duplicate dans le creator // ne pas oublier de // duplicate(Map optionsGraphique) - System.err.println("je suis instance de la classe " + creator.toString()); // -- duplique rectangle if (creator instanceof EbliWidgetCreatorRectangleTexte) { duplique.setCreator(new EbliWidgetCreatorRectangleTexte(((EbliWidgetCreatorRectangleTexte) getCreator()).getG())); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -4,6 +4,6 @@ void nodeAdded(EbliNode node); - void noderemoved(EbliNode node); + void nodeRemoved(EbliNode node); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -87,19 +87,16 @@ @Override protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { - // TODO Auto-generated method stub } @Override protected void attachEdgeTargetAnchor(EbliEdge edge, EbliNode oldTargetNode, EbliNode targetNode) { - // TODO Auto-generated method stub } @Override protected Widget attachEdgeWidget(EbliEdge edge) { - // TODO Auto-generated method stub return null; } @@ -186,7 +183,7 @@ for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { EbliNodeListener listener = it.next(); - listener.noderemoved(node); + listener.nodeRemoved(node); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -4,53 +4,51 @@ import java.util.Iterator; import java.util.Set; -import javax.swing.AbstractAction; import javax.swing.JDialog; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.visuallibrary.EbliWidgetShape; import org.netbeans.api.visual.model.ObjectScene; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuResource; +public class EbliWidgetActionConfigure extends EbliActionSimple { -public class EbliWidgetActionConfigure extends AbstractAction { + ObjectScene scene_; - ObjectScene scene_; + public EbliWidgetActionConfigure(ObjectScene _widget) { + super(EbliLib.getS("Configure"), BuResource.BU.getIcon("configurer"), "CONFIGURE"); + scene_ = _widget; + } - public EbliWidgetActionConfigure(ObjectScene _widget) { - super("configure"); - scene_ = _widget; - } - - /** + /** * */ - public void actionPerformed(ActionEvent e) { - EbliWidgetShape found = findWidget(); - if (found != null) { - BConfigurePalette palette = new BConfigurePalette(false); - BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); - palette.setTargetConf(cmp); - JDialog d = new JDialog(); - d.setContentPane(palette); - d.pack(); - d.setVisible(true); - } + public void actionPerformed(ActionEvent e) { + EbliWidgetShape found = findWidget(); + if (found != null) { + BConfigurePalette palette = new BConfigurePalette(false); + BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setContentPane(palette); + d.pack(); + d.setVisible(true); } + } - EbliWidgetShape findWidget() { - Set objs = scene_.getSelectedObjects(); - for (Iterator iterator = objs.iterator(); iterator.hasNext();) { - Object object = iterator.next(); - Widget w = scene_.findWidget(object); - if (w instanceof EbliWidgetShape) { - return (EbliWidgetShape) w; - } - } - return null; - + EbliWidgetShape findWidget() { + Set objs = scene_.getSelectedObjects(); + for (Iterator iterator = objs.iterator(); iterator.hasNext();) { + Object object = iterator.next(); + Widget w = scene_.findWidget(object); + if (w instanceof EbliWidgetShape) { return (EbliWidgetShape) w; } } -} + return null; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -23,133 +23,108 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; - - /** - * Classe qui gere un petit panel permettant de changer la police. - * Style logiciel windows. + * Classe qui gere un petit panel permettant de changer la police. Style + * logiciel windows. + * * @author Adrien Hadoux - * + * */ -public class EbliWidgetActionFont implements ActionListener{ +public class EbliWidgetActionFont implements ActionListener { - -CtuluCommandContainer cmd_; + CtuluCommandContainer cmd_; -/** - * liste de tous les fontes - */ -BuComboBox fonts ; - + /** + * liste de tous les fontes + */ + BuComboBox fonts; -/** - * scene. - */ -EbliScene scene_; - + /** + * scene. + */ + EbliScene scene_; + public EbliWidgetActionFont(EbliScene _scene) { -public EbliWidgetActionFont(EbliScene _scene){ - -scene_=_scene; -cmd_=_scene.getCmdMng(); - - -//-- creation de la combobox --// -GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); -Font envfonts[] = gEnv.getAllFonts(); -ArrayList<Font> listeFont = new ArrayList<Font>(); -for (int i = 1; i < envfonts.length; i++) { - listeFont.add(envfonts[i]); -} -fonts = new BuComboBox(listeFont.toArray()); -fonts.addActionListener(this); - -} + scene_ = _scene; + cmd_ = _scene.getCmdMng(); + // -- creation de la combobox --// + GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); + Font envfonts[] = gEnv.getAllFonts(); + ArrayList<Font> listeFont = new ArrayList<Font>(); + for (int i = 1; i < envfonts.length; i++) { + listeFont.add(envfonts[i]); + } + fonts = new BuComboBox(listeFont.toArray()); + fonts.addActionListener(this); + } -public BuComboBox getFonts() { - return fonts; -} + public BuComboBox getFonts() { + return fonts; + } + public void setFonts(BuComboBox fonts) { + this.fonts = fonts; + } + /** + * appelee dans le cas d event du combo. + */ + public void actionPerformed(ActionEvent e) { -public void setFonts(BuComboBox fonts) { - this.fonts = fonts; -} + if (e.getSource().equals(fonts)) { + // -- choix de la fontpar l utilisateur --// + // -- recuperation de la font + java.util.List<Font> oldFonts = new ArrayList<Font>(); + // on met a jour les font pour toutes les widgets selectionnees --// + Font newFont = (Font) fonts.getSelectedItem(); + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); -/** - * appelee dans le cas d event du combo. - */ -public void actionPerformed(ActionEvent e) { - - - - if(e.getSource().equals(fonts)){ - - System.err.println("Aller dans actionperformed du combobox"); - - - //-- choix de la fontpar l utilisateur --// - - - //-- recuperation de la font - java.util.List<Font> oldFonts=new ArrayList<Font>(); - - //on met a jour les font pour toutes les widgets selectionnees --// - Font newFont=(Font)fonts.getSelectedItem(); - - //-- liste des widget selectionnees --// - java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); - - //-- liste des nodes selectionnes --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ - - - for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + // -- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ - EbliNode currentNode = it.next(); - - if(currentNode.hasWidget()){ - - EbliWidget widget=currentNode.getCreator().getWidget(); - //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// - - //-- test pour savoir si le widget gere le font --// - if(widget.getFormeFont()!=null){ - - //-- ajout pour les undo redo - listeWidget.add(widget); - oldFonts.add(widget.getFormeFont()); - - //-- mise a jour de la nouvelle couleur --// - widget.setFormeFont(newFont); - - - - } - - } - } - //-- rafraichissement de la scene --// - scene_.refresh(); - - //-- ajout de l action undo redo --// - if (cmd_ != null) { - cmd_.addCmd(new CommandFont(listeWidget, oldFonts, newFont)); - - } + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - - -} + EbliNode currentNode = it.next(); -} + if (currentNode.hasWidget()) { + EbliWidget widget = currentNode.getCreator().getWidget(); + // -- recuperatioon de l ancienne color et de la widget associee pour + // le undo --// + // -- test pour savoir si le widget gere le font --// + if (widget.getFormeFont() != null) { + + // -- ajout pour les undo redo + listeWidget.add(widget); + oldFonts.add(widget.getFormeFont()); + + // -- mise a jour de la nouvelle couleur --// + widget.setFormeFont(newFont); + + } + + } + } + // -- rafraichissement de la scene --// + scene_.refresh(); + + // -- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandFont(listeWidget, oldFonts, newFont)); + + } + + } + + } + } 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-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -27,6 +27,15 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.fu.FuLog; + +/** + * + * Classe permettant d'afficher un calque en tant que Widget + * + * @author deniger + * + */ public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { ZEbliCalquesPanel calquePanel_; @@ -37,10 +46,9 @@ GrBoite zoom_; - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; @@ -61,16 +69,8 @@ } - /* - * (non-Javadoc) - * - * @see - * org.netbeans.api.visual.action.EditProvider#edit(org.netbeans.api.visual - * .widget.Widget) - */ public void edit(Widget _widget) { - if (frame_ != null) - frame_.toFront(); + if (frame_ != null) frame_.toFront(); else { // final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); @@ -88,8 +88,7 @@ @Override public void windowClosed(WindowEvent _e) { - if (frame_ != null) - frame_.dispose(); + if (frame_ != null) frame_.dispose(); frame_ = null; } @@ -121,40 +120,35 @@ Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); - - - + if (frame_ == null) { initSize(rec); + if (zoom_ != null) { + // image=null; + calquePanel_.getVueCalque().changeRepere(this, zoom_); + + } else calquePanel_.restaurer(); } - if (zoom_ != null) { -// image=null; - calquePanel_.getVueCalque().changeRepere(this, zoom_); - } else - calquePanel_.restaurer(); // mode edition if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + FuLog.debug("EWI: recreate image"); Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - - if(image==null) image = calquePanel_.produceImage(rec.width, rec.height, params); - - + } g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - - - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); + + public void setColorFond(Color newColor) { + couleurFond = newColor; + repaint(); } - - public Color getColorFond(){ - return couleurFond; + + public Color getColorFond() { + return couleurFond; } - + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -6,16 +6,21 @@ import javax.swing.Icon; import javax.swing.tree.TreeCellRenderer; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ctulu.CtuluLibString; import org.jdesktop.swingx.renderer.DefaultTreeRenderer; import org.jdesktop.swingx.renderer.IconValue; import org.jdesktop.swingx.renderer.StringValue; +/** + * @author deniger + * + */ +// TODO a am\xE9liorer public class EbliWidgetCellRendererBuilder { private static final class WidgetIconValue implements IconValue { public Icon getIcon(Object _value) { - EbliNodeDefault node = new EbliNodeDefault(); + // EbliNodeDefault node = new EbliNodeDefault(); Icon ic = new Icon() { public void paintIcon(Component _c, Graphics _g, int _x, int _y) { @@ -33,18 +38,16 @@ return 16; } }; - System.err.println("eee " + _value.getClass()); - // TODO Auto-generated method stub return ic; } } + @SuppressWarnings("serial") public static TreeCellRenderer getNodeIconCellRenderer() { return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { public String getString(Object _value) { - // TODO Auto-generated method stub - return ""; + return CtuluLibString.EMPTY_STRING; } }); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -7,9 +7,11 @@ import javax.swing.Icon; import javax.swing.tree.TreePath; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; +import org.fudaa.ebli.visuallibrary.EbliScene; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; @@ -22,448 +24,117 @@ * @author Adrien Hadoux * */ -public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements - EbliNodeListener { +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener { - // -- le nombre de colonnes est statique --// - final static int NBCOLUMN = 3; + // -- le nombre de colonnes est statique --// + // final static int NBCOLUMN = 3; - /** - * titres des colonnes. - */ - public String[] title = { "", EbliLib.getS("Nom"), "V" }; + /** + * titres des colonnes. + */ + private static final String[] title = { "", EbliLib.getS("Nom"), "V" }; - /** - * Icones associees au treemodeltable. - */ - // public Icon iconLeafEnabled = - // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - // public Icon iconLeafDisabled = - // CtuluResource.CTULU.getIcon("crystal22_cacher"); - // public Icon iconSubDirectorie = - // CtuluResource.CTULU.getIcon("reouvrir_26"); - // public Icon iconRoot = CtuluResource.CTULU.getIcon("maison_32"); - // - // /** - // * composant graphique utiliser ppuor afficher l etat masquer/visible du - // * widget . - // */ - // public BuCheckBox chexBox_ = new BuCheckBox(); - // - // public BuLabel labelIcon = new BuLabel(); - // - // public BuLabel labelTexte = new BuLabel(); - /** - * scene dont le model est associe - */ - // public EbliScene scene_; - /** - * numero du layer - */ - // int numLayer; - // FIXME le model n'a pas a connaitre le JXTree - // JXTreeTable tree_; - // - // public JXTreeTable getTree() { - // return tree_; - // } - // - // public void setTree_(JXTreeTable tree) { - // this.tree_ = tree; - // } - // -- noeud aui se trouve au sommet --// - // FIXME deja donne par getNodeRoot - // DefaultMutableTreeTableNode nodeRoot_; - /** - * constructeur. - * - * @param numLayer - * @param scene_ - */ - public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot/* - * , - * Widget - * parent - */) { - super(nodeRoot); - // this.numLayer = numLayer; - // this.scene_ = scene_; + final EbliScene scene_; - // --initialisation du node root --// - // nodeRoot_ = nodeRoot;// new - // DefaultMutableTreeTableNode("Layer "+numLayer); + /** + * constructeur. + * + * @param numLayer + * @param scene_ + */ + public EbliWidgetJXTreeTableModel(EbliScene _scene) { + super(EbliWidgetTreeTableNode.build(_scene)); + scene_ = _scene; + } - } + public EbliScene getScene() { + return scene_; + } - public void nodeAdded(EbliNode _node) { - refresh(); - } + public void nodeAdded(EbliNode _node) { + refresh(); + } - public void noderemoved(EbliNode _node) { - // refresh(); + public void nodeRemoved(EbliNode _node) { + MutableTreeTableNode aSuppr = findTreeTableNode(_node); - // -- modifs --// - DefaultMutableTreeTableNode Asuppr = null; - // -- recuperation des nodes --// - Enumeration<MutableTreeTableNode> liste = (Enumeration<MutableTreeTableNode>) getRoot().children(); + // -- suppression du node de ses parents + if (aSuppr != null) removeNodeFromParent(aSuppr); - while (liste.hasMoreElements() && Asuppr == null) { + // -- rafraichissement du modele --// + // modeleTree.reload(); + // reload(); - DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) liste.nextElement(); + // setResizeColumn(); - // recuperation du node - EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); + } - if (nodeSuspect != null && nodeSuspect == _node) - Asuppr = suspect; + public MutableTreeTableNode findTreeTableNode(EbliNode _node) { + // -- recuperation des nodes --// + TreeTableNode parent = getRoot(); + Enumeration<? extends TreeTableNode> childrens = parent.children(); + while (childrens.hasMoreElements()) { + MutableTreeTableNode suspect = findTreeTableNode(_node, (MutableTreeTableNode) childrens.nextElement()); + if (suspect != null) return suspect; } + return null; + } - // -- suppression du node de ses parents - if (Asuppr != null) - removeNodeFromParent(Asuppr); + public MutableTreeTableNode findTreeTableNode(EbliNode _node, MutableTreeTableNode parent) { + if (parent.getUserObject() == _node) return parent; + Enumeration<? extends TreeTableNode> childrens = parent.children(); + while (childrens.hasMoreElements()) { + MutableTreeTableNode suspect = (MutableTreeTableNode) childrens.nextElement(); + if (suspect.getUserObject() == _node) return suspect; - // -- rafraichissement du modele --// - // modeleTree.reload(); - reload(); + } + return null; - // setResizeColumn(); - - - } + } - private void refresh() { - EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); + private void refresh() { + EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); - Enumeration<? extends MutableTreeTableNode> children = root.children(); - int childCount = root.getChildCount(); - List<TreeTableNode> res = new ArrayList(childCount); - for (int i = 0; i < childCount; i++) { - res.add(root.getChildAt(i)); - } - for (TreeTableNode treeTableNode : res) { - removeNodeFromParent((MutableTreeTableNode) treeTableNode); - } - EbliWidgetTreeTableNode.fillRoot(root); - modelSupport.fireNewRoot(); - } + Enumeration<? extends MutableTreeTableNode> children = root.children(); + int childCount = root.getChildCount(); + List<TreeTableNode> res = new ArrayList(childCount); + for (int i = 0; i < childCount; i++) { + res.add(root.getChildAt(i)); + } + for (TreeTableNode treeTableNode : res) { + removeNodeFromParent((MutableTreeTableNode) treeTableNode); + } + EbliWidgetTreeTableNode.fillRoot(root); + modelSupport.fireNewRoot(); + } - public Class<?> getColumnClass(int arg0) { - // TODO Auto-generated method stub - switch (arg0) { - case 0: - return Icon.class; - case 1: - return String.class; - case 2: - return Boolean.class; - default: - return null; - } + public Class<?> getColumnClass(int arg0) { + switch (arg0) { + case 0: + return Icon.class; + case 1: + return String.class; + case 2: + return Boolean.class; + default: + return null; + } - } + } - // - // public int getColumnCount() { - // return NBCOLUMN; - // } - // - public String getColumnName(int arg0) { - if (arg0 < NBCOLUMN) - return title[arg0]; - else - return ""; - } - // - // /** - // * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. - // */ - // public Object getValueAt(Object arg0, int column) { - // - // // -- recuperation du mutableTreenode qui contient le node de la scene - // --// - // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) - // arg0; - // return nodeTree.getUserObject(); - // // - // // // -- test si il s agit du node root --// - // // if (nodeTree == nodeRoot_) { - // // if (column == 0) { - // // labelIcon.setIcon(iconRoot); - // // return iconRoot;// labelIcon; - // // } else if (column == 1) { - // // - // // return "Layer " + numLayer; - // // } else { - // // // recherche si au moins un sous fils est affiche sinon retourne false - // // boolean auMoinsUnSousElementAffiche = false; - // // - // // Enumeration<MutableTreeTableNode> liste = - // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - // // while (liste.hasMoreElements() && !auMoinsUnSousElementAffiche) { - // // - // // // System.err.println( - // // // "je suis setValueAt(Object arg0, int column et value) )"+box); - // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) - // // liste.nextElement(); - // // - // // // -- si il existe au moins un sous fils qi est affiche alors on est - // // // ok --// - // // if (((Boolean) getValueAt(modif, 2)).booleanValue()) { - // // auMoinsUnSousElementAffiche = true; - // // } - // // - // // } - // // - // // return auMoinsUnSousElementAffiche; - // // } - // // } - // // // --recuperation du node de la scene --// - // // EbliNode node = (EbliNode) nodeTree.getUserObject(); - // // - // // // -- cas 1 recuperation de l icone --// - // // if (column == 0) { - // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) - // // labelIcon.setIcon(iconLeafEnabled); - // // else - // // labelIcon.setIcon(iconLeafDisabled); - // // - // // return iconLeafEnabled;// labelIcon; - // // - // // } else - // // // -- recuperation du title --// - // // if (column == 1) { - // // // labelTexte.setText(node.getTitle()); - // // return node.getTitle();// labelTexte; - // // - // // } else - // // // -- recuperation de la checkbox --// - // // if (column == 2) { - // // boolean coche; - // // System.err.println("je suis la checbox: wodget selectionee:" + - // // node.getCreator().getWidget().isVisible()); - // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) - // // // coche la checkbox - // // coche = true;// chexBox_.setSelected(true); - // // else - // // coche = false;// chexBox_.setSelected(false); - // // - // // return coche;// chexBox_; - // // } - // // - // // return null; - // } - // - // /** - // * seul le texte et la checkbox sont editables - // */ - // public boolean isCellEditable(Object arg0, int column) { - // // TODO Auto-generated method stub - // - // if (column == 0 || column >= NBCOLUMN) - // return false; - // else - // return true; - // } - // - // /** - // * placer une valeur - // */ - // - // public void setValueAt(Object value, Object nodeT, int column) { - // // TODO Auto-generated method stub - // - // // -- recuperation du mutableTreenode qui contient le node de la scene - // --// - // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) - // nodeT; - // - // // // -- on essaie de masquer tous les sous repertoires --// - // // if (nodeTree == nodeRoot_ && column == 2) { - // // - // // // si on coche sur la check, on fait tout disparaitre - // // // --recupeation de la checkBox --// - // // boolean box = ((Boolean) value).booleanValue(); - // // Enumeration<MutableTreeTableNode> liste = - // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - // // while (liste.hasMoreElements()) { - // // - // //System.err.println( - // "je suis setValueAt(Object arg0, int column et value) )" - // // + box); - // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) - // // liste.nextElement(); - // // - // // - // //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible( - // // // box); - // // - // // // -- envoi du signal a tous les noeuds fils: reccurence sur le - // checkbox - // // // --// - // // setValueAt(value, modif, 2); - // // - // // } - // // - // // } - // // // -- si node tree = ROOT on arrete les frais --// - // // if (!nodeTree.isLeaf()) - // // return; - // // - // // // --recuperation du node de la scene --// - // // EbliNode node = (EbliNode) nodeTree.getUserObject(); - // // - // // // -- recuperation de la value en fonction de la colonne --// - // // if (column == 1) { - // // // --recuperation du nouveau nom --// - // // String newTitle = ((/* BuLabel */String) value);// .getText(); - // // node.setTitle(newTitle); - // // } else { - // // // --recupeation de la checkBox --// - // // boolean box = ((Boolean) value).booleanValue(); - // // - // // // -- affichage de la widget --// - // // node.getCreator().getWidget().setVisible(box); - // // - // // // -- rafraichissement de la scene --// - // // scene_.refresh(); - // // } - // // - // // // rafraichissement de l arbre - // // reload(); - // // - // // setResizeColumn(); - // - // } - // - // /** - // * Raffraichissement maison du jxtreetable - // */ - public void reload() { - - this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(getRoot()))); + public String getColumnName(int arg0) { + if (arg0 < title.length) return title[arg0]; + return CtuluLibString.EMPTY_STRING; } - // - // /** - // * methode qui redimensionne les colonens du table. - // */ - // // public void setResizeColumn() { - // // if (tree_ == null) - // // return; - // // tree_.getColumn(0).setPreferredWidth(60); - // // tree_.getColumn(1).setPreferredWidth(50); - // // tree_.getColumn(2).setPreferredWidth(5); - // // - // // tree_.getColumn(0).setResizable(false); - // // tree_.getColumn(1).setResizable(false); - // // tree_.getColumn(2).setResizable(false); - // // tree_.validate(); - // // } - // /* - // * public void addTreeModelListener(TreeModelListener l) { // TODO - // * Auto-generated method stub - // * - // * } - // */ - // /* - // * public Object getChild(Object parent, int index) { // TODO - // Auto-generated - // * method stub DefaultMutableTreeTableNode nodeParent= - // * (DefaultMutableTreeTableNode) parent; - // * - // * return nodeParent.getChildAt(index); - // * - // * } - // * - // * public int getChildCount(Object parent) { // TODO Auto-generated method - // * stub DefaultMutableTreeTableNode nodeParent= - // (DefaultMutableTreeTableNode) - // * parent; return nodeParent.getChildCount(); } - // * - // * public int getIndexOfChild(Object parent, Object child) { // TODO - // * Auto-generated method stub DefaultMutableTreeTableNode nodeParent= - // * (DefaultMutableTreeTableNode) parent; - // * - // * return nodeParent.getIndex((TreeNode) child); } / public Object - // getRoot() - // { - // * // TODO Auto-generated method stub return nodeRoot_; } - // * - // * public boolean isLeaf(Object _node) { // TODO Auto-generated method - // stub - // * DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; - // * - // * return node.isLeaf(); } - // * - // * public void removeTreeModelListener(TreeModelListener l) { // TODO - // * Auto-generated method stub - // * - // * } - // * - // * public void valueForPathChanged(TreePath path, Object newValue) { // - // TODO - // * Auto-generated method stubSystem.err.println( - // * "je suis valueForPathChanged(TreePath path, Object newValue)"); } - // */ - // // -- utilisation de l interface node added - // public void nodeAdded(EbliNode node) { - // // TODO Auto-generated method stub - // - // System.err.println("je suis nodeAdded(EbliNode node)"); - // // -- ajout du nouveau node --// - // - // DefaultMutableTreeTableNode newNode = new - // DefaultMutableTreeTableNode(node); - // // nodeRoot_.add(newNode); - // - // // -- rafraichissement du modele --// - // - // // -- ajout du node dans le tree en fin de liste--// - // // insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); - // - // // -- ajout du node dans le tree en debut de liste--// - // insertNodeInto(newNode, (MutableTreeTableNode) getRoot(), 0); - // - // // setResizeColumn(); - // // scene_.refresh(); - // - // } - // - // /** - // * Methode appelee lorsau elel recoit un signal de suppression de node de - // la - // * scene. a pour effet de chercher le treetableNode associee et de le - // * supprimer du tree ainsi que mettre a jour l arbre. - // */ - // public void noderemoved(EbliNode node) { - // - // DefaultMutableTreeTableNode Asuppr = null; - // // -- recuperation des nodes --// - // Enumeration<MutableTreeTableNode> liste = - // (Enumeration<MutableTreeTableNode>) getRoot().children(); - // - // while (liste.hasMoreElements() && Asuppr == null) { - // - // DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) - // liste.nextElement(); - // - // // recuperation du node - // EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); - // - // if (nodeSuspect != null && nodeSuspect == node) - // Asuppr = suspect; - // - // } - // - // // -- suppression du node de ses parents - // if (Asuppr != null) - // removeNodeFromParent(Asuppr); - // - // // -- rafraichissement du modele --// - // // modeleTree.reload(); - // reload(); - // - // // setResizeColumn(); - // } + // /** + // * Raffraichissement maison du jxtreetable + // */ + // private void reload() { + // + // this.modelSupport.fireTreeStructureChanged(new + // TreePath(getPathToRoot(getRoot()))); + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -52,7 +52,6 @@ } public Object getValueAt(int _column) { - System.err.println("get at" + _column); if (root) return "root"; if (_column == 0) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -323,7 +323,7 @@ f.setSize(new Dimension(1024, 768)); final BuPanel p = new BuPanel(); p.setLayout(new BuBorderLayout()); - EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene)); + EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(scene); scene.addEbliNodeListener(tree); // FIXME: mettre tout cela dans la construction de EbliWidgetJXTree // EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); @@ -335,8 +335,8 @@ // tree.getColumn(2).setPreferredWidth(5); JXTreeTable view = new JXTreeTable(tree); - BConfigurePaletteAction action = new BConfigurePaletteAction(view.getTreeSelectionModel()){ - + BConfigurePaletteAction action = new BConfigurePaletteAction(view.getTreeSelectionModel()) { + protected Object getTarget(final TreeSelectionModel _m) { final TreePath[] p = _m.getSelectionPaths(); @@ -351,7 +351,7 @@ } return null; } - + }; view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); p.add(new JScrollPane(view), BuBorderLayout.WEST); @@ -403,15 +403,13 @@ bar.add(new EbliActionSimple("undo", BuResource.BU.getToolIcon("defaire"), "UNDO") { @Override public void actionPerformed(ActionEvent _e) { - if (scene.getCmdMng().canUndo()) - scene.getCmdMng().undo(); + if (scene.getCmdMng().canUndo()) scene.getCmdMng().undo(); } }); bar.add(new EbliActionSimple("redo", BuResource.BU.getToolIcon("refaire"), "REDO") { @Override public void actionPerformed(ActionEvent _e) { - if (scene.getCmdMng().canRedo()) - scene.getCmdMng().redo(); + if (scene.getCmdMng().canRedo()) scene.getCmdMng().redo(); } }); bar.addSeparator(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -1,46 +1,27 @@ package org.fudaa.fudaa.tr.post; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; -import java.awt.event.ActionEvent; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JMenu; +import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.ListSelectionModel; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUndoRedoInterface; +import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.commun.EbliActionSimple; -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.EbliWidgetCreatorFleche; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangleTexte; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorForeground; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; -import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; +import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.jdesktop.swingx.JXCollapsiblePane; -import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; +import com.memoire.bu.BuUndoRedoInterface; /** * InternalFrame qui contient la scene EbliScene. @@ -48,9 +29,18 @@ * @author Adrien Hadoux * */ -public class TrPostLayoutFille extends BuInternalFrame { +public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, + BuUndoRedoInterface { /** + * @param _node + * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addNode(org.fudaa.ebli.visuallibrary.EbliNode) + */ + public void addNode(EbliNode _node) { + controller_.addNode(_node); + } + + /** * */ private static final long serialVersionUID = -2769884291563880931L; @@ -58,288 +48,97 @@ /** * scene de l internalFrame. */ - final private EbliScene scene_; + // final private EbliScene scene_; + TrPostLayoutPanelController controller_; - /** - * Calque principal associ\xE9 a la vue layout. - */ - private ZEbliCalquesPanel calquePrincipal; + JComponent right; /** - * Model du Jxtree associe. - */ - // private EbliWidgetJXTreeModel modelTree_; - /** - * Tree associe a la scene. - */ - private JXTreeTable tree_; - - public int indiceLayer = 1; - - /** * Constructeur de la fenetre. */ public TrPostLayoutFille() { super(); - // TODO Auto-generated constructor stub setTitle(TrResource.getS("vue 2D")); // creation de la scene EBLI - scene_ = new EbliScene(); + controller_ = new TrPostLayoutPanelController(new EbliScene()); + setContentPane(controller_.getPanel()); + } - // -- construction du jtree - /* - * // etape 1 construction du model EbliWidgetJXTreeModel model = new - * EbliWidgetJXTreeModel(1); - * - * // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - * scene_.addEbliNodeListener(model); - * - * // etape 3 creation du jxtree tree_ = new EbliWidgetJXTree(model); - * - * //renderer du jxtree EbliJXTreeTableCellRenderer renderer = new - * EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); - * tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); - * tree_.setEditable(true); //tree_.setPreferredSize(new - * Dimension(300,600)); - */ + JMenu[] menus_; + JComponent[] tools_; - // -- construction du JXTABLETREE --// - // creation du node root--// - // DefaultMutableTreeTableNode nodeRoot=new - // DefaultMutableTreeTableNode("Layer "+indiceLayer); - // -- creation du tablemodel --// - EbliWidgetJXTreeTableModel modeltable = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene_)); - - // -- ajout au listener de la scene--// - scene_.addEbliNodeListener(modeltable); - - // -- creation du JXtabletree --// - tree_ = new JXTreeTable(modeltable); - - // -- ajout du tree au model pour les dimensionnements --// - // modeltable.setTree_(tree_); - - // --vision du noeud root --// - tree_.setRootVisible(false); - - // --ajout du renderer pour les images-// - tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - - // -- ouvert par defaut --// - tree_.expandAll(); - - // -- ajout des highlighters customs --// - tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); - tree_.setShowsRootHandles(true); - // -- selection unique --// - tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tree_.setEditable(true); - - // --dimensions des colonnes --// - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se - // redimensionnents - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - - // -- initialisation de la frame --// - init(); + @Override + public JMenu[] getSpecificMenus() { + if (menus_ == null) { + menus_ = new JMenu[] { controller_.createMenu() }; + } + return menus_; } - public ZEbliCalquesPanel getCalquePrincipal() { - return calquePrincipal; + @Override + public JComponent[] getSpecificTools() { + if (tools_ == null) { + tools_ = controller_.createSpecificComponent(getDesktopPane(), this); + } + return tools_; } - public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { - this.calquePrincipal = calquePrincipal; + public void clearCmd(final CtuluCommandManager _source) { + if (getCmdMng() != null && _source != getCmdMng()) { + getCmdMng().clean(); + } } - public EbliScene getScene_() { - return scene_; - } + public JComponent createComponent() { + if (right == null) { + right = new JPanel(new BorderLayout()); -// public EbliWidgetJXTreeModel getModelTree_() { -// return modelTree_; -// } -// -// public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { -// this.modelTree_ = modelTree_; -// } - - public JXTreeTable getTree_() { - return tree_; + JXCollapsiblePane pane = new JXCollapsiblePane(); + JButton toggle = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + toggle.setText("Overview"); + JPanel over = new JPanel(new BorderLayout()); + over.add(toggle, BorderLayout.NORTH); + over.add(pane, BorderLayout.CENTER); + pane.add(getScene().createSatelliteView()); + right.add(over, BorderLayout.NORTH); + right.add(new JScrollPane(controller_.createTree()), BorderLayout.CENTER); + } + return right; } - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; + public ZEbliCalquesPanel getCalquePrincipal() { + return controller_.getCalquePrincipal(); } /** - * methode appelee pour l init de la construction de la internalframe + * @param _title + * @param _preferredLocation + * @param _preferedDimension + * @param _calque + * @return + * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addCalque(java.lang.String, + * java.awt.Point, java.awt.Dimension, + * org.fudaa.ebli.calque.ZEbliCalquesPanel) */ - public void init() { - - // -- creation du conteneur de base qui contient tout --// - BuPanel content = new BuPanel(new BuBorderLayout()); - - // -- creation de la box sur le cote qui contient le tree et la sattelite - // view --// - // Box contentEast=Box.createVerticalBox(); - - this.add(content); - - this.setLayout(new BuBorderLayout()); - - // ajout de la scene au centre - content.add(new JScrollPane(scene_.createView()), BuBorderLayout.CENTER); - - // FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux - // ajout du jtree sur la droite - getTree_().setPreferredSize(new Dimension(200, 500)); - // contentEast.add(new BuScrollPane(getTree_())); - - // -- ajout de la vue sattelite dans la box --// - // contentEast.add(getScene_().createSatelliteView()); - - // -- ajout de la box dans le content --// - // content.add(contentEast,BuBorderLayout.EAST); - - // content.doLayout(); - // this.pack(); - this.setVisible(true); - - // -- construction de la barre des commandes de base --// - content.add(buildToolBar(), BuBorderLayout.NORTH); - + public EbliNode addCalque(String _title, Point _preferredLocation, Dimension _preferedDimension, + ZEbliCalquesPanel _calque) { + return controller_.addCalque(_title, _preferredLocation, _preferedDimension, _calque); } - /** - * Methode generique d ajout d un node widget a la scene. - * - * @param node - */ - public void addNode(EbliNode node) { - getScene_().addNode(node); - - // -- rafraichissement de la scene pour eviter les plantages --// - getScene_().refresh(); + public CtuluCommandManager getCmdMng() { + return getScene().getCmdMng(); } - /** - * Methode specialisee dans l ajout d un ndoe de type calque a la scene. - * - * @param title - * de la widget - * @param preferredLocation - * de la widget - * @param preferedDimension - * de la widget - * @param calque - * contenu de la widget - * @return le node cree - */ - public EbliNode addCalque(String title, Point preferredLocation, Dimension preferedDimension, ZEbliCalquesPanel calque) { - - // -- enregistrement du calque principal --// - if (calquePrincipal == null) - // -- alors le calque recupere sera considere comem le calque principal - // --// - setCalquePrincipal(calque); - - // on ajoute le calque sous forme d'un node - - // construction du node correspondant - final EbliNode nodeCalque = new EbliNodeDefault(); - nodeCalque.setTitle(title); - nodeCalque.setPreferedSize(preferedDimension);// new Dimension(400, 200) - nodeCalque.setPreferedLocation(preferredLocation);// new Point(250, 170) - nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); - - // ajout du node au layout - addNode(nodeCalque); - - return nodeCalque; + public Class getComponentClass() { + return JPanel.class; } - /** - * Methode d ajout de composant de base graphique. - * - * @return - */ - public EbliNode addRectangleTexte() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeRect = new EbliNodeDefault(); - nodeRect.setTitle("Rectangle texte"); - nodeRect.setCreator(new EbliWidgetCreatorRectangleTexte("Tapez votre texte ici")); - nodeRect.setPreferedSize(new Dimension(200, 100)); - nodeRect.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeRect); - - return nodeRect; + public String getComponentTitle() { + return TrLib.getString("Layout"); } - - public EbliNode addEllipse() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeEllipse = new EbliNodeDefault(); - nodeEllipse.setTitle("Ellipse"); - nodeEllipse.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorEllipse())); - nodeEllipse.setPreferedSize(new Dimension(200, 100)); - nodeEllipse.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeEllipse); - return nodeEllipse; - } - - public EbliNode addCercle() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeCercle = new EbliNodeDefault(); - nodeCercle.setTitle("Cercle"); - nodeCercle.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorCircle())); - nodeCercle.setPreferedSize(new Dimension(200, 100)); - nodeCercle.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeCercle); - - return nodeCercle; - } - - - public EbliNode addRectangle() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeCercle = new EbliNodeDefault(); - nodeCercle.setTitle("rectangle"); - nodeCercle.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorRectangle())); - nodeCercle.setPreferedSize(new Dimension(200, 100)); - nodeCercle.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeCercle); - - return nodeCercle; - } - - /** - * Methode d ajout de composant de base graphique. - * - * @return - */ - public EbliNode addFleche() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeFleche = new EbliNodeDefault(); - nodeFleche.setTitle("Fleche"); - nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFleche())); - nodeFleche.setPreferedSize(new Dimension(100, 50)); - nodeFleche.setPreferedLocation(new Point(350, 125)); - - // ajout du node au layout - addNode(nodeFleche); - - return nodeFleche; + public EbliScene getScene() { + return controller_.getScene(); } /** @@ -352,118 +151,22 @@ return getCalquePrincipal(); } - /** - * Methode qui construit la toolbar contenant toutes les actions alignements, - * duplication et premier plan de la scene - * - * @return - */ - public JToolBar buildToolBar() { + public void majComponent(Object _o) {} - JToolBar bar = new JToolBar(); - // -- actions d etat des widgets --// - buildActions(bar); - - // -- action liees a la palette d objets graphiques --// - buildPaletteGraphique(bar); - - bar.setFloatable(false); - - return bar; + public void redo() { + final CtuluCommandManager c = getCmdMng(); + if (c != null) { + c.redo(); + } } - /** - * Ajoute les actions a la toolbar - */ - public void buildActions(JToolBar bar) { - // om met en place le undo/redo - scene_.setCmdMng(new CtuluCommandManager()); - bar.add(new EbliActionSimple("undo", BuResource.BU.getToolIcon("defaire"), "UNDO") { - @Override - public void actionPerformed(ActionEvent _e) { - if (scene_.getCmdMng().canUndo()) - scene_.getCmdMng().undo(); - } - }); + public void setActive(final boolean _b) {} - bar.add(new EbliActionSimple("redo", BuResource.BU.getToolIcon("refaire"), "REDO") { - @Override - public void actionPerformed(ActionEvent _e) { - if (scene_.getCmdMng().canRedo()) - scene_.getCmdMng().redo(); - } - }); - bar.addSeparator(); - // -- actions d alignement --// - bar.add(new EbliWidgetActionAlign.Left(scene_)); - bar.add(new EbliWidgetActionAlign.Right(scene_)); - bar.add(new EbliWidgetActionAlign.Middle(scene_)); - bar.add(new EbliWidgetActionAlign.Center(scene_)); - bar.add(new EbliWidgetActionAlign.Top(scene_)); - bar.add(new EbliWidgetActionAlign.Bottom(scene_)); - bar.addSeparator(); - // -- action de positions --// - bar.add(new EbliWidgetActionForeGround(scene_)); - bar.add(new EbliWidgetActionBackGround(scene_)); - bar.addSeparator(); - // -- action de duplication --// - bar.add(new EbliWidgetActionDuplicate(scene_)); - bar.addSeparator(); - - //-- Action sur le format --// - bar.add(new EbliWidgetActionColorForeground(scene_)); - bar.add(new EbliWidgetActionColorBackground(scene_)); - bar.add(new EbliWidgetActionConfigure(scene_)); - bar.addSeparator(); + public void undo() { + final CtuluCommandManager c = getCmdMng(); + if (c != null) { + c.undo(); + } } - /** - * Ajoute la palette graphique a la toolbar - */ - public void buildPaletteGraphique(JToolBar bar) { - bar.addSeparator(); - // -- palette rectangle texte--// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle texte"), EbliResource.EBLI - .getToolIcon("draw-rectangle"), "WIDGETRECTANGLE") { - public void actionPerformed(ActionEvent _evt) { - addRectangleTexte(); - } - }); - // -- palette fleche --// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), EbliResource.EBLI - .getToolIcon("crystal_bu_link"), "WIDGETFLECHE") { - public void actionPerformed(ActionEvent _evt) { - addFleche(); - } - }); - //-- palette Ellipse --// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Ellipse"), EbliResource.EBLI - .getToolIcon("ellip"), "WIDGETELLIPSE") { - public void actionPerformed(ActionEvent _evt) { - - addEllipse(); - } - }); - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Cercle"), EbliResource.EBLI - .getToolIcon("cerc"), "WIDGETCERCLE") { - public void actionPerformed(ActionEvent _evt) { - - addCercle(); - } - }); - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle"), EbliResource.EBLI - .getToolIcon("rect"), "WIDGETRECT") { - public void actionPerformed(ActionEvent _evt) { - - addRectangle(); - } - }); - - - - - bar.addSeparator(); - // getVisuPanel().getArbreCalqueModel().fillMenu(_m); - } - } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -0,0 +1,371 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JDesktopPane; +import javax.swing.JMenu; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionAbstract; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +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.EbliWidgetCreatorRectangleTexte; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorForeground; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; +import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuDesktop; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuSeparator; + +public class TrPostLayoutPanelController { + + JPanel pn_; + EbliWidgetJXTreeTableModel treeModel_; + List<EbliActionAbstract> actions; + + /** + * Calque principal associ\xE9 a la vue layout. + */ + private ZEbliCalquesPanel calquePrincipal; + + TrPostLayoutPanelController(EbliScene _scene) { + treeModel_ = new EbliWidgetJXTreeTableModel(_scene); + _scene.addEbliNodeListener(treeModel_); + _scene.setCmdMng(new CtuluCommandManager()); + } + + /** + * Methode specialisee dans l ajout d un ndoe de type calque a la scene. + * + * @param title + * de la widget + ... [truncated message content] |
From: <had...@us...> - 2008-08-14 19:08:47
|
Revision: 3806 http://fudaa.svn.sourceforge.net/fudaa/?rev=3806&view=rev Author: hadouxad Date: 2008-08-14 19:08:56 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Correction du bug si on supprime un element, ca met correctement a jour le tree Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 18:50:30 UTC (rev 3805) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 19:08:56 UTC (rev 3806) @@ -2,27 +2,19 @@ import java.util.ArrayList; import java.util.Enumeration; -import java.util.Iterator; import java.util.List; import javax.swing.Icon; import javax.swing.tree.TreePath; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; -import org.jdesktop.swingx.treetable.TreeTableModel; import org.jdesktop.swingx.treetable.TreeTableNode; -import org.netbeans.api.visual.widget.Widget; -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuLabel; - /** * Model du treetable. contient 3 colonnes: colonne 1:icone colonne 2:nom * colonne 3:checkbox associee @@ -108,7 +100,36 @@ } public void noderemoved(EbliNode _node) { - refresh(); + // refresh(); + + // -- modifs --// + DefaultMutableTreeTableNode Asuppr = null; + // -- recuperation des nodes --// + Enumeration<MutableTreeTableNode> liste = (Enumeration<MutableTreeTableNode>) getRoot().children(); + + while (liste.hasMoreElements() && Asuppr == null) { + + DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) liste.nextElement(); + + // recuperation du node + EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); + + if (nodeSuspect != null && nodeSuspect == _node) + Asuppr = suspect; + + } + + // -- suppression du node de ses parents + if (Asuppr != null) + removeNodeFromParent(Asuppr); + + // -- rafraichissement du modele --// + // modeleTree.reload(); + reload(); + + // setResizeColumn(); + + } private void refresh() { @@ -318,12 +339,11 @@ // /** // * Raffraichissement maison du jxtreetable // */ - // public void reload() { + public void reload() { + + this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(getRoot()))); + } // - // this.modelSupport.fireTreeStructureChanged(new - // TreePath(getPathToRoot(getRoot()))); - // } - // // /** // * methode qui redimensionne les colonens du table. // */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-14 18:50:24
|
Revision: 3805 http://fudaa.svn.sourceforge.net/fudaa/?rev=3805&view=rev Author: hadouxad Date: 2008-08-14 18:50:30 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Nouvelles fonctionnalites: - Action qui gere les couleurs des contours + undo/redo - Action qui gere les couleurs des contenus + undo/redo - Optimisation du dessin de l image du calque - Mise en forme et int?\195?\169gration des shapes - Cr?\195?\169ation des composants et palettes - Duplication des objets shape Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.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/EbliWidgetCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.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/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.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/TrPostProjet.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorCircle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorEllipse.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorRectangle.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -14,12 +14,12 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import com.memoire.bu.BuResource; - import org.fudaa.ebli.commun.BPalettePanelInterface; import org.fudaa.ebli.commun.EbliActionPaletteTreeModel; import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuResource; + /** * @author Fred Deniger * @version $Id: BConfigurePaletteAction.java,v 1.8 2007-05-04 13:49:44 deniger Exp $ @@ -36,6 +36,7 @@ } protected boolean setPaletteTarget(final Object _target) { + // FIXME a reprendre avec les EbliWidget if (palette_ == null) { return false; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -11,18 +11,31 @@ import java.awt.Font; import java.beans.PropertyChangeListener; -import com.memoire.bu.BuTextField; - import org.fudaa.ctulu.CtuluLibString; - import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.controle.*; +import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BSelecteurAlpha; +import org.fudaa.ebli.controle.BSelecteurCheckBox; +import org.fudaa.ebli.controle.BSelecteurColorChooser; +import org.fudaa.ebli.controle.BSelecteurColorChooserBt; +import org.fudaa.ebli.controle.BSelecteurFont; +import org.fudaa.ebli.controle.BSelecteurIconModel; +import org.fudaa.ebli.controle.BSelecteurInterface; +import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; +import org.fudaa.ebli.controle.BSelecteurTextField; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigneModel; +import com.memoire.bu.BuTextField; + /** + * FIXME a reprendre + * * @author fred deniger - * @version $Id: EGCourbeConfigureTarget.java,v 1.2 2007-05-04 13:49:41 deniger Exp $ + * @version $Id: EGCourbeConfigureTarget.java,v 1.2 2007-05-04 13:49:41 deniger + * Exp $ */ public abstract class EGCourbeConfigureTarget implements /*BConfigurableSectionInterface, */BSelecteurTargetInterface, BConfigurableInterface { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -26,7 +26,7 @@ * @version $Id: EGObject.java,v 1.17 2007-05-04 13:49:41 deniger Exp $ */ public abstract class EGObject implements Icon, BConfigurePaletteTargetInterface { - +//FIXME a reprende public BSelecteurTargetInterface getVisibleTitleTarget() { return new EGObjectConfigureVisibleTarget(this); } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,172 +0,0 @@ -package org.fudaa.ebli.courbe; - - - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.image.CtuluImageProducer; -import org.fudaa.ctulu.image.CtuluLibImage; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.graph.GraphScene; -import org.netbeans.api.visual.laf.LookFeel; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.ImageWidget; -import org.netbeans.api.visual.widget.LayerWidget; - -import sun.awt.image.ToolkitImage; - -/** - * Classe qui g\xE9n\xE8re les l\xE9gendes de chacun des graphes - * - * - * @author Adrien Hadoux - * - */ - -public class WidgetLegendeManager { - - - static List<ImageWidget> listeWidgets=null; - - //gap vertical entre chaque widget legendes - final static int Vgap=10; - //gap horizontal entre chaque widget legendes - final static int Hgap=10; - - final static int widthDefault=100; - final static int heightDefault=30; - - - public static void createWidgetLegendeGraphe(GraphScene scene,LayerWidget visu,EGGraphe graphe, Rectangle areaGraphe) { - - - listeWidgets=new ArrayList<ImageWidget>(); - - //-- cr\xE9ation, affichage et ajout du listener du graphe pour chacune des widgets suivantes --// - - for(int i=0; i<graphe.getModel().getCourbes().length;i++){ - - final EGCourbe courbe=graphe.getModel().getCourbes()[i]; - final int cpt=i; - - - - //--creation d un nouveau widget image --// - final ImageWidget legendeWidget=new ImageWidget (scene){ - public void notifyStateChanged(ObjectState previousState, - ObjectState newState) { - LookFeel lookFeel = getScene().getLookFeel(); - // setBorder(lookFeel.getBorder(newState)); - // setForeground(lookFeel.getForeground(newState)); - - setBorder(lookFeel.getBorder(newState)); - // setBorder(newState.isSelected() ? - // (DEFAULT_SELECTED_BORDER) : - // (newState.isHovered() ? RESIZE_BORDER - // : DEFAULT_BORDER)); - //repaint(); - - } - - //-- redessinne la l\xE9gende - protected void paintWidget() { - - // recuperation du rectangle contour - Rectangle rec = getClientArea(); - Graphics2D g=getGraphics(); - - g.translate(rec.x, rec.y); - - - //dimension du cadre de la l\xE9gende // - int widthCadre=rec.width; - int heightCadre=rec.height; - - //cas initial: dessin vide - if(widthCadre==0) - widthCadre=widthDefault; - if(heightCadre==0) - heightCadre=heightDefault; - - g.setColor(Color.GRAY); - g.drawRect(rec.x, rec.y,widthCadre - 1, heightCadre - 1); - - //-- dessin du titre et des lignes --// - g.setFont(new Font("Serif",Font.PLAIN,rec.height/2)); - g.setColor(courbe.getAspectContour()); - g.drawString(courbe.getTitle(),rec.x + Hgap/2 , (int)(rec.y + rec.height/2)); - //FIXME Comment je peux obtenir les icones et les lignes et les dimensionner? - } - - }; -legendeWidget.setPreferredSize(new Dimension(widthDefault,heightDefault)); - - //-- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els l\xE9gendes --// - graphe.getModel().addModelListener(new EGGrapheModelListener() { - - public void structureChanged() { - legendeWidget.repaint(); - - } - - public void courbeContentChanged(EGObject _c, boolean restore) { - legendeWidget.repaint(); - - } - - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - legendeWidget.repaint(); - // TODO Auto-generated method stub - - } - - public void axeContentChanged(EGAxe _c) { - legendeWidget.repaint(); - - } - - public void axeAspectChanged(EGAxe _c) { - legendeWidget.repaint(); - - } - }); - - //-- ajouter les actions liees au widget --// - legendeWidget.getActions().addAction( ActionFactory.createResizeAction()); - legendeWidget.getActions().addAction(ActionFactory.createMoveAction()); - legendeWidget.getActions().addAction(scene.createWidgetHoverAction()); - - - - //-- ajout de la widget dans la liste --// - listeWidgets.add(legendeWidget); - - //-- positionner le widget dans la scene par rapport au graphe et a ses autres widgets --// - //FIXME am\xE9eliorer en discuter avec Fred - legendeWidget.setPreferredLocation (new Point ((widthDefault+Hgap)*cpt, Vgap)); - - scene.addChild(legendeWidget); - - }//fin for - - //-- positionner le widget dans la scene par rapport au graphe et a ses autres widgets --// - //TODO am\xE9eliorer en discuter avec Fred - //visu.addChildren(listeWidgets); - - } - - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -8,119 +8,109 @@ import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; public class EbliNodeDefault implements EbliNode { - - EbliWidgetCreator creator; - Point preferedLocation; - Dimension preferedSize; - String title; - - - public String getTitle() { - return title; - } - - - /** - * methode qui permet de dupliquer un node - */ - public EbliNode duplicate(Map options) { - // TODO Auto-generated method stub - EbliNode duplique= new EbliNodeDefault(); - - duplique.setTitle(getTitle()); - - System.err.println("je suis instance de la classe "+creator.toString()); - //-- duplique rectangle - if(creator instanceof EbliWidgetCreatorRectangle){ - duplique.setCreator(new EbliWidgetCreatorRectangle(((EbliWidgetCreatorRectangle)getCreator()).getG())); - }else if(creator instanceof EbliWidgetCreatorFleche){ - duplique.setCreator(new EbliWidgetCreatorFleche(((EbliWidgetCreatorFleche)getCreator()).orientation)); - }else if(creator instanceof EbliWidgetCreatorDblFleche){ - duplique.setCreator(new EbliWidgetCreatorDblFleche(((EbliWidgetCreatorDblFleche)getCreator()).getG())); - }else if(creator instanceof EbliWidgetCreatorGraphe){ - duplique.setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe)getCreator()).getGraphe())); - }else if(creator instanceof EbliWidgetCreatorVueCalque){ - duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque)getCreator()).getCalque())); - }else{ - // instance pas identifie, impossible de dupliquer - return null; - } - - duplique.setPreferedSize(getPreferedSize()); - - //-- calcul nouvelle position - Point nouvellePosition = new Point( - getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget().getLocation().y + getCreator().getWidget().getClientArea().height)); - - duplique.setPreferedLocation(nouvellePosition); - //duplique.setPreferedLocation(getPreferedLocation()); - - return duplique; - } + EbliWidgetCreator creator; + Point preferedLocation; + Dimension preferedSize; + String title; + public String getTitle() { + return title; + } + /** + * methode qui permet de dupliquer un node + */ + public EbliNode duplicate(Map options) { + // TODO Auto-generated method stub + EbliNode duplique = new EbliNodeDefault(); - public void setTitle(String title) { - this.title = title; - } + duplique.setTitle(getTitle()); + // FIXME cree un methode duplicate dans le creator + // ne pas oublier de + // duplicate(Map optionsGraphique) + System.err.println("je suis instance de la classe " + creator.toString()); + // -- duplique rectangle + if (creator instanceof EbliWidgetCreatorRectangleTexte) { + duplique.setCreator(new EbliWidgetCreatorRectangleTexte(((EbliWidgetCreatorRectangleTexte) getCreator()).getG())); + } else if (creator instanceof EbliWidgetCreatorFleche) { + duplique.setCreator(new EbliWidgetCreatorFleche(((EbliWidgetCreatorFleche) getCreator()).orientation)); + } else if (creator instanceof EbliWidgetCreatorDblFleche) { + duplique.setCreator(new EbliWidgetCreatorDblFleche(((EbliWidgetCreatorDblFleche) getCreator()).getG())); + } else if (creator instanceof EbliWidgetCreatorGraphe) { + duplique.setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe())); + } else if (creator instanceof EbliWidgetCreatorVueCalque) { + duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); + } else if (creator instanceof EbliWidgetCreatorShape) { + duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); + } else { + // instance pas identifie, impossible de dupliquer + return null; + } - public void setPreferedLocation(Point p) { - this.preferedLocation = p; - // repositionnement du widget si existant - if(hasWidget()) - getCreator().getWidget().setPreferredLocation(p); - } + duplique.setPreferedSize(getPreferedSize()); - public void setPreferedSize(Dimension d) { - this.preferedSize = d; - - // repositionnement du widget si existant - if(hasWidget()) - getCreator().getWidget().setPreferredSize(d); - } + // -- calcul nouvelle position + Point nouvellePosition = new Point(getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget() + .getLocation().y + getCreator().getWidget().getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + // duplique.setPreferedLocation(getPreferedLocation()); + return duplique; + } - public void setCreator(EbliWidgetCreator creator) { - this.creator = creator; - } + public void setTitle(String title) { + this.title = title; + } - public EbliWidgetCreator getCreator() { - return creator; - } + public void setPreferedLocation(Point p) { + this.preferedLocation = p; + // repositionnement du widget si existant + if (hasWidget()) + getCreator().getWidget().setPreferredLocation(p); + } - public Point getPreferedLocation() { - - return preferedLocation; - } + public void setPreferedSize(Dimension d) { + this.preferedSize = d; - public Dimension getPreferedSize() { - // TODO Auto-generated method stub - - return preferedSize; - } - - public String toString() { - // TODO Auto-generated method stub - return title; - } + // repositionnement du widget si existant + if (hasWidget()) + getCreator().getWidget().setPreferredSize(d); + } + public void setCreator(EbliWidgetCreator creator) { + this.creator = creator; + } + public EbliWidgetCreator getCreator() { + return creator; + } - public boolean hasWidget() { - return (getCreator()!=null && getCreator().getWidget()!=null); - - } + public Point getPreferedLocation() { + return preferedLocation; + } + public Dimension getPreferedSize() { + // TODO Auto-generated method stub - public boolean isMovable() { - // TODO Auto-generated method stub - return (hasWidget() && getPreferedLocation() !=null && getPreferedSize() !=null); - } + return preferedSize; + } + public String toString() { + // TODO Auto-generated method stub + return title; + } - + public boolean hasWidget() { + return (getCreator() != null && getCreator().getWidget() != null); + } + + public boolean isMovable() { + // TODO Auto-generated method stub + return (hasWidget() && getPreferedLocation() != null && getPreferedSize() != null); + } + } 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-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,13 +1,24 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Color; +import java.awt.Font; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.util.Map; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BConfigurePaletteTargetInterface; +import org.fudaa.ebli.controle.BSelecteurInterface; +import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.model.ObjectState; @@ -19,34 +30,99 @@ * @author Adrien Hadoux * */ -public class EbliWidget extends Widget { +public class EbliWidget extends Widget implements BConfigurePaletteTargetInterface, BSelecteurTargetInterface { private EbliScene scene_; - + Map propGraphique; + private boolean useBorder_ = true; -/** - * @param scene - * @param Point - * : indiaue la location preferentiel. peut etre nul - */ -public EbliWidget(EbliScene scene) { - super(scene); - setScene_(scene); - getActions().addAction(scene.createSelectAction()); - getActions().addAction(ActionFactory.createResizeAction()); - getActions().addAction(scene.createWidgetHoverAction()); - getActions().addAction(scene.getMoveAction()); + public BConfigurableInterface[] getConfigureInterfaces() { + return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib + .getS("Affichage")) }; + } - // positionnement de la widget si precise - // if(preferredLocation!=null) - // setPreferredLocation(preferredLocation); + private BConfigurableInterface getSingleConfigureInterface() { + // return new EGCourbeConfigureTarget.Display(this) + return new BConfigurableInterface() { - // menu clic droit basique (fermeture, duplication) - setMenu(); -} + public void stopConfiguration() { + } + public BSelecteurTargetInterface getTarget() { + return EbliWidget.this; + } + + public BSelecteurInterface[] createSelecteurs() { + return new BSelecteurInterface[] { new BSelecteurLineModel() }; + } + + public String getTitle() { + return "test"; + } + + public BConfigurableInterface[] getSections() { + return null; + } + }; + + } + + public BSelecteurTargetInterface getVisibleTitleTarget() { + // FIXME voir EGObjectConfigureVisibleTarget(this) + return null; + } + + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { + // voir EGObject + } + + public Object getMin(String _key) { + return null; + } + + public Object getMoy(String _key) { + return null; + } + + public Object getProperty(String _key) { + return propGraphique.get(_key); + // return new TraceLigneModel(); + } + + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { + } + + public boolean setProperty(String _key, Object prop) { + return false; + } + + public boolean isTitleModifiable() { + return true; + } + /** + * @param scene + * @param Point + * : indiaue la location preferentiel. peut etre nul + */ + public EbliWidget(EbliScene scene) { + super(scene); + setScene_(scene); + getActions().addAction(scene.createSelectAction()); + getActions().addAction(ActionFactory.createResizeAction()); + getActions().addAction(scene.createWidgetHoverAction()); + getActions().addAction(scene.getMoveAction()); + + // positionnement de la widget si precise + // if(preferredLocation!=null) + // setPreferredLocation(preferredLocation); + + // menu clic droit basique (fermeture, duplication) + setMenu(); + } + + /** * Methode de construction des menus de base * * @param _popup @@ -58,28 +134,26 @@ public void actionPerformed(ActionEvent e) { - - - //-- recuperation du node a dupliquer --// + // -- recuperation du node a dupliquer --// EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); - - // duplication du node en question - EbliNode duplique=n.duplicate(null); - - // nouvelle position a cote de son predecesseur - // duplique.setPreferedLocation(nouvellePosition); + // duplication du node en question + EbliNode duplique = n.duplicate(null); + + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); + // -- ajout dans la scene --// - if (duplique!=null && EbliWidget.this.getScene() != null) { - EbliWidget.this.getEbliScene().addNode(duplique); - //info debug widget duplique - //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); - - //-- raffraichissement de la scene --// - EbliWidget.this.getEbliScene().refresh(); + if (duplique != null && EbliWidget.this.getScene() != null) { + EbliWidget.this.getEbliScene().addNode(duplique); + // info debug widget duplique + //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator(). + // getWidget().getPreferredBounds()); + + // -- raffraichissement de la scene --// + EbliWidget.this.getEbliScene().refresh(); } - - + } }); @@ -89,11 +163,10 @@ public void actionPerformed(ActionEvent e) { - EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); EbliWidget.this.getEbliScene().removeNode(n); - - //-- raffraichissement de la scene --// + + // -- raffraichissement de la scene --// EbliWidget.this.getEbliScene().refresh(); } @@ -114,16 +187,16 @@ } /** - * methode qui construit une widget duplication pqr default, doit etre surchargee pour reproduire l' evenement + * methode qui construit une widget duplication pqr default, doit etre + * surchargee pour reproduire l' evenement + * * @return */ - public EbliNode duplicate(){ - EbliNode duplique =null; - - - return duplique; - } + public EbliNode duplicate() { + EbliNode duplique = null; + return duplique; + } public EbliScene getEbliScene() { return scene_; @@ -167,6 +240,33 @@ public void setUseBorder(boolean _useBorder) { useBorder_ = _useBorder; } - - + + /** + * Methode a surcharger pour la recuperation des colors + * + * @param newColor + */ + public void setColorContour(Color newColor) { + + } + + public Color getColorContour() { + return null; + } + + public void setColorFond(Color newColor) { + + } + + public Color getColorFond() { + return null; + } + + public Font getFormeFont() { + return null; + } + + public void setFormeFont(Font newFont) { + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -4,7 +4,7 @@ public interface EbliWidgetCreator { EbliWidget create(EbliScene _scene); - + // FIXME a mettre dans le EbliNode EbliWidget getWidget(); // void widgetCreated(EbliWidget w); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,35 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import org.fudaa.ebli.courbe.EGGraphe; - - -public class EbliWidgetCreatorRectangle implements EbliWidgetCreator { - - String label_; - EbliWidgetRectangle res; - - public EbliWidgetCreatorRectangle(String g) { - super(); - this.label_ = g; - } - - public String getG() { - return label_; - } - - public void setG(String g) { - this.label_ = g; - } - - public EbliWidget create(EbliScene _scene) { - res= new EbliWidgetRectangle(_scene, getG()); - - return res; - } - - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } - -} Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java (from rev 3796, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,35 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGGraphe; + + +public class EbliWidgetCreatorRectangleTexte implements EbliWidgetCreator { + + String label_; + EbliWidgetRectangle res; + + public EbliWidgetCreatorRectangleTexte(String g) { + super(); + this.label_ = g; + } + + public String getG() { + return label_; + } + + public void setG(String g) { + this.label_ = g; + } + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetRectangle(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,52 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; + +/** + * Creator pour les objets graphiques de type shape. + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorShape implements EbliWidgetCreator { + + + EbliWidgetShape res; + + /** + * Le type de l objet a creer. + */ + ShapeCreator typeObject_; + + public ShapeCreator getTypeObject_() { + return typeObject_; + } + + + + public void setTypeObject_(ShapeCreator typeObject_) { + this.typeObject_ = typeObject_; + } + + + + public EbliWidgetCreatorShape(ShapeCreator _typeObject ) { + super(); + + typeObject_=_typeObject; + } + + + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetShape(_scene,typeObject_ ,null); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -52,7 +52,8 @@ public static int ORIENTATION_EAST=2; public static int ORIENTATION_WEST=3; - public Color couleur=Color.black; + public Color couleurContour=Color.black; + public Color couleurFond=Color.white; /** * @param _scene @@ -83,7 +84,14 @@ protected void paintWidget() { Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + //-- couleur de fond --// + g.setColor(couleurFond); + g.fillRect(0, 0, rec.width, rec.height); + g.translate(rec.x, rec.y); // la ligne @@ -91,7 +99,7 @@ l.setEpaisseur(largeurBorder); - l.setCouleur(couleur); + l.setCouleur(couleurContour); //FIXME prob fleche pas tres jolie l.dessineFleche(g,(int)( l.getEpaisseur() / 2),(int)( rec.height/2), (int)(rec.width-l.getEpaisseur()/2), (int)(rec.height/2)); @@ -109,19 +117,24 @@ - public Color getCouleurFleche() { - return couleur; - } + public void setColorContour(Color newColor){ + couleurContour=newColor; + repaint(); + } + + public Color getColorContour(){ + return couleurContour; + } - - - - public void setCouleurFleche(Color couleurFleche) { - this.couleur = couleurFleche; - } - + public void setColorFond(Color newColor){ + couleurFond=newColor; + repaint(); + } + + public Color getColorFond(){ + return couleurFond; + } - Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,6 +1,7 @@ package org.fudaa.ebli.visuallibrary; import java.awt.Color; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; @@ -31,7 +32,10 @@ int largeurBorder = 15; int espaceInterieur = 5; - public Color couleur=Color.black; + public Color couleurContour=Color.black; + public Color couleurFond=Color.white; + public Font fontForme; + /** * @param _scene */ @@ -86,12 +90,19 @@ protected void paintWidget() { Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); + + //-- couleur de fond --// + g.setColor(couleurFond); + g.fillRect(0, 0, rec.width, rec.height); + + g.translate(rec.x, rec.y); // la ligne TraceLigne l = new TraceLigne(); - l.setCouleur(couleur); + l.setCouleur(couleurContour); l.setEpaisseur(largeurBorder); // l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); l.dessineRectangle(g, l.getEpaisseur() / 2, l.getEpaisseur() / 2, @@ -99,6 +110,8 @@ g.translate(-rec.x, -rec.y); + + } public String getText(Widget widget) { @@ -117,5 +130,38 @@ } + public void setColorContour(Color newColor){ + couleurContour=newColor; + intern.setForeground(couleurContour); + repaint(); + } + + public Color getColorContour(){ + return couleurContour; + } + + public void setColorFond(Color newColor){ + couleurFond=newColor; + repaint(); + } + + public Color getColorFond(){ + return couleurFond; + } + + + public Font getFormeFont(){ + return fontForme; + } + public void setFormeFont(Font newFont){ + fontForme=newFont; + intern.setFont(fontForme); + intern.revalidate(); + revalidate(); + repaint(); + + } + + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,164 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.util.HashMap; +import java.util.Map; + +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.netbeans.api.visual.widget.Scene; + +/** + * Classe qui permet de dessinner des shapes. + * @author genesis + * + */ +public class EbliWidgetShape extends EbliWidget { + Paint fg_ = Color.YELLOW;//pour l'exemple + Map options_; + ShapeCreator shaper_; + + double rotation_; + + public Color couleurFond=Color.white; + public Color couleurContour=Color.black; + + public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, couleurContour);//pour l'exempls + /** + * @return the rotation_ + */ + public double getRotation() { + return rotation_; + } + + /** + * @param rotation_ the rotation_ to set + */ + public void setRotation(double rotation_) { + this.rotation_ = rotation_; + // Dimension dim = getPreferredSize(); + // if (dim != null) { + // Shape rec = new Rectangle(0, 0, dim.width, dim.height); + // AffineTransform tr = AffineTransform.getRotateInstance(dim.width / 2, dim.height / 2, rotation_); + // Rectangle bounds2 = tr.createTransformedShape(rec).getBounds(); + // dim.height = bounds2.height; + // dim.width = bounds2.width; + // setPreferredSize(dim); + // } + } + + public EbliWidgetShape (EbliScene scene, ShapeCreator _shaper, Map _options) { + super(scene); + super.setCheckClipping(true); + options_ = new HashMap(); + if (_options != null) { + options_.putAll(_options); + } + shaper_ = _shaper; + } + + /** + * + */ + @Override + protected void paintWidget() { + Graphics2D g = getGraphics(); + Rectangle recInit = getClientArea(); + // AffineTransform oldTr = g.getTransform(); + + + TraceLigne tl = new TraceLigne(tl_); + + AffineTransform oldTr = g.getTransform(); + g.translate(recInit.x, recInit.y); + float ep = tl_.getEpaisseur(); + //Il faut prendre en compte l'epaisseur de la ligne + Rectangle2D.Float rec = new Rectangle2D.Float(ep / 2, ep / 2, recInit.width - ep, recInit.height - ep); + Shape shape = shaper_.createShapeFor(rec, options_, ep); + if (rotation_ != 0) { + AffineTransform tr = AffineTransform.getRotateInstance(rotation_, rec.getCenterX(), rec.getCenterY()); + shape = tr.createTransformedShape(shape); + Rectangle2D newBound = shape.getBounds2D(); + double wRatio = rec.width / newBound.getWidth(); + double hRatio = rec.height / newBound.getHeight(); + tr = AffineTransform.getTranslateInstance(-newBound.getX(), -newBound.getY()); + shape = tr.createTransformedShape(shape); + shape = AffineTransform.getScaleInstance(wRatio, hRatio).createTransformedShape(shape); + tr = AffineTransform.getTranslateInstance(ep / 2, ep / 2); + shape = tr.createTransformedShape(shape); + } + + if (fg_ != null) { + Paint old = g.getPaint(); + g.setPaint(fg_); + + //--couleur de fond --// + g.setColor(couleurFond); + g.fill(shape); + + + + g.setPaint(old); + } + tl.dessineShape(g, shape); + g.setTransform(oldTr); + // g.translate(-recInit.x, -recInit.y); + // g.setTransform(oldTr); + } + + /** + * @return the fg + */ + public Paint getFg() { + return fg_; + } + + /** + * @return the tl_ + */ + public TraceLigneModel getTraceLigneModel() { + return tl_; + } + + /** + * @param _fg the fg to set + */ + public void setFg(Paint _fg) { + this.fg_ = _fg; + } + + /** + * @param _tl the tl_ to set + */ + public void setTraceLigneModel(TraceLigneModel _tl) { + this.tl_ = _tl; + } + + + public void setColorContour(Color newColor){ + couleurContour=newColor; + tl_.setCouleur(newColor); + repaint(); + } + + public Color getColorContour(){ + return couleurContour; + } + + public void setColorFond(Color newColor){ + couleurFond=newColor; + repaint(); + } + + public Color getColorFond(){ + return couleurFond; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,60 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Color; + +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + + +public class CommandColorContour implements CtuluCommand { + + + List<Color> oldColor; + Color newColor; + java.util.List<EbliWidget> widgets_; + + + + public CommandColorContour(List<EbliWidget> listeWidget, + List<Color> oldColor,Color newColor) { + super(); + this.widgets_ = listeWidget; + this.newColor = newColor; + this.oldColor = oldColor; + if (widgets_.size() != oldColor.size()) + throw new IllegalArgumentException("list must ahava the same size"); + + } + + + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setColorContour(oldColor.get(i)); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setColorContour(newColor); + + } + refreshScene(); + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,59 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Color; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + + +public class CommandColorFond implements CtuluCommand { + + + List<Color> oldColor; + Color newColor; + java.util.List<EbliWidget> widgets_; + + + + public CommandColorFond(List<EbliWidget> listeWidget, + List<Color> oldColor,Color newColor) { + super(); + this.widgets_ = listeWidget; + this.newColor = newColor; + this.oldColor = oldColor; + if (widgets_.size() != oldColor.size()) + throw new IllegalArgumentException("list must ahava the same size"); + + } + + + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setColorFond(oldColor.get(i)); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setColorFond(newColor); + + } + refreshScene(); + } + +} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,64 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Color; +import java.awt.Font; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Commande pour le undo redo sur les fontes + * @author Adrien Hadoux + * + */ +public class CommandFont implements CtuluCommand { + + + List<Font> oldFonts; + Font newFont; + java.util.List<EbliWidget> widgets_; + + + + public CommandFont(List<EbliWidget> listeWidget, + List<Font> oldFont,Font newFont) { + super(); + this.widgets_ = listeWidget; + this.newFont = newFont; + this.oldFonts = oldFont; + if (widgets_.size() != oldFont.size()) + throw new IllegalArgumentException("list must ahava the same size"); + + } + + + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setFormeFont(oldFonts.get(i)); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setFormeFont(newFont); + + } + refreshScene(); + } + +} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,119 @@ +package org.fudaa.ebli.visuallibrary.actions; + + + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.commun.EbliActionSimple; +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 com.memoire.bu.BuColorChooser; + + +/** + * Classe qui permet de changer la couleur des contours des widgets . + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionColorBackground extends EbliActionSimple{ + + + + CtuluCommandContainer cmd_; + + + EbliScene scene_; + + + + + public EbliWidgetActionColorBackground(EbliScene _scene) { + super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + + + scene_=_scene; + cmd_=_scene.getCmdMng(); + + + // TODO Auto-generated constructor stub + } + + + + + public void actionPerformed(ActionEvent e) { + + + + //-- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null,"Couleur du fond",Color.white); + if(couleur != null){ + + //on met a joru les couleurs pour toutes les widgets selectionnees --// + + //-- recupere les anciennes color --// + List<Color> oldColor=new ArrayList<Color>(); ; + + //-- nouvelle couleur --// + + Color newColor=couleur; + + //-- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); + + //-- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + + + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + + if(currentNode.hasWidget()){ + + EbliWidget widget=currentNode.getCreator().getWidget(); + //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + + //-- test pour savoir si le widget gere le colorcontour --// + if(widget.getColorFond()!=null){ + + //-- ajout pour les undo redo + listeWidget.add(widget); + oldColor.add(widget.getColorFond()); + + //-- mise a jour de la nouvelle couleur --// + widget.setColorFond(newColor); + + + + } + + } + } + //-- rafraichissement de la scene --// + scene_.refresh(); + + //-- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandColorFond(listeWidget, oldColor, newColor)); + + } + + + + } + +} + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,118 @@ +package org.fudaa.ebli.visuallibrary.actions; + + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.commun.EbliActionSimple; +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 com.memoire.bu.BuColorChooser; + + +/** + * Classe qui permet de changer la couleur des contours des widgets . + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionColorForeground extends EbliActionSimple{ + + + + CtuluCommandContainer cmd_; + + + EbliScene scene_; + + + + + public EbliWidgetActionColorForeground(EbliScene _scene) { + super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("palettecouleur"), "CONTOUR"); + + + scene_=_scene; + cmd_=_scene.getCmdMng(); + + + // TODO Auto-generated constructor stub + } + + + + + public void actionPerformed(ActionEvent e) { + + + + //-- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null,"Couleur du contour",Color.black); + if(couleur != null){ + + //on met a joru les couleurs pour toutes les widgets selectionnees --// + + //-- recupere les anciennes color --// + List<Color> oldColor=new ArrayList<Color>(); ; + + //-- nouvelle couleur --// + + Color newColor=couleur; + + //-- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); + + //-- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + + + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + + if(currentNode.hasWidget()){ + + EbliWidget widget=currentNode.getCreator().getWidget(); + //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + + //-- test pour savoir si le widget gere le colorcontour --// + if(widget.getColorContour()!=null){ + + //-- ajout pour les undo redo + listeWidget.add(widget); + oldColor.add(widget.getColorContour()); + + //-- mise a jour de la nouvelle couleur --// + widget.setColorContour(newColor); + + + + } + + } + } + //-- rafraichissement de la scene --// + scene_.refresh(); + + //-- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandColorContour(listeWidget, oldColor, newColor)); + + } + + + + } + +} + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,56 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.event.ActionEvent; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.AbstractAction; +import javax.swing.JDialog; + +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.netbeans.api.visual.model.ObjectScene; +import org.netbeans.api.visual.widget.Widget; + + + +public class EbliWidgetActionConfigure extends AbstractAction { + + ObjectScene scene_; + + public EbliWidgetActionConfigure(ObjectScene _widget) { + super("configure"); + scene_ = _widget; + } + + /** + * + */ + public void actionPerformed(ActionEvent e) { + EbliWidgetShape found = findWidget(); + if (found != null) { + BConfigurePalette palette = new BConfigurePalette(false); + BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setContentPane(palette); + d.pack(); + d.setVisible(true); + } + } + + EbliWidgetShape findWidget() { + Set objs = scene_.getSelectedObjects(); + for (Iterator iterator = objs.iterator(); iterator.hasNext();) { + Object object = iterator.next(); + Widget w = scene_.findWidget(object); + if (w instanceof EbliWidgetShape) { + return (EbliWidgetShape) w; + } + } + return null; + + } +} + Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,155 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import com.memoire.bu.BuColorChooser; +import com.memoire.bu.BuComboBox; +import com.memoire.bu.BuPanel; + +import java.awt.Color; +import java.awt.GraphicsEnvironment; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.swing.JComboBox; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + + + +/** + * Classe qui gere un petit panel permettant de changer la police. + * Style logiciel windows. + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionFont implements ActionListener{ + + +CtuluCommandContainer cmd_; + +/** + * liste de tous les fontes + */ +BuComboBox fonts ; + + +/** + * scene. + */ +EbliScene scene_; + + + +public EbliWidgetActionFont(EbliScene _scene){ + +scene_=_scene; +cmd_=_scene.getCmdMng(); + + +//-- creation de la combobox --// +GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); +Font envfonts[] = gEnv.getAllFonts(); +ArrayList<Font> listeFont = new ArrayList<Font>(); +for (int i = 1; i < envfonts.length; i++) { + listeFont.add(envfonts[i]); +} +fonts = new BuComboBox(listeFont.toArray()); +fonts.addActionListener(this); + +} + + + +public BuComboBox getFonts() { + return fonts; +} + + + +public void setFonts(BuComboBox fonts) { + this.fonts = fonts; +} + + + + + +/** + * appelee dans le cas d event du combo. + */ +public void actionPerformed(ActionEvent e) { + + + + if(e.getSource().equals(fonts)){ + + System.err.println("Aller dans actionperformed du combobox"); + + + //-- choix de la fontpar l utilisateur --// + + + //-- recuperation de la font + java.util.List<Font> oldFonts=new ArrayList<Font>(); + + //on met a jour les font pour toutes les widgets selectionnees --// + Font newFont=(Font)fonts.getSelectedItem(); + + //-- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); + + //-- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + + + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + + if(currentNode.hasWidget()){ + + EbliWidget widget=currentNode.getCreator().getWidget(); + //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + + //-- test pour savoir si le widget gere le font --// + if(widget.getFormeFont()!=null){ + + //-- ajout pour les undo redo + listeWidget.add(widget); + oldFonts.add(widget.getFormeFont()); + + //-- mise a jour de la nouvelle couleur --// + widget.setFormeFont(newFont); + + + + } + + } + } + //-- rafraichissement de la scene --// + scene_.refresh(); + + //-- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandFont(listeWidget, oldFonts, newFont)); + + } + + + +} + +} + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,70 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.beans.PropertyChangeListener... [truncated message content] |
From: <bma...@us...> - 2008-08-14 16:16:15
|
Revision: 3804 http://fudaa.svn.sourceforge.net/fudaa/?rev=3804&view=rev Author: bmarchan Date: 2008-08-14 16:16:23 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Test de merge depuis branche Trunk Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java Property Changed: ---------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2008-08-14 15:54:56 UTC (rev 3803) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2008-08-14 16:16:23 UTC (rev 3804) @@ -1,629 +1,627 @@ -/** - * @creation 24 oct. 2003 - * @modification $Date: 2008-05-13 12:10:36 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - */ -package org.fudaa.ebli.calque; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; - -import com.memoire.bu.BuTable; - -import org.fudaa.ctulu.CtuluListSelectionInterface; -import org.fudaa.ctulu.CtuluRange; - -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.commun.EbliListeSelectionMultiInterface; -import org.fudaa.ebli.commun.EbliTableInfoPanel; -import org.fudaa.ebli.commun.EbliUIProperties; -import org.fudaa.ebli.controle.BConfigurableComposite; -import org.fudaa.ebli.controle.BConfigurableInterface; -import org.fudaa.ebli.controle.BSelecteurAlpha; -import org.fudaa.ebli.controle.BSelecteurIconModel; -import org.fudaa.ebli.controle.BSelecteurLineModel; -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.geometrie.GrMorphisme; -import org.fudaa.ebli.palette.BPalettePlage; -import org.fudaa.ebli.palette.BPalettePlageAbstract; -import org.fudaa.ebli.palette.BPalettePlageDiscret; -import org.fudaa.ebli.palette.BPalettePlageInterface; -import org.fudaa.ebli.palette.BPalettePlageLegende; -import org.fudaa.ebli.palette.BPalettePlageProperties; -import org.fudaa.ebli.palette.BPaletteInfo.InfoData; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigneModel; - -/** - * @author deniger - * @version $Id: ZCalqueAffichageDonneesAbstract.java,v 1.47.6.2 2008-05-13 12:10:36 bmarchan Exp $ - */ -public abstract class ZCalqueAffichageDonneesAbstract extends BCalqueAffichage implements - ZCalqueAffichageDonneesInterface { - - public static final void ajusteZoomOnSelected(final GrBoite _r, final ZModeleDonnees _modele) { - ajusteZoomOnSelected(_r, _modele.getDomaine()); - } - - protected BConfigurableInterface getAffichageConf() { - final BConfigurableInterface[] sect = new BConfigurableInterface[1 + getNbSet()]; - sect[0] = new ZCalqueAffichageDonneesConfigure(this); - for (int i = 1; i < sect.length; i++) { - sect[i] = new ZCalqueAffichageDonneesTraceConfigure(this, i - 1); - } - return new BConfigurableComposite(sect, EbliLib.getS("Affichage")); - } - - public BConfigurableInterface getSingleConfigureInterface() { - return new BConfigurableComposite(getAffichageConf(), null); - } - - public static final void ajusteZoomOnSelected(final GrBoite _r, final GrBoite _envGeneral) { - final double wT = _envGeneral.getDeltaX(); - final double hT = _envGeneral.getDeltaY(); - final double coef = 0.1; - // premier test: le zoom ne doit pas etre inferieur a 10% du domaine total - // sinon l'utilisateur ne sait pas ou il est - if (_r.getDeltaY() < hT * coef) { - final double delta = (hT * coef - _r.getDeltaY()) / 2; - _r.e_.y_ += delta; - _r.o_.y_ -= delta; - } - if (_r.getDeltaX() < wT * coef) { - final double delta = (wT * coef - _r.getDeltaX()) / 2; - _r.e_.x_ += delta; - _r.o_.x_ -= delta; - } - // on agrandit la boite de zoom de 10% pour tout voir - double delta = _r.getDeltaY() * coef / 2; - _r.e_.y_ += delta; - _r.o_.y_ -= delta; - delta = _r.getDeltaX() * coef / 2; - _r.e_.x_ += delta; - _r.o_.x_ -= delta; - } - - protected TraceIconModel iconModel_; - - protected TraceLigneModel ligneModel_; - - protected int alpha_ = 255; - /** - * Permet de savoir si la palette de couleur doit etre utilisee ou non. Jusqu'a maintenant on testait paletteCouleur_: - * si null pas de palette et sinon palette. Or cette methode ne permet pas de sauvegarder l'etat de la palette. - */ - protected boolean isPaletteCouleurUsed_; - protected boolean painted_ = true; - - protected BPalettePlageAbstract paletteCouleur_; - - BPalettePlageLegende paletteLegende_; - - public ZCalqueAffichageDonneesAbstract() { - super(); - setDestructible(false); - } - - public boolean isEditable() { - return modeleDonnees() != null && modeleDonnees().getNombre() > 0; - } - - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - if (isVisible()) { - paintDonnees(_g, _versEcran, _versReel, _clipReel); - } - } - - /** - * Construit si necessaire la legende specifique. Sinon met a jour la legende. - */ - protected void construitLegende() { - final BCalqueLegende l = getLegende(); - if (l == null) { - return; - } - // il n'y a pas de palette, on enleve la legende. - if (isPaletteCouleurUsed_) { - if (paletteLegende_ != null) { - if (paletteLegende_.getModel() == paletteCouleur_) { - paletteLegende_.allPaletteModified(paletteCouleur_); - } else { - paletteLegende_.setModel(paletteCouleur_); - } - - } else if (paletteCouleur_ != null) { - paletteLegende_ = new BPalettePlageLegende(paletteCouleur_); - } - if (!l.containsLegend(this)) { - l.ajoute(this, paletteLegende_, getTitle()); - } - // l.revalidate(); - l.updateAll(); - } else { - l.enleve(this); - l.revalidate(); - } - } - - protected void fireSelectionEvent() { - repaint(); - ZSelectionEvent evt = null; - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ZSelectionListener.class) { - if (evt == null) { - evt = new ZSelectionEvent(this); - } - ((ZSelectionListener) listeners[i + 1]).selectionChanged(evt); - } - } - } - - /** - * @param _paletteCouleur PaletteCouleur - */ - protected void setPaletteCouleur(final BPalettePlageAbstract _paletteCouleur) { - if (paletteCouleur_ != _paletteCouleur) { - final BPalettePlageInterface vp = paletteCouleur_; - paletteCouleur_ = _paletteCouleur; - isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; - construitLegende(); - firePropertyChange("paletteCouleur", vp, paletteCouleur_); - repaint(); - } - } - - protected void updateLegendeTitre() { - if (paletteLegende_ != null) { - paletteLegende_.paletteTitreModified(paletteCouleur_); - if ((getLegende() != null) && (getLegende().isVisible())) { - getLegende().revalidate(); - getLegende().doLayout(); - } - } - } - - /** - * Permet d'ajuster le zoom (la boite _r) en fonction du modele: la boite est au moins egale a 10% du domaine total et - * elle est ensuite agrandie de 10% pour tout voir. - * - * @param _r la boite de zoom a modifier - */ - public final void ajusteZoomOnSelected(final GrBoite _r) { - ajusteZoomOnSelected(_r, modeleDonnees()); - } - - public BPalettePlageInterface createPaletteCouleur() { - return new BPalettePlage(); - } - - public BuTable createValuesTable() { - final BuTable table = modeleDonnees().createValuesTable(this); - if (table != null && EbliTableInfoPanel.containsTitle(table) == null) { - EbliTableInfoPanel.setTitle(table, getTitle()); - } - return table; - } - - /** - * Lance la premiere action. - */ - public String editSelected() { - if (actions_ != null && actions_.length > 0) { - actions_[0].updateStateBeforeShow(); - if (actions_[0].isEnabled()) { - actions_[0].actionPerformed(null); - } - } - return null; - } - - public void fillWithInfo(final InfoData _d) { - if (modeleDonnees() != null) { - modeleDonnees().fillWithInfo(_d, this); - if (!_d.isTitleSet()) { - _d.setTitle(getTitle()); - } - } - } - - public String getDataDescription() { - return getTitle(); - } - - /** - * @return Domaine - */ - public GrBoite getDomaine() { - // GrBoite r = null; - if (isVisible()) { - final ZModeleDonnees m = modeleDonnees(); - return m == null ? null : m.getDomaine(); - /* - * //r = super.getDomaine(); if (m == null) return r; if (r != null) { r.ajuste(m.getDomaine()); return r; - */ - } - return null; - } - - public TraceIconModel getIconModel(final int _idx) { - return iconModel_; - } - - public String getSetTitle(final int _idx) { - return EbliLib.getS("Trac\xE9"); - } - - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) {} - - public CtuluListSelectionInterface getLayerSelection() { - return null; - } - - public EbliListeSelectionMultiInterface getLayerSelectionMulti() { - return null; - } - - public BPalettePlageInterface getPaletteCouleur() { - return paletteCouleur_; - } - - public boolean getRange(final CtuluRange _b) { - return false; - } - - public int[] getSelectedObjectInTable() { - return null; - } - - public boolean getTimeRange(final CtuluRange _b) { - return false; - } - - public GrBoite getZoomOnSelected() { - GrBoite bt=getDomaineOnSelected(); - if (bt==null) return null; - - ajusteZoomOnSelected(bt); - return bt; - } - - public boolean isAntialiasSupported() { - return true; - } - - public void initFrom(final EbliUIProperties _p) { - if (_p != null) { - super.initFrom(_p); - if (_p.isDefined("calque.alpha")) { - setAlpha(_p.getInteger("calque.alpha")); - } - if (_p.isDefined("calque.antialias") && isAntialiasSupported()) { - antialiasing_ = _p.getBoolean("calque.antialias"); - } - final int nbSet = getNbSet(); - for (int i = 0; i < nbSet; i++) { - String prop = createPropIcon(i); - if (_p.isDefined(prop)) { - setIconModel(i, (TraceIconModel) _p.get(prop)); - } - prop = createPropLine(i); - if (_p.isDefined(prop)) { - setLineModel(i, (TraceLigneModel) _p.get(prop)); - } - } - - if (_p.isDefined("calque.paletteCouleur")) { - final BPalettePlageInterface newPalette = createPaletteCouleur(); - newPalette.load((BPalettePlageProperties) _p.get("calque.paletteCouleur")); - setPaletteCouleurPlages(newPalette); - } - } - } - - private String createPropLine(final int _i) { - return "calque." + BSelecteurLineModel.getProperty(_i); - } - - private String createPropIcon(final int _i) { - return "calque." + BSelecteurIconModel.getProperty(_i); - } - - public void inverseSelection() {} - - /** - * @return false - */ - public boolean isDiscrete() { - return false; - } - - public boolean isDonneesBoiteAvailable() { - return false; - } - - public boolean isDonneesBoiteTimeAvailable() { - return false; - } - - public boolean isOnlyOneObjectSelected() { - return false; - } - - /** - * @return true si seule la selection est dessinee. - */ - public boolean isPainted() { - return painted_; - } - - public boolean isPaletteModifiable() { - return true; - } - - public boolean isSelectionEmpty() { - return false; - } - - public boolean isSpecialSelectionAllowed() { - return false; - } - - public boolean isValuesTableAvailable() { - return modeleDonnees() == null ? false : modeleDonnees().isValuesTableAvailable(); - } - - public ZModeleDonnees modeleDonnees() { - return null; - } - - boolean antialiasing_ = true; - - public final void paintComponent(final Graphics _g) { - if (!isVisible()) { - return; - } - - if (painted_) { - final Graphics2D graphics2D = (Graphics2D) _g; - RenderingHints old = null; - if (isRapide()) { - old = graphics2D.getRenderingHints(); -// final RenderingHints newRenderer = new RenderingHints(old); - final RenderingHints newRenderer = (RenderingHints)old.clone(); // Java 1.5 - newRenderer.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - newRenderer.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - newRenderer.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); - newRenderer.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); - newRenderer.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); - newRenderer.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); - newRenderer.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); - newRenderer.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); - graphics2D.setRenderingHints(newRenderer); - } else if (isAntialiasSupported() && antialiasing_) { - old = graphics2D.getRenderingHints(); -// final RenderingHints newRenderer = new RenderingHints(old); - final RenderingHints newRenderer = (RenderingHints)old.clone(); // Java 1.5 - newRenderer.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - newRenderer.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - graphics2D.setRenderingHints(newRenderer); - } - paintDonnees(graphics2D, getVersEcran(), getVersReel(), getClipReel(_g)); - if (old != null) { - graphics2D.setRenderingHints(old); - } - } - } - - /** - * Dessine les donnees. - * - * @param _g la cible - */ - public final void paintDonnees(final Graphics2D _g) { - paintDonnees(_g, getVersEcran(), getVersReel(), getClipReel(_g)); - - } - - public final void paintDonnees(final Graphics _g) { - paintDonnees((Graphics2D) _g, getVersEcran(), getVersReel(), getClipReel(_g)); - } - - public final void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace) { - paintSelection(_g, _trace, getVersEcran(), getClipReel(_g)); - - } - - /** - * @param _c - * @param _g - * @param _x - * @param _y - */ - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - final int w = getIconWidth(); - final int h = getIconHeight(); - _g.setColor(Color.white); - _g.fillRect(_x + 1, _y + 1, w - 1, h - 1); - if (isPaletteCouleurUsed_) { - _g.setColor(Color.RED); - // le trait horizontal d'en haut en rouge - _g.drawLine(_x, _y, _x + w, _y); - _g.setColor(Color.BLUE); - // le trait horizontal d'en bas en bleu - _g.drawLine(_x, _y + h, _x + w, _y + h); - _g.setColor(Color.GREEN); - // trait vertical gauche - _g.drawLine(_x, _y, _x, _y + h); - // trait vertical droit - _g.setColor(Color.YELLOW); - _g.drawLine(_x + w, _y, _x + w, _y + h); - - } else { - _g.setColor(getForeground()); - _g.drawRect(_x, _y, w, h); - } - } - - public EbliUIProperties saveUIProperties() { - final EbliUIProperties res = super.saveUIProperties(); - final int nbSet = getNbSet(); - for (int i = 0; i < nbSet; i++) { - final TraceIconModel model = getIconModel(i); - if (model != null) { - res.put(createPropIcon(i), new TraceIconModel(model)); - } - final TraceLigneModel lineModel = getLineModel(i); - if (lineModel != null) { - res.put(createPropLine(i), new TraceLigneModel(lineModel)); - } - } - if (EbliLib.isAlphaChanged(alpha_)) { - res.put("calque.alpha", alpha_); - } - if (paletteCouleur_ != null) { - res.put("calque.paletteCouleur", paletteCouleur_.save()); - } - if (isAntialiasSupported()) { - res.put("calque.antialias", Boolean.valueOf(antialiasing_)); - } - return res; - } - - public void selectAll() {} - - public void setForeground(final Color _v) { - for (int i = getNbSet() - 1; i >= 0; i--) { - final TraceIconModel ic = getIconModel(i); - if (ic != null && ic.setCouleur(_v)) { - firePropertyChange(BSelecteurIconModel.getProperty(i), null, ic); - } - final TraceLigneModel line = getLineModel(i); - if (line != null && line.setCouleur(_v)) { - firePropertyChange(BSelecteurLineModel.getProperty(i), null, line); - } - } - super.setForeground(_v); - if (isPaletteCouleurUsed_) { - firePropertyChange("paletteCouleur", paletteCouleur_, null); - isPaletteCouleurUsed_ = false; - if (legendContainsOnlyPalette()) { - final BCalqueLegende l = getLegende(); - if (l != null) { - l.enleve(this); - l.revalidate(); - } - } - } - if (isVisible()) { - quickRepaint(); - } - - } - - /** - * @return true si la l\xE9gende ne contient que des donn\xE9es concerant la palette de couleur. dans ce cas, la legende est - * enlevee si aucune palette n'est utilis\xE9e. - */ - public boolean legendContainsOnlyPalette() { - return true; - } - - /** - * Tout sera dessine. - * - * @param _b si true, les donnees +selection seront dessines. si false, seule la selection sera dessinee. - */ - public void setPainted(final boolean _b) { - painted_ = _b; - } - - public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) { - if (paletteCouleur_ == null) { - if (isDiscrete()) { - paletteCouleur_ = new BPalettePlageDiscret(new Object[0]); - paletteCouleur_.setPlages(_newPlage.getPlages()); - } else { - paletteCouleur_ = new BPalettePlage(); - paletteCouleur_.initFrom(_newPlage); - } - } else { - paletteCouleur_.initFrom(_newPlage); - } - isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; - construitLegende(); - firePropertyChange("paletteCouleur", null, paletteCouleur_); - repaint(); - } - - public boolean setTitle(final String _title) { - final boolean r = super.setTitle(_title); - if (r && paletteLegende_ != null && getLegende() != null) { - getLegende().updateMainTitle(this, _title); - } - return r; - } - - public boolean setIconModel(final int _idx, final TraceIconModel _model) { - final TraceIconModel model = getIconModel(_idx); - final boolean r = model == null || model.updateData(_model); - if (r) { - firePropertyChange(BSelecteurIconModel.getProperty(_idx), null, model); - repaint(); - } - return r; - } - - public int getAlpha() { - return alpha_; - } - - public TraceLigneModel getLineModel(final int _idx) { - return ligneModel_; - } - - public int getNbSet() { - return 1; - } - - public boolean setLineModel(final int _idx, final TraceLigneModel _model) { - final TraceLigneModel ligne = getLineModel(_idx); - if (_model != null && ligne != null && ligne.updateData(_model)) { - firePropertyChange(BSelecteurLineModel.getProperty(_idx), null, ligne); - repaint(); - return true; - } - return false; - } - - public void setAlpha(final int _alpha) { - if (_alpha != alpha_ && _alpha >= 0 && _alpha < 256) { - final int old = alpha_; - alpha_ = _alpha; - firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY, old, alpha_); - if (isVisible()) { - repaint(); - } - } - } - - public boolean isAntialiasing() { - return antialiasing_; - } - - /** - * Efface la selection si le calque est rendu invisible. - */ - public void setVisible(boolean _b) { - if (isVisible()!=_b) { - super.setVisible(_b); - if (!_b) clearSelection(); - } - } +/** + * @creation 24 oct. 2003 + * @modification $Date: 2008-05-13 12:10:36 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + */ +package org.fudaa.ebli.calque; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; + +import com.memoire.bu.BuTable; + +import org.fudaa.ctulu.CtuluListSelectionInterface; +import org.fudaa.ctulu.CtuluRange; + +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliListeSelectionMultiInterface; +import org.fudaa.ebli.commun.EbliTableInfoPanel; +import org.fudaa.ebli.commun.EbliUIProperties; +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BSelecteurAlpha; +import org.fudaa.ebli.controle.BSelecteurIconModel; +import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.geometrie.GrMorphisme; +import org.fudaa.ebli.palette.BPalettePlage; +import org.fudaa.ebli.palette.BPalettePlageAbstract; +import org.fudaa.ebli.palette.BPalettePlageDiscret; +import org.fudaa.ebli.palette.BPalettePlageInterface; +import org.fudaa.ebli.palette.BPalettePlageLegende; +import org.fudaa.ebli.palette.BPalettePlageProperties; +import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigneModel; + +/** + * @author deniger + * @version $Id: ZCalqueAffichageDonneesAbstract.java,v 1.47.6.2 2008-05-13 12:10:36 bmarchan Exp $ + */ +public abstract class ZCalqueAffichageDonneesAbstract extends BCalqueAffichage implements + ZCalqueAffichageDonneesInterface { + + public static final void ajusteZoomOnSelected(final GrBoite _r, final ZModeleDonnees _modele) { + ajusteZoomOnSelected(_r, _modele.getDomaine()); + } + + protected BConfigurableInterface getAffichageConf() { + final BConfigurableInterface[] sect = new BConfigurableInterface[1 + getNbSet()]; + sect[0] = new ZCalqueAffichageDonneesConfigure(this); + for (int i = 1; i < sect.length; i++) { + sect[i] = new ZCalqueAffichageDonneesTraceConfigure(this, i - 1); + } + return new BConfigurableComposite(sect, EbliLib.getS("Affichage")); + } + + public BConfigurableInterface getSingleConfigureInterface() { + return new BConfigurableComposite(getAffichageConf(), null); + } + + public static final void ajusteZoomOnSelected(final GrBoite _r, final GrBoite _envGeneral) { + final double wT = _envGeneral.getDeltaX(); + final double hT = _envGeneral.getDeltaY(); + final double coef = 0.1; + // premier test: le zoom ne doit pas etre inferieur a 10% du domaine total + // sinon l'utilisateur ne sait pas ou il est + if (_r.getDeltaY() < hT * coef) { + final double delta = (hT * coef - _r.getDeltaY()) / 2; + _r.e_.y_ += delta; + _r.o_.y_ -= delta; + } + if (_r.getDeltaX() < wT * coef) { + final double delta = (wT * coef - _r.getDeltaX()) / 2; + _r.e_.x_ += delta; + _r.o_.x_ -= delta; + } + // on agrandit la boite de zoom de 10% pour tout voir + double delta = _r.getDeltaY() * coef / 2; + _r.e_.y_ += delta; + _r.o_.y_ -= delta; + delta = _r.getDeltaX() * coef / 2; + _r.e_.x_ += delta; + _r.o_.x_ -= delta; + } + + protected TraceIconModel iconModel_; + + protected TraceLigneModel ligneModel_; + + protected int alpha_ = 255; + /** + * Permet de savoir si la palette de couleur doit etre utilisee ou non. Jusqu'a maintenant on testait paletteCouleur_: + * si null pas de palette et sinon palette. Or cette methode ne permet pas de sauvegarder l'etat de la palette. + */ + protected boolean isPaletteCouleurUsed_; + protected boolean painted_ = true; + + protected BPalettePlageAbstract paletteCouleur_; + + BPalettePlageLegende paletteLegende_; + + public ZCalqueAffichageDonneesAbstract() { + super(); + setDestructible(false); + } + + public boolean isEditable() { + return modeleDonnees() != null && modeleDonnees().getNombre() > 0; + } + + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + if (isVisible()) { + paintDonnees(_g, _versEcran, _versReel, _clipReel); + } + } + + /** + * Construit si necessaire la legende specifique. Sinon met a jour la legende. + */ + protected void construitLegende() { + final BCalqueLegende l = getLegende(); + if (l == null) { + return; + } + // il n'y a pas de palette, on enleve la legende. + if (isPaletteCouleurUsed_) { + if (paletteLegende_ != null) { + if (paletteLegende_.getModel() == paletteCouleur_) { + paletteLegende_.allPaletteModified(paletteCouleur_); + } else { + paletteLegende_.setModel(paletteCouleur_); + } + + } else if (paletteCouleur_ != null) { + paletteLegende_ = new BPalettePlageLegende(paletteCouleur_); + } + if (!l.containsLegend(this)) { + l.ajoute(this, paletteLegende_, getTitle()); + } + // l.revalidate(); + l.updateAll(); + } else { + l.enleve(this); + l.revalidate(); + } + } + + protected void fireSelectionEvent() { + repaint(); + ZSelectionEvent evt = null; + final Object[] listeners = listenerList.getListenerList(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ZSelectionListener.class) { + if (evt == null) { + evt = new ZSelectionEvent(this); + } + ((ZSelectionListener) listeners[i + 1]).selectionChanged(evt); + } + } + } + + /** + * @param _paletteCouleur PaletteCouleur + */ + protected void setPaletteCouleur(final BPalettePlageAbstract _paletteCouleur) { + if (paletteCouleur_ != _paletteCouleur) { + final BPalettePlageInterface vp = paletteCouleur_; + paletteCouleur_ = _paletteCouleur; + isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; + construitLegende(); + firePropertyChange("paletteCouleur", vp, paletteCouleur_); + repaint(); + } + } + + protected void updateLegendeTitre() { + if (paletteLegende_ != null) { + paletteLegende_.paletteTitreModified(paletteCouleur_); + if ((getLegende() != null) && (getLegende().isVisible())) { + getLegende().revalidate(); + getLegende().doLayout(); + } + } + } + + /** + * Permet d'ajuster le zoom (la boite _r) en fonction du modele: la boite est au moins egale a 10% du domaine total et + * elle est ensuite agrandie de 10% pour tout voir. + * + * @param _r la boite de zoom a modifier + */ + public final void ajusteZoomOnSelected(final GrBoite _r) { + ajusteZoomOnSelected(_r, modeleDonnees()); + } + + public BPalettePlageInterface createPaletteCouleur() { + return new BPalettePlage(); + } + + public BuTable createValuesTable() { + final BuTable table = modeleDonnees().createValuesTable(this); + if (table != null && EbliTableInfoPanel.containsTitle(table) == null) { + EbliTableInfoPanel.setTitle(table, getTitle()); + } + return table; + } + + /** + * Lance la premiere action. + */ + public String editSelected() { + if (actions_ != null && actions_.length > 0) { + actions_[0].updateStateBeforeShow(); + if (actions_[0].isEnabled()) { + actions_[0].actionPerformed(null); + } + } + return null; + } + + public void fillWithInfo(final InfoData _d) { + if (modeleDonnees() != null) { + modeleDonnees().fillWithInfo(_d, this); + if (!_d.isTitleSet()) { + _d.setTitle(getTitle()); + } + } + } + + public String getDataDescription() { + return getTitle(); + } + + /** + * @return Domaine + */ + public GrBoite getDomaine() { + // GrBoite r = null; + if (isVisible()) { + final ZModeleDonnees m = modeleDonnees(); + return m == null ? null : m.getDomaine(); + /* + * //r = super.getDomaine(); if (m == null) return r; if (r != null) { r.ajuste(m.getDomaine()); return r; + */ + } + return null; + } + + public TraceIconModel getIconModel(final int _idx) { + return iconModel_; + } + + public String getSetTitle(final int _idx) { + return EbliLib.getS("Trac\xE9"); + } + + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) {} + + public CtuluListSelectionInterface getLayerSelection() { + return null; + } + + public EbliListeSelectionMultiInterface getLayerSelectionMulti() { + return null; + } + + public BPalettePlageInterface getPaletteCouleur() { + return paletteCouleur_; + } + + public boolean getRange(final CtuluRange _b) { + return false; + } + + public int[] getSelectedObjectInTable() { + return null; + } + + public boolean getTimeRange(final CtuluRange _b) { + return false; + } + + public GrBoite getZoomOnSelected() { + GrBoite bt=getDomaineOnSelected(); + if (bt==null) return null; + + ajusteZoomOnSelected(bt); + return bt; + } + + public boolean isAntialiasSupported() { + return true; + } + + public void initFrom(final EbliUIProperties _p) { + if (_p != null) { + super.initFrom(_p); + if (_p.isDefined("calque.alpha")) { + setAlpha(_p.getInteger("calque.alpha")); + } + if (_p.isDefined("calque.antialias") && isAntialiasSupported()) { + antialiasing_ = _p.getBoolean("calque.antialias"); + } + final int nbSet = getNbSet(); + for (int i = 0; i < nbSet; i++) { + String prop = createPropIcon(i); + if (_p.isDefined(prop)) { + setIconModel(i, (TraceIconModel) _p.get(prop)); + } + prop = createPropLine(i); + if (_p.isDefined(prop)) { + setLineModel(i, (TraceLigneModel) _p.get(prop)); + } + } + + if (_p.isDefined("calque.paletteCouleur")) { + final BPalettePlageInterface newPalette = createPaletteCouleur(); + newPalette.load((BPalettePlageProperties) _p.get("calque.paletteCouleur")); + setPaletteCouleurPlages(newPalette); + } + } + } + + private String createPropLine(final int _i) { + return "calque." + BSelecteurLineModel.getProperty(_i); + } + + private String createPropIcon(final int _i) { + return "calque." + BSelecteurIconModel.getProperty(_i); + } + + public void inverseSelection() {} + + /** + * @return false + */ + public boolean isDiscrete() { + return false; + } + + public boolean isDonneesBoiteAvailable() { + return false; + } + + public boolean isDonneesBoiteTimeAvailable() { + return false; + } + + public boolean isOnlyOneObjectSelected() { + return false; + } + + /** + * @return true si seule la selection est dessinee. + */ + public boolean isPainted() { + return painted_; + } + + public boolean isPaletteModifiable() { + return true; + } + + public boolean isSelectionEmpty() { + return false; + } + + public boolean isSpecialSelectionAllowed() { + return false; + } + + public boolean isValuesTableAvailable() { + return modeleDonnees() == null ? false : modeleDonnees().isValuesTableAvailable(); + } + + public ZModeleDonnees modeleDonnees() { + return null; + } + + boolean antialiasing_ = true; + + public final void paintComponent(final Graphics _g) { + if (!isVisible()) { + return; + } + + if (painted_) { + final Graphics2D graphics2D = (Graphics2D) _g; + RenderingHints old = null; + if (isRapide()) { + old = graphics2D.getRenderingHints(); + final RenderingHints newRenderer = (RenderingHints)old.clone(); + newRenderer.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + newRenderer.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + newRenderer.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); + newRenderer.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); + newRenderer.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + newRenderer.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); + newRenderer.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); + newRenderer.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); + graphics2D.setRenderingHints(newRenderer); + } else if (isAntialiasSupported() && antialiasing_) { + old = graphics2D.getRenderingHints(); + final RenderingHints newRenderer = (RenderingHints)old.clone(); + newRenderer.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + newRenderer.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + graphics2D.setRenderingHints(newRenderer); + } + paintDonnees(graphics2D, getVersEcran(), getVersReel(), getClipReel(_g)); + if (old != null) { + graphics2D.setRenderingHints(old); + } + } + } + + /** + * Dessine les donnees. + * + * @param _g la cible + */ + public final void paintDonnees(final Graphics2D _g) { + paintDonnees(_g, getVersEcran(), getVersReel(), getClipReel(_g)); + + } + + public final void paintDonnees(final Graphics _g) { + paintDonnees((Graphics2D) _g, getVersEcran(), getVersReel(), getClipReel(_g)); + } + + public final void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace) { + paintSelection(_g, _trace, getVersEcran(), getClipReel(_g)); + + } + + /** + * @param _c + * @param _g + * @param _x + * @param _y + */ + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + final int w = getIconWidth(); + final int h = getIconHeight(); + _g.setColor(Color.white); + _g.fillRect(_x + 1, _y + 1, w - 1, h - 1); + if (isPaletteCouleurUsed_) { + _g.setColor(Color.RED); + // le trait horizontal d'en haut en rouge + _g.drawLine(_x, _y, _x + w, _y); + _g.setColor(Color.BLUE); + // le trait horizontal d'en bas en bleu + _g.drawLine(_x, _y + h, _x + w, _y + h); + _g.setColor(Color.GREEN); + // trait vertical gauche + _g.drawLine(_x, _y, _x, _y + h); + // trait vertical droit + _g.setColor(Color.YELLOW); + _g.drawLine(_x + w, _y, _x + w, _y + h); + + } else { + _g.setColor(getForeground()); + _g.drawRect(_x, _y, w, h); + } + } + + public EbliUIProperties saveUIProperties() { + final EbliUIProperties res = super.saveUIProperties(); + final int nbSet = getNbSet(); + for (int i = 0; i < nbSet; i++) { + final TraceIconModel model = getIconModel(i); + if (model != null) { + res.put(createPropIcon(i), new TraceIconModel(model)); + } + final TraceLigneModel lineModel = getLineModel(i); + if (lineModel != null) { + res.put(createPropLine(i), new TraceLigneModel(lineModel)); + } + } + if (EbliLib.isAlphaChanged(alpha_)) { + res.put("calque.alpha", alpha_); + } + if (paletteCouleur_ != null) { + res.put("calque.paletteCouleur", paletteCouleur_.save()); + } + if (isAntialiasSupported()) { + res.put("calque.antialias", Boolean.valueOf(antialiasing_)); + } + return res; + } + + public void selectAll() {} + + public void setForeground(final Color _v) { + for (int i = getNbSet() - 1; i >= 0; i--) { + final TraceIconModel ic = getIconModel(i); + if (ic != null && ic.setCouleur(_v)) { + firePropertyChange(BSelecteurIconModel.getProperty(i), null, ic); + } + final TraceLigneModel line = getLineModel(i); + if (line != null && line.setCouleur(_v)) { + firePropertyChange(BSelecteurLineModel.getProperty(i), null, line); + } + } + super.setForeground(_v); + if (isPaletteCouleurUsed_) { + firePropertyChange("paletteCouleur", paletteCouleur_, null); + isPaletteCouleurUsed_ = false; + if (legendContainsOnlyPalette()) { + final BCalqueLegende l = getLegende(); + if (l != null) { + l.enleve(this); + l.revalidate(); + } + } + } + if (isVisible()) { + quickRepaint(); + } + + } + + /** + * @return true si la l\xE9gende ne contient que des donn\xE9es concerant la palette de couleur. dans ce cas, la legende est + * enlevee si aucune palette n'est utilis\xE9e. + */ + public boolean legendContainsOnlyPalette() { + return true; + } + + /** + * Tout sera dessine. + * + * @param _b si true, les donnees +selection seront dessines. si false, seule la selection sera dessinee. + */ + public void setPainted(final boolean _b) { + painted_ = _b; + } + + public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) { + if (paletteCouleur_ == null) { + if (isDiscrete()) { + paletteCouleur_ = new BPalettePlageDiscret(new Object[0]); + paletteCouleur_.setPlages(_newPlage.getPlages()); + } else { + paletteCouleur_ = new BPalettePlage(); + paletteCouleur_.initFrom(_newPlage); + } + } else { + paletteCouleur_.initFrom(_newPlage); + } + isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; + construitLegende(); + firePropertyChange("paletteCouleur", null, paletteCouleur_); + repaint(); + } + + public boolean setTitle(final String _title) { + final boolean r = super.setTitle(_title); + if (r && paletteLegende_ != null && getLegende() != null) { + getLegende().updateMainTitle(this, _title); + } + return r; + } + + public boolean setIconModel(final int _idx, final TraceIconModel _model) { + final TraceIconModel model = getIconModel(_idx); + final boolean r = model == null || model.updateData(_model); + if (r) { + firePropertyChange(BSelecteurIconModel.getProperty(_idx), null, model); + repaint(); + } + return r; + } + + public int getAlpha() { + return alpha_; + } + + public TraceLigneModel getLineModel(final int _idx) { + return ligneModel_; + } + + public int getNbSet() { + return 1; + } + + public boolean setLineModel(final int _idx, final TraceLigneModel _model) { + final TraceLigneModel ligne = getLineModel(_idx); + if (_model != null && ligne != null && ligne.updateData(_model)) { + firePropertyChange(BSelecteurLineModel.getProperty(_idx), null, ligne); + repaint(); + return true; + } + return false; + } + + public void setAlpha(final int _alpha) { + if (_alpha != alpha_ && _alpha >= 0 && _alpha < 256) { + final int old = alpha_; + alpha_ = _alpha; + firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY, old, alpha_); + if (isVisible()) { + repaint(); + } + } + } + + public boolean isAntialiasing() { + return antialiasing_; + } + + /** + * Efface la selection si le calque est rendu invisible. + */ + public void setVisible(boolean _b) { + if (isVisible()!=_b) { + super.setVisible(_b); + if (!_b) clearSelection(); + } + } } \ No newline at end of file Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java ___________________________________________________________________ Added: svn:mergeinfo + /trunk/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java:3445-3803 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-14 15:56:59
|
Revision: 3803 http://fudaa.svn.sourceforge.net/fudaa/?rev=3803&view=rev Author: bmarchan Date: 2008-08-14 15:54:56 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Correction pour que le Z soit transport?\195?\169 par les g?\195?\169om?\195?\169tries s?\195?\169lectionn?\195?\169es. Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java 2008-08-14 15:03:15 UTC (rev 3802) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java 2008-08-14 15:54:56 UTC (rev 3803) @@ -78,7 +78,7 @@ } /** - * Retourne les g\xE9ometries s\xE9lectionn\xE9es de l'arbre. + * Retourne les g\xE9ometries s\xE9lectionn\xE9es de l'arbre. Les g\xE9om\xE9tries transportent le Z en chaque point si un Z existe. * @return Les g\xE9om\xE9tries, de taille = 0 si rien de selectionn\xE9. */ private Geometry[] getSelectedGeomInTree() { @@ -90,7 +90,10 @@ for (int i=0; i<selpaths.length; i++) { final CalqueGISTreeModel.LayerNode node=(CalqueGISTreeModel.LayerNode)selpaths[i].getLastPathComponent(); final ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) node.getUserObject(); - geoms[i]=((ZModeleGeom)cq.modeleDonnees()).getGeomData().getGeometry(node.getIdxGeom()); + GISZoneCollection col=((ZModeleGeom)cq.modeleDonnees()).getGeomData(); + // Pour le transport du Z. + col.initZCoordinate(node.getIdxGeom()); + geoms[i]=col.getGeometry(node.getIdxGeom()); } return geoms; Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2008-08-14 15:03:15 UTC (rev 3802) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2008-08-14 15:54:56 UTC (rev 3803) @@ -263,7 +263,6 @@ targetGeoms.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); targetGeoms.setAttributeIsZ(GISAttributeConstants.BATHY); -// targetGeoms.postImport(0); InterpolationTarget target=new InterpolationTargetGISAdapter(targetGeoms); InterpolationParameters params=new InterpolationParameters(vars,target,support); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-14 15:03:07
|
Revision: 3802 http://fudaa.svn.sourceforge.net/fudaa/?rev=3802&view=rev Author: bmarchan Date: 2008-08-14 15:03:15 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Ajout de 2 m?\195?\169thodes pour le maintien de la coh?\195?\169rence ZAttribut<->ZCoordinate Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-08-14 10:01:56 UTC (rev 3801) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-08-14 15:03:15 UTC (rev 3802) @@ -1,567 +1,631 @@ -/* - * @creation 7 avr. 2005 - * @modification $Date: 2008-03-26 16:46:43 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ctulu.gis; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.GeometryFactory; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.collection.CtuluCollection; -import org.fudaa.ctulu.collection.CtuluCollectionDoubleEdit; -import org.geotools.feature.type.SetAttributeType; - -/** - * Une classe abstraite d'objets g\xE9ometriques auquels sont associ\xE9s des attributs dont les valeurs - * sont g\xE9r\xE9es par des mod\xE8les. - * Ces mod\xE8les d'attributs sont ordonn\xE9s dans la liste des mod\xE8les d'attributs. - * - * @author Fred Deniger - * @version $Id: GISZoneCollection.java,v 1.16.6.4 2008-03-26 16:46:43 bmarchan Exp $ - */ -public abstract class GISZoneCollection extends GISCollectionData implements GISAttributeListener, GISDataModel { - - private String title_; - - /** La liste ordonn\xE9e des mod\xE8les d'attributs associ\xE9es \xE0 la collection. */ - protected GISAttributeModelListener[] attr_; - /** La valeur de la nature pour pour cette collection si elle est impos\xE9e. null : non impos\xE9e. */ - protected Map fixedAttributes_=new HashMap(); - - protected GISAttributeDouble attributeIsZ_ = null;//GISAttributeConstants.BATHY; // Devrait \xEAtre null par defaut. - - protected boolean isGeomModifiable_ = true; - - public GISZoneCollection() { - super(); - } - - public GISZoneCollection(final boolean _isGeomModifiable) { - isGeomModifiable_ = _isGeomModifiable; - } - - /** - * @param _factory - * @param _nbObject - */ - public GISZoneCollection(final GeometryFactory _factory, final int _nbObject) { - super(_factory, _nbObject); - } - - /** - * @param _nbObject - */ - public GISZoneCollection(final int _nbObject) { - super(_nbObject); - } - - public long getId() { return -1; } - - protected void fireAttributesChanged(final GISAttributeInterface _att) { - if (listener_ != null) { - listener_.attributeChanged(this, _att); - } - } - - protected final void fireObjectAdded() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.INSERT); - } - } - - protected final void fireObjectChanged() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.UPDATE); - } - } - - protected final void fireObjectRemoved() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.DELETE); - } - - } - - protected final void fireObjectStructureChanged() { - if (listener_ != null) { - listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.ALL); - } - } - - protected void fireTitleChanged() { - - } - - /** - * Retourne le mod\xE8le d'attribut associ\xE9 \xE0 l'attribut en indice. - * @param _i L'indice suivant l'ordre de la liste des mod\xE8le d'attributs. - */ - protected CtuluCollection getData(final int _i) { - return isDataCreated(_i) ? attr_[_i] : null; - } - - protected Object getDefaultValuesObject(final int _idxValues) { - return isDataCreated(_idxValues) ? attr_[_idxValues].getAttribute().getDefaultValue() : null; - } - - /** - * @param _i l'indice de l'attribut - * @return le model si existant (null sinon). - */ - protected GISAttributeModelListener getModelListener(final int _i) { - return (GISAttributeModelListener) getData(_i); - } - - protected void initAttributes(final GISAttributeInterface[] _att) { - if (_att != null) { - attr_ = new GISAttributeModelListener[_att.length]; - for (int i = _att.length - 1; i >= 0; i--) { - attr_[i] = (GISAttributeModelListener) GISZoneAttributeFactory.createModel(this, _att[i]); - if (_att[i] == GISAttributeConstants.BATHY) { - setAttributeIsZ(GISAttributeConstants.BATHY); - } - } - } - - } - - protected void initAttributes(final GISAttributeModelListener[] _att) { - attr_ = _att; - } - - /** - * A utiliser avec precaution: change les modeles sans aucune v\xE9rification. - * - * @param _att - * @param _cmd - */ - protected void initAttributes(final GISAttributeModelListener[] _att, final CtuluCommandContainer _cmd) { - if (!Arrays.equals(_att, attr_)) { - final GISAttributeModelListener[] old = attr_; - attr_ = _att; - fireAttributesChanged(null); - if (_cmd != null) { - _cmd.addCmd(new CtuluCommand() { - - public void redo() { - initAttributes(_att, null); - } - - public void undo() { - initAttributes(old, null); - - } - - }); - } - - } - - } - - protected boolean isDataCreated(final int _i) { - return attr_ != null && attr_.length > _i && attr_[_i] != null; - } - - public abstract boolean accept(GISVisitor _v); - - /** - * Ne fait pas de verif quant a l'origine des donnees. - * Remarque : Le modele a ajouter doit avoir le m\xEAme nombre d'attributs que le mod\xE8le courant. Si ce n'est pas - * le cas, une erreur est d\xE9clench\xE9e. - * - * @param _model le model a ajouter - * @param _cmd le receveur de commande - * @param _doPostImport true si on doit lancer l'action de post-traitement. - * @return true si ok. - */ - public boolean addAll(final GISDataModel _model, final CtuluCommandContainer _cmd, final boolean _doPostImport) { - if (!isGeomModifiable_ || _model == null) { - return false; - } - if (_model.getNbAttributes() != getNbAttributes()) { - throw new IllegalArgumentException("Bad attributes"); - } - final int nbGeom = _model.getNumGeometries(); - final Geometry[] pt = new Geometry[nbGeom]; - for (int i = nbGeom - 1; i >= 0; i--) { - pt[i] = _model.getGeometry(i); - } - final int nbAttribute = getNbAttributes(); - final List data = new ArrayList(nbAttribute); - for (int iatt = 0; iatt < nbAttribute; iatt++) { - final GISAttributeInterface gi = getAttribute(iatt); - final Object[] os = new Object[nbGeom]; - for (int igeom = 0; igeom < nbGeom; igeom++) { -// os[igeom] = gi.createDataForGeom(_model.getValue(iatt, igeom), pt[igeom].getNumPoints()); - os[igeom] = createOrAssignAttribut(iatt, _model.getValue(iatt, igeom), pt[igeom]); - } - data.add(nbGeom == 1 ? os[0] : os); - - } - - final int firstIdx = super.geometry_.getSize() - 1; - super.geometry_.addAll(pt, data, _cmd); - if (_doPostImport) { - postImport(firstIdx); - } - - return true; - } - - /** - * Cr\xE9e ou assigne la valeur d'attribut pass\xE9e. Si la valeur pass\xE9e est null, une valeur par d\xE9faut est affect\xE9e. - * Si la valeur est scalaire et l'attribut atomique, un tableau de valeurs est cr\xE9e. Si la valeur est un tableau et - * l'attribut est global, une valeur scalaire moyenne et cr\xE9ee. - * - * @param _iatt L'indice d'attribut dans la liste des attributs. - * @param _valatt La valeur de l'attribut. Peut \xEAtre null. - * @param _dest La g\xE9om\xE9trie pour la cr\xE9ation de la valeur. - * @return La valeur pour l'attribut et la g\xE9om\xE9trie donn\xE9e. - */ - protected Object createOrAssignAttribut(int _iatt, final Object _init, final Geometry _dest) { - Object ret; - final int nbPt = _dest.getNumPoints(); - Object val=fixedAttributes_.get(getAttribute(_iatt)); - if (val==null) val=_init; - ret = getDataModel(_iatt).getAttribute().createDataForGeom(val,nbPt); - if (attributeIsZ_ != null && attributeIsZ_.isAtomicValue() && _init == null && - getDataModel(_iatt).getAttribute() == attributeIsZ_) { - final GISAttributeModelDoubleArray array = (GISAttributeModelDoubleArray) ret; - for (int k = nbPt - 1; k >= 0; k--) { - array.set(k, ((GISCoordinateSequenceContainerInterface)_dest).getCoordinateSequence().getOrdinate(k,2)); - } - } - return ret; - } - - public abstract void addCoordinateSequence(CoordinateSequence _seq, Object[] _datas, CtuluCommandContainer _cmd); - - /** - * Ajoute une g\xE9om\xE9trie du bon type \xE0 la collection. En cas de mauvaise g\xE9ometrie ajout\xE9e, une Exception est lev\xE9e. - * @param _geom La g\xE9om\xE9trie. - * @param _datas Les valeurs d'attributs, dans l'ordre. - * @param _cmd Le manager de commandes. - */ - public abstract void addGeometry(Geometry _geom, Object[] _datas, CtuluCommandContainer _cmd); - - public void removeGeometries(final int[] _idx, CtuluCommandContainer _cmd) { - super.geometry_.remove(_idx, _cmd); - } - - public GISAttributeModel[] getAtomicAttributeSubModel(final int _geomIdx) { - final int nb = getNbAttributes(); - final List r = new ArrayList(nb); - for (int i = 0; i < nb; i++) { - final GISAttributeModel model = getDataModel(i); - if (model.getAttribute().isAtomicValue()) { - // cast inutile mais utilise pour detecte le plus tot les erreur d - r.add(model.getObjectValueAt(_geomIdx)); - } - } - final GISAttributeModel[] rf = new GISAttributeModel[r.size()]; - r.toArray(rf); - return rf; - } - - public GISAttributeInterface getAttribute(final int _i) { - final GISAttributeModel model = getDataModel(_i); - return model == null ? null : model.getAttribute(); - } - - /** - * @return l'attribut qui correspond \xE0 z: il sera automatiquement mis \xE0 jour lors de l'ajout de geometri\xE9 - */ - public final GISAttributeDouble getAttributeIsZ() { - return attributeIsZ_; - } - - /** - * @return les attributs utilises. - */ - public GISAttributeInterface[] getAttributes() { - final GISAttributeInterface[] res = new GISAttributeInterface[getNbAttributes()]; - for (int i = res.length - 1; i >= 0; i--) { - res[i] = getAttribute(i); - } - return res; - - } - - /** - * Retourne le mod\xE8le d'attribut associ\xE9 \xE0 l'attribut en indice. - * @param _i L'indice suivant l'ordre de la liste des mod\xE8le d'attributs. null si aucun mod\xE8le associ\xE9. - */ - public GISAttributeModel getDataModel(final int _i) { - return (GISAttributeModel) getData(_i); - } - - /** - * @return la classe a utiliser pour les sauvegardes dans les data stores - */ - public abstract Class getDataStoreClass(); - - public int getIndiceOf(final GISAttributeInterface _att) { - if (attr_ != null && _att != null) { - for (int i = attr_.length - 1; i >= 0; i--) { - if (_att.equals(getAttribute(i))) { - return i; - } - } - } - return -1; - } - - /** - * @param _att l'attribut recherche - * @return le modele correspondant ou null si aucun. - */ - public GISAttributeModel getModel(final GISAttributeInterface _att) { - if (attr_ != null) { - for (int i = attr_.length - 1; i >= 0; i--) { - if (attr_[i].getAttribute() == _att || attr_[i].getAttribute().equals(_att)) { - return attr_[i]; - } - } - } - return null; - } - - public GISAttributeModel getModel(final int _i) { - return (GISAttributeModelListener) getData(_i); - } - - public GISAttributeModel[] getModels() { - final GISAttributeModel[] res = new GISAttributeModel[attr_.length]; - System.arraycopy(attr_, 0, res, 0, attr_.length); - return res; - } - - public int getNbAttributes() { - return attr_ == null ? 0 : attr_.length; - } - - public int getNbGeometries() { - return super.getNumGeometries(); - } - - /** - * @return le titre ce cette collection - */ - public final String getTitle() { - return title_; - } - - public Object getValue(final int _idxAtt, final int _idxGeom) { - if (_idxAtt<0 || _idxAtt>getNbAttributes()) return null; - return getModel(_idxAtt).getObjectValueAt(_idxGeom); - } - - /** - * Wrapper pour d\xE9finir la valeur d'un attribut. - * @param _idxAtt L'indice de l'attribut. - * @param _idxGeom La g\xE9om\xE9trie. - * @param _data La valeur de l'attribut. - * @param _cmd Le manager undo/redo. - */ - public void setAttributValue(final int _idxAtt, final int _idxGeom, Object _data, CtuluCommandContainer _cmd) { - if (_idxAtt<0 || _idxAtt>getNbAttributes()) return; - getModel(_idxAtt).setObject(_idxGeom, _data, _cmd); - } - - public void gisDataChanged(final GISAttributeInterface _src) { - if (listener_ != null) { - listener_.dataChanged(_src, this); - } - } - - /** - * Mise a jour des listeners et du listener principal. A utiliser lors de la restauration uniquement. - */ - public void initListeners(final GISZoneListener _listener) { - super.setListener(_listener); - updateListeners(); - } - - /** - * @return true si les objets geometriques sont editables - */ - public final boolean isGeomModifiable() { - return isGeomModifiable_; - } - - /** - * Initialise le mod\xE8le d'attribut utilis\xE9 pour Z avec les coordonn\xE9es Z des points des g\xE9om\xE9tries. - * Principalement utilis\xE9 \xE0 la suite d'un import. - * - * @param _firstIdx l'indice de la premiere geometrie utilis\xE9e pour l'initialisation. - * @see #setAttributeIsZ(GISAttributeDouble) - * @see {@link #prepareExport()} pour la m\xE9thode inverse - */ - public abstract void postImport(final int _firstIdx); - - public void preload(final GISAttributeInterface[] _att, final ProgressionInterface _prog) {} - - /** - * Pr\xE9pare l'export des g\xE9om\xE9tries, en affectant \xE0 la coordonn\xE9e Z de leurs points les valeurs contenues - * dans l'attribut utilis\xE9 pour Z. - * - * @see #setAttributeIsZ(GISAttributeDouble) - * @see {@link #postImport(int)} pour la m\xE9thode inverse - */ - public void prepareExport() { - if (attributeIsZ_ != null) { - final GISAttributeModel model = getModel(attributeIsZ_); - if (model instanceof GISAttributeModelObjectInterface) { - final int nb = getNumGeometries(); - for (int i = 0; i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - final GISAttributeModelDoubleArray arr = (GISAttributeModelDoubleArray) model.getObjectValueAt(i); - for (int k = seq.size() - 1; k >= 0; k--) { - seq.setOrdinate(k, 2, arr.getValue(k)); - } - } - } else if (model instanceof CtuluCollectionDoubleEdit) { - final int nb = getNumGeometries(); - final CtuluCollectionDoubleEdit dModel = (CtuluCollectionDoubleEdit) model; - for (int i = 0; i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - final double value = dModel.getValue(i); - for (int k = seq.size() - 1; k >= 0; k--) { - - seq.setOrdinate(k, 2, value); - } - } - } - - } - } - - /** - * D\xE9finit l'attribut qui correspond \xE0 Z. Il est alors utilis\xE9 lors des d\xE9placements en Z de l'objet, - * ou pour la persistence en chaque point s'il est atomique. Seul les attributs de type {@link GISAttributeDouble} - * sont autoris\xE9s.<p> - * Remarque : L'attribut doit \xEAtre dans la liste des attributs de la collection, sinon l'appel de la m\xE9thode n'a pas d'effet. - * - * @param _attributeIsZ l'attribut qui correspond \xE0 z: il sera automatiquement mis \xE0 jour lors de - * l'ajout de geometrie. Peut \xEAtre null. - */ - public final void setAttributeIsZ(final GISAttributeDouble _attributeIsZ) { - if (getIndiceOf(_attributeIsZ)==-1) return; - attributeIsZ_ = _attributeIsZ; - } - - /** - * Definit les attributs pour lesquels la valeur est immuable.<p> - * <b>Remarque</b> : Si des objets existent d\xE9j\xE0 avec une valeur pour l'attribut \xE0 rendre immuable, ces valeurs ne seront pas - * remplac\xE9e par la valeur constante. Utilisez {@link GISZoneCollection#setAttributes()} - * pour r\xE9initialiser les valeurs pour la collection. - * - * @param _att L'attribut \xE0 fixer. - * @param _value La valeur constante. Si null, l'attribut n'est pas obligatoirement fix\xE9. - */ - public void setFixedAttributeValue(GISAttributeInterface _att, Object _value) { - if (_value==null) - fixedAttributes_.remove(_att); - else - fixedAttributes_.put(_att, _value); - } - - /** - * Associe les attributs aux objets de la collection. Pour chaque attribut inexistant dans la liste est cr\xE9\xE9 un nouveau mod\xE8le. - * @param _att La liste des attributs, conditionnant l'ordre des mod\xE8les dans la liste des mod\xE8les. - * @param _cmd Le conteneur de commande. - */ - public void setAttributes(final GISAttributeInterface[] _att, final CtuluCommandContainer _cmd) { - if (_att == attr_ || Arrays.equals(attr_, _att)) { - return; - } - // on sauvegarde les anciens attributs - final GISAttributeModelListener[] old = attr_; - - // on recupere les valeurs d\xE9j\xE0 utilis\xE9es - final Map exist = new HashMap(attr_ == null ? 0 : attr_.length); - if (attr_ != null) { - for (int i = attr_.length - 1; i >= 0; i--) { - exist.put(attr_[i].getAttribute(), attr_[i]); - } - } - final GISAttributeModelListener[] newAtt = _att == null ? null : new GISAttributeModelListener[_att.length]; - if (_att != null) { - for (int i = _att.length - 1; i >= 0; i--) { - newAtt[i] = (GISAttributeModelListener) exist.get(_att[i]); - if (newAtt[i] == null) { - newAtt[i] = (GISAttributeModelListener) GISZoneAttributeFactory.createModel(this, _att[i]); - } - } - } - attr_ = newAtt; - fireAttributesChanged(null); - if (_cmd != null) { - _cmd.addCmd(new CtuluCommand() { - - public void redo() { - attr_ = newAtt; - fireAttributesChanged(null); - } - - public void undo() { - attr_ = old; - fireAttributesChanged(null); - } - - }); - } - - } - - public abstract void setCoordinateSequence(int _idx, CoordinateSequence _newSeq, CtuluCommandContainer _cmd); - - /** - * @param _title le nouveau titre - * @param _cmd la commande - * @return true si modif - */ - public final boolean setTitle(final String _title, final CtuluCommandContainer _cmd) { - // test pour ne pas mettre le meme titre - if (_title == title_ || (_title != null && _title.equals(title_))) { - return false; - } - final String old = _title; - title_ = _title; - fireTitleChanged(); - if (_cmd != null) { - _cmd.addCmd(new CtuluCommand() { - - public void redo() { - setTitle(_title, null); - } - - public void undo() { - setTitle(old, null); - } - }); - } - return true; - - } - - /** - * Mise a jour des listeners. - */ - public abstract void updateListeners(); - -} +/* + * @creation 7 avr. 2005 + * @modification $Date: 2008-03-26 16:46:43 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ctulu.gis; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.collection.CtuluCollection; +import org.fudaa.ctulu.collection.CtuluCollectionDoubleEdit; + +/** + * Une classe abstraite d'objets g\xE9ometriques auquels sont associ\xE9s des attributs dont les valeurs + * sont g\xE9r\xE9es par des mod\xE8les. + * Ces mod\xE8les d'attributs sont ordonn\xE9s dans la liste des mod\xE8les d'attributs. + * + * @author Fred Deniger + * @version $Id: GISZoneCollection.java,v 1.16.6.4 2008-03-26 16:46:43 bmarchan Exp $ + */ +public abstract class GISZoneCollection extends GISCollectionData implements GISAttributeListener, GISDataModel { + + private String title_; + + /** La liste ordonn\xE9e des mod\xE8les d'attributs associ\xE9es \xE0 la collection. */ + protected GISAttributeModelListener[] attr_; + /** La valeur de la nature pour pour cette collection si elle est impos\xE9e. null : non impos\xE9e. */ + protected Map<GISAttributeInterface,Object> fixedAttributes_=new HashMap<GISAttributeInterface,Object>(); + /** L'attribut utilis\xE9 pour Z */ + protected GISAttributeDouble attributeIsZ_=null; + /** L'indice dans la liste des mod\xE8le de l'attribut pris pour Z (pour optimisation des temps). + * Est remis a jour \xE0 chaque modification sur la liste. Si \xE9gal -1, pas d'attribut pris pour Z */ + private int idxAttZ_=-1; + /** L'indice de l'attribut pris pour Z doit \xEAtre remis a jour */ + protected boolean badIdxAttZ_=true; + + protected boolean isGeomModifiable_ = true; + + public GISZoneCollection() { + super(); + } + + public GISZoneCollection(final boolean _isGeomModifiable) { + isGeomModifiable_ = _isGeomModifiable; + } + + /** + * @param _factory + * @param _nbObject + */ + public GISZoneCollection(final GeometryFactory _factory, final int _nbObject) { + super(_factory, _nbObject); + } + + /** + * @param _nbObject + */ + public GISZoneCollection(final int _nbObject) { + super(_nbObject); + } + + public long getId() { return -1; } + + protected void fireAttributesChanged(final GISAttributeInterface _att) { + if (listener_ != null) { + listener_.attributeChanged(this, _att); + } + } + + protected final void fireObjectAdded() { + if (listener_ != null) { + listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.INSERT); + } + } + + protected final void fireObjectChanged() { + if (listener_ != null) { + listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.UPDATE); + } + } + + protected final void fireObjectRemoved() { + if (listener_ != null) { + listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.DELETE); + } + + } + + protected final void fireObjectStructureChanged() { + if (listener_ != null) { + listener_.geometryChanged(this, getDataStoreClass(), GISZoneListener.ALL); + } + } + + protected void fireTitleChanged() { + + } + + /** + * Retourne le mod\xE8le d'attribut associ\xE9 \xE0 l'attribut en indice. + * @param _i L'indice suivant l'ordre de la liste des mod\xE8le d'attributs. + */ + protected CtuluCollection getData(final int _i) { + return isDataCreated(_i) ? attr_[_i] : null; + } + + protected Object getDefaultValuesObject(final int _idxValues) { + return isDataCreated(_idxValues) ? attr_[_idxValues].getAttribute().getDefaultValue() : null; + } + + /** + * @param _i l'indice de l'attribut + * @return le model si existant (null sinon). + */ + protected GISAttributeModelListener getModelListener(final int _i) { + return (GISAttributeModelListener) getData(_i); + } + + protected void initAttributes(final GISAttributeInterface[] _att) { + if (_att != null) { + badIdxAttZ_=true; + attr_ = new GISAttributeModelListener[_att.length]; + for (int i = _att.length - 1; i >= 0; i--) { + attr_[i] = (GISAttributeModelListener) GISZoneAttributeFactory.createModel(this, _att[i]); + // FIXME : B.M. : Je laisse, mais c'est douteux. Dans une collection, l'attribut Z n'est pas forcement + // la bathy. + if (_att[i] == GISAttributeConstants.BATHY) { + setAttributeIsZ(GISAttributeConstants.BATHY); + } + } + } + } + + protected void initAttributes(final GISAttributeModelListener[] _att) { + badIdxAttZ_=true; + attr_ = _att; + } + + /** + * A utiliser avec precaution: change les modeles sans aucune v\xE9rification. + * + * @param _att + * @param _cmd + */ + protected void initAttributes(final GISAttributeModelListener[] _att, final CtuluCommandContainer _cmd) { + if (!Arrays.equals(_att, attr_)) { + badIdxAttZ_=true; + final GISAttributeModelListener[] old = attr_; + attr_ = _att; + fireAttributesChanged(null); + if (_cmd != null) { + _cmd.addCmd(new CtuluCommand() { + + public void redo() { + initAttributes(_att, null); + } + + public void undo() { + initAttributes(old, null); + + } + + }); + } + + } + + } + + protected boolean isDataCreated(final int _i) { + return attr_ != null && attr_.length > _i && attr_[_i] != null; + } + + public abstract boolean accept(GISVisitor _v); + + /** + * Ne fait pas de verif quant a l'origine des donnees. + * Remarque : Le modele a ajouter doit avoir le m\xEAme nombre d'attributs que le mod\xE8le courant. Si ce n'est pas + * le cas, une erreur est d\xE9clench\xE9e. + * + * @param _model le model a ajouter + * @param _cmd le receveur de commande + * @param _doPostImport true si on doit lancer l'action de post-traitement. + * @return true si ok. + */ + public boolean addAll(final GISDataModel _model, final CtuluCommandContainer _cmd, final boolean _doPostImport) { + if (!isGeomModifiable_ || _model == null) { + return false; + } + if (_model.getNbAttributes() != getNbAttributes()) { + throw new IllegalArgumentException("Bad attributes"); + } + final int nbGeom = _model.getNumGeometries(); + final Geometry[] pt = new Geometry[nbGeom]; + for (int i = nbGeom - 1; i >= 0; i--) { + pt[i] = _model.getGeometry(i); + } + final int nbAttribute = getNbAttributes(); + final List data = new ArrayList(nbAttribute); + for (int iatt = 0; iatt < nbAttribute; iatt++) { + final GISAttributeInterface gi = getAttribute(iatt); + final Object[] os = new Object[nbGeom]; + for (int igeom = 0; igeom < nbGeom; igeom++) { +// os[igeom] = gi.createDataForGeom(_model.getValue(iatt, igeom), pt[igeom].getNumPoints()); + os[igeom] = createOrAssignAttribut(iatt, _model.getValue(iatt, igeom), pt[igeom]); + } + data.add(nbGeom == 1 ? os[0] : os); + + } + + final int firstIdx = super.geometry_.getSize() - 1; + super.geometry_.addAll(pt, data, _cmd); + if (_doPostImport) { + postImport(firstIdx); + } + + return true; + } + + /** + * Cr\xE9e ou assigne la valeur d'attribut pass\xE9e. Si la valeur pass\xE9e est null, une valeur par d\xE9faut est affect\xE9e. + * Si la valeur est scalaire et l'attribut atomique, un tableau de valeurs est cr\xE9e. Si la valeur est un tableau et + * l'attribut est global, une valeur scalaire moyenne et cr\xE9ee. + * + * @param _iatt L'indice d'attribut dans la liste des attributs. + * @param _valatt La valeur de l'attribut. Peut \xEAtre null. + * @param _dest La g\xE9om\xE9trie pour la cr\xE9ation de la valeur. + * @return La valeur pour l'attribut et la g\xE9om\xE9trie donn\xE9e. + */ + protected Object createOrAssignAttribut(int _iatt, final Object _init, final Geometry _dest) { + Object ret; + final int nbPt = _dest.getNumPoints(); + Object val=fixedAttributes_.get(getAttribute(_iatt)); + if (val==null) val=_init; + ret = getDataModel(_iatt).getAttribute().createDataForGeom(val,nbPt); + if (getIdxAttZ()!=-1 && getAttributeIsZ().isAtomicValue() && _init == null && + getDataModel(_iatt).getAttribute() == getAttributeIsZ()) { + final GISAttributeModelDoubleArray array = (GISAttributeModelDoubleArray) ret; + for (int k = nbPt - 1; k >= 0; k--) { + array.set(k, ((GISCoordinateSequenceContainerInterface)_dest).getCoordinateSequence().getOrdinate(k,2)); + } + } + return ret; + } + + public abstract void addCoordinateSequence(CoordinateSequence _seq, Object[] _datas, CtuluCommandContainer _cmd); + + /** + * Ajoute une g\xE9om\xE9trie du bon type \xE0 la collection. En cas de mauvaise g\xE9ometrie ajout\xE9e, une Exception est lev\xE9e. + * @param _geom La g\xE9om\xE9trie. + * @param _datas Les valeurs d'attributs, dans l'ordre. + * @param _cmd Le manager de commandes. + */ + public abstract void addGeometry(Geometry _geom, Object[] _datas, CtuluCommandContainer _cmd); + + public void removeGeometries(final int[] _idx, CtuluCommandContainer _cmd) { + super.geometry_.remove(_idx, _cmd); + } + + public GISAttributeModel[] getAtomicAttributeSubModel(final int _geomIdx) { + final int nb = getNbAttributes(); + final List<GISAttributeModel> r = new ArrayList<GISAttributeModel>(nb); + for (int i = 0; i < nb; i++) { + final GISAttributeModel model = getDataModel(i); + if (model.getAttribute().isAtomicValue()) { + // cast inutile mais utilise pour detecte le plus tot les erreur d + r.add((GISAttributeModel)model.getObjectValueAt(_geomIdx)); + } + } + final GISAttributeModel[] rf = new GISAttributeModel[r.size()]; + r.toArray(rf); + return rf; + } + + public GISAttributeInterface getAttribute(final int _i) { + final GISAttributeModel model = getDataModel(_i); + return model == null ? null : model.getAttribute(); + } + + /** + * @return l'attribut qui correspond \xE0 z: il sera automatiquement mis \xE0 jour lors de l'ajout de geometri\xE9 + */ + public final GISAttributeDouble getAttributeIsZ() { + return attributeIsZ_; + } + + /** + * @return les attributs utilises. + */ + public GISAttributeInterface[] getAttributes() { + final GISAttributeInterface[] res = new GISAttributeInterface[getNbAttributes()]; + for (int i = res.length - 1; i >= 0; i--) { + res[i] = getAttribute(i); + } + return res; + + } + + /** + * Retourne le mod\xE8le d'attribut associ\xE9 \xE0 l'attribut en indice. + * @param _i L'indice suivant l'ordre de la liste des mod\xE8le d'attributs. null si aucun mod\xE8le associ\xE9. + */ + public GISAttributeModel getDataModel(final int _i) { + return (GISAttributeModel) getData(_i); + } + + /** + * @return la classe a utiliser pour les sauvegardes dans les data stores + */ + public abstract Class getDataStoreClass(); + + public int getIndiceOf(final GISAttributeInterface _att) { + if (attr_ != null && _att != null) { + for (int i = attr_.length - 1; i >= 0; i--) { + if (_att.equals(getAttribute(i))) { + return i; + } + } + } + return -1; + } + + /** + * @param _att l'attribut recherche + * @return le modele correspondant ou null si aucun. + */ + public GISAttributeModel getModel(final GISAttributeInterface _att) { + if (attr_ != null) { + for (int i = attr_.length - 1; i >= 0; i--) { + if (attr_[i].getAttribute() == _att || attr_[i].getAttribute().equals(_att)) { + return attr_[i]; + } + } + } + return null; + } + + public GISAttributeModel getModel(final int _i) { + return (GISAttributeModelListener) getData(_i); + } + + public GISAttributeModel[] getModels() { + final GISAttributeModel[] res = new GISAttributeModel[attr_.length]; + System.arraycopy(attr_, 0, res, 0, attr_.length); + return res; + } + + public int getNbAttributes() { + return attr_ == null ? 0 : attr_.length; + } + + public int getNbGeometries() { + return super.getNumGeometries(); + } + + /** + * @return le titre ce cette collection + */ + public final String getTitle() { + return title_; + } + + public Object getValue(final int _idxAtt, final int _idxGeom) { + if (_idxAtt<0 || _idxAtt>getNbAttributes()) return null; + return getModel(_idxAtt).getObjectValueAt(_idxGeom); + } + + /** + * Wrapper pour d\xE9finir la valeur d'un attribut. + * @param _idxAtt L'indice de l'attribut. + * @param _idxGeom La g\xE9om\xE9trie. + * @param _data La valeur de l'attribut. + * @param _cmd Le manager undo/redo. + */ + public void setAttributValue(final int _idxAtt, final int _idxGeom, Object _data, CtuluCommandContainer _cmd) { + if (_idxAtt<0 || _idxAtt>getNbAttributes()) return; + getModel(_idxAtt).setObject(_idxGeom, _data, _cmd); + } + + public void gisDataChanged(final GISAttributeInterface _src) { + if (listener_ != null) { + listener_.dataChanged(_src, this); + } + } + + /** + * Mise a jour des listeners et du listener principal. A utiliser lors de la restauration uniquement. + */ + public void initListeners(final GISZoneListener _listener) { + super.setListener(_listener); + updateListeners(); + } + + /** + * @return true si les objets geometriques sont editables + */ + public final boolean isGeomModifiable() { + return isGeomModifiable_; + } + + /** + * Initialise le mod\xE8le d'attribut utilis\xE9 pour Z avec les coordonn\xE9es Z des points des g\xE9om\xE9tries. + * Principalement utilis\xE9 \xE0 la suite d'un import. + * + * @param _firstIdx l'indice de la premiere geometrie utilis\xE9e pour l'initialisation. + * @see #setAttributeIsZ(GISAttributeDouble) + * @see {@link #prepareExport()} pour la m\xE9thode inverse + */ + public void postImport(final int _firstIdx) { + if (getIdxAttZ()==-1) return; + + final int nb = getNumGeometries(); + for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { + initZAttribute(i); + } + } + + public void preload(final GISAttributeInterface[] _att, final ProgressionInterface _prog) {} + + /** + * Pr\xE9pare l'export des g\xE9om\xE9tries, en affectant \xE0 la coordonn\xE9e Z de leurs points les valeurs contenues + * dans l'attribut utilis\xE9 pour Z. + * + * @see #setAttributeIsZ(GISAttributeDouble) + * @see {@link #postImport(int)} pour la m\xE9thode inverse + */ + public void prepareExport() { + if (getIdxAttZ()==-1) return; + + final int nb = getNumGeometries(); + for (int i=0; i<nb; i++) { + initZCoordinate(i); + } + } + + protected int getIdxAttZ() { + if (badIdxAttZ_) { + idxAttZ_=getIndiceOf(attributeIsZ_); + badIdxAttZ_=false; + } + return idxAttZ_; + } + /** + * Initialise les coordonn\xE9es Z d'une g\xE9om\xE9trie avec les valeurs contenues + * dans l'attribut utilis\xE9 pour Z. + * + * @param _idxGeom L'index de g\xE9om\xE9trie. + */ + public void initZCoordinate(int _idxGeom) { + if (getIdxAttZ()==-1) + return; + final GISAttributeModel model = getModel(getIdxAttZ()); + + if (model instanceof GISAttributeModelObjectInterface) { + final CoordinateSequence seq=getCoordinateSequence(_idxGeom); + final GISAttributeModelDoubleArray arr=(GISAttributeModelDoubleArray)model.getObjectValueAt(_idxGeom); + for (int k=seq.size()-1; k>=0; k--) { + seq.setOrdinate(k, 2, arr.getValue(k)); + } + } + else if (model instanceof CtuluCollectionDoubleEdit) { + final CtuluCollectionDoubleEdit dModel=(CtuluCollectionDoubleEdit)model; + final CoordinateSequence seq=getCoordinateSequence(_idxGeom); + final double value=dModel.getValue(_idxGeom); + for (int k=seq.size()-1; k>=0; k--) { + seq.setOrdinate(k, 2, value); + } + } + } + + /** + * Initialise les valeurs dans l'attribut utilis\xE9 pour Z avec les coordonn\xE9es Z d'une g\xE9om\xE9trie. + * + * @param _idxGeom L'index de g\xE9om\xE9trie. + */ + public void initZAttribute(int _idxGeom) { + if (getIdxAttZ()==-1) + return; + final GISAttributeModel model=getModel(getIdxAttZ()); + + if (model instanceof GISAttributeModelObjectInterface) { + final CoordinateSequence seq=getCoordinateSequence(_idxGeom); + final GISAttributeModelDoubleArray arr=(GISAttributeModelDoubleArray)model.getObjectValueAt(_idxGeom); + for (int k=seq.size()-1; k>=0; k--) { + arr.set(k, seq.getOrdinate(k, 2)); + } + } + + // L'attribut est global : On r\xE9cup\xE9re les coordonn\xE9es, qu'on moyenne. + else if (model instanceof CtuluCollectionDoubleEdit) { + final CoordinateSequence seq=getCoordinateSequence(_idxGeom); + double moy=0; + for (int k=seq.size()-1; k>=0; k--) { + moy+=seq.getOrdinate(k, 2); + } + model.setObject(_idxGeom, new Double(moy/seq.size()), null); + } + } + + /** + * D\xE9finit l'attribut qui correspond \xE0 Z. Il est alors utilis\xE9 lors des d\xE9placements en Z de l'objet, + * ou pour la persistence en chaque point s'il est atomique. Seul les attributs de type {@link GISAttributeDouble} + * sont autoris\xE9s.<p> + * Remarque : L'attribut doit \xEAtre dans la liste des attributs de la collection pour que les traitements + * soit effectu\xE9s en en tenant compte. + * + * @param _attributeIsZ l'attribut qui correspond \xE0 z: il sera automatiquement mis \xE0 jour lors de + * l'ajout de geometrie. Peut \xEAtre null. + */ + public void setAttributeIsZ(final GISAttributeDouble _attributeIsZ) { + badIdxAttZ_=true; + attributeIsZ_ = _attributeIsZ; + } + + /** + * Definit les attributs pour lesquels la valeur est immuable.<p> + * <b>Remarque</b> : Si des objets existent d\xE9j\xE0 avec une valeur pour l'attribut \xE0 rendre immuable, ces valeurs ne seront pas + * remplac\xE9e par la valeur constante. Utilisez {@link GISZoneCollection#setAttributes()} + * pour r\xE9initialiser les valeurs pour la collection. + * + * @param _att L'attribut \xE0 fixer. + * @param _value La valeur constante. Si null, l'attribut n'est pas obligatoirement fix\xE9. + */ + public void setFixedAttributeValue(GISAttributeInterface _att, Object _value) { + if (_value==null) + fixedAttributes_.remove(_att); + else + fixedAttributes_.put(_att, _value); + } + + /** + * Associe les attributs aux objets de la collection. Pour chaque attribut inexistant dans la liste est cr\xE9\xE9 un nouveau mod\xE8le. + * @param _att La liste des attributs, conditionnant l'ordre des mod\xE8les dans la liste des mod\xE8les. + * @param _cmd Le conteneur de commande. + */ + public void setAttributes(final GISAttributeInterface[] _att, final CtuluCommandContainer _cmd) { + if (_att == attr_ || Arrays.equals(attr_, _att)) { + return; + } + badIdxAttZ_=true; + // on sauvegarde les anciens attributs + final GISAttributeModelListener[] old = attr_; + + // on recupere les valeurs d\xE9j\xE0 utilis\xE9es + final Map<GISAttributeInterface,GISAttributeModel> exist = + new HashMap<GISAttributeInterface,GISAttributeModel>(attr_ == null ? 0 : attr_.length); + + if (attr_ != null) { + for (int i = attr_.length - 1; i >= 0; i--) { + exist.put(attr_[i].getAttribute(), attr_[i]); + } + } + final GISAttributeModelListener[] newAtt = _att == null ? null : new GISAttributeModelListener[_att.length]; + if (_att != null) { + for (int i = _att.length - 1; i >= 0; i--) { + newAtt[i] = (GISAttributeModelListener) exist.get(_att[i]); + if (newAtt[i] == null) { + newAtt[i] = (GISAttributeModelListener) GISZoneAttributeFactory.createModel(this, _att[i]); + } + } + } + attr_ = newAtt; + fireAttributesChanged(null); + if (_cmd != null) { + _cmd.addCmd(new CtuluCommand() { + + public void redo() { + attr_ = newAtt; + fireAttributesChanged(null); + } + + public void undo() { + attr_ = old; + fireAttributesChanged(null); + } + + }); + } + + } + + public abstract void setCoordinateSequence(int _idx, CoordinateSequence _newSeq, CtuluCommandContainer _cmd); + + /** + * @param _title le nouveau titre + * @param _cmd la commande + * @return true si modif + */ + public final boolean setTitle(final String _title, final CtuluCommandContainer _cmd) { + // test pour ne pas mettre le meme titre + if (_title == title_ || (_title != null && _title.equals(title_))) { + return false; + } + final String old = _title; + title_ = _title; + fireTitleChanged(); + if (_cmd != null) { + _cmd.addCmd(new CtuluCommand() { + + public void redo() { + setTitle(_title, null); + } + + public void undo() { + setTitle(old, null); + } + }); + } + return true; + + } + + /** + * Mise a jour des listeners. + */ + public abstract void updateListeners(); + +} Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2008-08-14 10:01:56 UTC (rev 3801) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2008-08-14 15:03:15 UTC (rev 3802) @@ -15,8 +15,6 @@ import com.vividsolutions.jts.geom.CoordinateSequence; import com.vividsolutions.jts.geom.Geometry; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLib; @@ -180,34 +178,6 @@ return ((CtuluCollectionDouble) getModel(_idxAtt)).getValue(_idxGeom); } - public void postImport(final int _firstIdx) { - final GISAttributeModel model = getModel(attributeIsZ_); - if (attributeIsZ_ == null || model == null) return; - - if (attributeIsZ_.isAtomicValue()) { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - final GISAttributeModelDoubleArray arr = (GISAttributeModelDoubleArray) model.getObjectValueAt(i); - for (int k = seq.size() - 1; k >= 0; k--) { - arr.set(k, seq.getOrdinate(k, 2)); - } - } - } - // L'attribut est global : On r\xE9cup\xE9re les coordonn\xE9es, qu'on moyenne. - else { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - double moy=0; - for (int k = seq.size() - 1; k >= 0; k--) { - moy+=seq.getOrdinate(k, 2); - } - model.setObject(i,new Double(moy/seq.size()),null); - } - } - } - public void setCoordinateSequence(final int _idx, final CoordinateSequence _newSeq, final CtuluCommandContainer _cmd) { final Geometry old = (Geometry) super.geometry_.getValueAt(_idx); if (_newSeq != null && _newSeq.size() == old.getNumPoints()) { Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2008-08-14 10:01:56 UTC (rev 3801) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2008-08-14 15:03:15 UTC (rev 3802) @@ -329,34 +329,6 @@ return ((CtuluCollectionDouble) getModel(_idxAtt)).getValue(_idxGeom); } - public void postImport(final int _firstIdx) { - final GISAttributeModel model = getModel(attributeIsZ_); - if (attributeIsZ_ == null || model == null) return; - - if (attributeIsZ_.isAtomicValue()) { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - final GISAttributeModelDoubleArray arr = (GISAttributeModelDoubleArray) model.getObjectValueAt(i); - for (int k = seq.size() - 1; k >= 0; k--) { - arr.set(k, seq.getOrdinate(k, 2)); - } - } - } - // L'attribut est global : On r\xE9cup\xE9re les coordonn\xE9es, qu'on moyenne. - else { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - double moy=0; - for (int k = seq.size() - 1; k >= 0; k--) { - moy+=seq.getOrdinate(k, 2); - } - model.setObject(i,new Double(moy/seq.size()),null); - } - } - } - public boolean removeAtomicValue(final int _idxGeom, final CtuluListSelectionInterface _sel, final CtuluUI _ui, final CtuluCommandContainer _cmd) { if (_sel == null || _sel.isEmpty()) { Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java 2008-08-14 10:01:56 UTC (rev 3801) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java 2008-08-14 15:03:15 UTC (rev 3802) @@ -260,34 +260,6 @@ return ((CtuluCollectionDouble) getModel(_idxAtt)).getValue(_idxGeom); } - public void postImport(final int _firstIdx) { - final GISAttributeModel model = getModel(attributeIsZ_); - if (attributeIsZ_ == null || model == null) return; - - if (attributeIsZ_.isAtomicValue()) { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - final GISAttributeModelDoubleArray arr = (GISAttributeModelDoubleArray) model.getObjectValueAt(i); - for (int k = seq.size() - 1; k >= 0; k--) { - arr.set(k, seq.getOrdinate(k, 2)); - } - } - } - // L'attribut est global : On r\xE9cup\xE9re les coordonn\xE9es, qu'on moyenne. - else { - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - final CoordinateSequence seq = getCoordinateSequence(i); - double moy=0; - for (int k = seq.size() - 1; k >= 0; k--) { - moy+=seq.getOrdinate(k, 2); - } - model.setObject(i,new Double(moy/seq.size()),null); - } - } - } - public void setCoordinateSequence(final int _idx, final CoordinateSequence _newSeq, final CtuluCommandContainer _cmd) { final Geometry old = (Geometry) super.geometry_.getValueAt(_idx); if (_newSeq != null && _newSeq.size() == old.getNumPoints()) { Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2008-08-14 10:01:56 UTC (rev 3801) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2008-08-14 15:03:15 UTC (rev 3802) @@ -146,16 +146,6 @@ return true; } - public void postImport(final int _firstIdx) { - if (attributeIsZ_ != null) { - final GISAttributeModelDoubleInterface dModel = (GISAttributeModelDoubleInterface) getModel(attributeIsZ_); - final int nb = getNumGeometries(); - for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) { - dModel.set(i, getZ(i), null); - } - } - } - public void setCoordinateSequence(final int _idx, final CoordinateSequence _newSeq, final CtuluCommandContainer _cmd) { if (_newSeq != null && _newSeq.size() == 1) { set(_idx, _newSeq.getX(0), _newSeq.getY(0), _cmd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-14 10:01:48
|
Revision: 3801 http://fudaa.svn.sourceforge.net/fudaa/?rev=3801&view=rev Author: bmarchan Date: 2008-08-14 10:01:56 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Integration fonction d'interpolation Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationSupportGISAdapter.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Added Paths: ----------- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneProjectionAction.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModelGeometry.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationSupportGISAdapter.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationSupportGISAdapter.java 2008-08-14 10:00:28 UTC (rev 3800) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationSupportGISAdapter.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -9,22 +9,39 @@ import gnu.trove.TObjectIntHashMap; -import com.vividsolutions.jts.geom.Point; +import java.util.ArrayList; import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.collection.CtuluCollectionDouble; +import org.fudaa.ctulu.gis.GISAttributeDouble; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISDataModel; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.Point; + /** + * Un adapteur pour un support d'interpolation a partir d'un modele contenant des + * g\xE9om\xE9tries. + * * @author Fred Deniger * @version $Id: InterpolationSupportGISAdapter.java,v 1.2 2007-06-11 13:03:29 deniger Exp $ */ public class InterpolationSupportGISAdapter implements SupportLocationI, InterpolationSupportValuesI { final GISDataModel model_; + /** Une table qui associe un attribut a un indice sur le modele */ final TObjectIntHashMap attInt_; - + /** Si le modele ne contient que des points, optimisation du support */ + final boolean onlyPoints_; + /** Si le modele continet autre chose que des points */ + int[][] idx2geom_; + /** - * @param _model un model ne contenant que des points + * Construction de l'adapteur a partir d'un modele g\xE9om\xE9trique. Si le modele n'est constitu\xE9 que + * de Point, le support est optimis\xE9. + * @param _model un model contenant des g\xE9om\xE9tries. */ public InterpolationSupportGISAdapter(final GISDataModel _model) { model_ = _model; @@ -33,21 +50,99 @@ for (int i = 0; i < nbAttributes; i++) { attInt_.put(model_.getAttribute(i), i); } + + onlyPoints_=containsOnlyPoints(); + if (!onlyPoints_) initIndexes(); } + + /** + * Retourne vrai si le modele ne contient que des points. + * @return True : Si vide ou uniquement des points. + */ + public boolean containsOnlyPoints() { + int nb=model_.getNumGeometries(); + for (int i=0; i<nb; i++) { + if (!(model_.getGeometry(i) instanceof Point)) return false; + } + return true; + } + + private void initIndexes() { + ArrayList<int[]> vidx2geom=new ArrayList<int[]>(); + int nb=model_.getNumGeometries(); + for (int i=0; i<nb; i++) { + Geometry g=model_.getGeometry(i); + int nbpts=g.getNumPoints(); + for (int j=0; j<nbpts; j++) { + vidx2geom.add(new int[]{i,j}); + } + } + idx2geom_=vidx2geom.toArray(new int[0][0]); + } + public int getPtsNb() { - return model_.getNumGeometries(); + int nb; + + if (onlyPoints_) + nb=model_.getNumGeometries(); + else + nb=idx2geom_.length; + + return nb; } public double getPtX(final int _i) { - return ((Point) model_.getGeometry(_i)).getX(); + if (onlyPoints_) { + return ((Point)model_.getGeometry(_i)).getX(); + } + else { + CoordinateSequence seq= + ((GISCoordinateSequenceContainerInterface)model_.getGeometry(idx2geom_[_i][0])).getCoordinateSequence(); + return seq.getX(idx2geom_[_i][1]); + } } public double getPtY(final int _i) { - return ((Point) model_.getGeometry(_i)).getY(); + if (onlyPoints_) { + return ((Point)model_.getGeometry(_i)).getY(); + } + else { + CoordinateSequence seq= + ((GISCoordinateSequenceContainerInterface)model_.getGeometry(idx2geom_[_i][0])).getCoordinateSequence(); + return seq.getY(idx2geom_[_i][1]); + } } - public double getV(CtuluVariable _var, int _ptIdx) { - return model_.getDoubleValue(attInt_.get(_var), _ptIdx); + /* + * _var Un attribut pour lequel trouver la valeur. L'attribut peut \xEAtre atomique ou + * global, mais doit \xEAtre de type GISAttributDouble. + */ + public double getV(CtuluVariable _var, int _i) { + if (!(_var instanceof GISAttributeDouble)) + throw new IllegalArgumentException("Bad argument _var"); + + double val; + + if (onlyPoints_) { + val=model_.getDoubleValue(attInt_.get(_var), _i); + } + else { + GISAttributeDouble att=(GISAttributeDouble)_var; + if (att.isAtomicValue()) { + Object vals=model_.getValue(attInt_.get(_var),idx2geom_[_i][0]); + if (vals instanceof CtuluCollectionDouble) { + val=((CtuluCollectionDouble)vals).getValue(idx2geom_[_i][1]); + } + else { + val=0; + } + } + else { + val=model_.getDoubleValue(attInt_.get(_var),idx2geom_[_i][0]); + } + } + + return val; } } Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-08-14 10:00:28 UTC (rev 3800) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -41,6 +41,7 @@ import org.fudaa.fudaa.modeleur.action.SceneDecimationAction; import org.fudaa.fudaa.modeleur.action.SceneInterpolationAction; import org.fudaa.fudaa.modeleur.action.SceneMoveInLayerAction; +import org.fudaa.fudaa.modeleur.action.SceneProjectionAction; import org.fudaa.fudaa.modeleur.action.SceneRefinementAction; import org.fudaa.fudaa.sig.layer.FSigEditor; import org.fudaa.fudaa.sig.layer.FSigLayerExporter; @@ -83,6 +84,7 @@ acts.add(new SceneMoveInLayerAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneDecimationAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneRefinementAction((MdlSceneEditor)sceneEditor_)); + acts.add(new SceneProjectionAction((MdlSceneEditor)sceneEditor_)); getSceneEditor().getScene().setActions(acts.toArray(new EbliActionAbstract[0])); } Added: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java (rev 0) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -0,0 +1,194 @@ +/* + * @creation 8 sept. 06 + * @modification $Date: 2008/05/13 12:10:21 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.fudaa.modeleur; + +import java.awt.Color; +import java.awt.Dimension; + +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.TreePath; + +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISDataModel; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.CalqueGISTreeModel; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesAbstract; +import org.fudaa.ebli.calque.ZCalqueGeometry; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.ZModeleGeom; +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.fudaa.modeleur.layer.MdlModelGeometry; +import org.fudaa.fudaa.sig.FSigLib; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuVerticalLayout; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.Polygon; + +/** + * Un panneau de saisie des g\xE9om\xE9tries supports de projection suivant Z. + * @author Bertrand Marchand + * @version $Id: MdlProjectImportPanel.java,v 1.1.2.1 2008/05/13 12:10:21 bmarchan Exp $ + */ +public class MdlProjectionPanel extends CtuluDialogPanel { + + private ZEbliCalquesPanel pn_; + private GrBoite initZoom_; + private JTree trLayers_; + private ZCalqueGeometry cqTmp_; + private GISZoneCollection support_; + + public MdlProjectionPanel(ZEbliCalquesPanel _pn) { + pn_=_pn; + setLayout(new BuVerticalLayout(5,true,true)); + + BuLabel lbTitle=new BuLabel(FSigLib.getS("S\xE9lectionnez les semis")); + add(lbTitle); + + CalqueGISTreeModel md=new CalqueGISTreeModel(null,_pn.getDonneesCalque()); + md.setMask(GISLib.MASK_MULTIPOINT); + trLayers_=md.createView(true,true); + + trLayers_.addTreeSelectionListener(new TreeSelectionListener() { + public void valueChanged(TreeSelectionEvent e) { + treeSelectionChanged(getSelectedGeomInTree(),true); + } + }); + JScrollPane sp=new JScrollPane(trLayers_); + sp.setPreferredSize(new Dimension(300,200)); + add(sp); + } + + /** + * Retourne les g\xE9ometries s\xE9lectionn\xE9es de l'arbre. + * @return Les g\xE9om\xE9tries, de taille = 0 si rien de selectionn\xE9. + */ + private Geometry[] getSelectedGeomInTree() { + if (trLayers_.isSelectionEmpty()) { + return null; + } + TreePath[] selpaths=trLayers_.getSelectionPaths(); + Geometry[] geoms=new Geometry[selpaths.length]; + for (int i=0; i<selpaths.length; i++) { + final CalqueGISTreeModel.LayerNode node=(CalqueGISTreeModel.LayerNode)selpaths[i].getLastPathComponent(); + final ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) node.getUserObject(); + geoms[i]=((ZModeleGeom)cq.modeleDonnees()).getGeomData().getGeometry(node.getIdxGeom()); + } + + return geoms; + } + + /** + * R\xE9affichage de la fenetre 2D en cas de selection d'un objet. + * @param _geoms Les g\xE9om\xE9tries s\xE9lectionn\xE9es. + * @param _zoom True si le zoom doit se faire sur les g\xE9ometries s\xE9lectionn\xE9es. + */ + private void treeSelectionChanged(final Geometry[] _geoms, final boolean _zoom) { + if (pn_==null) { + return; + } + if (_geoms == null || _geoms.length==0) { + if (cqTmp_ != null) { + cqTmp_.setVisible(false); + } + return; + } + + MdlModelGeometry mdl=new MdlModelGeometry(); + support_=mdl.getGeomData(); + + for (int i=0; i<_geoms.length; i++) { + support_.addGeometry(_geoms[i], null, null); + } + // Ajout de l'enveloppe externe pour visualisation. + Geometry g=support_.convexHull(); + if (g instanceof Polygon) + support_.addGeometry(((Polygon)g).getExteriorRing(), null, null); + else + support_.addGeometry(g, null, null); + + if (cqTmp_ == null) { + initZoom_ = pn_.getVueCalque().getViewBoite(); + cqTmp_ = new ZCalqueGeometry(mdl); + cqTmp_.setDestructible(true); + final TraceIconModel model = new TraceIconModel(TraceIcon.PLUS_DOUBLE, 4, Color.RED); + cqTmp_.setIconModel(0, model); + cqTmp_.setIconModel(1, model); + final TraceLigneModel ligne = new TraceLigneModel(TraceLigne.MIXTE, 2, Color.RED); + cqTmp_.setLineModel(0, ligne); + cqTmp_.setLineModel(1, ligne); + pn_.getVueCalque().getCalque().enPremier(cqTmp_); + pn_.getCqInfos().enPremier(); + } + cqTmp_.modele(mdl); + cqTmp_.setVisible(true); + + if (_zoom) { + BArbreCalqueModel.actionCenter(cqTmp_, pn_); + } + } + + @Override + public boolean valide() { + if (trLayers_.getSelectionCount()==0) { + setErrorText(TrResource.getS("Vous devez s\xE9lectionner au moins 1 semis")); + return false; + } + return true; + } + + /** + * Retourne le modele des g\xE9om\xE9tries supports (les g\xE9om\xE9tries s\xE9l\xE9ectionn\xE9es dans l'arbre). + * @return Le mod\xE8le. + */ + public GISDataModel getSupportCollection() { + support_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + support_.setAttributeIsZ(GISAttributeConstants.BATHY); + support_.postImport(0); + return support_; + } + + /** + * Fermeture du dialogue, et suppression du calque qui visualise les g\xE9om\xE9tries s\xE9lectionn\xE9es. + */ + private void close() { + if (cqTmp_!=null) { + cqTmp_.detruire(); + cqTmp_=null; + // Suppression de l'enveloppe externe. + support_.removeGeometries(new int[]{support_.getNbGeometries()-1}, null); + pn_.getVueCalque().getCalque().repaint(); + } + pn_.getVueCalque().changeRepere(this, initZoom_); + } + + @Override + public void cancel() { + close(); + super.cancel(); + } + + @Override + public boolean ok() { + close(); + return super.ok(); + } +} \ No newline at end of file Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectionPanel.java ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2008-08-14 10:00:28 UTC (rev 3800) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -7,36 +7,37 @@ */ package org.fudaa.fudaa.modeleur; +import java.util.ArrayList; +import java.util.List; + import org.fudaa.ctulu.CtuluCommandComposite; -import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; +import org.fudaa.ctulu.gis.GISDataModel; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISMultiPoint; -import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; -import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; +import org.fudaa.ctulu.interpolation.InterpolationParameters; +import org.fudaa.ctulu.interpolation.InterpolationResultsHolderI; +import org.fudaa.ctulu.interpolation.InterpolationSupportGISAdapter; +import org.fudaa.ctulu.interpolation.InterpolationTarget; +import org.fudaa.ctulu.interpolation.InterpolationTargetGISAdapter; +import org.fudaa.ctulu.interpolation.bilinear.InterpolatorBilinear; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZModeleDonnees; import org.fudaa.ebli.calque.ZModeleGeom; import org.fudaa.ebli.calque.ZScene; -import org.fudaa.ebli.calque.edition.ZCalqueEditable; -import org.fudaa.ebli.calque.edition.ZCalqueMultiPointEditable; -import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; -import org.fudaa.ebli.calque.edition.ZModeleMultiPointEditable; import org.fudaa.ebli.calque.edition.ZSceneEditor; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.geometrie.GrPolyligne; import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.commun.impl.Fudaa; -import org.fudaa.fudaa.modeleur.layer.MdlLayer2dCloud; -import org.fudaa.fudaa.modeleur.layer.MdlModel2dCloud; import org.fudaa.fudaa.modeleur.layer.MdlModel2dLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dMultiPoint; -import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.MultiPoint; /** * L'\xE9diteur effectuant les traitements sur la scene sp\xE9cifiques au modeleur. @@ -242,4 +243,66 @@ super.getScene().clearSelection(); } } + + /** + * Projete une g\xE9om\xE9trie sur un ensemble de points d'un ou plusieurs semis. + */ + public void projectSelectedObject() { + MdlProjectionPanel pnProjection=new MdlProjectionPanel(pn_); + + if (pnProjection.afficheModaleOk(pn_.getFrame(), FudaaLib.getS("Projection sur des semis"))) { + GISDataModel mdl=pnProjection.getSupportCollection(); + InterpolationSupportGISAdapter support=new InterpolationSupportGISAdapter(mdl); + List<GISAttributeInterface> vars=new ArrayList<GISAttributeInterface>(); + vars.add(GISAttributeConstants.BATHY); + + GISZoneCollectionGeometry targetGeoms=new GISZoneCollectionGeometry(); + int[] idxGeom=getScene().getLayerSelection().getSelectedIndex(); + for (int i : idxGeom) + targetGeoms.addGeometry((Geometry)getScene().getObject(i), null, null); + + targetGeoms.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + targetGeoms.setAttributeIsZ(GISAttributeConstants.BATHY); +// targetGeoms.postImport(0); + + InterpolationTarget target=new InterpolationTargetGISAdapter(targetGeoms); + InterpolationParameters params=new InterpolationParameters(vars,target,support); + InterpolatorBilinear interp=new InterpolatorBilinear(support); + interp.interpolate(params); + InterpolationResultsHolderI res=params.getResults(); + + if (ui_.manageAnalyzeAndIsFatal(params.getAnalyze())) return; + + final CtuluCommandComposite cmp = new CtuluCommandComposite(); + + // Transfert du Z sur les objets selectionn\xE9s. + int ipt=0; + for (int i=0; i<targetGeoms.getNbGeometries(); i++) { + CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)targetGeoms.getGeometry(i)).getCoordinateSequence(); + for (int idx=0; idx<seq.size(); idx++) { + seq.setOrdinate(idx, 2, res.getValuesForPt(ipt++)[0]); + } + } + targetGeoms.postImport(0); + + GISZoneCollection col=null; + int zatt=0; + + for (int i=0; i<idxGeom.length; i++) { + Object vals=targetGeoms.getValue(0,i); + GISZoneCollection colTmp=((ZModeleGeom)getScene().getLayerForId(idxGeom[i]).modeleDonnees()).getGeomData(); + if (col!=colTmp) { + col=colTmp; + zatt=col.getIndiceOf(GISAttributeConstants.BATHY); + } + int idx=getScene().sceneId2LayerId(idxGeom[i]); + if (zatt!=-1) + col.setAttributValue(zatt, idx, vals, cmp); + } + + if (mng_ != null) { + mng_.addCmd(cmp.getSimplify()); + } + } + } } Added: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneProjectionAction.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneProjectionAction.java (rev 0) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneProjectionAction.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -0,0 +1,89 @@ +/* + * @creation 3 juil. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.action; + +import java.awt.event.ActionEvent; + +import javax.swing.Action; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.gis.GISMultiPoint; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ebli.calque.ZScene; +import org.fudaa.ebli.calque.ZSelectionEvent; +import org.fudaa.ebli.calque.ZSelectionListener; +import org.fudaa.ebli.calque.ZScene.SceneSelectionHelper; +import org.fudaa.ebli.calque.edition.ZCalqueEditable; +import org.fudaa.ebli.calque.edition.ZSceneEditor; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.modeleur.MdlSceneEditor; + +import com.memoire.bu.BuResource; + +/** + * Une action pour projeter une g\xE9om\xE9trie sur un ou des semis de points. + * @author Bertrand Marchand + */ +public class SceneProjectionAction extends EbliActionSimple implements ZSelectionListener { + MdlSceneEditor sceneEditor_; + + public SceneProjectionAction(MdlSceneEditor _sceneEditor) { + super(BuResource.BU.getString("Projeter sur un semis"), null, "GIS_PROJECT"); + setDefaultToolTip(CtuluLib.getS("Projeter la g\xE9om\xE9trie sur un semis")); + setSceneEditor(_sceneEditor); + sceneEditor_.getScene().addSelectionListener(this); + } + + public void actionPerformed(final ActionEvent _e) { + sceneEditor_.projectSelectedObject(); + } + + /** + * @param _editor l'editeur + */ + private void setSceneEditor(final MdlSceneEditor _sceneEditor) { + sceneEditor_ = _sceneEditor; + } + + public void updateForSelectionChanged() { + ZScene scn=sceneEditor_.getScene(); + SceneSelectionHelper hlp=sceneEditor_.getScene().getSelectionHelper(); + int idGeom=-1; + + boolean b=true; + // Si la selection n'est pas null et atomique + b=b && !scn.isSelectionEmpty(); + // Si la selection est sur le m\xEAme objet. +// b=b && (idGeom=hlp.getUniqueSelectedIdx())!=-1; +// // Si le nombre d'atomiques est de 2 cons\xE9cutifs sur une g\xE9om\xE9trie de type polyligne. +// if (b && scn.getObject(idGeom) instanceof GISPolyligne) { +// b=b && hlp.getNbAtomicSelected()==2; +// b=b && Math.abs(hlp.getUniqueAtomicSelection().getMinIndex()-hlp.getUniqueAtomicSelection().getMaxIndex())==1; +// if (b) putValue(Action.NAME, BuResource.BU.getString("Scinder la polyligne")); +// } +// // Si ou est sur un multipoint +// else { +// b=b && (scn.getObject(idGeom) instanceof GISMultiPoint); +// if (b) putValue(Action.NAME, BuResource.BU.getString("Scinder le multipoint")); +// } +// if (!b) putValue(Action.NAME, BuResource.BU.getString("Scinder")); + + setEnabled(b); + } + + public String getEnableCondition() { + return CtuluLib.getS("S\xE9lectionner une g\xE9om\xE9trie ou des sommets"); + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.calque.ZSelectionListener#selectionChanged(org.fudaa.ebli.calque.ZSelectionEvent) + */ + public void selectionChanged(ZSelectionEvent _evt) { + updateForSelectionChanged(); + } +} Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneProjectionAction.java ___________________________________________________________________ Added: svn:eol-style + native Added: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModelGeometry.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModelGeometry.java (rev 0) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModelGeometry.java 2008-08-14 10:01:56 UTC (rev 3801) @@ -0,0 +1,131 @@ +/* + * @creation 20 janv. 08 + * @modification $Date: 2008/02/21 19:41:56 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.layer; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISAttribute; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeDouble; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; +import org.fudaa.ctulu.gis.GISMultiPoint; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.ctulu.gis.GISZoneListener; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.calque.ZModeleGeometry; +import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import org.fudaa.fudaa.modeleur.MdlResource; +import org.fudaa.fudaa.sig.FSigResource; + +import com.memoire.bu.BuTable; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; + +/** + * Un mod\xE8le contenant des g\xE9om\xE9tries de tous types, pour repr\xE9sentation unique. + * @author Bertrand Marchand + * @version $Id: MdlModel2dLevel.java,v 1.1.2.6 2008/02/21 19:41:56 bmarchan Exp $ + */ +public class MdlModelGeometry implements ZModeleGeometry { + GISZoneCollectionGeometry geometries_; + + /** + * Constructeur + */ + public MdlModelGeometry() { + geometries_=new GISZoneCollectionGeometry(); + } + + public void getDomaineForGeometry(int _idxGeom, GrBoite _target) { + if (geometries_ == null || geometries_.getNumGeometries() == 0) { + return; + } + final Geometry g = geometries_.getGeometry(_idxGeom); + final Envelope e = g.getEnvelopeInternal(); + if (_target.o_ == null) { + _target.o_ = new GrPoint(); + } + if (_target.e_ == null) { + _target.e_ = new GrPoint(); + } + if (e != null && !e.isNull()) { + _target.o_.x_ = e.getMinX(); + _target.o_.y_ = e.getMinY(); + _target.e_.x_ = e.getMaxX(); + _target.e_.y_ = e.getMaxY(); + } + } + + public int getNbPointForGeometry(int _idxGeom) { + if (geometries_ == null) { + return 0; + } + final Geometry gi = geometries_.getGeometry(_idxGeom); + return gi.getNumPoints(); + } + + public final boolean isGeometryReliee(final int _idxGeom) { + Geometry g=getGeomData().getGeometry(_idxGeom); + return (g instanceof LineString); + } + + public final boolean isGeometryFermee(final int _idxGeom) { + Geometry g=getGeomData().getGeometry(_idxGeom); + return (g instanceof LineString && ((LineString)g).isClosed()); + } + + public boolean point(GrPoint _pt, int _idxGeom, int _pointIdx) { + final CoordinateSequence g=((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(_idxGeom)).getCoordinateSequence(); + _pt.x_ = g.getX(_pointIdx); + _pt.y_ = g.getY(_pointIdx); + return true; + } + + public GISZoneCollection getGeomData() { + return geometries_; + } + + public void prepareExport() { + geometries_.prepareExport(); + } + + public BuTable createValuesTable(ZCalqueAffichageDonneesInterface _layer) { + return null; + } + + public void fillWithInfo(InfoData _d, ZCalqueAffichageDonneesInterface _layer) {} + + public GrBoite getDomaine() { + if (geometries_ == null || geometries_.getNumGeometries() == 0) { + return null; + } + final Envelope e = geometries_.getEnvelopeInternal(); + if (e == null) { + return null; + } + return new GrBoite(new GrPoint(e.getMinX(), e.getMinY(), 0), new GrPoint(e.getMaxX(), e.getMaxY(), 0)); + } + + public final int getNombre() { + return geometries_ == null ? 0 : geometries_.getNumGeometries(); + } + + public final Object getObject(final int _ind) { + return geometries_ == null ? null : geometries_.getGeometry(_ind); + } + + public boolean isValuesTableAvailable() { + return false; + } +} Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModelGeometry.java ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-14 10:00:19
|
Revision: 3800 http://fudaa.svn.sourceforge.net/fudaa/?rev=3800&view=rev Author: bmarchan Date: 2008-08-14 10:00:28 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Un peu de doc Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/Interpolator.java branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-08-14 09:54:18 UTC (rev 3799) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollection.java 2008-08-14 10:00:28 UTC (rev 3800) @@ -404,14 +404,24 @@ } /** - * Permet de remettre a jour le model contenant les z et le z des geometrie. + * Initialise le mod\xE8le d'attribut utilis\xE9 pour Z avec les coordonn\xE9es Z des points des g\xE9om\xE9tries. + * Principalement utilis\xE9 \xE0 la suite d'un import. * - * @param _firstIdx l'indice de la premiere geometrie a modifier + * @param _firstIdx l'indice de la premiere geometrie utilis\xE9e pour l'initialisation. + * @see #setAttributeIsZ(GISAttributeDouble) + * @see {@link #prepareExport()} pour la m\xE9thode inverse */ public abstract void postImport(final int _firstIdx); public void preload(final GISAttributeInterface[] _att, final ProgressionInterface _prog) {} + /** + * Pr\xE9pare l'export des g\xE9om\xE9tries, en affectant \xE0 la coordonn\xE9e Z de leurs points les valeurs contenues + * dans l'attribut utilis\xE9 pour Z. + * + * @see #setAttributeIsZ(GISAttributeDouble) + * @see {@link #postImport(int)} pour la m\xE9thode inverse + */ public void prepareExport() { if (attributeIsZ_ != null) { final GISAttributeModel model = getModel(attributeIsZ_); Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/Interpolator.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/Interpolator.java 2008-08-14 09:54:18 UTC (rev 3799) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/Interpolator.java 2008-08-14 10:00:28 UTC (rev 3800) @@ -10,13 +10,23 @@ import org.fudaa.ctulu.CtuluActivity; /** + * Un interpolateur. * @author fred deniger * @version $Id: Interpolator.java,v 1.1 2007-06-05 08:57:43 deniger Exp $ */ public abstract class Interpolator implements CtuluActivity { + /** + * @see #interpolate(InterpolationParameters) + */ protected abstract boolean doInterpolate(InterpolationParameters _params); + /** + * Interpole les valeurs pour les points de la cible. + * @param _params Les parametres d'interpolation, contenant la cible, le support, les resultats. + * @return True : Si l'interpolation s'est correctement d\xE9roul\xE9e. False en cas d'\xE9chec sur 1 ou + * plusieurs points. + */ public final boolean interpolate(InterpolationParameters _params) { if (_params == null) return false; return doInterpolate(_params.createParametersForVect()); Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-08-14 09:54:18 UTC (rev 3799) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-08-14 10:00:28 UTC (rev 3800) @@ -487,9 +487,9 @@ } /** - * Retourne le calque pour l'objet geom selectionn\xE9. - * @param _id - * @return + * Retourne le calque contenant la g\xE9om\xE9trie d'indice _idGeom. + * @param _idGeom L'indice de scene. + * @return Le calque. */ public ZCalqueAffichageDonneesInterface getLayerForId(int _idGeom) { int idecal=0; @@ -500,23 +500,34 @@ return null; } - public int sceneId2LayerId(int _idGeom) { + /** + * Converti un indice de scene (global) en un indice pour un calque. + * @param _idScene L'index dans la scene. + * @return L'index pour le calque. + * @see #getLayerForId(int) + */ + public int sceneId2LayerId(int _idScene) { int idecal=0; for (ZCalqueAffichageDonneesInterface cq : getTargetLayers()) { int nb=cq.modeleDonnees().getNombre(); - if (_idGeom < idecal+nb) - return _idGeom-idecal; + if (_idScene < idecal+nb) + return _idScene-idecal; idecal+=nb; -// if (_idGeom < (idecal+=cq.modeleDonnees().getNombre())) -// return _idGeom-idecal; } return -1; } - public int layerId2SceneId(ZCalqueAffichageDonneesInterface _cq, int _idGeom) { + /** + * Converti un indice de calque en un indice de scene (global). + * @param _cq Le calque. + * @param _idLayer L'index dans le calque. + * @return L'index global pour la scene. + * @see #getLayerForId(int) + */ + public int layerId2SceneId(ZCalqueAffichageDonneesInterface _cq, int _idLayer) { int idecal=0; for (ZCalqueAffichageDonneesInterface cq : getTargetLayers()) { - if (cq==_cq) return _idGeom+idecal; + if (cq==_cq) return _idLayer+idecal; idecal+=cq.modeleDonnees().getNombre(); } return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-14 09:54:09
|
Revision: 3799 http://fudaa.svn.sourceforge.net/fudaa/?rev=3799&view=rev Author: bmarchan Date: 2008-08-14 09:54:18 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Renomme et generalise InterpolationPtAdapter Added Paths: ----------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetGISAdapter.java Removed Paths: ------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetPtAdapter.java Copied: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetGISAdapter.java (from rev 3798, branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetPtAdapter.java) =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetGISAdapter.java (rev 0) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetGISAdapter.java 2008-08-14 09:54:18 UTC (rev 3799) @@ -0,0 +1,159 @@ +/* + * @creation 5 sept. 2005 + * @modification $Date: 2007-06-05 08:57:43 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ctulu.interpolation; + +import java.util.ArrayList; + +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISZoneCollection; + +import com.vividsolutions.jts.algorithm.SIRtreePointInRing; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LinearRing; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; + +/** + * Un adapteur pour une cible d'interpolation a partir d'un modele contenant des + * g\xE9om\xE9tries. + * + * @author Fred Deniger + * @version $Id: InterpolationSupportGISAdapter.java,v 1.2 2007-06-11 13:03:29 deniger Exp $ + */ +public class InterpolationTargetGISAdapter implements InterpolationTarget { + + Envelope env_; + LinearRing extern_; + final GISZoneCollection geometries_; + SIRtreePointInRing tester_; + /** Si le modele ne contient que des points, optimisation de la cible */ + final boolean onlyPoints_; + /** Si le modele continet autre chose que des points */ + int[][] idx2geom_; + + final Coordinate tmp_ = new Coordinate(); + final Coordinate tmpX1_ = new Coordinate(); + final Coordinate tmpX2_ = new Coordinate(); + + /** + * @param _geoms + */ + public InterpolationTargetGISAdapter(final GISZoneCollection _geoms) { + super(); + geometries_ = _geoms; + + onlyPoints_=containsOnlyPoints(); + if (!onlyPoints_) initIndexes(); + } + + /** + * Retourne vrai si le modele ne contient que des points. + * @return True : Si vide ou uniquement des points. + */ + public boolean containsOnlyPoints() { + int nb=geometries_.getNumGeometries(); + for (int i=0; i<nb; i++) { + if (!(geometries_.getGeometry(i) instanceof Point)) return false; + } + return true; + } + + private void initIndexes() { + ArrayList<int[]> vidx2geom=new ArrayList<int[]>(); + + int nb=geometries_.getNumGeometries(); + for (int i=0; i<nb; i++) { + Geometry g=geometries_.getGeometry(i); + int nbpts=g.getNumPoints(); + for (int j=0; j<nbpts; j++) { + vidx2geom.add(new int[]{i,j}); + } + } + idx2geom_=vidx2geom.toArray(new int[0][0]); + } + + private void buildEnvs() { + env_ = geometries_.getEnvelopeInternal(); + final Geometry g = geometries_.convexHull(); + if (g instanceof LinearRing) { + extern_ = (LinearRing) g; + } else if (g instanceof Polygon) { + extern_ = (LinearRing) ((Polygon) g).getExteriorRing(); + } + tester_ = new SIRtreePointInRing(extern_); + } + + private double getDistanceFromFrontier(final double _xref, final double _yref) { + tmp_.x = _xref; + tmp_.y = _yref; + return GISLib.getDistanceFromFrontier(extern_.getCoordinateSequence(), tmp_, tmpX1_, tmpX2_); + } + + public int getPtsNb() { + int nb; + + if (onlyPoints_) + nb=geometries_.getNumPoints(); + else + nb=idx2geom_.length; + + return nb; + } + + public double getPtX(final int _i) { + if (onlyPoints_) { + return ((Point)geometries_.getGeometry(_i)).getX(); + } + else { + CoordinateSequence seq= + ((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(idx2geom_[_i][0])).getCoordinateSequence(); + return seq.getX(idx2geom_[_i][1]); + } +// return geometries_.getX(_i); + } + + public double getPtY(final int _i) { + if (onlyPoints_) { + return ((Point)geometries_.getGeometry(_i)).getY(); + } + else { + CoordinateSequence seq= + ((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(idx2geom_[_i][0])).getCoordinateSequence(); + return seq.getY(idx2geom_[_i][1]); + } +// return geometries_.getY(_i); + } + + public boolean isInBuffer(final double _xToTest, final double _yToTest, final double _maxDist) { + if (env_ == null) { + buildEnvs(); + } + // le point n'appartient pas a l'enveloppe du maillage + if (!env_.contains(_xToTest, _yToTest)) { + if (GISLib.getDistance(_xToTest, _yToTest, env_) > _maxDist) { + return false; + } + + return getDistanceFromFrontier(_xToTest, _yToTest) <= _maxDist; + + } + tmp_.x = _xToTest; + tmp_.y = _yToTest; + // le point est contenu dans la forme: ok + if (tester_.isInside(tmp_)) { + return true; + } + // test distance + return getDistanceFromFrontier(_xToTest, _yToTest) <= _maxDist; + } + +} Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetGISAdapter.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetPtAdapter.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetPtAdapter.java 2008-08-14 07:32:00 UTC (rev 3798) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/InterpolationTargetPtAdapter.java 2008-08-14 09:54:18 UTC (rev 3799) @@ -1,93 +0,0 @@ -/* - * @creation 5 sept. 2005 - * @modification $Date: 2007-06-05 08:57:43 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ctulu.interpolation; - -import com.vividsolutions.jts.algorithm.SIRtreePointInRing; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.LinearRing; -import com.vividsolutions.jts.geom.Polygon; - -import org.fudaa.ctulu.gis.GISLib; -import org.fudaa.ctulu.gis.GISZoneCollectionPoint; - -public class InterpolationTargetPtAdapter implements InterpolationTarget { - - Envelope env_; - LinearRing extern_; - final GISZoneCollectionPoint pts_; - SIRtreePointInRing tester_; - - final Coordinate tmp_ = new Coordinate(); - - final Coordinate tmpX1_ = new Coordinate(); - - final Coordinate tmpX2_ = new Coordinate(); - - /** - * @param _pts - */ - public InterpolationTargetPtAdapter(final GISZoneCollectionPoint _pts) { - super(); - pts_ = _pts; - } - - private void buildEnvs() { - env_ = pts_.getEnvelopeInternal(); - final Geometry g = pts_.convexHull(); - if (g instanceof LinearRing) { - extern_ = (LinearRing) g; - } else if (g instanceof Polygon) { - extern_ = (LinearRing) ((Polygon) g).getExteriorRing(); - } - tester_ = new SIRtreePointInRing(extern_); - } - - public double getDistanceFromFrontier(final double _xref, final double _yref) { - tmp_.x = _xref; - tmp_.y = _yref; - return GISLib.getDistanceFromFrontier(extern_.getCoordinateSequence(), tmp_, tmpX1_, tmpX2_); - } - - public int getPtsNb() { - return pts_.getNumPoints(); - } - - public double getPtX(final int _i) { - return pts_.getX(_i); - } - - public double getPtY(final int _i) { - return pts_.getY(_i); - } - - public boolean isInBuffer(final double _xToTest, final double _yToTest, final double _maxDist) { - if (env_ == null) { - buildEnvs(); - } - // le point n'appartient pas a l'enveloppe du maillage - if (!env_.contains(_xToTest, _yToTest)) { - if (GISLib.getDistance(_xToTest, _yToTest, env_) > _maxDist) { - return false; - } - - return getDistanceFromFrontier(_xToTest, _yToTest) <= _maxDist; - - } - tmp_.x = _xToTest; - tmp_.y = _yToTest; - // le point est contenu dans la forme: ok - if (tester_.isInside(tmp_)) { - return true; - } - // test distance - return getDistanceFromFrontier(_xToTest, _yToTest) <= _maxDist; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <opa...@us...> - 2008-08-14 07:31:50
|
Revision: 3798 http://fudaa.svn.sourceforge.net/fudaa/?rev=3798&view=rev Author: opasteur Date: 2008-08-14 07:32:00 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Modified Paths: -------------- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml Modified: trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml =================================================================== --- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-14 07:22:02 UTC (rev 3797) +++ trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-14 07:32:00 UTC (rev 3798) @@ -108,4 +108,4 @@ </native> - </installation> \ No newline at end of file + </installation> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <opa...@us...> - 2008-08-14 07:21:53
|
Revision: 3797 http://fudaa.svn.sourceforge.net/fudaa/?rev=3797&view=rev Author: opasteur Date: 2008-08-14 07:22:02 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Modified Paths: -------------- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml Modified: trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml =================================================================== --- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-13 21:13:14 UTC (rev 3796) +++ trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-14 07:22:02 UTC (rev 3797) @@ -76,7 +76,7 @@ <description>L'application de base intégrant l'interface graphique Fudaa-Mascaret et le code de calcul Mascaret</description> <file src="../../../distrib/build/jar/mascaret/fudaa-mascaret.jar" targetdir="$INSTALL_PATH" /> <file src="../../fudaa/serveurs" targetdir="$INSTALL_PATH" /> - <file src="../../aide/src/mascaret" targetdir="$INSTALL_PATH" /aide/src/mascaret> + <file src="../../aide/src/mascaret" targetdir="$INSTALL_PATH/aide/src/mascaret" /> <file src="fudaa-mascaret.bat" targetdir="$INSTALL_PATH" /> <file src="icons" targetdir="$INSTALL_PATH" /> <parsable targetfile="$INSTALL_PATH/fudaa-mascaret.bat" /> <!-- The file will be parsed --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-13 21:13:11
|
Revision: 3796 http://fudaa.svn.sourceforge.net/fudaa/?rev=3796&view=rev Author: deniger Date: 2008-08-13 21:13:14 +0000 (Wed, 13 Aug 2008) Log Message: ----------- modif du JXtreeTable Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -157,7 +157,7 @@ return alignWithMoveAction; } - public LayerWidget getVisu_() { + public LayerWidget getVisu() { return visu_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -57,7 +57,7 @@ if(foregroundNode!=null && foregroundNode != currentNode && foregroundNode.isMovable() ) //-- ajout au premier plan du node --// - scene_.getVisu_().addChild(foregroundNode.getCreator().getWidget()); + scene_.getVisu().addChild(foregroundNode.getCreator().getWidget()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -48,7 +48,7 @@ if(currentNode.getCreator().getWidget().getState().isSelected()){ //-- ajout au premier plan du node --// - scene_.getVisu_().addChild(currentNode.getCreator().getWidget()); + scene_.getVisu().addChild(currentNode.getCreator().getWidget()); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,112 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTree; -import javax.swing.event.ChangeEvent; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeCellEditor; -import javax.swing.tree.TreePath; - -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; - -import com.memoire.bu.BuCheckBox; - -/** - * Editeur dans le tree - * - * @author Adrien Hadoux - * - */ -public class EbliCheckBoxNodeEditor extends AbstractCellEditor implements TreeCellEditor { - - -private static final long serialVersionUID = 4576652808917382435L; - -EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); - - ChangeEvent changeEvent = null; - - EbliWidgetJXTree tree; - - public EbliCheckBoxNodeEditor(EbliWidgetJXTree tree) { - this.tree = tree; - } - - public Object getCellEditorValue() { - BuCheckBox checkbox = new BuCheckBox();//renderer.getLeafRenderer().checkBox; - // EbliNodeDefault checkBoxNode = new CheckBoxNode(checkbox.getText(), - // checkbox.isSelected()); - - return checkbox.getText();// checkBoxNode; - } - - public boolean isCellEditable(EventObject event) { - boolean returnValue = false; - if (event instanceof MouseEvent) { - MouseEvent mouseEvent = (MouseEvent) event; - TreePath path = tree.getPathForLocation(mouseEvent.getX(), mouseEvent.getY()); - if (path != null) { - Object node = path.getLastPathComponent(); - if ((node != null) && (node instanceof DefaultMutableTreeNode)) { - DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node; - Object userObject = treeNode.getUserObject(); - returnValue = ((treeNode.isLeaf()) && (userObject instanceof EbliNodeDefault)); - } - } - } - return returnValue; - // return true; - } - - public Component getTreeCellEditorComponent(JTree tree, final Object value, boolean selected, boolean expanded, - boolean leaf, int row) { - - final Component editor = renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf, row, true); - - // -- recuperation de l instance defaultnode - Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - - if (userObject instanceof EbliNode && editor instanceof EbliCheckBoxPanel) { - final EbliNodeDefault node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - - // -- suppression des anciens listeners --// - // ((JCheckBox) editor).re - - // ajoute le listener au checkbox pour afficher la widget en fonction de - // son click - if(((EbliCheckBoxPanel) editor).checkBox !=null){ - - System.err.println("checkbox ok poru le node: " + node.getTitle()); - ((EbliCheckBoxPanel) editor).checkBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - - // -- on rend visible la widget en fonction de la checkbox - node.getCreator().getWidget().setVisible((((EbliCheckBoxPanel) editor).checkBox).isSelected()); - node.getCreator().getWidget().getEbliScene().refresh(); - - //-- mise a jour de l icone --// - if(((EbliCheckBoxPanel) editor).checkBox.isSelected()) - ((EbliCheckBoxPanel) editor).labelRenderer.setIcon(renderer.iconLeafEnabled); - - else - ((EbliCheckBoxPanel) editor).labelRenderer.setIcon(renderer.iconLeafDisabled); - - - } - }); - }else{ - System.err.println("checkbox FALSE poru le node: " + node.getTitle()); - } - - } - - return editor; - } -} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -0,0 +1,51 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import java.awt.Component; +import java.awt.Graphics; + +import javax.swing.Icon; +import javax.swing.tree.TreeCellRenderer; + +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.jdesktop.swingx.renderer.DefaultTreeRenderer; +import org.jdesktop.swingx.renderer.IconValue; +import org.jdesktop.swingx.renderer.StringValue; + +public class EbliWidgetCellRendererBuilder { + + private static final class WidgetIconValue implements IconValue { + public Icon getIcon(Object _value) { + EbliNodeDefault node = new EbliNodeDefault(); + Icon ic = new Icon() { + + public void paintIcon(Component _c, Graphics _g, int _x, int _y) { + _g.drawRoundRect(_x, _y, 16, 16, 3, 3); + _g.drawRoundRect(_x + 4, _y + 4, 8, 8, 3, 3); + // TODO Auto-generated method stub + + } + + public int getIconWidth() { + return 16; + } + + public int getIconHeight() { + return 16; + } + }; + System.err.println("eee " + _value.getClass()); + // TODO Auto-generated method stub + return ic; + } + } + + public static TreeCellRenderer getNodeIconCellRenderer() { + return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { + + public String getString(Object _value) { + // TODO Auto-generated method stub + return ""; + } + }); + } +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,41 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; - - -import org.jdesktop.swingx.JXTree; - -public class EbliWidgetJXTree extends JXTree implements TreeSelectionListener{ - - - // modele du tree - private EbliWidgetJXTreeModel model_; - - - - public EbliWidgetJXTree(EbliWidgetJXTreeModel newModel) { - super(newModel.getModeleTree()); - // TODO Auto-generated constructor stub - model_=newModel; - - //-- selection unique des elments du - - } - - public EbliWidgetJXTreeModel getModel_() { - return model_; - } - - public void setModel_(EbliWidgetJXTreeModel model_) { - this.model_ = model_; - } - - public void valueChanged(TreeSelectionEvent e) { - // TODO Auto-generated method stub - - } - - - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,140 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.Icon; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeListener; -import org.fudaa.ebli.visuallibrary.EbliScene; - - -/** - * Modele du Jxtree: - * contient l'ensemble des infos du tree - * les infos sont des node referencant les widgets - * @author Adrien Hadoux - * - */ -public class EbliWidgetJXTreeModel implements EbliNodeListener{ - -public static String NAMELAYER="Layer"; - -//-- noeud aui se trouve au sommet --// -public DefaultMutableTreeNode nodeRoot_; - -//-- modele du tree --// -DefaultTreeModel modeleTree; - - - - - - -//-- scene principale pour recuperer la liste des noeuds --// -//EbliScene scene; - -public EbliWidgetJXTreeModel(int numLayer/*, EbliScene scene*/) { - - // TODO Auto-generated constructor stub - - nodeRoot_=new DefaultMutableTreeNode(NAMELAYER+numLayer); - - //this.scene=scene; - - //-- construction de la hierarchie des nodes a partir des nodes de la scene --// - //constructModelNode(); - - - modeleTree=new DefaultTreeModel(nodeRoot_); -} - - -public DefaultTreeModel getModeleTree() { - return modeleTree; -} - - -public void setModeleTree(DefaultTreeModel modeleTree) { - this.modeleTree = modeleTree; -} - - -public void setNodeRoot_(DefaultMutableTreeNode nodeRoot_) { - this.nodeRoot_ = nodeRoot_; -} - - -/** - * methode qui construit la hierarchie des nodes a partir de la scene - */ -/* - public DefaultMutableTreeNode constructModelNode(){ - - //-- recuperation de la liste des nodes de scene --// - ArrayList<EbliNode> listeNodes=new ArrayList<EbliNode>(scene.getNodes()); - - for(Iterator<EbliNode> it=listeNodes.iterator();it.hasNext();){ - //-- pqr lq suite on pourra faire un test si le noeud est sous element, par exemple la legende par rapport au graphe --// - EbliNode node=it.next(); - nodeRoot_.add(new DefaultMutableTreeNode(node)); - } - return nodeRoot_; - } -*/ - -public DefaultMutableTreeNode getNodeRoot_() { - return nodeRoot_; -} - -public void addNode(EbliNode node){ -nodeRoot_.add(new DefaultMutableTreeNode(node)); - -//-- rafraichissement du modele --// -modeleTree.reload(); - -} - - -public void nodeAdded(EbliNode node) { - addNode(node); - - -} - - -public void noderemoved(EbliNode _node) { - // TODO Auto-generated method stub - - //-- reconstruction des noeuds --// - nodeRoot_.removeAllChildren(); - - //-- recuperation de la scene --// - EbliScene scene=_node.getCreator().getWidget().getEbliScene(); - - //-- recuperation de la liste des nodes de scene --// - ArrayList<EbliNode> listeNodes=new ArrayList<EbliNode>(scene.getNodes()); - - for(Iterator<EbliNode> it=listeNodes.iterator();it.hasNext();){ - //-- pqr lq suite on pourra faire un test si le noeud est sous element, par exemple la legende par rapport au graphe --// - EbliNode node=it.next(); - nodeRoot_.add(new DefaultMutableTreeNode(node)); - } - - //-- rafraichissement du modele --// - modeleTree.reload(); - -} - - - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,442 +1,435 @@ package org.fudaa.ebli.visuallibrary.tree; -import java.awt.Checkbox; -import java.awt.Image; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; +import java.util.List; import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.treetable.AbstractTreeTableModel; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableModel; +import org.jdesktop.swingx.treetable.TreeTableNode; +import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuLabel; - /** - * Model du treetable. - * contient 3 colonnes: - * colonne 1:icone - * colonne 2:nom - * colonne 3:checkbox associee + * Model du treetable. contient 3 colonnes: colonne 1:icone colonne 2:nom + * colonne 3:checkbox associee * * @author Adrien Hadoux - * + * */ -public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener{ +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener { - //-- le nombre de colonnes est statique --// - final static int NBCOLUMN=3; - - /** - * titres des colonnes. - */ - public String[] title={"Icon","Nom","V" }; - - /** - * Icones associees au treemodeltable. - */ - public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_cacher"); - public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); - public Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); - - /** - * composant graphique utiliser ppuor afficher l etat masquer/visible du widget . - */ - public BuCheckBox chexBox_=new BuCheckBox(); - - public BuLabel labelIcon=new BuLabel(); - - public BuLabel labelTexte=new BuLabel(); - - /** - * scene dont le model est associe - */ - public EbliScene scene_; - - /** - * numero du layer - */ - int numLayer; - - JXTreeTable tree_; - - - public JXTreeTable getTree_() { - return tree_; - } + // -- le nombre de colonnes est statique --// + final static int NBCOLUMN = 3; - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; - } + /** + * titres des colonnes. + */ + public String[] title = { "", EbliLib.getS("Nom"), "V" }; + /** + * Icones associees au treemodeltable. + */ + // public Icon iconLeafEnabled = + // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + // public Icon iconLeafDisabled = + // CtuluResource.CTULU.getIcon("crystal22_cacher"); + // public Icon iconSubDirectorie = CtuluResource.CTULU.getIcon("reouvrir_26"); + // public Icon iconRoot = CtuluResource.CTULU.getIcon("maison_32"); + // + // /** + // * composant graphique utiliser ppuor afficher l etat masquer/visible du + // * widget . + // */ + // public BuCheckBox chexBox_ = new BuCheckBox(); + // + // public BuLabel labelIcon = new BuLabel(); + // + // public BuLabel labelTexte = new BuLabel(); + /** + * scene dont le model est associe + */ + // public EbliScene scene_; + /** + * numero du layer + */ + // int numLayer; + // FIXME le model n'a pas a connaitre le JXTree + // JXTreeTable tree_; + // + // public JXTreeTable getTree() { + // return tree_; + // } + // + // public void setTree_(JXTreeTable tree) { + // this.tree_ = tree; + // } + // -- noeud aui se trouve au sommet --// + // FIXME deja donne par getNodeRoot + // DefaultMutableTreeTableNode nodeRoot_; + /** + * constructeur. + * + * @param numLayer + * @param scene_ + */ + public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot/* + * , + * Widget + * parent + */) { + super(nodeRoot); + // this.numLayer = numLayer; + // this.scene_ = scene_; - //-- noeud aui se trouve au sommet --// - DefaultMutableTreeTableNode nodeRoot_; - - /** - * constructeur. - * @param numLayer - * @param scene_ - */ - public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot,int numLayer, EbliScene scene_) { - super(nodeRoot); - this.numLayer = numLayer; - this.scene_ = scene_; - - //--initialisation du node root --// - nodeRoot_=nodeRoot;//new DefaultMutableTreeTableNode("Layer "+numLayer); - - - } + // --initialisation du node root --// + // nodeRoot_ = nodeRoot;// new + // DefaultMutableTreeTableNode("Layer "+numLayer); - public Class<?> getColumnClass(int arg0) { - // TODO Auto-generated method stub - switch(arg0){ - case 0: return Icon.class; - case 1: return String.class; - case 2: return Boolean.class; - default: return null; - } - - } + } - public int getColumnCount() { - // TODO Auto-generated method stub - return NBCOLUMN; - } + public void nodeAdded(EbliNode _node) { + refresh(); + } - public String getColumnName(int arg0) { - // TODO Auto-generated method stub - if(arg0<NBCOLUMN) - return title[arg0]; - else return ""; - } + public void noderemoved(EbliNode _node) { + refresh(); + } - public int getHierarchicalColumn() { - // TODO Auto-generated method stub - return 0; - } + private void refresh() { + EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); - /** - * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. - */ - public Object getValueAt(Object arg0, int column) { - - - //-- recuperation du mutableTreenode qui contient le node de la scene --// - DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)arg0; + Enumeration<? extends MutableTreeTableNode> children = root.children(); + int childCount = root.getChildCount(); + List<TreeTableNode> res = new ArrayList(childCount); + for (int i = 0; i < childCount; i++) { + res.add(root.getChildAt(i)); + } + for (TreeTableNode treeTableNode : res) { + root.remove((MutableTreeTableNode) treeTableNode); + } + EbliWidgetTreeTableNode.fillRoot(root); + modelSupport.fireNewRoot(); + } - //-- test si il s agit du node root --// - if(nodeTree == nodeRoot_) - { - if(column==0){ - labelIcon.setIcon(iconRoot); - return iconRoot;//labelIcon; - } - else - if(column==1){ - - return "Layer "+numLayer; - } - else{ - // recherche si au moins un sous fils est affiche sinon retourne false - boolean auMoinsUnSousElementAffiche=false; - - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - while(liste.hasMoreElements() && !auMoinsUnSousElementAffiche){ - - //System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); - DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); - - - //-- si il existe au moins un sous fils qi est affiche alors on est ok --// - if(((Boolean)getValueAt(modif, 2)).booleanValue()){ - auMoinsUnSousElementAffiche=true; - } - - } - - return auMoinsUnSousElementAffiche; - } - } - //--recuperation du node de la scene --// - EbliNode node= (EbliNode) nodeTree.getUserObject(); - + public Class<?> getColumnClass(int arg0) { + // TODO Auto-generated method stub + switch (arg0) { + case 0: + return Icon.class; + case 1: + return String.class; + case 2: + return Boolean.class; + default: + return null; + } - - //-- cas 1 recuperation de l icone --// - if(column==0){ - if(node.hasWidget() && node.getCreator().getWidget().isVisible()) - labelIcon.setIcon(iconLeafEnabled); - else - labelIcon.setIcon(iconLeafDisabled); - - return iconLeafEnabled;//labelIcon; - - }else - //-- recuperation du title --// - if(column==1){ - //labelTexte.setText(node.getTitle()); - return node.getTitle();//labelTexte; - - }else - //-- recuperation de la checkbox --// - if(column==2){ - boolean coche; - System.err.println("je suis la checbox: wodget selectionee:"+node.getCreator().getWidget().isVisible()); - if(node.hasWidget() && node.getCreator().getWidget().isVisible()) - //coche la checkbox - coche=true;//chexBox_.setSelected(true); - else - coche=false;//chexBox_.setSelected(false); - - return coche;//chexBox_; - } - - - - - return null; - } + } - /** - * seul le texte et la checkbox sont editables - */ - public boolean isCellEditable(Object arg0, int column) { - // TODO Auto-generated method stub + // + // public int getColumnCount() { + // return NBCOLUMN; + // } + // + public String getColumnName(int arg0) { + if (arg0 < NBCOLUMN) + return title[arg0]; + else + return ""; + } + // + // /** + // * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. + // */ + // public Object getValueAt(Object arg0, int column) { + // + // // -- recuperation du mutableTreenode qui contient le node de la scene --// + // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) arg0; + // return nodeTree.getUserObject(); + // // + // // // -- test si il s agit du node root --// + // // if (nodeTree == nodeRoot_) { + // // if (column == 0) { + // // labelIcon.setIcon(iconRoot); + // // return iconRoot;// labelIcon; + // // } else if (column == 1) { + // // + // // return "Layer " + numLayer; + // // } else { + // // // recherche si au moins un sous fils est affiche sinon retourne false + // // boolean auMoinsUnSousElementAffiche = false; + // // + // // Enumeration<MutableTreeTableNode> liste = + // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + // // while (liste.hasMoreElements() && !auMoinsUnSousElementAffiche) { + // // + // // // System.err.println( + // // // "je suis setValueAt(Object arg0, int column et value) )"+box); + // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) + // // liste.nextElement(); + // // + // // // -- si il existe au moins un sous fils qi est affiche alors on est + // // // ok --// + // // if (((Boolean) getValueAt(modif, 2)).booleanValue()) { + // // auMoinsUnSousElementAffiche = true; + // // } + // // + // // } + // // + // // return auMoinsUnSousElementAffiche; + // // } + // // } + // // // --recuperation du node de la scene --// + // // EbliNode node = (EbliNode) nodeTree.getUserObject(); + // // + // // // -- cas 1 recuperation de l icone --// + // // if (column == 0) { + // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) + // // labelIcon.setIcon(iconLeafEnabled); + // // else + // // labelIcon.setIcon(iconLeafDisabled); + // // + // // return iconLeafEnabled;// labelIcon; + // // + // // } else + // // // -- recuperation du title --// + // // if (column == 1) { + // // // labelTexte.setText(node.getTitle()); + // // return node.getTitle();// labelTexte; + // // + // // } else + // // // -- recuperation de la checkbox --// + // // if (column == 2) { + // // boolean coche; + // // System.err.println("je suis la checbox: wodget selectionee:" + + // // node.getCreator().getWidget().isVisible()); + // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) + // // // coche la checkbox + // // coche = true;// chexBox_.setSelected(true); + // // else + // // coche = false;// chexBox_.setSelected(false); + // // + // // return coche;// chexBox_; + // // } + // // + // // return null; + // } + // + // /** + // * seul le texte et la checkbox sont editables + // */ + // public boolean isCellEditable(Object arg0, int column) { + // // TODO Auto-generated method stub + // + // if (column == 0 || column >= NBCOLUMN) + // return false; + // else + // return true; + // } + // + // /** + // * placer une valeur + // */ + // + // public void setValueAt(Object value, Object nodeT, int column) { + // // TODO Auto-generated method stub + // + // // -- recuperation du mutableTreenode qui contient le node de la scene --// + // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) nodeT; + // + // // // -- on essaie de masquer tous les sous repertoires --// + // // if (nodeTree == nodeRoot_ && column == 2) { + // // + // // // si on coche sur la check, on fait tout disparaitre + // // // --recupeation de la checkBox --// + // // boolean box = ((Boolean) value).booleanValue(); + // // Enumeration<MutableTreeTableNode> liste = + // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + // // while (liste.hasMoreElements()) { + // // + ////System.err.println("je suis setValueAt(Object arg0, int column et value) )" + // // + box); + // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) + // // liste.nextElement(); + // // + // // //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible( + // // // box); + // // + // // // -- envoi du signal a tous les noeuds fils: reccurence sur le checkbox + // // // --// + // // setValueAt(value, modif, 2); + // // + // // } + // // + // // } + // // // -- si node tree = ROOT on arrete les frais --// + // // if (!nodeTree.isLeaf()) + // // return; + // // + // // // --recuperation du node de la scene --// + // // EbliNode node = (EbliNode) nodeTree.getUserObject(); + // // + // // // -- recuperation de la value en fonction de la colonne --// + // // if (column == 1) { + // // // --recuperation du nouveau nom --// + // // String newTitle = ((/* BuLabel */String) value);// .getText(); + // // node.setTitle(newTitle); + // // } else { + // // // --recupeation de la checkBox --// + // // boolean box = ((Boolean) value).booleanValue(); + // // + // // // -- affichage de la widget --// + // // node.getCreator().getWidget().setVisible(box); + // // + // // // -- rafraichissement de la scene --// + // // scene_.refresh(); + // // } + // // + // // // rafraichissement de l arbre + // // reload(); + // // + // // setResizeColumn(); + // + // } + // + // /** + // * Raffraichissement maison du jxtreetable + // */ + // public void reload() { + // + // this.modelSupport.fireTreeStructureChanged(new + // TreePath(getPathToRoot(getRoot()))); + // } + // + // /** + // * methode qui redimensionne les colonens du table. + // */ + // // public void setResizeColumn() { + // // if (tree_ == null) + // // return; + // // tree_.getColumn(0).setPreferredWidth(60); + // // tree_.getColumn(1).setPreferredWidth(50); + // // tree_.getColumn(2).setPreferredWidth(5); + // // + // // tree_.getColumn(0).setResizable(false); + // // tree_.getColumn(1).setResizable(false); + // // tree_.getColumn(2).setResizable(false); + // // tree_.validate(); + // // } + // /* + // * public void addTreeModelListener(TreeModelListener l) { // TODO + // * Auto-generated method stub + // * + // * } + // */ + // /* + // * public Object getChild(Object parent, int index) { // TODO Auto-generated + // * method stub DefaultMutableTreeTableNode nodeParent= + // * (DefaultMutableTreeTableNode) parent; + // * + // * return nodeParent.getChildAt(index); + // * + // * } + // * + // * public int getChildCount(Object parent) { // TODO Auto-generated method + // * stub DefaultMutableTreeTableNode nodeParent= + // (DefaultMutableTreeTableNode) + // * parent; return nodeParent.getChildCount(); } + // * + // * public int getIndexOfChild(Object parent, Object child) { // TODO + // * Auto-generated method stub DefaultMutableTreeTableNode nodeParent= + // * (DefaultMutableTreeTableNode) parent; + // * + // * return nodeParent.getIndex((TreeNode) child); } / public Object getRoot() + // { + // * // TODO Auto-generated method stub return nodeRoot_; } + // * + // * public boolean isLeaf(Object _node) { // TODO Auto-generated method stub + // * DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; + // * + // * return node.isLeaf(); } + // * + // * public void removeTreeModelListener(TreeModelListener l) { // TODO + // * Auto-generated method stub + // * + // * } + // * + // * public void valueForPathChanged(TreePath path, Object newValue) { // TODO + // * Auto-generated method stubSystem.err.println( + // * "je suis valueForPathChanged(TreePath path, Object newValue)"); } + // */ + // // -- utilisation de l interface node added + // public void nodeAdded(EbliNode node) { + // // TODO Auto-generated method stub + // + // System.err.println("je suis nodeAdded(EbliNode node)"); + // // -- ajout du nouveau node --// + // + // DefaultMutableTreeTableNode newNode = new + // DefaultMutableTreeTableNode(node); + // // nodeRoot_.add(newNode); + // + // // -- rafraichissement du modele --// + // + // // -- ajout du node dans le tree en fin de liste--// + // // insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); + // + // // -- ajout du node dans le tree en debut de liste--// + // insertNodeInto(newNode, (MutableTreeTableNode) getRoot(), 0); + // + // // setResizeColumn(); + // // scene_.refresh(); + // + // } + // + // /** + // * Methode appelee lorsau elel recoit un signal de suppression de node de la + // * scene. a pour effet de chercher le treetableNode associee et de le + // * supprimer du tree ainsi que mettre a jour l arbre. + // */ + // public void noderemoved(EbliNode node) { + // + // DefaultMutableTreeTableNode Asuppr = null; + // // -- recuperation des nodes --// + // Enumeration<MutableTreeTableNode> liste = + // (Enumeration<MutableTreeTableNode>) getRoot().children(); + // + // while (liste.hasMoreElements() && Asuppr == null) { + // + // DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) + // liste.nextElement(); + // + // // recuperation du node + // EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); + // + // if (nodeSuspect != null && nodeSuspect == node) + // Asuppr = suspect; + // + // } + // + // // -- suppression du node de ses parents + // if (Asuppr != null) + // removeNodeFromParent(Asuppr); + // + // // -- rafraichissement du modele --// + // // modeleTree.reload(); + // reload(); + // + // // setResizeColumn(); + // } - if(column==0 || column>=NBCOLUMN) - return false; - else - return true; - } - - /** - * placer une valeur - */ - - public void setValueAt(Object value, Object nodeT, int column) { - // TODO Auto-generated method stub - - //-- recuperation du mutableTreenode qui contient le node de la scene --// - DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)nodeT; - - - //-- on essaie de masquer tous les sous repertoires --// - if(nodeTree==nodeRoot_ && column==2){ - - // si on coche sur la check, on fait tout disparaitre - //--recupeation de la checkBox --// - boolean box= ((Boolean) value).booleanValue(); - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - while(liste.hasMoreElements()){ - - System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); - DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); - - - //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible(box); - - //-- envoi du signal a tous les noeuds fils: reccurence sur le checkbox --// - setValueAt(value, modif, 2); - - } - - - - - - } - //-- si node tree = ROOT on arrete les frais --// - if(!nodeTree.isLeaf()) - return; - - //--recuperation du node de la scene --// - EbliNode node= (EbliNode) nodeTree.getUserObject(); - - - //-- recuperation de la value en fonction de la colonne --// - if(column==1){ - //--recuperation du nouveau nom --// - String newTitle=((/*BuLabel*/String) value);//.getText(); - node.setTitle(newTitle); - }else{ - //--recupeation de la checkBox --// - boolean box= ((Boolean) value).booleanValue(); - - - //-- affichage de la widget --// - node.getCreator().getWidget().setVisible(box); - - //-- rafraichissement de la scene --// - scene_.refresh(); - } - - //rafraichissement de l arbre - reload(); - - setResizeColumn(); - - } - - - - /** - * Raffraichissement maison du jxtreetable - */ - public void reload(){ - - this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(nodeRoot_))); - } - - /** - * methode qui redimensionne les colonens du table. - */ - public void setResizeColumn(){ - if(tree_==null) - return; - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - } - - - /*public void addTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - -*/ - /* - public Object getChild(Object parent, int index) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - - return nodeParent.getChildAt(index); - - } - - public int getChildCount(Object parent) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - return nodeParent.getChildCount(); - } - - public int getIndexOfChild(Object parent, Object child) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - - return nodeParent.getIndex((TreeNode) child); - } -/* - public Object getRoot() { - // TODO Auto-generated method stub - return nodeRoot_; - } - - public boolean isLeaf(Object _node) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; - - return node.isLeaf(); - } - - public void removeTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - - public void valueForPathChanged(TreePath path, Object newValue) { - // TODO Auto-generated method stub - System.err.println("je suis valueForPathChanged(TreePath path, Object newValue)"); - } -*/ - //-- utilisation de l interface node added - - public void nodeAdded(EbliNode node) { - // TODO Auto-generated method stub - - System.err.println("je suis nodeAdded(EbliNode node)"); - //-- ajout du nouveau node --// - - DefaultMutableTreeTableNode newNode=new DefaultMutableTreeTableNode(node); - //nodeRoot_.add(newNode); - - //-- rafraichissement du modele --// - - //-- ajout du node dans le tree en fin de liste--// - //insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); - - //-- ajout du node dans le tree en debut de liste--// - insertNodeInto(newNode,nodeRoot_, 0); - - - //setResizeColumn(); - //scene_.refresh(); - - } - - - /** - * Methode appelee lorsau elel recoit un signal de suppression de node de la scene. - * a pour effet de chercher le treetableNode associee et de le supprimer du tree ainsi que mettre a jour l arbre. - */ - public void noderemoved(EbliNode node) { - - - DefaultMutableTreeTableNode Asuppr=null; - //-- recuperation des nodes --// - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - - - while(liste.hasMoreElements() && Asuppr==null){ - - - DefaultMutableTreeTableNode suspect= (DefaultMutableTreeTableNode) liste.nextElement(); - - //recuperation du node - EbliNode nodeSuspect=(EbliNode) suspect.getUserObject(); - - if(nodeSuspect!=null && nodeSuspect == node) - Asuppr=suspect; - - - } - - //-- suppression du node de ses parents - if(Asuppr!=null) - removeNodeFromParent(Asuppr); - - - - //-- rafraichissement du modele --// - //modeleTree.reload(); - reload(); - - setResizeColumn(); - } - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -0,0 +1,84 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.netbeans.api.visual.model.ObjectScene; +import org.netbeans.api.visual.widget.Widget; + +public class EbliWidgetTreeTableNode extends DefaultMutableTreeTableNode { + + public static EbliWidgetTreeTableNode build(EbliScene _sc) { + Widget w = _sc.getVisu(); + EbliWidgetTreeTableNode root = new EbliWidgetTreeTableNode(w); + addChilds(_sc, w, root, null); + return root; + } + + static void fillRoot(EbliWidgetTreeTableNode _root) { + Widget w = (Widget) _root.getUserObject(); + addChilds((ObjectScene) w.getScene(), w, _root, null); + } + + static void addChilds(ObjectScene _sc, Widget w, EbliWidgetTreeTableNode parent, EbliNode parentNode) { + for (Widget child : w.getChildren()) { + EbliNode n = (EbliNode) _sc.findObject(child); + if (n != null && n != parentNode) { + EbliWidgetTreeTableNode treeNode = new EbliWidgetTreeTableNode(n); + parent.add(treeNode); + addChilds(_sc, child, treeNode, n); + } + } + } + + // public Icon iconLeafEnabled = + // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + boolean root; + + EbliWidgetTreeTableNode(Widget w) { + super(w); + root = true; + + } + + EbliWidgetTreeTableNode(EbliNode _userObject) { + super(_userObject, true); + + } + + public int getColumnCount() { + return 3; + } + + public Object getValueAt(int _column) { + System.err.println("get at" + _column); + if (root) + return "root"; + if (_column == 0) { + return getUserObject(); + } + if (_column == 1) { + return ((EbliNodeDefault) getUserObject()).getTitle(); + } + return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getCreator().getWidget().isVisible()); + } + + @Override + public boolean isEditable(int _column) { + return _column > 0; + } + + @Override + public void setValueAt(Object _value, int _column) { + if (!root) { + if (_column == 1) + ((EbliNode) getUserObject()).setTitle((String) _value); + else if (_column == 2) { + ((EbliNode) getUserObject()).getCreator().getWidget().setVisible(((Boolean) _value).booleanValue()); + ((EbliNode) getUserObject()).getCreator().getWidget().getEbliScene().refresh(); + } + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -44,6 +44,7 @@ import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorDblFleche; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorFleche; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; @@ -55,10 +56,10 @@ import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxTreeRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetCellRendererBuilder; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; +import org.jdesktop.swingx.JXTreeTable; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.model.ObjectState; @@ -156,18 +157,15 @@ // -- construction du jtree // etape 1 construction du model - EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1/* ,scene */); + // EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1/* ,scene */); // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - scene.addEbliNodeListener(model); + // scene.addEbliNodeListener(model); // etape 3 creation du jtree - EbliWidgetJXTree tree = new EbliWidgetJXTree(model); - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); - tree.setCellRenderer(renderer); - tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); - tree.setEditable(true); + // tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); + // tree.setEditable(true); // -- creation d un noeud Graphe --// final EbliNodeDefault nodeG = new EbliNodeDefault(); @@ -240,7 +238,9 @@ nodeFleche.setPreferedSize(new Dimension(100, 100)); nodeFleche.setPreferedLocation(new Point(250, 525)); scene.addNode(nodeFleche); - + EbliWidget widget = nodeFleche.getCreator().getWidget(); + widget.removeFromParent(); + node.getCreator().getWidget().addChild(widget); // node.getCreator().getWidget().setState(state) // if(node.getCreator().getWidget().) @@ -282,7 +282,19 @@ f.setSize(new Dimension(1024, 768)); final BuPanel p = new BuPanel(); p.setLayout(new BuBorderLayout()); - p.add(tree, BuBorderLayout.WEST); + EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene)); + scene.addEbliNodeListener(tree); + // FIXME: mettre tout cela dans la construction de EbliWidgetJXTree + // EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + // tree.setCellRenderer(renderer); + //tree.setCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer + // ()); + // tree.getColumn(0).setPreferredWidth(60); + // tree.getColumn(1).setPreferredWidth(50); + // tree.getColumn(2).setPreferredWidth(5); + JXTreeTable view = new JXTreeTable(tree); + view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); + p.add(new JScrollPane(view), BuBorderLayout.WEST); g.setPreferredSize(new Dimension(200, 300)); g.setSize(g.getPreferredSize()); final JTree t = new JTree((EGGrapheTreeModel) g.getModel()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,12 +1,14 @@ package org.fudaa.fudaa.tr.post; -import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.ListSelectionModel; + import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -20,390 +22,373 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.HighlighterFactory; -import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import javax.swing.Box; -import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.JTree; -import javax.swing.ListSelectionModel; - import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; -import com.memoire.bu.BuScrollPane; + /** - * InternalFrame qui contient la scene EbliScene. + * InternalFrame qui contient la scene EbliScene. + * * @author Adrien Hadoux - * + * */ public class TrPostLayoutFille extends BuInternalFrame { - /** + /** * */ - private static final long serialVersionUID = -2769884291563880931L; + private static final long serialVersionUID = -2769884291563880931L; - /** - * scene de l internalFrame. - */ - final private EbliScene scene_; + /** + * scene de l internalFrame. + */ + final private EbliScene scene_; - /** - * Calque principal associ\xE9 a la vue layout. - */ - private ZEbliCalquesPanel calquePrincipal; + /** + * Calque principal associ\xE9 a la vue layout. + */ + private ZEbliCalquesPanel calquePrincipal; + /** + * Model du Jxtree associe. + */ + // private EbliWidgetJXTreeModel modelTree_; + /** + * Tree associe a la scene. + */ + private JXTreeTable tree_; + public int indiceLayer = 1; + /** + * Constructeur de la fenetre. + */ + public TrPostLayoutFille() { + super(); + // TODO Auto-generated constructor stub + setTitle(TrResource.getS("vue 2D")); + // creation de la scene EBLI + scene_ = new EbliScene(); - /** - * Model du Jxtree associe. - */ - private EbliWidgetJXTreeModel modelTree_; + // -- construction du jtree + /* + * // etape 1 construction du model EbliWidgetJXTreeModel model = new + * EbliWidgetJXTreeModel(1); + * + * // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene + * scene_.addEbliNodeListener(model); + * + * // etape 3 creation du jxtree tree_ = new EbliWidgetJXTree(model); + * + * //renderer du jxtree EbliJXTreeTableCellRenderer renderer = new + * EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); + * tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); + * tree_.setEditable(true); //tree_.setPreferredSize(new + * Dimension(300,600)); + */ - /** - * Tree associe a la scene. - */ - private JXTreeTable tree_; + // -- construction du JXTABLETREE --// + // creation du node root--// + // DefaultMutableTreeTableNode nodeRoot=new + // DefaultMutableTreeTableNode("Layer "+indiceLayer); + // -- creation du tablemodel --// + EbliWidgetJXTreeTableModel modeltable = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene_)); + // -- ajout au listener de la scene--// + scene_.addEbliNodeListener(modeltable); - public int indiceLayer=1; + // -- creation du JXtabletree --// + tree_ = new JXTreeTable(modeltable); + // -- ajout du tree au model pour les dimensionnements --// + // modeltable.setTree_(tree_); + // --vision du noeud root --// + tree_.setRootVisible(false); - /** - * Constructeur de la fenetre. - */ - public TrPostLayoutFille() { - super(); - // TODO Auto-generated constructor stub - setTitle(TrResource.getS("vue 2D")); - // creation de la scene EBLI - scene_ = new EbliScene(); + // --ajout du renderer pour les images-// + tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - // -- construction du jtree -/* - // etape 1 construction du model - EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1); + // -- ouvert par defaut --// + tree_.expandAll(); - // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - scene_.addEbliNodeListener(model); + // -- ajout des highlighters customs --// + tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); + tree_.setShowsRootHandles(true); + // -- selection unique --// + tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tree_.setEditable(true); - // etape 3 creation du jxtree - tree_ = new EbliWidgetJXTree(model); + // --dimensions des colonnes --// + tree_.getColumn(0).setPreferredWidth(60); + tree_.getColumn(1).setPreferredWidth(50); + tree_.getColumn(2).setPreferredWidth(5); + // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se + // redimensionnents + tree_.getColumn(0).setResizable(false); + tree_.getColumn(1).setResizable(false); + tree_.getColumn(2).setResizable(false); + tree_.validate(); - //renderer du jxtree - EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); - tree_.setCellRenderer(renderer); - tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); - tree_.setEditable(true); - //tree_.setPreferredSize(new Dimension(300,600)); -*/ - - // -- construction du JXTABLETREE --// - - //creation du node root--// - DefaultMutableTreeTableNode nodeRoot=new DefaultMutableTreeTableNode("Layer "+indiceLayer); - //-- creation du tablemodel --// - EbliWidgetJXTreeTableModel modeltable= new EbliWidgetJXTreeTableModel(nodeRoot,indiceLayer,scene_); - - //-- ajout au listener de la scene--// - scene_.addEbliNodeListener(modeltable); - - //-- creation du JXtabletree --// - tree_=new JXTreeTable(modeltable); - - //-- ajout du tree au model pour les dimensionnements --// - modeltable.setTree_(tree_); - - //--vision du noeud root --// - tree_.setRootVisible(true); - - //--ajout du renderer pour les images-// - tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - - //-- ouvert par defaut --// - tree_.expandAll(); - - //-- ajout des highlighters customs --// - tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); - tree_.setShowsRootHandles(true); - //-- selection unique --// - tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tree_.setEditable(true); - - //--dimensions des colonnes --// - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - //FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se redimensionnents - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - - //-- initialisation de la frame --// - init(); - } + // -- initialisation de la frame --// + init(); + } + public ZEbliCalquesPanel getCalquePrincipal() { + return calquePrincipal; + } - public ZEbliCalquesPanel getCalquePrincipal() { - return calquePrincipal; - } + public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { + this.calquePrincipal = calquePrincipal; + } - public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { - this.calquePrincipal = calquePrincipal; - } + public EbliScene getScene_() { + return scene_; + } - public EbliScene getScene_() { - return scene_; - } +// public EbliWidgetJXTreeModel getModelTree_() { +// return modelTree_; +// } +// +// public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { +// this.modelTree_ = modelTree_; +// } + public JXTreeTable getTree_() { + return tree_; + } - public EbliWidgetJXTreeModel getModelTree_() { - return modelTree_; - } + public void setTree_(JXTreeTable tree_) { + this.tree_ = tree_; + } - public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { - this.modelTree_ = modelTree_; - } + /** + * methode appelee pour l init de la construction de la internalframe + */ + public void init() { - public JXTreeTable getTree_() { - return tree_; - } + // -- creation du conteneur de base qui contient tout --// + BuPanel content = new BuPanel(new BuBorderLayout()); - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; - } + // -- creation de la box sur le cote qui contient le tree et la sattelite + // view --// + // Box contentEast=Box.createVerticalBox(); - /** - * methode appelee pour l init de la construction de la internalframe - */ - public void init(){ + this.add(content); - //-- creation du conteneur de base qui contient tout --// - BuPanel content =new BuPanel(new BuBorderLayout()); + this.setLayout(new BuBorderLayout()); - //-- creation de la box sur le cote qui contient le tree et la sattelite view --// - //Box contentEast=Box.createVerticalBox(); + // ajout de la scene au centre + content.add(new JScrollPane(scene_.createView()), BuBorderLayout.CENTER); + // FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux + // ajout du jtree sur la droite + getTree_().setPreferredSize(new Dimension(200, 500)); + // contentEast.add(new BuScrollPane(getTree_())); - this.add(content); + // -- ajout de la vue sattelite dans la box --// + // contentEast.add(getScene_().createSatelliteView()); - this.setLayout(new BuBorderLayout()); + // -- ajout de la box dans le content --// + // content.add(contentEast,BuBorderLayout.EAST); + // content.doLayout(); + // this.pack(); + this.setVisible(true); + // -- construction de la barre des commandes de base --// + content.add(buildToolBar(), BuBorderLayout.NORTH); - //ajout de la scene au centre - content.add(new JScrollPane(scene_.createView()),BuBorderLayout.CENTER); + } - - //FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux - //ajout du jtree sur la droite - getTree_().setPreferredSize(new Dimension(200,500)); - //contentEast.add(new BuScrollPane(getTree_())); + /** + * Methode generique d ajout d un node widget a la scene. + * + * @param node + */ + public void addNode(EbliNode node) { + getScene_().addNode(node); - //-- ajout de la vue sattelite dans la box --// - //contentEast.add(getScene_().createSatelliteView()); + // -- rafraichissement de la scene pour eviter les plantages --// + getScene_().refresh(); + } - //-- ajout de la box dans le content --// - //content.add(contentEast,BuBorderLayout.EAST); + /** + * Methode specialisee dans l ajout d un ndoe de type calque a la scene. + * + * @param title + * de la widget + * @param preferredLocation + * de la widget + * @param preferedDimension + * de la widget + * @param calque + * contenu de la widget + * @return le node cree + */ + public EbliNode addCalque(String title, Point preferredLocation, Dimension preferedDimension, ZEbliCalquesPanel calque) { - // content.doLayout(); - //this.pack(); - this.setVisible(true); + // -- enregistrement du calque principal --// + if (calquePrincipal == null) + // -- alors le calque recupere sera considere comem le calque principal + // --// + setCalquePrincipal(calque); + // on ajoute le calque sous forme d'un node - //-- construction de la barre des commandes de base --// - content.add(buildToolBar(),BuBorderLayout.NORTH); + // construction du node correspondant + final EbliNode nodeCalque = new EbliNodeDefault(); + nodeCalque.setTitle(title); + nodeCalque.setPreferedSize(preferedDimension);// new Dimension(400, 200) + nodeCalque.setPreferedLocation(preferredLocation);// new Point(250, 170) + nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); + ... [truncated message content] |
From: <had...@us...> - 2008-08-13 16:14:12
|
Revision: 3795 http://fudaa.svn.sourceforge.net/fudaa/?rev=3795&view=rev Author: hadouxad Date: 2008-08-13 16:14:17 +0000 (Wed, 13 Aug 2008) Log Message: ----------- - creation du jxtreetablemodel avec 3 colonnes (icon, nom, checkbox) - optimisation d utilisation des objets graphiques avec les renderer (EbliJXTreeTableCellRenderer pour l icone) - gestion des maj en cas d'ajouts suppression d objets - edition du titre des eblinode directement sur le tree - si on clique sur le repertoire courant: ca masque tout les noeuds fils et inversement - integration du tree a droite dans l implementation - surcharge de la methode addFille de trpostProjet, je verrais avec toi comment executer les graphes. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.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/TrPostProjet.java 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-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -6,14 +6,18 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.EnumSet; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluPopupListener; @@ -26,6 +30,7 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -51,6 +56,8 @@ private EGGraphe graphe; private EbliNodeDefault nodeLegende=null; + + public EGGraphe getGraphe() { return graphe; } @@ -65,6 +72,7 @@ setGraphe(_graphe); + //-- creation de l action pour editor --// WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); @@ -190,6 +198,9 @@ return panelGraphe; } + + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -21,15 +21,20 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxTreeRenderer; +import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import javax.swing.Box; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.JTree; +import javax.swing.ListSelectionModel; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; @@ -69,13 +74,13 @@ /** * Tree associe a la scene. */ - private EbliWidgetJXTree tree_; + private JXTreeTable tree_; + public int indiceLayer=1; - /** * Constructeur de la fenetre. */ @@ -87,7 +92,7 @@ scene_ = new EbliScene(); // -- construction du jtree - +/* // etape 1 construction du model EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1); @@ -98,11 +103,55 @@ tree_ = new EbliWidgetJXTree(model); //renderer du jxtree - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); tree_.setEditable(true); //tree_.setPreferredSize(new Dimension(300,600)); +*/ + + // -- construction du JXTABLETREE --// + + //creation du node root--// + DefaultMutableTreeTableNode nodeRoot=new DefaultMutableTreeTableNode("Layer "+indiceLayer); + //-- creation du tablemodel --// + EbliWidgetJXTreeTableModel modeltable= new EbliWidgetJXTreeTableModel(nodeRoot,indiceLayer,scene_); + + //-- ajout au listener de la scene--// + scene_.addEbliNodeListener(modeltable); + + //-- creation du JXtabletree --// + tree_=new JXTreeTable(modeltable); + + //-- ajout du tree au model pour les dimensionnements --// + modeltable.setTree_(tree_); + + //--vision du noeud root --// + tree_.setRootVisible(true); + + //--ajout du renderer pour les images-// + tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); + + //-- ouvert par defaut --// + tree_.expandAll(); + + //-- ajout des highlighters customs --// + tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); + tree_.setShowsRootHandles(true); + //-- selection unique --// + tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tree_.setEditable(true); + + //--dimensions des colonnes --// + tree_.getColumn(0).setPreferredWidth(60); + tree_.getColumn(1).setPreferredWidth(50); + tree_.getColumn(2).setPreferredWidth(5); + //FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se redimensionnents + tree_.getColumn(0).setResizable(false); + tree_.getColumn(1).setResizable(false); + tree_.getColumn(2).setResizable(false); + tree_.validate(); + //-- initialisation de la frame --// init(); } @@ -129,11 +178,11 @@ this.modelTree_ = modelTree_; } - public EbliWidgetJXTree getTree_() { + public JXTreeTable getTree_() { return tree_; } - public void setTree_(EbliWidgetJXTree tree_) { + public void setTree_(JXTreeTable tree_) { this.tree_ = tree_; } @@ -146,7 +195,7 @@ BuPanel content =new BuPanel(new BuBorderLayout()); //-- creation de la box sur le cote qui contient le tree et la sattelite view --// - Box contentEast=Box.createVerticalBox(); + //Box contentEast=Box.createVerticalBox(); this.add(content); @@ -162,13 +211,13 @@ //FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux //ajout du jtree sur la droite getTree_().setPreferredSize(new Dimension(200,500)); - contentEast.add(new BuScrollPane(getTree_())); + //contentEast.add(new BuScrollPane(getTree_())); //-- ajout de la vue sattelite dans la box --// - contentEast.add(getScene_().createSatelliteView()); + //contentEast.add(getScene_().createSatelliteView()); //-- ajout de la box dans le content --// - content.add(contentEast,BuBorderLayout.EAST); + //content.add(contentEast,BuBorderLayout.EAST); // content.doLayout(); //this.pack(); 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-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -18,6 +18,7 @@ import java.util.Observer; import java.util.Set; +import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JTable; @@ -613,8 +614,28 @@ //filleLayout_.setTitle(s_.getTitle()); filleLayout_.setClosable(true); filleLayout_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - + //-- agrandissement du panel droit --// + //impl_.getMainPanel().getRightColumn().setPreferredSize(new Dimension(400,impl_.getMainPanel().getPreferredSize().height)); + + + //-- ajout de la vue sattelite de la scene --// + JComponent satt =filleLayout_.getScene_().createSatelliteView(); + + //FIXME Adrien: si je decommente ci-dessous, ca plante, je ne comprends pas!!!!!!! + //impl_.getMainPanel().getRightColumn().addToggledComponent("Aper\xE7u", "SCENEAPERCU",satt,this); + + filleLayout_.getScene_().refresh(); + + //-- ajout du tree de la fille layout dans impl --// + impl_.getMainPanel().getRightColumn().addToggledComponent("Calques", "SCENECALQUES",new BuScrollPane(filleLayout_.getTree_()), this); + + filleLayout_.getScene_().refresh(); + //filleLayout_.getScene_().refresh(); + + + + final BuMenuBar menubar = impl_.getMainMenuBar(); final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); menu.setIcon(null); @@ -642,6 +663,9 @@ } menubar.add(menu, 2); + + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-13 16:13:11
|
Revision: 3794 http://fudaa.svn.sourceforge.net/fudaa/?rev=3794&view=rev Author: hadouxad Date: 2008-08-13 16:13:16 +0000 (Wed, 13 Aug 2008) Log Message: ----------- - creation du jxtreetablemodel avec 3 colonnes (icon, nom, checkbox) - optimisation d utilisation des objets graphiques avec les renderer (EbliJXTreeTableCellRenderer pour l icone) - gestion des maj en cas d'ajouts suppression d objets - edition du titre des eblinode directement sur le tree - si on clique sur le repertoire courant: ca masque tout les noeuds fils et inversement - integration du tree a droite dans l implementation - surcharge de la methode addFille de trpostProjet, je verrais avec toi comment executer les graphes. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -52,7 +52,7 @@ public static int ORIENTATION_EAST=2; public static int ORIENTATION_WEST=3; - public Color couleurFleche=Color.black; + public Color couleur=Color.black; /** * @param _scene @@ -91,7 +91,7 @@ l.setEpaisseur(largeurBorder); - l.setCouleur(couleurFleche); + l.setCouleur(couleur); //FIXME prob fleche pas tres jolie l.dessineFleche(g,(int)( l.getEpaisseur() / 2),(int)( rec.height/2), (int)(rec.width-l.getEpaisseur()/2), (int)(rec.height/2)); @@ -110,14 +110,14 @@ public Color getCouleurFleche() { - return couleurFleche; + return couleur; } public void setCouleurFleche(Color couleurFleche) { - this.couleurFleche = couleurFleche; + this.couleur = couleurFleche; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -1,8 +1,10 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Color; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.Shape; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; @@ -29,6 +31,7 @@ int largeurBorder = 15; int espaceInterieur = 5; + public Color couleur=Color.black; /** * @param _scene */ @@ -88,12 +91,14 @@ // la ligne TraceLigne l = new TraceLigne(); - + l.setCouleur(couleur); l.setEpaisseur(largeurBorder); // l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); l.dessineRectangle(g, l.getEpaisseur() / 2, l.getEpaisseur() / 2, rec.width - l.getEpaisseur(), rec.height - l.getEpaisseur()); g.translate(-rec.x, -rec.y); + + } public String getText(Widget widget) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -46,7 +46,7 @@ JFrame frame = new JFrame("Flexdock Test App"); frame.getContentPane().setLayout(new BorderLayout()); - JMenu[] specificMenus = pn.getSpecificMenus("test"); + JMenu[] specificMenus = pn.getSpecificMenus("Vue 2D"); JMenuBar mb = new JMenuBar(); frame.setJMenuBar(mb); for (int i = 0; i < specificMenus.length; i++) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -29,7 +29,7 @@ private static final long serialVersionUID = 4576652808917382435L; -EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); +EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); ChangeEvent changeEvent = null; @@ -40,7 +40,7 @@ } public Object getCellEditorValue() { - BuCheckBox checkbox = renderer.getLeafRenderer().checkBox; + BuCheckBox checkbox = new BuCheckBox();//renderer.getLeafRenderer().checkBox; // EbliNodeDefault checkBoxNode = new CheckBoxNode(checkbox.getText(), // checkbox.isSelected()); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -1,136 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; - -import javax.swing.Icon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeCellRenderer; - -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; - -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; -import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; - -public class EbliCheckBoxTreeRenderer implements TreeCellRenderer { - - //-- panel renderer --// - private EbliCheckBoxPanel leafRenderer = new EbliCheckBoxPanel(); - - private DefaultTreeCellRenderer nonLeafRenderer = new DefaultTreeCellRenderer(); - - Color selectionBorderColor, selectionForeground, selectionBackground, textForeground, textBackground; - - public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_cacher"); - - public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); - - - public Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); - - - protected EbliCheckBoxPanel getLeafRenderer() { - return leafRenderer; - } - - public EbliCheckBoxTreeRenderer() { - leafRenderer.setOpaque(false); - /* - * Font fontValue; fontValue = UIManager.getFont("Tree.font"); if (fontValue - * != null) { leafRenderer.setFont(fontValue); } Boolean booleanValue = - * (Boolean) UIManager .get("Tree.drawsFocusBorderAroundIcon"); - * leafRenderer.setFocusPainted((booleanValue != null) && - * (booleanValue.booleanValue())); - * - * selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor"); - * selectionForeground = UIManager.getColor("Tree.selectionForeground"); - * selectionBackground = UIManager.getColor("Tree.selectionBackground"); - * textForeground = UIManager.getColor("Tree.textForeground"); - * textBackground = UIManager.getColor("Tree.textBackground"); - */ - - - - } - - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, - boolean leaf, int row, boolean hasFocus) { - - - BuLabel returnLabel = null; - BuCheckBox returnValue = null; - // cas particulier renderer: on met un checkbox que si on est feuille et pqs root (= cqs ou lqyer depourvu d objet graphique) - if (leaf && !((DefaultMutableTreeNode) value).isRoot()) { - - // -- recuperation du node --// - Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - - EbliNodeDefault node = null; - if (userObject instanceof EbliNode) { - node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - - //System.err.println("c est un EbliNode!!! ROW: " + row); - - // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque - // composant - returnValue=new BuCheckBox(); - //leafRenderer.setOpaque(false); - - returnValue.setText(node.getTitle()); - returnValue.setSelected(node.getCreator().getWidget().isVisible()); - - - returnLabel=new BuLabel(this.iconLeafEnabled); - - - - returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); - } - - } /*else if (!leaf && !((DefaultMutableTreeNode) value).isRoot()) { - - returnLabel=new BuLabel(this.iconSubDirectorie); - returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - - }*/else { - returnLabel=new BuLabel(((DefaultMutableTreeNode) value).toString(),this.iconRoot); - //returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - - } - - - //-- creation du panel avec les informations --// - leafRenderer=new EbliCheckBoxPanel(); - - if(returnLabel!=null) - leafRenderer.labelRenderer=returnLabel; - - if(returnValue!=null ) - leafRenderer.checkBox=returnValue; - - //-- construction du composant --// - leafRenderer.construct(); - - // qccessible en fonction du tree - leafRenderer.setEnabled(tree.isEnabled()); - if(selected){ - leafRenderer.setBackground(Color.BLUE); - } - else - leafRenderer.setBackground(Color.WHITE); - return leafRenderer; - } - -} Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java (from rev 3771, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -0,0 +1,170 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; + +import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.UIManager; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeCellRenderer; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; + +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; +import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; +/** + * Treecell renderer pour l arbre des calques de visualllibrary. + * gere uniquement l affichage des icones optimises. + * @author genesis + * + */ +public class EbliJXTreeTableCellRenderer implements TreeCellRenderer { + + //-- panel renderer --// + private BuLabel returnLabel = new BuLabel(); + + Color selectionBorderColor, selectionForeground, selectionBackground, textForeground, textBackground; + + public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal_visibilite"); + public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal_cacher"); + public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir"); + public Icon iconRoot=CtuluResource.CTULU.getIcon("crystal_maison"); + + + public EbliJXTreeTableCellRenderer() { + returnLabel.setOpaque(false); + returnLabel.setHorizontalAlignment(BuLabel.LEFT); + /* + * Font fontValue; fontValue = UIManager.getFont("Tree.font"); if (fontValue + * != null) { leafRenderer.setFont(fontValue); } Boolean booleanValue = + * (Boolean) UIManager .get("Tree.drawsFocusBorderAroundIcon"); + * leafRenderer.setFocusPainted((booleanValue != null) && + * (booleanValue.booleanValue())); + * + * selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor"); + * selectionForeground = UIManager.getColor("Tree.selectionForeground"); + * selectionBackground = UIManager.getColor("Tree.selectionBackground"); + * textForeground = UIManager.getColor("Tree.textForeground"); + * textBackground = UIManager.getColor("Tree.textBackground"); + */ + } + + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + + // cas particulier renderer: on met un checkbox que si on est feuille et pqs root (= cqs ou lqyer depourvu d objet graphique) + if (leaf && ((DefaultMutableTreeTableNode) value).getParent()!=null) { + + // -- recuperation du node --// + Object userObject = ((DefaultMutableTreeTableNode) value).getUserObject(); + + EbliNodeDefault node = null; + if (userObject instanceof EbliNode) { + node = (EbliNodeDefault) (((DefaultMutableTreeTableNode) value).getUserObject()); + + + + if(node.getCreator().getWidget().isVisible()) + returnLabel.setIcon(iconLeafEnabled);//=new BuLabel(this.iconLeafEnabled); + else + returnLabel.setIcon(iconLeafDisabled);//returnLabel=new BuLabel(this.iconLeafDisabled); + + + returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); + } + + } /*else if (!leaf && !((DefaultMutableTreeTableNode) value).isRoot()) { + + returnLabel=new BuLabel(this.iconSubDirectorie); + returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + + }*/else { + //returnLabel=new BuLabel(((DefaultMutableTreeTableNode) value).toString(),this.iconRoot); + returnLabel.setIcon(this.iconRoot); + returnLabel.setEnabled(true); + } + + return returnLabel; + } + + + + + + /* + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + + + BuLabel returnLabel = null; + BuCheckBox returnValue = null; + // cas particulier renderer: on met un checkbox que si on est feuille et pqs root (= cqs ou lqyer depourvu d objet graphique) + if (leaf && !((DefaultMutableTreeNode) value).isRoot()) { + + // -- recuperation du node --// + Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); + + EbliNodeDefault node = null; + if (userObject instanceof EbliNode) { + node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); + + //System.err.println("c est un EbliNode!!! ROW: " + row); + + // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque + // composant + returnValue=new BuCheckBox(); + //leafRenderer.setOpaque(false); + + returnValue.setText(node.getTitle()); + returnValue.setSelected(node.getCreator().getWidget().isVisible()); + + + returnLabel=new BuLabel(this.iconLeafEnabled); + + + + returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); + } + + } else { + returnLabel=new BuLabel(((DefaultMutableTreeNode) value).toString(),this.iconRoot); + //returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + + } + + + //-- creation du panel avec les informations --// + leafRenderer=new EbliCheckBoxPanel(); + + if(returnLabel!=null) + leafRenderer.labelRenderer=returnLabel; + + if(returnValue!=null ) + leafRenderer.checkBox=returnValue; + + //-- construction du composant --// + leafRenderer.construct(); + + // qccessible en fonction du tree + leafRenderer.setEnabled(tree.isEnabled()); + if(selected){ + leafRenderer.setBackground(Color.BLUE); + } + else + leafRenderer.setBackground(Color.WHITE); + return leafRenderer; + } +*/ + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 15:03:32 UTC (rev 3793) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.List; +import javax.swing.Icon; import javax.swing.event.TreeModelListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; @@ -11,6 +12,7 @@ import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; +import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -28,11 +30,16 @@ public static String NAMELAYER="Layer"; //-- noeud aui se trouve au sommet --// -DefaultMutableTreeNode nodeRoot_; +public DefaultMutableTreeNode nodeRoot_; //-- modele du tree --// DefaultTreeModel modeleTree; + + + + + //-- scene principale pour recuperer la liste des noeuds --// //EbliScene scene; Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-13 16:13:16 UTC (rev 3794) @@ -0,0 +1,442 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import java.awt.Checkbox; +import java.awt.Image; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeListener; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.AbstractTreeTableModel; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import org.jdesktop.swingx.treetable.TreeTableModel; + +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuLabel; + + +/** + * Model du treetable. + * contient 3 colonnes: + * colonne 1:icone + * colonne 2:nom + * colonne 3:checkbox associee + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener{ + + //-- le nombre de colonnes est statique --// + final static int NBCOLUMN=3; + + /** + * titres des colonnes. + */ + public String[] title={"Icon","Nom","V" }; + + /** + * Icones associees au treemodeltable. + */ + public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_cacher"); + public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); + public Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); + + /** + * composant graphique utiliser ppuor afficher l etat masquer/visible du widget . + */ + public BuCheckBox chexBox_=new BuCheckBox(); + + public BuLabel labelIcon=new BuLabel(); + + public BuLabel labelTexte=new BuLabel(); + + /** + * scene dont le model est associe + */ + public EbliScene scene_; + + /** + * numero du layer + */ + int numLayer; + + JXTreeTable tree_; + + + public JXTreeTable getTree_() { + return tree_; + } + + public void setTree_(JXTreeTable tree_) { + this.tree_ = tree_; + } + + + //-- noeud aui se trouve au sommet --// + DefaultMutableTreeTableNode nodeRoot_; + + /** + * constructeur. + * @param numLayer + * @param scene_ + */ + public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot,int numLayer, EbliScene scene_) { + super(nodeRoot); + this.numLayer = numLayer; + this.scene_ = scene_; + + //--initialisation du node root --// + nodeRoot_=nodeRoot;//new DefaultMutableTreeTableNode("Layer "+numLayer); + + + } + + public Class<?> getColumnClass(int arg0) { + // TODO Auto-generated method stub + switch(arg0){ + case 0: return Icon.class; + case 1: return String.class; + case 2: return Boolean.class; + default: return null; + } + + } + + public int getColumnCount() { + // TODO Auto-generated method stub + return NBCOLUMN; + } + + public String getColumnName(int arg0) { + // TODO Auto-generated method stub + if(arg0<NBCOLUMN) + return title[arg0]; + else return ""; + } + + public int getHierarchicalColumn() { + // TODO Auto-generated method stub + return 0; + } + + /** + * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. + */ + public Object getValueAt(Object arg0, int column) { + + + //-- recuperation du mutableTreenode qui contient le node de la scene --// + DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)arg0; + + //-- test si il s agit du node root --// + if(nodeTree == nodeRoot_) + { + if(column==0){ + labelIcon.setIcon(iconRoot); + return iconRoot;//labelIcon; + } + else + if(column==1){ + + return "Layer "+numLayer; + } + else{ + // recherche si au moins un sous fils est affiche sinon retourne false + boolean auMoinsUnSousElementAffiche=false; + + Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + while(liste.hasMoreElements() && !auMoinsUnSousElementAffiche){ + + //System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); + DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); + + + //-- si il existe au moins un sous fils qi est affiche alors on est ok --// + if(((Boolean)getValueAt(modif, 2)).booleanValue()){ + auMoinsUnSousElementAffiche=true; + } + + } + + return auMoinsUnSousElementAffiche; + } + } + //--recuperation du node de la scene --// + EbliNode node= (EbliNode) nodeTree.getUserObject(); + + + + //-- cas 1 recuperation de l icone --// + if(column==0){ + if(node.hasWidget() && node.getCreator().getWidget().isVisible()) + labelIcon.setIcon(iconLeafEnabled); + else + labelIcon.setIcon(iconLeafDisabled); + + return iconLeafEnabled;//labelIcon; + + }else + //-- recuperation du title --// + if(column==1){ + //labelTexte.setText(node.getTitle()); + return node.getTitle();//labelTexte; + + }else + //-- recuperation de la checkbox --// + if(column==2){ + boolean coche; + System.err.println("je suis la checbox: wodget selectionee:"+node.getCreator().getWidget().isVisible()); + if(node.hasWidget() && node.getCreator().getWidget().isVisible()) + //coche la checkbox + coche=true;//chexBox_.setSelected(true); + else + coche=false;//chexBox_.setSelected(false); + + return coche;//chexBox_; + } + + + + + return null; + } + + /** + * seul le texte et la checkbox sont editables + */ + public boolean isCellEditable(Object arg0, int column) { + // TODO Auto-generated method stub + + if(column==0 || column>=NBCOLUMN) + return false; + else + return true; + } + + /** + * placer une valeur + */ + + public void setValueAt(Object value, Object nodeT, int column) { + // TODO Auto-generated method stub + + //-- recuperation du mutableTreenode qui contient le node de la scene --// + DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)nodeT; + + + //-- on essaie de masquer tous les sous repertoires --// + if(nodeTree==nodeRoot_ && column==2){ + + // si on coche sur la check, on fait tout disparaitre + //--recupeation de la checkBox --// + boolean box= ((Boolean) value).booleanValue(); + Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + while(liste.hasMoreElements()){ + + System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); + DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); + + + //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible(box); + + //-- envoi du signal a tous les noeuds fils: reccurence sur le checkbox --// + setValueAt(value, modif, 2); + + } + + + + + + } + //-- si node tree = ROOT on arrete les frais --// + if(!nodeTree.isLeaf()) + return; + + //--recuperation du node de la scene --// + EbliNode node= (EbliNode) nodeTree.getUserObject(); + + + //-- recuperation de la value en fonction de la colonne --// + if(column==1){ + //--recuperation du nouveau nom --// + String newTitle=((/*BuLabel*/String) value);//.getText(); + node.setTitle(newTitle); + }else{ + //--recupeation de la checkBox --// + boolean box= ((Boolean) value).booleanValue(); + + + //-- affichage de la widget --// + node.getCreator().getWidget().setVisible(box); + + //-- rafraichissement de la scene --// + scene_.refresh(); + } + + //rafraichissement de l arbre + reload(); + + setResizeColumn(); + + } + + + + /** + * Raffraichissement maison du jxtreetable + */ + public void reload(){ + + this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(nodeRoot_))); + } + + /** + * methode qui redimensionne les colonens du table. + */ + public void setResizeColumn(){ + if(tree_==null) + return; + tree_.getColumn(0).setPreferredWidth(60); + tree_.getColumn(1).setPreferredWidth(50); + tree_.getColumn(2).setPreferredWidth(5); + + tree_.getColumn(0).setResizable(false); + tree_.getColumn(1).setResizable(false); + tree_.getColumn(2).setResizable(false); + tree_.validate(); + } + + + /*public void addTreeModelListener(TreeModelListener l) { + // TODO Auto-generated method stub + + } + +*/ + /* + public Object getChild(Object parent, int index) { + // TODO Auto-generated method stub + DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; + + return nodeParent.getChildAt(index); + + } + + public int getChildCount(Object parent) { + // TODO Auto-generated method stub + DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; + return nodeParent.getChildCount(); + } + + public int getIndexOfChild(Object parent, Object child) { + // TODO Auto-generated method stub + DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; + + return nodeParent.getIndex((TreeNode) child); + } +/* + public Object getRoot() { + // TODO Auto-generated method stub + return nodeRoot_; + } + + public boolean isLeaf(Object _node) { + // TODO Auto-generated method stub + DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; + + return node.isLeaf(); + } + + public void removeTreeModelListener(TreeModelListener l) { + // TODO Auto-generated method stub + + } + + public void valueForPathChanged(TreePath path, Object newValue) { + // TODO Auto-generated method stub + System.err.println("je suis valueForPathChanged(TreePath path, Object newValue)"); + } +*/ + //-- utilisation de l interface node added + + public void nodeAdded(EbliNode node) { + // TODO Auto-generated method stub + + System.err.println("je suis nodeAdded(EbliNode node)"); + //-- ajout du nouveau node --// + + DefaultMutableTreeTableNode newNode=new DefaultMutableTreeTableNode(node); + //nodeRoot_.add(newNode); + + //-- rafraichissement du modele --// + + //-- ajout du node dans le tree en fin de liste--// + //insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); + + //-- ajout du node dans le tree en debut de liste--// + insertNodeInto(newNode,nodeRoot_, 0); + + + //setResizeColumn(); + //scene_.refresh(); + + } + + + /** + * Methode appelee lorsau elel recoit un signal de suppression de node de la scene. + * a pour effet de chercher le treetableNode associee et de le supprimer du tree ainsi que mettre a jour l arbre. + */ + public void noderemoved(EbliNode node) { + + + DefaultMutableTreeTableNode Asuppr=null; + //-- recuperation des nodes --// + Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + + + while(liste.hasMoreElements() && Asuppr==null){ + + + DefaultMutableTreeTableNode suspect= (DefaultMutableTreeTableNode) liste.nextElement(); + + //recuperation du node + EbliNode nodeSuspect=(EbliNode) suspect.getUserObject(); + + if(nodeSuspect!=null && nodeSuspect == node) + Asuppr=suspect; + + + } + + //-- suppression du node de ses parents + if(Asuppr!=null) + removeNodeFromParent(Asuppr); + + + + //-- rafraichissement du modele --// + //modeleTree.reload(); + reload(); + + setResizeColumn(); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <opa...@us...> - 2008-08-13 15:03:26
|
Revision: 3793 http://fudaa.svn.sourceforge.net/fudaa/?rev=3793&view=rev Author: opasteur Date: 2008-08-13 15:03:32 +0000 (Wed, 13 Aug 2008) Log Message: ----------- Modified Paths: -------------- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml Modified: trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml =================================================================== --- trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-12 20:22:49 UTC (rev 3792) +++ trunk/fudaa_devel/fudaa-distrib/mascaret/izpack/izpack_fudaa_mascaret.xml 2008-08-13 15:03:32 UTC (rev 3793) @@ -1,49 +1,49 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<!-- +<!-- A sample installation file. Use it as a base for your own installers :-) - + To compile it : - go in the bin directory where you installed IzPack - call "compile ../sample/install.xml -b ../sample" --> <installation version="1.0"> - <!-- + <!-- The info section. The meaning of the tags should be natural ... - - --> + + --> <info> <appname>Fudaa-Mascaret</appname> - <appversion>3.0.3</appversion> - <variable name="released-on" value="14/05/2008" /> + <appversion>3.1 alpha 1</appversion> + <variable name="released-on" value="13/12/2007" /> <authors> - <author name="EDF Recherche et D�veloppement" email="http://rd.edf.com" /> - <author name="CETMEF" email="http://www.cetmef.equipement.gouv.fr" /> + <author name="EDF Recherche et Développement" email="" /> + <author name="CETMEF" email="" /> </authors> <url>http://rd.edf.com</url> </info> -<native type="izpack" name="ShellLink.dll" /> - <!-- +<native type="izpack" name="ShellLink.dll" /> + <!-- The gui preferences indication. Sets the installer window to 800x420. It will be able to change the size. - - --> - <guiprefs width="800" height="420" resizable="yes" /> - <!-- + + --> + <guiprefs width="800" height="420" resizable="yes" /> + <!-- The locale section. Asks here to include the French langpacks. - - --> + + --> <locale> <langpack iso3="fra" /> </locale> - <!-- + <!-- The resources section. The ids must be these ones if you want to use the LicencePanel and/or the InfoPanel. - - --> + + --> <resources> <res src="izpack/shortcutSpec.xml" id="shortcutSpec.xml" /> <res src="Licence.txt" id="LicencePanel.licence"/> @@ -52,11 +52,11 @@ <!-- res src="izpack/RegistrySpec.xml" id="RegistrySpec.xml"/ --> </resources> - <!-- + <!-- The panels section. We indicate here which panels we want to use. The order will be respected. - - --> + + --> <panels> <panel classname="HelloPanel" /> <panel classname="InfoPanel" /> @@ -67,23 +67,22 @@ <panel classname="ShortcutPanel" /> <panel classname="FinishPanel" /> </panels> - <!-- + <!-- The packs section. We specify here our packs. - --> + --> <packs> <pack name="Core" required="yes"> - <description>L'application de base int�grant l'interface graphique Fudaa-Mascaret et le code de calcul Mascaret</description> + <description>L'application de base intégrant l'interface graphique Fudaa-Mascaret et le code de calcul Mascaret</description> <file src="../../../distrib/build/jar/mascaret/fudaa-mascaret.jar" targetdir="$INSTALL_PATH" /> <file src="../../fudaa/serveurs" targetdir="$INSTALL_PATH" /> <file src="../../aide/src/mascaret" targetdir="$INSTALL_PATH" /aide/src/mascaret> - <file src="fudaa-mascaret.bat" targetdir="$INSTALL_PATH" /> <file src="icons" targetdir="$INSTALL_PATH" /> <parsable targetfile="$INSTALL_PATH/fudaa-mascaret.bat" /> <!-- The file will be parsed --> </pack> <pack name="Exemples" required="no"> - <description>Quelques exemples de fichiers d'entr�e de Fudaa-Mascaret</description> + <description>Quelques exemples de fichiers d'entrée de Fudaa-Mascaret</description> <file src="exemples" targetdir="$INSTALL_PATH" /> <!-- Reccursive adding --> </pack> <pack name="Docs" required="no"> @@ -108,5 +107,5 @@ <os family="windows"/> </native> - - </installation> + + </installation> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-12 20:22:40
|
Revision: 3792 http://fudaa.svn.sourceforge.net/fudaa/?rev=3792&view=rev Author: deniger Date: 2008-08-12 20:22:49 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 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-08-12 19:55:32 UTC (rev 3791) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-12 20:22:49 UTC (rev 3792) @@ -18,6 +18,7 @@ import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.ActionFactory; @@ -31,6 +32,10 @@ EditCreator editor_; JFrame frame_; + BufferedImage image; + + GrBoite zoom_; + public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; @@ -40,7 +45,8 @@ setPreferredSize(new Dimension(200, 200)); setMinimumSize(new Dimension(200, 200)); initSize(new Rectangle(0, 0, 200, 200)); - calquePanel_.restaurer(); + // zoom_ = calquePanel_.getVueCalque().getCalque().getDomaine(); + // calquePanel_.restaurer(); // -- creation de l action pour editor --// WidgetAction editorAction = ActionFactory.createEditAction(this); @@ -50,42 +56,6 @@ } - @Override - protected void paintWidget() { - - Rectangle rec = getClientArea(); - Graphics2D g = getGraphics(); - g.translate(rec.x, rec.y); - // mode edition - if (frame_ != null) { - Map params = new HashMap(); - CtuluLibImage.setCompatibleImageAsked(params); - // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - BufferedImage image = calquePanel_.produceImage(rec.width, rec.height, params); - g.drawImage(image, 0, 0, rec.width, rec.height, null); - return; - - } - // GrBoite b = vue_.getVueCalque().getViewBoite(); - // vue_.getVueCalque().changeRepere(this, b); - // TODO a ameliorer - initSize(rec); - - calquePanel_.getVueCalque().paintImage(g, Collections.EMPTY_MAP); - g.translate(-rec.x, -rec.y); - } - - private void initSize(Rectangle rec) { - BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); - calquePanel_.getVueCalque().setSize(rec.width, rec.height); - calquePanel_.setSize(rec.width, rec.height); - calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); - calquePanel_.getVueCalque().getCalque().setSize(rec.width, rec.height); - for (int i = 0; i < tousCalques.length; i++) { - tousCalques[i].setSize(rec.width, rec.height); - } - } - /* * (non-Javadoc) * @@ -97,6 +67,7 @@ if (frame_ != null) frame_.toFront(); else { + // final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); Point p = new Point(rec.x, rec.y); JComponent jc = getEbliScene().getView(); @@ -105,6 +76,7 @@ frame_ = editor_.createFrame(calquePanel_); frame_.setLocation(p); frame_.pack(); + // calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame_.addWindowListener(new WindowAdapter() { @@ -116,9 +88,50 @@ frame_ = null; } + @Override + public void windowClosing(WindowEvent _e) { + zoom_ = calquePanel_.getVueCalque().getViewBoite(); + // image = null; + // getEbliScene().refresh(); + } + }); } // TODO Auto-generated method stub } + + private void initSize(Rectangle rec) { + BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); + calquePanel_.getVueCalque().setSize(rec.width, rec.height); + // calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); + calquePanel_.getVueCalque().getCalque().setSize(rec.width, rec.height); + for (int i = 0; i < tousCalques.length; i++) { + tousCalques[i].setSize(rec.width, rec.height); + } + } + + @Override + protected void paintWidget() { + + Rectangle rec = getClientArea(); + Graphics2D g = getGraphics(); + if (frame_ == null) { + initSize(rec); + } + if (zoom_ != null) { +// image=null; + calquePanel_.getVueCalque().changeRepere(this, zoom_); + + } else + calquePanel_.restaurer(); + // mode edition + if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // a ameliorer: il ne faudrait pas recreer l'image a chaque fois + image = calquePanel_.produceImage(rec.width, rec.height, params); + } + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-12 19:55:22
|
Revision: 3791 http://fudaa.svn.sourceforge.net/fudaa/?rev=3791&view=rev Author: deniger Date: 2008-08-12 19:55:32 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 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-08-12 19:54:13 UTC (rev 3790) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-12 19:55:32 UTC (rev 3791) @@ -1,139 +1,124 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; import java.util.Collections; -import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import javax.swing.JComponent; import javax.swing.JFrame; -import javax.swing.JLabel; +import javax.swing.SwingUtilities; -import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.EditProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; -import sun.swing.BakedArrayList; +public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuButton; -import com.memoire.bu.BuPanel; + ZEbliCalquesPanel calquePanel_; + EditCreator editor_; + JFrame frame_; -public class EbliWidgetVueCalque extends EbliWidget implements - InplaceEditorProvider<BuPanel> { + public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { + super(scene); + calquePanel_ = vue; - ZEbliCalquesPanel vue_; + editor_ = EditCreator.INSTANCE; + // FIXME a enlever par la suite + setPreferredSize(new Dimension(200, 200)); + setMinimumSize(new Dimension(200, 200)); + initSize(new Rectangle(0, 0, 200, 200)); + calquePanel_.restaurer(); - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { - super(scene); - vue_ = vue; - setPreferredSize(new Dimension(200, 200)); - setMinimumSize(new Dimension(200, 200)); + // -- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory.createEditAction(this); - // -- creation de l action pour editor --// - WidgetAction editorAction = ActionFactory - .createInplaceEditorAction(this); + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); - // -- ajout de l action au widget correspondant --// - this.getActions().addAction(editorAction); + } - } + @Override + protected void paintWidget() { - @Override - protected void paintWidget() { - Rectangle rec = getClientArea(); - Graphics2D g = getGraphics(); - g.translate(rec.x, rec.y); - // GrBoite b = vue_.getVueCalque().getViewBoite(); - // vue_.getVueCalque().changeRepere(this, b); - // TODO a ameliorer - BCalque[] tousCalques = vue_.getVueCalque().getCalque() - .getTousCalques(); - vue_.getVueCalque().setSize(rec.width, rec.height); - vue_.getVueCalque().getCalque().setSize(rec.width, rec.height); - for (int i = 0; i < tousCalques.length; i++) { - tousCalques[i].setSize(rec.width, rec.height); - } - vue_.restaurer(); - vue_.getVueCalque().paintImage(g, Collections.EMPTY_MAP); - g.translate(-rec.x, -rec.y); - } + Rectangle rec = getClientArea(); + Graphics2D g = getGraphics(); + g.translate(rec.x, rec.y); + // mode edition + if (frame_ != null) { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // a ameliorer: il ne faudrait pas recreer l'image a chaque fois + BufferedImage image = calquePanel_.produceImage(rec.width, rec.height, params); + g.drawImage(image, 0, 0, rec.width, rec.height, null); + return; - // -- methodes implements InplaceEditorProvider --// + } + // GrBoite b = vue_.getVueCalque().getViewBoite(); + // vue_.getVueCalque().changeRepere(this, b); + // TODO a ameliorer + initSize(rec); - /** - * Methode appeleee pour creer un editor correspondant - */ - public BuPanel createEditorComponent( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget) { - // TODO Auto-generated method stub + calquePanel_.getVueCalque().paintImage(g, Collections.EMPTY_MAP); + g.translate(-rec.x, -rec.y); + } - final BuPanel panelTest = new BuPanel(new FlowLayout(FlowLayout.CENTER)); - panelTest.add(new JLabel("test panel")); - BuButton boutonTest = new BuButton("bouton cool"); - boutonTest.addActionListener(new ActionListener() { + private void initSize(Rectangle rec) { + BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); + calquePanel_.getVueCalque().setSize(rec.width, rec.height); + calquePanel_.setSize(rec.width, rec.height); + calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); + calquePanel_.getVueCalque().getCalque().setSize(rec.width, rec.height); + for (int i = 0; i < tousCalques.length; i++) { + tousCalques[i].setSize(rec.width, rec.height); + } + } - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - panelTest.add(new JLabel("bouton appuy\xE9")); - panelTest.validate(); - JFrame frameTruc = new JFrame(); - frameTruc.getContentPane().add(new JLabel("bouton appuy\xE9")); - frameTruc.setSize(200, 200); - frameTruc.setVisible(true); - } + /* + * (non-Javadoc) + * + * @see + * org.netbeans.api.visual.action.EditProvider#edit(org.netbeans.api.visual + * .widget.Widget) + */ + public void edit(Widget _widget) { + if (frame_ != null) + frame_.toFront(); + else { + Rectangle rec = convertLocalToScene(getClientArea()); + Point p = new Point(rec.x, rec.y); + JComponent jc = getEbliScene().getView(); + SwingUtilities.convertPointToScreen(p, jc); - }); - panelTest.add(boutonTest); - BuPanel res = new BuPanel(new BuBorderLayout()); - res.add(vue_); - res - .add(new BArbreCalque(vue_.getArbreCalqueModel()), - BorderLayout.EAST); - // panelTest.add(vue_); + frame_ = editor_.createFrame(calquePanel_); + frame_.setLocation(p); + frame_.pack(); + frame_.setVisible(true); + frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame_.addWindowListener(new WindowAdapter() { - return /* panelTest */res; - } + @Override + public void windowClosed(WindowEvent _e) { + if (frame_ != null) + frame_.dispose(); + frame_ = null; + } - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor) { - // TODO Auto-generated method stub - return null; - } + }); + } + // TODO Auto-generated method stub - public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor, Rectangle viewBounds) { - return new Rectangle(viewBounds.x, viewBounds.y, viewBounds.width + 200, - viewBounds.height); - // TODO Auto-generated method stub - //return null; - } - - public void notifyClosing( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor, boolean commit) { - // TODO Auto-generated method stub - - } - - public void notifyOpened( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor) { - // TODO Auto-generated method stub - - } - + } } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 2008-08-12 19:55:32 UTC (rev 3791) @@ -0,0 +1,117 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.border.LineBorder; + +import org.flexdock.docking.DockingConstants; +import org.flexdock.docking.DockingManager; +import org.flexdock.docking.DockingPort; +import org.flexdock.docking.defaults.DefaultDockingPort; +import org.flexdock.view.View; +import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; + +/** + * A ameliorer... + * + * @author deniger + * + */ +public final class EditCreator { + + private EditCreator() { + + } + + public static final EditCreator INSTANCE = new EditCreator(); + + JFrame createFrame(ZEbliCalquesPanel pn) { + JFrame frame = new JFrame("Flexdock Test App"); + + frame.getContentPane().setLayout(new BorderLayout()); + JMenu[] specificMenus = pn.getSpecificMenus("test"); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + for (int i = 0; i < specificMenus.length; i++) { + mb.add(specificMenus[i]); + } + JToolBar tb = new JToolBar(); + List actions = pn.getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + tb.addSeparator(); + } else { + tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + frame.getContentPane().add(tb, BorderLayout.NORTH); + pn.setPreferredSize(pn.getPreferredSize()); + final DefaultDockingPort globalPort = createDockingPort(); + JComponent centerComponent = createView(pn, "VUE 2D"); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JComponent rightComponent = createView(new JScrollPane(new BArbreCalque(pn.getArbreCalqueModel())), "arbre", true); + DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); + + frame.getContentPane().add(globalPort, BorderLayout.CENTER); + frame.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent _e) { + globalPort.clear(); + } + + }); + return frame; + + } + + private static DefaultDockingPort createDockingPort() { + DefaultDockingPort port = new DefaultDockingPort(); + port.setPreferredSize(new Dimension(400, 400)); + return port; + } + + private static JComponent createDockableComponent(String name) { + JPanel panel = new JPanel(new BorderLayout()); + panel.setBorder(new LineBorder(Color.BLUE)); + panel.add(new JLabel("COUCOU " + name)); + return createView(panel, name, true); + } + + private static JComponent createView(JComponent jc, String name) { + return createView(jc, name, false); + } + + private static JComponent createView(JComponent jc, String name, boolean dockage) { + View view = new View(name); + view.getViewProperties().setDockingEnabled(false); + if (dockage) { + view.addAction(DockingConstants.CLOSE_ACTION); + view.getViewProperties().setDockingEnabled(true); + } + view.setContentPane(jc); + view.setTitle(name, true); + // DockingManager.registerDockable(view.getComponent(), name); + + return view; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-12 19:54:04
|
Revision: 3790 http://fudaa.svn.sourceforge.net/fudaa/?rev=3790&view=rev Author: deniger Date: 2008-08-12 19:54:13 +0000 (Tue, 12 Aug 2008) Log Message: ----------- ajout d'une methode qui permet de creer une image adapte a l'affichage ecran Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java 2008-08-12 19:54:01 UTC (rev 3789) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluLibImage.java 2008-08-12 19:54:13 UTC (rev 3790) @@ -33,7 +33,8 @@ * @version $Id: CtuluLibImage.java,v 1.12 2007-06-05 08:57:44 deniger Exp $ */ public final class CtuluLibImage { - private CtuluLibImage() {} + private CtuluLibImage() { + } public static float getRatio(final int _sup, final int _inf) { return ((float) _sup) / ((float) _inf); @@ -44,8 +45,10 @@ } /** - * @param _imageParams la tables des parametres: peut etre null. - * @return true si le client doit cr\xE9er une image compatible avec l'affichage de l'\xE9cran + * @param _imageParams + * la tables des parametres: peut etre null. + * @return true si le client doit cr\xE9er une image compatible avec l'affichage + * de l'\xE9cran * @see CtuluImageProducer#PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE */ public static boolean isCompatibleImageAsked(Map _imageParams) { @@ -53,6 +56,12 @@ && _imageParams.get(CtuluImageProducer.PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE) == Boolean.TRUE; } + public static void setCompatibleImageAsked(Map _imageParams) { + if (_imageParams != null) { + _imageParams.put(CtuluImageProducer.PARAMS_CREATE_SCREEN_COMPATIBLE_IMAGE, Boolean.TRUE); + } + } + public static int getImageRGBType(Map _imageParams) { return mustFillBackground(_imageParams) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; } @@ -80,9 +89,12 @@ } /** - * @param _c le compsant a imprimer - * @param _w la largeur de l'image - * @param _h la hauteur + * @param _c + * le compsant a imprimer + * @param _w + * la largeur de l'image + * @param _h + * la hauteur * @param _params * @return */ @@ -120,7 +132,8 @@ } } - if (i == null) i = new BufferedImage(_w, _h, getImageRGBType(_params)); + if (i == null) + i = new BufferedImage(_w, _h, getImageRGBType(_params)); return i; } @@ -158,7 +171,8 @@ } } - // il y a un bogue avec le plugin javaio sur certains fichiers jpg: on va essayer de le virer + // il y a un bogue avec le plugin javaio sur certains fichiers jpg: on va + // essayer de le virer if (res != null && inputOk) { try { res.getHeight(0); @@ -168,7 +182,8 @@ if (it != null && it.hasNext()) { // on prend le prochain lecteur res = (ImageReader) it.next(); - if (res == null) inputOk = false; + if (res == null) + inputOk = false; else { try { res.setInput(ImageIO.createImageInputStream(_f)); @@ -224,7 +239,8 @@ * @return */ private static BufferedImage createThumbnail(BufferedImage _initImage, int _newWidth, int _newHeight, int _type) { - if (Fu.DEBUG && FuLog.isDebug()) FuLog.debug("CIM: on utilise technique swingx pour les thumbnails"); + if (Fu.DEBUG && FuLog.isDebug()) + FuLog.debug("CIM: on utilise technique swingx pour les thumbnails"); int width = _initImage.getWidth(); int height = _initImage.getHeight(); @@ -254,7 +270,8 @@ } if (temp == null || isTranslucent) { - if (g2 != null) g2.dispose(); + if (g2 != null) + g2.dispose(); temp = createImage(width, height, _type); g2 = temp.createGraphics(); setBestQuality(g2); @@ -306,7 +323,8 @@ } public static BufferedImage resize(final BufferedImage _init, final int _newW, final int _newH, final int _type) { - if (_newH < _init.getHeight() && _newW < _init.getWidth()) return createThumbnail(_init, _newW, _newH, _type); + if (_newH < _init.getHeight() && _newW < _init.getWidth()) + return createThumbnail(_init, _newW, _newH, _type); final BufferedImage res = new BufferedImage(_newW, _newH, _type); final Graphics2D g2 = res.createGraphics(); g2.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-12 19:53:52
|
Revision: 3789 http://fudaa.svn.sourceforge.net/fudaa/?rev=3789&view=rev Author: deniger Date: 2008-08-12 19:54:01 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/commons-logging-1.1.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/commons-logging-1.1.src.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/flexdock-0.5.1.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/flexdock-0.5.1.src.jar Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/commons-logging-1.1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/commons-logging-1.1.src.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/flexdock-0.5.1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/flexdock-0.5.1.src.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-12 18:53:29
|
Revision: 3788 http://fudaa.svn.sourceforge.net/fudaa/?rev=3788&view=rev Author: deniger Date: 2008-08-12 18:53:38 +0000 (Tue, 12 Aug 2008) Log Message: ----------- fichier de formattage d'eclipse Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml Added: branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml 2008-08-12 18:53:38 UTC (rev 3788) @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<profiles version="11"> +<profile kind="CodeFormatterProfile" name="Fudaa" version="11"> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> +<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/> +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> +</profile> +</profiles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-08-12 15:48:55
|
Revision: 3787 http://fudaa.svn.sourceforge.net/fudaa/?rev=3787&view=rev Author: bmarchan Date: 2008-08-12 15:48:58 +0000 (Tue, 12 Aug 2008) Log Message: ----------- CalqueFindCourbeTreeModel g?\195?\169n?\195?\169ralis?\195?\169 et renomm?\195?\169 en CalqueGISTreeModel Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindComponentPolygone.java branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java Added Paths: ----------- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java Removed Paths: ------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java Copied: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java (from rev 3783, branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java) =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java (rev 0) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2008-08-12 15:48:58 UTC (rev 3787) @@ -0,0 +1,348 @@ +/* + * @creation 21 nov. 06 + * @modification $Date: 2007-05-04 13:49:46 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.calque; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.List; +import java.util.Observable; +import java.util.Observer; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JLabel; +import javax.swing.JTree; +import javax.swing.UIManager; +import javax.swing.border.Border; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.DefaultTreeSelectionModel; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeModelObjectInterface; +import org.fudaa.ctulu.gis.GISGeometry; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISVisitorChooser; +import org.fudaa.ctulu.gis.GISVisitorGeometryCollector; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gui.CtuluCellRenderer; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; + +import com.vividsolutions.jts.geom.Geometry; + +/** + * Un TreeModel repr\xE9sentant les calques contenant des g\xE9om\xE9tries. Ces g\xE9om\xE9tries peuvent \xEAtre filtr\xE9es par type. + * Ce mod\xE8le est automatiquement mis a jour si une instance de l'arbre des calque lui est fourni. + * + * @author Fred Deniger, Bertrand Marchand + * @version $Id: CalqueFindCourbeTreeModel.java,v 1.5 2007-05-04 13:49:46 deniger Exp $ + */ +public class CalqueGISTreeModel extends DefaultTreeModel implements Observer { + + final BGroupeCalque rootLayer_; + LayerNode rootNode_; + final CalqueGeometryVisitor finder_ = new CalqueGeometryVisitor(); + GISVisitorChooser chooser_ = new GISVisitorChooser(); + + /** + * Le renderer pour l'arbre, gerant la non selection des calques si non autoris\xE9. + * @author Bertrand Marchand + */ + public static class CellRenderer extends JLabel implements TreeCellRenderer { + final Color selectedBackground_ = UIManager.getColor("Tree.selectionBackground"); + final Color selectedForground_ = UIManager.getColor("Tree.selectionForeground"); + final Border focusBorderColor_ = BorderFactory.createLineBorder(UIManager.getColor("Tree.selectionBorderColor"), 1); + final boolean onlyLineSelectable_; + + public CellRenderer(final boolean _onlyGeomSelectable) { + this.setOpaque(true); + setPreferredSize(new Dimension(120, 25)); + onlyLineSelectable_ = _onlyGeomSelectable; + } + + protected boolean isSelectable(final Object _value, final boolean _leaf) { + if (onlyLineSelectable_) { + if (!_leaf) { + return false; + } + final LayerNode node = (LayerNode) _value; + return node.idxGeom_ >= 0; + } + return true; + + } + + public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected, + final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) { + this.setFont(_tree.getFont()); + setIcon(((LayerNode) _value).getIcon()); + setText(_value.toString()); + final boolean selectable = isSelectable(_value, _leaf); + if (_selected && selectable) { + setBackground(selectedBackground_); + setForeground(selectedForground_); + } else { + setBackground(_tree.getBackground()); + setForeground(_tree.getForeground()); + } + if (selectable) { + setToolTipText(getText()); + } else { + setToolTipText(getText() + ": " + CtuluLib.getS("Non s\xE9lectionnable")); + } + setBorder((selectable && _hasFocus) ? focusBorderColor_ : CtuluCellRenderer.BORDER_NO_FOCUS); + setEnabled(_tree.isEnabled()); + return this; + } + } + + /** + * Modele de selection de l'arbre, gerant la non selection des calques si non autoris\xE9. + * @author Bertrand Marchand + */ + public static class OnlyGeomTreeSelectionModel extends DefaultTreeSelectionModel { + + public void setSelectionPaths(final TreePath[] _paths) { + super.setSelectionPaths(getCorrectPaths(_paths)); + } + + public void addSelectionPaths(final TreePath[] _paths) { + super.addSelectionPaths(getCorrectPaths(_paths)); + } + + private TreePath[] getCorrectPaths(final TreePath[] _paths) { + TreePath[] paths = _paths; + if (!CtuluLibArray.isEmpty(_paths)) { + final List<TreePath> correctPath = new ArrayList<TreePath>(paths.length); + for (int i = 0; i < paths.length; i++) { + if (paths[i] != null && paths[i].getLastPathComponent() != null + && ((LayerNode) paths[i].getLastPathComponent()).idxGeom_ >= 0) { + correctPath.add(paths[i]); + } + } + if (correctPath.size() != paths.length) { + paths=correctPath.toArray(new TreePath[correctPath.size()]); + } + } + return paths; + } + + } + + /** + * Un noeud de l'arbre, customis\xE9 suivant le nom de la g\xE9om\xE9trie et son type. + * @author Bertrand Marchand + */ + public static class LayerNode extends DefaultMutableTreeNode { + + int idxGeom_ = -1; + String titre_; + final Icon icon_; + + public LayerNode(final BCalque _userObject) { + super(_userObject, true); + icon_ = CtuluLibImage.resize(_userObject, 16, 16); + } + + public LayerNode(final ZCalqueAffichageDonneesAbstract _userObject, final int _idx, final String _titre) { + super(_userObject, false); + idxGeom_ = _idx; + titre_ = _titre; + + if (_userObject instanceof ZCalqueMultiPoint) { + icon_ = EbliResource.EBLI.getIcon("draw-multipoint"); + } +// else if (_userObject instanceof ZCalquePoint) { +// icon_ = EbliResource.EBLI.getIcon("draw-add-pt"); +// } + else { + if (((ZCalqueLigneBrisee)_userObject).getModele().isGeometryFermee(_idx)) { + icon_=EbliResource.EBLI.getIcon("draw-polygon"); + } + else { + icon_=EbliResource.EBLI.getIcon("draw-polyline"); + } + } + } + + public String toString() { + if (titre_ != null) { + return titre_; + } + return ((BCalque) userObject).getTitle(); + } + + public Icon getIcon() { + return icon_; + } + + public int getIdxGeom() { + return idxGeom_; + } + + } + + /** + * Cr\xE9ation du modele a partir de la racine des calques. + */ + public CalqueGISTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) { + super(new LayerNode(_root)); + rootNode_=(LayerNode)getRoot(); + rootLayer_ = _root; + if (_model != null) { + _model.getObservable().addObserver(this); + } + + buildTree(); + } + + public final void buildTree() { + rootNode_.removeAllChildren(); + addLayer(rootNode_, rootLayer_); + } + + protected boolean containsGeometries(final BCalque _cq) { + finder_.resetFound(); + _cq.apply(finder_); + return finder_.isFound(); + } + + /** + * Remplit la liste avec les geometries du noeud. + * @param _nd Le noeud. + * @param _dest La liste de destination. + */ + public void fillWithGeometries(LayerNode _nd, final List<Geometry> _dest) { + if (_nd.idxGeom_ >= 0) { + final ZModeleGeom md=(ZModeleGeom)((ZCalqueAffichageDonneesAbstract)_nd.getUserObject()).modeleDonnees(); + _dest.add(md.getGeomData().getGeometry(_nd.idxGeom_)); + } else if (((BCalque) _nd.getUserObject()).isGroupeCalque()) { + final BCalque[] cqs = ((BCalque) _nd.getUserObject()).getTousCalques(); + if (cqs != null) { + for (int i = cqs.length - 1; i >= 0; i--) { + fillWithLayerGeometries(_dest, cqs[i]); + } + } + + } else { + fillWithLayerGeometries(_dest, (BCalque) _nd.getUserObject()); + } + + } + + private void fillWithLayerGeometries(final List<Geometry> _dest, final BCalque _cq) { + if (_cq instanceof ZCalqueAffichageDonneesAbstract) { + final GISZoneCollection collec = ((ZModeleGeom)((ZCalqueAffichageDonneesAbstract)_cq).modeleDonnees()).getGeomData(); + final GISVisitorGeometryCollector visitor = new GISVisitorGeometryCollector(finder_.getMask()); + collec.accept(visitor); + _dest.addAll(visitor.getGeometries()); + } + } + + void addLayer(final LayerNode _parent, final BGroupeCalque _gc) { + final BCalque[] cq = _gc.getCalques(); + if (CtuluLibArray.isEmpty(cq)) { + return; + } + for (int i = 0; i < cq.length; i++) { + final LayerNode node = new LayerNode(cq[i]); + if (finder_.isMatching(cq[i])) { + _parent.add(node); + addGeometries(node, (ZCalqueAffichageDonneesAbstract) cq[i]); + } + else if (cq[i].isGroupeCalque() && containsGeometries(cq[i])) { + _parent.add(node); + addLayer(node, (BGroupeCalque) cq[i]); + } + } + } + + void addGeometries(final LayerNode _parent, final ZCalqueAffichageDonneesAbstract _cq) { + final GISZoneCollection collec = ((ZModeleGeom)_cq.modeleDonnees()).getGeomData(); + final GISAttributeModelObjectInterface nameAtt = (GISAttributeModelObjectInterface) collec.getModel(GISAttributeConstants.TITRE); + final int nb = collec.getNumGeometries(); + for (int i = 0; i < nb; i++) { + chooser_.clear(); + ((GISGeometry) collec.getGeometry(i)).accept(chooser_); + + boolean badd=false; + String name=null; + if (chooser_.isMultiPoint() && (finder_.getMask()&GISLib.MASK_MULTIPOINT)!=0) { + badd=true; + name="Multipoint {0}"; + } +// else if (chooser_.isPt() && (finder_.getMask()&GISLib.MASK_POINT)!=0) { +// badd=true; +// name="Point {0}"; +// } + else if (chooser_.isPolyligne() && (finder_.getMask()&GISLib.MASK_POLYLINE)!=0) { + badd=true; + name="Ligne ouverte {0}"; + } + else if (chooser_.isPolygone() && (finder_.getMask()&GISLib.MASK_POLYGONE)!=0) { + badd=true; + name="Ligne ferm\xE9e {0}"; + } + + if (badd) { + if (nameAtt!=null) + name=(String)nameAtt.getValue(i); + else + name=EbliLib.getS(name, CtuluLibString.getString(i+1)); + _parent.add(new LayerNode(_cq, i, name)); + } + } + } + + public void update(final Observable _o, final Object _arg) { + buildTree(); + } + + /** + * Filtre sur les g\xE9om\xE9tries. Par defaut, toutes g\xE9om\xE9tries. + */ + public void setMask(int _mask) { + finder_.setMask(_mask); + buildTree(); + } + + /** + * Creation d'une vue pour le modele. + */ + public JTree createView(final boolean _onlyGeomSelected, final boolean _multiSelection) { + final JTree tree = new JTree(this); + tree.setEditable(false); + tree.setShowsRootHandles(true); + tree.setExpandsSelectedPaths(true); + tree.setCellRenderer(new CellRenderer(_onlyGeomSelected)); + tree.setRootVisible(false); + tree.setFocusable(true); + if (_onlyGeomSelected) { + final TreeSelectionModel onlyGeomSelectionModel = new OnlyGeomTreeSelectionModel(); + tree.setSelectionModel(onlyGeomSelectionModel); + } + + if (_multiSelection) + tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); + else + tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + + return tree; + } + +} Property changes on: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2008-08-12 15:47:33 UTC (rev 3786) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2008-08-12 15:48:58 UTC (rev 3787) @@ -52,19 +52,19 @@ * @return True si trouv\xE9. */ public boolean isMatching(final BCalque _cq) { - if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0) { - return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; + if (_cq instanceof ZCalqueMultiPoint && (mask_&GISLib.MASK_MULTIPOINT)!=0) { + return ((ZCalqueMultiPoint)_cq).modeleDonnees().getNombre() > 0; } - else if (_cq instanceof ZCalqueMultiPoint && (mask_&GISLib.MASK_MULTIPOINT)!=0) { - return ((ZCalqueMultiPoint) _cq).modeleDonnees().getNombre() > 0; - } +// else if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0) { +// return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; +// } else if (_cq instanceof ZCalqueLigneBrisee && (mask_&GISLib.MASK_POLYLINE)!=0) { boolean bok=((ZCalqueLigneBrisee) _cq).modeleDonnees().getNombre() > 0; - return bok && (!((ZCalqueLigneBrisee) _cq).containsPolygone()); + return bok && ((ZCalqueLigneBrisee)_cq).getModele().getNbLigneBrisee()!=0; } else if (_cq instanceof ZCalqueLigneBrisee && (mask_&GISLib.MASK_POLYGONE)!=0) { - boolean bok=((ZCalqueLigneBrisee) _cq).modeleDonnees().getNombre() > 0; - return bok && ((ZCalqueLigneBrisee) _cq).containsPolygone(); + boolean bok=((ZCalqueLigneBrisee)_cq).modeleDonnees().getNombre() > 0; + return bok && ((ZCalqueLigneBrisee)_cq).getModele().getNbPolygone()!=0; } return false; } Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindComponentPolygone.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindComponentPolygone.java 2008-08-12 15:47:33 UTC (rev 3786) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindComponentPolygone.java 2008-08-12 15:48:58 UTC (rev 3787) @@ -27,10 +27,12 @@ import com.memoire.bu.BuVerticalLayout; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ebli.calque.BGroupeCalque; +import org.fudaa.ebli.calque.CalqueGISTreeModel; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel.LayerNode; +import org.fudaa.ebli.calque.CalqueGISTreeModel.LayerNode; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.find.EbliFindComponent; @@ -39,7 +41,7 @@ * @version $Id: CalqueFindComponentPolygone.java,v 1.2 2007-05-04 13:49:46 deniger Exp $ */ public class CalqueFindComponentPolygone implements EbliFindComponent { - private final CalqueFindCourbeTreeModel model_; + private final CalqueGISTreeModel model_; TreeSelectionModel selection_; JPanel pn_; BuComboBox cb_; @@ -49,8 +51,8 @@ } public CalqueFindComponentPolygone(final BGroupeCalque _cqRoot) { - model_ = new CalqueFindCourbeTreeModel(null, _cqRoot); - model_.setOnlyLigneFerme(true); + model_ = new CalqueGISTreeModel(null, _cqRoot); + model_.setMask(GISLib.MASK_POLYGONE); cb_ = new BuComboBox(new String[] { EbliLib.getS("Tous les sommets sont s\xE9lectionn\xE9s"), EbliLib.getS("Au moins un sommet est s\xE9lectionn\xE9"), EbliLib.getS("le barycentre est s\xE9lectionn\xE9"), @@ -61,7 +63,7 @@ if (pn_ == null) { pn_ = new BuPanel(new BuBorderLayout(0, 5)); pn_.setBorder(BuBorders.EMPTY3333); - final JTree tree = CalqueFindCourbeTreeModel.createCalqueTree(model_, false); + final JTree tree = model_.createView(false, true); selection_ = tree.getSelectionModel(); final BuScrollPane sc = new BuScrollPane(tree); sc.setPreferredHeight(80); @@ -86,7 +88,7 @@ final List res = new ArrayList(20); final TreePath[] paths = selection_.getSelectionPaths(); for (int i = paths.length - 1; i >= 0; i--) { - ((LayerNode) paths[i].getLastPathComponent()).fillWithPolygone(res); + model_.fillWithGeometries(((LayerNode) paths[i].getLastPathComponent()), res); } return res.toArray(new LinearRing[res.size()]); } Deleted: branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2008-08-12 15:47:33 UTC (rev 3786) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ebli/src/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2008-08-12 15:48:58 UTC (rev 3787) @@ -1,331 +0,0 @@ -/* - * @creation 21 nov. 06 - * @modification $Date: 2007-05-04 13:49:46 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ebli.calque.find; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.util.ArrayList; -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.DefaultTreeSelectionModel; -import javax.swing.tree.TreeCellRenderer; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; - -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibArray; -import org.fudaa.ctulu.CtuluLibString; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISAttributeModelObjectInterface; -import org.fudaa.ctulu.gis.GISGeometry; -import org.fudaa.ctulu.gis.GISLib; -import org.fudaa.ctulu.gis.GISVisitorChooser; -import org.fudaa.ctulu.gis.GISVisitorLigneCollector; -import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.ctulu.gui.CtuluCellRenderer; -import org.fudaa.ctulu.image.CtuluLibImage; - -import org.fudaa.ebli.calque.BArbreCalqueModel; -import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.calque.BGroupeCalque; -import org.fudaa.ebli.calque.CalqueGeometryVisitor; -import org.fudaa.ebli.calque.ZCalqueLigneBrisee; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.ressource.EbliResource; - -/** - * Une classe permettant d'avoir un TreeModel repr\xE9sentant les calques contentant des lignes bris\xE9es et les lignes - * bris\xE9es Il est possible d'avoir que les calques contenant des lignes ferm\xE9es. Ce mod\xE8le est automatiquement mis a - * jour si une instance de l'arbre des calque lui est fourni. - * - * @author fred deniger - * @version $Id: CalqueFindCourbeTreeModel.java,v 1.5 2007-05-04 13:49:46 deniger Exp $ - */ -public class CalqueFindCourbeTreeModel implements Observer { - - final BGroupeCalque rootLayer_; - LayerNode rootNode_; - boolean onlyLigneFerme_; - final CalqueGeometryVisitor finder_ = new CalqueGeometryVisitor(GISLib.MASK_POLYLINE|GISLib.MASK_POLYGONE); - - public static class CellRenderer extends JLabel implements TreeCellRenderer { - final Color selectedBackground_ = UIManager.getColor("Tree.selectionBackground"); - final Color selectedForground_ = UIManager.getColor("Tree.selectionForeground"); - final Border focusBorderColor_ = BorderFactory.createLineBorder(UIManager.getColor("Tree.selectionBorderColor"), 1); - final boolean onlyLineSelectable_; - - public CellRenderer(final boolean _onlyLineSelectable) { - this.setOpaque(true); - setPreferredSize(new Dimension(120, 25)); - onlyLineSelectable_ = _onlyLineSelectable; - } - - protected boolean isSelectable(final Object _value, final boolean _leaf) { - if (onlyLineSelectable_) { - if (!_leaf) { - return false; - } - final LayerNode node = (LayerNode) _value; - return node.idxPoly_ >= 0; - } - return true; - - } - - public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected, - final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) { - this.setFont(_tree.getFont()); - setIcon(((LayerNode) _value).getIcon()); - setText(_value.toString()); - final boolean selectable = isSelectable(_value, _leaf); - if (_selected && selectable) { - setBackground(selectedBackground_); - setForeground(selectedForground_); - } else { - setBackground(_tree.getBackground()); - setForeground(_tree.getForeground()); - } - if (selectable) { - setToolTipText(getText()); - } else { - setToolTipText(getText() + ": " + CtuluLib.getS("Non s\xE9lectionnable")); - } - setBorder((selectable && _hasFocus) ? focusBorderColor_ : CtuluCellRenderer.BORDER_NO_FOCUS); - setEnabled(_tree.isEnabled()); - return this; - } - } - - public static CellRenderer createRenderer(final boolean _selectOnlyLeaf) { - return new CellRenderer(_selectOnlyLeaf); - - } - - public static TreeSelectionModel getOnlyCourbeSelectionModel() { - return new OnlyCourbeTreeSelectionModel(); - } - - public static class OnlyCourbeTreeSelectionModel extends DefaultTreeSelectionModel { - - public void setSelectionPaths(final TreePath[] _paths) { - super.setSelectionPaths(getCorrectPaths(_paths)); - } - - public void addSelectionPaths(final TreePath[] _paths) { - super.addSelectionPaths(getCorrectPaths(_paths)); - } - - private TreePath[] getCorrectPaths(final TreePath[] _paths) { - TreePath[] paths = _paths; - if (!CtuluLibArray.isEmpty(_paths)) { - final List correctPath = new ArrayList(paths.length); - for (int i = 0; i < paths.length; i++) { - if (paths[i] != null && paths[i].getLastPathComponent() != null - && ((LayerNode) paths[i].getLastPathComponent()).idxPoly_ >= 0) { - correctPath.add(paths[i]); - } - } - if (correctPath.size() != paths.length) { - paths = (TreePath[]) correctPath.toArray(new TreePath[correctPath.size()]); - } - } - return paths; - } - - } - - public static class LayerNode extends DefaultMutableTreeNode { - - int idxPoly_ = -1; - String titre_; - final Icon icon_; - - public LayerNode(final BCalque _userObject) { - super(_userObject, true); - icon_ = CtuluLibImage.resize(_userObject, 16, 16); - } - - public LayerNode(final ZCalqueLigneBrisee _userObject, final int _idx, final String _titre) { - super(_userObject, false); - idxPoly_ = _idx; - titre_ = _titre; - if (_userObject.getModele().isGeometryFermee(_idx)) { - icon_ = EbliResource.EBLI.getIcon("draw-polygon"); - } else { - icon_ = EbliResource.EBLI.getIcon("draw-polyline"); - } - } - - public void fillWithPolygone(final List _dest) { - - if (idxPoly_ >= 0) { - final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) userObject; - if (cq.getModele().isGeometryFermee(idxPoly_)) { - _dest.add(cq.getModele().getGeomData().getGeometry(idxPoly_)); - } - } else if (((BCalque) userObject).isGroupeCalque()) { - final BCalque[] cqs = ((BCalque) userObject).getTousCalques(); - if (cqs != null) { - for (int i = cqs.length - 1; i >= 0; i--) { - addPolygones(_dest, cqs[i]); - } - } - - } else { - addPolygones(_dest, (BCalque) userObject); - } - - } - - private void addPolygones(final List _dest, final BCalque _cq) { - if (_cq instanceof ZCalqueLigneBrisee) { - final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) _cq; - final GISVisitorLigneCollector visitor = new GISVisitorLigneCollector(true); - cq.getModele().getGeomData().accept(visitor); - _dest.addAll(visitor.getPolygones()); - } - } - - public String toString() { - if (titre_ != null) { - return titre_; - } - return ((BCalque) userObject).getTitle(); - } - - public Icon getIcon() { - return icon_; - } - - public int getIdxPoly() { - return idxPoly_; - } - - } - - DefaultTreeModel treeModel_; - - public CalqueFindCourbeTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) { - super(); - rootLayer_ = _root; - if (_model != null) { - _model.getObservable().addObserver(this); - } - - rootNode_ = new LayerNode(rootLayer_); - treeModel_ = new DefaultTreeModel(rootNode_); - buildTree(); - } - - public final void buildTree() { - rootNode_.removeAllChildren(); - addLayer(rootNode_, rootLayer_); - treeModel_.setRoot(null); - treeModel_.setRoot(rootNode_); - - } - - protected boolean containsLigne(final BCalque _cq) { - finder_.resetFound(); - _cq.apply(finder_); - return finder_.isFound(); - } - - void addLayer(final LayerNode _parent, final BGroupeCalque _gc) { - final BCalque[] cq = _gc.getCalques(); - if (CtuluLibArray.isEmpty(cq)) { - return; - } - for (int i = 0; i < cq.length; i++) { - final LayerNode node = new LayerNode(cq[i]); - if (finder_.isMatching(cq[i])) { - _parent.add(node); - addLigne(node, (ZCalqueLigneBrisee) cq[i]); - } else if (cq[i].isGroupeCalque() && containsLigne(cq[i])) { - _parent.add(node); - addLayer(node, (BGroupeCalque) cq[i]); - } - - } - - } - - GISVisitorChooser chooser_ = new GISVisitorChooser(); - - void addLigne(final LayerNode _parent, final ZCalqueLigneBrisee _brisee) { - final GISZoneCollectionLigneBrisee collec = (GISZoneCollectionLigneBrisee) _brisee.getModele().getGeomData(); - final GISAttributeModelObjectInterface str = (GISAttributeModelObjectInterface) collec - .getModel(GISAttributeConstants.TITRE); - final int nb = collec.getNumGeometries(); - for (int i = 0; i < nb; i++) { - chooser_.clear(); - ((GISGeometry) collec.getGeometry(i)).accept(chooser_); - if (chooser_.isPolygone() || (chooser_.isPolyligne() && !onlyLigneFerme_)) { - String titre = null; - if (str != null) { - titre = (String) str.getValue(i); - } else if (chooser_.isPolygone()) { - titre = EbliLib.getS("Ligne ferm\xE9e {0}", CtuluLibString.getString(i + 1)); - } else { - titre = EbliLib.getS("Ligne ouverte {0}", CtuluLibString.getString(i + 1)); - } - _parent.add(new LayerNode(_brisee, i, titre)); - } - } - - } - - public void update(final Observable _o, final Object _arg) { - buildTree(); - } - - public boolean isOnlyLigneFerme() { - return onlyLigneFerme_; - } - - public void setOnlyLigneFerme(final boolean _onlyLigneFerme) { - onlyLigneFerme_ = _onlyLigneFerme; - int mask=GISLib.MASK_POLYGONE; - if (!_onlyLigneFerme) mask|=GISLib.MASK_POLYLINE; - finder_.setMask(mask); - buildTree(); - } - - public TreeModel getTreeModel() { - return treeModel_; - } - - public static JTree createCalqueTree(final CalqueFindCourbeTreeModel _treeModel, final boolean _onlyCourbeSelected) { - final JTree tree = new JTree(_treeModel.getTreeModel()); - tree.setEditable(false); - tree.setShowsRootHandles(true); - tree.setExpandsSelectedPaths(true); - tree.setCellRenderer(createRenderer(_onlyCourbeSelected)); - tree.setRootVisible(false); - tree.setFocusable(true); - if (_onlyCourbeSelected) { - final TreeSelectionModel onlyCourbeSelectionModel = getOnlyCourbeSelectionModel(); - onlyCourbeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - tree.setSelectionModel(onlyCourbeSelectionModel); - } - return tree; - } - -} Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-08-12 15:47:33 UTC (rev 3786) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-08-12 15:48:58 UTC (rev 3787) @@ -36,15 +36,16 @@ import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; +import org.fudaa.ebli.calque.CalqueGISTreeModel; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.fudaa.commun.FudaaLib; @@ -53,12 +54,13 @@ public class MvProfileBuilderFromTree extends MvProfileBuilder { final LineString initSelected_; - final CalqueFindCourbeTreeModel lineTreeModel_; + final CalqueGISTreeModel lineTreeModel_; public MvProfileBuilderFromTree(final MvProfileTarget _data, final CtuluUI _ui, final LineString _selected, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { super(_data, _ui, _panel, _tester); - lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _panel.getDonneesCalque()); + lineTreeModel_ = new CalqueGISTreeModel(null, _panel.getDonneesCalque()); + lineTreeModel_.setMask(GISLib.MASK_POLYLINE|GISLib.MASK_POLYGONE); initSelected_ = _selected; } @@ -66,23 +68,23 @@ if (_tree.isSelectionEmpty()) { return null; } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() + final CalqueGISTreeModel.LayerNode node = (CalqueGISTreeModel.LayerNode) _tree.getSelectionPath() .getLastPathComponent(); final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); - return (LineString) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + return (LineString) cq.getModele().getGeomData().getGeometry(node.getIdxGeom()); } String getSelectedLineTitle(final JTree _tree) { if (_tree.isSelectionEmpty()) { return null; } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() + final CalqueGISTreeModel.LayerNode node = (CalqueGISTreeModel.LayerNode) _tree.getSelectionPath() .getLastPathComponent(); return node.toString(); } protected JTree buildTree() { - return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); + return lineTreeModel_.createView(true,false); } protected void intersectTest(final JDialog _d, final MvExportChooseVarAndTime _var, final ProgressionInterface _prog) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2008-08-12 15:47:25
|
Revision: 3786 http://fudaa.svn.sourceforge.net/fudaa/?rev=3786&view=rev Author: fargeix Date: 2008-08-12 15:47:33 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Connexion au serveur sinavi Modified Paths: -------------- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/sinavi3/Sinavi3Implementation.java Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/sinavi3/Sinavi3Implementation.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/sinavi3/Sinavi3Implementation.java 2008-08-12 15:46:15 UTC (rev 3785) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/sinavi3/Sinavi3Implementation.java 2008-08-12 15:47:33 UTC (rev 3786) @@ -2371,56 +2371,64 @@ final String os = System.getProperty("os.name"); final String path = cheminServeur(); + final SParametresSinavi32 par = (SParametresSinavi32)projet_.getParam("parametres"); + int graineEnCours=par.donneesGenerales.graine; + int dureeEnCours = par.donneesGenerales.nombreJours; System.out.println("**\nLe chemin des serveurs est:\n "+path+" \n**"); try { String[] cmd; if (os.startsWith("Windows")) { - cmd = new String[2]; - if(progFortran==0) - cmd[0] = path + "bin" + "\\win\\sinaviGenarr_win.exe"; - else - cmd[0] = path + "bin" + "\\win\\sinavi_win.exe"; - // cmd[1] = path + "bin" + "\\win\\"; - cmd[1] = nomEtude; + cmd = new String[4]; + if(progFortran==0) + cmd[0] = path + "bin" + "\\win\\sinaviGenarr_win.exe"; + else + cmd[0] = path + "bin" + "\\win\\sinavi_win.exe"; + + // cmd[1] = path + "bin" + "\\win\\"; + cmd[1] = nomEtude; + cmd[2]= Integer.toString(dureeEnCours); + cmd[3]= Integer.toString(graineEnCours); } else { - // System.out.println("* yo 2 *"); - cmd = new String[2]; - if(progFortran==0) - cmd[0] = path + "bin" + "/linux/sinaviGenarr_linux.x"; - else - cmd[0] = path + "bin" + "/linux/sinavi_linux.x"; - //cmd[1] = path + "bin" + "/linux/"; - cmd[1] = nomEtude; - } + // System.out.println("* yo 2 *"); + cmd = new String[2]; + if(progFortran==0) + cmd[0] = path + "bin" + "/linux/sinaviGenarr_linux.x"; + else + cmd[0] = path + "bin" + "/linux/sinavi_linux.x"; + //cmd[1] = path + "bin" + "/linux/"; + cmd[1] = nomEtude; + cmd[2]= Integer.toString(dureeEnCours); + cmd[3]= Integer.toString(graineEnCours); + } System.out.println("**\nLa commande ex\xE9cut\xE9e est: \n "+cmd[0] + " " + cmd[1] +"\n**"); - - + + try { - final CExec ex = new CExec(); - ex.setCommand(cmd); - ex.setOutStream(System.out); - ex.setErrStream(System.err); - ex.exec(); + final CExec ex = new CExec(); + ex.setCommand(cmd); + ex.setOutStream(System.out); + ex.setErrStream(System.err); + ex.exec(); } catch (final Throwable _e1) { - System.out.println("Erreur rencontr\xE9e lors de l'execution du code de calcul"); - _e1.printStackTrace(); - new BuDialogError(this.getApp(),isSinavi_,"Erreur rencontr\xE9e lors de l'execution du code de calcul").activate(); - return false; + System.out.println("Erreur rencontr\xE9e lors de l'execution du code de calcul"); + _e1.printStackTrace(); + new BuDialogError(this.getApp(),isSinavi_,"Erreur rencontr\xE9e lors de l'execution du code de calcul").activate(); + return false; } } catch (final Exception ex) { - System.out.println("Erreur lors de l'execution du code de calcul"); - if(progFortran==0) - new BuDialogMessage(this.getApp(),isSinavi_,"Impossible d'executer le g\xE9n\xE9rateur de navire genarr").activate(); - else - new BuDialogMessage(this.getApp(),isSinavi_,"Impossible d'executer le noyau de calcul Sinavi").activate(); - return false; + System.out.println("Erreur lors de l'execution du code de calcul"); + if(progFortran==0) + new BuDialogMessage(this.getApp(),isSinavi_,"Impossible d'executer le g\xE9n\xE9rateur de navire genarr").activate(); + else + new BuDialogMessage(this.getApp(),isSinavi_,"Impossible d'executer le noyau de calcul Sinavi").activate(); + return false; } - - return true; + + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |