From: <de...@us...> - 2008-08-19 03:46:16
|
Revision: 3826 http://fudaa.svn.sourceforge.net/fudaa/?rev=3826&view=rev Author: deniger Date: 2008-08-19 03:46:23 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaInternalFrameModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileFillePanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/prepro.properties Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSceneEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/extensions.jnlp branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/prepro-maquette.jnlp Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -10,22 +10,36 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; +import java.awt.Dialog; import java.awt.Font; import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Window; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.*; +import javax.swing.AbstractListModel; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.border.Border; +import org.fudaa.ctulu.CtuluLib; + import com.memoire.bu.BuApplication; import com.memoire.bu.BuBorders; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuLib; import com.memoire.bu.BuList; -import org.fudaa.ctulu.CtuluLib; - /** * @author fred deniger * @version $Id: CtuluLibSwing.java,v 1.8 2007-05-04 13:43:23 deniger Exp $ @@ -49,9 +63,11 @@ } /** - * Ajouter un actionListener a la checkbox _res afin d'activer ou non un panneau (et tous ces composants). + * Ajouter un actionListener a la checkbox _res afin d'activer ou non un + * panneau (et tous ces composants). * - * @param _target le panneau dont les composants seront activ\xE9es ou non, selon l'\xE9tat de la checkbox _res + * @param _target le panneau dont les composants seront activ\xE9es ou non, selon + * l'\xE9tat de la checkbox _res * @param _res la checkbox permettant de activer ou non un panneau */ public static void addActionListenerForCheckBoxTitle(final JPanel _target, final JCheckBox _res) { @@ -74,9 +90,7 @@ } public static String getHelpUrl(final JComponent _c) { - if (_c == null) { - return null; - } + if (_c == null) { return null; } String r = (String) _c.getClientProperty(CtuluLib.getHelpProperty()); if (r == null) { final Container parent = _c.getParent(); @@ -88,20 +102,31 @@ } public static Frame getFrameAncestor(final Component _c) { - if (_c instanceof Frame) { - return (Frame) _c; - } + if (_c instanceof Frame) { return (Frame) _c; } + Frame fr = (Frame) SwingUtilities.getAncestorOfClass(JFrame.class, _c); + if (fr != null) return fr; final BuApplication app = (BuApplication) SwingUtilities.getAncestorOfClass(BuApplication.class, _c); - if (app != null) { - return app; - } - return (Frame) SwingUtilities.getAncestorOfClass(JFrame.class, _c); + if (app != null) { return app; } + return null; } + /** + * @return la window active + */ + public static Window getActiveWindow() { + return KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); + } + + public static JDialog createDialogOnActiveWindow(String _title) { + Window w = getActiveWindow(); + if (w instanceof Frame) { return new JDialog((Frame) w, _title); } + if (w instanceof Dialog) { return new JDialog((Dialog) w, _title); } + return new JDialog(BuLib.HELPER, _title); + + } + public static BuList createBuList(final Object[] _o) { - if (_o == null) { - return new BuList(); - } + if (_o == null) { return new BuList(); } final BuList l = new BuList(); l.setModel(CtuluLibSwing.createListModel(_o)); return l; @@ -154,12 +179,8 @@ d.dispose(); final Object selectedValue = _optionPane.getValue(); - if (selectedValue == null) { - return JOptionPane.CLOSED_OPTION; - } - if (selectedValue instanceof Integer) { - return ((Integer) selectedValue).intValue(); - } + if (selectedValue == null) { return JOptionPane.CLOSED_OPTION; } + if (selectedValue instanceof Integer) { return ((Integer) selectedValue).intValue(); } return JOptionPane.CLOSED_OPTION; } @@ -210,7 +231,7 @@ c.setEnabled(_enable); if (c instanceof Container) { setEnable((Container) c, _resToAvoid, _enable); - } + } } } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -106,7 +106,7 @@ CalqueInteractionListener interactionListener_; protected ZEbliCalquesPanel pn_; - boolean isSpecificActionInit_; + protected boolean isSpecificActionInit_; EbliActionInterface[] selectedActionGroup_; @@ -175,6 +175,7 @@ /** * Construction du groupe de navigation par defaut. */ + @SuppressWarnings("serial") protected void buildButtonGroupNavigation() { if (navigationActionGroup_ != null) { return; @@ -490,7 +491,7 @@ return actions; } - void initSpecificActions() { + protected void initSpecificActions() { if (!isSpecificActionInit_) { specificActionGroup_ = pn_.getApplicationActions(); isSpecificActionInit_ = true; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -28,7 +28,7 @@ "SONDE", _cq); _m.addTreeSelectionListener(this); super.setDefaultToolTip(EbliLib.getS("Interpoler les valeurs en un point")); - super.setEnabled(_m.getSelectedCalque() instanceof ZCalqueSondeInterface); + updateForLayer(_m.getSelectedCalque()); } public void valueChanged(final TreeSelectionEvent _e){ @@ -39,14 +39,18 @@ final BCalque c = (BCalque) _e.getPath().getLastPathComponent(); //le calque en cours doit passer en mode inactif // active si le nouveau calque le permet - if (c instanceof ZCalqueSondeInterface) { + updateForLayer(c); + + } + + private void updateForLayer(final BCalque _c) { + if (_c instanceof ZCalqueSondeInterface) { super.setEnabled(true); - ((ZCalqueSondeInteraction)bc_).setTarget((ZCalqueSondeInterface)c); + ((ZCalqueSondeInteraction)bc_).setTarget((ZCalqueSondeInterface)_c); } else { super.setEnabled(false); ((ZCalqueSondeInteraction)bc_).setTarget(null); } - } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -9,6 +9,7 @@ import java.awt.Component; import java.awt.Dialog; import java.awt.Dimension; +import java.awt.Frame; import java.awt.Point; import java.awt.Window; import java.awt.event.MouseWheelListener; @@ -24,15 +25,16 @@ import javax.swing.SwingUtilities; import javax.swing.event.InternalFrameEvent; +import org.fudaa.ctulu.gui.CtuluLibSwing; + import com.memoire.bu.BuDesktop; import com.memoire.bu.BuLib; import com.memoire.bu.BuPalette; -import org.fudaa.ctulu.gui.CtuluLibSwing; - /** * @author deniger - * @version $Id: EbliActionPaletteAbstract.java,v 1.21 2007-06-13 12:57:45 deniger Exp $ + * @version $Id: EbliActionPaletteAbstract.java,v 1.21 2007-06-13 12:57:45 + * deniger Exp $ */ public abstract class EbliActionPaletteAbstract extends EbliActionChangeState { @@ -97,9 +99,7 @@ dial_.dispose(); dial_ = null; } - if ((window_ == null) || !window_.isVisible()) { - return; - } + if ((window_ == null) || !window_.isVisible()) { return; } loc_ = window_.getLocation(); window_.setVisible(false); window_.getContent().setVisible(false); @@ -152,14 +152,16 @@ } if (desktop_ == null) { - Dialog d = (Dialog) SwingUtilities.getAncestorOfClass(Dialog.class, parent_); + Window d = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent_); if (d != null) { - dial_ = new JDialog(d); + dial_ = (d instanceof Frame) ? new JDialog((Frame) d) : new JDialog((Dialog) d); dial_.setLocation(d.getLocationOnScreen()); } else { dial_ = new JDialog(CtuluLibSwing.getFrameAncestor(parent_)); + dial_.setLocationRelativeTo(parent_); } + dial_.setModal(true); dial_.setContentPane(window_.getContentPane()); dial_.pack(); dial_.addWindowListener(new WindowAdapter() { @@ -214,9 +216,7 @@ } public JComponent getPaletteContent() { - if (window_ == null) { - return null; - } + if (window_ == null) { return null; } return window_.getContent(); } @@ -233,7 +233,8 @@ } /** - * Methode appele lorsque le bouton de cette palette change d'\xE9tat (visible ou non). + * Methode appele lorsque le bouton de cette palette change d'\xE9tat (visible ou + * non). */ public void setMainButtonVisible(final boolean _b) { if (_b && isSelected()) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -23,7 +23,6 @@ import com.memoire.fu.Fu; import com.memoire.fu.FuLog; - /** * @author Fred Deniger * @version $Id: EGAxeHorizontal.java,v 1.17 2007-05-04 13:49:41 deniger Exp $ @@ -32,7 +31,7 @@ private boolean isDiscret_; - //private boolean isIntegerStep_; + // private boolean isIntegerStep_; /** * Rien. @@ -64,11 +63,11 @@ } - protected void afficheGraduationsEtGrille(final Graphics2D _g,final EGRepere _f){ - //NumberFormat nf = isIntegerStep_ ? null : getNumberFormat(); + protected void afficheGraduationsEtGrille(final Graphics2D _g, final EGRepere _f) { + // NumberFormat nf = isIntegerStep_ ? null : getNumberFormat(); final FontMetrics fm = _g.getFontMetrics(); final Color lightfg = getLightColor(); - //Color superlightfg = getSuperLightColor(); + // Color superlightfg = getSuperLightColor(); final int y = _f.getMaxEcranY(); final int yBasMajor = y + 3; final int yBas = y + 1; @@ -76,8 +75,8 @@ double lastMaxX = -10; final double ftHaut = fm.getMaxAscent() + 5; final boolean grille = isGrille(); - int idx=0; - for (final TickIterator it = buildUpToDateMainTickIterator(); it.hasNext() && idx<300; it.next()) { + int idx = 0; + for (final TickIterator it = buildUpToDateMainTickIterator(); it.hasNext() && idx < 300; it.next()) { idx++; _g.setColor(lightfg); final int xe = _f.getXEcran(it.currentValue()); @@ -90,7 +89,7 @@ } final double wordWidth = fm.stringWidth(t); final double xLeft = xe - wordWidth / 2; - //pour eviter que les graduations se chevauchent + // pour eviter que les graduations se chevauchent if (xLeft > (lastMaxX + 2) && (xe + wordWidth / 2) < _f.getMaxEcranX()) { _g.drawLine(xe, y, xe, yBasMajor); @@ -99,8 +98,7 @@ } else { _g.drawLine(xe, y, xe, yBas); } - } - else { + } else { _g.drawLine(xe, y, xe, yBas); } } @@ -109,32 +107,33 @@ } } /* - * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double xLeft = xe - - * fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { g.drawString(t, (int) xLeft, (int) (y + - * ftHaut)); } + * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double + * xLeft = xe - fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { + * g.drawString(t, (int) xLeft, (int) (y + ftHaut)); } */ } /** - * Appelee uniquement si isIntegerStep est true: permet de donner une repr\xE9sentation specifique - * pour la graduation passee en parametres. Par defaut, l'entier est traduit en string. + * Appelee uniquement si isIntegerStep est true: permet de donner une + * repr\xE9sentation specifique pour la graduation passee en parametres. Par + * defaut, l'entier est traduit en string. + * * @param _i la graduation a dessiner * @return la chaine representant cette graduation */ - protected String getGraduationFor(final int _i){ + protected String getGraduationFor(final int _i) { return CtuluLibString.getString(_i); } - protected Color getLightColor(){ + protected Color getLightColor() { final int rc = lineColor_.getRed(); final int gc = lineColor_.getGreen(); final int bc = lineColor_.getBlue(); final int incr = Math.max(Math.max((200 - rc), (200 - gc)), (200 - bc)); - return new Color(Math.min(255, rc + incr / 5), Math.min(255, gc + incr / 5), Math.min(255, bc - + incr / 5)); + return new Color(Math.min(255, rc + incr / 5), Math.min(255, gc + incr / 5), Math.min(255, bc + incr / 5)); } - protected Color getSuperLightColor(){ + protected Color getSuperLightColor() { final int rc = lineColor_.getRed(); final int gc = lineColor_.getGreen(); final int bc = lineColor_.getBlue(); @@ -142,7 +141,7 @@ return new Color(Math.min(255, rc + incr), Math.min(255, gc + incr), Math.min(255, bc + incr)); } - protected TickIterator createMainTickIterator(){ + protected TickIterator createMainTickIterator() { if (isDiscret_ && axisIterator_ == null) { axisIterator_ = new NumberIntegerIterator(); } @@ -151,13 +150,12 @@ /** * Dessine l'axe horizontal. + * * @param _g le graphics cible * @param _f le repere */ - public void dessine(final Graphics2D _g,final EGRepere _f){ - if (!visible_) { - return; - } + public void dessine(final Graphics2D _g, final EGRepere _f) { + if (!visible_) { return; } final Font old = _g.getFont(); if (font_ != null) { _g.setFont(font_); @@ -179,8 +177,8 @@ _g.drawLine(xf, y, xf - 3, y + 2); } _g.setFont(old); - if(FuLog.isDebug()&& Fu.DEBUG) { - FuLog.debug(getClass().getName()+" paint END"); + if (FuLog.isDebug() && Fu.DEBUG) { + FuLog.debug(getClass().getName() + " paint END"); } } @@ -188,7 +186,7 @@ if (titreVisible_ || uniteVisible_) { final String t = titreVisible_ ? titre_ : null; String unit = null; - if (uniteVisible_ && unite_!=null && unite_.length()>0) { + if (uniteVisible_ && unite_ != null && unite_.length() > 0) { unit = '[' + unite_ + ']'; } _g.setColor(lineColor_); @@ -206,8 +204,7 @@ } final int xtext = _xi + (_f.getMaxEcranX() - _xi) / 2 - fm.stringWidth(txt) / 2; _g.drawString(txt, xtext, _y + _f.getMargesBas() - fm.getHeight() - 1); - } - else { + } else { if (t != null) { width = fm.stringWidth(t); } @@ -234,45 +231,45 @@ * @param _g la cible * @return l'espace requis en bas de l'axe */ - public int getBottomHeightNeeded(final Graphics2D _g){ - //epaisseur trait + public int getBottomHeightNeeded(final Graphics2D _g) { + // epaisseur trait int r = 3; - if (_g == null) { - return r; - } + if (_g == null) { return r; } if (graduations_ || isGrille()) { if (font_ == null) { font_ = EGGraphe.DEFAULT_FONT; } - //la graduation + // la graduation r += 10; r += _g.getFontMetrics(font_).getHeight(); } - //si la legende est centree elle est dessinee en-dessous de la graduation + // si la legende est centree elle est dessinee en-dessous de la graduation if (isTitreCentre_) { r += _g.getFontMetrics(font_).getHeight(); } /* - * if (titre != null && unite != null) { r += _g.getFontMetrics(font).getDescent(); } + * if (titre != null && unite != null) { r += + * _g.getFontMetrics(font).getDescent(); } */ return r; } /* *//** - * Renvoie la chaine reelle et non formatee. - * @param _val la valeur a considerer - * @return la chaine a utiliser pour l'affichage - */ + * Renvoie la chaine reelle et non formatee. + * + * @param _val la valeur a considerer + * @return la chaine a utiliser pour l'affichage + */ /* - * public String getReelString(double _val){ if (isIntegerStep_) { return getGraduationFor((int) - * _val); } return Double.toString(_val); } + * public String getReelString(double _val){ if (isIntegerStep_) { return + * getGraduationFor((int) _val); } return Double.toString(_val); } */ /** * @param _g le graphics dessine * @return l'espace requis a droite de l'axe */ - public int getRightWidthNeeded(final Graphics2D _g){ + public int getRightWidthNeeded(final Graphics2D _g) { int r = 0; if (!isTitreCentre_) { if (titreVisible_ && titre_ != null) { @@ -295,31 +292,30 @@ * @param _val la valeur a considerer * @return la chaine a utiliser pour l'affichage */ - public String getStringAffiche(final double _val){ - if (specificFormat_ != null) { - return specificFormat_.format(_val); - } + public String getStringAffiche(final double _val) { + if (specificFormat_ != null) { return specificFormat_.format(_val); } return super.getStringAffiche(_val); } - public final boolean isDiscret(){ + public final boolean isDiscret() { return isDiscret_; } /** - * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est effectuee en - * consequence: seul des entiers sont dessin\xE9s. + * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est + * effectuee en consequence: seul des entiers sont dessin\xE9s. + * * @return true si la graduation est faite par palier. */ /* * public final boolean isIntegerStep(){ return isIntegerStep_; } */ - public final boolean isVertical(){ + public final boolean isVertical() { return false; } - public static EGAxeHorizontal buildDefautTimeAxe(final CtuluNumberFormatI _i){ + public static EGAxeHorizontal buildDefautTimeAxe(final CtuluNumberFormatI _i) { final EGAxeHorizontal h = new EGAxeHorizontal(); h.setTitre("t"); h.setAxisIterator(new DateIterator()); @@ -340,18 +336,18 @@ * @param _isIntegerStep si la graduation est faite par palier. */ /* - * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = _isIntegerStep; - * if(axisIterator_!=null) axisIterator_=null; } + * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = + * _isIntegerStep; if(axisIterator_!=null) axisIterator_=null; } */ - + public EGAxeHorizontal duplicate() { - + EGAxeHorizontal duplic = new EGAxeHorizontal(this); - duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); + if (getFont() != null) duplic.setFont(new Font(this.getFont().getFamily(), this.getFont().getStyle(), this + .getFont().getSize())); duplic.setTitre(this.getTitre()); - + return duplic; } - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -627,7 +627,7 @@ } - void setLabel(final BuLabel _lb) { + public void setLabel(final BuLabel _lb) { lbXyInfo_ = _lb; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -11,6 +11,7 @@ import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; @@ -26,16 +27,31 @@ * */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { - + public static void refreshScene(Scene _sc) { _sc.validate(); _sc.repaint(); - if (_sc.getView() != null) - _sc.getView().repaint(); + if (_sc.getView() != null) _sc.getView().repaint(); } + EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; + /** + * @return the editor + */ + public EbliWidgetEditCreator getEditor() { + return editor_; + } + + /** + * @param _editor the editor to set + */ + public void setEditor(EbliWidgetEditCreator _editor) { + editor_ = _editor; + } + + /** * Le gestionnaire de commande associe \xE0 la scene */ CtuluCommandManager cmdMng_; @@ -72,6 +88,7 @@ setMenuBase(); } + /** * Methode qui permet d ajouter un listener * @@ -79,8 +96,7 @@ */ public void addEbliNodeListener(EbliNodeListener listener) { // init si necessaire - if (listenerList == null) - listenerList = new HashSet<EbliNodeListener>(); + if (listenerList == null) listenerList = new HashSet<EbliNodeListener>(); // ajout listenerList.add(listener); } @@ -108,8 +124,7 @@ // -- remplissage des proprietes res.setPreferredLocation(node.getPreferedLocation()); - if (node.getPreferedSize() != null) - res.setPreferredSize(node.getPreferedSize()); + if (node.getPreferedSize() != null) res.setPreferredSize(node.getPreferedSize()); // -- ajout dans la vue layer --// visu_.addChild(res); @@ -122,10 +137,8 @@ * graph model. The default implementation removes the node widget from its * parent widget. * - * @param node - * the removed node - * @param widget - * the removed node widget; null if the node is non-visual + * @param node the removed node + * @param widget the removed node widget; null if the node is non-visual * * Surcharge pour faire appel au notify des listener et ainsi mettre * ajour les listener @@ -134,8 +147,7 @@ // -- indique la suppresion du node chez le parent notifyAllListenerNodeRemoved(node); - if (widget != null) - widget.removeFromParent(); + if (widget != null) widget.removeFromParent(); } @@ -164,8 +176,7 @@ * @param listener */ public void notifyAllListenerNodeAdded(EbliNode node) { - if (listenerList == null) - return; + if (listenerList == null) return; for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { it.next().nodeAdded(node); } @@ -178,8 +189,7 @@ * @param listener */ public void notifyAllListenerNodeRemoved(EbliNode node) { - if (listenerList == null) - return; + if (listenerList == null) return; for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { EbliNodeListener listener = it.next(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -13,6 +13,7 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -44,7 +45,6 @@ */ public Map propGraphique; - /** * Liste des clef utilisees pour les composants graphiques */ @@ -53,8 +53,7 @@ public final static String COLORFOND = "colorFond"; public final static String ROTATION = "rotation"; public final static String FONT = "font"; - - + private boolean useBorder_ = true; /** @@ -71,7 +70,11 @@ */}; } - + protected String getTitle() { + EbliNode n = (EbliNode) getEbliScene().findObject(this); + return n == null ? CtuluLibString.EMPTY_STRING : n.getTitle(); + } + /** * Retourne une interface widgetConfigure qui permet de gerer les interfaces a * creer @@ -79,24 +82,23 @@ * @return */ private BConfigurableInterface getSingleConfigureInterface() { - + // -- retourne l interface qui va bien qui permet de creer les composants // graphiques correspondant --// return new WidgetConfigure(this); } - - public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { - // voir EGObject + // voir EGObject } - + // useless public Object getMin(String _key) { return null; } + // useless public Object getMoy(String _key) { return null; @@ -107,72 +109,67 @@ * correspondant depuis la map d objets graphiques de la widget. */ public Object getProperty(String _key) { - + System.err.println("suis dans getProperty key= " + _key); - + // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// if (_key.equals(ROTATION)) { double radian = getRotation(); int degre = (int) (radian * 180 / Math.PI); - return new Integer(degre); + return new Integer(degre); } - - + return propGraphique.get(_key); } - public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { - } + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} /** * Methode directement appelee apres modification des parametres renvoye par * le getproperty. Ajoute les anciens parametres dans la commande undo/redo. */ public boolean setProperty(String _key, Object prop) { - + System.err.println("Je suis rentre dans setProperty key= " + _key); - - - // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// if (_key.equals(LINEMODEL)) { getTraceLigneModel().updateData((TraceLigneModel) prop); prop = getTraceLigneModel(); } else if (_key.equals(ROTATION) && prop instanceof Integer) { - // -- cas particulier si il s agit de la rotation --// + // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// int degre = ((Integer) prop).intValue(); double radian = degre * Math.PI / 180; prop = new Double(radian); - + } - - // -- creation de la commande undo/redo --// + + // -- creation de la commande undo/redo --// CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); - + // -- ajout de la widget en question ainsi que la oldpropertie --// undoRedo.addWidget(this); undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); - + // --mise a jout de la map de proprietes --// propGraphique.put(_key, prop); - + // -- ajout de la nouvelle propertie --// undoRedo.addNewPropertie(propGraphique); - + // -- enregistrement de la commande undo/redo --// if (getEbliScene().cmdMng_ != null) { getEbliScene().cmdMng_.addCmd(undoRedo); } - + // -- mise a jour des parametres de la map --// refreshMyProperties(); - + return true; } @@ -182,34 +179,31 @@ /** * @param scene - * @param Point - * : indiaue la location preferentiel. peut etre nul + * @param Point : indiaue la location preferentiel. peut etre nul */ public EbliWidget(EbliScene scene) { super(scene); setScene_(scene); - - //-- remplisage de la map de propriete grahiques --// + + // -- remplisage de la map de propriete grahiques --// propGraphique = new HashMap<String, Object>(); - + // -- ajout du traceligneModel utilise par les filles--// propGraphique.put(LINEMODEL, new TraceLigneModel()); - + // -- ajout de la couleur de fond par default blanc--// propGraphique.put(COLORFOND, Color.WHITE); // -- ajout de la couleur de contour par default black--// propGraphique.put(COLORCONTOUR, Color.BLACK); - + // -- ajout de la font par default--// propGraphique.put(FONT, new Font("Helvetica.Italic", Font.PLAIN, 12)); // -- ajout de l angle de rotation par default PI --// propGraphique.put(ROTATION, Math.PI); - - - - //-- construction des actions --// + + // -- construction des actions --// getActions().addAction(scene.createSelectAction()); getActions().addAction(ActionFactory.createResizeAction()); getActions().addAction(scene.createWidgetHoverAction()); @@ -229,7 +223,7 @@ * @param _popup */ public void constructPopupMenuBase(JPopupMenu _popup) { - + JMenuItem menuItem4 = _popup.add("Configuration graphique"); menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); // BuResource.BU.getIcon("configurer") @@ -267,8 +261,7 @@ } }); - - + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -288,14 +281,11 @@ if (duplique != null && EbliWidget.this.getScene() != null) { EbliWidget.this.getEbliScene().addNode(duplique); - // -- duplication des map de property graphique de la widget --// duplique.getCreator().getWidget().propGraphique = n.getCreator().getWidget().duplicateGraphicalProperties(); // -- duplication de la taille --// duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); - - - + // -- raffraichissement de la scene --// EbliWidget.this.getEbliScene().refresh(); } @@ -303,13 +293,7 @@ } }); - - - - - - JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem2.addActionListener(new ActionListener() { @@ -325,7 +309,7 @@ } }); - + } /** @@ -350,9 +334,7 @@ @Override public void notifyStateChanged(ObjectState previousState, ObjectState newState) { - if (!useBorder_) { - return; - } + if (!useBorder_) { return; } setBorder(getScene().getLookFeel().getBorder(newState)); } @@ -389,25 +371,19 @@ public void refreshMyProperties() { getEbliScene().refresh(); } - - + public Map duplicateGraphicalProperties() { - Map mapDupliquee = new HashMap<String, Object>(); - - mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); mapDupliquee.put(COLORCONTOUR, getColorContour()); mapDupliquee.put(COLORFOND, getColorFond()); mapDupliquee.put(ROTATION, getRotation()); mapDupliquee.put(FONT, getFormeFont()); - - + return mapDupliquee; } - /** * Retourne les proprietes de la map. @@ -420,9 +396,6 @@ propGraphique.put(LINEMODEL, _l); } - - - public void setColorContour(Color newColor) { propGraphique.put(COLORCONTOUR, newColor); } @@ -439,21 +412,19 @@ return (Color) propGraphique.get(COLORFOND); } - public double getRotation() { - if (propGraphique.get(ROTATION) instanceof Integer) - propGraphique.put(ROTATION, new Double((Integer) propGraphique.get(ROTATION))); + if (propGraphique.get(ROTATION) instanceof Integer) propGraphique.put(ROTATION, new Double((Integer) propGraphique + .get(ROTATION))); return (Double) propGraphique.get(ROTATION); } public void setRotation(double rotation) { propGraphique.put(ROTATION, rotation); } - - + public Font getFormeFont() { - return (Font) propGraphique.get(FONT); - + return (Font) propGraphique.get(FONT); + } public void setFormeFont(Font newFont) { Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java (from rev 3819, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -0,0 +1,174 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Iterator; +import java.util.List; + +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.JTree; + +import org.flexdock.docking.DockingConstants; +import org.flexdock.docking.DockingManager; +import org.flexdock.docking.DockingPort; +import org.flexdock.docking.defaults.DefaultDockingPort; +import org.flexdock.view.View; +import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.ressource.EbliResource; + +/** + * + * @author deniger + * + */ +public class EbliWidgetEditCreator { + + public EbliWidgetEditCreator() { + + } + + /** + * Singleton pour configurer par defaut EbliScene + */ + public static final EbliWidgetEditCreator INSTANCE = new EbliWidgetEditCreator(); + + public Window createFrame(ZEbliCalquesPanel pn, String title) { + JFrame frame = new JFrame(title); + + frame.getContentPane().setLayout(new BorderLayout()); + JMenu[] specificMenus = pn.getSpecificMenus(EbliLib.getS("Vue 2D")); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + for (int i = 0; i < specificMenus.length; i++) { + mb.add(specificMenus[i]); + } + JToolBar tb = new JToolBar(); + List actions = pn.getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + tb.addSeparator(); + } else { + tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + frame.getContentPane().add(tb, BorderLayout.NORTH); + frame.setIconImage(EbliResource.EBLI.getImage("lissage")); +// pn.setPreferredSize(pn.getPreferredSize()); + final DefaultDockingPort globalPort = createDockingPort(); + JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("lissage"), EbliLib.getS("Vue 2D")); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JComponent rightComponent = createView(new JScrollPane(new BArbreCalque(pn.getArbreCalqueModel())), + EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); + DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); + + frame.getContentPane().add(globalPort, BorderLayout.CENTER); + frame.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent _e) { + globalPort.clear(); + } + + }); + return frame; + + } + + public Window createFrame(EGFillePanel pn, String title) { + JFrame frame = new JFrame(title); + + frame.getContentPane().setLayout(new BorderLayout()); + frame.setTitle(title); + frame.setIconImage(EbliResource.EBLI.getImage("curves")); + EbliActionInterface[] specificInterfaces = pn.getSpecificActions(); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + JMenu menu = new JMenu("Menu graphe"); + pn.fillSpecificMenu(menu); + + // for (int i = 0; i < specificInterfaces.length; i++) { + // mb.add(new JMenu(specificInterfaces[i])); + // } + mb.add(menu); + + JToolBar tb = new JToolBar(); + + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + if (object == null) { + tb.addSeparator(); + } else { + tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + frame.getContentPane().add(tb, BorderLayout.NORTH); + pn.setPreferredSize(pn.getPreferredSize()); + final DefaultDockingPort globalPort = createDockingPort(); + JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("curves"), EbliLib.getS("Courbes")); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + JComponent rightComponent = createView(new JScrollPane(tree), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); + DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); + + frame.getContentPane().add(globalPort, BorderLayout.CENTER); + frame.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent _e) { + globalPort.clear(); + } + + }); + return frame; + + } + + protected static DefaultDockingPort createDockingPort() { + DefaultDockingPort port = new DefaultDockingPort(); + port.setPreferredSize(new Dimension(400, 400)); + return port; + } + + // protected static JComponent createDockableComponent(String name) { + // JPanel panel = new JPanel(new BorderLayout()); + // panel.setBorder(new LineBorder(Color.BLUE)); + // panel.add(new JLabel("COUCOU " + name)); + // return createView(panel, name, true); + // } + + protected static JComponent createView(JComponent jc, Icon ic, String name) { + return createView(jc, ic, name, false); + } + + protected static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { + View view = new View(name); + view.setIcon(ic); + view.getViewProperties().setDockingEnabled(false); + if (dockage) { + view.addAction(DockingConstants.CLOSE_ACTION); + view.getViewProperties().setDockingEnabled(true); + } + view.setContentPane(jc); + view.setTitle(name, true); + // DockingManager.registerDockable(view.getComponent(), name); + + return view; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -5,12 +5,14 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Observable; +import java.util.Observer; import javax.swing.JComponent; import javax.swing.JFrame; @@ -36,28 +38,27 @@ * @author deniger * */ -public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { +public class EbliWidgetVueCalque extends EbliWidget implements EditProvider, Observer { ZEbliCalquesPanel calquePanel_; - EditCreator editor_; - JFrame frame_; + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; + + Window frame_; + BufferedImage image; GrBoite zoom_; - public Color couleurContour = Color.black; - public Color couleurFond = Color.white; - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; - editor_ = EditCreator.INSTANCE; // FIXME a enlever par la suite - setPreferredSize(new Dimension(200, 200)); - setMinimumSize(new Dimension(200, 200)); - initSize(new Rectangle(0, 0, 200, 200)); + setPreferredSize(new Dimension(500, 400)); + initSize(new Rectangle(0, 0, 500, 400)); + // calquePanel_.getArbreCalqueModel().getObservable().addObserver(this); // zoom_ = calquePanel_.getVueCalque().getCalque().getDomaine(); // calquePanel_.restaurer(); @@ -72,18 +73,19 @@ public void edit(Widget _widget) { if (frame_ != null) frame_.toFront(); else { - // final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); + final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); Point p = new Point(rec.x, rec.y); JComponent jc = getEbliScene().getView(); SwingUtilities.convertPointToScreen(p, jc); - frame_ = editor_.createFrame(calquePanel_); + frame_ = getEbliScene().getEditor().createFrame(calquePanel_, getTitle()); + p.x = p.x - 50; + p.y = p.y - 50; frame_.setLocation(p); - frame_.pack(); - // calquePanel_.getVueCalque().changeRepere(this, gr); + calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); - frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame_.addWindowListener(new WindowAdapter() { @Override @@ -94,17 +96,21 @@ @Override public void windowClosing(WindowEvent _e) { + setPreferredSize(calquePanel_.getVueCalque().getSize()); zoom_ = calquePanel_.getVueCalque().getViewBoite(); - // image = null; - // getEbliScene().refresh(); + image = null; + getEbliScene().refresh(); } }); } - // TODO Auto-generated method stub } + public Color getColorFond() { + return couleurFond; + } + private void initSize(Rectangle rec) { BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); calquePanel_.getVueCalque().setSize(rec.width, rec.height); @@ -115,6 +121,7 @@ } } + @SuppressWarnings("unchecked") @Override protected void paintWidget() { @@ -147,8 +154,9 @@ repaint(); } - public Color getColorFond() { - return couleurFond; + public void update(Observable _o, Object _arg) { + image = null; + getEbliScene().refresh(); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -1,48 +1,56 @@ package org.fudaa.ebli.visuallibrary.graphe; +import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; + /** * interface qui permet de creer un widget + * * @author genesis - * + * */ public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { - EGGraphe graphe; - public EGGraphe getGraphe() { - return graphe; - } + EGFillePanel pn_; - public void setGraphe(EGGraphe graphe) { - this.graphe = graphe; - } + public EGGraphe getGraphe() { + return pn_.getGraphe(); + } - EbliWidgetGraphe res; + // + // public void setGraphe(EGGraphe graphe) { + // this.graphe = graphe; + // } - public EbliWidgetCreatorGraphe(EGGraphe g) { - super(); - this.graphe = g; - } + EbliWidgetGraphe res; - public EbliWidget create(EbliScene _scene) { - // TODO Auto-generated method stub - // creation de la widget correspondante - res= new EbliWidgetGraphe(_scene, null, graphe); - - // ajout des listener d ecoute du graphe - graphe.getModel().addModelListener( - new EbliWidgetGrapheController(res)); - - return res; - } + public EbliWidgetCreatorGraphe(EGGraphe _g) { + super(); + this.pn_ = new EGFillePanel(_g); + } - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } + public EbliWidgetCreatorGraphe(EGFillePanel _pn) { + super(); + this.pn_ = _pn; + } + public EbliWidget create(EbliScene _scene) { + // TODO Auto-generated method stub + // creation de la widget correspondante + res = new EbliWidgetGraphe(_scene, null, pn_); + // ajout des listener d ecoute du graphe + pn_.getGraphe().getModel().addModelListener(new EbliWidgetGrapheController(res)); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -5,36 +5,42 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Map; import javax.swing.JComponent; -import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.calque.EditCreator; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.EditProvider; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.fu.FuLog; /** * widget qui contient un objet graphe + * * @author adrien hadoux - * + * */ public class EbliWidgetGraphe extends EbliWidget implements EditProvider/* * , @@ -44,165 +50,145 @@ * > */{ - private EGGraphe graphe; - JFrame frame_; - EditCreator editor_; - EGFillePanel panelGraphe_; - - private EbliNodeDefault nodeLegende=null; - - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; - - public EGGraphe getGraphe() { - return graphe; - } + // private EGGraphe graphe_; + Window frame_; + EGFillePanel panelGraphe_; - public void setGraphe(EGGraphe graphe) { - this.graphe = graphe; - } + private EbliNodeDefault nodeLegende = null; - public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { - super(scene); - // TODO Auto-generated constructor stub - setGraphe(_graphe); - - editor_ = EditCreator.INSTANCE; - panelGraphe_=new EGFillePanel(_graphe); - //-- creation de l action pour editor --// + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; + + public EGGraphe getGraphe() { + return panelGraphe_.getGraphe(); + } + + // + // public void setGraphe(EGGraphe graphe) { + // this.graphe_ = graphe; + // } + + public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGFillePanel _pn) { + super(scene); + panelGraphe_ = _pn; + WidgetAction editorAction = ActionFactory.createEditAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + } + + public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { + this(scene, preferredLocation, new EGFillePanel(_graphe)); + // -- creation de l action pour editor --// // WidgetAction editorAction = // ActionFactory.createInplaceEditorAction(this); - WidgetAction editorAction = ActionFactory.createEditAction(this); - - // -- ajout de l action au widget correspondant --// - this.getActions().addAction(editorAction); - - } + } - - protected void paintWidget() { - Rectangle rec = getClientArea(); - Graphics2D g = getGraphics(); - //-- couleur de fond --// + BufferedImage image; + + protected void paintWidget() { + Rectangle rec = getClientArea(); + Graphics2D g = getGraphics(); + g.translate(rec.x, rec.y); + + if (frame_ == null) { + getGraphe().setSize(rec.width - 1, rec.height - 1); +// getGraphe().computeMarges(g); +// getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); + } + + // mode edition + if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + FuLog.debug("EWI: recreate image"); + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // a ameliorer: il ne faudrait pas recreer l'image a chaque fois + image = getGraphe().produceImage(rec.width, rec.height, params); + + } + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); + // -- couleur de fond --// // g.setColor(couleurFond); // g.fillRect(0, 0, rec.width, rec.height); - - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - g.translate(rec.x, rec.y); - graphe.setSize(rec.width - 1, - rec.height - 1); - graphe.computeMarges(g); - - graphe.dessine(g, rec.width - 1, - rec.height - 1, false ); - } - - - /** - * Surcharge de la creation du menu de base en ajoutant les menus specifiques - */ - public void setMenu() { - getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { - public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu (); + // BufferedImage image = courbe.produceImage( + // rec.width - 1, rec.height - 1, + // Collections.EMPTY_MAP); - //-- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); - - //-- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); - return popup; - } - })); - } - - /** - * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende - * @param _popup - */ - private void constructPopupMenuSpecifique(JPopupMenu _popup){ - JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); - menuItem.addActionListener(new ActionListener(){ + g.translate(-rec.x, -rec.y); + } - public void actionPerformed(ActionEvent e) { + /** + * Surcharge de la creation du menu de base en ajoutant les menus specifiques + */ + public void setMenu() { + getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu(); - //-- creation de la l\xE9gende --// - if(EbliWidgetGraphe.this.getEbliScene()!=null){ - - //position a cote de la widget graphe - Point nouvellePosition=new Point((int)(EbliWidgetGraphe.this.getLocation().x),(int)(EbliWidgetGraphe.this.getLocation().y+EbliWidgetGraphe.this.getBounds().height*1.2)); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); - //getScene_().addChild(new EbliWidget(getScene_(),null)); - //addChild (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), GrapheWidget.this.getScene_(),null)); - if(!EbliWidgetGraphe.this.getEbliScene().isObject(nodeLegende)){ - - //-- creation d'un node legende --// - nodeLegende = new EbliNodeDefault(); - - nodeLegende.setCreator(new EbliWidgetCreatorLegende(getGraphe())); - nodeLegende.setPreferedLocation(nouvellePosition); - nodeLegende.setPreferedSize(new Dimension(100, 100)); - EbliWidgetGraphe.this.getEbliScene().addNode(nodeLegende); - - //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe.this.getGraphe(), EbliWidgetGraphe.this.getScene_(),nouvellePosition); - - } - - //GrapheWidget.this.addChild(widgetLegende); - } - } + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + return popup; + } + })); + } - }); + /** + * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende + * + * @param _popup + */ + private void constructPopupMenuSpecifique(JPopupMenu _popup) { + JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.addActionListener(new ActionListener() { - - //-- creation du menu config de la courbe - _popup.add(new EGConfigureActionPalette(graphe.getModel())); + public void actionPerformed(ActionEvent e) { - - - } + // -- creation de la l\xE9gende --// + if (EbliWidgetGraphe.this.getEbliScene() != null) { - - //-- methodes implements InplaceEditorProvider --// - - /** - * Methode appeleee pour creer un editor EGFillePanel correspondant a la vue - */ - // public /*EGFillePanel*/ BuPanel createEditorComponent( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget) { - // - // //-- creation du menu d'actions--// - // final JMenu menu = new JMenu(); - // menu.setName("menu du graphe"); - // menu.setText("menu du graphe"); - // // creation du panel Egfille correspondant - // final EGFillePanel panelGraphe=new EGFillePanel(this.graphe); - // new CtuluPopupListener(new CtuluPopupListener.PopupReceiver() { - // - // public void popup(MouseEvent _evt) { - // panelGraphe.popupMenu(_evt.getX(), _evt.getY()); - // - // } - // },panelGraphe); - // - // //--remplissage du menu --// - // panelGraphe.fillSpecificMenu(menu); - // - // //FIXME : comment construire le Jmenu principal ainsi que le tree qui - // qffiche les courbes ??? - // - // - // return panelGraphe; - // } - - public void edit(Widget _widget) { + // position a cote de la widget graphe + Point nouvellePosition = new Point((int) (EbliWidgetGraphe.this.getLocation().x), + (in... [truncated message content] |