From: <de...@us...> - 2008-08-25 20:38:20
|
Revision: 3837 http://fudaa.svn.sourceforge.net/fudaa/?rev=3837&view=rev Author: deniger Date: 2008-08-25 20:38:24 +0000 (Mon, 25 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-25 20:38:24 UTC (rev 3837) @@ -0,0 +1,49 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Dimension; +import java.awt.Point; + +import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; + +import com.memoire.bu.BuLib; + +/** + * Test d'un widget pour afficher la legende A remplacer. + * + * @author deniger + */ +public class EbliWidgetCalqueLegende extends BCalqueLegende { + + EbliScene scene_; + + public EbliWidgetCalqueLegende(EbliScene _scene) { + super(); + scene_ = _scene; + } + + @Override + protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { + _pnLeg.setVisible(true); + _pnLeg.setSize(150, 300); + _pnLeg.setPreferredSize(new Dimension(150, 300)); + _pnLeg.setMinimumSize(new Dimension(150, 300)); + EbliWidgetCreatorCalqueLegende creator = new EbliWidgetCreatorCalqueLegende(_pnLeg); + _pnLeg.setDoubleBuffered(false); + BuLib.setDoubleBuffered(_pnLeg, false); + EbliNodeDefault def = new EbliNodeDefault(); + def.setPreferedLocation(new Point(200, 200)); + // def.setPreferedSize(new Dimension(150, 250)); + def.setCreator(creator); + // TODO non stable + scene_.addNode(def); + scene_.refresh(); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-03 16:54:23
|
Revision: 3873 http://fudaa.svn.sourceforge.net/fudaa/?rev=3873&view=rev Author: deniger Date: 2008-09-03 16:54:27 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java Deleted: 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-03 15:11:35 UTC (rev 3872) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-03 16:54:27 UTC (rev 3873) @@ -1,500 +0,0 @@ -/** - * Licence GPL - * Copyright Genesis - */ -package org.fudaa.ebli.visuallibrary.calque; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.EnumSet; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; - -import org.fudaa.ebli.calque.BArbreCalqueModel; -import org.fudaa.ebli.calque.BCalqueLegende; -import org.fudaa.ebli.calque.BCalqueLegendePanel; -import org.fudaa.ebli.palette.BPalettePlageInterface; -import org.fudaa.ebli.palette.BPalettePlageLegende; -import org.fudaa.ebli.palette.PaletteEditAction; -import org.fudaa.ebli.trace.BPlageInterface; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; -import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.InplaceEditorProvider; -import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.api.visual.widget.LabelWidget.Alignment; -import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; -import org.netbeans.modules.visual.layout.FlowLayout; - -import com.memoire.fu.FuLog; - -/** - * La classe de gestion des legendes pour le calque. - * - * @author Adrien Hadoux - */ -public class EbliWidgetCalqueLegende extends BCalqueLegende { - - EbliScene scene_; - - BCalqueLegendePanel legendePanel_; - - BArbreCalqueModel modelTreeCalque_; - - public BArbreCalqueModel getModelTreeCalque() { - return modelTreeCalque_; - } - - public void setModelTreeCalque(BArbreCalqueModel _modelTreeCalque) { - modelTreeCalque_ = _modelTreeCalque; - - } - - public static int LENGHT_PER_LEGENDE = 15; - public static int WIDTH_PER_LEGENDEICON = 10; - public static int WIDTH_PER_LEGENDETEXT = 130; - public static int WIDTH_LEGENDE = 200; - - public static int MAX_BORDURE = 12; - - public static Dimension createSizeForWidget(int _nbLibelles) { - return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); - } - - public EbliWidgetCalqueLegende(EbliScene _scene, BArbreCalqueModel model) { - super(); - scene_ = _scene; - modelTreeCalque_ = model; - - } - - /** - * override de calqueLegende qui recupere le panel legende associe - */ - @Override - protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { - FuLog.warning("J'ajoute un nouveau BCalqueLegendePanel dans la widget legende:" + _pnLeg); - - legendePanel_ = _pnLeg; - - // createLegende(); - } - - /** - * cree la legende en widget. - * - * @return EbliNode cree ajoute a la scene. - */ - public EbliNode createLegende() { - - // legendePanel_.setVisible(true); - // legendePanel_.setSize(150, 300); - // legendePanel_.setPreferredSize(new Dimension(150, 300)); - // legendePanel_.setMinimumSize(new Dimension(150, 300)); - // - // // EbliWidgetCreatorLegende creator = new - // // EbliWidgetCreatorLegende(legendePanel_); - // // legendePanel_.setDoubleBuffered(false); - // // BuLib.setDoubleBuffered(legendePanel_, false); - - EbliNodeDefault def = new EbliNodeDefault(); - def.setPreferedLocation(new Point(200, 200)); - // def.setPreferedSize(new Dimension(150, 250)); - def.setCreator(new EbliWidgetCreatorLegende(legendePanel_, modelTreeCalque_)); - def.setTitle("L\xE9gende calque"); - // TODO non stable - scene_.addNode(def); - scene_.refresh(); - - return def; - } - - static class MetricLegend extends FontMetrics { - - // protected MetricLegend(Font font) { - // super(font); - // } - public MetricLegend(Font font) { - super(font); - } - - } - - /** - * Creation de la classe widget specifique au calque. Permet de gerer le - * resize via le changement de font - * - */ - public static class WidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<JComponent>, - TreeModelListener { - - Font oldFont_; - BArbreCalqueModel modelTree_; - boolean maj = true; - BCalqueLegendePanel legendePanel_; - - public WidgetCalqueLegende(EbliScene scene, boolean _controller, BArbreCalqueModel model, - BCalqueLegendePanel legendePanel) { - super(scene, _controller); - oldFont_ = getFormeFont(); - modelTree_ = model; - - // -- la legende est un listener des modifs de son calque --// - modelTree_.addTreeModelListener(this); - - legendePanel_ = legendePanel; - setEnabled(true); - - // -- creation de l action edition des labels --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); - // -- ajout de l action au label correspondant --// - this.getActions().addAction(editorAction); - - - - } - - protected Rectangle resizeMaxLegende() { - this.getGraphics().setFont(getFormeFont()); - int maxHeight = 0; - int maxWidth = 0; - // -- mise a jour de la widget avec la nouvelle font - List<Widget> listePlage = getChildren(); - for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidgetPlageTitle) { - EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; - - // -- recuperation des tailles des font pour les textes saisies - - FontMetrics ftm = this.getGraphics().getFontMetrics(); - - int newWidth = ftm.stringWidth(new_widget.getIntern().getLabel()); - int newHeight = ftm.getHeight(); - if (maxWidth < newWidth) - maxWidth = newWidth; - maxHeight = newHeight; - - } - - } - Rectangle newBounds = new Rectangle(); - newBounds.height /* + */= maxHeight; - newBounds.width /* + */= maxWidth; - - return newBounds; - } - - protected void paintWidget() { - - // -- mise a jour de la fonte que si il y a eu une modification --// - if (oldFont_ != getFormeFont() || maj) { - maj = false; - // -- calcul des max height et width pour resize les composants --// - Rectangle newBounds = resizeMaxLegende(); - - // -- mise a jour de la widget avec la nouvelle font - List<Widget> listePlage = getChildren(); - for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidgetPlageTitle) { - EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; - new_widget.getIntern().setFont(getFormeFont()); - new_widget.getIntern().majText(); - FuLog.warning("MA plage: " + new_widget.plage_.getLegende()); - - // -- mise du nouveau bounds max --// - Rectangle boundsIntern = new_widget.getIntern().getBounds(); - boundsIntern.width = newBounds.width; - boundsIntern.height = (int) (newBounds.height); - - new_widget.getIntern().setPreferredBounds(boundsIntern); - - // resize pour le logo: forme carr\xE9 - Rectangle boundsLogo = new_widget.getLogo_().getBounds(); - boundsLogo.height = (int) (newBounds.height); - boundsLogo.width = (int) (newBounds.height); - new_widget.getLogo_().setPreferredBounds(boundsLogo); - new_widget.getLogo_().repaint(); - - } else if (widget instanceof LabelWidget) { - LabelWidget new_widget = (LabelWidget) widget; - - new_widget.setFont(getFormeFont()); - Rectangle boundsTitre = new_widget.getBounds(); - boundsTitre.width = newBounds.width; - boundsTitre.height = (int) (newBounds.height); - new_widget.setPreferredBounds(boundsTitre); - } - - } - // Resize de la widget - - Rectangle newBoundConteneurs = getParentWidget().getBounds(); - newBoundConteneurs.height = (int) ((listePlage.size() + 1) * (newBounds.height * 1.5));// ( - newBoundConteneurs.width = (int) (newBounds.width * 1.5); - getParentWidget().setPreferredBounds(newBoundConteneurs); - getEbliScene().refresh(); - oldFont_ = getFormeFont(); - - } - - } - - /** - * Methode qui cree l editeur du calque. - */ - public JComponent createEditorComponent( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget) { - - // -- creation de la palette de la legende --// - if (modelTree_ != null) { - PaletteEditAction editeur = new PaletteEditAction(modelTree_.getTreeSelectionModel()); - editeur.setSelected(true); - JComponent comp = editeur.buildContentPane(); - comp.setSize(this.getBounds().width, this.getBounds().height); - comp.setMaximumSize(new Dimension(this.getBounds().width, this.getBounds().height)); - comp.setPreferredSize(new Dimension(this.getBounds().width, this.getBounds().height)); - - editeur.updateBeforeShow(); - return comp; - } - return null; - } - - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor) { - return null; - } - - public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor, Rectangle _viewBounds) { - return null; - } - - public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, - Widget _widget, JComponent _editor, boolean _commit) { - // - // - // reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); - // this.getEbliScene().refresh(); - } - - - - public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, - Widget _widget, JComponent _editor) { - } - - - // ----------------------------- listener du calque - // ----------------------------// - /** - * cas ou l arbre est modifie pour changer de variable, on reconstruit sa - * legende associee - */ - public void treeNodesChanged(TreeModelEvent _e) { - FuLog.warning("J ENTRE DANS treeNodesChanged " + cp++); - FuLog.warning("treeNodesChanged"); - // -- on supprime le listener aupres du calque --// - // modelTree_.removeTreeModelListener(this); - - // -- on retire tous les widget children du widget legende --// - this.removeChildren(); - - reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); - this.getEbliScene().refresh(); - } - - public void treeNodesInserted(TreeModelEvent _e) { - FuLog.warning("treeNodesInserted"); - } - - public void treeNodesRemoved(TreeModelEvent _e) { - FuLog.warning("treeNodesRemoved"); - } - - - public void treeStructureChanged(TreeModelEvent _e) { - FuLog.warning("treeStructureChanged"); - } - - - - } - - /** - * Methode statique qui recree la widget associee au calque. Il faut que son - * parent la bordure ajoute et prenne en compte sa nouvelle fille pour bien - * gerer le dispatch des composants graphiques. - * - * @param widgetLegende_ - * @param _calqueLegende - * @param _scene - * @param model - */ - public static int cp = 1; - public static void reconstructWidget(WidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, - EbliScene _scene, BArbreCalqueModel model) { - - // -- on retire de la bordure la widget fille --// - EbliWidgetBordure parent = (EbliWidgetBordure) widgetLegende_.getParentWidget(); - - widgetLegende_ = (WidgetCalqueLegende) createLegendeWidget(widgetLegende_, _calqueLegende, _scene, model); - - parent.repaint(); - - } - /** - * Mananger statique qui se charge de creer \xE9a widget associee au calque. - * - * @param _calqueLegende - * le panel legende qui sera recopie version widget - * @param _scene - * la scene - * @return la widfget de la legende. - */ - public static EbliWidget createLegendeWidget(WidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, - EbliScene _scene, - BArbreCalqueModel model) { - - // --creation de la widget conteneur --// - BPalettePlageInterface listeplages = null; - // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, - // _calqueLegende); - widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); - - if (_calqueLegende != null) { - Component[] listeC = _calqueLegende.getComponents(); - - for (int i = 0; i < listeC.length; i++) { - Component c = listeC[i]; - FuLog.warning(i + ") " + c); - if (c instanceof JLabel) { - - - LabelWidget titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(((JLabel) c).getText()); - titre.setEnabled(true); - widgetLegende_.addChild(titre); - } - - if (c instanceof BPalettePlageLegende) { - BPalettePlageLegende pal = (BPalettePlageLegende) c; - FuLog.warning("title) " + pal.getModel().getTitre() + "| nb de composant du model: " - + pal.getModel().getNbPlages()); - - // --recuperation de la liste des plages --// - listeplages = pal.getModel(); - - - // --creation du titre --// - LabelWidget titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(listeplages.getTitre()); - titre.setEnabled(true); - widgetLegende_.addChild(titre); - - if (listeplages.getNbPlages() != 0) { - for (int j = 0; j < listeplages.getNbPlages(); j++) { - - BPlageInterface plage = listeplages.getPlageInterface(j); - FuLog.warning("jlist " + j + ") " + plage.getLegende()); - - // -- ajout d'une widget plage --// - EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); - - lw.setUseBorder(false); - lw.setEnabled(true); - - widgetLegende_.addChild(lw); - - } - } else { - // liste des plages est vide il s agit d une autre legende - Component[] lcomp = pal.getComponents(); - for (int j = 0; j < lcomp.length; j++) { - Component co = lcomp[j]; - FuLog.warning(j + ") autre legende: " + co); - - if (co instanceof JPanel) { - JPanel panel = (JPanel) co; - - for (int k = 0; k < panel.getComponents().length; k++) { - FuLog.warning(j + ") appartien a panel: " + panel.getComponents()[k]); - - if (panel.getComponents()[k] instanceof JLabel) { - FuLog.warning("label) =" + ((JLabel) panel.getComponents()[k]).getText()); - titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); - titre.setEnabled(true); - widgetLegende_.addChild(titre); - } else if (panel.getComponents()[k] instanceof JList) { - JList jlst = (JList) panel.getComponents()[k]; - for (int g = 0; g < jlst.getModel().getSize(); g++) { - FuLog.warning(g + ")jlist: element=" + jlst.getModel().getElementAt(g)); - titre = new LabelWidget(_scene); - titre.setAlignment(Alignment.CENTER); - titre.setVerticalAlignment(VerticalAlignment.CENTER); - titre.setLabel((String) jlst.getModel().getElementAt(g)); - titre.setEnabled(true); - widgetLegende_.addChild(titre); - } - - } - - } - - } - - } - } - } - - } - - widgetLegende_.setController_(new EbliWidgetControllerMenuOnly(widgetLegende_, false)); - - // -- prendre en compte le resize automatique --// - widgetLegende_.oldFont_ = new Font("Helvetica", Font.BOLD, 40); - widgetLegende_.repaint(); - - return widgetLegende_; - } else { - FuLog.warning("createLegendeWidget retourne widget null"); - return null; - } - } - - - - - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-03 16:55:51
|
Revision: 3874 http://fudaa.svn.sourceforge.net/fudaa/?rev=3874&view=rev Author: deniger Date: 2008-09-03 16:55:56 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-03 16:55:56 UTC (rev 3874) @@ -0,0 +1,207 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JComponent; + +import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.palette.PaletteSelecteurCouleurPlage; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection; +import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Widget; + +import com.memoire.fu.FuLog; + +/** + * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font + */ +public class EbliWidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<JComponent>, + PropertyChangeListener { + + BCalqueLegendePanel legendePanel_; + // BArbreCalqueModel modelTree_; + boolean maj = true; + Font oldFont_; + + public EbliWidgetCalqueLegende(EbliScene _scene, boolean _controller/* , BArbreCalqueModel model */, + BCalqueLegendePanel _legendePanel) { + super(_scene, _controller); + oldFont_ = getFormeFont(); + // -- la legende est un listener des modifs de son calque --// + _legendePanel.getCalque().addPropertyChangeListener("paletteCouleur", this); + _legendePanel.getCalque().addPropertyChangeListener("paletteTitle", this); + + // modelTree_.addTreeModelListener(this); + + legendePanel_ = _legendePanel; + setEnabled(true); + + // -- creation de l action edition des labels --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + // -- ajout de l action au label correspondant --// + this.getActions().addAction(editorAction); + + } + + /** + * Methode qui cree l editeur du calque. + */ + public JComponent createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget) { + if (PaletteSelecteurCouleurPlage.isTargetValid(legendePanel_.getCalque())) { + PaletteSelecteurCouleurPlage palette = new PaletteSelecteurCouleurPlage(); + palette.setPalettePanelTarget(legendePanel_.getCalque()); + palette.setSize(this.getBounds().width, this.getBounds().height); + palette.setMaximumSize(new Dimension(this.getBounds().width, this.getBounds().height)); + palette.setPreferredSize(new Dimension(this.getBounds().width, this.getBounds().height)); + return palette; + } + + return null; + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, + JComponent _editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, + JComponent _editor, Rectangle _viewBounds) { + return null; + } + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, + Widget _widget, JComponent _editor, boolean _commit) { + // + // + // reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); + // this.getEbliScene().refresh(); + } + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, + Widget _widget, JComponent _editor) {} + + protected void notifyRemoved() { + legendePanel_.getCalque().removePropertyChangeListener("paletteCouleur", this); + legendePanel_.getCalque().removePropertyChangeListener("paletteTitle", this); + } + + protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + if (oldFont_ != getFormeFont() || maj) { + maj = false; + // -- calcul des max height et width pour resize les composants --// + Rectangle newBounds = resizeMaxLegende(); + + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlageTitle) { + EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; + new_widget.getIntern().setFont(getFormeFont()); + new_widget.getIntern().majText(); + FuLog.warning("MA plage: " + new_widget.plage_.getLegende()); + + // -- mise du nouveau bounds max --// + Rectangle boundsIntern = new_widget.getIntern().getBounds(); + boundsIntern.width = newBounds.width; + boundsIntern.height = (int) (newBounds.height); + + new_widget.getIntern().setPreferredBounds(boundsIntern); + + // resize pour le logo: forme carr\xE9 + Rectangle boundsLogo = new_widget.getLogo_().getBounds(); + boundsLogo.height = (int) (newBounds.height); + boundsLogo.width = (int) (newBounds.height); + new_widget.getLogo_().setPreferredBounds(boundsLogo); + new_widget.getLogo_().repaint(); + + } else if (widget instanceof LabelWidget) { + LabelWidget new_widget = (LabelWidget) widget; + + new_widget.setFont(getFormeFont()); + Rectangle boundsTitre = new_widget.getBounds(); + boundsTitre.width = newBounds.width; + boundsTitre.height = (int) (newBounds.height); + new_widget.setPreferredBounds(boundsTitre); + } + + } + // Resize de la widget + + Rectangle newBoundConteneurs = getParentWidget().getBounds(); + newBoundConteneurs.height = (int) ((listePlage.size() + 1) * (newBounds.height * 1.5));// ( + newBoundConteneurs.width = (int) (newBounds.width * 1.5); + getParentWidget().setPreferredBounds(newBoundConteneurs); + getEbliScene().refresh(); + oldFont_ = getFormeFont(); + + } + + } + + /** + * Si la palette est modifiee on change la widget + */ + public void propertyChange(PropertyChangeEvent _evt) { + rebuildWidget(); + + } + + private void rebuildWidget() { + this.removeChildren(); + + CalqueLegendeWidgetAdapter.reconstructWidget(this, legendePanel_, getEbliScene()); + this.getEbliScene().refresh(); + } + + protected Rectangle resizeMaxLegende() { + this.getGraphics().setFont(getFormeFont()); + int maxHeight = 0; + int maxWidth = 0; + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlageTitle) { + EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; + + // -- recuperation des tailles des font pour les textes saisies + + FontMetrics ftm = this.getGraphics().getFontMetrics(); + + int newWidth = ftm.stringWidth(new_widget.getIntern().getLabel()); + int newHeight = ftm.getHeight(); + if (maxWidth < newWidth) maxWidth = newWidth; + maxHeight = newHeight; + + } + + } + Rectangle newBounds = new Rectangle(); + newBounds.height /* + */= maxHeight; + newBounds.width /* + */= maxWidth; + + return newBounds; + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-24 21:17:49
|
Revision: 3978 http://fudaa.svn.sourceforge.net/fudaa/?rev=3978&view=rev Author: deniger Date: 2008-09-24 21:17:45 +0000 (Wed, 24 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 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-24 21:15:55 UTC (rev 3977) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-24 21:17:45 UTC (rev 3978) @@ -2,7 +2,6 @@ import java.awt.Dimension; import java.awt.Font; -import java.awt.FontMetrics; import java.awt.Rectangle; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |