From: <de...@us...> - 2008-09-16 22:10:40
|
Revision: 3933 http://fudaa.svn.sourceforge.net/fudaa/?rev=3933&view=rev Author: deniger Date: 2008-09-16 22:10:48 +0000 (Tue, 16 Sep 2008) Log Message: ----------- maj animation 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/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.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/TrPostMinMaxTableModel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple2.res branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java Property changes on: branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple2.res ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -1,9 +1,18 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; import java.util.Collections; +import java.util.Map; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.image.CtuluImageProducer; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.graph.GraphScene; @@ -16,14 +25,55 @@ * * @author Adrien Hadoux */ -public class EbliScene extends GraphScene<EbliNode, EbliEdge> { +public class EbliScene extends GraphScene<EbliNode, EbliEdge> implements CtuluImageProducer { /** * model de la scene pour l affichage de ses composants */ EbliWidgetJXTreeTableModel treeModel_; + final PropertyChangeSupport propertyChangeSupport_ = new PropertyChangeSupport(this); + /** + * @param _listener le listener: a chaque fois le parametre new correspond au widget modifie + */ + public void addPropertyChangeListener(PropertyChangeListener _listener) { + propertyChangeSupport_.addPropertyChangeListener(_listener); + } + + /** + * @param _propertyName + * @param _listener + * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + propertyChangeSupport_.addPropertyChangeListener(_propertyName, _listener); + } + + /** + * @param _listener + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener _listener) { + propertyChangeSupport_.removePropertyChangeListener(_listener); + } + + protected void firePropertyChange(Object _nodeOrEdge, String _property) { + propertyChangeSupport_.firePropertyChange(_property, null, _nodeOrEdge); + } + + /** + * @param _propertyName + * @param _listener + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + propertyChangeSupport_.removePropertyChangeListener(_propertyName, _listener); + } + + /** * controller de la scene qui gere les actions et les constructions graphiques */ private EbliSceneController controller_; @@ -89,6 +139,38 @@ } + public Dimension getDefaultImageDimension() { + Rectangle rec = getBounds(); + Dimension d = new Dimension(); + d.height = rec.height; + d.width = rec.width; + return d; + } + + public BufferedImage produceImage(final Map _params) { + Dimension d = getDefaultImageDimension(); + return produceImage(d.width, d.height, _params); + } + + public BufferedImage produceImage(final int _w, final int _h, final Map _params) { + Dimension d = getDefaultImageDimension(); + final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); + final Graphics2D g = i.createGraphics(); + CtuluLibImage.setBestQuality(g); + if (_w != d.width || _h != d.height) { + g.scale(CtuluLibImage.getRatio(_w, d.width), CtuluLibImage.getRatio(_h, d.height)); + } + if (CtuluLibImage.mustFillBackground(_params)) { + g.setPaint(getBackground()); + g.fillRect(0, 0, d.width, d.height); + } + paint(g); + g.dispose(); + i.flush(); + return i; + + } + @Override protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { 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-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -7,11 +7,14 @@ import java.util.HashMap; import java.util.Map; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BSelecteurCheckBox; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; @@ -51,9 +54,6 @@ private EbliScene scene_; private boolean useBorder_ = true; - - - /** * @param scene @@ -185,6 +185,8 @@ * graphiques de la widget. */ public Object getProperty(String _key) { + if ("title".equals(_key)) return getTitle(); + if (BSelecteurCheckBox.PROP_VISIBLE.equals(_key)) return Boolean.valueOf(isVisible()); // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// @@ -236,6 +238,7 @@ return isGroup; } + @Override public boolean isHitAt(Point localLocation) { if (localLocation == null) return false; @@ -269,6 +272,13 @@ } /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + return null; + } + + /** * Methode qui raffraichis les proprietes de la widget. */ public final void refreshMyProperties() { @@ -277,9 +287,8 @@ public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} - public void removePropertyChangeListenerFormWidget(EbliWidget _widget) { - } - + public void removePropertyChangeListenerFormWidget(EbliWidget _widget) {} + public void setColorContour(Color newColor) { propGraphique.put(COLORCONTOUR, newColor); } @@ -290,7 +299,7 @@ public void setController(EbliWidgetController controller_) { this.controller_ = controller_; - + } public void setFormeFont(Font newFont) { @@ -308,16 +317,65 @@ * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens * parametres dans la commande undo/redo. */ - public final boolean setProperty(String _key, Object prop) { + public final boolean setProperty(final String _property, final Object _newVlaue) { + if ("title".equals(_property)) { return changeTitle((String) _newVlaue, true); } + if (BSelecteurCheckBox.PROP_VISIBLE.equals(_property)) { return changeVisible(((Boolean) _newVlaue).booleanValue(), + true); } // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// - setPropertyCmd(_key, prop, getEbliScene().getCmdMng()); + setPropertyCmd(_property, _newVlaue, getEbliScene().getCmdMng()); return true; } - protected void setPropertyCmd(String _key, Object prop, CtuluCommandContainer _cmd) { + private boolean changeVisible(final boolean _newValue, boolean _cmd) { + if (_newValue == isVisible()) return false; + setVisible(_newValue); + getEbliScene().firePropertyChange(EbliWidget.this, BSelecteurCheckBox.PROP_VISIBLE); + if (_cmd) getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + + public void undo() { + changeVisible(!_newValue, false); + } + + public void redo() { + changeVisible(_newValue, false); + } + }); + return true; + } + + private boolean changeTitle(final String _title, boolean _cmd) { + final String old = getTitle(); + if (_title != null && !_title.equals(old)) { + final EbliNode n = (EbliNode) getEbliScene().findObject(this); + if (n == null) return false; + n.setTitle(_title); + getEbliScene().firePropertyChange(EbliWidget.this, "title"); + if (_cmd) { + + getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + public void undo() { + changeTitle(old, false); + } + + public void redo() { + changeTitle(_title, false); + } + }); + } + return true; + + } + return false; + + } + + protected void setPropertyCmd(String _property, Object _newValue, CtuluCommandContainer _cmd) { + Object old = propGraphique.get(_property); + if (old == _newValue || (old != null && old.equals(_newValue))) return; + CommandeUndoRedoGraphicalProperties undoRedo = null; if (_cmd != null) { undoRedo = new CommandeUndoRedoGraphicalProperties(); @@ -327,15 +385,16 @@ undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); _cmd.addCmd(undoRedo); } - if (_key.equals(LINEMODEL)) { - getTraceLigneModel().updateData((TraceLigneModel) prop); - prop = getTraceLigneModel(); - } else if (_key.equals(ROTATION) && prop instanceof Integer) { - prop = new Double(Math.toRadians(((Integer) prop).intValue())); + if (_property.equals(LINEMODEL)) { + getTraceLigneModel().updateData((TraceLigneModel) _newValue); + _newValue = getTraceLigneModel(); + } else if (_property.equals(ROTATION) && _newValue instanceof Integer) { + _newValue = new Double(Math.toRadians(((Integer) _newValue).intValue())); } // --mise a jout de la map de proprietes --// - propGraphique.put(_key, prop); + propGraphique.put(_property, _newValue); + getEbliScene().firePropertyChange(this, _property); if (undoRedo != null) { // -- ajout de la nouvelle propertie --// undoRedo.addNewPropertie(propGraphique); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -5,6 +5,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; /** @@ -27,15 +28,17 @@ return getIntern().getController(); } - + @Override + public EbliAnimatedInterface getAnimatedInterface() { + return getIntern().getAnimatedInterface(); + } + EbliWidgetControllerActionOnly controllerBordure_ = null; + public EbliWidgetController getBordureController() { return controllerBordure_; } - - - /** * constructeur qui gere un controller uniquement pour les actions. * @@ -58,14 +61,12 @@ insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); setLayout(new OverlayLayoutGap(insets_)); - // -- ajout du child --// addChild(intern_); - // -- mise a jour des evenements (action,menus) du intern --// // intern_.getController().majActionsBordureSpecific(this); - + // --ajout du controller specifique au bordure --// controllerBordure_ = new EbliWidgetControllerActionOnly(this, canMove, canResize); this.setController(controllerBordure_); @@ -86,10 +87,10 @@ // // TraceLigne tl = new TraceLigne(getTraceLigneModel()); // // tl.dessineRectangle(getGraphics(), 0, 0, getClientArea().width, // getClientArea().getHeight()); -// + // // // } - + /** * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur */ @@ -97,16 +98,17 @@ // -- la bordure ne gere que tracemodel et couleur contour, le reste est // dispatch\xE9 a son conteneur --// - if (_key.equals(ROTATION)) { - - double radian = intern_.getRotation(); - return Integer.valueOf((int) (radian * 180 / Math.PI)); - - } else if (_key.equals(FONT)) { + // if (_key.equals(ROTATION)) { + // + // double radian = intern_.getRotation(); + // return Integer.valueOf((int) (radian * 180 / Math.PI)); + // + // } + // + if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); - } else if (_key.equals(COLORFOND)) { - return intern_.propGraphique.get(_key); - } else return propGraphique.get(_key); + } else if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } + return super.getProperty(_key); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -24,6 +25,7 @@ import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; @@ -146,11 +148,10 @@ }); } - - + public AbstractButton boutonBloque = null; public boolean isBlocked = false; - + public void constructMenuBloquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { // EbliWidget widgetListenMove = null; @@ -160,40 +161,37 @@ // widgetListenMove = (EbliWidget) widget_.getParentWidget(); // } else // widgetListenMove = widget_; - + // FuLog.warning("widgetListenMove instanceof " + widgetListenMove); EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); - + boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); - - _popup.add(boutonBloque); + + _popup.add(boutonBloque); } - + public void excecuteBlockOrDeblock() { if (boutonBloque == null) { EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); } - - boutonBloque.doClick(); + + boutonBloque.doClick(); } - + /** - * Methode a appeler apres coup pour mettre a jour les actions, menus et autre - * dans le cas d une bordure englobante de la widget. + * Methode a appeler apres coup pour mettre a jour les actions, menus et autre dans le cas d une bordure englobante de + * la widget. * * @param bordure */ public void majActionsBordureSpecific(EbliWidgetBordureSingle bordure) { - + // -- mise a jour action block/deblock --// EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(bordure); - if (boutonBloque != null) - boutonBloque.setAction(actionBloque); - + if (boutonBloque != null) boutonBloque.setAction(actionBloque); + } - - protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); @@ -250,12 +248,9 @@ constructMenuDupliquer(_popup, cmd_); } - constructMenuBloquer(_popup, cmd_); - + constructMenuSupprimer(_popup, cmd_); - - } @@ -272,26 +267,12 @@ menuItem4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - EbliWidget found = null;// widget_; if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordureSingle) found = (EbliWidget) widget_ .getParentWidget(); else found = widget_; - - BConfigurePalette palette = new BConfigurePalette(false); - - BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); - - palette.setTargetConf(cmp); - JDialog d = new JDialog(); - d.setModal(true); - d.setTitle(EbliResource.EBLI.getString("Configuration graphique")); - d.setContentPane(palette); - - d.pack(); - d.setVisible(true); - + EbliWidgetActionConfigure.configure(found); } }); @@ -408,7 +389,7 @@ canResize_ = false; } - + public WidgetAction getActionMove() { return actionMove_; } @@ -417,10 +398,8 @@ * fonction inverse de la precedente. */ public void replaceActionResizeAndMove() { - if(actionMove_!=null) - widget_.getActions().addAction(actionMove_); - if(actionResize_!=null) - widget_.getActions().addAction(actionResize_); + if (actionMove_ != null) widget_.getActions().addAction(actionMove_); + if (actionResize_ != null) widget_.getActions().addAction(actionResize_); canMove_ = true; canResize_ = true; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -6,9 +6,11 @@ import javax.swing.JDialog; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.widget.Widget; @@ -33,8 +35,12 @@ */ public void actionPerformed(ActionEvent e) { EbliWidget found = findWidget(); + configure(found); + } + + public static void configure(EbliWidget found) { if (found != null) { - BConfigurePalette palette = new BConfigurePalette(false); + BConfigurePalette palette = new BConfigurePalette(true); // -- creation du composite avec le configure qui genere les interfaces // necessaires --// @@ -42,14 +48,14 @@ // WidgetConfigure(found), "test"); BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); + palette.setTargetConf(cmp); + palette.setTitleVisibleTarget(found, true); - palette.setTargetConf(cmp); - JDialog d = new JDialog(); + JDialog d = CtuluLibSwing.createDialogOnActiveWindow(EbliLib.getS("Configuration graphique")); d.setModal(true); - d.setTitle("Configuration graphique"); d.setContentPane(palette); - d.pack(); + d.setLocationRelativeTo(d.getParent()); d.setVisible(true); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -33,6 +33,7 @@ * classe qui permet de creer les selecteurs necessaires pour la configuration. * * @author Adrien Hadoux + * TODO a revoir: ce sont les widgets qui doivent la responsabilite de savoir ce qui peut etre configurer ou non */ public class WidgetConfigure implements BConfigurableInterface { @@ -200,7 +201,7 @@ } else { // -- cas des legendes: juste font et color contour pour resizer le tout --// rotations_ = false; - colorFonds_ = false; + colorFonds_ = true; lineModel_ = false; colorsContours_ = false; Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -0,0 +1,79 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimationAction; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.animation.EbliAnimationComposite; +import org.fudaa.ebli.animation.EbliAnimationSourceAbstract; +import org.fudaa.ebli.animation.EbliAnimationSourceInterface; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.widget.Widget; + +/** + * @author deniger + */ +public class EbliWidgetAnimAdapter extends EbliAnimationSourceAbstract { + + EbliScene scene_; + + public EbliWidgetAnimAdapter(EbliScene _scene) { + super(); + scene_ = _scene; + } + + @SuppressWarnings("serial") + public EbliAnimationAction createAction() { + EbliAnimationAction act = new EbliAnimationAction(this) { + @Override + public void updateBeforeShow() { + super.setAnimAdapterInterface(findAnimAdapter()); + } + }; + act.setEnabled(true); + return act; + } + + public EbliAnimationAdapterInterface findAnimAdapter() { + List<Widget> children = scene_.getLayerVisu().getChildren(); + List<EbliAnimationSourceInterface> anims = new ArrayList<EbliAnimationSourceInterface>(); + for (Widget widget : children) { + EbliWidget ew = (EbliWidget) widget; + EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); + if (animatedInterface != null) { + anims.add(animatedInterface.getAnimationSrc()); + } + } + return (new EbliAnimationComposite(anims.toArray(new EbliAnimationSourceInterface[anims.size()]))); + } + + public Component getComponent() { + return scene_.getView(); + } + + public Dimension getDefaultImageDimension() { + return scene_.getDefaultImageDimension(); + } + + public BufferedImage produceImage(int _w, int _h, Map _params) { + return scene_.produceImage(_w, _h, _params); + } + + public BufferedImage produceImage(Map _params) { + return scene_.produceImage(_params); + } + + public void setVideoMode(boolean _b) {} + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -190,8 +190,8 @@ _widgetLegende.setController(new EbliWidgetControllerMenuOnly(_widgetLegende, false)); // -- prendre en compte le resize automatique --// + _widgetLegende.getEbliScene().refresh(); _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); - _widgetLegende.repaint(); return _widgetLegende; } else { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -143,9 +143,11 @@ lbWidget.setFont(boldFont_); Rectangle boundsTitre = lbWidget.getBounds(); + if(boundsTitre!=null){ boundsTitre.width = fmtBold.stringWidth(lbWidget.getLabel()) + 5; maxTitle = Math.max(maxTitle, boundsTitre.width); boundsTitre.height = (int) (fmtBold.getHeight() + 2); + } // lbWidget.setPreferredBounds(boundsTitre); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -17,6 +17,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -81,7 +82,7 @@ } - + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { 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-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -13,6 +13,7 @@ import javax.swing.BorderFactory; import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; @@ -47,8 +48,6 @@ // GrBoite zoom_; public EbliWidgetVueCalque(EbliScene _scene, ZEbliCalquesPanel _vue) { this(_scene, _vue, null); - - } @@ -68,9 +67,6 @@ setPreferredSize(new Dimension(500, 400)); initSize(new Rectangle(0, 0, 500, 400)); - - - } public BuPanel createEditorComponent( @@ -110,6 +106,14 @@ } /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + if (calquePanel_ instanceof EbliAnimatedInterface) return (EbliAnimatedInterface) calquePanel_; + return null; + } + + /** * Creer une frame qui contient toutes les fonctions pour modifier le calque. Ancienne methode edit(). * * @param _widget 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-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -1,16 +1,20 @@ package org.fudaa.ebli.visuallibrary.tree; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Enumeration; 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.DefaultObjectSceneListener; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; @@ -51,55 +55,32 @@ nodeAdded((EbliNode) _addedObject); } - // @Override - // public void selectionChanged(ObjectSceneEvent _event, Set<Object> - // _previousSelection, Set<Object> _newSelection) { - // - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // - // @Override - // public void focusChanged(ObjectSceneEvent _event, Object - // _previousFocusedObject, Object _newFocusedObject) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // @Override - // public void hoverChanged(ObjectSceneEvent _event, Object - // _previousHoveredObject, Object _newHoveredObject) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // @Override - // public void objectStateChanged(ObjectSceneEvent _event, Object - // _changedObject, ObjectState _previousState, - // ObjectState _newState) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - @Override public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) { nodeRemoved((EbliNode) _removedObject); } }; - scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); + scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED, + ObjectSceneEventType.OBJECT_REMOVED); + scene_.addPropertyChangeListener(new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent _evt) { + if ("title".equals(_evt.getPropertyName()) || "visible".equals(_evt.getPropertyName())) { + EbliWidget widget = (EbliWidget) _evt.getNewValue(); + EbliNode n = (EbliNode) scene_.findObject(widget); + if (n != null) { + MutableTreeTableNode aNode = findTreeTableNode(n); + if (aNode != null) modelSupport.firePathChanged(new TreePath(getPathToRoot(aNode))); + } + } + + } + }); } - - public void removeListener(){ - scene_.removeObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); + + public void removeListener() { + scene_.removeObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED, + ObjectSceneEventType.OBJECT_REMOVED); } public EbliScene getScene() { @@ -180,9 +161,6 @@ } - - - public String getColumnName(int arg0) { if (arg0 < title.length) return title[arg0]; return CtuluLibString.EMPTY_STRING; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -457,7 +457,7 @@ protected void buildImportMenu() {} protected boolean buildFudaaReportTool() { - return true; + return false; } protected boolean useScrollInBuDesktop() { 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-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -3,9 +3,11 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; import java.util.Set; import javax.swing.JButton; @@ -52,7 +54,7 @@ * @author Adrien Hadoux */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener { + BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener, CtuluImageProducer { /** * @@ -116,8 +118,8 @@ // -- enregistrement de this comem listener de la scene pour le type d objet // selection changed--// -// controller_.getSceneCourante().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, -// ObjectSceneEventType.OBJECT_STATE_CHANGED); + // controller_.getSceneCourante().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, + // ObjectSceneEventType.OBJECT_STATE_CHANGED); controller_.getSceneCourante().getController().addEditListener(this); // -- ajout de la toolbar et du menu en haut --// @@ -294,8 +296,8 @@ for (Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) { EbliNode node = it.next(); if (!(node.getCreator() instanceof EbliWidgetCreatorLegende) - && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) - projet_.nodesCopyied.add(node); + && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCopyied + .add(node); } // -- reinit de la commande cut si on voulait faire un ctrl+x projet_.nodesCutted = null; @@ -317,8 +319,8 @@ for (Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) { EbliNode node = it.next(); if (!(node.getCreator() instanceof EbliWidgetCreatorLegende) - && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) - projet_.nodesCutted.add(node); + && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCutted + .add(node); } // -- suppression des nodes depuis cetet kliste pour eviter les concourant @@ -335,8 +337,8 @@ projet_.nodesCopyied = null; // --creation de la commande undo/redo --// - if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoCut(projet_.nodesCutted)); + if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd( + new CommandUndoRedoCut(projet_.nodesCutted)); } @@ -374,8 +376,7 @@ } // --creation de la commande undo/redo --// - if (newNodes.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); + if (newNodes.size() != 0) getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); // reinitialisation de la liste projet_.nodesCopyied = null; @@ -391,8 +392,8 @@ getScene().addNode(node); } // --creation de la commande undo/redo --// - if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(projet_.nodesCutted)); + if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd( + new CommandUndoRedoPaste(projet_.nodesCutted)); // reinit de la liste projet_.nodesCutted = null; @@ -469,6 +470,18 @@ } + public Dimension getDefaultImageDimension() { + return getScene().getDefaultImageDimension(); + } + + public BufferedImage produceImage(int _w, int _h, Map _params) { + return getScene().produceImage(_w, _h, _params); + } + + public BufferedImage produceImage(Map _params) { + return getScene().produceImage(_params); + } + public void editStop(Widget _w) { changeTreeScene(); changeToolbarScene(); 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-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -49,6 +49,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; +import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimAdapter; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; @@ -537,8 +538,8 @@ init.add(null); // -- Action sur le format --// - init.add(new EbliWidgetActionColorForeground(getSceneCourante())); - init.add(new EbliWidgetActionColorBackground(getSceneCourante())); +// init.add(new EbliWidgetActionColorForeground(getSceneCourante())); +// init.add(new EbliWidgetActionColorBackground(getSceneCourante())); // -- action de configuration des composants graphiques--// init.add(new EbliWidgetActionConfigure(getSceneCourante())); init.add(null); @@ -549,6 +550,8 @@ // suppression, on choisit la source a prendre en compte --// init.add(new TrPostActionChooseAndCreateCalque(projet_, this)); + init.add(null); + init.add(new EbliWidgetAnimAdapter(getSceneCourante()).createAction()); // -- action qui permet d ajouter un point du calque dans tous les graphes // selectionnes --// // init.add(new TrPostActionAddPointFromWidgetCalque(getSceneCourante(), Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -280,6 +280,7 @@ } } final int nb = list.size(); + if(nb==0) return; final ProgressionUpdater up = new ProgressionUpdater(_impl.createProgressionForMainPanel()); up.setValue(nb, 10); for (int i = 0; i < nb; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |