From: <had...@us...> - 2008-08-06 14:53:02
|
Revision: 3715 http://fudaa.svn.sourceforge.net/fudaa/?rev=3715&view=rev Author: hadouxad Date: 2008-08-06 14:53:07 +0000 (Wed, 06 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 mise en forme des donnees - ajout des nodes pour les elements - implementation dans EbliScene Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliEdge.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/EbliScene.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/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliEdge.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliEdge.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliEdge.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,5 @@ +package org.fudaa.ebli.visuallibrary; + +public interface EbliEdge { + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliEdge.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java 2008-08-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -1,166 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Dimension; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JComponent; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.PopupMenuProvider; -import org.netbeans.api.visual.graph.GraphScene; -import org.netbeans.api.visual.widget.LayerWidget; -import org.netbeans.api.visual.widget.Widget; - - -/** - * clqsse de gestion de la scene principale - * @author Adrien Hadoux - * - */ -public class EbliGraphScene extends GraphScene{ - - /** - * la visu du graphscene - */ - private LayerWidget visu_; - - public EbliGraphScene() { - super(); - - // creation du layer de mise en page - visu_ = new LayerWidget(this); - addChild(visu_); - - //-- ajoute l'action du zoom ( ctrl + clic) - getActions ().addAction (ActionFactory.createCenteredZoomAction (1.1)); - - //-- ajouter le menu popup de base - setMenuBase(); - - } - - public LayerWidget getVisu_() { - return visu_; - } - - public void setVisu_(LayerWidget visu_) { - this.visu_ = visu_; - } - - @Override - protected void attachEdgeSourceAnchor(Object edge, Object oldSourceNode, - Object sourceNode) { - // TODO Auto-generated method stub - - } - - @Override - protected void attachEdgeTargetAnchor(Object edge, Object oldTargetNode, - Object targetNode) { - // TODO Auto-generated method stub - - } - - @Override - protected Widget attachEdgeWidget(Object edge) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected Widget attachNodeWidget(Object node) { - // TODO Auto-generated method stub - return null; - } - - /** - * methode qui permet d'ajouter une widget dans la vue principale - */ - public void addWidget(EbliWidget widget){ - - addWidget(widget, null,null); - - } - - public void addWidget(EbliWidget widget,Point preferredLocation, Dimension preferedSize){ - - if(preferedSize!=null){ - widget.setPreferredSize(preferedSize); - } - if(preferredLocation !=null){ - widget.setPreferredLocation(preferredLocation); - } - - getVisu_().addChild(widget); - - - } - - - /** - * recupere une version miniature de la vue aui se rafraichit simultanement avec la scene - * @return - */ - public JComponent getSatteliteView(){ - return this.createSatelliteView(); - } - - /** - * retourne la vue Jcomponent associ\xE9 - * Utile pour l'integration dans les components existants - */ - public JComponent getSwingView(){ - return this.getView(); - } - - public void setMenuBase() { - getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { - public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu (); - - - - JMenuItem menuItem1=popup.add ("Ajouter Graphe"); - menuItem1.addActionListener(new ActionListener(){ - - public void actionPerformed(ActionEvent e) { - - - } - - }); - - JMenuItem menuItem2=popup.add ("Ajouter Maillage"); - menuItem2.addActionListener(new ActionListener(){ - - public void actionPerformed(ActionEvent e) { - - - } - - }); - - JMenuItem menuItem3=popup.add ("Fermer l'objet"); - menuItem3.addActionListener(new ActionListener(){ - - public void actionPerformed(ActionEvent e) { - - //fermeture des widgets children - EbliGraphScene.this.removeChildren(); - //fermeture du widget donne - EbliGraphScene.this.removeFromParent(); - - } - - }); - return popup; - } - })); - } - - - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,18 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.util.Map; + +public interface EbliNode { + String getTitle(); + + EbliWidgetCreator getCreator(); + + Dimension getPreferedDimension(); + + EbliNode duplicate(Map options); + + Point getLocation(); + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,56 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.util.Map; + +public class EbliNodeDefault implements EbliNode { + EbliWidgetCreator creator; + Point p; + Dimension d; + String title; + public String getTitle() { + return title; + } + + + + public EbliNode duplicate(Map options) { + // TODO Auto-generated method stub + return null; + } + + + + public void setTitle(String title) { + this.title = title; + } + + public void setP(Point p) { + this.p = p; + } + + public void setD(Dimension d) { + this.d = d; + } + + + + public void setCreator(EbliWidgetCreator creator) { + this.creator = creator; + } + + public EbliWidgetCreator getCreator() { + return creator; + } + + public Point getLocation() { + return p; + } + + public Dimension getPreferedDimension() { + // TODO Auto-generated method stub + return d; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java (from rev 3714, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,185 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JComponent; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.courbe.EGGraphe; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.graph.GraphScene; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.general.IconNodeWidget; +import org.netbeans.modules.visual.layout.OverlayLayout; + +/** + * classe de gestion de la scene principale + * + * @author Adrien Hadoux + * + */ +public class EbliScene extends GraphScene<EbliNode, EbliEdge> { + + /** + * la visu du graphscene + */ + private LayerWidget visu_; + + public EbliScene() { + super(); + + // creation du layer de mise en page + visu_ = new LayerWidget(this); + addChild(visu_); + + // -- ajoute l'action du zoom ( ctrl + clic) + getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + + // -- ajouter le menu popup de base + setMenuBase(); + + } + + public LayerWidget getVisu_() { + return visu_; + } + + public void setVisu_(LayerWidget visu_) { + this.visu_ = visu_; + } + @Override + protected void notifyNodeAdded(EbliNode node, Widget widget) { +// node.widgetCreated((EbliWidget)widget); + } + + + + @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; + } + + @Override + protected Widget attachNodeWidget(EbliNode node ) { + + //-- creation de la widget ici --// + EbliWidget res= node.getCreator().create(this); + + //-- remplissage des proprietes + res.setPreferredLocation(node.getLocation()); + res.setPreferredSize(node.getPreferedDimension()); + + //-- ajout dans la vue layer --// + visu_.addChild(res); + + return res; + } + + /** + * methode qui permet d'ajouter une widget dans la vue principale + */ + public void addWidget(EbliWidget widget) { + + addWidget(widget, null, null); + + } + + public void addWidget(EbliWidget widget, Point preferredLocation, + Dimension preferedSize) { + + if (preferedSize != null) { + widget.setPreferredSize(preferedSize); + } + if (preferredLocation != null) { + widget.setPreferredLocation(preferredLocation); + } + + getVisu_().addChild(widget); + + } + + /** + * recupere une version miniature de la vue aui se rafraichit simultanement + * avec la scene + * + * @return + */ + public JComponent getSatteliteView() { + return this.createSatelliteView(); + } + + /** + * retourne la vue Jcomponent associ\xE9 Utile pour l'integration dans les + * components existants + */ + public JComponent getSwingView() { + return this.getView(); + } + + public void setMenuBase() { + getActions().addAction( + ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, + Point localLocation) { + JPopupMenu popup = new JPopupMenu(); + + JMenuItem menuItem1 = popup.add("Ajouter Graphe"); + menuItem1.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + } + + }); + + JMenuItem menuItem2 = popup.add("Ajouter Maillage"); + menuItem2.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + } + + }); + + JMenuItem menuItem3 = popup.add("Fermer l'objet"); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + // fermeture des widgets children + EbliScene.this.removeChildren(); + // fermeture du widget donne + EbliScene.this.removeFromParent(); + + } + + }); + return popup; + } + })); + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -8,6 +8,7 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluResource; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.border.Border; @@ -21,96 +22,134 @@ /** * Widget version EBLI - * @author genesis + * @author Adrien Hadoux * */ class EbliWidget extends Widget { + + private static final Border RESIZE_BORDER = BorderFactory.createResizeBorder(8,Color.blue.brighter().brighter(),true); + private static final Border DEFAULT_BORDER =BorderFactory.createEmptyBorder(8); - private static final Border RESIZE_BORDER = BorderFactory.createResizeBorder(8,Color.blue.brighter().brighter(),true); - private static final Border DEFAULT_BORDER =BorderFactory.createEmptyBorder(8); - /** - * @param scene - * @param Point : indiaue la location preferentiel. peut etre nul - */ - public EbliWidget(Scene scene, Point preferredLocation) { - super(scene); - getActions().addAction( ActionFactory.createResizeAction()); + private EbliScene scene_; + + public EbliScene getScene_() { + return scene_; + } + + public void setScene_(EbliScene scene_) { + this.scene_ = scene_; + } + + /** + * @param scene + * @param Point : indiaue la location preferentiel. peut etre nul + */ + public EbliWidget(EbliScene scene) { + super(scene); + setScene_(scene); + getActions().addAction( ActionFactory.createResizeAction()); getActions().addAction(ActionFactory.createMoveAction()); - getActions().addAction(scene.createWidgetHoverAction());//a voir pour que le parent soit - //aussi en hover : a voir apr\xE8s. - - setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); - - // positionnement de la widget si precise - if(preferredLocation!=null) - setPreferredLocation(preferredLocation); - - //menu clic droit basique (fermeture, duplication) - setMenuBase(); - } + getActions().addAction(scene.createWidgetHoverAction()); + getActions().addAction( scene.createSelectAction()); - @Override - public void notifyStateChanged(ObjectState previousState, ObjectState newState) { - LookFeel lookFeel = getScene().getLookFeel(); - - // setBorder(lookFeel.getMiniBorder(newState)); - - - setBorder( newState.isSelected() ? ( - newState.isHovered() ? RESIZE_BORDER : DEFAULT_BORDER) : ( - newState.isHovered() ? RESIZE_BORDER : DEFAULT_BORDER)); - } + setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); - - /** - * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base - * on ouvre le menu via le clic droit ou le raccourcis shift+F10 - */ - - public void setMenuBase() { - getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { - public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu (); - - JMenuItem menuItem1=popup.add ("Dupliquer l'objet"); - menuItem1.addActionListener(new ActionListener(){ + // positionnement de la widget si precise +// if(preferredLocation!=null) +// setPreferredLocation(preferredLocation); - public void actionPerformed(ActionEvent e) { - - //position a cote de l element initial - Point nouvellePosition=new Point((int)(EbliWidget.this.getLocation().x+EbliWidget.this.getClientArea().width/2),(int)(EbliWidget.this.getLocation().y+EbliWidget.this.getClientArea().height/2)); - - EbliWidget duplique; - - try { - //clonage de l'objet - duplique=(EbliWidget)EbliWidget.this.clone(); - duplique.setPreferredSize(EbliWidget.this.getScene().getPreferredSize()); - - } catch (CloneNotSupportedException e1) { - // TODO que fqire si cq pete? une peite fenetre d'erreur, widget pas duplicable? ou alors surcharger la methode dans les filles? - e1.printStackTrace(); - } + //menu clic droit basique (fermeture, duplication) + setMenu(); + } + + @Override + public void notifyStateChanged(ObjectState previousState, ObjectState newState) { + LookFeel lookFeel = getScene().getLookFeel(); + + // setBorder(lookFeel.getMiniBorder(newState)); + + + setBorder( newState.isSelected() ? ( + newState.isHovered() ? RESIZE_BORDER : lookFeel.getMiniBorder(newState)) : ( + newState.isHovered() ? RESIZE_BORDER : lookFeel.getMiniBorder(newState))); + } + + + /** + * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base + * on ouvre le menu via le clic droit ou le raccourcis shift+F10 + */ + + public void setMenu() { + getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { + public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu (); + + //-- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); + + + return popup; + } + })); + } + + + /** + * Methode de construction des menus de base + * @param _popup + */ + public void constructPopupMenuBase(JPopupMenu _popup){ + JMenuItem menuItem1=_popup.add ("Dupliquer l'objet"); + menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); + menuItem1.addActionListener(new ActionListener(){ + + public void actionPerformed(ActionEvent e) { + + //position a cote de l element initial + Point nouvellePosition=new Point((int)(EbliWidget.this.getLocation().x+EbliWidget.this.getClientArea().width/2),(int)(EbliWidget.this.getLocation().y+EbliWidget.this.getClientArea().height/2)); + + EbliWidget duplique; + + try { + //clonage de l'objet + duplique=(EbliWidget)EbliWidget.this.clone(); + duplique.setPreferredSize(EbliWidget.this.getScene().getPreferredSize()); + duplique.setPreferredLocation(nouvellePosition); + + //-- ajout dans la scene --// + if(EbliWidget.this.getScene()!=null){ + EbliWidget.this.getScene().addChild(duplique); } - - }); - JMenuItem menuItem2=popup.add ("Fermer l'objet"); - menuItem2.addActionListener(new ActionListener(){ + + } catch (CloneNotSupportedException e1) { + // TODO que fqire si ca pete? une peite fenetre d'erreur, widget pas duplicable? ou alors surcharger la methode dans les filles? + e1.printStackTrace(); + } + } - public void actionPerformed(ActionEvent e) { - - //fermeture des widgets children - EbliWidget.this.removeChildren(); - //fermeture du widget donne - EbliWidget.this.removeFromParent(); - - } - - }); - return popup; - } - })); - } - + }); + JMenuItem menuItem2=_popup.add ("Fermer l'objet"); + menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem2.addActionListener(new ActionListener(){ + + public void actionPerformed(ActionEvent e) { + + EbliWidget.this.setVisible(false); + + // NE PAS DECOCHER CES ELEMENTS + //fermeture des widgets children + //EbliWidget.this.removeChildren(); + //fermeture du widget donne + //EbliWidget.this.removeFromParent(); + + + } + + }); + } + + + } \ No newline at end of file Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,11 @@ +package org.fudaa.ebli.visuallibrary; + + +public interface EbliWidgetCreator { + + EbliWidget create(EbliScene _scene); + +// void widgetCreated(EbliWidget w); + //void nodeRemoved(); + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,30 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGGraphe; +/** + * interface qui permet de creer un widget + * @author genesis + * + */ +public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { + + EGGraphe g; + + public EbliWidgetCreatorGraphe(EGGraphe g) { + super(); + this.g = g; + } + + public EbliWidget create(EbliScene _scene) { + // TODO Auto-generated method stub + // creation de la widget correspondante + EbliWidgetGraphe res= new EbliWidgetGraphe(_scene, null, g); + + // ajout des listener d ecoute du graphe + new EbliWidgetGrapheController(res); + + return res; + } + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,26 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGGraphe; + +public class EbliWidgetCreatorLegende implements EbliWidgetCreator { + + EGGraphe g; + + public EbliWidgetCreatorLegende(EGGraphe g) { + super(); + this.g = g; + } + + public EGGraphe getG() { + return g; + } + + public void setG(EGGraphe g) { + this.g = g; + } + + public EbliWidget create(EbliScene _scene) { + return WidgetLegendeManager.createLegende(g, _scene, null); + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,19 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.calque.BVueCalque; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; + +public class EbliWidgetCreatorVue2d implements EbliWidgetCreator { + + ZEbliCalquesPanel calque; + + public EbliWidgetCreatorVue2d(ZEbliCalquesPanel calque) { + super(); + this.calque = calque; + } + + public EbliWidget create(EbliScene _scene) { + return new EbliWidgetVue2D(_scene, calque); + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java (from rev 3714, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,146 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.courbe.EGAxe; +import org.fudaa.ebli.courbe.EGConfigureActionPalette; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGObject; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.laf.LookFeel; +import org.netbeans.api.visual.model.ObjectState; +import org.netbeans.api.visual.widget.Widget; + +import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; + + +/** + * widget qui contient un objet graphe + * @author adrien hadoux + * + */ +public class EbliWidgetGraphe extends EbliWidget{ + + private EGGraphe graphe; + private EbliNodeDefault nodeLegende=null; + + public EGGraphe getGraphe() { + return graphe; + } + + public void setGraphe(EGGraphe graphe) { + this.graphe = graphe; + } + + public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { + super(scene); + // TODO Auto-generated constructor stub + setGraphe(_graphe); + + + } + + public void notifyStateChanged(ObjectState previousState, + ObjectState newState) { + LookFeel lookFeel = getScene().getLookFeel(); + + setBorder(lookFeel.getBorder(newState)); + + + } + + protected void paintWidget() { + Rectangle rec = getClientArea(); + + // BufferedImage image = courbe.produceImage( + // rec.width - 1, rec.height - 1, + // Collections.EMPTY_MAP); + getGraphics().translate(rec.x, rec.y); + graphe.setSize(rec.width - 1, + rec.height - 1); + graphe.computeMarges(getGraphics()); + graphe.dessine(getGraphics(), rec.width - 1, + rec.height - 1, false ); + } + + + + /** + * Surcharge de la creation du menu de base en ajoutant les menus specifiques + */ + public void setMenu() { + getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { + public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu (); + + //-- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); + + //-- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + return popup; + } + })); + } + + /** + * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende + * @param _popup + */ + private void constructPopupMenuSpecifique(JPopupMenu _popup){ + + + + JMenuItem menuItem=_popup.add ("Ajouter la l\xE9gende"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.addActionListener(new ActionListener(){ + + public void actionPerformed(ActionEvent e) { + + //-- creation de la l\xE9gende --// + if(EbliWidgetGraphe.this.getScene_()!=null){ + + //position a cote de la widget graphe + Point nouvellePosition=new Point((int)(EbliWidgetGraphe.this.getLocation().x),(int)(EbliWidgetGraphe.this.getLocation().y+EbliWidgetGraphe.this.getBounds().height*1.2)); + + //getScene_().addChild(new EbliWidget(getScene_(),null)); + //addChild (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), GrapheWidget.this.getScene_(),null)); + if(nodeLegende==null){ + + //-- creation d'un node legende --// + nodeLegende = new EbliNodeDefault(); + + nodeLegende.setCreator(new EbliWidgetCreatorLegende(getGraphe())); + nodeLegende.setP(nouvellePosition); + nodeLegende.setD(new Dimension(100, 100)); + EbliWidgetGraphe.this.getScene_().addNode(nodeLegende); + + //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe.this.getGraphe(), EbliWidgetGraphe.this.getScene_(),nouvellePosition); + + } + + //GrapheWidget.this.addChild(widgetLegende); + } + } + + }); + + + //-- creation du menu config de la courbe + _popup.add(new EGConfigureActionPalette(graphe.getModel())); + + + + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,42 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGAxe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGObject; + +public class EbliWidgetGrapheController implements EGGrapheModelListener { + EbliWidgetGraphe w; + + public EbliWidgetGrapheController(EbliWidgetGraphe w) { + super(); + this.w = w; + } + + public void structureChanged() { + w.repaint(); + + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + w.repaint(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + // graphe.paint(); + w.repaint(); + // TODO Auto-generated method stub + + } + + public void axeContentChanged(EGAxe _c) { + w.repaint(); + + } + + public void axeAspectChanged(EGAxe _c) { + w.repaint(); + + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java (from rev 3714, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,58 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; + +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; +import org.netbeans.api.visual.widget.Scene; + + +/** + * Legende + * Widget qui contient le trac\xE9 de la ligne de la l\xE9gende courbe + * @author genesis + * + */ +public class EbliWidgetLine extends EbliWidget { + + EGCourbe cb_; + + /** + * @param _scene + */ + public EbliWidgetLine(EbliScene _scene, EGCourbe _cb, Point preferedLocation) { + super(_scene); + cb_ = _cb; + setMinimumSize(new Dimension(30, 10)); + setPreferredSize(new Dimension(40, 10)); + + setEnabled(false); + + } + + /** + * + */ + @Override + protected void paintWidget() { + Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); + g.translate(rec.x, rec.y); + //la ligne + TraceLigne l = new TraceLigne(cb_.getLigneModel()); + l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); + //l'icone + TraceIconModel icm = new TraceIconModel(cb_.getIconModel()); + icm.setTaille(Math.min(rec.width / 2, rec.height));//a voir + TraceIcon ic = new TraceIcon(icm); + ic.paintIconCentre(g, rec.width / 2, rec.height / 2); + g.translate(-rec.x, -rec.y); + } + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java (from rev 3714, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,91 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Point; + +import org.fudaa.ebli.courbe.EGCourbe; +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.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.layout.FlowLayout; + + + +/** + * Legende + * Widget qui contient le titre de la ligne de la l\xE9gende courbe + * @author genesis + * + */ +public class EbliWidgetTitle extends EbliWidget implements TextFieldInplaceEditor{ + + EGCourbe cb_; + + LabelWidget intern; + + /** + * @param _scene + */ + public EbliWidgetTitle(EbliScene _scene, EGCourbe _cb,Point preferedLocation) { + super(_scene); + setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); + intern = new LabelWidget(_scene); + intern.setForeground(_cb.getAspectContour()); + addChild(intern); + setCourbe(_cb); + + //-- ajouter l option de remplacer le text dans le label --// + + //-- creation de l action --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction (this); + + //-- ajout de l action au label correspondant --// + intern.getActions ().addAction (editorAction); + + setEnabled(false); + } + + public void majLabel(){ + intern.setForeground(cb_.getAspectContour()); + intern.setLabel(cb_.getTitle()); + } + + + /** + * @return the cb_ + */ + public EGCourbe getCourbe() { + return cb_; + } + + /** + * @param _cb the cb_ to set + */ + public void setCourbe(EGCourbe _cb) { + this.cb_ = _cb; + if (cb_ != null) { + intern.setLabel(cb_.getTitle()); + } + } + + public String getText(Widget widget) { + return ((LabelWidget) widget).getLabel (); + } + + public boolean isEnabled(Widget widget) { + // TODO Auto-generated method stub + return true; + } + + public void setText(Widget widget, String text) { + ((LabelWidget) widget).setLabel (text); + cb_.setTitle(text); + } + + + + +} \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -0,0 +1,34 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.util.Collections; + +import org.fudaa.ebli.calque.BVueCalque; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; + +public class EbliWidgetVue2D extends EbliWidget { + + ZEbliCalquesPanel vue_; + + public EbliWidgetVue2D(EbliScene scene, ZEbliCalquesPanel vue) { + super(scene); + vue_ = vue; + // TODO Auto-generated constructor stub + } + + @Override + protected void paintWidget() { + Rectangle rec = getClientArea(); + Graphics2D g = getGraphics(); + + g.translate(rec.x, rec.y); + vue_.setSize(rec.width, rec.height); + vue_.restaurer(); + vue_.paint(g); + // TODO Auto-generated method stub + super.paintWidget(); + g.translate(-rec.x, -rec.y); + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java 2008-08-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -1,104 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Point; -import java.awt.Rectangle; - -import org.fudaa.ebli.courbe.EGAxe; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.courbe.EGGrapheModelListener; -import org.fudaa.ebli.courbe.EGObject; -import org.netbeans.api.visual.laf.LookFeel; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.Scene; - - -/** - * widget aui contient un objet courbe - * @author adrien hadoux - * - */ -public class GrapheWidget extends EbliWidget{ - - private EGGraphe graphe; - - public EGGraphe getGraphe() { - return graphe; - } - - public void setGraphe(EGGraphe graphe) { - this.graphe = graphe; - } - - public GrapheWidget(Scene scene, Point preferredLocation, EGGraphe _graphe) { - super(scene, preferredLocation); - // TODO Auto-generated constructor stub - setGraphe(_graphe); - - - //prise en compte du listener d'\xE9coute des modif du graphe - listenGraphe(); - - } - - 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)); - - } - - protected void paintWidget() { - Rectangle rec = getClientArea(); - - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - getGraphics().translate(rec.x, rec.y); - graphe.setSize(rec.width - 1, - rec.height - 1); - graphe.computeMarges(getGraphics()); - graphe.dessine(getGraphics(), rec.width - 1, - rec.height - 1, false ); - } - - /** - * methode aui permet d ajouter les fonctions de redessin du graphe - */ - private void listenGraphe(){ - graphe.getModel().addModelListener(new EGGrapheModelListener() { - - public void structureChanged() { - repaint(); - - } - - public void courbeContentChanged(EGObject _c, boolean restore) { - repaint(); - - } - - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - //graphe.paint(); - repaint(); - // TODO Auto-generated method stub - - } - - public void axeContentChanged(EGAxe _c) { - repaint(); - - } - - public void axeAspectChanged(EGAxe _c) { - repaint(); - - } - }); - } -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java 2008-08-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -1,53 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigne; -import org.netbeans.api.visual.widget.Scene; - - -/** - * Legende - * Widget qui contient le trac\xE9 de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class LineWidget extends EbliWidget { - - EGCourbe cb_; - - /** - * @param _scene - */ - public LineWidget(Scene _scene, EGCourbe _cb, Point preferedLocation) { - super(_scene,preferedLocation); - cb_ = _cb; - setMinimumSize(new Dimension(30, 10)); - setPreferredSize(new Dimension(40, 10)); - } - - /** - * - */ - @Override - protected void paintWidget() { - Graphics2D g = getGraphics(); - Rectangle rec = getClientArea(); - g.translate(rec.x, rec.y); - //la ligne - TraceLigne l = new TraceLigne(cb_.getLigneModel()); - l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); - //l'icone - TraceIconModel icm = new TraceIconModel(cb_.getIconModel()); - icm.setTaille(Math.min(rec.width / 2, rec.height));//a voir - TraceIcon ic = new TraceIcon(icm); - ic.paintIconCentre(g, rec.width / 2, rec.height / 2); - g.translate(-rec.x, -rec.y); - } -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java 2008-08-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -1,59 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Point; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.modules.visual.layout.FlowLayout; - - -/** - * Legende - * Widget qui contient le titre de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class TitleWidget extends EbliWidget { - - EGCourbe cb_; - - LabelWidget intern; - - /** - * @param _scene - */ - public TitleWidget(Scene _scene, EGCourbe _cb,Point preferedLocation) { - super(_scene,preferedLocation); - setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); - intern = new LabelWidget(_scene); - intern.setForeground(_cb.getAspectContour()); - addChild(intern); - setCourbe(_cb); - } - - public void majLabel(){ - intern.setForeground(cb_.getAspectContour()); - intern.setLabel(cb_.getTitle()); - } - - - /** - * @return the cb_ - */ - public EGCourbe getCourbe() { - return cb_; - } - - /** - * @param _cb the cb_ to set - */ - public void setCourbe(EGCourbe _cb) { - this.cb_ = _cb; - if (cb_ != null) { - intern.setLabel(cb_.getTitle()); - } - } - -} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-05 15:42:58 UTC (rev 3714) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-06 14:53:07 UTC (rev 3715) @@ -43,6 +43,7 @@ import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.layout.OverlayLayout; /** * @author denf01a adrien hadoux @@ -61,20 +62,22 @@ * @param PreferredLocation peut etre null * @return */ - public static EbliWidget createLegende(EGGraphe g, Scene scene, Point PreferredLocation) { - EGCourbe[] cs = g.getModel().getCourbes(); - final EbliWidget res = new EbliWidget(scene,PreferredLocation); - res.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 10));// a modifier pour setter le gap + public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene,final Point PreferredLocation) { + final EGCourbe[] cs = g.getModel().getCourbes(); + final EbliWidget res = new EbliWidget(scene); + res.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 5));// a modifier pour setter le gap + //res.setLayout(new OverlayLayout()); for (int i = 0; i < cs.length; i++) { - final EbliWidget line = new EbliWidget(scene,PreferredLocation); - line.setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); - + final EbliWidget line = new EbliWidget(scene); + line.setLayout(new FlowLayout(false, SerialAlignment.JUSTIFY, 5)); + //creation de la widget titre - final TitleWidget tw=new TitleWidget(scene, cs[i],null); + final EbliWidgetTitle tw=new EbliWidgetTitle(scene, cs[i],null); //creation de la widget ligne - LineWidget lw=new LineWidget(scene, cs[i],null); - + EbliWidgetLine lw=new EbliWidgetLine(scene, cs[i],null); + + lw.setEnabled(false); line.addChild(lw); line.addChild(tw); res.addChild(line); @@ -114,6 +117,8 @@ } + + return res; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |