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] |