From: <de...@us...> - 2008-09-21 23:14:19
|
Revision: 3965 http://fudaa.svn.sourceforge.net/fudaa/?rev=3965&view=rev Author: deniger Date: 2008-09-21 23:14:14 +0000 (Sun, 21 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 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/animation/EbliWidgetAnimAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.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/EbliWidgetPlage.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/EbliJXTreeTableCellRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -128,6 +128,7 @@ configure_.addItemListener(this); configure_.setHorizontalAlignment(SwingConstants.LEFT); final BuPanel pnConfigure = new BuPanel(new BuButtonLayout(0, SwingConstants.LEFT)); + if (cmpOptions_ != null) pnConfigure.add(cmpOptions_); pnConfigure.add(configure_); pnButton.setBorder(new CtuluRoundEtchBorder(30)); lbTitle_ = new JLabel(); @@ -432,11 +433,10 @@ final BuPalette parent = (BuPalette) SwingUtilities.getAncestorOfClass(BuPalette.class, pn_); if (parent != null) { parent.pack(); + } else { + final Window winParent = (Window) SwingUtilities.getAncestorOfClass(Window.class, pn_); + winParent.pack(); } - else { - final Window winParent = (Window) SwingUtilities.getAncestorOfClass(Window.class, pn_); - winParent.pack(); - } } public void itemStateChanged(final ItemEvent _e) { @@ -594,21 +594,36 @@ Timer timerContainer_; + /** + * Composant optionel ajouter par l'utilisateur + */ + JComponent cmpOptions_; + public EbliAnimation() { task_ = new EbliAnimationTask(); } + /** + * @return the optionCp + */ + public JComponent getOptionCp() { + return cmpOptions_; + } + + /** + * @param _optionCp the optionCp to set + */ + public void setOptionCp(JComponent _optionCp) { + cmpOptions_ = _optionCp; + } + private void createTimer() { if (swingTimer_ == null) { final Runnable r = new Runnable() { public void run() { - if (task_.isFinished_) { - return; - } - if (isPaused()) { - return; - } + if (task_.isFinished_) { return; } + if (isPaused()) { return; } task_.doAnim(); } @@ -734,9 +749,7 @@ } public void active() { - if (task_.getSrc() == null) { - return; - } + if (task_.getSrc() == null) { return; } getPanel(); } @@ -750,9 +763,7 @@ } public JToggleButton getConfigureBt() { - if (pn_ != null) { - return pn_.configure_; - } + if (pn_ != null) { return pn_.configure_; } return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -65,11 +65,11 @@ return anim_.isPlaying(); } - protected void setAnimAdapter(final Object _o) { + public void setAnimAdapter(final Object _o) { setAnimAdapterInterface(_o instanceof EbliAnimationAdapterInterface ? (EbliAnimationAdapterInterface) _o : null); } - protected void setAnimAdapterInterface(final EbliAnimationAdapterInterface _o) { + public void setAnimAdapterInterface(final EbliAnimationAdapterInterface _o) { if (isPlaying()) { return; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -25,6 +25,12 @@ String getTimeStep(int _idx); /** + * @param _idx indice du pas de temps [0;getNbTimeStep()[ + * @return la valeur en sec de ce pas de temps + */ + double getTimeStepValueSec(int _idx); + + /** * @param _idx l'indice a afficher */ void setTimeStep(int _idx); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -7,6 +7,10 @@ */ package org.fudaa.ebli.animation; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.fudaa.ebli.commun.EbliLib; /** @@ -15,32 +19,51 @@ */ public class EbliAnimationComposite implements EbliAnimationAdapterInterface { - EbliAnimationAdapterInterface[] anims_; + final List<EbliAnimationAdapterInterface> anims_; /** * @param _anims */ public EbliAnimationComposite(final EbliAnimationAdapterInterface[] _anims) { super(); - anims_ = _anims; + anims_ = Collections.unmodifiableList(Arrays.asList(_anims)); } + /** + * @param _anims + */ + public EbliAnimationComposite(final List<EbliAnimationAdapterInterface> _anims) { + super(); + anims_ = Collections.unmodifiableList(_anims); + } + + /** + * @return the anims liste non modifiable + */ + public List<EbliAnimationAdapterInterface> getAnims() { + return anims_; + } + public int getNbTimeStep() { - return anims_[0].getNbTimeStep(); + return anims_.get(0).getNbTimeStep(); } - public String getTimeStep(final int _idx) { - return anims_[0].getTimeStep(_idx); + public double getTimeStepValueSec(int _idx) { + return anims_.get(0).getTimeStepValueSec(_idx); } - public void setTimeStep(final int _idx) { - for (int i = anims_.length - 1; i >= 0; i--) { - anims_[i].setTimeStep(_idx); - } + public String getTimeStep(final int _idx) { + return anims_.get(0).getTimeStep(_idx); } public String getTitle() { return EbliLib.getS("Sources muliples"); } + public void setTimeStep(final int _idx) { + for (EbliAnimationAdapterInterface it : anims_) { + it.setTimeStep(_idx); + } + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -40,6 +40,10 @@ return adapter_ == null ? CtuluLibString.EMPTY_STRING : adapter_.getTimeStep(_idx); } + public double getTimeStepValueSec(int _idx) { + return adapter_ == null ? 0D : adapter_.getTimeStepValueSec(_idx); + } + public void setTimeStep(final int _idx) { if (adapter_ != null) { adapter_.setTimeStep(_idx); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-21 23:14:14 UTC (rev 3965) @@ -616,4 +616,5 @@ Configuration graphique= Graphical configuration Masquer la frame= Hide the frame Dupliquer la frame= Duplicate the frame -R\xE9aliser la fusion= Perform the merging \ No newline at end of file +R\xE9aliser la fusion= Perform the merging +Anim\xE9=Animated \ No newline at end of file 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -2,19 +2,19 @@ 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.Iterator; import java.util.Map; +import java.util.Set; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluLibString; 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; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; @@ -28,6 +28,22 @@ public class EbliScene extends GraphScene<EbliNode, EbliEdge> implements CtuluImageProducer, EbliWidgetInterface<EbliSceneController> { + int idx_ = 0; + + protected String generateId() { + return CtuluLibString.getString(idx_++); + } + + public EbliWidget findById(final String _id) { + final Set obj = getObjects(); + for (final Iterator it = obj.iterator(); it.hasNext();) { + final EbliWidget w = (EbliWidget) findWidget(it.next()); + if (w.getIntern().getId().equals(_id)) return w; + + } + return null; + } + /** * model de la scene pour l affichage de ses composants */ @@ -38,7 +54,7 @@ /** * @param _listener le listener: a chaque fois le parametre new correspond au widget modifie */ - public void addPropertyChangeListener(PropertyChangeListener _listener) { + public void addPropertyChangeListener(final PropertyChangeListener _listener) { propertyChangeSupport_.addPropertyChangeListener(_listener); } @@ -48,7 +64,7 @@ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, * java.beans.PropertyChangeListener) */ - public void addPropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + public void addPropertyChangeListener(final String _propertyName, final PropertyChangeListener _listener) { propertyChangeSupport_.addPropertyChangeListener(_propertyName, _listener); } @@ -56,11 +72,11 @@ * @param _listener * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) */ - public void removePropertyChangeListener(PropertyChangeListener _listener) { + public void removePropertyChangeListener(final PropertyChangeListener _listener) { propertyChangeSupport_.removePropertyChangeListener(_listener); } - protected void firePropertyChange(Object _nodeOrEdge, String _property) { + protected void firePropertyChange(final Object _nodeOrEdge, final String _property) { propertyChangeSupport_.firePropertyChange(_property, null, _nodeOrEdge); } @@ -70,37 +86,37 @@ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, * java.beans.PropertyChangeListener) */ - public void removePropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + public void removePropertyChangeListener(final String _propertyName, final PropertyChangeListener _listener) { propertyChangeSupport_.removePropertyChangeListener(_propertyName, _listener); } /** * controller de la scene qui gere les actions et les constructions graphiques */ - private EbliSceneController controller_; + private final EbliSceneController controller_; - private class ObjectSelectProvider implements SelectProvider { + // private class ObjectSelectProvider implements SelectProvider { + // + // public boolean isAimingAllowed(final Widget widget, final Point localLocation, final boolean invertSelection) { + // return false; + // } + // + // public boolean isSelectionAllowed(final Widget widget, final Point localLocation, final boolean invertSelection) { + // return findObject(widget) != null; + // } + // + // public void select(final Widget widget, final Point localLocation, final boolean invertSelection) { + // final Object object = findObject(widget); + // + // setFocusedObject(object); + // if (object != null) { + // if (!invertSelection && getSelectedObjects().contains(object)) return; + // userSelectionSuggested(Collections.singleton(object), invertSelection); + // } else userSelectionSuggested(Collections.emptySet(), invertSelection); + // } + // } - public boolean isAimingAllowed(Widget widget, Point localLocation, boolean invertSelection) { - return false; - } - - public boolean isSelectionAllowed(Widget widget, Point localLocation, boolean invertSelection) { - return findObject(widget) != null; - } - - public void select(Widget widget, Point localLocation, boolean invertSelection) { - Object object = findObject(widget); - - setFocusedObject(object); - if (object != null) { - if (!invertSelection && getSelectedObjects().contains(object)) return; - userSelectionSuggested(Collections.singleton(object), invertSelection); - } else userSelectionSuggested(Collections.emptySet(), invertSelection); - } - } - - public static void refreshScene(Scene _sc) { + public static void refreshScene(final Scene _sc) { _sc.validate(); _sc.repaint(); if (_sc.getView() != null) _sc.getView().repaint(); @@ -112,7 +128,7 @@ */ private CtuluCommandManager cmdMng_; - private LayerWidget interactionLayer_; + private final LayerWidget interactionLayer_; /** * la visu du graphscene @@ -141,20 +157,20 @@ } public Dimension getDefaultImageDimension() { - Rectangle rec = getBounds(); - Dimension d = new Dimension(); + final Rectangle rec = getBounds(); + final Dimension d = new Dimension(); d.height = rec.height; d.width = rec.width; return d; } public BufferedImage produceImage(final Map _params) { - Dimension d = getDefaultImageDimension(); + final 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 Dimension d = getDefaultImageDimension(); final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); final Graphics2D g = i.createGraphics(); CtuluLibImage.setBestQuality(g); @@ -173,17 +189,17 @@ } @Override - protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { + protected void attachEdgeSourceAnchor(final EbliEdge edge, final EbliNode oldSourceNode, final EbliNode sourceNode) { } @Override - protected void attachEdgeTargetAnchor(EbliEdge edge, EbliNode oldTargetNode, EbliNode targetNode) { + protected void attachEdgeTargetAnchor(final EbliEdge edge, final EbliNode oldTargetNode, final EbliNode targetNode) { } @Override - protected Widget attachEdgeWidget(EbliEdge edge) { + protected Widget attachEdgeWidget(final EbliEdge edge) { return null; } @@ -200,7 +216,7 @@ // } @Override - protected Widget attachNodeWidget(EbliNode node) { + protected Widget attachNodeWidget(final EbliNode node) { // -- creation de la widget ici --// // if (node.getWidget() == null) @@ -254,7 +270,7 @@ // // } @Override - protected void notifyNodeAdded(EbliNode node, Widget widget) { + protected void notifyNodeAdded(final EbliNode node, final Widget widget) { // -- notifier tous les listener que le noeud a ete attache --// // notifyAllListenerNodeAdded(node); } @@ -269,11 +285,11 @@ /** * @param _cmdMng the cmdMng to set */ - public void setCmdMng(CtuluCommandManager _cmdMng) { + public void setCmdMng(final CtuluCommandManager _cmdMng) { cmdMng_ = _cmdMng; } - public void setVisuLayer(LayerWidget visu_) { + public void setVisuLayer(final LayerWidget visu_) { this.visu_ = visu_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -46,16 +46,20 @@ public final static String ROTATION = "rotation"; protected EbliWidgetController controller_; + /** + * L'identifiant unique du widget + */ + private final String id_; boolean isGroup; + boolean isInEditMode_ = false; - /** * Map contenant tous les objets graphiques de la widget generique. key: lineModel => le lignemodel du ebliWidget. * key: color => couleur de fond. */ protected Map<String, Object> propGraphique; + private EbliScene scene_; - private boolean useBorder_ = true; /** @@ -64,6 +68,7 @@ */ public EbliWidget(final EbliScene scene) { super(scene); + id_ = scene.generateId(); setScene(scene); // -- remplisage de la map de propriete grahiques --// @@ -104,6 +109,69 @@ } + public boolean canColorBackground() { + return true; + } + + public boolean canColorForeground() { + return true; + } + + public boolean canFont() { + return true; + } + + public boolean canRotate() { + return true; + } + + public boolean canTraceLigneModel() { + return true; + } + + private boolean changeTitle(final String _title, final 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 redo() { + changeTitle(_title, false); + } + + public void undo() { + changeTitle(old, false); + } + }); + } + return true; + + } + return false; + + } + + private boolean changeVisible(final boolean _newValue, final 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 redo() { + changeVisible(_newValue, false); + } + + public void undo() { + changeVisible(!_newValue, false); + } + }); + return true; + } + public Map<String, Object> duplicateGraphicalProperties() { // FIXME il faut juste cloner la map ... final Map<String, Object> mapDupliquee = new HashMap<String, Object>(); @@ -122,15 +190,31 @@ } - public List<EbliWidgetAnimatedItem> getAnimatedItems() { - return null; - } - protected void editingStop() { isInEditMode_ = false; getEbliScene().getController().fireEditStop(this); } + /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + return null; + } + + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + return null; + } + + public EbliWidget getIntern(){ + return this; + } + + + public boolean isAnimatedItemAlive(String _id){ + return false; + } + public Color getColorContour() { return (Color) propGraphique.get(COLORCONTOUR); } @@ -177,6 +261,13 @@ return null; } + /** + * @return the idst + */ + public String getId() { + return id_; + } + // useless public Object getMin(final String _key) { return null; @@ -279,13 +370,6 @@ } /** - * @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() { @@ -336,49 +420,6 @@ return true; } - private boolean changeVisible(final boolean _newValue, final 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, final 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(final String _property, Object _newValue, final CtuluCommandContainer _cmd) { final Object old = propGraphique.get(_property); if (old == _newValue || (old != null && old.equals(_newValue))) return; @@ -433,24 +474,4 @@ useBorder_ = _useBorder; } - public boolean canRotate() { - return true; - } - - public boolean canColorForeground() { - return true; - } - - public boolean canColorBackground() { - return true; - } - - public boolean canTraceLigneModel() { - return true; - } - - public boolean canFont() { - return true; - } - } \ No newline at end of file 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -34,12 +34,17 @@ public EbliAnimatedInterface getAnimatedInterface() { return getIntern().getAnimatedInterface(); } - + @Override public List<EbliWidgetAnimatedItem> getAnimatedItems() { return getIntern().getAnimatedItems(); } + @Override + public boolean isAnimatedItemAlive(String _id) { + return getIntern().isAnimatedItemAlive(_id); + } + EbliWidgetControllerActionOnly controllerBordure_ = null; public EbliWidgetController getBordureController() { @@ -115,7 +120,7 @@ if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); } else - // if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } + // if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } return super.getProperty(_key); } @@ -166,7 +171,7 @@ public void setIntern(EbliWidget _intern) { intern_ = _intern; } - + public boolean canRotate() { return intern_.canRotate(); } @@ -186,6 +191,5 @@ public boolean canFont() { return intern_.canFont(); } - } Modified: 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 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -6,91 +6,172 @@ import java.awt.Component; import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.Iterator; +import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Set; -import javax.swing.JDialog; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibDialog; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimation; 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.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuButton; +import com.sun.org.apache.bcel.internal.generic.GETSTATIC; + /** * @author deniger */ public class EbliWidgetAnimAdapter extends EbliAnimationSourceAbstract { EbliScene scene_; + EbliAnimationAction act_; + BuButton optionCp_; public EbliWidgetAnimAdapter(EbliScene _scene) { super(); scene_ = _scene; } + protected void chooseSources() { + LayerWidget widget = scene_.getVisu(); + EbliWidgetAnimTreeNode animsNode = new EbliWidgetAnimTreeNode(); + List<EbliWidgetAnimTreeNode> animItems = new ArrayList<EbliWidgetAnimTreeNode>(); + findAnimsTreeNode(widget, animsNode, animItems); + CtuluDialogPanel pn = new CtuluDialogPanel(); + pn.setLayout(new BuBorderLayout()); + + JXTreeTable treeTable = new JXTreeTable(new EbliWidgetAnimateTreeTableModel(animsNode, Arrays.asList(EbliLib + .getS("Titre"), EbliLib.getS("Anim\xE9")))); + treeTable.expandAll(); + treeTable.getColumnModel().getColumn(0).setPreferredWidth(200); + treeTable.getColumnModel().getColumn(1).setPreferredWidth(150); + treeTable.setTreeCellRenderer(new AnimTreeCellRenderer()); + pn.add(new JScrollPane(treeTable)); + CtuluDialog dialog = pn.createDialog(CtuluLibSwing.getActiveWindow()); + if (CtuluDialogPanel.isOkResponse(dialog.afficheDialogModal(optionCp_.getLocationOnScreen(), null))) { + List<EbliWidgetAnimatedItem> adapter = new ArrayList<EbliWidgetAnimatedItem>(); + for (EbliWidgetAnimTreeNode item : animItems) { + if (item.isSelected()) adapter.add(((EbliWidgetAnimatedItem) item.getUserObject())); + } + if (adapter.isEmpty()) { + act_.setAnimAdapter(null); + } else { + act_.setAnimAdapter(new EbliWidgetAnimationComposition(scene_, adapter)); + } + } + + } + @SuppressWarnings("serial") public EbliAnimationAction createAction() { - EbliAnimationAction act = new EbliAnimationAction(this) { - @Override - public void updateBeforeShow() { - EbliAnimationAdapterInterface adapter = findAnimAdapter(); - EbliWidgetAnimAdapter.this.setAdapter(adapter); - super.setAnimAdapterInterface(adapter); - updateStateBeforeShow(); + if (act_ != null) return act_; + EbliAnimation anim = new EbliAnimation(); + optionCp_ = new BuButton(EbliLib.getS("Choisir les sources")); + optionCp_.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent _e) { + chooseSources(); } + }); + anim.setOptionCp(optionCp_); + act_ = new EbliAnimationAction(this, anim) { + // @Override + // public void updateBeforeShow() { + // EbliAnimationAdapterInterface adapter = findAnimAdapter(); + // EbliWidgetAnimAdapter.this.setAdapter(adapter); + // super.setAnimAdapterInterface(adapter); + // updateStateBeforeShow(); + // } }; - act.setEnabled(true); - return act; + act_.setEnabled(true); + return act_; } - public EbliAnimationAdapterInterface findAnimAdapter() { - LayerWidget widget = scene_.getVisu(); - DefaultMutableTreeTableNode animsNode = new DefaultMutableTreeTableNode(); - findAnimsTreeNode(widget, animsNode); - JDialog d = new JDialog(); - d.setContentPane(new JXTreeTable(new DefaultTreeTableModel(animsNode))); - d.pack(); - d.setVisible(true); - return null; + private static class AnimTreeCellRenderer extends DefaultTreeCellRenderer { + + @Override + public Component getTreeCellRendererComponent(JTree _tree, Object _value, boolean _sel, boolean _expanded, + boolean _leaf, int _row, boolean _hasFocus) { + Component res = super.getTreeCellRendererComponent(_tree, _value, _sel, _expanded, _leaf, _row, _hasFocus); + if (_value != null) { + DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode) _value; + EbliWidgetAnimatedItem object = (EbliWidgetAnimatedItem) node.getUserObject(); + if (object != null) { + setText(object.getTitle()); + setIcon(object.getIcon()); + } + } + return res; + } + } - private void findAnimsTreeNode(Widget widget, DefaultMutableTreeTableNode animsNode) { - List<Widget> children = widget.getChildren(); + // public EbliAnimationAdapterInterface findAnimAdapter() { + // LayerWidget widget = scene_.getVisu(); + // EbliWidgetAnimTreeNode animsNode = new EbliWidgetAnimTreeNode(); + // findAnimsTreeNode(widget, animsNode); + // JDialog d = new JDialog(); + // JXTreeTable treeTable = new JXTreeTable(new EbliWidgetAnimateTreeTableModel(animsNode, Arrays + // .asList("Title", "Use"))); + // treeTable.setTreeCellRenderer(new AnimTreeCellRenderer()); + // d.setContentPane(treeTable); + // d.pack(); + // d.setVisible(true); + // return null; + // } + + private void findAnimsTreeNode(Widget _widget, EbliWidgetAnimTreeNode _animsNode, + List<EbliWidgetAnimTreeNode> _animItems) { + EbliWidgetAnimationComposition adapter = (EbliWidgetAnimationComposition) getAdapter(); + List<Widget> children = _widget.getChildren(); for (Widget w : children) { EbliWidget ew = (EbliWidget) w; EbliNode n = (EbliNode) scene_.findObject(ew); - if (n.getWidget() == ew) { + if (n.getWidget() == ew && ew.isVisible()) { EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); if (animatedInterface != null) { - EbliAnimationSourceInterface animationSrc = animatedInterface.getAnimationSrc(); - DefaultMutableTreeTableNode treeNode = new DefaultMutableTreeTableNode(new EbliWidgetAnimatedItem( - animationSrc, null, n.getTitle())); + EbliWidgetAnimTreeNode treeNode = new EbliWidgetAnimTreeNode(new EbliWidgetAnimatedItem(animationSrc, null, + ew.getId(), null, n.getTitle())); List<EbliWidgetAnimatedItem> animatedItems = ew.getAnimatedItems(); if (CtuluLibArray.isNotEmpty(animatedItems)) { for (EbliWidgetAnimatedItem ebliWidgetAnimatedItem : animatedItems) { - treeNode.add(new DefaultMutableTreeTableNode(ebliWidgetAnimatedItem)); + EbliWidgetAnimTreeNode animTreeNode = new EbliWidgetAnimTreeNode(ebliWidgetAnimatedItem); + if (adapter != null && adapter.contains(ebliWidgetAnimatedItem.getAnimated())) { + animTreeNode.selected_ = true; + } + treeNode.add(animTreeNode); + _animItems.add(animTreeNode); } - animsNode.add(treeNode); + _animsNode.add(treeNode); } } else { - findAnimsTreeNode(ew, animsNode); + findAnimsTreeNode(ew, _animsNode, _animItems); } } @@ -113,6 +194,14 @@ return scene_.produceImage(_params); } - public void setVideoMode(boolean _b) {} + public void setVideoMode(boolean _b) { + if (_b) { + EbliWidgetAnimationComposition cmp = (EbliWidgetAnimationComposition) getAdapter(); + if (cmp.removeKilledItems()) { + if (cmp.getNbItems() == 0) act_.setAnimAdapter(null); + } + } + } + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,46 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; + +public class EbliWidgetAnimTreeNode extends DefaultMutableTreeTableNode { + boolean selected_; + + public EbliWidgetAnimTreeNode() {} + + public EbliWidgetAnimTreeNode(EbliWidgetAnimatedItem _userObject) { + super(_userObject); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public Object getValueAt(int _column) { + if (_column == 1) return Boolean.valueOf(selected_); + return super.getValueAt(_column); + } + + @Override + public boolean isEditable(int _column) { + return _column == 1; + } + + /** + * @return the selected + */ + public boolean isSelected() { + return selected_; + } + + @Override + public void setValueAt(Object _value, int _column) { + Boolean b = (Boolean) _value; + selected_ = b.booleanValue(); + } +} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,53 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import java.util.List; + +import javax.swing.tree.TreePath; + +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.jdesktop.swingx.treetable.TreeTableNode; + +/** + * @author deniger + */ +public class EbliWidgetAnimateTreeTableModel extends DefaultTreeTableModel { + + public EbliWidgetAnimateTreeTableModel() { + super(); + } + + public EbliWidgetAnimateTreeTableModel(TreeTableNode _root) { + super(_root); + } + + public EbliWidgetAnimateTreeTableModel(TreeTableNode _root, List<?> _columnNames) { + super(_root, _columnNames); + } + + + @Override + public Class<?> getColumnClass(int _column) { + if (_column == 1) return Boolean.class; + return super.getColumnClass(_column); + } + + @Override + public void setValueAt(Object _value, Object _node, int _column) { + super.setValueAt(_value, _node, _column); + TreeTableNode ttn = (TreeTableNode) _node; + + if (_column == 1 && !ttn.isLeaf()) { + int n = ttn.getChildCount(); + for (int i = 0; i < n; i++) { + TreeTableNode child = ttn.getChildAt(i); + child.setValueAt(_value, _column); + modelSupport.firePathChanged(new TreePath(getPathToRoot(child))); + } + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -4,9 +4,13 @@ */ package org.fudaa.ebli.visuallibrary.animation; +import java.lang.ref.WeakReference; + import javax.swing.Icon; import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; /** * @author deniger @@ -14,42 +18,60 @@ public class EbliWidgetAnimatedItem { /** - * L'interface d'animation + * L'interface d'animation. On utilise une weakreference car l'inteface peut etre supprime de la scene et toujours + * reference dans la liste des anim\xE9es */ - private EbliAnimationAdapterInterface animated_; + private final WeakReference<EbliAnimationAdapterInterface> animated_; /** - * L'icone + * L'icone. On utilise une weakreference car l'inteface peut etre supprime de la scene et toujours reference dans la + * liste des anim\xE9es */ - private Icon icon_; + private final WeakReference<Icon> icon_; /** * L'identifiant */ - private String id_; - - public EbliWidgetAnimatedItem() { - } - - - public EbliWidgetAnimatedItem(EbliAnimationAdapterInterface _animated, Icon _icon, String _id) { + private final String id_; + private final String widgetId_; + private final String title_; + + public EbliWidgetAnimatedItem(EbliAnimationAdapterInterface _animated, Icon _icon, String _widgetId, String _id, + String _title) { super(); - animated_ = _animated; - icon_ = _icon; + animated_ = new WeakReference<EbliAnimationAdapterInterface>(_animated); + icon_ = new WeakReference<Icon>(_icon); id_ = _id; + widgetId_ = _widgetId; + title_ = _title; } /** + * @return the widgetId + */ + public String getWidgetId() { + return widgetId_; + } + + public boolean isAlive(EbliScene _scene) { + if (animated_.get() == null) return false; + EbliWidget w = _scene.findById(getWidgetId()); + if (w == null) return false; + return w.isAnimatedItemAlive(getId()); + + } + + /** * @return the animated */ public EbliAnimationAdapterInterface getAnimated() { - return animated_; + return animated_.get(); } /** * @return the icon */ public Icon getIcon() { - return icon_; + return icon_.get(); } /** @@ -60,24 +82,10 @@ } /** - * @param _animated the animated to set + * @return the title */ - public void setAnimated(EbliAnimationAdapterInterface _animated) { - animated_ = _animated; + public String getTitle() { + return title_; } - /** - * @param _icon the icon to set - */ - public void setIcon(Icon _icon) { - icon_ = _icon; - } - - /** - * @param _id the id to set - */ - public void setId(String _id) { - id_ = _id; - } - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,136 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import gnu.trove.TIntArrayList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * @author deniger + */ +public class EbliWidgetAnimationComposition implements EbliAnimationAdapterInterface { + + final List<EbliWidgetAnimatedItem> anims_; + final List<TIntArrayList> tsIdx_ = new ArrayList<TIntArrayList>(); + final EbliScene scene_; + final double eps = 1E-3; + + public EbliWidgetAnimationComposition(EbliScene _scene, List<EbliWidgetAnimatedItem> _items) { + super(); + scene_ = _scene; + anims_ = _items; + buildTs(); + } + + private void buildTs() { + tsIdx_.clear(); + if (anims_.isEmpty()) return; + final int size = anims_.size(); + if (size == 1) { + tsIdx_.add(null); + return; + } + EbliWidgetAnimatedItem it = anims_.get(0); + int nbTime = it.getAnimated().getNbTimeStep(); + for (int i = size - 1; i >= 0; i--) { + tsIdx_.add(new TIntArrayList(nbTime)); + } + + int[] indexes = new int[size - 1]; + for (int i = 0; i < nbTime; i++) { + boolean ok = findNext(indexes, it.getAnimated().getTimeStepValueSec(i)); + if (ok) { + tsIdx_.get(0).add(i); + for (int k = size - 1; k > 0; k--) { + tsIdx_.get(k).add(indexes[k - 1]); + } + } + } + + } + + private boolean findNext(int[] idx, double _v) { + Arrays.fill(idx, -1); + int nb = anims_.size(); + boolean ok = true; + for (int i = 1; i < nb; i++) { + int res = findIn(anims_.get(i).getAnimated(), _v); + idx[i - 1] = res; + if (res < 0) ok = false; + } + return ok; + } + + private int findIn(EbliAnimationAdapterInterface _src, double _val) { + for (int i = 0; i < _src.getNbTimeStep(); i++) { + if (CtuluLib.isZero(_val - _src.getTimeStepValueSec(i), eps)) return i; + } + return -1; + } + + public int getNbItems() { + return anims_.size(); + } + + public boolean contains(EbliAnimationAdapterInterface _anim) { + for (EbliWidgetAnimatedItem it : anims_) { + if (CtuluLib.isEquals(_anim, it.getAnimated())) return true; + } + return false; + } + + protected boolean removeKilledItems() { + boolean removed = false; + for (int i = anims_.size() - 1; i >= 0; i--) { + if (!anims_.get(i).isAlive(scene_)) { + anims_.remove(i); + tsIdx_.remove(i); + removed = true; + } + + } + if (removed) buildTs(); + return removed; + } + + protected int getTsFor(int _animsIdx, int _tidx) { + TIntArrayList list = tsIdx_.get(_animsIdx); + return list == null ? _tidx : list.get(_tidx); + } + + public int getNbTimeStep() { + TIntArrayList list = tsIdx_.get(0); + return list == null ? anims_.get(0).getAnimated().getNbTimeStep() : tsIdx_.get(0).size(); + } + + public String getTimeStep(final int _idx) { + return anims_.get(0).getAnimated().getTimeStep(getTsFor(0, _idx)); + } + + public double getTimeStepValueSec(int _idx) { + return anims_.get(0).getAnimated().getTimeStepValueSec(getTsFor(0, _idx)); + } + + public String getTitle() { + return EbliLib.getS("Sources muliples"); + } + + public void setTimeStep(final int _idx) { + int idx = 0; + for (EbliWidgetAnimatedItem it : anims_) { + it.getAnimated().setTimeStep(getTsFor(idx++, _idx)); + } + } + +} 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -123,8 +123,8 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidgetPlage) { EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - new_widget.getIntern().setFont(ft); - new_widget.getIntern().majText(); + new_widget.getInternWidget().setFont(ft); + new_widget.getInternWidget().majText(); // -- mise du nouveau bounds max --// Rectangle boundsIntern = new_widget.getIntern().getBounds(); @@ -286,7 +286,7 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidgetPlage) { EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getIntern().getLabel())); + maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getInternWidget().getLabel())); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -97,15 +97,15 @@ // setEnabled(false); } -// public String formatte(String texte) { -// if (texte.length() < plage_.getLegende().length()) { -// -// return texte; -// } else return texte.substring(0, plage_.getLegende().length()); -// -// } + // public String formatte(String texte) { + // if (texte.length() < plage_.getLegende().length()) { + // + // return texte; + // } else return texte.substring(0, plage_.getLegende().length()); + // + // } - public InternWidget getIntern() { + public InternWidget getInternWidget() { return intern_; } @@ -118,7 +118,7 @@ intern_.setLabel(plage_.getLegende()); } - public void setIntern(InternWidget intern_) { + public void setInternLabel(InternWidget intern_) { this.intern_ = intern_; } 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -216,10 +216,16 @@ List<EbliWidgetAnimatedItem> res = new ArrayList<EbliWidgetAnimatedItem>(20); for (int i = 0; i < cqs.length; i++) { if (cqs[i].isVisible() && cqs[i] instanceof EbliAnimationAdapterInterface) { - res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], cqs[i].getName())); + res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], getId(), cqs[i].getName(), + cqs[i].getTitle())); } } return res; } + public boolean isAnimatedItemAlive(String _id) { + BCalque cq = calquePanel_.getVueCalque().getCalque().getCalqueParNom(_id); + return cq != null && cq.isVisible(); + } + } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -1,36 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; - -/** - * Panel de renderer pour le tree - * @author genesis - * - */ -public class EbliCheckBoxPanel extends BuPanel{ - - - private static final long serialVersionUID = -608817114677578183L; - BuCheckBox checkBox; - BuLabel labelRenderer; - public EbliCheckBoxPanel(){ - setOpaque(false); - } - - public void construct(){ - if(labelRenderer !=null){ - labelRenderer.setOpaque(false); - add(labelRenderer); - } - if(checkBox !=null){ - checkBox.setOpaque(false); - add(checkBox); - } - setOpaque(false); - - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -36,19 +36,6 @@ public EbliJXTreeTableCellRenderer() { returnLabel.setOpaque(false); returnLabel.setHorizontalAlignment(BuLabel.LEFT); - /* - * Font fontValue; fontValue = UIManager.getFont("Tree.font"); if (fontValue - * != null) { leafRenderer.setFont(fontValue); } Boolean booleanValue = - * (Boolean) UIManager .get("Tree.drawsFocusBorderAroundIcon"); - * leafRenderer.setFocusPainted((booleanValue != null) && - * (booleanValue.booleanValue())); - * - * selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor"); - * selectionForeground = UIManager.getColor("Tree.selectionForeground"); - * selectionBackground = UIManager.getColor("Tree.selectionBackground"); - * textForeground = UIManager.getColor("Tree.textForeground"); - * textBackground = UIManager.getColor("Tree.textBackground"); - */ } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, @@ -89,59 +76,5 @@ return returnLabel; } - /* - * public Component getTreeCellRendererComponent(JTree tree, Object value, - * boolean selected, boolean expanded, boolean leaf, int row, boolean - * hasFocus) { - * - * - * BuLabel returnLabel = null; BuCheckBox returnValue = null; // cas - * particulier renderer: on met un checkbox que si on est feuille et pqs root - * (= cqs ou lqyer depourvu d objet graphique) if (leaf && - * !((DefaultMutableTreeNode) value).isRoot()) { - * - * // -- recuperation du node --// Object userObject = - * ((DefaultMutableTreeNode) value).getUserObject(); - * - * EbliNodeDefault node = null; if (userObject instanceof EbliNode) { node = - * (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - * - * //System.err.println("c est un EbliNode!!! ROW: " + row); - * - * // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque // - * composant returnValue=new BuCheckBox(); //leafRenderer.setOpaque(false); - * - * returnValue.setText(node.getTitle()); - * returnValue.setSelected(node.getWidget().isVisible()); - * - * - * returnLabel=new BuLabel(this.iconLeafEnabled); - * - * - * - * returnLabel.setEnabled(node.getWidget().isVisible()); } - * - * } else { returnLabel=new BuLabel(((DefaultMutableTreeNode) - * value).toString(),this.iconRoot); //returnValue = - * nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, - * expanded, leaf, row, hasFocus); - * - * } - * - * - * //-- creation du panel avec les informations --// leafRenderer=new - * EbliCheckBoxPanel(); - * - * if(returnLabel!=null) leafRenderer.labelRenderer=returnLabel; - * - * if(returnValue!=null ) leafRenderer.checkBox=returnValue; - * - * //-- construction du composant --// leafRenderer.construct(); - * - * // qccessible en fonction du tree - * leafRenderer.setEnabled(tree.isEnabled()); if(selected){ - * leafRenderer.setBackground(Color.BLUE); } else - * leafRenderer.setBackground(Color.WHITE); return leafRenderer; } - */ } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -1,53 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.awt.Component; -import java.awt.Graphics; - -import javax.swing.Icon; -import javax.swing.tree.TreeCellRenderer; - -import org.fudaa.ctulu.CtuluLibString; -import org.jdesktop.swingx.renderer.DefaultTreeRenderer; -import org.jdesktop.swingx.renderer.IconValue; -import org.jdesktop.swingx.renderer.StringValue; - -/** - * @author deniger - * - */ -// TODO a am\xE9liorer -public class EbliWidgetCellRendererBuilder { - - private static final class WidgetIconValue implements IconValue { - public Icon getIcon(Object _value) { - // EbliNodeDefault node = new EbliNodeDefault(); - Icon ic = new Icon() { - - public void paintIcon(Component _c, Graphics _g, int _x, int _y) { - _g.drawRoundRect(_x, _y, 16, 16, 3, 3); - _g.drawRoundRect(_x + 4, _y + 4, 8, 8, 3, 3); - - } - - public int getIconWidth() { - return 16; - } - - public int getIconHeight() { - return 16; - } - }; - return ic; - } - } - - @SuppressWarnings("serial") - public static TreeCellRenderer getNodeIconCellRenderer() { - return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { - - public String getString(Object _value) { - return CtuluLibString.EMPTY_STRING; - } - }); - } -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -71,7 +71,6 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetCellRendererBuilder; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.jdesktop.swingx.JXTreeTable; import org.netbeans.api.visual.action.ActionFactory; @@ -350,7 +349,7 @@ JXTreeTable view = new JXTreeTable(tree); - view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); +// view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); p.add(new JScrollPane(view), BuBorderLayout.WEST); g.setPreferredSize(new Dimension(200, 300)); g.setSize(g.getPreferredSize()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |