From: <de...@us...> - 2008-08-06 21:58:27
|
Revision: 3721 http://fudaa.svn.sourceforge.net/fudaa/?rev=3721&view=rev Author: deniger Date: 2008-08-06 21:58:30 +0000 (Wed, 06 Aug 2008) Log Message: ----------- maj test sur les widgets 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/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.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-06 21:57:43 UTC (rev 3720) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-06 21:58:30 UTC (rev 3721) @@ -55,25 +55,24 @@ public void setVisu_(LayerWidget visu_) { this.visu_ = visu_; } + @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { -// node.widgetCreated((EbliWidget)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 @@ -83,18 +82,19 @@ } @Override - protected Widget attachNodeWidget(EbliNode node ) { - - //-- creation de la widget ici --// - EbliWidget res= node.getCreator().create(this); - - //-- remplissage des proprietes + 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 --// + if (node.getPreferedDimension() != null) + res.setPreferredSize(node.getPreferedDimension()); + + // -- ajout dans la vue layer --// visu_.addChild(res); - + return res; } 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-06 21:57:43 UTC (rev 3720) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-06 21:58:30 UTC (rev 3721) @@ -19,139 +19,152 @@ import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; - /** * Widget version EBLI + * * @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); - - private EbliScene scene_; - - public EbliScene getScene_() { - return scene_; - } + private EbliScene scene_; - public void setScene_(EbliScene scene_) { - this.scene_ = 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 + * @param Point + * : indiaue la location preferentiel. peut etre nul */ public EbliWidget(EbliScene scene) { super(scene); setScene_(scene); - getActions().addAction( ActionFactory.createResizeAction()); + getActions().addAction(ActionFactory.createResizeAction()); getActions().addAction(ActionFactory.createMoveAction()); getActions().addAction(scene.createWidgetHoverAction()); - //getActions().addAction( scene.createSelectAction()); + // getActions().addAction( scene.createSelectAction()); - setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); + setBorder(DEFAULT_BORDER); // positionnement de la widget si precise -// if(preferredLocation!=null) -// setPreferredLocation(preferredLocation); + // if(preferredLocation!=null) + // setPreferredLocation(preferredLocation); - //menu clic droit basique (fermeture, duplication) + // menu clic droit basique (fermeture, duplication) setMenu(); } @Override - public void notifyStateChanged(ObjectState previousState, ObjectState newState) { + 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))); + if (!newState.isHovered() || !newState.isSelected()) { + setBorder(DEFAULT_BORDER); + return; + } + 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 + * 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 (); + 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; - } - })); + // -- 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"); + public void constructPopupMenuBase(JPopupMenu _popup) { + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); - menuItem1.addActionListener(new ActionListener(){ + 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)); + // 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()); + // 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){ + + // -- ajout dans la scene --// + if (EbliWidget.this.getScene() != null) { EbliWidget.this.getScene().addChild(duplique); } - + } 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? + // TODO que fqire si ca pete? une peite fenetre d'erreur, + // widget pas duplicable? ou alors surcharger la methode + // dans les filles? e1.printStackTrace(); } } }); - JMenuItem menuItem2=_popup.add ("Fermer l'objet"); + JMenuItem menuItem2 = _popup.add("Fermer l'objet"); menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem2.addActionListener(new ActionListener(){ + menuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EbliWidget.this.setVisible(false); - EbliNode n=(EbliNode)EbliWidget.this.getScene_().findObject(EbliWidget.this); + EbliNode n = (EbliNode) EbliWidget.this.getScene_().findObject( + EbliWidget.this); EbliWidget.this.getScene_().removeNode(n); - + // NE PAS DECOCHER CES ELEMENTS - //fermeture des widgets children - //EbliWidget.this.removeChildren(); - //fermeture du widget donne - //EbliWidget.this.removeFromParent(); - + // fermeture des widgets children + // EbliWidget.this.removeChildren(); + // fermeture du widget donne + // EbliWidget.this.removeFromParent(); } }); } - - } \ 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-06 21:57:43 UTC (rev 3720) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-06 21:58:30 UTC (rev 3721) @@ -1,7 +1,8 @@ package org.fudaa.ebli.visuallibrary; - +import java.awt.Color; import java.awt.Graphics2D; +import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; @@ -17,84 +18,100 @@ import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.layout.OverlayLayout; - - /** - * Legende - * Widget qui permet de construire des rectangles avec du texte + * Legende Widget qui permet de construire des rectangles avec du texte + * * @author Adrien Hadoux - * + * */ -public class EbliWidgetRectangle extends EbliWidget implements TextFieldInplaceEditor{ +public class EbliWidgetRectangle extends EbliWidget implements + TextFieldInplaceEditor { - + LabelWidget intern; + Insets inGaps_; + int largeurBorder = 15; + int espaceInterieur = 5; - LabelWidget intern; + /** + * @param _scene + */ + public EbliWidgetRectangle(EbliScene _scene, String label) { + super(_scene); + inGaps_ = new Insets(largeurBorder + espaceInterieur, largeurBorder + + espaceInterieur, largeurBorder + espaceInterieur, + largeurBorder + espaceInterieur); + // Ce layout permet de placer le texte + setLayout(new OverlayLayoutGap(inGaps_)); + intern = new LabelWidget(_scene); + intern.setVerticalAlignment(VerticalAlignment.CENTER); + intern.setLabel(label); - /** - * @param _scene - */ - public EbliWidgetRectangle(EbliScene _scene, String label) { - super(_scene); - setLayout(new FlowLayout(true, SerialAlignment.CENTER, 23)); - intern = new LabelWidget(_scene); - intern.setLabel(label); - - addChild(intern); - - //-- 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); - - intern.getActions ().addAction( ActionFactory.createResizeAction()); - - - //setEnabled(false); - } - - public void majLabel(String label){ - //intern.setForeground(); - intern.setLabel(label); - } - + addChild(intern); - protected void paintWidget() { - Graphics2D g = getGraphics(); - Rectangle rec = getClientArea(); - g.translate(rec.x, rec.y); - //la ligne - - TraceLigne l = new TraceLigne(); - l.setEpaisseur(5); - //l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); - l.dessineRectangle(g, 0, 0, rec.width, rec.height); - g.translate(-rec.x, -rec.y); - } + // -- 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); + intern.getActions().addAction(ActionFactory.createResizeAction()); + // setEnabled(false); + } + + public void majLabel(String label) { + // intern.setForeground(); + intern.setLabel(label); + revalidate(); + } + + @Override + protected Rectangle calculateClientArea() { + Rectangle res = intern.getPreferredBounds(); + // TODO Auto-generated method stub + return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) + + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); + } + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + g.translate(rec.x, rec.y); + // la ligne + + TraceLigne l = new TraceLigne(); + + 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); + g.setColor(Color.RED); + g.draw(getBounds()); + g.draw(getClientArea()); + } + public String getText(Widget widget) { - return ((LabelWidget) widget).getLabel (); + return ((LabelWidget) widget).getLabel(); } public boolean isEnabled(Widget widget) { // TODO Auto-generated method stub - return true; + return true; } public void setText(Widget widget, String text) { - ((LabelWidget) widget).setLabel (text); - + ((LabelWidget) widget).setLabel(text); + revalidate(); + } - - - } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java 2008-08-06 21:58:30 UTC (rev 3721) @@ -0,0 +1,62 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; + +import org.netbeans.api.visual.layout.Layout; +import org.netbeans.api.visual.widget.Widget; + +public class OverlayLayoutGap implements Layout { + + Insets inGaps_; + + public OverlayLayoutGap(Insets _inGaps) { + super(); + inGaps_ = _inGaps; + } + + public void layout(Widget widget) { + Dimension total = new Dimension(); + for (Widget child : widget.getChildren()) { + if (!child.isVisible()) + continue; + Dimension size = child.getPreferredBounds().getSize(); + if (size.width > total.width) + total.width = size.width; + if (size.height > total.height) + total.height = size.height; + } + total.width -= inGaps_.left + inGaps_.right; + total.height -= inGaps_.top + inGaps_.bottom; + for (Widget child : widget.getChildren()) { + Point location = child.getPreferredBounds().getLocation(); + child.resolveBounds(new Point(-location.x+inGaps_.left, -location.y+inGaps_.top), + new Rectangle(location, total)); + } + } + + public boolean requiresJustification(Widget widget) { + return true; + } + + public void justify(Widget widget) { + Rectangle clientArea = widget.getClientArea(); + clientArea.x+=inGaps_.left; + clientArea.y+=inGaps_.top; + clientArea.width -= inGaps_.left + inGaps_.right; + clientArea.height -= inGaps_.top + inGaps_.bottom; + for (Widget child : widget.getChildren()) { + if (child.isVisible()) { + Point location = child.getPreferredBounds().getLocation(); + child.resolveBounds(new Point(clientArea.x - location.x, + clientArea.y - location.y), new Rectangle(location, + clientArea.getSize())); + } else { + child.resolveBounds(clientArea.getLocation(), new Rectangle()); + } + } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-07 21:44:15
|
Revision: 3735 http://fudaa.svn.sourceforge.net/fudaa/?rev=3735&view=rev Author: deniger Date: 2008-08-07 21:44:21 +0000 (Thu, 07 Aug 2008) Log Message: ----------- Mise en place lookandfeel maj auto de la vue 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/EbliWidget.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/EbliWidgetTitle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.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/graphe/EbliWidgetGrapheController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManagerOLD.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/layout/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/layout/OverlayLayoutGap.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/ 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/EbliCheckBoxTreeRenderer.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 Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.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/EbliWidgetJXTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,102 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.JCheckBox; -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 com.memoire.bu.BuCheckBox; -/** - * Editeur dans le tree - * @author Adrien Hadoux - * - */ -public class EbliCheckBoxNodeEditor extends AbstractCellEditor implements TreeCellEditor { - - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); - - ChangeEvent changeEvent = null; - - EbliWidgetJXTree tree; - - public EbliCheckBoxNodeEditor(EbliWidgetJXTree tree) { - this.tree = tree; - } - - public Object getCellEditorValue() { - JCheckBox checkbox = renderer.getLeafRenderer(); - // 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 JCheckBox) { - 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 - ((JCheckBox) editor).addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent event) { - - //-- on rend visible la widget en fonction de la checkbox - node.getCreator().getWidget().setVisible(((JCheckBox) editor).isSelected()); - - - } - }); - - } - - - - - - return editor; - } - } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,98 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; - -import javax.swing.JCheckBox; -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeCellRenderer; - -import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; - -public class EbliCheckBoxTreeRenderer implements TreeCellRenderer { - private JCheckBox leafRenderer = new JCheckBox(); - - private DefaultTreeCellRenderer nonLeafRenderer = new DefaultTreeCellRenderer(); - - Color selectionBorderColor, selectionForeground, selectionBackground, - textForeground, textBackground; - - protected JCheckBox getLeafRenderer() { - return leafRenderer; - } - - public EbliCheckBoxTreeRenderer() { - /*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) { - - Component returnValue; - if (leaf) { - - - //-- recuperation du node --// - Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - - - EbliNodeDefault node=null; - if (userObject instanceof EbliNode) { - node= (EbliNodeDefault)(((DefaultMutableTreeNode)value).getUserObject()); - - System.err.println("PS EbliNode!!! ROW: "+row); - - //-- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque composant - leafRenderer=new JCheckBox(); - - leafRenderer.setText(node.getTitle()); - leafRenderer.setSelected(node.getCreator().getWidget().isVisible()); - } - else{ - System.err.println("TROP NULLLLLLLLLLLLLLLLLLL!!!"); - } - // qccessible en fonction du tree - leafRenderer.setEnabled(tree.isEnabled()); - - /* // foreground si selectionne ou non - if (leafRenderer.isSelected()) { - leafRenderer.setForeground(selectionForeground); - leafRenderer.setBackground(selectionBackground); - } else { - leafRenderer.setForeground(textForeground); - leafRenderer.setBackground(textBackground); - } -*/ - - - - returnValue = leafRenderer; - - } else { - returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, - value, selected, expanded, leaf, row, hasFocus); - } - return returnValue; - } - - - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -0,0 +1,46 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Color; + +import org.netbeans.api.visual.border.Border; +import org.netbeans.api.visual.border.BorderFactory; +import org.netbeans.api.visual.model.ObjectState; +import org.netbeans.modules.visual.laf.DefaultLookFeel; + +public class EbliLookFeel extends DefaultLookFeel { + + private static final Color COLOR_HOVERED = new Color(0x447BCD); + private static final Color COLOR_SELECTED = COLOR_HOVERED.brighter(); + private static final int MINI_THICKNESS = 8; + private static final Border MINI_BORDER_SELECTED = BorderFactory.createRoundedBorder(MINI_THICKNESS, MINI_THICKNESS, + MINI_THICKNESS, MINI_THICKNESS, COLOR_SELECTED, COLOR_SELECTED.darker()); + + private static final Border RESIZE_BORDER = BorderFactory.createResizeBorder(MINI_THICKNESS, COLOR_HOVERED, true); + private static final Border RESIZE_BORDER_SELECTED = BorderFactory.createCompositeBorder(BorderFactory + .createRoundedBorder(0, 0, 0, 0, COLOR_SELECTED, COLOR_HOVERED), RESIZE_BORDER); + private static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder(8); + + public Border getBorder(ObjectState _state) { + return getBorder(_state, true); + } + + public Border getBorder(ObjectState _state, boolean resizable) { + if (resizable) { + if (_state.isHovered()) { + if (_state.isSelected()) { + return RESIZE_BORDER_SELECTED; + } + return RESIZE_BORDER; + } + if (_state.isSelected()) { + return MINI_BORDER_SELECTED; + } + + } else { + // a continuer pour le cas non retaillable + + } + + return DEFAULT_BORDER; + } +} 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-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,28 +1,21 @@ package org.fudaa.ebli.visuallibrary; -import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; import java.util.Iterator; -import java.util.List; -import java.util.Set; -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.action.WidgetAction; 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 @@ -32,212 +25,169 @@ */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { - /** - * la visu du graphscene - */ - private LayerWidget visu_; + /** + * la visu du graphscene + */ + private LayerWidget visu_; - - /** - * la liste des listener associes a la scene - */ - List<EbliNodeListener> listenerList ; - - public EbliScene() { - super(); + private LayerWidget interactionLayer_; + final private WidgetAction alignWithMoveAction; - // creation du layer de mise en page - visu_ = new LayerWidget(this); - addChild(visu_); + /** + * la liste des listener associes a la scene + */ + Collection<EbliNodeListener> listenerList; - // -- ajoute l'action du zoom ( ctrl + clic) - getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + public EbliScene() { + super(); + setLookFeel(new EbliLookFeel()); + // creation du layer de mise en page + visu_ = new LayerWidget(this); + addChild(visu_); + interactionLayer_ = new LayerWidget(this); + addChild(interactionLayer_); + alignWithMoveAction = ActionFactory.createAlignWithMoveAction(visu_, interactionLayer_, ActionFactory + .createDefaultAlignWithMoveDecorator(),false); - // -- ajouter le menu popup de base - setMenuBase(); - + // -- ajoute l'action du zoom ( ctrl + clic) + getActions().addAction(ActionFactory.createZoomAction(1.1, true)); - } + // -- ajouter le menu popup de base + setMenuBase(); - public LayerWidget getVisu_() { - return visu_; - } + } - public void setVisu_(LayerWidget visu_) { - this.visu_ = visu_; - } + /** + * Methode qui permet d ajouter un listener + * + * @param listener + */ + public void addEbliNodeListener(EbliNodeListener listener) { + // init si necessaire + if (listenerList == null) + listenerList = new HashSet<EbliNodeListener>(); + // ajout + listenerList.add(listener); + } - @Override - protected void notifyNodeAdded(EbliNode node, Widget widget) { - //-- notifier tous les listener que le noeud a ete attache --// - notifyAllListenerNodeAdded(node); - } + @Override + protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { + // TODO Auto-generated method stub - @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 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 attachEdgeWidget(EbliEdge edge) { - // TODO Auto-generated method stub - return null; - } + @Override + protected Widget attachNodeWidget(EbliNode node) { - @Override - protected Widget attachNodeWidget(EbliNode node) { + // -- creation de la widget ici --// + EbliWidget res = node.getCreator().create(this); - // -- creation de la widget ici --// - EbliWidget res = node.getCreator().create(this); + // -- remplissage des proprietes + res.setPreferredLocation(node.getLocation()); + if (node.getPreferedDimension() != null) + res.setPreferredSize(node.getPreferedDimension()); - // -- remplissage des proprietes - res.setPreferredLocation(node.getLocation()); - if (node.getPreferedDimension() != null) - res.setPreferredSize(node.getPreferedDimension()); + // -- ajout dans la vue layer --// + visu_.addChild(res); - // -- ajout dans la vue layer --// - visu_.addChild(res); - - + return res; + } - return res; - } + public LayerWidget getLayerVisu() { + return visu_; + } - /** - * methode qui permet d'ajouter une widget dans la vue principale - */ - public void addWidget(EbliWidget widget) { + public WidgetAction getMoveAction() { + return alignWithMoveAction; + } - addWidget(widget, null, null); + /** + * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener + * + * @param listener + */ + public void notifyAllListenerNodeAdded(EbliNode node) { + if (listenerList == null) + return; + for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + it.next().nodeAdded(node); + } - } + } - public void addWidget(EbliWidget widget, Point preferredLocation, - Dimension preferedSize) { + /** + * Methode qui permet d envoyer le signal du node retir\xE9 a tous les listener + * + * @param listener + */ + public void notifyAllListenerNodeRemoved(EbliNode node) { + if (listenerList == null) + return; - if (preferedSize != null) { - widget.setPreferredSize(preferedSize); - } - if (preferredLocation != null) { - widget.setPreferredLocation(preferredLocation); - } + for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + EbliNodeListener listener = it.next(); + listener.noderemoved(node); + } - getVisu_().addChild(widget); + } - } + @Override + protected void notifyNodeAdded(EbliNode node, Widget widget) { + // -- notifier tous les listener que le noeud a ete attache --// + notifyAllListenerNodeAdded(node); + } - /** - * recupere une version miniature de la vue aui se rafraichit simultanement - * avec la scene - * - * @return - */ - public JComponent getSatteliteView() { - return this.createSatelliteView(); - } + public void setMenuBase() { + getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu(); - /** - * retourne la vue Jcomponent associ\xE9 Utile pour l'integration dans les - * components existants - */ - public JComponent getSwingView() { - return this.getView(); - } + JMenuItem menuItem1 = popup.add("Ajouter Graphe"); + menuItem1.addActionListener(new ActionListener() { - public void setMenuBase() { - getActions().addAction( - ActionFactory.createPopupMenuAction(new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, - Point localLocation) { - JPopupMenu popup = new JPopupMenu(); + public void actionPerformed(ActionEvent e) { - 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 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) { - JMenuItem menuItem3 = popup.add("Fermer l'objet"); - menuItem3.addActionListener(new ActionListener() { + // fermeture des widgets children + EbliScene.this.removeChildren(); + // fermeture du widget donne + EbliScene.this.removeFromParent(); - public void actionPerformed(ActionEvent e) { + } - // fermeture des widgets children - EbliScene.this.removeChildren(); - // fermeture du widget donne - EbliScene.this.removeFromParent(); + }); + return popup; + } + })); + } - } - - }); - return popup; - } - })); - } - - - /** - * Methode qui permet d ajouter un listener - * @param listener - */ - public void addEbliNodeListener(EbliNodeListener listener){ - // init si necessaire - if(listenerList==null) - listenerList= new ArrayList<EbliNodeListener>(); - //ajout - listenerList.add(listener); - } - - /** - * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener - * @param listener - */ - public void notifyAllListenerNodeAdded(EbliNode node){ - if(listenerList==null) - return; - - for(Iterator<EbliNodeListener> it=listenerList.iterator();it.hasNext();){ - EbliNodeListener listener=it.next(); - listener.nodeAdded(node); - } - - } - - /** - * Methode qui permet d envoyer le signal du node retir\xE9 a tous les listener - * @param listener - */ - public void notifyAllListenerNodeRemoved(EbliNode node){ - if(listenerList==null) - return; - - for(Iterator<EbliNodeListener> it=listenerList.iterator();it.hasNext();){ - EbliNodeListener listener=it.next(); - listener.noderemoved(node); - } - - } - - } 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-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -25,155 +25,140 @@ * @author Adrien Hadoux * */ -class EbliWidget extends Widget { +public 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 EbliScene scene_; + private boolean useBorder_ = true; - private EbliScene scene_; + /** + * @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 EbliScene getScene_() { - return scene_; - } + // positionnement de la widget si precise + // if(preferredLocation!=null) + // setPreferredLocation(preferredLocation); - public void setScene_(EbliScene scene_) { - this.scene_ = scene_; - } + // menu clic droit basique (fermeture, duplication) + setMenu(); + } - /** - * @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()); - // getActions().addAction( scene.createSelectAction()); + /** + * 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() { - setBorder(DEFAULT_BORDER); + public void actionPerformed(ActionEvent e) { - // positionnement de la widget si precise - // if(preferredLocation!=null) - // setPreferredLocation(preferredLocation); + // 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)); - // menu clic droit basique (fermeture, duplication) - setMenu(); - } + EbliWidget duplique; - @Override - public void notifyStateChanged(ObjectState previousState, - ObjectState newState) { - LookFeel lookFeel = getScene().getLookFeel(); + try { + // clonage de l'objet + duplique = (EbliWidget) EbliWidget.this.clone(); + duplique.setPreferredSize(EbliWidget.this.getScene().getPreferredSize()); + duplique.setPreferredLocation(nouvellePosition); - // setBorder(lookFeel.getMiniBorder(newState)); + // -- ajout dans la scene --// + if (EbliWidget.this.getScene() != null) { + EbliWidget.this.getScene().addChild(duplique); + } - if (!newState.isHovered() && !newState.isSelected()) { - setBorder(DEFAULT_BORDER); - return; - } - setBorder(newState.isSelected() ? (newState.isHovered() ? RESIZE_BORDER - : lookFeel.getMiniBorder(newState)) - : (newState.isHovered() ? RESIZE_BORDER : lookFeel - .getMiniBorder(newState))); - } + } 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(); + } + } - /** - * 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 - */ + }); + JMenuItem menuItem2 = _popup.add("Fermer l'objet"); + menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem2.addActionListener(new ActionListener() { - public void setMenu() { - getActions().addAction( - ActionFactory.createPopupMenuAction(new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, - Point localLocation) { - JPopupMenu popup = new JPopupMenu(); + public void actionPerformed(ActionEvent e) { - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); + // EbliWidget.this.setVisible(false); + EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); + EbliWidget.this.getEbliScene().removeNode(n); + EbliWidget.this.getEbliScene().getLayerVisu().removeChild(EbliWidget.this); - 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) { + JMenuItem menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem3.addActionListener(new ActionListener() { - // 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)); + public void actionPerformed(ActionEvent e) { - EbliWidget duplique; + EbliWidget.this.setVisible(false); - 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); - } + }); + } - } 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 EbliScene getEbliScene() { + return scene_; + } - }); - JMenuItem menuItem2 = _popup.add("Fermer l'objet"); - menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem2.addActionListener(new ActionListener() { + public boolean isUseBorder() { + return useBorder_; + } - public void actionPerformed(ActionEvent e) { + @Override + public void notifyStateChanged(ObjectState previousState, ObjectState newState) { + if (!useBorder_) { + return; + } + setBorder(getScene().getLookFeel().getBorder(newState)); + } - //EbliWidget.this.setVisible(false); - EbliNode n = (EbliNode) EbliWidget.this.getScene_().findObject( - EbliWidget.this); - EbliWidget.this.getScene_().removeNode(n); - EbliWidget.this.getScene_().getVisu_().removeChild(EbliWidget.this); - + /** + * 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(); - }); - - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem3.addActionListener(new ActionListener() { + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); - public void actionPerformed(ActionEvent e) { + return popup; + } + })); + } - EbliWidget.this.setVisible(false); - + public void setScene_(EbliScene scene_) { + this.scene_ = scene_; + } - } + public void setUseBorder(boolean _useBorder) { + useBorder_ = _useBorder; + } - }); - } - } \ No newline at end of file Deleted: 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 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,36 +0,0 @@ -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; - EbliWidgetGraphe res; - - public EbliWidgetCreatorGraphe(EGGraphe g) { - super(); - this.g = g; - } - - public EbliWidget create(EbliScene _scene) { - // TODO Auto-generated method stub - // creation de la widget correspondante - res= new EbliWidgetGraphe(_scene, null, g); - - // ajout des listener d ecoute du graphe - new EbliWidgetGrapheController(res); - - return res; - } - - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } - - -} Deleted: 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 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,32 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import org.fudaa.ebli.courbe.EGGraphe; - -public class EbliWidgetCreatorLegende implements EbliWidgetCreator { - - EGGraphe g; - EbliWidget res; - 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) { - res= WidgetLegendeManager.createLegende(g, _scene, null); - return res; - } - - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } - -} Deleted: 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 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,26 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import org.fudaa.ebli.calque.BVueCalque; -import org.fudaa.ebli.calque.ZEbliCalquesPanel; - -public class EbliWidgetCreatorVue2d implements EbliWidgetCreator { - - ZEbliCalquesPanel calque; - EbliWidgetVue2D res; - - public EbliWidgetCreatorVue2d(ZEbliCalquesPanel calque) { - super(); - this.calque = calque; - } - - public EbliWidget create(EbliScene _scene) { - res= new EbliWidgetVue2D(_scene, calque); - 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-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -17,6 +17,7 @@ import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; 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.ConnectProvider; import org.netbeans.api.visual.action.TextFieldInplaceEditor; Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,146 +0,0 @@ -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(!EbliWidgetGraphe.this.getScene_().isObject(nodeLegende)){ - - //-- 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())); - - - - } - -} Deleted: 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 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGrapheController.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,42 +0,0 @@ -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(); - - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,40 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreeModel; - -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/EbliWidgetJXTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,111 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -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; - - -/** - * 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 --// -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 - -} - - - -} 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-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,26 +1,18 @@ package org.fudaa.ebli.visuallibrary; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.Insets; -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.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.ConnectProvider; 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.api.visual.widget.LabelWidget.Alignment; import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; -import org.netbeans.modules.visual.layout.FlowLayout; -import org.netbeans.modules.visual.layout.OverlayLayout; /** * Legende Widget qui permet de construire des rectangles avec du texte @@ -50,6 +42,7 @@ intern = new LabelWidget(_scene); intern.setVerticalAlignment(VerticalAlignment.CENTER); + intern.setAlignment(Alignment.CENTER); intern.setLabel(label); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -7,6 +7,7 @@ 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.model.ObjectState; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; @@ -53,6 +54,10 @@ intern.setLabel(cb_.getTitle()); } +// @Override +// public void notifyStateChanged(ObjectState _previousState, ObjectState _newState) { +// } + /** * @return the cb_ Deleted: 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 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetVue2D.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,34 +0,0 @@ -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); - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/OverlayLayoutGap.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,62 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; - -import org.netbeans.api.visual.layout.Layout; -import org.netbeans.api.visual.widget.Widget; - -public class OverlayLayoutGap implements Layout { - - Insets inGaps_; - - public OverlayLayoutGap(Insets _inGaps) { - super(); - inGaps_ = _inGaps; - } - - public void layout(Widget widget) { - Dimension total = new Dimension(); - for (Widget child : widget.getChildren()) { - if (!child.isVisible()) - continue; - Dimension size = child.getPreferredBounds().getSize(); - if (size.width > total.width) - total.width = size.width; - if (size.height > total.height) - total.height = size.height; - } - total.width -= inGaps_.left + inGaps_.right; - total.height -= inGaps_.top + inGaps_.bottom; - for (Widget child : widget.getChildren()) { - Point location = child.getPreferredBounds().getLocation(); - child.resolveBounds(new Point(-location.x+inGaps_.left, -location.y+inGaps_.top), - new Rectangle(location, total)); - } - } - - public boolean requiresJustification(Widget widget) { - return true; - } - - public void justify(Widget widget) { - Rectangle clientArea = widget.getClientArea(); - clientArea.x+=inGaps_.left; - clientArea.y+=inGaps_.top; - clientArea.width -= inGaps_.left + inGaps_.right; - clientArea.height -= inGaps_.top + inGaps_.bottom; - for (Widget child : widget.getChildren()) { - if (child.isVisible()) { - Point location = child.getPreferredBounds().getLocation(); - child.resolveBounds(new Point(clientArea.x - location.x, - clientArea.y - location.y), new Rectangle(location, - clientArea.getSize())); - } else { - child.resolveBounds(clientArea.getLocation(), new Rectangle()); - } - } - } - -} Deleted: 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-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,127 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - - - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JFrame; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; - -import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; -import org.fudaa.ebli.courbe.EGAxe; -import org.fudaa.ebli.courbe.EGAxeHorizontal; -import org.fudaa.ebli.courbe.EGAxeVertical; -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.courbe.EGCourbeChild; -import org.fudaa.ebli.courbe.EGCourbeModelDefault; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.courbe.EGGrapheModelListener; -import org.fudaa.ebli.courbe.EGGrapheTreeModel; -import org.fudaa.ebli.courbe.EGGroup; -import org.fudaa.ebli.courbe.EGObject; -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.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.PopupMenuProvider; -import org.netbeans.api.visual.graph.GraphScene; -import org.netbeans.api.visual.laf.LookFeel; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.LayerWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.modules.visual.layout.FlowLayout; -import org.netbeans.modules.visual.layout.OverlayLayout; - -/** - * @author denf01a adrien hadoux - * @creation 5 ao\xFBt 2008 - * @version - * - */ -public class WidgetLegendeManager { - - - - /** - * Creation de la legende - * @param g - * @param scene - * @param PreferredLocation peut etre null - * @return - */ - 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); - line.setLayout(new FlowLayout(false, SerialAlignment.JUSTIFY, 5)); - - //creation de la widget titre - final EbliWidgetTitle tw=new EbliWidgetTitle(scene, cs[i],null); - - //creation de la widget ligne - EbliWidgetLine lw=new EbliWidgetLine(scene, cs[i],null); - - lw.setEnabled(false); - line.addChild(lw); - line.addChild(tw); - res.addChild(line); - - //-- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els l\xE9gendes --// - g.getModel().addModelListener(new EGGrapheModelListener() { - - public void structureChanged() { - line.repaint(); - tw.majLabel(); - - } - - public void courbeContentChanged(EGObject _c, boolean restore) { - line.repaint(); - tw.majLabel(); - - } - - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - line.repaint(); - tw.majLabel(); - - } - - public void axeContentChanged(EGAxe _c) { - line.repaint(); - tw.majLabel(); - } - - public void axeAspectChanged(EGAxe _c) { - line.repaint(); - tw.majLabel(); - } - }); - - } - - - - - return res; - } - - - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java 2008-08-07 21:26:39 UTC (rev 3734) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java 2008-08-07 21:44:21 UTC (rev 3735) @@ -1,184 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - - - -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.fudaa.ebli.courbe.EGAxe; -import org.fudaa.ebli.courbe.EGCourbe; -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.SelectProvider; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -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.LabelWidget; -import org.netbeans.api.visual.widget.LayerWidget; -import org.netbeans.api.visual.widget.Widget; - -import sun.awt.image.ToolkitImage; - - - -/** - * Classe qui g\xE9n\xE8re les l\xE9gendes de chacun des graphes - * - * - * @author Adrien Hadoux - * - */ - -public class WidgetLegendeManagerOLD { - - - 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(); - ... [truncated message content] |
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. |
From: <had...@us...> - 2008-08-07 13:56:07
|
Revision: 3725 http://fudaa.svn.sourceforge.net/fudaa/?rev=3725&view=rev Author: hadouxad Date: 2008-08-07 13:56:12 +0000 (Thu, 07 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 - les widget fleches directionnelle et bi directionnelle (a ameliorer) - les classes modeles et tree - les methodes de gestion des listener eblinodelistener pour la scene - la classe exemple testGraphe - exemple testgraphe pour voir le fonctionnement du lien tree scene Modified Paths: -------------- 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/EbliWidgetCreatorRectangle.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/EbliWidgetRectangle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.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/EbliWidgetJXTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java Modified: 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 2008-08-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -14,5 +14,7 @@ EbliNode duplicate(Map options); Point getLocation(); + + public String toString(); } 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-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -5,6 +5,8 @@ import java.util.Map; public class EbliNodeDefault implements EbliNode { + + EbliWidgetCreator creator; Point p; Dimension d; @@ -52,5 +54,10 @@ // TODO Auto-generated method stub return d; } + + public String toString() { + // TODO Auto-generated method stub + return title; + } } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,9 @@ +package org.fudaa.ebli.visuallibrary; + +public interface EbliNodeListener { + + void nodeAdded(EbliNode node); + + void noderemoved(EbliNode node); + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -4,6 +4,10 @@ import java.awt.Point; 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.JComponent; import javax.swing.JMenuItem; @@ -33,6 +37,12 @@ */ private LayerWidget visu_; + + /** + * la liste des listener associes a la scene + */ + List<EbliNodeListener> listenerList ; + public EbliScene() { super(); @@ -45,6 +55,7 @@ // -- ajouter le menu popup de base setMenuBase(); + } @@ -58,7 +69,8 @@ @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { - // node.widgetCreated((EbliWidget)widget); + //-- notifier tous les listener que le noeud a ete attache --// + notifyAllListenerNodeAdded(node); } @Override @@ -94,6 +106,8 @@ // -- ajout dans la vue layer --// visu_.addChild(res); + + return res; } @@ -181,5 +195,49 @@ } })); } + + + /** + * Methode qui permet d ajouter un listener + * @param listener + */ + public void addEbliNodeListener(EbliNodeListener listener){ + // init si necessaire + if(listenerList==null) + listenerList= new ArrayList<EbliNodeListener>(); + //ajout + listenerList.add(listener); + } + /** + * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener + * @param listener + */ + public void notifyAllListenerNodeAdded(EbliNode node){ + if(listenerList==null) + return; + + for(Iterator<EbliNodeListener> it=listenerList.iterator();it.hasNext();){ + EbliNodeListener listener=it.next(); + listener.nodeAdded(node); + } + + } + + /** + * Methode qui permet d envoyer le signal du node retir\xE9 a tous les listener + * @param listener + */ + public void notifyAllListenerNodeRemoved(EbliNode node){ + if(listenerList==null) + return; + + for(Iterator<EbliNodeListener> it=listenerList.iterator();it.hasNext();){ + EbliNodeListener listener=it.next(); + listener.noderemoved(node); + } + + } + + } 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-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -5,6 +5,8 @@ EbliWidget create(EbliScene _scene); + EbliWidget getWidget(); + // void widgetCreated(EbliWidget w); //void nodeRemoved(); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,36 @@ +package org.fudaa.ebli.visuallibrary; + +public class EbliWidgetCreatorDblFleche implements EbliWidgetCreator { + + + int orientation; + + EbliWidgetDBLFleche res; + + public EbliWidgetCreatorDblFleche(int orientation) { + super(); + this.orientation = orientation; + + } + + public int getG() { + return orientation; + } + + public void setG(int orientation) { + this.orientation = orientation; + } + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetDBLFleche(_scene, orientation); + + 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/EbliWidgetCreatorDblFleche.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,34 @@ +package org.fudaa.ebli.visuallibrary; + +public class EbliWidgetCreatorFleche implements EbliWidgetCreator { + + int orientation; + + EbliWidgetFleche res; + + public EbliWidgetCreatorFleche(int orientation) { + super(); + this.orientation = orientation; + + } + + public int getG() { + return orientation; + } + + public void setG(int orientation) { + this.orientation = orientation; + } + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetFleche(_scene, orientation); + + 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/EbliWidgetCreatorFleche.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: 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 2008-08-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorGraphe.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -9,6 +9,7 @@ public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { EGGraphe g; + EbliWidgetGraphe res; public EbliWidgetCreatorGraphe(EGGraphe g) { super(); @@ -18,7 +19,7 @@ public EbliWidget create(EbliScene _scene) { // TODO Auto-generated method stub // creation de la widget correspondante - EbliWidgetGraphe res= new EbliWidgetGraphe(_scene, null, g); + res= new EbliWidgetGraphe(_scene, null, g); // ajout des listener d ecoute du graphe new EbliWidgetGrapheController(res); @@ -26,5 +27,10 @@ return res; } + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + } Modified: 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 2008-08-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorLegende.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -5,7 +5,7 @@ public class EbliWidgetCreatorLegende implements EbliWidgetCreator { EGGraphe g; - + EbliWidget res; public EbliWidgetCreatorLegende(EGGraphe g) { super(); this.g = g; @@ -20,7 +20,13 @@ } public EbliWidget create(EbliScene _scene) { - return WidgetLegendeManager.createLegende(g, _scene, null); + res= WidgetLegendeManager.createLegende(g, _scene, 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/EbliWidgetCreatorRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -6,7 +6,8 @@ public class EbliWidgetCreatorRectangle implements EbliWidgetCreator { String label_; - + EbliWidgetRectangle res; + public EbliWidgetCreatorRectangle(String g) { super(); this.label_ = g; @@ -21,9 +22,14 @@ } public EbliWidget create(EbliScene _scene) { - EbliWidgetRectangle res= new EbliWidgetRectangle(_scene, getG()); + res= new EbliWidgetRectangle(_scene, getG()); return res; } + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + } Modified: 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 2008-08-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorVue2d.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -6,14 +6,21 @@ public class EbliWidgetCreatorVue2d implements EbliWidgetCreator { ZEbliCalquesPanel calque; - + EbliWidgetVue2D res; + public EbliWidgetCreatorVue2d(ZEbliCalquesPanel calque) { super(); this.calque = calque; } public EbliWidget create(EbliScene _scene) { - return new EbliWidgetVue2D(_scene, calque); + res= new EbliWidgetVue2D(_scene, calque); + return res; } + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,112 @@ +package org.fudaa.ebli.visuallibrary; + + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.geom.GeneralPath; +import java.util.ArrayList; + +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.action.ActionFactory; +import org.netbeans.api.visual.action.ConnectProvider; +import org.netbeans.api.visual.action.TextFieldInplaceEditor; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.anchor.AnchorFactory; +import org.netbeans.api.visual.anchor.AnchorShape; +import org.netbeans.api.visual.anchor.AnchorShapeFactory; +import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.ConnectionWidget; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; +import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.layout.OverlayLayout; + +/** + * Legende Widget qui permet de construire une fleche double + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetDBLFleche extends EbliWidget { + + + Insets inGaps_; + int largeurFleche = 15; + + public final static int ORIENTATION_NORTH=0; + public final static int ORIENTATION_SOUTH=1; + public final static int ORIENTATION_EAST=2; + public final static int ORIENTATION_WEST=3; + public final static int ORIENTATION_DIAG1=4; + public final static int ORIENTATION_DIAG2=5; + public final static int ORIENTATION_DIAG3=6; + public final static int ORIENTATION_DIAG4=7; + + + Point positionInit; + Point positionDest; + + ConnectionWidget shapeWidget; + AnchorShape shape; + + /** + * @param _scene + */ + public EbliWidgetDBLFleche(EbliScene _scene, int orientation) { + super(_scene); + + + //-- creation de la fleche --// + shapeWidget = new ConnectionWidget (_scene); + shape = AnchorShapeFactory.createTriangleAnchorShape(largeurFleche, true, false, 0); + //shape = AnchorShapeFactory.createArrowAnchorShape(45, 17); + + determinePosition(orientation); + + + shapeWidget.setSourceAnchor (AnchorFactory.createFixedAnchor(positionInit)); + shapeWidget.setTargetAnchor (AnchorFactory.createFixedAnchor(positionDest)); + shapeWidget.setSourceAnchorShape (shape); + shapeWidget.setTargetAnchorShape (shape); + addChild(shapeWidget); + + } + + + + + public void determinePosition(int orientation){ + positionInit=new Point(); + positionDest=new Point(); + + switch(orientation){ + case ORIENTATION_NORTH: positionInit.x=25;positionInit.y=0;positionDest.x=25;positionDest.y=50;break; + case ORIENTATION_SOUTH: positionInit.x=25;positionInit.y=0;positionDest.x=25;positionDest.y=50;break; + case ORIENTATION_WEST: positionInit.x=0;positionInit.y=25;positionDest.x=50;positionDest.y=25;break; + case ORIENTATION_EAST: positionInit.x=0;positionInit.y=25;positionDest.x=50;positionDest.y=25;break; + case ORIENTATION_DIAG1: positionInit.x=0;positionInit.y=0;positionDest.x=50;positionDest.y=50;break; + case ORIENTATION_DIAG2: positionInit.x=0;positionInit.y=0;positionDest.x=50;positionDest.y=50;break; + case ORIENTATION_DIAG3: positionInit.x=0;positionInit.y=50;positionDest.x=50;positionDest.y=50;break; + case ORIENTATION_DIAG4: positionInit.x=0;positionInit.y=50;positionDest.x=50;positionDest.y=0;break; + + } + } + + + + + + + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,113 @@ +package org.fudaa.ebli.visuallibrary; + + + + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Polygon; +import java.awt.Rectangle; +import java.awt.geom.GeneralPath; +import java.util.ArrayList; + +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.action.ActionFactory; +import org.netbeans.api.visual.action.ConnectProvider; +import org.netbeans.api.visual.action.TextFieldInplaceEditor; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.anchor.AnchorFactory; +import org.netbeans.api.visual.anchor.AnchorShape; +import org.netbeans.api.visual.anchor.AnchorShapeFactory; +import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.ConnectionWidget; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; +import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.layout.OverlayLayout; + +/** + * Legende Widget qui permet de construire une fleche + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetFleche extends EbliWidget { + + + Insets inGaps_; + int largeurBorder = 15; + int espaceInterieur = 5; + public static int ORIENTATION_NORTH=0; + public static int ORIENTATION_SOUTH=1; + public static int ORIENTATION_EAST=2; + public static int ORIENTATION_WEST=3; + + + + /** + * @param _scene + */ + public EbliWidgetFleche(EbliScene _scene, int orientation) { + super(_scene); + inGaps_ = new Insets(largeurBorder + espaceInterieur, largeurBorder + + espaceInterieur, largeurBorder + espaceInterieur, + largeurBorder + espaceInterieur); + // Ce layout permet de placer le texte + + setLayout(new OverlayLayoutGap(inGaps_)); + + + + } + + + + + /*protected Rectangle calculateClientArea() { + Rectangle res = this.getPreferredBounds(); + // TODO Auto-generated method stub + return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) + + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); + }*/ + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + g.translate(rec.x, rec.y); + // la ligne + + TraceLigne l = new TraceLigne(); + + l.setEpaisseur(largeurBorder); + + + //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)); + + + + + + g.translate(-rec.x, -rec.y); + + + + + } + + + + + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,40 @@ +package org.fudaa.ebli.visuallibrary; + +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.TreeModel; + +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 + + } + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTree.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -0,0 +1,111 @@ +package org.fudaa.ebli.visuallibrary; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +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; + + +/** + * 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 --// +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 + +} + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetJXTreeModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-06 22:00:30 UTC (rev 3724) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-07 13:56:12 UTC (rev 3725) @@ -45,11 +45,15 @@ + espaceInterieur, largeurBorder + espaceInterieur, largeurBorder + espaceInterieur); // Ce layout permet de placer le texte + setLayout(new OverlayLayoutGap(inGaps_)); + intern = new LabelWidget(_scene); intern.setVerticalAlignment(VerticalAlignment.CENTER); + intern.setLabel(label); - + + //-- layout du texte --// addChild(intern); // -- ajouter l option de remplacer le text dans le label --// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-11 07:25:30
|
Revision: 3752 http://fudaa.svn.sourceforge.net/fudaa/?rev=3752&view=rev Author: hadouxad Date: 2008-08-11 07:25:37 +0000 (Mon, 11 Aug 2008) Log Message: ----------- implementation de la fonction de duplication pour le graphe, les feleches et fleches double. probleme pour la vue calque Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-08-11 07:24:44 UTC (rev 3751) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-08-11 07:25:37 UTC (rev 3752) @@ -10,8 +10,16 @@ public class EbliWidgetCreatorVueCalque implements EbliWidgetCreator { ZEbliCalquesPanel calque; - EbliWidgetVueCalque res; + public ZEbliCalquesPanel getCalque() { + return calque; +} +public void setCalque(ZEbliCalquesPanel calque) { + this.calque = calque; +} + +EbliWidgetVueCalque res; + public EbliWidgetCreatorVueCalque(ZEbliCalquesPanel calque) { super(); this.calque = calque; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-11 07:24:44 UTC (rev 3751) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-11 07:25:37 UTC (rev 3752) @@ -11,21 +11,29 @@ */ public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { - EGGraphe g; + EGGraphe graphe; + public EGGraphe getGraphe() { + return graphe; + } + + public void setGraphe(EGGraphe graphe) { + this.graphe = graphe; + } + EbliWidgetGraphe res; public EbliWidgetCreatorGraphe(EGGraphe g) { super(); - this.g = g; + this.graphe = g; } public EbliWidget create(EbliScene _scene) { // TODO Auto-generated method stub // creation de la widget correspondante - res= new EbliWidgetGraphe(_scene, null, g); + res= new EbliWidgetGraphe(_scene, null, graphe); // ajout des listener d ecoute du graphe - g.getModel().addModelListener( + graphe.getModel().addModelListener( new EbliWidgetGrapheController(res)); return res; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-11 07:31:48
|
Revision: 3753 http://fudaa.svn.sourceforge.net/fudaa/?rev=3753&view=rev Author: hadouxad Date: 2008-08-11 07:31:55 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Correction FIXME: raffraichissement desormais instantane dans la scene. Il fallait utiliser la methode validate() de scene et pas autre chose 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/EbliWidgetActionAlign.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-11 07:25:37 UTC (rev 3752) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-11 07:31:55 UTC (rev 3753) @@ -225,7 +225,7 @@ * Methode qui permet de raffraichir les elements de la scene */ public void refresh(){ - revalidate(); + this.validate(); this.repaint(); getView().repaint(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 07:25:37 UTC (rev 3752) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 07:31:55 UTC (rev 3753) @@ -160,6 +160,7 @@ //-- rafraichissement de la scene --// scene_.refresh(); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-11 21:02:59
|
Revision: 3765 http://fudaa.svn.sourceforge.net/fudaa/?rev=3765&view=rev Author: deniger Date: 2008-08-11 21:02:53 +0000 (Mon, 11 Aug 2008) Log Message: ----------- maj pour les actions 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/EbliWidget.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-11 21:00:25 UTC (rev 3764) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-11 21:02:53 UTC (rev 3765) @@ -10,11 +10,13 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluCommandManager; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; /** @@ -24,21 +26,27 @@ * */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { + + public static void refreshScene(Scene _sc) { + _sc.validate(); + _sc.repaint(); + if (_sc.getView() != null) + _sc.getView().repaint(); + } + /** + * Le gestionnaire de commande associe \xE0 la scene + */ + CtuluCommandManager cmdMng_; + + /** * la visu du graphscene */ private LayerWidget visu_; - public LayerWidget getVisu_() { - return visu_; -} + private LayerWidget interactionLayer_; -public void setVisu_(LayerWidget visu_) { - this.visu_ = visu_; -} - -private LayerWidget interactionLayer_; final private WidgetAction alignWithMoveAction; /** @@ -55,7 +63,7 @@ interactionLayer_ = new LayerWidget(this); addChild(interactionLayer_); alignWithMoveAction = ActionFactory.createAlignWithMoveAction(visu_, interactionLayer_, ActionFactory - .createDefaultAlignWithMoveDecorator(),false); + .createDefaultAlignWithMoveDecorator(), false); // -- ajoute l'action du zoom ( ctrl + clic) getActions().addAction(ActionFactory.createZoomAction(1.1, true)); @@ -64,7 +72,6 @@ setMenuBase(); } - /** * Methode qui permet d ajouter un listener * @@ -112,29 +119,36 @@ return res; } - - + /** - * Called by the removeNode method to notify that a node is removed from the graph model. - * The default implementation removes the node widget from its parent widget. - * @param node the removed node - * @param widget the removed node widget; null if the node is non-visual + * Called by the removeNode method to notify that a node is removed from the + * graph model. The default implementation removes the node widget from its + * parent widget. * - * Surcharge pour faire appel au notify des listener et ainsi mettre ajour les listener + * @param node + * the removed node + * @param widget + * the removed node widget; null if the node is non-visual + * + * Surcharge pour faire appel au notify des listener et ainsi mettre + * ajour les listener */ - protected void detachNodeWidget (EbliNode node, Widget widget) { - //-- indique la suppresion du node chez le parent - notifyAllListenerNodeRemoved(node); - - if (widget != null) - widget.removeFromParent (); - - + protected void detachNodeWidget(EbliNode node, Widget widget) { + // -- indique la suppresion du node chez le parent + notifyAllListenerNodeRemoved(node); + + if (widget != null) + widget.removeFromParent(); + } - - - + /** + * @return the cmdMng + */ + public CtuluCommandManager getCmdMng() { + return cmdMng_; + } + public LayerWidget getLayerVisu() { return visu_; } @@ -143,6 +157,10 @@ return alignWithMoveAction; } + public LayerWidget getVisu_() { + return visu_; + } + /** * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener * @@ -179,6 +197,20 @@ notifyAllListenerNodeAdded(node); } + /** + * Methode qui permet de raffraichir les elements de la scene + */ + public void refresh() { + refreshScene(this); + } + + /** + * @param _cmdMng the cmdMng to set + */ + public void setCmdMng(CtuluCommandManager _cmdMng) { + cmdMng_ = _cmdMng; + } + public void setMenuBase() { getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { @@ -220,15 +252,8 @@ })); } - - /** - * Methode qui permet de raffraichir les elements de la scene - */ - public void refresh(){ - this.validate(); - this.repaint(); - getView().repaint(); - + public void setVisu_(LayerWidget visu_) { + this.visu_ = visu_; } - + } 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-11 21:00:25 UTC (rev 3764) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-11 21:02:53 UTC (rev 3765) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary; -import java.awt.Color; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -11,12 +10,7 @@ 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; -import org.netbeans.api.visual.border.BorderFactory; -import org.netbeans.api.visual.laf.LookFeel; -import org.netbeans.api.visual.layout.LayoutFactory; import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; /** @@ -28,33 +22,30 @@ public class EbliWidget extends Widget { private EbliScene scene_; - public EbliScene getScene_() { - return scene_; -} + + private boolean useBorder_ = true; -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()); - /** - * @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); - // positionnement de la widget si precise - // if(preferredLocation!=null) - // setPreferredLocation(preferredLocation); + // menu clic droit basique (fermeture, duplication) + setMenu(); +} - // menu clic droit basique (fermeture, duplication) - setMenu(); - } - /** * Methode de construction des menus de base * @@ -122,6 +113,18 @@ }); } + /** + * 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 EbliScene getEbliScene() { return scene_; } @@ -164,17 +167,6 @@ public void setUseBorder(boolean _useBorder) { useBorder_ = _useBorder; } - - /** - * methode qui construit une widget duplication pqr default, doit etre surchargee pour reproduire l' evenement - * @return - */ - public EbliNode duplicate(){ - EbliNode duplique =null; - - - return duplique; - } } \ 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: <had...@us...> - 2008-08-11 14:17:05
|
Revision: 3759 http://fudaa.svn.sourceforge.net/fudaa/?rev=3759&view=rev Author: hadouxad Date: 2008-08-11 14:17:07 +0000 (Mon, 11 Aug 2008) Log Message: ----------- - ajout etat supplementaire poru le jtree: si la widget est masquee, affiche icone differente - Mise en place de l editor du graphe - Mise en place de l editor du calque Modified Paths: -------------- 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/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 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/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -7,6 +7,7 @@ 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.InplaceEditorProvider; import org.netbeans.api.visual.action.TextFieldInplaceEditor; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.LabelWidget; @@ -55,6 +56,8 @@ WidgetAction editorAction = ActionFactory .createInplaceEditorAction(this); + + // -- ajout de l action au label correspondant --// intern.getActions().addAction(editorAction); 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-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -1,17 +1,31 @@ package org.fudaa.ebli.visuallibrary.calque; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Graphics2D; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Collections; +import java.util.EnumSet; +import javax.swing.JFrame; +import javax.swing.JLabel; + 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.WidgetAction; +import org.netbeans.api.visual.widget.Widget; -public class EbliWidgetVueCalque extends EbliWidget { +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; +public class EbliWidgetVueCalque extends EbliWidget implements InplaceEditorProvider<BuPanel>{ + ZEbliCalquesPanel vue_; public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { @@ -19,6 +33,13 @@ vue_ = vue; setPreferredSize(new Dimension(200, 200)); setMinimumSize(new Dimension(200, 200)); + + //-- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + } @Override @@ -40,4 +61,67 @@ g.translate(-rec.x, -rec.y); } + + //-- methodes implements InplaceEditorProvider --// + + /** + * 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 + + + + 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(){ + + 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); + } + + }); + panelTest.add(boutonTest); + + + return panelTest; } + +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; +} + +public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, Rectangle viewBounds) { + // 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 + +} + +} 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-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -5,13 +5,19 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.EnumSet; +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 org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGConfigureActionPalette; +import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheModelListener; import org.fudaa.ebli.courbe.EGObject; @@ -19,11 +25,17 @@ 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.PopupMenuProvider; +import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.laf.LookFeel; import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.Widget; +import sun.security.krb5.internal.PAEncTSEnc; + +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; @@ -32,7 +44,7 @@ * @author adrien hadoux * */ -public class EbliWidgetGraphe extends EbliWidget{ +public class EbliWidgetGraphe extends EbliWidget implements InplaceEditorProvider<BuPanel>{ private EGGraphe graphe; private EbliNodeDefault nodeLegende=null; @@ -51,6 +63,12 @@ setGraphe(_graphe); + //-- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + } @@ -137,5 +155,59 @@ } + + //-- methodes implements InplaceEditorProvider --// + + /** + * Methode appeleee pour creer un editor EGFillePanel correspondant a la vue + */ + public /*EGFillePanel*/ BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget) { + + //-- creation du menu d'actions--// + final JMenu menu = new JMenu(); + menu.setName("menu du graphe"); + menu.setText("menu du graphe"); + // creation du panel Egfille correspondant + EGFillePanel panelGraphe=new EGFillePanel(this.graphe); + + //--remplissage du menu --// + panelGraphe.fillSpecificMenu(menu); + + //FIXME : comment construire le Jmenu principal ainsi que le tree qui qffiche les courbes ??? + + + return panelGraphe; + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, /*EGFillePanel*/BuPanel editor) { + // TODO Auto-generated method stub + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, /*EGFillePanel*/BuPanel editor, Rectangle viewBounds) { + // TODO Auto-generated method stub + return null; + } + + public void notifyClosing( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, /*EGFillePanel*/BuPanel editor, boolean commit) { + // TODO Auto-generated method stub + + } + + public void notifyOpened( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, /*EGFillePanel*/BuPanel editor) { + // TODO Auto-generated method stub + + } + } 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-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -90,6 +90,14 @@ // -- 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); + } }); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-08-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -29,6 +29,8 @@ add(checkBox); } setOpaque(false); + + } } Modified: 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-11 13:07:36 UTC (rev 3758) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-11 14:17:07 UTC (rev 3759) @@ -32,13 +32,13 @@ Color selectionBorderColor, selectionForeground, selectionBackground, textForeground, textBackground; - private Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - // private Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_cacher"); - private Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); + public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); - private Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); + public Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); protected EbliCheckBoxPanel getLeafRenderer() { @@ -91,7 +91,12 @@ returnValue.setText(node.getTitle()); returnValue.setSelected(node.getCreator().getWidget().isVisible()); - returnLabel=new BuLabel(this.iconLeafEnabled); + + returnLabel=new BuLabel(this.iconLeafEnabled); + + + + returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); } } /*else if (!leaf && !((DefaultMutableTreeNode) value).isRoot()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-11 18:47:42
|
Revision: 3761 http://fudaa.svn.sourceforge.net/fudaa/?rev=3761&view=rev Author: hadouxad Date: 2008-08-11 18:47:40 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Mie a jour de la journ?\195?\169e: - duplication - alignement + gestion des commandes undo redo - creation d une classe implementant ctulucommande pour gerer les undio redo de positions de widget - gestion des icones pour le tree - gestion des editeur pour le graphe - gestion des editeur pour le calque ainsi que le tree calque Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.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/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionUndoRedo.java 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -7,7 +7,7 @@ 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.InplaceEditorProvider; + import org.netbeans.api.visual.action.TextFieldInplaceEditor; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.LabelWidget; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -12,164 +12,178 @@ import javax.swing.AbstractAction; +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.netbeans.api.visual.widget.Widget; /** * Action qui permet de realiser l alignement des composants. * - * - *ATTTENTION CHOIX DE CONCEPTION: - *il faut que les EbliNode soit movables (isMovable()== true) - * pour pouvoir les aligner - * il faut donc lorss de la creation des nodes remplir les infos dimensions et size comme suit: * - * EbliNodeDefault node = new EbliNodeDefault(); - * node.setCreator(new EbliWidgetCreatorGraphe(g)); - * node.setTitle("Graphe"); - * node.setPreferedSize(new Dimension(300, 300)); - * node.setPreferedLocation(new Point(4, 4)); - * scene.addNode(node); - * + *ATTTENTION CHOIX DE CONCEPTION: il faut que les EbliNode soit movables + * (isMovable()== true) pour pouvoir les aligner il faut donc lorss de la + * creation des nodes remplir les infos dimensions et size comme suit: + * + * EbliNodeDefault node = new EbliNodeDefault(); node.setCreator(new + * EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); + * node.setPreferedSize(new Dimension(300, 300)); node.setPreferedLocation(new + * Point(4, 4)); scene.addNode(node); + * *@author Adrien Hadoux - * + * */ -public class EbliWidgetActionAlign extends AbstractAction { +public class EbliWidgetActionAlign extends AbstractAction { /** * */ private static final long serialVersionUID = 1L; EbliScene scene_; - public final static int ALIGNLEFT=0; - public final static int ALIGNRIGHT=1; - public final static int ALIGNCENTERHORIZONTAL=2; - public final static int ALIGNCENTERVERTICAL=3; - public final static int ALIGNTOP=4; - public final static int ALIGNBOTTOM=5; + public final static int ALIGNLEFT = 0; + public final static int ALIGNRIGHT = 1; + public final static int ALIGNCENTERHORIZONTAL = 2; + public final static int ALIGNCENTERVERTICAL = 3; + public final static int ALIGNTOP = 4; + public final static int ALIGNBOTTOM = 5; int typeAlignement_; + + + CtuluCommandManager cmd_=new CtuluCommandManager() ; - //liste des positions precedentes pour chaque widgets - List<Point> listPreviousPositions_; - public EbliWidgetActionAlign(EbliScene _scene, int _typeAlignement) { super(); // TODO Auto-generated constructor stub - scene_=_scene; - typeAlignement_=_typeAlignement; - //-- renseignements des infos complementaires --// - putValue(NAME,"Alignement "+traduct(_typeAlignement)); + scene_ = _scene; + typeAlignement_ = _typeAlignement; + // -- renseignements des infos complementaires --// + putValue(NAME, "Alignement " + traduct(_typeAlignement)); - } public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub alignComponents(); + + } + /** - * methode qui recalcule la nouvelle position par rapport a la scene et a l alignement choisiT. + * methode qui recalcule la nouvelle position par rapport a la scene et a l + * alignement choisiT. */ - private Point calculeNewLocation(Point _previousLocation,Dimension _dimensionWidget,Dimension _dimensionScene){ + + private Point calculeNewLocation(Point _previousLocation, + Rectangle _dimensionWidget, Dimension _dimensionScene) { + switch (typeAlignement_) { + case ALIGNLEFT: + return new Point(0, _previousLocation.y); + case ALIGNRIGHT: + return new Point(_dimensionScene.width - _dimensionWidget.width, + _previousLocation.y); + case ALIGNCENTERHORIZONTAL: + return new Point(_dimensionScene.width / 2 - _dimensionWidget.width + / 2, _previousLocation.y); + case ALIGNCENTERVERTICAL: + return new Point(_previousLocation.x, _dimensionScene.height / 2 + - _dimensionWidget.height / 2); + case ALIGNTOP: + return new Point(_previousLocation.x, 0); + case ALIGNBOTTOM: + return new Point(_previousLocation.x, _dimensionScene.height + - _dimensionWidget.height); - switch(typeAlignement_){ - case ALIGNLEFT: return new Point(0,_previousLocation.y); - case ALIGNRIGHT: return new Point(_dimensionScene.width-_dimensionWidget.width,_previousLocation.y); - case ALIGNCENTERHORIZONTAL: return new Point(_dimensionScene.width/2 -_dimensionWidget.width/2 ,_previousLocation.y); - case ALIGNCENTERVERTICAL: return new Point(_previousLocation.x,_dimensionScene.height/2 -_dimensionWidget.height/2); - case ALIGNTOP: return new Point(_previousLocation.x,0); - case ALIGNBOTTOM: return new Point(_previousLocation.x,_dimensionScene.height-_dimensionWidget.height); - - - default: return _previousLocation; + default: + return _previousLocation; } - } - private Point calculeNewLocation(Point _previousLocation,Rectangle _dimensionWidget,Dimension _dimensionScene){ + private String traduct(int _align) { + switch (typeAlignement_) { + case ALIGNLEFT: + return "\xE0 gauche"; + case ALIGNRIGHT: + return "\xE0 droite"; + case ALIGNCENTERHORIZONTAL: + return "centr\xE9 horizontal"; + case ALIGNCENTERVERTICAL: + return "centr\xE9 vertical"; + case ALIGNTOP: + return "en haut"; + case ALIGNBOTTOM: + return "en bas"; - - switch(typeAlignement_){ - case ALIGNLEFT: return new Point(0,_previousLocation.y); - case ALIGNRIGHT: return new Point(_dimensionScene.width-_dimensionWidget.width,_previousLocation.y); - case ALIGNCENTERHORIZONTAL: return new Point(_dimensionScene.width/2 -_dimensionWidget.width/2 ,_previousLocation.y); - case ALIGNCENTERVERTICAL: return new Point(_previousLocation.x,_dimensionScene.height/2 -_dimensionWidget.height/2); - case ALIGNTOP: return new Point(_previousLocation.x,0); - case ALIGNBOTTOM: return new Point(_previousLocation.x,_dimensionScene.height-_dimensionWidget.height); - - - default: return _previousLocation; + default: + return ""; } - - } - - private String traduct(int _align){ - switch(typeAlignement_){ - case ALIGNLEFT: return "\xE0 gauche"; - case ALIGNRIGHT: return "\xE0 droite"; - case ALIGNCENTERHORIZONTAL: return "centr\xE9 horizontal"; - case ALIGNCENTERVERTICAL: return "centr\xE9 vertical"; - case ALIGNTOP: return "en haut"; - case ALIGNBOTTOM: return "en bas"; - - - default: return ""; - } - } - /** * action alignement qui realise l alignements de tous les composants */ - public void alignComponents(){ + public void alignComponents() { - //-- reinitialisation de la liste des historique des positions --// - listPreviousPositions_=new ArrayList<Point>(); - - //-- recuperation de la liste des widgets selectionnees --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();//scene_.getNodes(); - //-- parcours des nodes - for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + // -- recuperation de la liste des widgets selectionnees --// - EbliNode currentNode=it.next(); - if(currentNode!=null && currentNode.isMovable()){ + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + // . + // getNodes + // ( + // ) + // ; - //-- deplacement que si la widget est selectionnee --// - if(currentNode.getCreator().getWidget().getState().isSelected()){ + // -- parcours des nodes + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - //-- enregistrement de la previous position --// - listPreviousPositions_.add(currentNode.getPreferedLocation()); + EbliNode currentNode = it.next(); + if (currentNode != null && currentNode.isMovable()) { - //-- calcul de la nouvelle position du node en fonction de l alignement choisi --// - Point newLocation=calculeNewLocation(currentNode.getCreator().getWidget().getLocation(), currentNode.getCreator().getWidget().getBounds(),scene_.getView().getSize()); + // -- deplacement que si la widget est selectionnee --// + if (currentNode.getCreator().getWidget().getState() + .isSelected()) { - //-- tentative de modification de la position du node --// + // -- enregistrement de la previous position --// + Point previousLocation=currentNode.getPreferedLocation(); + + // -- calcul de la nouvelle position du node en fonction de + // l alignement choisi --// + Point newLocation = calculeNewLocation(currentNode + .getCreator().getWidget().getLocation(), + currentNode.getCreator().getWidget().getBounds(), + scene_.getView().getSize()); + + // -- tentative de modification de la position du node --// currentNode.setPreferedLocation(newLocation); currentNode.getCreator().getWidget().revalidate(); currentNode.getCreator().getWidget().repaint(); + + //-- enregistrement de la commande undo redo --// + + //--creation d une commande undo redo --// + EbliWidgetActionUndoRedo cmd=new EbliWidgetActionUndoRedo(newLocation,previousLocation,currentNode.getCreator().getWidget()); + + //-- ajout de la commande undo redo --// + if (cmd_ != null) + cmd_.addCmd(cmd); } } } - //-- rafraichissement de la scene --// + // -- rafraichissement de la scene --// scene_.refresh(); - } - - - } 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -39,7 +39,7 @@ EbliNode currentNode=it.next(); if(currentNode!=null && currentNode.isMovable()){ - //-- deplacement au premier plan que si la widget est selectionnee --// + //-- deplacement au premier plan que si la widget est selectionnee if(currentNode.getCreator().getWidget().getState().isSelected()){ //-- ajout au premier plan du node --// Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionUndoRedo.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionUndoRedo.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionUndoRedo.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -0,0 +1,41 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Point; + +import org.fudaa.ctulu.CtuluCommand; + +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * classe qui permet de faire du undo redo de positions d une widget + * @author genesis + * + */ +public class EbliWidgetActionUndoRedo implements CtuluCommand{ + + EbliWidget widget_; + Point oldPos_; + Point newPos_; + + + + public EbliWidgetActionUndoRedo(Point newPos_, Point oldPos_, + EbliWidget widget_) { + super(); + this.newPos_ = newPos_; + this.oldPos_ = oldPos_; + this.widget_ = widget_; + } + + + public void redo() { + // TODO Auto-generated method stub + widget_.setPreferredLocation(newPos_); + } + + public void undo() { + // TODO Auto-generated method stub + widget_.setPreferredLocation(oldPos_); + } + +} 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics2D; @@ -12,6 +13,7 @@ import javax.swing.JFrame; import javax.swing.JLabel; +import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -21,107 +23,117 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import sun.swing.BakedArrayList; + +import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; import com.memoire.bu.BuPanel; -public class EbliWidgetVueCalque extends EbliWidget implements InplaceEditorProvider<BuPanel>{ +public class EbliWidgetVueCalque extends EbliWidget implements + InplaceEditorProvider<BuPanel> { - ZEbliCalquesPanel vue_; + ZEbliCalquesPanel vue_; - 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.createInplaceEditorAction(this); + public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { + super(scene); + vue_ = vue; + setPreferredSize(new Dimension(200, 200)); + setMinimumSize(new Dimension(200, 200)); - // -- ajout de l action au widget correspondant --// - this.getActions().addAction(editorAction); - - } + // -- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory + .createInplaceEditorAction(this); - @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); - } + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); - - //-- methodes implements InplaceEditorProvider --// - - /** - * 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 - - - - 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(){ + } - 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); + @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); } - - }); - panelTest.add(boutonTest); - - - return panelTest; -} + vue_.restaurer(); + vue_.getVueCalque().paintImage(g, Collections.EMPTY_MAP); + g.translate(-rec.x, -rec.y); + } -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; -} + // -- methodes implements InplaceEditorProvider --// -public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor, Rectangle viewBounds) { - // TODO Auto-generated method stub - return null; -} + /** + * 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 -public void notifyClosing( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor, boolean commit) { - // TODO Auto-generated method stub - -} + 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() { -public void notifyOpened( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor) { - // TODO Auto-generated method stub - -} + 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); + } + }); + panelTest.add(boutonTest); + BuPanel res = new BuPanel(new BuBorderLayout()); + res.add(vue_); + res + .add(new BArbreCalque(vue_.getArbreCalqueModel()), + BorderLayout.EAST); + // panelTest.add(vue_); + + return /* panelTest */res; + } + + 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; + } + + 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 + + } + } 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -5,6 +5,7 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; import java.util.EnumSet; import javax.swing.JFrame; @@ -15,6 +16,7 @@ import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluPopupListener; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; @@ -171,8 +173,15 @@ menu.setName("menu du graphe"); menu.setText("menu du graphe"); // creation du panel Egfille correspondant - EGFillePanel panelGraphe=new EGFillePanel(this.graphe); + final EGFillePanel panelGraphe=new EGFillePanel(this.graphe); + new CtuluPopupListener(new CtuluPopupListener.PopupReceiver() { + public void popup(MouseEvent _evt) { + panelGraphe.popupMenu(_evt.getX(), _evt.getY()); + + } + },panelGraphe); + //--remplissage du menu --// panelGraphe.fillSpecificMenu(menu); 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -3,13 +3,10 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.util.EventObject; import javax.swing.AbstractCellEditor; -import javax.swing.JCheckBox; import javax.swing.JTree; import javax.swing.event.ChangeEvent; import javax.swing.tree.DefaultMutableTreeNode; @@ -29,8 +26,11 @@ */ public class EbliCheckBoxNodeEditor extends AbstractCellEditor implements TreeCellEditor { - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + +private static final long serialVersionUID = 4576652808917382435L; +EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + ChangeEvent changeEvent = null; EbliWidgetJXTree tree; Modified: 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-11 14:17:51 UTC (rev 3760) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-11 18:47:40 UTC (rev 3761) @@ -125,7 +125,11 @@ // qccessible en fonction du tree leafRenderer.setEnabled(tree.isEnabled()); - + if(selected){ + leafRenderer.setBackground(Color.BLUE); + } + else + leafRenderer.setBackground(Color.WHITE); return leafRenderer; } 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: <had...@us...> - 2008-08-18 07:49:40
|
Revision: 3812 http://fudaa.svn.sourceforge.net/fudaa/?rev=3812&view=rev Author: hadouxad Date: 2008-08-18 07:49:49 +0000 (Mon, 18 Aug 2008) Log Message: ----------- - Creation d un editeur docking pour le widget graphe. Utilisation similaire au calque Modified Paths: -------------- 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/graphe/EbliWidgetGraphe.java 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-18 07:16:38 UTC (rev 3811) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 2008-08-18 07:49:49 UTC (rev 3812) @@ -16,6 +16,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JToolBar; +import javax.swing.JTree; import javax.swing.border.LineBorder; import org.flexdock.docking.DockingConstants; @@ -27,6 +28,8 @@ import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; /** * A ameliorer... @@ -82,7 +85,55 @@ return frame; } + + public JFrame createFrame(EGFillePanel pn) { + JFrame frame = new JFrame("Modification du graphe"); + frame.getContentPane().setLayout(new BorderLayout()); + EbliActionInterface[] specificInterfaces = pn.getSpecificActions(); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + JMenu menu = new JMenu("Menu graphe"); + pn.fillSpecificMenu(menu); + + // for (int i = 0; i < specificInterfaces.length; i++) { + // mb.add(new JMenu(specificInterfaces[i])); + // } + mb.add(menu); + + JToolBar tb = new JToolBar(); + + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + 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, "Graphe"); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + JComponent rightComponent = createView(new JScrollPane(tree), "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)); 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-18 07:16:38 UTC (rev 3811) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-18 07:49:49 UTC (rev 3812) @@ -7,40 +7,50 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.util.EnumSet; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; -import javax.swing.JMenu; +import javax.swing.JComponent; +import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.gui.CtuluPopupListener; import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; 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.EditProvider; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; -import com.memoire.bu.BuPanel; - /** * widget qui contient un objet graphe * @author adrien hadoux * */ -public class EbliWidgetGraphe extends EbliWidget implements InplaceEditorProvider<BuPanel>{ +public class EbliWidgetGraphe extends EbliWidget implements EditProvider/* + * , + * InplaceEditorProvider + * < + * BuPanel + * > + */{ private EGGraphe graphe; + JFrame frame_; + EditCreator editor_; + EGFillePanel panelGraphe_; + private EbliNodeDefault nodeLegende=null; - + public Color couleurContour=Color.black; public Color couleurFond=Color.white; @@ -57,11 +67,14 @@ // TODO Auto-generated constructor stub setGraphe(_graphe); - - + editor_ = EditCreator.INSTANCE; + panelGraphe_=new EGFillePanel(_graphe); //-- creation de l action pour editor --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(this); + WidgetAction editorAction = ActionFactory.createEditAction(this); + // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); @@ -112,10 +125,7 @@ * @param _popup */ private void constructPopupMenuSpecifique(JPopupMenu _popup){ - - - - JMenuItem menuItem=_popup.add ("Ajouter la l\xE9gende"); + JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); menuItem.addActionListener(new ActionListener(){ @@ -163,64 +173,101 @@ /** * Methode appeleee pour creer un editor EGFillePanel correspondant a la vue */ - public /*EGFillePanel*/ BuPanel createEditorComponent( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget) { - - //-- creation du menu d'actions--// - final JMenu menu = new JMenu(); - menu.setName("menu du graphe"); - menu.setText("menu du graphe"); - // creation du panel Egfille correspondant - final EGFillePanel panelGraphe=new EGFillePanel(this.graphe); - new CtuluPopupListener(new CtuluPopupListener.PopupReceiver() { - - public void popup(MouseEvent _evt) { - panelGraphe.popupMenu(_evt.getX(), _evt.getY()); - - } - },panelGraphe); - - //--remplissage du menu --// - panelGraphe.fillSpecificMenu(menu); - - //FIXME : comment construire le Jmenu principal ainsi que le tree qui qffiche les courbes ??? - - - return panelGraphe; - } + // public /*EGFillePanel*/ BuPanel createEditorComponent( + // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController + // controller, + // Widget widget) { + // + // //-- creation du menu d'actions--// + // final JMenu menu = new JMenu(); + // menu.setName("menu du graphe"); + // menu.setText("menu du graphe"); + // // creation du panel Egfille correspondant + // final EGFillePanel panelGraphe=new EGFillePanel(this.graphe); + // new CtuluPopupListener(new CtuluPopupListener.PopupReceiver() { + // + // public void popup(MouseEvent _evt) { + // panelGraphe.popupMenu(_evt.getX(), _evt.getY()); + // + // } + // },panelGraphe); + // + // //--remplissage du menu --// + // panelGraphe.fillSpecificMenu(menu); + // + // //FIXME : comment construire le Jmenu principal ainsi que le tree qui + // qffiche les courbes ??? + // + // + // return panelGraphe; + // } - - + public void edit(Widget _widget) { + 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(); + SwingUtilities.convertPointToScreen(p, jc); - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, /*EGFillePanel*/BuPanel editor) { - // TODO Auto-generated method stub - return null; - } + frame_ = editor_.createFrame(panelGraphe_); + frame_.setLocation(p); + frame_.pack(); + // calquePanel_.getVueCalque().changeRepere(this, gr); + frame_.setVisible(true); + frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame_.addWindowListener(new WindowAdapter() { - public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, /*EGFillePanel*/BuPanel editor, Rectangle viewBounds) { - // TODO Auto-generated method stub - return null; - } + @Override + public void windowClosed(WindowEvent _e) { + if (frame_ != null) frame_.dispose(); + frame_ = null; + } - public void notifyClosing( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, /*EGFillePanel*/BuPanel editor, boolean commit) { - // TODO Auto-generated method stub - - } + +// public void windowClosing(WindowEvent _e) { +// zoom_ = calquePanel_.getVueCalque().getViewBoite(); +// // image = null; +// // getEbliScene().refresh(); +// } - public void notifyOpened( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, /*EGFillePanel*/BuPanel editor) { - // TODO Auto-generated method stub - + }); + } + } + + + +// public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( +// org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, +// Widget widget, /*EGFillePanel*/BuPanel editor) { +// // TODO Auto-generated method stub +// return null; +// } +// +// public Rectangle getInitialEditorComponentBounds( +// org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, +// Widget widget, /*EGFillePanel*/BuPanel editor, Rectangle viewBounds) { +// // TODO Auto-generated method stub +// return null; +// } +// +// public void notifyClosing( +// org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, +// Widget widget, /*EGFillePanel*/BuPanel editor, boolean commit) { +// // TODO Auto-generated method stub +// +// } +// +// public void notifyOpened( +// org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, +// Widget widget, /*EGFillePanel*/BuPanel editor) { +// // TODO Auto-generated method stub +// +// } + // public void setColorContour(Color newColor){ // couleurContour=newColor; // repaint(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-02 21:51:31
|
Revision: 3865 http://fudaa.svn.sourceforge.net/fudaa/?rev=3865&view=rev Author: deniger Date: 2008-09-02 21:51:32 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-02 21:48:34 UTC (rev 3864) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -29,10 +29,9 @@ * Classe qui g\xE8re les actions de contr\xF4le de la widget * * @author genesis - * */ public class EbliWidgetController { - + protected boolean canDuplicate_ = true; protected boolean canMove_ = true; protected boolean canResize_ = true; @@ -45,96 +44,88 @@ WidgetAction actionMove_; WidgetAction actionResize_; WidgetAction actionSelect_; - -public EbliWidgetController(EbliWidget widget_) { - this(widget_, true, true, true); - - -} + public EbliWidgetController(EbliWidget widget_) { + this(widget_, true, true, true); + + } + public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize) { - this(widget_, canMove, canResize, true); + this(widget_, canMove, canResize, true); } public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize, boolean canDuplicate) { - + this.widget_ = widget_; canDuplicate_ = canDuplicate; canMove_ = canMove; canResize_ = canResize; - - + // creation des actions par defaut createdefaultAction(); // menu intern propre a la widget setMenu(); - + } - - - public boolean isCanDuplicate_() { + + public boolean isCanDuplicate() { return canDuplicate_; } - public boolean isCanMove_() { + public boolean isCanMove() { return canMove_; } - public boolean isCanResize_() { + public boolean isCanResize() { return canResize_; } - - + /** * methode qui cree les actions par defaut pour la widget. - * */ public void createdefaultAction() { // -- construction des actions --// actionSelect_ = widget_.getEbliScene().createSelectAction(); widget_.getActions().addAction(actionSelect_); - + actionResize_ = ActionFactory.createResizeAction(); - if (canResize_) - widget_.getActions().addAction(actionResize_); - + if (canResize_) widget_.getActions().addAction(actionResize_); + widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); - + actionMove_ = widget_.getEbliScene().getMoveAction(); - if (canMove_) - widget_.getActions().addAction(actionMove_); + if (canMove_) widget_.getActions().addAction(actionMove_); } /** * Methode appelee pour bloquer une widget: l'empecher de se deplacer. */ - public void removeActionResizeAndMove(){ + public void removeActionResizeAndMove() { widget_.getActions().removeAction(actionMove_); widget_.getActions().removeAction(actionSelect_); - + } - + /** * fonction inverse de la precedente. */ public void replaceActionResizeAndMove() { - + widget_.getActions().addAction(actionMove_); widget_.getActions().addAction(actionSelect_); } - - - public String getDescription_() { + + public String getDescription() { return description_; } - public void setDescription_(String description_) { + + public void setDescription(String description_) { this.description_ = description_; widget_.setToolTipText(description_); } - - + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add("Masquer l'objet"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -157,8 +148,7 @@ }); } - - + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add("Supprimer l'objet"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); @@ -185,7 +175,7 @@ }); } - + protected void constructMenuDupliquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); @@ -224,7 +214,7 @@ }); } - + /** * Methode de construction des menus de base * @@ -233,63 +223,60 @@ public void constructPopupMenuBase(JPopupMenu _popup) { // -- reference vers le gestionnaire de commandeundo/redo --// - final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); - + final CtuluCommandContainer cmd_ = getWidget().getEbliScene().getCmdMng(); + JMenuItem menuItem3 = _popup.add("Informations"); menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); + JOptionPane.showMessageDialog(null, getDescription(), "Informations", JOptionPane.DEFAULT_OPTION, null); } }); constructMenuMasquer(_popup, cmd_); - - + if (canDuplicate_) { constructMenuDupliquer(_popup, cmd_); } - + constructMenuSupprimer(_popup, cmd_); } - PopupMenuProvider providerPopup_ = null; - protected JPopupMenu popupMenu_ = null; + protected JPopupMenu popupMenu_ = null; + public JPopupMenu getPopup() { return popupMenu_; } + /** - * 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 + * 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() { - + popupMenu_ = new JPopupMenu(); // -- construction du menu pour les graphismees --// constructPopupMenuBaseGraphique(popupMenu_); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popupMenu_); - - - providerPopup_=new PopupMenuProvider() { + + providerPopup_ = new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - return popupMenu_; + return popupMenu_; } }; widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_)); } /** - * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il - * n a aucun effet. + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il n a aucun effet. * * @param _popup */ @@ -321,17 +308,13 @@ }); } - + public EbliWidget getWidget() { + return widget_; + } -public EbliWidget getWidget_() { - return widget_; -} + public void setWidget(EbliWidget widget_) { + this.widget_ = widget_; + }; -public void setWidget_(EbliWidget widget_) { - this.widget_ = widget_; -}; - - - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-02 21:48:34 UTC (rev 3864) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -65,7 +65,7 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize()) listeNodeAutorises.add(node); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-02 21:48:34 UTC (rev 3864) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -65,7 +65,7 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize()) listeNodeAutorises.add(node); } Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java (from rev 3863, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -0,0 +1,268 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; + +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; + +import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.palette.BPalettePlageInterface; +import org.fudaa.ebli.palette.BPalettePlageLegende; +import org.fudaa.ebli.trace.BPlageInterface; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; +import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; +import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.LabelWidget.Alignment; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; +import org.netbeans.modules.visual.layout.FlowLayout; + +import com.memoire.fu.FuLog; + +/** + * La classe de gestion des legendes pour le calque. + * + * @author Adrien Hadoux + */ +public class CalqueLegendeWidgetAdapter extends BCalqueLegende { + + static class MetricLegend extends FontMetrics { + + // protected MetricLegend(Font font) { + // super(font); + // } + public MetricLegend(Font font) { + super(font); + } + + } + + /** + * Methode statique qui recree la widget associee au calque. Il faut que son parent la bordure ajoute et prenne en + * compte sa nouvelle fille pour bien gerer le dispatch des composants graphiques. + * + * @param widgetLegende_ + * @param _calqueLegende + * @param _scene + * @param model + */ + public static int cp = 1; + public static int LENGHT_PER_LEGENDE = 15; + public static int MAX_BORDURE = 12; + public static int WIDTH_LEGENDE = 200; + + public static int WIDTH_PER_LEGENDEICON = 10; + + public static int WIDTH_PER_LEGENDETEXT = 130; + + /** + * Mananger statique qui se charge de creer \xE9a widget associee au calque. + * + * @param _calqueLegende le panel legende qui sera recopie version widget + * @param _scene la scene + * @return la widfget de la legende. + */ + public static EbliWidget createLegendeWidget(EbliWidgetCalqueLegende _widgetLegende, BCalqueLegendePanel _calqueLegende, + EbliScene _scene) { + + // --creation de la widget conteneur --// + BPalettePlageInterface listeplages = null; + // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, + // _calqueLegende); + _widgetLegende.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); + + if (_calqueLegende != null) { + Component[] listeC = _calqueLegende.getComponents(); + + for (int i = 0; i < listeC.length; i++) { + Component c = listeC[i]; + FuLog.warning(i + ") " + c); + if (c instanceof JLabel) { + + LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) c).getText()); + titre.setEnabled(true); + _widgetLegende.addChild(titre); + } + + if (c instanceof BPalettePlageLegende) { + BPalettePlageLegende pal = (BPalettePlageLegende) c; + FuLog.warning("title) " + pal.getModel().getTitre() + "| nb de composant du model: " + + pal.getModel().getNbPlages()); + + // --recuperation de la liste des plages --// + listeplages = pal.getModel(); + + // --creation du titre --// + LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(listeplages.getTitre()); + titre.setEnabled(true); + _widgetLegende.addChild(titre); + LabelWidget sstitre = new LabelWidget(_scene); + sstitre.setAlignment(Alignment.CENTER); + sstitre.setVerticalAlignment(VerticalAlignment.CENTER); + sstitre.setLabel(listeplages.getSousTitre()); + sstitre.setEnabled(true); + _widgetLegende.addChild(sstitre); + + if (listeplages.getNbPlages() != 0) { + for (int j = 0; j < listeplages.getNbPlages(); j++) { + + BPlageInterface plage = listeplages.getPlageInterface(j); + FuLog.warning("jlist " + j + ") " + plage.getLegende()); + + // -- ajout d'une widget plage --// + EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); + + lw.setUseBorder(false); + lw.setEnabled(true); + + _widgetLegende.addChild(lw); + + } + } else { + // liste des plages est vide il s agit d une autre legende + Component[] lcomp = pal.getComponents(); + for (int j = 0; j < lcomp.length; j++) { + Component co = lcomp[j]; + FuLog.warning(j + ") autre legende: " + co); + + if (co instanceof JPanel) { + JPanel panel = (JPanel) co; + + for (int k = 0; k < panel.getComponents().length; k++) { + FuLog.warning(j + ") appartien a panel: " + panel.getComponents()[k]); + + if (panel.getComponents()[k] instanceof JLabel) { + FuLog.warning("label) =" + ((JLabel) panel.getComponents()[k]).getText()); + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); + titre.setEnabled(true); + _widgetLegende.addChild(titre); + } else if (panel.getComponents()[k] instanceof JList) { + JList jlst = (JList) panel.getComponents()[k]; + for (int g = 0; g < jlst.getModel().getSize(); g++) { + FuLog.warning(g + ")jlist: element=" + jlst.getModel().getElementAt(g)); + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel((String) jlst.getModel().getElementAt(g)); + titre.setEnabled(true); + _widgetLegende.addChild(titre); + } + + } + + } + + } + + } + } + } + + } + + _widgetLegende.setController_(new EbliWidgetControllerMenuOnly(_widgetLegende, false)); + + // -- prendre en compte le resize automatique --// + _widgetLegende.oldFont_ = new Font("Helvetica", Font.BOLD, 40); + _widgetLegende.repaint(); + + return _widgetLegende; + } else { + FuLog.warning("createLegendeWidget retourne widget null"); + return null; + } + } + + public static Dimension createSizeForWidget(int _nbLibelles) { + return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + } + + public static void reconstructWidget(EbliWidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, + EbliScene _scene/* , BArbreCalqueModel model */) { + + // -- on retire de la bordure la widget fille --// + EbliWidgetBordure parent = (EbliWidgetBordure) widgetLegende_.getParentWidget(); + + widgetLegende_ = (EbliWidgetCalqueLegende) createLegendeWidget(widgetLegende_, _calqueLegende, _scene); + + parent.repaint(); + + } + + BCalqueLegendePanel legendePanel_; + + EbliScene scene_; + + public CalqueLegendeWidgetAdapter(EbliScene _scene, BArbreCalqueModel model) { + super(); + scene_ = _scene; + // modelTreeCalque_ = model; + + } + + /** + * override de calqueLegende qui recupere le panel legende associe + */ + @Override + protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { + FuLog.warning("J'ajoute un nouveau BCalqueLegendePanel dans la widget legende:" + _pnLeg); + + legendePanel_ = _pnLeg; + + // createLegende(); + } + + /** + * cree la legende en widget. + * + * @return EbliNode cree ajoute a la scene. + */ + public EbliNode createLegende() { + + // legendePanel_.setVisible(true); + // legendePanel_.setSize(150, 300); + // legendePanel_.setPreferredSize(new Dimension(150, 300)); + // legendePanel_.setMinimumSize(new Dimension(150, 300)); + // + // // EbliWidgetCreatorLegende creator = new + // // EbliWidgetCreatorLegende(legendePanel_); + // // legendePanel_.setDoubleBuffered(false); + // // BuLib.setDoubleBuffered(legendePanel_, false); + + EbliNodeDefault def = new EbliNodeDefault(); + def.setPreferedLocation(new Point(200, 200)); + // def.setPreferedSize(new Dimension(150, 250)); + def.setCreator(new EbliWidgetCreatorLegende(legendePanel_)); + def.setTitle("L\xE9gende calque"); + // TODO non stable + scene_.addNode(def); + scene_.refresh(); + + return def; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-02 21:48:34 UTC (rev 3864) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -37,13 +37,13 @@ /** * widget de la legende */ - EbliWidgetCalqueLegende legendeWidget_; + CalqueLegendeWidgetAdapter legendeWidget_; - public EbliWidgetCalqueLegende getLegendeWidget_() { + public CalqueLegendeWidgetAdapter getLegendeWidget_() { return legendeWidget_; } - public void setLegendeWidget_(EbliWidgetCalqueLegende legendeWidget_) { + public void setLegendeWidget_(CalqueLegendeWidgetAdapter legendeWidget_) { this.legendeWidget_ = legendeWidget_; } @@ -168,7 +168,7 @@ if (!widget_.getEbliScene().isObject(getNodeLegende())) { if (this.legendeWidget_ == null) { - legendeWidget_ = (EbliWidgetCalqueLegende) widgetCalque_.calquePanel_.getCqLegend(); + legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); } // -- creation de la legende setNodeLegende(legendeWidget_.createLegende()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-02 21:48:34 UTC (rev 3864) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-02 21:51:32 UTC (rev 3865) @@ -12,21 +12,20 @@ * Creator pour les legendes des calques * * @author Adrien Hadoux - * */ public class EbliWidgetCreatorLegende implements EbliWidgetCreator { BCalqueLegendePanel g; - // EbliWidget res; + // EbliWidget res; EbliWidgetBordure res; - - BArbreCalqueModel modelTreeCalque_; - public EbliWidgetCreatorLegende(BCalqueLegendePanel g, BArbreCalqueModel model) { + // BArbreCalqueModel modelTreeCalque_; + + public EbliWidgetCreatorLegende(BCalqueLegendePanel g/* , BArbreCalqueModel model */) { super(); this.g = g; - modelTreeCalque_ = model; + // modelTreeCalque_ = model; } public BCalqueLegendePanel getG() { @@ -38,15 +37,10 @@ } public EbliWidget create(EbliScene _scene) { - EbliWidget widgetLegende_ = EbliWidgetCalqueLegende.createLegendeWidget( - new EbliWidgetCalqueLegende.WidgetCalqueLegende(_scene, false, modelTreeCalque_, g), g, _scene, - modelTreeCalque_); + EbliWidget widgetLegende_ = CalqueLegendeWidgetAdapter.createLegendeWidget( + new EbliWidgetCalqueLegende(_scene, false, g), g, _scene); res = new EbliWidgetBordure(widgetLegende_, true, false); - - // g.getModel().addModelListener(new EbliWidgetGrapheController(res)); - - - + return res; } @@ -62,6 +56,5 @@ public EbliWidgetBordure getBordure() { return res; } - -} +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-03 17:05:24
|
Revision: 3875 http://fudaa.svn.sourceforge.net/fudaa/?rev=3875&view=rev Author: hadouxad Date: 2008-09-03 17:05:28 +0000 (Wed, 03 Sep 2008) Log Message: ----------- - refactorisation de trpostLayoutFille - il n' y a plus qu'une unique creation des composants graphique pour les objets calques, graphe et scene - methode d acces au composants graphiques sont dans les controlleurs - getOverviewComponent () donne l arbre principal - getToolbarComponent() donne la toolbar - getMenus() donne le menu - methode addFonctionsSpecific() qui permet d ajouter des actions haut niveau (trpost) sans etre g?\195?\169n?\195?\169 cot?\195?\169 ebli - methode du trpostfilel sont synchronized pour eviter de faire bugger les composant si on clic comme un fou... - ajout du trac?\195?\169 souris dans le cas du calque - creation d un controller de la scene qui gere les actions et els constructions graphiques - l'arbre et de la scene est inclu dans l objet EbliSceneController necessaire pour la gestion multi scene - mise en oeuvre le syst?\195?\168me d?\195?\169crit hier pour la creation de toutes les courbes dans n'importe quel graphe - action disponible dans la palette principale - selection simultan?\195?\169e des graphes et du calque unique - gestion des messages d erreurs en cas de prob. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java Modified: 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 2008-09-03 16:55:56 UTC (rev 3874) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-09-03 17:05:28 UTC (rev 3875) @@ -34,5 +34,11 @@ */ public boolean isMovable(); + /** + * obtient la widget associee + * + * @return + */ + public EbliWidget getWidget(); } 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-09-03 16:55:56 UTC (rev 3874) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-03 17:05:28 UTC (rev 3875) @@ -5,9 +5,8 @@ import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; -import org.netbeans.api.visual.action.ActionFactory; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.netbeans.api.visual.action.SelectProvider; -import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; @@ -20,6 +19,19 @@ */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { + /** + * model de la scene pour l affichage de ses composants + */ + EbliWidgetJXTreeTableModel treeModel_; + + /** + * controller de la scene qui gere les actions et les constructions graphiques + */ + private EbliSceneController controller_; + + + + private class ObjectSelectProvider implements SelectProvider { public boolean isAimingAllowed(Widget widget, Point localLocation, boolean invertSelection) { @@ -48,8 +60,7 @@ } - final private WidgetAction alignWithMoveAction; - final private WidgetAction alignWithResizeAction; + /** * Le gestionnaire de commande associe \xE0 la scene */ @@ -59,8 +70,10 @@ private LayerWidget interactionLayer_; - public final WidgetAction rectangularSelection_; + + + /** * la visu du graphscene */ @@ -79,21 +92,14 @@ visu_ = new LayerWidget(this); addChild(visu_); + // -- creation de son model tree --// + treeModel_ = new EbliWidgetJXTreeTableModel(this); + + // -- creation de son controlleur --// + controller_ = new EbliSceneController(this); - alignWithMoveAction = ActionFactory.createAlignWithMoveAction(visu_, interactionLayer_, ActionFactory - .createDefaultAlignWithMoveDecorator(), false); - alignWithResizeAction = ActionFactory.createAlignWithResizeAction(visu_, interactionLayer_, ActionFactory - .createDefaultAlignWithMoveDecorator(), false); - - rectangularSelection_=ActionFactory.createRectangularSelectAction(this, interactionLayer_); - // -- ajoute l'action du zoom ( ctrl + clic) - getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); - getActions().addAction(rectangularSelection_); - // -- ajouter le menu popup de base - setMenuBase(); - } @Override @@ -157,17 +163,8 @@ return visu_; } - public WidgetAction getMoveAction() { - return alignWithMoveAction; - } + - /** - * @return the rectangularSelection - */ - public WidgetAction getRectangularSelection() { - return rectangularSelection_; - } - public LayerWidget getVisu() { return visu_; } @@ -243,53 +240,24 @@ editor_ = _editor; } - 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; - // } - // })); - } + public void setVisu_(LayerWidget visu_) { this.visu_ = visu_; } + - + public LayerWidget getInteractionLayer() { + return interactionLayer_; + } + + public EbliSceneController getController() { + return controller_; + } + public EbliWidgetJXTreeTableModel getTreeModel() { + return treeModel_; + } + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-09-03 17:05:28 UTC (rev 3875) @@ -0,0 +1,173 @@ +package org.fudaa.ebli.visuallibrary; + +import javax.swing.ListSelectionModel; + +import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.model.ObjectSceneEventType; + +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuToolBar; + +public class EbliSceneController { + /** + * Tree qui contient la hierarchie des widget de la scene. + */ + JXTreeTable treeScene_ = null; + + BuToolBar toolbarCalque_ = null; + BuMenuBar menuCalque_ = null; + + EbliScene scene_; + + final private WidgetAction alignWithMoveAction; + final private WidgetAction alignWithResizeAction; + + + + public final WidgetAction rectangularSelection_; + + public EbliSceneController(EbliScene _scene) { + + + scene_ = _scene; + + + + alignWithMoveAction = ActionFactory.createAlignWithMoveAction(scene_.getVisu(), scene_.getInteractionLayer(), + ActionFactory + .createDefaultAlignWithMoveDecorator(), false); + + alignWithResizeAction = ActionFactory.createAlignWithResizeAction(scene_.getVisu(), scene_.getInteractionLayer(), + ActionFactory + .createDefaultAlignWithMoveDecorator(), false); + + rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); + // -- ajoute l'action du zoom ( ctrl + clic) + scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + scene_.getActions().addAction(rectangularSelection_); + + // -- ajouter le menu popup de base + setMenuBase(); + + } + + + 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; + // } + // })); + } + + /** + * Methode qui retourne ou cree le tree associe a la scene + * + * @return + */ + public JXTreeTable getOverviewComponent() { + + if (treeScene_ != null) { + + // FuLog.warning("treeScene JE SUIS PA nul"); + return treeScene_; + } + + treeScene_ = new JXTreeTable(scene_.getTreeModel()); + + // -- ajout du tree au model pour les dimensionnements --// + // modeltable.setTree_(tree_); + + // --vision du noeud root --// + treeScene_.setRootVisible(false); + + // --ajout du renderer pour les images-// + treeScene_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); + + // -- ouvert par defaut --// + treeScene_.expandAll(); + + // -- ajout des highlighters customs --// + treeScene_.setHighlighters(HighlighterFactory.createSimpleStriping()); + treeScene_.setShowsRootHandles(true); + // -- selection unique --// + treeScene_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + treeScene_.setEditable(true); + + // --dimensions des colonnes --// + treeScene_.getColumn(0).setPreferredWidth(60); + treeScene_.getColumn(1).setPreferredWidth(50); + treeScene_.getColumn(2).setPreferredWidth(5); + // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se + // redimensionnents + treeScene_.getColumn(0).setResizable(false); + treeScene_.getColumn(1).setResizable(false); + treeScene_.getColumn(2).setResizable(false); + treeScene_.validate(); + + // -- ajout du synchroniser du tree/scene --// + + scene_.addObjectSceneListener(new EbliWidgetSynchroniser(scene_.getTreeModel(), treeScene_), + ObjectSceneEventType.OBJECT_SELECTION_CHANGED); + + return treeScene_; + + } + + public BuToolBar getToolbarComponent() { + return null; + } + + public BuMenuBar getMenubarComponent() { + return null; + } + public WidgetAction getMoveAction() { + return alignWithMoveAction; + } + + /** + * @return the rectangularSelection + */ + public WidgetAction getRectangularSelection() { + return rectangularSelection_; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-03 16:55:56 UTC (rev 3874) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-03 17:05:28 UTC (rev 3875) @@ -26,10 +26,15 @@ */ EbliWidget intern_; - + /** + * Retourne le controlleur de son objet contenu. Le controlleur de la bordure + * n'a pas besoin d'etre recup\xE9r\xE9. + */ + @Override + public EbliWidgetController getController_() { + return getIntern().getController_(); + } - - public float epaisseurHisto_ = 0; /** * constructeur qui gere un controller uniquement pour les actions. Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-03 16:55:56 UTC (rev 3874) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-03 17:05:28 UTC (rev 3875) @@ -5,13 +5,16 @@ import java.awt.event.ActionListener; import java.util.ArrayList; +import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; @@ -23,7 +26,9 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuResource; +import com.memoire.bu.BuToolBar; /** * Classe qui g\xE8re les actions de contr\xF4le de la widget @@ -94,7 +99,7 @@ widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); - actionMove_ = widget_.getEbliScene().getMoveAction(); + actionMove_ = widget_.getEbliScene().getController().getMoveAction(); if (canMove_) widget_.getActions().addAction(actionMove_); } @@ -317,4 +322,34 @@ this.widget_ = widget_; }; + + public JComponent getOverviewComponent() { + + + + return null; + } + + public BuToolBar getToolbarComponent() { + return null; + } + + public BuMenuBar getMenubarComponent() { + return null; + } + public void addFonctionsSpecific(ArrayList<EbliActionSimple> _listeActions) { + + } + + public boolean fonctionsAlreadySpecified() { + return false; + } + + + public JComponent gettracableComponent() { + + return new JLabel(); + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-30 10:49:11
|
Revision: 4112 http://fudaa.svn.sourceforge.net/fudaa/?rev=4112&view=rev Author: hadouxad Date: 2008-10-30 10:49:01 +0000 (Thu, 30 Oct 2008) Log Message: ----------- correction fin rapport recette lot 1 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroup.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/EbliWidgetActiontextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/AlignWithResizeProportionalStrategy.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliAlignWithMoveStrategyProvider.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliWidgetActionFactory.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/MoveAction.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/ Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -7,8 +7,8 @@ import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; -import org.fudaa.ebli.visuallibrary.resizestrategy.EbliAlignWithMoveStrategyProvider; -import org.fudaa.ebli.visuallibrary.resizestrategy.EbliWidgetActionFactory; +import org.fudaa.ebli.visuallibrary.bahaviorstrategy.EbliAlignWithMoveStrategyProvider; +import org.fudaa.ebli.visuallibrary.bahaviorstrategy.EbliWidgetActionFactory; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.HighlighterFactory; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroup.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroup.java 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroup.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -1,5 +1,14 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Dimension; +import java.awt.Point; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.netbeans.api.visual.widget.Widget; + /** * Widget qui a pour but de grouper plusieurs sous widget. * @@ -9,9 +18,62 @@ public final static String NOGROUP = "N/A"; + + /** + * Enregistre les proportions des widgets initialement par rapport a la taille de la widget + */ + public Map<EbliWidget,Couple> listeProportionsWidgets=new HashMap<EbliWidget,Couple>(); + public EbliWidgetGroup(final EbliScene scene) { super(scene); // TODO Auto-generated constructor stub } + + + private class Couple{ + public double propX; + public double propY; + public Couple(double propX, double propY) { + super(); + this.propX = propX; + this.propY = propY; + } + } + + public void setProportions(){ + if(getPreferredSize()==null) + return; + double width=getPreferredSize().width; + double height=getPreferredSize().height; + + for(Widget widget:getChildren()){ + if(widget instanceof EbliWidget && widget.getPreferredSize()!=null){ + double w=widget.getPreferredSize().width; + double h=widget.getPreferredSize().height; + + Couple prop=new Couple(w/width,h/height); + listeProportionsWidgets.put((EbliWidget) widget, prop); + } + + } + } + + public Dimension getPropDimension(EbliWidget widget){ + + Couple proportions=listeProportionsWidgets.get(widget); + if(proportions==null) + return null; + + if(getBounds()==null) + return null; + int width=getBounds().width; + int height=getBounds().height; + + double w=proportions.propX*width; + double h=proportions.propY*height; + + return new Dimension((int)w,(int)h); + } + } Modified: 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 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -15,7 +15,7 @@ import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuPanel; -public class EbliWidgetTextEditor extends EbliWidget implements InplaceEditorProvider<BuPanel> { +public class EbliWidgetTextEditor extends EbliWidget implements InplaceEditorProvider<CtuluHtmlEditorPanel> { // editeur de texte CtuluHtmlEditorPanel editorPane_ = new CtuluHtmlEditorPanel(); @@ -30,7 +30,8 @@ super(scene, false); editorPane_ = content; - intern_ = new ComponentWidget(scene, contenuHTML_); + intern_ = new ComponentWidget(scene, contenuHTML_); + // intern_ = new ComponentWidget(scene, editorPane_.); contenuHTML_.setText(content.getDocumentText()); // -- ajout en interne du label d affichage --// @@ -81,7 +82,7 @@ // // // } - public BuPanel createEditorComponent( + public CtuluHtmlEditorPanel createEditorComponent( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget) { // --creation du panel ekitcore if (conteneur == null) { @@ -99,21 +100,21 @@ } // -- on masque l affichage du widgetcomponent --// - contenuHTML_.setText(""); + // contenuHTML_.setText(""); - return conteneur; + return editorPane_; } public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, - final BuPanel editor) { + final CtuluHtmlEditorPanel editor) { return null; } public Rectangle getInitialEditorComponentBounds( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, - final BuPanel editor, final Rectangle viewBounds) { + final CtuluHtmlEditorPanel editor, final Rectangle viewBounds) { return null; } @@ -133,9 +134,9 @@ // // } - public void notifyClosing(final EditorController _controller, final Widget _widget, final BuPanel _editor, + public void notifyClosing(final EditorController _controller, final Widget _widget, final CtuluHtmlEditorPanel _editor, final boolean _commit) { - // contenuHTML_.setText(editorPane_.getDocumentText()); + contenuHTML_.setText(editorPane_.getDocumentText()); intern_.repaint(); intern_.revalidate(); this.repaint(); @@ -144,10 +145,13 @@ } - public void notifyOpened(final EditorController _controller, final Widget _widget, final BuPanel _editor) { - // contenuHTML_.setText(CtuluHtmlEditorPanel.showMinimalHtmlDialog("", - // getEbliScene().getView(), true)); - editingStart(); + public void notifyOpened(final EditorController _controller, final Widget _widget, final CtuluHtmlEditorPanel _editor) { + //contenuHTML_.setText(CtuluHtmlEditorPanel.showMinimalHtmlDialog(contenuHTML_.getText(), + //getEbliScene().getView(), true)); + //editorPane_.setDocumentText(contenuHTML_.getText()); + // -- on masque l affichage du widgetcomponent --// + contenuHTML_.setText(""); + editingStart(); } Modified: 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 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -30,8 +30,8 @@ // -- creation de la widget et ajout dans la scene --// final EbliNodeDefault nodeText = new EbliNodeDefault(); nodeText.setTitle("Texte"); - final CtuluHtmlEditorPanel editor = new CtuluHtmlEditorPanel(EbliLib.getS("Double-cliquez pour \xE9diter"), - CtuluHtmlEditorPanel.getMinimalActions()); + final CtuluHtmlEditorPanel editor = new CtuluHtmlEditorPanel(EbliLib.getS("Double-cliquez pour \xE9diter")/*, + CtuluHtmlEditorPanel.getMinimalActions()*/); // editor.setDocumentText(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -165,6 +165,9 @@ } + //-- sauvegarde des proportions pour le ungroup --// + parent.setProportions(); + final EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); parent.setGroup(true); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-10-30 09:59:16 UTC (rev 4111) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -4,6 +4,7 @@ */ package org.fudaa.ebli.visuallibrary.actions; +import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; import java.util.ArrayList; @@ -14,6 +15,7 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.netbeans.api.visual.widget.Widget; @@ -55,7 +57,14 @@ w.removePropertyChangeListenerFormWidget((EbliWidget) widget); _n.setPreferedLocation(toScene); - _n.setPreferedSize(widget.getPreferredSize()); + + //-- on essaie de recuperere les proportions --// + //getPropDimension + Dimension sizeProp=((EbliWidgetGroup)_n.getWidget().getIntern()).getPropDimension((EbliWidget) widget); + if(sizeProp!=null) + n.setPreferedSize(sizeProp); + else + n.setPreferedSize(widget.getPreferredSize()); // widget.setPreferredLocation(toScene); _scene.addNode(n).setPreferredLocation(toScene); n.getWidget().getController().replaceActionResize(); Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/AlignWithResizeProportionalStrategy.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/AlignWithResizeProportionalStrategy.java 2008-10-29 20:57:44 UTC (rev 4109) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/AlignWithResizeProportionalStrategy.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -1,4 +1,4 @@ -package org.fudaa.ebli.visuallibrary.resizestrategy; +package org.fudaa.ebli.visuallibrary.bahaviorstrategy; import java.awt.Insets; import java.awt.Point; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliAlignWithMoveStrategyProvider.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliAlignWithMoveStrategyProvider.java 2008-10-29 20:57:44 UTC (rev 4109) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliAlignWithMoveStrategyProvider.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -2,7 +2,7 @@ * Licence GPL * Copyright Genesis */ -package org.fudaa.ebli.visuallibrary.resizestrategy; +package org.fudaa.ebli.visuallibrary.bahaviorstrategy; import java.awt.Point; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliWidgetActionFactory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/EbliWidgetActionFactory.java 2008-10-29 20:57:44 UTC (rev 4109) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/EbliWidgetActionFactory.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -1,4 +1,4 @@ -package org.fudaa.ebli.visuallibrary.resizestrategy; +package org.fudaa.ebli.visuallibrary.bahaviorstrategy; import java.awt.BasicStroke; import java.awt.Color; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/MoveAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/resizestrategy/MoveAction.java 2008-10-29 20:57:44 UTC (rev 4109) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/bahaviorstrategy/MoveAction.java 2008-10-30 10:49:01 UTC (rev 4112) @@ -1,4 +1,4 @@ -package org.fudaa.ebli.visuallibrary.resizestrategy; +package org.fudaa.ebli.visuallibrary.bahaviorstrategy; import java.awt.Point; import java.awt.event.MouseEvent; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-12-08 18:25:41
|
Revision: 4281 http://fudaa.svn.sourceforge.net/fudaa/?rev=4281&view=rev Author: hadouxad Date: 2008-12-08 18:25:30 +0000 (Mon, 08 Dec 2008) Log Message: ----------- ***** Correction du Bug zoom:***** l'affichage du calque est op?\195?\169rationnel et proportionnel a sa widget! en utilisant la m?\195?\169thode calquePanel_.restaurer(); Mais the question is: Is the method optimized? (tout est dans EbliWidgetVueCalque) **** Evolution: Fonction duplcation layout **** possibilit?\195?\169 via le clic sur un bouton de dupliquer int?\195?\169gralement le contenu d'un layout et de g?\195?\169n?\195?\169rer une nouvelle trpostLayoutfille pour l'occasion Menu actions du trpostlayout 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/behavior/AlignWithResizeProportionalStrategy.java 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/actions/EbliWidgetActionDuplicateLayout.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-12-08 18:24:57 UTC (rev 4280) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-12-08 18:25:30 UTC (rev 4281) @@ -343,6 +343,44 @@ } + /** + * Methode qui redimensionne proportionellement les widget \xE0 la scene + * @param size + */ + public void resizeInnerWidget(Dimension newSize,Dimension oldSize){ + // this.getVisu().setPreferredSize(newSize); + if(getNodes().size()==0) + return; + for (final Iterator<EbliNode> it2 = getNodes().iterator(); it2.hasNext();) { + + final EbliNode currentNode = it2.next(); + if (currentNode != null && currentNode.hasWidget()) { + + + Rectangle oldRectangle=currentNode.getWidget().getPreferredBounds(); + + double proportionW=newSize.width*oldRectangle.width/oldSize.width; + double proportionH=newSize.width*oldRectangle.height/oldSize.height; + + + // -- retaillage --// + currentNode.getWidget().setPreferredBounds( + new Rectangle(new Dimension((int)proportionW, (int)proportionH))); + + + // -- rafraichissement de la scene --// + this.refresh(); + + } + } + + // this.setPreferredSize(newSize); + + + } + + + public void moveWidgetTo(EbliWidget widget, int position){ //-- ne marche pas.......................... --// Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java 2008-12-08 18:25:30 UTC (rev 4281) @@ -0,0 +1,129 @@ +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 org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGrapheController; + + +/** + * Action qui duplique l'ensemble des widget d'un layout vers un autre + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionDuplicateLayout extends EbliWidgetActionSimple { + + /** + * + */ + + /** + * Possibilit\xE9 de changer la scene de destination + */ + EbliScene sceneDestination_ = null; + + private static final long serialVersionUID = 1L; + + final CtuluCommandContainer cmd_; + + public EbliWidgetActionDuplicateLayout(final EbliScene _scene) { + super(_scene, EbliResource.EBLI.getString("Dupliquer la sc\xE8ne"), CtuluResource.CTULU + .getIcon("crystal_cascade.png"), "DUPLICATE"); + + putValue(NAME, EbliResource.EBLI.getString("Dupliquer la sc\xE8ne")); + cmd_ = _scene.getCmdMng(); + + } + + @Override + public void actionPerformed(final ActionEvent e) { + // -- recuperation de la liste des widgets selectionnees --// + + final Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); + + final ArrayList<EbliNode> listeNodeADupliquer = new ArrayList<EbliNode>(listeNode); + + ArrayList<EbliNode> listeNodeUndo = new ArrayList<EbliNode>(); + + + sceneDestination_ = selectionneSceneNode(); + + // -- duplication des noeuds saisis --// + for (final Iterator<EbliNode> it = listeNodeADupliquer.iterator(); it.hasNext();) { + final EbliNode currentNode = it.next(); + + // -- duplication du node --// + + EbliNode node = currentNode.getWidget().getController().duplication(listeNodeUndo, sceneDestination_); + + //--repositionnement des nodes dans le layout a la position initiale --// + if(node!=null){ + node.getWidget().setPreferredLocation(currentNode.getWidget().getLocation()); + + + + //cas particuliers: les l\xE9gendes calques + if(node.getWidget().getIntern() instanceof EbliWidgetVueCalque){ + EbliWidgetVueCalque calque=(EbliWidgetVueCalque)node.getWidget().getIntern(); + //-- on verifie si il y a legende ou pas --// + if(calque.getCalqueController().hasLegende()){ + //-- on recupere la location de la legende duplicata --// + Point legendeLocation=((EbliWidgetVueCalque)currentNode.getWidget().getIntern()).nodeLegende.getWidget().getLocation(); + if(legendeLocation!=null){ + calque.nodeLegende.getWidget().setPreferredLocation(legendeLocation); + } + + } + + } + + //cas particuliers: les l\xE9gendes graphes + if(node.getWidget().getIntern() instanceof EbliWidgetGraphe){ + EbliWidgetGraphe graphe=(EbliWidgetGraphe)node.getWidget().getIntern(); + //-- on verifie si il y a legende ou pas --// + if(((EbliWidgetControllerGraphe)graphe.getController()).hasLegende()){ + //-- on recupere la location de la legende duplicata --// + Point legendeLocation=((EbliWidgetGraphe)currentNode.getWidget().getIntern()).getNodeLegende().getWidget().getLocation(); + if(legendeLocation!=null){ + graphe.getNodeLegende().getWidget().setPreferredLocation(legendeLocation); + } + + } + + } + + + sceneDestination_.refresh(); + } + + + } + + + cmd_.addCmd(new CommandeDuplicate(listeNodeUndo, sceneDestination_)); + // -- creation de l action undo/redo pour les nodes --// + // cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, + // sceneDestination_)); + + } + + /** + * methode qui doit etre surchargee par les filles pour selectionner la scene de destination + */ + protected EbliScene selectionneSceneNode() { + + return scene_; + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/behavior/AlignWithResizeProportionalStrategy.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/behavior/AlignWithResizeProportionalStrategy.java 2008-12-08 18:24:57 UTC (rev 4280) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/behavior/AlignWithResizeProportionalStrategy.java 2008-12-08 18:25:30 UTC (rev 4281) @@ -6,6 +6,7 @@ import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.netbeans.api.visual.action.AlignWithMoveDecorator; import org.netbeans.api.visual.action.AlignWithWidgetCollector; import org.netbeans.api.visual.action.ResizeProvider; @@ -197,8 +198,11 @@ suggestedBounds.height = (int) (hDivParW * suggestedBounds.width); } } - + } + + + return widget.convertSceneToLocal(suggestedBounds); } 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-12-08 18:24:57 UTC (rev 4280) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-12-08 18:25:30 UTC (rev 4281) @@ -51,6 +51,8 @@ Window frame_; BufferedImage image; + + public GrBoite initZoom_; BuPanel conteneurEditor; @@ -183,10 +185,22 @@ final Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - + CtuluLibImage.setCompatibleImageAsked(params); + + + //- on enregistre le zoom en memoire --// + //GrBoite zoomMemoire=calquePanel_.getVueCalque().getViewBoite(); + + //-- on redessinne --// image = calquePanel_.produceImage(rec.width, rec.height, params); - + + //-- on remet le repere au max de la clientArea de la widget --// + //calquePanel_.getVueCalque().changeRepere(this, zoomMemoire); + + + calquePanel_.restaurer(); } + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } @@ -291,5 +305,13 @@ } + + public BufferedImage getImage() { + return image; + } + + public void setImage(BufferedImage image) { + this.image = image; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |