From: <had...@us...> - 2008-08-20 15:07:12
|
Revision: 3829 http://fudaa.svn.sourceforge.net/fudaa/?rev=3829&view=rev Author: hadouxad Date: 2008-08-20 15:07:17 +0000 (Wed, 20 Aug 2008) Log Message: ----------- - Modification de l'ajout des graphes: ajoute directement dans la scene le widget - implementation de l niterface ObjectSceneListener pour trPostLayoutFille qui modifie l'arbre de FudaaImplementation et sa toolBar des reception du notify - Composant scrollPane de droite en memoire et toolbar de la frame en memoire - Modification de ces composants en fonction du type de widget selectionne 4 cas: - Calque selectionne: affichage du tree calque a droite et de sa toolbar et menu dans trpostlayoutfille - Graphe selectionne: affichage du tree graphe a droite et de sa toolbar et menu dans trpostlayoutfille - Autre composant selectionne: affichage du tree des widgets a droite et toolbar et menu contient juste action modif couleur contour,rotation... - Rien de selectionn?\195?\169: on affiche le tree des widgets - Amelioration pour EDF: Un seul clic sur le widget: modification du widget (CF: EbliActionEditorOneClick) - creation de l editeur dans la widget pour les graphes - creation de l editeur dans la widget pour les calques - Depuis l'editeur de graphe et calque, possibilit?\195?\169 d'exporter ers la fenetre dock avec toutes les fonctionnalites - Demarrage du post avec les fonctions associees au calque. - Bouton permettant de recr?\195?\169er un calque initial (si jamais l'utilisateur supprime le sien...) - Correction du bug de configurer les graphismes du graphe. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.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/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/all/FudaaCourbeExample.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/all/TestFudaaDjaFrame.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -31,7 +31,7 @@ * La classe de l'objet doit etre la meme que getComponentClass. * @return le composant a l'etat initiale. Appele la premiere fois pour construire le composant. */ - JComponent createComponent(); + JComponent createPanelComponent(); /** * La classe de l'objet doit etre la meme que getComponentClass. * @param o le composant a mettre a jour Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -148,7 +148,7 @@ pn_.getController().clearSelections(); } - public JComponent createComponent() { + public JComponent createPanelComponent() { if (arbre_ == null) { arbre_ = new BArbreCalque(); arbre_.setName("ARBRE_CALQUE"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -95,7 +95,7 @@ TableModel listModel_; - public JComponent createComponent() { + public JComponent createPanelComponent() { if (list_ == null) { list_ = new EGListSimple(); list_.setColumnSelectionAllowed(false); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -92,7 +92,7 @@ EGSpecificActions actions_; EGTree tree_; - public JComponent createComponent(){ + public JComponent createPanelComponent(){ if (tree_ == null) { if (CtuluLibMessage.DEBUG) { CtuluLibMessage.debug("init composant pour graphe fille"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -6,4 +6,6 @@ void nodeRemoved(EbliNode node); + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -197,7 +197,26 @@ } } + + /** + * Methode qui permet d envoyer le signal du node selectionn\xE9 a tous les + * listener + * + * @param listener + */ + public void notifyAllListenerNodeSelected(EbliNode node) { + if (listenerList == null) + return; + for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + EbliNodeListener listener = it.next(); + listener.nodeRemoved(node); + } + + } + + + @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { // -- notifier tous les listener que le noeud a ete attache --// 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-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -110,7 +110,7 @@ */ public Object getProperty(String _key) { - System.err.println("suis dans getProperty key= " + _key); + // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// @@ -133,7 +133,7 @@ */ public boolean setProperty(String _key, Object prop) { - System.err.println("Je suis rentre dans setProperty key= " + _key); + // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// @@ -224,32 +224,8 @@ */ public void constructPopupMenuBase(JPopupMenu _popup) { - JMenuItem menuItem4 = _popup.add("Configuration graphique"); - menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); - // BuResource.BU.getIcon("configurer") - menuItem4.addActionListener(new ActionListener() { + - public void actionPerformed(ActionEvent e) { - - EbliWidget found = EbliWidget.this; - - BConfigurePalette palette = new BConfigurePalette(false); - - BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); - - palette.setTargetConf(cmp); - JDialog d = new JDialog(); - d.setModal(true); - d.setTitle("Configuration graphique"); - d.setContentPane(palette); - - d.pack(); - d.setVisible(true); - - } - - }); - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); menuItem3.addActionListener(new ActionListener() { @@ -349,6 +325,8 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + // -- construction du menu pour les graphismees --// + constructPopupMenuBaseGraphique(popup); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); @@ -357,6 +335,42 @@ })); } + /** + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il + * n a aucun effet. + * + * @param _popup + */ + public void constructPopupMenuBaseGraphique(JPopupMenu _popup) { + + JMenuItem menuItem4 = _popup.add("Configuration"); + menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); + // BuResource.BU.getIcon("configurer") + menuItem4.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget found = EbliWidget.this; + + BConfigurePalette palette = new BConfigurePalette(false); + + BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setModal(true); + d.setTitle("Configuration graphique"); + d.setContentPane(palette); + + d.pack(); + d.setVisible(true); + + } + + }); + } + + public void setScene_(EbliScene scene_) { this.scene_ = scene_; } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -0,0 +1,210 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.util.EnumSet; + +import javax.swing.JComponent; + +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.util.GeomUtil; + +/** + * Classe qui permet d'ouvrir l editor en 1 seul clic. + * + * @author David Kaspar + * @pompeur Adrien Hadoux + * + */ +public final class EbliActionEditorOneClick<C extends JComponent> extends WidgetAction.LockedAdapter implements + InplaceEditorProvider.EditorController { + + private InplaceEditorProvider<C> provider; + + private C editor = null; + private Widget widget = null; + private Rectangle rectangle = null; + + public EbliActionEditorOneClick(InplaceEditorProvider<C> provider) { + this.provider = provider; + } + + protected boolean isLocked() { + return editor != null; + } + +/** + * Modification ici: pour activer l editor, il suffit d appuyer une seule fois + * sur l editeur + */ + public State mouseClicked(Widget widget, WidgetMouseEvent event) { + if (event.getButton() == MouseEvent.BUTTON1 /*&& event.getClickCount() == 2*/) { + if (openEditor(widget)) + return State.createLocked(widget, this); + } + return State.REJECTED; + } + + public State mousePressed(Widget widget, WidgetMouseEvent event) { + if (editor != null) + closeEditor(true); + return State.REJECTED; + } + + public State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) { + if (editor != null) + closeEditor(true); + return State.REJECTED; + } + + public State keyPressed(Widget widget, WidgetKeyEvent event) { + if (event.getKeyChar() == KeyEvent.VK_ENTER) + if (openEditor(widget)) + return State.createLocked(widget, this); + return State.REJECTED; + } + + public final boolean isEditorVisible() { + return editor != null; + } + + public final boolean openEditor(Widget widget) { + if (editor != null) + return false; + + Scene scene = widget.getScene(); + JComponent component = scene.getView(); + if (component == null) + return false; + + editor = provider.createEditorComponent(this, widget); + if (editor == null) + return false; + this.widget = widget; + + component.add(editor); + provider.notifyOpened(this, widget, editor); + + Rectangle rectangle = widget.getScene().convertSceneToView(widget.convertLocalToScene(widget.getBounds())); + + Point center = GeomUtil.center(rectangle); + Dimension size = editor.getMinimumSize(); + if (rectangle.width > size.width) + size.width = rectangle.width; + if (rectangle.height > size.height) + size.height = rectangle.height; + int x = center.x - size.width / 2; + int y = center.y - size.height / 2; + + rectangle = new Rectangle(x, y, size.width, size.height); + updateRectangleToFitToView(rectangle); + + Rectangle r = provider.getInitialEditorComponentBounds(this, widget, editor, rectangle); + this.rectangle = r != null ? r : rectangle; + + editor.setBounds(x, y, size.width, size.height); + notifyEditorComponentBoundsChanged(); + editor.requestFocusInWindow(); + + return true; + } + + private void updateRectangleToFitToView(Rectangle rectangle) { + JComponent component = widget.getScene().getView(); + if (rectangle.x + rectangle.width > component.getWidth()) + rectangle.x = component.getWidth() - rectangle.width; + if (rectangle.y + rectangle.height > component.getHeight()) + rectangle.y = component.getHeight() - rectangle.height; + if (rectangle.x < 0) + rectangle.x = 0; + if (rectangle.y < 0) + rectangle.y = 0; + } + + public final void closeEditor(boolean commit) { + if (editor == null) + return; + Container parent = editor.getParent(); + Rectangle bounds = parent != null ? editor.getBounds() : null; + provider.notifyClosing(this, widget, editor, commit); + boolean hasFocus = editor.hasFocus(); + if (bounds != null) { + parent.remove(editor); + parent.repaint(bounds.x, bounds.y, bounds.width, bounds.height); + } + editor = null; + widget = null; + rectangle = null; + if (hasFocus) + if (parent != null) + parent.requestFocusInWindow(); + } + + public void notifyEditorComponentBoundsChanged() { + EnumSet<InplaceEditorProvider.ExpansionDirection> directions = provider + .getExpansionDirections(this, widget, editor); + if (directions == null) + directions = EnumSet.noneOf(InplaceEditorProvider.ExpansionDirection.class); + Rectangle rectangle = this.rectangle; + Dimension size = editor.getPreferredSize(); + Dimension minimumSize = editor.getMinimumSize(); + if (minimumSize != null) { + if (size.width < minimumSize.width) + size.width = minimumSize.width; + if (size.height < minimumSize.height) + size.height = minimumSize.height; + } + + int heightDiff = rectangle.height - size.height; + int widthDiff = rectangle.width - size.width; + + boolean top = directions.contains(InplaceEditorProvider.ExpansionDirection.TOP); + boolean bottom = directions.contains(InplaceEditorProvider.ExpansionDirection.BOTTOM); + + if (top) { + if (bottom) { + rectangle.y += heightDiff / 2; + rectangle.height = size.height; + } else { + rectangle.y += heightDiff; + rectangle.height = size.height; + } + } else { + if (bottom) { + rectangle.height = size.height; + } else { + } + } + + boolean left = directions.contains(InplaceEditorProvider.ExpansionDirection.LEFT); + boolean right = directions.contains(InplaceEditorProvider.ExpansionDirection.RIGHT); + + if (left) { + if (right) { + rectangle.x += widthDiff / 2; + rectangle.width = size.width; + } else { + rectangle.x += widthDiff; + rectangle.width = size.width; + } + } else { + if (right) { + rectangle.width = size.width; + } else { + } + } + + updateRectangleToFitToView (rectangle); + + editor.setBounds (rectangle); + editor.repaint (); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -127,7 +127,9 @@ final DefaultDockingPort globalPort = createDockingPort(); JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("curves"), EbliLib.getS("Courbes")); DockingManager.dock(centerComponent, (DockingPort) globalPort); + // POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + tree.setSelectionModel(((EGGrapheTreeModel) pn.getGraphe().getModel()).getSelectionModel()); JComponent rightComponent = createView(new JScrollPane(tree), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); @@ -157,11 +159,11 @@ // return createView(panel, name, true); // } - protected static JComponent createView(JComponent jc, Icon ic, String name) { + public static JComponent createView(JComponent jc, Icon ic, String name) { return createView(jc, ic, name, false); } - protected static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { + public static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { View view = new View(name); view.setIcon(ic); view.getViewProperties().setDockingEnabled(false); @@ -171,6 +173,7 @@ } view.setContentPane(jc); view.setTitle(name, true); + view.setPreferredSize(jc.getPreferredSize()); // DockingManager.registerDockable(view.getComponent(), name); return view; 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-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -11,6 +12,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; +import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -27,14 +29,20 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.EditProvider; +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.widget.Widget; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; + + /** * * Classe permettant d'afficher un calque en tant que Widget @@ -42,7 +50,8 @@ * @author deniger * */ -public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { +public class EbliWidgetVueCalque extends EbliWidget implements +/* EditProvider */InplaceEditorProvider<BuPanel> { ZEbliCalquesPanel calquePanel_; @@ -50,11 +59,13 @@ public Color couleurFond = Color.white; private EbliNodeDefault nodeLegende = null; - + Window frame_; BufferedImage image; + BuPanel conteneurEditor; + GrBoite zoom_; public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { @@ -69,15 +80,61 @@ // calquePanel_.restaurer(); // -- creation de l action pour editor --// - WidgetAction editorAction = ActionFactory.createEditAction(this); - + // WidgetAction editorAction = ActionFactory.createEditAction(this); + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(this); + WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + + + } + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + + conteneurEditor = new BuPanel(new BorderLayout()); + + conteneurEditor.add(calquePanel_, BorderLayout.CENTER); + + BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + fonctionsCompletes.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // Cree la frame de docking associee au calque + edit(EbliWidgetVueCalque.this); + + } + + }); + conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); + + return conteneurEditor; + } + + /** + * appel\xE9 lors de la fermeture de l editeur. Il faut redessiner la widget. + */ + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + + zoom_ = calquePanel_.getVueCalque().getViewBoite(); + image = null; + getEbliScene().refresh(); + this.repaint(); + } + + /** + * Creer une frame qui contient toutes les fonctions pour modifier le calque. + * Ancienne methode edit(). + * + * @param _widget + */ public void edit(Widget _widget) { - if (frame_ != null) frame_.toFront(); + if (frame_ != null) + frame_.toFront(); else { final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); @@ -88,7 +145,10 @@ frame_ = getEbliScene().getEditor().createFrame(calquePanel_, getTitle()); p.x = p.x - 50; p.y = p.y - 50; - frame_.setLocation(p); + // frame_.setLocation(p); + // -- centrer la vue par rapport a la frame principal car si le widget est + // en bas a droite, c'est la merde! + frame_.setLocationRelativeTo(this.getScene().getView()); calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); @@ -96,16 +156,20 @@ @Override public void windowClosed(WindowEvent _e) { - if (frame_ != null) frame_.dispose(); + if (frame_ != null) + frame_.dispose(); frame_ = null; } @Override public void windowClosing(WindowEvent _e) { - setPreferredSize(calquePanel_.getVueCalque().getSize()); + // setPreferredSize(calquePanel_.getVueCalque().getSize()); zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; getEbliScene().refresh(); + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL + // EST + conteneurEditor.add(calquePanel_, BorderLayout.CENTER); } }); @@ -155,7 +219,7 @@ g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - + /** * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ @@ -164,18 +228,19 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); - // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); + return popup; } })); } private void constructPopupMenuSpecifique(JPopupMenu _popup) { JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -190,7 +255,7 @@ if (!EbliWidgetVueCalque.this.getEbliScene().isObject(nodeLegende)) { - + nodeLegende = new EbliNodeDefault(); // nodeLegende.setTitle("Legende calque"); // @@ -206,8 +271,8 @@ // methode qui permet d ajouter une legemde calquePanel_.addWidgetLegendeCalque(); - - + + EbliWidgetVueCalque.this.getEbliScene().refresh(); } @@ -219,9 +284,30 @@ } - - -// public void setColorFond(Color newColor) { + + + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, + BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, + BuPanel editor, + Rectangle viewBounds) { + return null; + } + + + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + + + // public void setColorFond(Color newColor) { // couleurFond = newColor; // repaint(); // } 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-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -19,6 +19,10 @@ public EGGraphe getGraphe() { return pn_.getGraphe(); } + + public EGFillePanel getGraphePanel() { + return pn_; + } // // public void setGraphe(EGGraphe graphe) { 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-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.graphe; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -11,6 +12,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; +import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -21,18 +23,25 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.image.CtuluLibImage; +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; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.EditProvider; +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.widget.Widget; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; /** @@ -41,18 +50,15 @@ * @author adrien hadoux * */ -public class EbliWidgetGraphe extends EbliWidget implements EditProvider/* - * , - * InplaceEditorProvider - * < - * BuPanel - * > - */{ +public class EbliWidgetGraphe extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel>, + EGGrapheModelListener { // private EGGraphe graphe_; Window frame_; EGFillePanel panelGraphe_; + BuPanel conteneurEditor; + private EbliNodeDefault nodeLegende = null; public Color couleurContour = Color.black; @@ -70,10 +76,16 @@ public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGFillePanel _pn) { super(scene); panelGraphe_ = _pn; - WidgetAction editorAction = ActionFactory.createEditAction(this); - + // WidgetAction editorAction = ActionFactory.createEditAction(this); + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(this); + WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + + + panelGraphe_.getGraphe().getModel().addModelListener(this); + } public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { @@ -93,10 +105,11 @@ if (frame_ == null) { getGraphe().setSize(rec.width - 1, rec.height - 1); -// getGraphe().computeMarges(g); -// getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); + // getGraphe().computeMarges(g); + // getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); } + // mode edition if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { FuLog.debug("EWI: recreate image"); @@ -107,14 +120,8 @@ } g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); - // -- couleur de fond --// - // g.setColor(couleurFond); - // g.fillRect(0, 0, rec.width, rec.height); + - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - g.translate(-rec.x, -rec.y); } @@ -126,16 +133,19 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + // -- 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 * @@ -143,7 +153,7 @@ */ private void constructPopupMenuSpecifique(JPopupMenu _popup) { JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -182,11 +192,42 @@ }); // -- creation du menu config de la courbe + _popup.add(new EGConfigureActionPalette(getGraphe().getModel())); + } + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + + conteneurEditor = new BuPanel(new BorderLayout()); + conteneurEditor.add(this.panelGraphe_, BorderLayout.CENTER); + + BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + fonctionsCompletes.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // Cree la frame de docking associee au graphe + edit(EbliWidgetGraphe.this); + } + + }); + conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); + + return conteneurEditor; + } + + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + } + // TODO a changer pour ne recreer tout plein de listener a chaque fois + /** + * Ancienne version de edit(). genere une frame complete pour prametrer le + * graphe. + */ public void edit(Widget _widget) { if (frame_ != null) frame_.toFront(); else { @@ -199,7 +240,8 @@ frame_ = getEbliScene().getEditor().createFrame(panelGraphe_, getTitle()); frame_.setPreferredSize(new Dimension(800, 600)); - frame_.setLocation(p); + // frame_.setLocation(p); + frame_.setLocationRelativeTo(this.getScene().getView()); frame_.pack(); frame_.addWindowListener(new WindowAdapter() { @@ -209,11 +251,16 @@ frame_ = null; } - public void windowClosing(WindowEvent _e) { -// zoom_ = calquePanel_.getVueCalque().getViewBoite(); + public void windowClosing(WindowEvent _e) { + // zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; getEbliScene().refresh(); - } + frame_ = null; + + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL + // EST + conteneurEditor.add(panelGraphe_, BorderLayout.CENTER); + } }); // calquePanel_.getVueCalque().changeRepere(this, gr); @@ -223,6 +270,54 @@ } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, + Rectangle viewBounds) { + return null; + } + + + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + + public void axeAspectChanged(EGAxe _c) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void axeContentChanged(EGAxe _c) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void structureChanged() { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + // public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider. // ExpansionDirection> getExpansionDirections( // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -5,14 +5,12 @@ import java.util.List; import javax.swing.Icon; -import javax.swing.tree.TreePath; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; import org.fudaa.ebli.visuallibrary.EbliScene; -import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; @@ -128,6 +126,8 @@ return CtuluLibString.EMPTY_STRING; } + + // /** // * Raffraichissement maison du jxtreetable // */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -788,7 +788,7 @@ } if (_evt.getInternalFrame() instanceof CtuluFilleWithComponent) { final CtuluFilleWithComponent c = (CtuluFilleWithComponent) _evt.getInternalFrame(); - oldRightComponent_ = c.createComponent(); + oldRightComponent_ = c.createPanelComponent(); addRightComponent(c); } else { removeRightComponent(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -73,7 +73,7 @@ } - public JComponent createComponent() { + public JComponent createPanelComponent() { return FudaaDjaBuilder.createDjaTable(getFudaaGrid()); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -4,6 +4,7 @@ import java.awt.Dimension; import java.awt.Point; import java.util.Iterator; +import java.util.List; import java.util.Set; import javax.swing.JButton; @@ -12,21 +13,39 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTree; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; +import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXCollapsiblePane; +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneEventType; +import org.netbeans.api.visual.model.ObjectSceneListener; +import org.netbeans.api.visual.model.ObjectState; import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuToolBar; import com.memoire.bu.BuUndoRedoInterface; + /** * InternalFrame qui contient la scene EbliScene. * @@ -34,7 +53,7 @@ * */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface { + BuUndoRedoInterface, BuCutCopyPasteInterface, ObjectSceneListener { /** * @@ -54,14 +73,51 @@ JComponent[] tools_; /** + * Toolbar modifiable qui se met a jour selon la selection de la widget. + */ + BuToolBar toolBarModifiable_ = new BuToolBar(); + + BuMenuBar menuModifiable_ = new BuMenuBar(); + + /** + * Scroll qui contient le tree a droite. Ce panel est modifi\xE9 des que l on + * change de type d elements. + */ + JScrollPane panelTreeModifiable_; + + /** + * Panel qui contient le tree modifiable + */ + JPanel conteneurTree_; + + /** + * bouton qui permet de masquer/afficher le tree + */ + JButton toggleTree_; + + /** * Constructeur de la fenetre. */ - public TrPostLayoutFille() { + public TrPostLayoutFille(TrPostProjet _projet) { super(); setTitle(TrResource.getS("vue 2D")); // creation de la scene EBLI - controller_ = new TrPostLayoutPanelController(new TrPostScene()); + controller_ = new TrPostLayoutPanelController(new TrPostScene(), _projet); setContentPane(controller_.getPanel()); + + // -- enregistrement de this comem listener de la scene pour le type d objet + // selection changed--// + controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED); + + + + // -- ajout de la toolbar et du menu en haut --// + toolBarModifiable_.setFloatable(false); + this.add(toolBarModifiable_, BorderLayout.NORTH); + this.setJMenuBar(menuModifiable_); + + // -- init du panel de choix des trees --// + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); } @@ -94,7 +150,10 @@ } } - public JComponent createComponent() { + /** + * Methode qui permet de modifier le panel sur la droite. + */ + public JComponent createPanelComponent() { if (right == null) { right = new JPanel(new BorderLayout()); @@ -106,8 +165,30 @@ over.add(pane, BorderLayout.CENTER); pane.add(getScene().createSatelliteView()); right.add(over, BorderLayout.NORTH); - right.add(new JScrollPane(controller_.createTree()), BorderLayout.CENTER); + + + pane = new JXCollapsiblePane(); + toggleTree_ = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + toggleTree_.setText("Composants"); + + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + // right.add(panelTreeModifiable_, BorderLayout.CENTER); + conteneurTree_ = new JPanel(new BorderLayout()); + conteneurTree_.add(toggleTree_, BorderLayout.NORTH); + conteneurTree_.add(pane, BorderLayout.CENTER); + pane.add(panelTreeModifiable_); + right.add(conteneurTree_, BorderLayout.CENTER); + + // --verification qu il n existe pas de composant sur la scene auquel cas, + // selection automatique pour modification --// + + if(controller_!=null){ + Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getScene().getObjects(); + if(noeudContenus.size()==1) + getScene().setSelectedObjects(noeudContenus); + getScene().refresh(); } + } return right; } @@ -192,7 +273,9 @@ //--recuperation des noeuds a copier --// nodesCopyied = (Set<EbliNode>) getScene().getSelectedObjects(); - + + // -- reinit de la commande cut si on voulait faire un ctrl+x + nodesCutted = null; } public void cut() { @@ -213,6 +296,9 @@ } + // reinit de la liste des noeuds a copier au cas ou on change d avis + nodesCopyied = null; + } public void duplicate() { @@ -234,6 +320,9 @@ // --duplication du node --// node.duplicate(null); } + // reinititalisation de la liste + nodesCopyied = null; + }else if (nodesCutted != null) { @@ -242,8 +331,310 @@ // --ajout du node --// getScene().addNode(node); } + // reinit de la liste + nodesCutted = null; + } + } + + // ---methode du listener d ecoute de la scene + + /** + * Called to notify that an object was added to an object scene. This is + * called when an object-widget mapping is registered in an ObjectScene only. + * At the moment of the call, the object is still not reqistered in the + * Graph*Scene classes yet. Therefore do not use the methods of Graph*Scene. + * + * @param event + * @param addedObject + */ + public void objectAdded(ObjectSceneEvent event, Object addedObject) { + } + + /** + * Called to notify that an object was removed from an object scene. This is + * called when an object-widget mapping is unregistered in an ObjectScene and + * Graph*Scene classes. At the moment of the call, a widget (visual + * representation of the object) is still in the scene. Therefore do not rely + * on a tree of widgets of the scene. + * + * @param event + * the object scene event + * @param removedObject + * the removed object + */ + public void objectRemoved(ObjectSceneEvent event, Object removedObject) { + } + + /** + * Called to notify that the object state of an object is changed. This method + * is always called before any other ObjectSceneListener method is called. + * + * @param event + * the object scene event + * @param changedObject + * the object with changed object state + * @param previousState + * the previous object state + * @param newState + * the new object state + */ + public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, + ObjectState newState) { + } + + /** + * Called to notify that the object-selection is changed. + * + * @param event + * the object scene event + * @param previousSelection + * the set of previously selected objects + * @param newSelection + * the set of newly selected objects + */ + public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { + + + // cas ou de multiples objets sont selectionnes, on ne fait rien pour le + // moment + // A voir pour une fonctionnalit\xE9 magique + if (newSelection != null && newSelection.size() > 1) + return; + else if (newSelection == null || newSelection.size() == 0) { + // -- cas particulier: on met le tree des calques et pas de toolbar --// + changeTreeScene(); + changeToolbarScene(); + return; + } + EbliNode node = (EbliNode) newSelection.iterator().next(); + + // 3 cas pour le moment: graphe ou calque ou rien + if(!node.hasWidget()) + return; + if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { + + // -- etape 1: ajout du tree de calque dans fudaaImplementation --// + changeTreeCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + + + } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { + + + // -- etape 1: ajout du tree de graphe dans fudaaImplementation --// + changeTreeGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphe()); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphePanel()); + } else { + + // -- etape 1: on fout eventuellement le tree des layouts --// + changeTreeScene(); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarScene(); + } + } + + /** + * Called to notify that the object-highlighting is changed. + * + * @param event + * the object scene event + * @param previousHighlighting + * the set of previously highlighted objects + * @param newHighlighting + * the set of newly highlighted objects + */ + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { } + /** + * Called to notify that the object-hovering is changed. + * + * @param event + * the object scene event + * @param previousHoveredObject + * the previous hovered object; null if there was no hovered object + * @param newHoveredObject + * the new hovered object; null if there is no hovered object + */ + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { + } + + /** + * Called to notify that the object-focus is changed. + * + * @param event + * the object scene event + * @param previousFocusedObject + * the previously focused object; null if there was no focused object + * @param newFocusedObject + * the newly focused object; null if there is no focused object + */ + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { + } + + { + } + + /** + * Methode qui met a jour le tree de droite avec le tree du calque + * selectionne. + * + * @param calque + */ + private void changeTreeCalque(ZEbliCalquesPanel _calque) { + + + conteneurTree_.remove(panelTreeModifiable_); + + // JComponent component = EbliWidgetEditCreator.createView(new + // BArbreCalque(_calque.getArbreCalqueModel()), + // EbliResource.EBLI.getToolIcon("arbre"), "Calques", false); + panelTreeModifiable_ = new JScrollPane(new BArbreCalque(_calque.getArbreCalqueModel())); + // panelTreeModifiable_ = new JScrollPane(component); + + this.toggleTree_.setText("Calques"); + + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + } + + /** + * Methode qui met a jour le tree de droite avec le tree du graphe + * selectionne. + * + * @param _graphe + */ + private void changeTreeGraphe(EGGraphe _graphe) { + + + conteneurTree_.remove(panelTreeModifiable_); + // JComponent component = EbliWidgetEditCreator.createView(new + // JTree((EGGrapheTreeModel) _graphe.getModel()), + // EbliResource.EBLI.getToolIcon("arbre"), "Courbes", false); + + //POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// + JTree yoda = new JTree((EGGrapheTreeModel) _graphe.getModel()); + yoda.setSelectionModel(((EGGrapheTreeModel) _graphe.getModel()).getSelectionModel()); + panelTreeModifiable_ = new JScrollPane(yoda); + if (this.toggleTree_ != null) + this.toggleTree_.setText("Courbes"); + // panelTreeModifiable_ = new JScrollPane(component); + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + + } + + /** + * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. + */ + private void changeTreeScene() { + conteneurTree_.remove(panelTreeModifiable_); + // JComponent component = + // EbliWidgetEditCreator.createView(controller_.createTree(), + // EbliResource.EBLI + // .getToolIcon("arbre"), "Composants", false); + + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + if (this.toggleTree_ != null) + this.toggleTree_.setText("Liste des composants"); + // panelTreeModifiable_ = new JScrollPane(component); + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + } + + + /** + * Methode qui modifie la toolbar associee au calque selectionne + * + * @param _calque + */ + private void changeToolbarCalque(ZEbliCalquesPanel _calque) { + + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + // ajout des tool specifiques du calque + List actions = _calque.getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + toolBarModifiable_.addSeparator(); + } else { + toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + + // ajout des menus specifiques pour le calque + JMenu[] specificMenus = _calque.getSpecificMenus(EbliLib.getS("Vue 2D")); + + for (int i = 0; i < specificMenus.length; i++) { + menuModifiable_.add(specificMenus[i]); + } + + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + + } + + private void changeToolbarGraphe(EGFillePanel _graphe) { + + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + + // ajout des toolbar specifiques du calque + EbliActionInterface[] specificInterfaces = _graphe.getSpecificActions(); + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + if (object == null) { + toolBarModifiable_.addSeparator(); + } else { + toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + + // ajout des menus specifiques + JMenu menu = new JMenu("Menu graphe"); + _graphe.fillSpecificMenu(menu); + menuModifiable_.add(menu); + + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + } + + private void changeToolbarScene() { + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + toolBarModifiable_.add(new EbliWidgetActionConfigure(controller_.getScene())); + JMenu menu = new JMenu("Configurer"); + menu.add(new EbliWidgetActionConfigure(controller_.getScene())); + menuModifiable_.add(menu); + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -54,6 +54,7 @@ import com.memoire.bu.BuDesktop; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.bu.BuSeparator; public class TrPostLayoutPanelController { @@ -64,14 +65,23 @@ List<EbliActionAbstract> actions; /** + * Tree qui contient la hierarchie des widget de la scene. + */ + JXTreeTable treeScene = null; + + + TrPostProjet projet_; + + /** * Calque principal associ\xE9 a la vue layout. */ private ZEbliCalquesPanel calquePrincipal; - TrPostLayoutPanelController(EbliScene _scene) { + TrPostLayoutPanelController(EbliScene _scene, TrPostProjet _projet) { treeModel_ = new EbliWidgetJXTreeTableModel(_scene); _scene.addEbliNodeListener(treeModel_); _scene.setCmdMng(new CtuluCommandManager()); + projet_ = _projet; } /** @@ -110,7 +120,6 @@ // ajout du node au layout addNode(nodeCalque); - @@ -270,6 +279,9 @@ } }); + + + // widget image _l.add(new EbliWidgetActionImageChooser(getScene())); @@ -325,39 +337,49 @@ return (JComponent[]) res.toArray(new JComponent[res.size()]); } + /** + * Methode qui cree le tree ou le renvoie si ce dernier est cree. + * + * @return tree des widgets. + */ public JXTreeTable createTree() { - JXTreeTable tree = new JXTreeTable(treeModel_); + + if (treeScene != null) + return treeScene; + + + treeScene = new JXTreeTable(treeModel_); // -- ajout du tree au model pour les dimensionnements --// // modeltable.setTree_(tree_); // --vision du noeud root --// - tree.setRootVisible(false); + treeScene.setRootVisible(false); // --ajout du renderer pour les images-// - tree.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); + treeScene.setTreeCellRendere... [truncated message content] |