From: <had...@us...> - 2008-08-18 16:11:34
|
Revision: 3824 http://fudaa.svn.sourceforge.net/fudaa/?rev=3824&view=rev Author: hadouxad Date: 2008-08-18 16:11:37 +0000 (Mon, 18 Aug 2008) Log Message: ----------- - Duplication des graphes ok - Edition des graphes ok - Mise a jour prises en compte lors de la modification dans la Frame Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 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-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -345,7 +345,12 @@ */ public EGAxeHorizontal duplicate() { - return new EGAxeHorizontal(this); + + EGAxeHorizontal duplic = new EGAxeHorizontal(this); + duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); + duplic.setTitre(this.getTitre()); + + return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -281,6 +281,7 @@ r += fm.getHeight() + 1; } else { final String axeTexte = getAxeTexte(); + System.err.println("HYAYHAH: axeTexte=" + axeTexte); final int wT = fm.stringWidth(axeTexte) + 4; // Le titre recouvre tout l'axe if (r < wT) { @@ -356,7 +357,11 @@ } public EGAxeVertical duplicate() { - return new EGAxeVertical(this); + EGAxeVertical duplic= new EGAxeVertical(this); + 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/EGCourbeChild.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -89,15 +89,35 @@ if (this.getModel() != null) duplic = new EGCourbeChild((EGGroup) newParent, this.getModel().duplicate()); else duplic = new EGCourbeChild((EGGroup) newParent, null); + + duplic.isVisible_ = this.isVisible_; duplic.displayTitleOnCurve_ = this.displayTitleOnCurve_; - duplic.font_ = new Font(this.font_.getFamily(), this.font_.getStyle(), this.font_.getSize()); + // if (this.font_ != null) + // duplic.font_ = new Font(this.font_.getFamily(), this.font_.getStyle(), + // this.font_.getSize()); + if (this.tbox_ != null) duplic.tbox_ = this.tbox_.duplicate(); // -- duplication du egCourbeSurfacePainter --// - duplic.surfacePainter_ = this.surfacePainter_.duplicate(); + duplic.surfacePainter_ = this.surfacePainter_.duplicate(duplic, _duplicator); + //-- aspect couleur contour+surface de la courbe --// + duplic.setAspectContour(this.getAspectContour()); + duplic.setAlpha(this.getAlpha()); + if(this.getFont()!=null) + duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); + if (this.getIconModel() != null) + duplic.setIconeModel(this.getIconModel().cloneData()); + if (this.getMarkLigneModel() != null) + duplic.setLigneMark(this.getMarkLigneModel().buildCopy().getModel()); + if (this.getLigneModel() != null) + duplic.setLigneType(this.getLigneModel()); + duplic.setTitle(this.getTitle()); + + + return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -71,7 +71,7 @@ duplic.tbox_ = this.tbox_.duplicate(); // -- duplication du egCourbeSurfacePainter --// - duplic.surfacePainter_ = this.surfacePainter_.duplicate(); + duplic.surfacePainter_ = this.surfacePainter_.duplicate(duplic, _duplicator); return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -317,21 +317,29 @@ model_ = _model; } - public EGCourbeSurfacePainter duplicate(EGGrapheDuplicator _duplicator) { + public EGCourbeSurfacePainter duplicate(EGCourbe cibleDuplique, EGGrapheDuplicator _duplicator) { //TODO: targetCourbe_.duplicate() n'est pas dans le graphe. Il faut une Map avec les anciennes/nouvelles valeurs //pas bon la courbe va etre duplique ailleurs - EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(this.targetCourbe_.duplicate(_duplicator), this.model_.duplicate(null)); + + // -- il ne faut pas oublier de changer la reference de la courvbe target + // qui est duplic et non this, de meme pour le model pour eviter des boucles + // infinies --// + + EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(cibleDuplique, _duplicator.getModelDuplique_()); duplic.alpha_ = this.alpha_; + if (this.delegateCourbe_ != null) duplic.delegateCourbe_ = new DelegateCourbe(duplic.model_); + duplic.down_ = this.down_; duplic.maxIdx_ = this.maxIdx_; duplic.minIdx_ = this.minIdx_; + if (this.delegatePalier_ != null) duplic.delegatePalier_ = new DelegatePalier(((int) Math.floor(targetCourbe_.getYMin()))); + duplic.selectedPainter_ = this.selectedPainter_; - // painter.painter_= - duplic.setSelectedPainter(this.selectedPainter_); duplic.up_ = this.up_; - // painter.x_ = CtuluLibArray.copy(this.x_); + + // painter.x_ = CtuluLibArray.copy(this.x_); // painter.y_ = CtuluLibArray.copy(this.y_); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -17,6 +17,22 @@ EGAxeHorizontal newH_; /** + * instance du eggrapheModel tres importante cette ref: envoye des la + * duplication du eggrapheModel a la base. Il est recupere notamment pour le + * EGCourbeSurfacePainter afin d eviter des stackoverflow de duplication du + * graphe model qui est deja duplique!!! . + */ + EGGrapheModel modelDuplique_; + + public EGGrapheModel getModelDuplique_() { + return modelDuplique_; + } + + public void setModelDuplique_(EGGrapheModel modelDuplique_) { + this.modelDuplique_ = modelDuplique_; + } + + /** * @param _vert l'axe a dupliquer * @return l'axe duplique en prenant soin de ne pas le recreer */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -771,6 +771,7 @@ EGGrapheSimpleModel duplic = new EGGrapheSimpleModel((EGCourbeSimple[]) listeElements.toArray()); //a corriger duplic.axeX_ = this.axeX_.duplicate(); + // duplication du listselectionModel // try { // duplic.selection_ = (DefaultListSelectionModel) this.selection_.clone(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -1071,8 +1071,17 @@ duplic.axeX_ = this.axeX_.duplicate(); duplic.selectionModel_.setSelectionMode(this.selectionModel_.getSelectionMode()); + GrapheTreeNode root=this.getGrapheTreeNode(); + GrapheTreeNode rootDuplique=duplic.getGrapheTreeNode(); + for (int i = 0; i < root.components_.size(); i++) { + + // -- ajout du groupe duplique --// + duplic.add(root.getGroup(i).duplicate(_duplicator)); + } + + return duplic; } Modified: 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/calque/EditCreator.java 2008-08-18 14:10:54 UTC (rev 3823) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java 2008-08-18 16:11:37 UTC (rev 3824) @@ -116,7 +116,13 @@ final DefaultDockingPort globalPort = createDockingPort(); JComponent centerComponent = createView(pn, "Graphe"); DockingManager.dock(centerComponent, (DockingPort) globalPort); + + // -- ajout du tree associes au nodes du graphe --// JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + // -- ajout du selectionlistener pour recuperer les events !! --// + tree.setSelectionModel(((EGGrapheTreeModel) pn.getGraphe().getModel()).getSelectionModel()); + tree.setRootVisible(false); + JComponent rightComponent = createView(new JScrollPane(tree), "arbre", true); DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-02 21:53:11
|
Revision: 3867 http://fudaa.svn.sourceforge.net/fudaa/?rev=3867&view=rev Author: deniger Date: 2008-09-02 21:53:15 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java 2008-09-02 21:52:17 UTC (rev 3866) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java 2008-09-02 21:53:15 UTC (rev 3867) @@ -26,6 +26,7 @@ import org.fudaa.ebli.commun.EbliActionPaletteTreeModel; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BSelecteurList; +import org.fudaa.ebli.controle.BSelecteurListComboBox; import org.fudaa.ebli.controle.BSelecteurListTarget; import org.fudaa.ebli.controle.BSelecteurListTimeTarget; import org.fudaa.ebli.ressource.EbliResource; @@ -70,6 +71,8 @@ } + final boolean useCombo_; + public EbliCalqueActionTimeChooser(final BArbreCalqueModel _c) { this(_c.getTreeSelectionModel()); } @@ -78,13 +81,18 @@ * Initialise l'action. */ public EbliCalqueActionTimeChooser(final TreeSelectionModel _c) { + this(_c, false); + } + + public EbliCalqueActionTimeChooser(final TreeSelectionModel _c, boolean _useCombo) { super(EbliLib.getS("Temps"), EbliResource.EBLI.getToolIcon("time"), "DISPLAY_TIME", _c); setDefaultToolTip(EbliLib.getS("S\xE9lectionner le temps \xE0 afficher")); setResizable(true); + useCombo_ = _useCombo; } protected BPalettePanelInterface buildPaletteContent() { - return new BSelecteurList(); + return useCombo_?new BSelecteurListComboBox():new BSelecteurList(); } protected boolean isTargetValid(final Object _o) { @@ -92,9 +100,7 @@ } protected boolean setPaletteTarget(final Object _target) { - if (_target == this || isTargetValid(_target)) { - return palette_.setPalettePanelTarget(this); - } + if (_target == this || isTargetValid(_target)) { return palette_.setPalettePanelTarget(this); } return palette_.setPalettePanelTarget(null); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java 2008-09-02 21:52:17 UTC (rev 3866) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java 2008-09-02 21:53:15 UTC (rev 3867) @@ -20,9 +20,6 @@ public abstract class EbliActionPaletteSpecAbstract extends EbliActionPaletteAbstract { protected transient BPalettePanelInterface palette_; - public BPalettePanelInterface getPalette_() { - return palette_; - } protected boolean setDisableWhenHide_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-09-02 21:52:17 UTC (rev 3866) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-09-02 21:53:15 UTC (rev 3867) @@ -56,7 +56,8 @@ public void valueChanged(final ListSelectionEvent _e) { if (isTargetUpdatable()) { isUpdatingFromSrc_ = true; - cb_.setSelectedIndex(target_.getListSelectionModel().getMaxSelectionIndex()); + int index = target_.getListSelectionModel().getMaxSelectionIndex(); + cb_.setSelectedIndex(index); isUpdatingFromSrc_ = false; } } @@ -125,6 +126,7 @@ if (idx >= 0) { adapter_.setSelectedItem(target_.getListModel().getElementAt(idx)); } + else adapter_.setSelectedItem(null); isUpdatingFromSrc_ = false; target_.getListSelectionModel().addListSelectionListener(listSelectionListener_); } @@ -135,6 +137,7 @@ adapter_.setModel(CtuluListModelEmpty.EMPTY); } cb_.setEnabled(ok); + cb_.setPreferredSize(cb_.getPreferredSize()); revalidate(); return target_ != null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-10 18:54:10
|
Revision: 3905 http://fudaa.svn.sourceforge.net/fudaa/?rev=3905&view=rev Author: hadouxad Date: 2008-09-10 18:54:20 +0000 (Wed, 10 Sep 2008) Log Message: ----------- GRAPHES Wizard graphes temporels OK - Lors Creation des graphe temporels du calque: cela utilise la source du visupanel et non plsu l unique source du projet. - POssibilit?\195?\169 d ajouter les courbes dans les graphes widget deja existant - Possibilit?\195?\169 de cr?\195?\169er un nouveau graphe - fonctionne pour les sondes et liste de points Wizard graphes profils spatiaux OK, fusion marche moyen... - panel 1: choix des isolignes, ne peut pas avancer tant qu il n y a rien de bon de choisi - panel 2 Choix des pas de tems et variables - panel 3 : choix creation ou graphes profils existant, on ne peut avancer tant qu il n y a rien de choisi (graphe existant a jout?\195?\169 ou cocher la case creation)) Fusion de graphes OK moyen (cf listing bugs): - action popup du widget "Fusion avec un autre graphe" - des l appui du bouton sur la popup de la widget selectionne: - ouverture d un menu qui propose la liste des graphes possible a fusionner ensemble (profils spatiaux et temporels s?\195?\169par?\195?\169s) - a la fin suppression de la widget choisie dans le panel. - recupere les variables des 2 graphes et les merge egalement - Fonctionne OK poru les profils spatiaux Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-09-10 07:40:16 UTC (rev 3904) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2008-09-10 18:54:20 UTC (rev 3905) @@ -12,7 +12,6 @@ import org.fudaa.ctulu.CtuluLibMessage; import org.fudaa.ctulu.CtuluLibString; - import org.fudaa.ebli.palette.BPaletteInfo; /** * Un panel affichant les infos envoyes par TrPanelInfoSender. @@ -31,6 +30,7 @@ super(); m_ = _m; m_.addTreeSelectionListener(this); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-09-10 07:40:16 UTC (rev 3904) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-09-10 18:54:20 UTC (rev 3905) @@ -199,6 +199,7 @@ _table.put(EbliLib.getS("X max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMax())); _table.put(EbliLib.getS("Y min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMin())); _table.put(EbliLib.getS("Y max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMax())); + } final boolean isMarkMaxLine() { 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-09-10 07:40:16 UTC (rev 3904) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-10 18:54:20 UTC (rev 3905) @@ -44,6 +44,10 @@ Window frame_; EGFillePanel panelGraphe_; + public EGFillePanel getPanelGraphe() { + return panelGraphe_; + } + BuPanel conteneurEditor; private EbliNodeDefault nodeLegende = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-13 20:14:47
|
Revision: 3914 http://fudaa.svn.sourceforge.net/fudaa/?rev=3914&view=rev Author: hadouxad Date: 2008-09-13 20:14:57 +0000 (Sat, 13 Sep 2008) Log Message: ----------- COrrection bugs - action configurer: delegue toujours a son widgetBordure. - cas special legende: Copier/couper: lors de la copie/couper de legende, n enregistre rien pour eviter le plantage. Correction bug wizard courbes temporelles - l'action ajouter en cliquant sur la ligene de la cellule vide - action supprimer: qui supprime les points saisis - action modifs: en double cliquant sur les cellules (cf setValueAt) - s'il n'y a pas de graphe dispo, l'option cr?\195?\169e un nouveau graphe doit etre coch?\195?\169e et disable ( l'utilisateur n'a pas le choix...) - Bug bizarre lors de la saisie de certains points pour les courbes temporelles... FONCTION AJOUT COURBE SOURCE OK!! - Fonction clic droit sur courbe du graphe FONCTIONNE! - methode TrPostCourbeTreeModel.duplicateWithChooseSrc() - Il fallait initialiser le tableau des y en recuperant la taille du y de son duplicata - utilsier la methode update - GESTION DE TOUS LEs CAS (tentative) - creation courbe REELLE sur nouveau src depuis courbe REELLE ancien source - creation courbe INTERPOLEE sur nouveau src depuis courbe REELLE ancien source - creation courbe REELLE sur nouveau src depuis courbe INTERPOLEE ancien source - creation courbe INTERPOLEE sur nouveau src depuis courbe INTERPOLEE ancien source Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -68,6 +68,8 @@ private boolean markMinLine_; + + private EGModel model_; private TraceLigneModel tLigneMarqueur_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -141,7 +141,15 @@ */ void duplicateCourbe(CtuluCommandManager _mng, EGCourbe _c); + /** + * Dupliquer la courbe pour les sources choisis + * + * @param _mng + * @param _c + */ + void duplicateCourbeForSrc(CtuluCommandManager _mng, EGCourbe _c); + /** * methode qui permet de dupliquer les models de courbe * @param _duplicator TODO */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -20,6 +20,7 @@ import javax.swing.ComboBoxModel; import javax.swing.DefaultListSelectionModel; import javax.swing.JComboBox; +import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; @@ -497,6 +498,13 @@ } } + + public void duplicateCourbeForSrc(CtuluCommandManager _mng, EGCourbe _c) { + + JOptionPane.showMessageDialog(null, "ne gere pas le multi source "); + duplicateCourbe(_mng,_c); + } + public void enDernier(final EGObject _o) { final int i = element_.indexOf(_o); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -777,7 +777,38 @@ } } } + + public void duplicateCourbeForSrc(final CtuluCommandManager _mng, final EGCourbe _c) { + + + + final EGCourbeChild child = (EGCourbeChild) _c; + final EGGroup g = child.getParentGroup(); + final int i = g.getIndex(child); + if (i >= 0) { + final EGCourbeChild cDuplicate = duplicateWithChooseSrc(child); + if (cDuplicate != null) { + g.addEGComponent(cDuplicate); + // g.addEGComponent(cDuplicate, i + 1); + curvesAdded(cDuplicate, _mng); + } + } + } + + /** + * methode qui demande a l user de choisir sa courbe puis genere une copie + * avec la source en cours. + * + * @param _child + * @return + */ + protected EGCourbeChild duplicateWithChooseSrc(EGCourbeChild _child) { + + return null; + } + + public void enDernier(final EGObject _o) { final List r = getGrapheTreeNode().components_; final int i = r.indexOf(_o); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -22,7 +22,7 @@ * @return true si ce modele peut-etre enleve */ boolean isRemovable(); - + /** * @return true si peut etre dupliqu\xE9. En general, renvoie true. */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -13,18 +13,17 @@ import javax.swing.JTextField; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuSeparator; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluPopupMenu; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.ressource.EbliResource; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuSeparator; + /** * @author Fred Deniger * @version $Id: EGSpecificActions.java,v 1.16 2007-05-04 13:49:41 deniger Exp $ @@ -55,6 +54,10 @@ return "DERNIER"; } + private static String getCopieSrc() { + return "COPIESRC"; + } + private static String getActDown() { return "DESCENDRE"; } @@ -109,7 +112,15 @@ canDescendre, this); menu_.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"), canDescendre, this); + + menu_.addMenuItem(EbliResource.EBLI.getString("Copier la courbe pour un autre jeu de donn\xE9es"), getCopieSrc(), + EbliResource.EBLI.getIcon("crystal_copier"), true, this); + } + + + + menu_.show(_evt.getComponent(), _evt.getX(), _evt.getY()); } @@ -141,7 +152,10 @@ target_.getModel().duplicateCourbe(cmd_, target_.getSelectedComponent()); } } + else if ("COPIESRC".equals(com)) { + target_.getModel().duplicateCourbeForSrc(cmd_, target_.getSelectedComponent()); + } else if ("VISIBLE".equals(com)) { if (n != 1) { return; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -294,8 +294,13 @@ public void actionPerformed(ActionEvent e) { - EbliWidget found = widget_; + EbliWidget found = null;// widget_; + if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordure) + found = (EbliWidget) widget_.getParentWidget(); + else + found = widget_; + BConfigurePalette palette = new BConfigurePalette(false); BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java 2008-09-12 12:48:33 UTC (rev 3913) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java 2008-09-13 20:14:57 UTC (rev 3914) @@ -23,6 +23,7 @@ // le node existe toujours apres l'avoir enleve node.getWidget().getEbliScene().addNode(node); } + if (nodesPasted_.iterator().hasNext()) nodesPasted_.iterator().next().getWidget().getEbliScene().refresh(); } @@ -35,6 +36,7 @@ // le node existe toujours apres l'avoir enleve node.getWidget().getEbliScene().removeNode(node); } + if (nodesPasted_.iterator().hasNext()) nodesPasted_.iterator().next().getWidget().getEbliScene().refresh(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-28 16:55:23
|
Revision: 4105 http://fudaa.svn.sourceforge.net/fudaa/?rev=4105&view=rev Author: hadouxad Date: 2008-10-28 16:55:15 +0000 (Tue, 28 Oct 2008) Log Message: ----------- corrections bugs Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java 2008-10-28 16:48:50 UTC (rev 4104) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/EbliCalqueActionTimeChooser.java 2008-10-28 16:55:15 UTC (rev 4105) @@ -20,7 +20,6 @@ import javax.swing.tree.TreeSelectionModel; import org.fudaa.ctulu.CtuluLib; - import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.commun.BPalettePanelInterface; import org.fudaa.ebli.commun.EbliActionPaletteTreeModel; @@ -105,7 +104,10 @@ } public ListModel getListModel() { + if (target_ instanceof BSelecteurListTimeTarget) return target_ == null ? null : ((BSelecteurListTimeTarget) target_).getTimeListModel(); + else + return null; } public ListSelectionModel getListSelectionModel() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-28 16:48:50 UTC (rev 4104) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-10-28 16:55:15 UTC (rev 4105) @@ -4,7 +4,6 @@ import java.util.Map; import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.calque.BCalqueAffichage; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -14,10 +13,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; -import org.netbeans.api.visual.widget.Widget; -import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException; - /** * Creator pour les legendes des calques * @@ -130,6 +126,9 @@ //g=new BCalqueLegendePanel((BCalqueAffichage) calqueCible_,calqueCible_.getTitle()); BCalqueLegendePanel legendePanel=((CalqueLegendeWidgetAdapter)calque.getCqLegend()).legendePanel_; g=legendePanel; + // -- mise a jour des sattelites --// + ((EbliWidgetControllerCalque) widget.getController()).setNodeLegende((EbliNode) parameters.get("node")); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java 2008-10-28 16:48:50 UTC (rev 4104) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java 2008-10-28 16:55:15 UTC (rev 4105) @@ -5,6 +5,7 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; 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.EbliWidgetBordureSingle; @@ -90,6 +91,11 @@ if (nodeGraphe != null && nodeGraphe.getCreator() instanceof EbliWidgetCreatorGraphe) { // -- on recupere le graphe --// g = ((EbliWidgetCreatorGraphe) nodeGraphe.getCreator()).getGraphe(); + // -- mise a jour des sattelites --// + ((EbliWidgetGraphe) nodeGraphe.getWidget().getIntern()).setNodeLegende((EbliNodeDefault) parameters + .get("node")); + + } else g = new EGGraphe(new EGGrapheTreeModel()); } else g = new EGGraphe(new EGGrapheTreeModel()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-28 16:48:50 UTC (rev 4104) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliWidgetSerializeXml.java 2008-10-28 16:55:15 UTC (rev 4105) @@ -161,7 +161,7 @@ // -- creation du creator specicalis\xE9 --// // EbliWidgetCreator creator= (EbliWidgetCreator) EbliWidgetCreatorShape.class.forName(type).newInstance(); final EbliWidgetCreator creator = EbliWidgetCreatorClassLoader.forName(type); - + parameters.put("node", newNode); // -- creation des datas --// creator.setPersistData(data, parameters); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-12-10 14:27:12
|
Revision: 4289 http://fudaa.svn.sourceforge.net/fudaa/?rev=4289&view=rev Author: hadouxad Date: 2008-12-10 14:27:03 +0000 (Wed, 10 Dec 2008) Log Message: ----------- - Correction de bugs g?\195?\170nants duplication/couper de l?\195?\169gendes. - Correction des g?\195?\169n?\195?\169rations de frames - Correction du filtre propre - Chargement de projet uniquement r?\195?\169pertoires avec filtre POST - Sauvegarde du projet avec .POST (pris en compte qu'on ajoute .POST manuellement ou non) (toutes les m?\195?\169thodes utiles sont dans TrpostFileFilter) - tentative correction bug lignes de courants: visiblement il y a des valeurs qu'il n'aime pas... - Test des valeurs null pour les legendes: update titres.... - Correction test value non null pour la ligne EfGridDataInterpolator.interpolateFromValue 180 - Compatibilit?\195?\169 maximum entre os via la methode TrPostPersistenceManager.updatePathForOs() Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeground.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-12-10 14:26:05 UTC (rev 4288) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-12-10 14:27:03 UTC (rev 4289) @@ -42,406 +42,409 @@ */ public class BPalettePlageLegende extends JPanel implements BPalettePlageListener { - public void setFont(final Font _font) { - super.setFont(_font); - if (pnPlages_ != null) { - internSetFont(pnPlages_, _font); - } - if (pnTitre_ != null) { - internSetFont(pnTitre_, _font); - } - if (reduit_ != null) { - reduit_.setFont(_font); - } - } + public void setFont(final Font _font) { + super.setFont(_font); + if (pnPlages_ != null) { + internSetFont(pnPlages_, _font); + } + if (pnTitre_ != null) { + internSetFont(pnTitre_, _font); + } + if (reduit_ != null) { + reduit_.setFont(_font); + } + } - public void addUserComponent(final JComponent _c) { - if (_c != null) { - pnTitre_.add(_c); - pnTitre_.doLayout(); - } - } + public void addUserComponent(final JComponent _c) { + if (_c != null) { + pnTitre_.add(_c); + pnTitre_.doLayout(); + } + } - public void removeUserComponent(final JComponent _c) { - if (_c != null) { - pnTitre_.remove(_c); - pnTitre_.doLayout(); - } - } + public void removeUserComponent(final JComponent _c) { + if (_c != null) { + pnTitre_.remove(_c); + pnTitre_.doLayout(); + } + } - private void internSetFont(final JComponent _c, final Font _font) { - for (int i = _c.getComponentCount() - 1; i >= 0; i--) { - _c.getComponent(i).setFont(_font); - } - } + private void internSetFont(final JComponent _c, final Font _font) { + for (int i = _c.getComponentCount() - 1; i >= 0; i--) { + _c.getComponent(i).setFont(_font); + } + } - BPalettePlageInterface model_; - public BPalettePlageInterface getModel_() { - return model_; - } + BPalettePlageInterface model_; + public BPalettePlageInterface getModel_() { + return model_; + } - public void setModel_(BPalettePlageInterface model_) { - this.model_ = model_; - } + public void setModel_(BPalettePlageInterface model_) { + this.model_ = model_; + } - // Le symbole par d\xE9faut pour les plages - private final JLabel lbTitre_ = new JLabel(); - private final JPanel pnPlages_ = new JPanel(); - // private JList lbPlages_; - private PlageTableModel listModel_; - private JLabel lbAutres_ = new JLabel(); - BuPanel pnTitre_; - private final JLabel lbSSTitre_ = new JLabel(); - final JList listPlages_; + // Le symbole par d\xE9faut pour les plages + private final JLabel lbTitre_ = new JLabel(); + private final JPanel pnPlages_ = new JPanel(); + // private JList lbPlages_; + private PlageTableModel listModel_; + private JLabel lbAutres_ = new JLabel(); + BuPanel pnTitre_; + private final JLabel lbSSTitre_ = new JLabel(); + final JList listPlages_; - public JList getListPlages_() { - return listPlages_; - } + public JList getListPlages_() { + return listPlages_; + } - /** - * Cr\xE9ation d'une palette vide. - */ - public BPalettePlageLegende() { - setLayout(new BuBorderLayout(0, 0, true, false)); - final Border bdPlages = BorderFactory.createEmptyBorder(5, 5, 5, 5); - pnTitre_ = new BuPanel(); - pnTitre_.setOpaque(false); - pnTitre_.setLayout(new BuVerticalLayout(4, true, true)); - lbTitre_.setHorizontalAlignment(SwingConstants.CENTER); - lbTitre_.setFont(getFont()); - lbTitre_.setAlignmentX((float) 0.5); - final BuGridLayout lyPlages = new BuGridLayout(); - lyPlages.setColumns(1); - lyPlages.setHgap(5); - pnPlages_.setLayout(lyPlages); - pnPlages_.setBorder(bdPlages); - pnPlages_.setOpaque(false); - listPlages_ = new JList(); - listPlages_.setFocusable(false); - listPlages_.setFont(getFont()); - final BPalettePlageLegende.PlageCellRenderer r = new BPalettePlageLegende.PlageCellRenderer(); - r.setOpaque(false); - listPlages_.setCellRenderer(r); - listModel_ = new PlageTableModel(); - listPlages_.setModel(listModel_); - listPlages_.setOpaque(false); - listPlages_.setSelectionModel(new ListSelectionModel() { + /** + * Cr\xE9ation d'une palette vide. + */ + public BPalettePlageLegende() { + setLayout(new BuBorderLayout(0, 0, true, false)); + final Border bdPlages = BorderFactory.createEmptyBorder(5, 5, 5, 5); + pnTitre_ = new BuPanel(); + pnTitre_.setOpaque(false); + pnTitre_.setLayout(new BuVerticalLayout(4, true, true)); + lbTitre_.setHorizontalAlignment(SwingConstants.CENTER); + lbTitre_.setFont(getFont()); + lbTitre_.setAlignmentX((float) 0.5); + final BuGridLayout lyPlages = new BuGridLayout(); + lyPlages.setColumns(1); + lyPlages.setHgap(5); + pnPlages_.setLayout(lyPlages); + pnPlages_.setBorder(bdPlages); + pnPlages_.setOpaque(false); + listPlages_ = new JList(); + listPlages_.setFocusable(false); + listPlages_.setFont(getFont()); + final BPalettePlageLegende.PlageCellRenderer r = new BPalettePlageLegende.PlageCellRenderer(); + r.setOpaque(false); + listPlages_.setCellRenderer(r); + listModel_ = new PlageTableModel(); + listPlages_.setModel(listModel_); + listPlages_.setOpaque(false); + listPlages_.setSelectionModel(new ListSelectionModel() { - public void setValueIsAdjusting(final boolean _valueIsAdjusting) {} + public void setValueIsAdjusting(final boolean _valueIsAdjusting) {} - public void setSelectionMode(final int _selectionMode) {} + public void setSelectionMode(final int _selectionMode) {} - public void setSelectionInterval(final int _index0, final int _index1) {} + public void setSelectionInterval(final int _index0, final int _index1) {} - public void setLeadSelectionIndex(final int _index) {} + public void setLeadSelectionIndex(final int _index) {} - public void setAnchorSelectionIndex(final int _index) {} + public void setAnchorSelectionIndex(final int _index) {} - public void removeSelectionInterval(final int _index0, final int _index1) {} + public void removeSelectionInterval(final int _index0, final int _index1) {} - public void removeListSelectionListener(final ListSelectionListener _x) {} + public void removeListSelectionListener(final ListSelectionListener _x) {} - public void removeIndexInterval(final int _index0, final int _index1) {} + public void removeIndexInterval(final int _index0, final int _index1) {} - public boolean isSelectionEmpty() { - return false; - } + public boolean isSelectionEmpty() { + return false; + } - public boolean isSelectedIndex(final int _index) { - return false; - } + public boolean isSelectedIndex(final int _index) { + return false; + } - public void insertIndexInterval(final int _index, final int _length, final boolean _before) {} + public void insertIndexInterval(final int _index, final int _length, final boolean _before) {} - public boolean getValueIsAdjusting() { - return false; - } + public boolean getValueIsAdjusting() { + return false; + } - public int getSelectionMode() { - return 0; - } + public int getSelectionMode() { + return 0; + } - public int getMinSelectionIndex() { - return 0; - } + public int getMinSelectionIndex() { + return 0; + } - public int getMaxSelectionIndex() { - return 0; - } + public int getMaxSelectionIndex() { + return 0; + } - public int getLeadSelectionIndex() { - return 0; - } + public int getLeadSelectionIndex() { + return 0; + } - public int getAnchorSelectionIndex() { - return 0; - } + public int getAnchorSelectionIndex() { + return 0; + } - public void clearSelection() {} + public void clearSelection() {} - public void addSelectionInterval(final int _index0, final int _index1) {} + public void addSelectionInterval(final int _index0, final int _index1) {} - public void addListSelectionListener(final ListSelectionListener _x) {} + public void addListSelectionListener(final ListSelectionListener _x) {} - }); - pnPlages_.add(listPlages_); - lbSSTitre_.setHorizontalAlignment(SwingConstants.CENTER); - lbSSTitre_.setFont(getFont()); - lbSSTitre_.setAlignmentX((float) 0.5); - this.setOpaque(false); + }); + pnPlages_.add(listPlages_); + lbSSTitre_.setHorizontalAlignment(SwingConstants.CENTER); + lbSSTitre_.setFont(getFont()); + lbSSTitre_.setAlignmentX((float) 0.5); + this.setOpaque(false); - pnTitre_.add(lbTitre_, null); - pnTitre_.add(lbSSTitre_, null); - this.add(pnTitre_, BorderLayout.NORTH); - add(pnPlages_, BorderLayout.CENTER); + pnTitre_.add(lbTitre_, null); + pnTitre_.add(lbSSTitre_, null); + this.add(pnTitre_, BorderLayout.NORTH); + add(pnPlages_, BorderLayout.CENTER); - } - JComponent reduit_; + } + JComponent reduit_; - /** - * Construit la legende et la met a jour. - * - * @param _model le modele - */ - public BPalettePlageLegende(final BPalettePlageAbstract _model) { - this(); - setModel(_model); - } + /** + * Construit la legende et la met a jour. + * + * @param _model le modele + */ + public BPalettePlageLegende(final BPalettePlageAbstract _model) { + this(); + setModel(_model); + } - class PlageTableModel extends AbstractListModel { + class PlageTableModel extends AbstractListModel { - public Object getElementAt(final int _index) { - return model_.getPlageInterface(_index); - } + public Object getElementAt(final int _index) { + return model_.getPlageInterface(_index); + } - public void fireAllRemoved(final int _oldSize) { + public void fireAllRemoved(final int _oldSize) { - if (_oldSize > 0) { - fireIntervalRemoved(this, 0, _oldSize - 1); - } - } + if (_oldSize > 0) { + fireIntervalRemoved(this, 0, _oldSize - 1); + } + } - public void fireAllAdd() { + public void fireAllAdd() { - if (model_ == null) { - fireIntervalAdded(this, 0, 0); - } else { - fireIntervalAdded(this, 0, model_.getNbPlages()); - } - } + if (model_ == null) { + fireIntervalAdded(this, 0, 0); + } else { + fireIntervalAdded(this, 0, model_.getNbPlages()); + } + } - public void fireModified(final int _i) { + public void fireModified(final int _i) { - fireContentsChanged(this, _i, _i); - } + fireContentsChanged(this, _i, _i); + } - public int getSize() { - return model_ == null ? 0 : model_.getNbPlages(); - } - } + public int getSize() { + return model_ == null ? 0 : model_.getNbPlages(); + } + } - /** - * Un cell renderer pour afficher une plage. - * - * @author Fred Deniger - * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger Exp $ - */ - public static class PlageCellRenderer extends JLabel implements ListCellRenderer { + /** + * Un cell renderer pour afficher une plage. + * + * @author Fred Deniger + * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger Exp $ + */ + public static class PlageCellRenderer extends JLabel implements ListCellRenderer { - TraceIcon icone_; + TraceIcon icone_; - public PlageCellRenderer() { - icone_ = new TraceIcon(); - setIcon(icone_); - setOpaque(true); - } + public PlageCellRenderer() { + icone_ = new TraceIcon(); + setIcon(icone_); + setOpaque(true); + } - public Component getListCellRendererComponent(final JList _list, final Object _value, final int _index, - final boolean _isSelected, final boolean _cellHasFocus) { - if (_isSelected) { - super.setForeground(_list.getSelectionForeground()); - super.setBackground(_list.getSelectionBackground()); - } else { - super.setForeground(_list.getForeground()); - super.setBackground(_list.getBackground()); - } - setFont(_list.getFont()); - if (_value instanceof BPlageInterface) { - final BPlageInterface p = (BPlageInterface) _value; - icone_.setCouleur(p.getCouleur()); - icone_.setTaille(p.getIconeTaille()); - icone_.setType(p.getIconeType()); - setText(p.getLegende()); - setToolTipText(p.getLegende()); - } else { - final String val = _value == null ? CtuluLibString.EMPTY_STRING : _value.toString(); - setText(val); - setToolTipText(val); - icone_.setType(TraceIcon.RIEN); - } + public Component getListCellRendererComponent(final JList _list, final Object _value, final int _index, + final boolean _isSelected, final boolean _cellHasFocus) { + if (_isSelected) { + super.setForeground(_list.getSelectionForeground()); + super.setBackground(_list.getSelectionBackground()); + } else { + super.setForeground(_list.getForeground()); + super.setBackground(_list.getBackground()); + } + setFont(_list.getFont()); + if (_value instanceof BPlageInterface) { + final BPlageInterface p = (BPlageInterface) _value; + icone_.setCouleur(p.getCouleur()); + icone_.setTaille(p.getIconeTaille()); + icone_.setType(p.getIconeType()); + setText(p.getLegende()); + setToolTipText(p.getLegende()); + } else { + final String val = _value == null ? CtuluLibString.EMPTY_STRING : _value.toString(); + setText(val); + setToolTipText(val); + icone_.setType(TraceIcon.RIEN); + } - return this; - } - } + return this; + } + } - /** - * @param _model le nouveau modele utilise pour dessiner la legende - */ - public final void setModel(final BPalettePlageInterface _model) { + /** + * @param _model le nouveau modele utilise pour dessiner la legende + */ + public final void setModel(final BPalettePlageInterface _model) { - if (model_ != _model) { - model_ = _model; - if (_model != null) { - _model.setPlageListener(this); - } - if (reduit_ != null) { - pnPlages_.remove(reduit_); - } - pnPlages_.remove(listPlages_); - JComponent cp = listPlages_; - if (model_ != null && (model_.isReduit() || (model_.isReduitEnable() && model_.getNbPlages() > 15))) { - cp = model_.createReduit(); + if (model_ != _model) { + model_ = _model; + if (_model != null) { + _model.setPlageListener(this); + } + if (reduit_ != null) { + pnPlages_.remove(reduit_); + } + pnPlages_.remove(listPlages_); + JComponent cp = listPlages_; + if (model_ != null && (model_.isReduit() || (model_.isReduitEnable() && model_.getNbPlages() > 15))) { + cp = model_.createReduit(); - } - if (cp == null) { - cp = listPlages_; - } else { - cp.setFont(getFont()); - } + } + if (cp == null) { + cp = listPlages_; + } else { + cp.setFont(getFont()); + } - pnPlages_.add(cp, 0); - updateAllLegende(); - } - } + pnPlages_.add(cp, 0); + updateAllLegende(); + } + } - public boolean isReduitEnable() { - return model_ != null && model_.isReduitEnable(); - } + public boolean isReduitEnable() { + return model_ != null && model_.isReduitEnable(); + } - public boolean isReduit() { - return model_ != null && model_.isReduit(); - } + public boolean isReduit() { + return model_ != null && model_.isReduit(); + } - /** - * @return le model utilise - */ - public BPalettePlageInterface getModel() { - return model_; - } + /** + * @return le model utilise + */ + public BPalettePlageInterface getModel() { + return model_; + } - /** - * Redessine enti\xE8rment la legende. Appele lorsque la structure de la palette a ete modifiee - */ - public final void updateAllLegende() { - if (model_ != null) { - updateTitres(); - listModel_.fireAllRemoved(model_.getNbPlages()); - listModel_.fireAllAdd(); - if (model_.isAutresVisible()) { - lbAutres_ = buildLabel(model_.getPlageAutresInterface()); - pnPlages_.add(lbAutres_); - } else { - pnPlages_.remove(lbAutres_); - } - } - revalidate(); - doLayout(); - repaint(); - } + /** + * Redessine enti\xE8rment la legende. Appele lorsque la structure de la palette a ete modifiee + */ + public final void updateAllLegende() { + if (model_ != null) { + updateTitres(); + listModel_.fireAllRemoved(model_.getNbPlages()); + listModel_.fireAllAdd(); + if (model_.isAutresVisible()) { + lbAutres_ = buildLabel(model_.getPlageAutresInterface()); + pnPlages_.add(lbAutres_); + } else { + pnPlages_.remove(lbAutres_); + } + } + revalidate(); + doLayout(); + repaint(); + } - private JLabel buildLabel(final BPlageInterface _p) { - final JLabel r = new JLabel(); - r.setFont(getFont()); - final TraceIcon ic = new TraceIcon(_p.getIconeType(), _p.getIconeTaille()); - ic.setCouleur(_p.getCouleur()); - r.setIcon(ic); - r.setText(_p.getLegende()); - return r; + private JLabel buildLabel(final BPlageInterface _p) { + final JLabel r = new JLabel(); + r.setFont(getFont()); + final TraceIcon ic = new TraceIcon(_p.getIconeType(), _p.getIconeTaille()); + ic.setCouleur(_p.getCouleur()); + r.setIcon(ic); + r.setText(_p.getLegende()); + return r; - } + } - protected final void updateTitres() { + protected final void updateTitres() { + if(model_==null) + return; + if(lbTitre_!=null) + lbTitre_.setText(model_.getTitre()); + if(lbSSTitre_!=null) + lbSSTitre_.setText(model_.getSousTitre()); + } - lbTitre_.setText(model_.getTitre()); - lbSSTitre_.setText(model_.getSousTitre()); - } + protected final void updateLabel(final int _idx) { + listModel_.fireModified(_idx); + } - protected final void updateLabel(final int _idx) { - listModel_.fireModified(_idx); - } + protected final void updateLabelAutre() { + if (lbAutres_ != null) { + updateLabel(lbAutres_, model_.getPlageAutresInterface()); + } + } - protected final void updateLabelAutre() { - if (lbAutres_ != null) { - updateLabel(lbAutres_, model_.getPlageAutresInterface()); - } - } + protected final void updateLabel(final JLabel _lb, final BPlageInterface _p) { + final TraceIcon ic = (TraceIcon) _lb.getIcon(); + ic.setCouleur(_p.getCouleur()); + ic.setTaille(_p.getIconeTaille()); + ic.setType(_p.getIconeType()); + _lb.setText(_p.getLegende()); + _lb.repaint(); + } - protected final void updateLabel(final JLabel _lb, final BPlageInterface _p) { - final TraceIcon ic = (TraceIcon) _lb.getIcon(); - ic.setCouleur(_p.getCouleur()); - ic.setTaille(_p.getIconeTaille()); - ic.setType(_p.getIconeType()); - _lb.setText(_p.getLegende()); - _lb.repaint(); - } + public void allPaletteModified(final BPalettePlageInterface _src) { + if (_src == model_) { + pnPlages_.removeAll(); + reduit_ = null; + if (_src != null && _src.isReduitEnable() && model_.isReduit()) { + reduit_ = model_.createReduit(); + pnPlages_.add(reduit_); + } else { + pnPlages_.add(listPlages_); + } + updateAllLegende(); - public void allPaletteModified(final BPalettePlageInterface _src) { - if (_src == model_) { - pnPlages_.removeAll(); - reduit_ = null; - if (_src != null && _src.isReduitEnable() && model_.isReduit()) { - reduit_ = model_.createReduit(); - pnPlages_.add(reduit_); - } else { - pnPlages_.add(listPlages_); - } - updateAllLegende(); + } + } - } - } + public void plageModified(final BPalettePlageInterface _src, final int _i) { - public void plageModified(final BPalettePlageInterface _src, final int _i) { + if (_src == model_) { + updateLabel(_i); + } + } - if (_src == model_) { - updateLabel(_i); - } - } + public void paletteTitreModified(final BPalettePlageInterface _src) { - public void paletteTitreModified(final BPalettePlageInterface _src) { + if (_src == model_) { + updateTitres(); + } + } - if (_src == model_) { - updateTitres(); - } - } + public boolean isUseReduit() { + return model_ != null && model_.isReduit(); + } - public boolean isUseReduit() { - return model_ != null && model_.isReduit(); - } + public void setUseReduit(final boolean _useReduit) { + if (reduit_ != null) { + pnPlages_.remove(reduit_); + } + pnPlages_.remove(listPlages_); + JComponent cp = null; + reduit_ = null; + if (model_ != null && model_.isReduitEnable()) { + model_.setReduit(_useReduit); + if (_useReduit) { + reduit_ = model_.createReduit(); + reduit_.setFont(getFont()); + cp = reduit_; - public void setUseReduit(final boolean _useReduit) { - if (reduit_ != null) { - pnPlages_.remove(reduit_); - } - pnPlages_.remove(listPlages_); - JComponent cp = null; - reduit_ = null; - if (model_ != null && model_.isReduitEnable()) { - model_.setReduit(_useReduit); - if (_useReduit) { - reduit_ = model_.createReduit(); - reduit_.setFont(getFont()); - cp = reduit_; + } else { + cp = listPlages_; + } + } + if (cp == null) { + cp = listPlages_; + } + pnPlages_.add(cp, 0); + pnPlages_.invalidate(); + allPaletteModified(model_); - } else { - cp = listPlages_; - } - } - if (cp == null) { - cp = listPlages_; - } - pnPlages_.add(cp, 0); - pnPlages_.invalidate(); - allPaletteModified(model_); - - } + } } \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeground.java 2008-12-10 14:26:05 UTC (rev 4288) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeground.java 2008-12-10 14:27:03 UTC (rev 4289) @@ -1,69 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Set; - -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - -/** - * classe qui permet de placer les widgets selectionnes au premier plan. - * - * @author genesis - */ -public class EbliWidgetActionForeground extends EbliWidgetActionSimple { - - CtuluCommandContainer cmd_; - - public EbliWidgetActionForeground(final EbliScene _scene) { - super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), - "FORGROUND"); - - cmd_ = _scene.getCmdMng(); - putValue(NAME, "Premier plan"); - } - - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(final ActionEvent e) { - // -- recuperation de la liste des nodes de la scene --// - final Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); - - // -- liste des widget selectionnees --// - final java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); - - // -- parcours des nodes - for (final Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - - final EbliNode currentNode = it.next(); - if (currentNode != null && currentNode.isMovable()) { - - // -- ajout au premier plan du node --// - // scene_.getVisu().addChild(currentNode.getWidget()); - - currentNode.getWidget().bringToFront(); - - listeWidget.add(currentNode.getWidget()); - - // -- rafraichissement de la scene --// - scene_.refresh(); - - } - - } - - // -- enregistrement de la commande undoRedo --// - if (cmd_ != null) { - cmd_.addCmd(new CommandBringToFront(listeWidget)); - } - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-12-10 14:26:05 UTC (rev 4288) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-12-10 14:27:03 UTC (rev 4289) @@ -134,7 +134,7 @@ // -- on ajoute la legende apres duplication --// - if (widgetGraphe_.getNodeLegende() != null) { + if (((EbliWidgetControllerGraphe)widgetGraphe_.getController()).hasLegende()) { controllerDuDuplique.ajoutLegende(); listeNodeUndo.add(widgetGrapheDuplic.getNodeLegende()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-12-11 09:14:49
|
Revision: 4294 http://fudaa.svn.sourceforge.net/fudaa/?rev=4294&view=rev Author: hadouxad Date: 2008-12-11 09:14:38 +0000 (Thu, 11 Dec 2008) Log Message: ----------- r?\195?\169solution bug 8b Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-12-10 23:38:37 UTC (rev 4293) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-12-11 09:14:38 UTC (rev 4294) @@ -7,6 +7,8 @@ */ package org.fudaa.ebli.controle; +import java.awt.Dimension; + import javax.swing.JComponent; import javax.swing.ListModel; import javax.swing.ListSelectionModel; @@ -81,19 +83,32 @@ public boolean isUpdatingFromSrc_; public BSelecteurListComboBox() { - setLayout(new BuBorderLayout()); - cb_ = new BuComboBox(); - adapter_ = new CtuluComboBoxModelAdapter(CtuluListModelEmpty.EMPTY); - cb_.setModel(adapter_); - cbListener_ = new CbDataListener(); - listSelectionListener_ = new TargetSelectionListener(); - adapter_.addListDataListener(cbListener_); - cb_.setEnabled(false); - add(cb_, BuBorderLayout.CENTER); + this(null); } + + public BSelecteurListComboBox(Dimension sizeCombo) { + setLayout(new BuBorderLayout()); + cb_ = new BuComboBox(); + adapter_ = new CtuluComboBoxModelAdapter(CtuluListModelEmpty.EMPTY); + cb_.setModel(adapter_); + cbListener_ = new CbDataListener(); + listSelectionListener_ = new TargetSelectionListener(); + adapter_.addListDataListener(cbListener_); + cb_.setEnabled(false); + + if(sizeCombo!=null){ + cb_.setMinimumSize(sizeCombo); + cb_.setMaximumSize(sizeCombo); + cb_.setSize(sizeCombo); + } + add(cb_, BuBorderLayout.CENTER); + + } + + boolean isTargetUpdatable() { return target_ != null && target_.getListSelectionModel() != null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-12-10 23:38:37 UTC (rev 4293) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-12-11 09:14:38 UTC (rev 4294) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -508,13 +509,19 @@ comboVar_ = new BSelecteurListComboBox(); // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change majComboVar(); - // combo.setPalettePanelTarget(listselector.getTarget()); - comboVar_.setMinimumSize(comboVar_.getPreferredSize()); - comboVar_.setMaximumSize(comboVar_.getPreferredSize()); // ajout combobox toolbarCalque_.add(comboVar_); - + + comboVar_.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + + comboVar_.revalidate(); + toolbarCalque_.revalidate(); + // -- ajout des combo des pas de temps --// final EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(getVisuPanel().getArbreCalqueModel() .getTreeSelectionModel(), true); @@ -522,12 +529,16 @@ chooserT.setSelected(true); final BSelecteurListComboBox combo = (BSelecteurListComboBox) chooserT.buildContentPane(); chooserT.updateBeforeShow(); - combo.setMaximumSize(combo.getPreferredSize()); - combo.setMinimumSize(combo.getPreferredSize()); - + // ajout combobox toolbarCalque_.add(combo); - + combo.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.getCb().setSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.getCb().setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.revalidate(); + toolbarCalque_.revalidate(); } // -- mise a jour de la combo de variables pour le cas ou l on ajoute des // var dans editer les var This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-13 19:15:37
|
Revision: 4348 http://fudaa.svn.sourceforge.net/fudaa/?rev=4348&view=rev Author: hadouxad Date: 2009-01-13 19:15:33 +0000 (Tue, 13 Jan 2009) Log Message: ----------- fleches + persistance des donnees des courbes Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorArrowEditor.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-01-13 19:15:33 UTC (rev 4348) @@ -0,0 +1,528 @@ +package org.fudaa.ebli.commun; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.image.BufferedImage; +import java.awt.image.ImageProducer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JToolBar; + +import org.fudaa.ctulu.image.CtuluImageProducer; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; + + + +import com.memoire.bu.BuPanel; + + +/** + * Editeur de fleche. + * Gere 4 points (2 pour le segment) et 2 pour les extr\xE9mit\xE9s + * Gere 2 type: plein ou vide + * + * Permet \xE0 l'utilisateur de modifier sa fleche en cliquant dessus + * + * @author Adrien Hadoux + * + */ +public class EbliEditorArrow extends BuPanel implements CtuluImageProducer, MouseListener, MouseMotionListener { + + public final static int ExtremiteTete=0; + public final static int ExtremiteQueue=1; + public final static int ExtremiteGauche=2; + public final static int ExtremiteDroite=3; + + + public EbliEditorArrow(){ + this(new Point[ExtremiteDroite+1]); + //-- on initialise --// + + creationFlecheClassique(); + repaint(); + } + + /** + * Constructeur appel\xE9 pour une cr\xE9ation de base. + * @param points + */ + public EbliEditorArrow(Point[] points){ + points_=points; + setSize(200, 150); + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); + repaint(); + } + + + private Point[] points_; + + + + + /** + * Model traceligne appel\xE9 a chaque edition de la fleche pour mettre a jour le trac\xE9. + */ + public TraceLigneModel model_; + public Color background_=Color.white; + public Color foreground_=Color.black; + + public Point getExtremiteTete(){ + return points_[ExtremiteTete]; + } + + public Point getExtremiteQueue(){ + return points_[ExtremiteQueue]; + } + + + public Point getExtremiteGauche(){ + return points_[ExtremiteGauche]; + } + + public Point getExtremiteDroite(){ + return points_[ExtremiteDroite]; + } + + public Point[] getPoints_() { + return points_; + } + + public void setPoints_(Point[] points_) { + this.points_ = points_; + } + + public void modifieExtremite(Point newPoint, int position){ + if(position>ExtremiteDroite || points_==null)return; + points_[position]=newPoint; + repaint(); + } + + public void clearArrow(){ + points_=new Point[ExtremiteDroite+1]; + repaint(); + } + + + + int previousWidth_=0; + int previousHeight_=0; + + + public void recalculatePosition(int w,int h){ + if(points_==null)return; + if(previousWidth_==0)previousWidth_=getWidth(); + if(previousHeight_==0)previousHeight_=getHeight(); + if(previousWidth_==0)return; + if(previousHeight_==0)return; + + double ratioW=1.0*w/previousWidth_; + double ratioH=1.0*h/previousHeight_; + + + for(int i=0;i<points_.length;i++){ + if(points_[i]!=null){ + points_[i].x=(int)(points_[i].x*ratioW); + points_[i].y=(int)(points_[i].y*ratioH); + } + } + previousWidth_=w; + previousHeight_=h; + } + + /** + * Methode qui dessine la fleche. + */ + public void print(Graphics _g,int w,int h) { + + + //recalculatePosition(w,h); + + final BufferedImage image = CtuluLibImage.createImage(w, h, new HashMap()); + final Graphics2D g2d = image.createGraphics(); + image.flush(); + + + + + if(points_==null)return; + + if(existeAucunPoint()){ + g2d.setColor(Color.black); + g2d.drawString("Veuillez cliquer sur les 4 points pour cr\xE9er la fl\xE8che", 10, 10); + g2d.drawString("Modifier: faire des glisser-d\xE9pos\xE9 pr\xE8s des extr\xE9mit\xE9s", 10, 20); + + } + + // -- creation du traceligne --// + final TraceLigne traceligne = new TraceLigne(model_); + traceligne.setCouleur(foreground_); + + //-- on trace le segment initial --// + if(getExtremiteTete()!=null && getExtremiteQueue()!=null){ + traceligne.dessineTrait(g2d, getExtremiteTete().x, getExtremiteTete().y, getExtremiteQueue().x,getExtremiteQueue().y); + }else{ + // pas de segment complet, on trace juste les points existants + if(getExtremiteTete()!=null) + traceligne.dessineRectangle(g2d,getExtremiteTete().x-traceligne.getEpaisseur()/2,getExtremiteTete().y-traceligne.getEpaisseur()/2,traceligne.getEpaisseur(), traceligne.getEpaisseur()); + if(getExtremiteQueue()!=null) + traceligne.dessineRectangle(g2d,getExtremiteQueue().x-traceligne.getEpaisseur()/2,getExtremiteQueue().y-traceligne.getEpaisseur()/2,traceligne.getEpaisseur(), traceligne.getEpaisseur()); + + } + //-- on trace le segment tete/gauche --// + if(getExtremiteTete()!=null && getExtremiteGauche()!=null){ + traceligne.dessineTrait(g2d, getExtremiteTete().x, getExtremiteTete().y, getExtremiteGauche().x,getExtremiteGauche().y); + }else{ + // pas de segment complet, on trace juste les points existants + if(getExtremiteGauche()!=null) + traceligne.dessineRectangle(g2d,getExtremiteGauche().x-traceligne.getEpaisseur()/2,getExtremiteGauche().y-traceligne.getEpaisseur()/2,traceligne.getEpaisseur(), traceligne.getEpaisseur()); + + } + //-- on trace le segment tete/droite --// + if(getExtremiteTete()!=null && getExtremiteDroite()!=null){ + traceligne.dessineTrait(g2d, getExtremiteTete().x, getExtremiteTete().y, getExtremiteDroite().x,getExtremiteDroite().y); + }else{ + // pas de segment complet, on trace juste les points existants + if(getExtremiteDroite()!=null) + traceligne.dessineRectangle(g2d,getExtremiteDroite().x-traceligne.getEpaisseur()/2,getExtremiteDroite().y-traceligne.getEpaisseur()/2,traceligne.getEpaisseur(), traceligne.getEpaisseur()); + + } + + //-- on dessine l'image --// + _g.drawImage(image, 0,0, null); + + } + + @Override + public void paintComponent(Graphics _g) { + + //-- empecher de voir d'autres dessins par dessus --// + _g.setColor(background_); + _g.fillRect(0, 0, getWidth(), getHeight()); + _g.setColor(foreground_); + print(_g,getWidth(),getHeight() ); + + //-- on affiche les marqueurs drag and drop --// + if(marqueurDeplacement_ && positionPointToMove_!=-1){ + _g.setColor(Color.RED); + //-- position initiale --// + _g.fillRect(points_[positionPointToMove_].x-3,points_[positionPointToMove_].y-3,6,6); + + //-- position deplacement --// + if(positionDeplacement_!=null){ + _g.setColor(Color.GREEN); + + _g.fillRect(positionDeplacement_.x-3,positionDeplacement_.y-3,6,6); + } + + + } + + } + + public BufferedImage produceImage(final int _w, final int _h, final Map _params) { + + recalculatePosition(_w,_h); + + final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); + final Graphics2D g2d = i.createGraphics(); + CtuluLibImage.setBestQuality(g2d); + if (CtuluLibImage.mustFillBackground(_params)) { + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, _w, _h); + } + + if (getWidth() != _w || getHeight() != _h) { + + // this.setPreferredSize(new Dimension(_w, _h)); + + g2d.scale(CtuluLibImage.getRatio(_w, getWidth()), CtuluLibImage.getRatio(_h, getHeight())); + setSize(_w, _h); + } + + print(g2d,_w,_h); + g2d.dispose(); + i.flush(); + return i; + } + + @Override + public Dimension getDefaultImageDimension() { + // TODO Auto-generated method stub + return getSize(); + } + + @Override + public BufferedImage produceImage(Map _params) { + final BufferedImage i = CtuluLibImage.createImage(getWidth(), getHeight(), _params); + final Graphics2D g2d = i.createGraphics(); + CtuluLibImage.setBestQuality(g2d); + if (CtuluLibImage.mustFillBackground(_params)) { + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, getWidth(), getHeight()); + } + + + print(g2d); + g2d.dispose(); + i.flush(); + return i; + } + + /** + * Methode qui est appel\xE9e apr\xE8s un clic et qui d\xE9termine le point manquant \xE0 ajouter: + * @param p + */ + public void determinePointAajouter(Point p){ + if(p==null)return; + + if(getExtremiteTete()==null) + modifieExtremite(p, ExtremiteTete); + else + if(getExtremiteQueue()==null) + modifieExtremite(p, ExtremiteQueue); + else + if(getExtremiteGauche()==null) + modifieExtremite(p, ExtremiteGauche); + else + if(getExtremiteDroite()==null) + modifieExtremite(p, ExtremiteDroite); + else return; + } + + + /** + * Retourne true si le point est a ajouter ou false si il s'agit d'un d\xE9placement + * @return + */ + public boolean ajout(){ + if(getExtremiteTete()==null) + return true; + if(getExtremiteQueue()==null) + return true; + if(getExtremiteDroite()==null) + return true; + if(getExtremiteGauche()==null) + return true; + return false; + } + + public boolean existeAucunPoint(){ + if(getExtremiteTete()!=null) + return false; + if(getExtremiteQueue()!=null) + return false; + if(getExtremiteDroite()!=null) + return false; + if(getExtremiteGauche()!=null) + return false; + return true; + } + + /** + * Methode qui determine le point a modifier de la fleche, c'est a dire le point qui se trouve le plus proche du clic utilisateur au point p. + * @param p + * @return + */ + public int determinePointAmodifier(Point p){ + + double distanceMin=p.distance(getExtremiteTete()); + int position=ExtremiteTete; + + if(distanceMin>p.distance(getExtremiteQueue())){ + distanceMin=p.distance(getExtremiteQueue()); + position=ExtremiteQueue; + } + + if(distanceMin>p.distance(getExtremiteDroite())){ + distanceMin=p.distance(getExtremiteDroite()); + position=ExtremiteDroite; + } + + if(distanceMin>p.distance(getExtremiteGauche())){ + distanceMin=p.distance(getExtremiteGauche()); + position=ExtremiteGauche; + } + + return position; + } + + + public void mouseClicked(MouseEvent e) { + + if(ajout()) + determinePointAajouter(new Point(e.getX(),e.getY())); + else{ + + //-- mode modification du point --// + // modifieExtremite(new Point(e.getX(),e.getY()), determinePointAmodifier(new Point(e.getX(),e.getY()))); + //RIEN FAIRE + } + repaint(); + } + + @Override + public void mouseEntered(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent e) { + // TODO Auto-generated method stub + + } + /** + * lors d'un drag and drop, on retient la position du point qu'on veut deplacer + * et lors du relachement souris ou remplace les infos + */ + int positionPointToMove_=-1; + + /** + * marqueur qui s'active dans le cas du drag and drop et qui marque le point initial ainsi que le point destination jusqu'au lacher. + */ + boolean marqueurDeplacement_=false; + @Override + public void mousePressed(MouseEvent e) { + // TODO Auto-generated method stub + if(!ajout()){ + positionPointToMove_=determinePointAmodifier(new Point(e.getX(),e.getY())); + marqueurDeplacement_=true; + System.out.println("Souris pressed: positionToMove:"+positionPointToMove_); + repaint(); + } + else + positionPointToMove_=-1; + + + } + + @Override + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + if(!ajout() && positionPointToMove_!=-1){ + modifieExtremite(new Point(e.getX(),e.getY()), positionPointToMove_); + positionPointToMove_=-1; + System.out.println("Souris released: positionToMove:"+positionPointToMove_); + marqueurDeplacement_=false; + positionDeplacement_=null; + repaint(); + } + } + + Point positionDeplacement_=null; + @Override + public void mouseDragged(MouseEvent e) { + //System.out.println("Souris dragged: "+positionPointToMove_); + if(marqueurDeplacement_){ + positionDeplacement_=new Point(e.getX(),e.getY()); + repaint(); + } + } + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + System.out.println("Souris MOVED: "+positionPointToMove_); + } + + + public EbliEditorArrow duplicate(){ + EbliEditorArrow duplic=new EbliEditorArrow(points_.clone()); + duplic.model_=new TraceLigneModel(model_); + return duplic; + } + + + public void creationFlecheClassique(){ + clearArrow(); + if(model_==null) + model_=new TraceLigneModel(); + modifieExtremite(new Point((int)(getWidth()-model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteTete); + modifieExtremite(new Point((int)(0+model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteQueue); + modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(model_.getEpaisseur())), ExtremiteDroite); + modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(getHeight()-model_.getEpaisseur())), ExtremiteGauche); + repaint(); + } + + public void creationDoubleFlecheClassique(){ + clearArrow(); + if(model_==null) + model_=new TraceLigneModel(); + modifieExtremite(new Point((int)(getWidth()-model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteTete); + modifieExtremite(new Point((int)(0+model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteQueue); + modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(model_.getEpaisseur())), ExtremiteDroite); + modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(getHeight()-model_.getEpaisseur())), ExtremiteGauche); + repaint(); + } + + JToolBar toolbar_; + JMenuBar menuBar_; + public JToolBar getToolBar( ) { + if(toolbar_==null){ + toolbar_=new JToolBar(); + for(EbliActionSimple action:getActions()) + toolbar_.add(action); + } + return toolbar_; + } + + public JMenuBar getMenuBar( ) { + if(menuBar_==null){ + menuBar_=new JMenuBar(); + JMenu principal=new JMenu("Menu"); + for(EbliActionSimple action:getActions()) + principal.add(action); + menuBar_.add(principal); + } + return menuBar_; + } + + + List<EbliActionSimple> getActions(){ + List<EbliActionSimple> liste=new ArrayList<EbliActionSimple>(); + + EbliActionSimple action=new EbliActionSimple(EbliResource.EBLI.getString("Initialiser"),EbliResource.EBLI + .getIcon("restore"),"Restaurer"){ + public void actionPerformed(final ActionEvent _evt) { + clearArrow(); + } + }; + liste.add(action); + action=new EbliActionSimple(EbliResource.EBLI.getString("Fl\xE8che"),EbliResource.EBLI.getToolIcon("crystal_bu_link"),"Fl\xE8che"){ + public void actionPerformed(final ActionEvent _evt) { + creationFlecheClassique(); + } + }; + liste.add(action); +// action=new EbliActionSimple(EbliResource.EBLI.getString("Double Fl\xE8che"),EbliResource.EBLI.getToolIcon("crystal_bu_scrollpane_corner"),"Double Fl\xE8che"){ +// public void actionPerformed(final ActionEvent _evt) { +// creationDoubleFlecheClassique(); +// } +// }; +// liste.add(action); + return liste; + } + + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-01-13 19:15:33 UTC (rev 4348) @@ -0,0 +1,125 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.commun.EbliEditorArrow; +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.widget.Widget; + +import com.memoire.fu.FuLog; + + + +/** + * Classe editeur de Fleche + * @author Adrien Hadoux + * + */ +public class EbliWidgetArrowEditor extends EbliWidget implements InplaceEditorProvider<EbliEditorArrow>{ + + public EbliEditorArrow editor_; + BufferedImage imageFleche; + + + public EbliWidgetArrowEditor(EbliScene scene,EbliEditorArrow editor) { + super(scene, false); + // TODO Auto-generated constructor stub + editor_=editor; + editor_.model_=getTraceLigneModel(); + editor_.foreground_=getColorContour(); + // -- creation de l action pour editor --// + //final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au widget correspondant --// + // this.getActions().addAction(editorAction); + + final EbliWidgetControllerFlecheEditor controller = new EbliWidgetControllerFlecheEditor(this); + controller.setEditable(true); + setController(controller); + + } + + + protected void paintWidget() { + final Rectangle rec = getClientArea(); + final Graphics2D g = getGraphics(); + // g.translate(rec.x, rec.y); + if (rec.width > 0 && rec.height > 0) { + + + // mode edition + //if (imageFleche == null || imageFleche.getWidth() != (rec.width-1) || imageFleche.getHeight() != (rec.height-1)) { + FuLog.debug("EWI: recreate image"); + final Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + editor_.model_=getTraceLigneModel(); + editor_.foreground_=getColorContour(); + imageFleche = editor_.produceImage(rec.width - 1, rec.height - 1, params); + + //} + g.drawImage(imageFleche, rec.x, rec.y, rec.width - 1, rec.height - 1, null); + } + } + + + @Override + public EbliEditorArrow createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget) { + //-- on met a jour le traceligne model --// + editor_.model_=getTraceLigneModel(); + editor_.foreground_=getColorContour(); + final Rectangle rec = getClientArea(); + editor_.setSize(new Dimension(rec.width,rec.height)); + editor_.setPreferredSize(new Dimension(rec.width,rec.height)); + + return editor_; + } + + @Override + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, EbliEditorArrow editor) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, EbliEditorArrow editor, Rectangle viewBounds) { + // TODO Auto-generated method stub + final Rectangle rec = convertLocalToScene(getClientArea()); + rec.width -= 1; + rec.height -= 1; + return rec; + } + + @Override + public void notifyClosing( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, EbliEditorArrow editor, boolean commit) { + // TODO Auto-generated method stub + imageFleche =null; + repaint(); + editingStop(); + } + + @Override + public void notifyOpened( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, EbliEditorArrow editor) { + // TODO Auto-generated method stub + editingStart(); + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java 2009-01-13 19:15:33 UTC (rev 4348) @@ -0,0 +1,92 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.JToolBar; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +import org.fudaa.ebli.commun.EbliEditorArrow; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; +import org.netbeans.api.visual.action.InplaceEditorProvider; + +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuPanel; + +/** + * Controller de l'editeur de fleches. + * @author Adrien Hadoux + * + */ +public class EbliWidgetControllerFlecheEditor extends EbliWidgetController { + + EbliActionEditorOneClick<EbliEditorArrow> editorAction_; + EbliEditorArrow editor_; + + public EbliWidgetControllerFlecheEditor(EbliWidgetArrowEditor _widget) { + super(_widget); + editor_ = _widget.editor_; + addActionSpecifiques(); + + } + + + public void MenuEditer() { + // -- executer l action d edition --// + editorAction_.openEditor(getWidget()); + + } + + public void addActionSpecifiques() { + + editorAction_ = new EbliActionEditorOneClick<EbliEditorArrow>((InplaceEditorProvider) widget_); + // -- ajout de l action au widget correspondant --// + widget_.getActions().addAction(editorAction_); + + } + + @Override + protected void buildPopupMenu(final JPopupMenu _menu) { + constructPopupMenuSpecifique(_menu); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(_menu); + } + + + private void constructPopupMenuSpecifique(final JPopupMenu _popup) { + JMenuItem menuItem = new JMenuItem(EbliResource.EBLI.getString("Editer la fl\xE8che")); + _popup.add(menuItem, 0); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_editer")); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent e) { + MenuEditer(); + } + }); + } + + + public JToolBar getToolbarComponent() { + if (editor_ != null) + return editor_.getToolBar(); + else + return new JToolBar(); + } + + JMenuBar menuBar_; + + public JMenuBar getMenubarComponent() { + if (editor_ == null) + return new BuMenuBar(); + + if (menuBar_ == null) + menuBar_ = editor_.getMenuBar(); + return menuBar_; + + } + + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorArrowEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorArrowEditor.java 2009-01-13 19:15:33 UTC (rev 4348) @@ -0,0 +1,81 @@ +package org.fudaa.ebli.visuallibrary.creator; + +import java.awt.Point; +import java.util.Map; + +import org.fudaa.ebli.commun.EbliEditorArrow; +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.EbliWidgetArrowEditor; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; + +import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; + +public class EbliWidgetCreatorArrowEditor implements EbliWidgetCreator { + + EbliWidgetArrowEditor res; + //EbliWidgetWithBordure res; + /** + * Le type de l objet a creer. + */ + EbliEditorArrow editor_; + + + + + + public EbliWidgetCreatorArrowEditor(final EbliEditorArrow _typeObject) { + super(); + + editor_ = _typeObject; + } + + public EbliWidgetCreatorArrowEditor() { + + } + + public EbliWidget create(final EbliScene _scene) { + // res = new EbliWidgetBordureSingle(new EbliWidgetArrowEditor(_scene, editor_)); + res=new EbliWidgetArrowEditor(_scene, editor_); + return res; + } + + public EbliWidget getWidget() { + return res; + } + + public EbliNode duplicate(final EbliNode _nodeAdupliquer) { + + final EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorArrowEditor(editor_.duplicate())); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + final Point nouvellePosition = new Point(getWidget().getLocation().x, (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + public EbliWidgetWithBordure getBordure() { + return null; + } + + public Object getPersistData(final Map parameters) { + return editor_.getPoints_(); + } + + public void setPersistData(final Object data, final Map parameters) { + if (data == null) editor_ = new EbliEditorArrow(); + else { + editor_ = new EbliEditorArrow((Point[])data); + } + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-15 17:49:40
|
Revision: 4358 http://fudaa.svn.sourceforge.net/fudaa/?rev=4358&view=rev Author: hadouxad Date: 2009-01-15 17:49:33 +0000 (Thu, 15 Jan 2009) Log Message: ----------- corrections bug + persistance donn?\195?\169es enregistr?\195?\169es Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.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/graphe/EbliWidgetControllerGraphe.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -1,7 +1,12 @@ package org.fudaa.ebli.courbe; +import java.util.Map; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ebli.trace.TraceBox; import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; /** * Classe persistante de la courbe @@ -27,6 +32,11 @@ TraceLigneModel lineModel_; TraceLigneModel tLigneMarqueur_; + //-- data specifiques --// + Object dataSpecifiques; + String classeModel; + + public EGCourbePersist(EGCourbeChild courbe, int IdGroup) { fillInfoWith(courbe,IdGroup); } @@ -55,17 +65,67 @@ tLigneMarqueur_=courbe.getMarkLigneModel(); + //-- donnees specifiques --// + + //-- exemple pour evol: pdt, point,variable, fichier source --// + dataSpecifiques=courbe.getModel().getPersistSpecificDatas(); + classeModel=courbe.getModel().getClass().toString(); } + public static EGModel forName(String className) { + + try{ + + if (className.startsWith("class ")) ; + className = className.substring("class ".length()); + final Class myclass = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); + final Object myModel = myclass.newInstance(); + + if (myModel instanceof EGModel) return (EGModel) myModel; + else return null; + }catch(Exception e){ + return null; + } +} + /** * Generate the proper curve in the appropriate group. * @param groupe * @return */ -public EGCourbeChild generateCourbe(EGGroup groupe){ - EGModel model=new EGCourbeModelDefault(abscisses,ordonnees); - EGCourbeChild courbe=new EGCourbeChild(groupe,model); +public EGCourbeChild generateCourbe(EGGroup groupe,Map infos){ + //EGModel model=new EGCourbeModelDefault(abscisses,ordonnees); + EGModel model=null; + if(classeModel!=null) + model=forName(classeModel); + + if(model==null) + model=new EGCourbeModelDefault(abscisses,ordonnees); + + //-- ajotu des coordonnees --// + model.addValue(abscisses, ordonnees, new CtuluCommandManager()); + + + + + //-- donnees specifiques --// + infos.put("GROUPE", groupe); + + model.setPersistSpecificDatas(dataSpecifiques, infos); + + EGCourbeChild courbe=null; + + //-- Verifie dans le cas de rejoue des donnees, il faut peut etre ne pas ajouter la courbe --// +// if(infos.get("MODELREPLAY")!=null && infos.get("MODELREPLAY") instanceof EGCourbeChild){ +// +// //-- on remplace le model par le model rejouee et deja ajout\xE9--// +// courbe=(EGCourbeChild) infos.get("MODELREPLAY"); +// infos.remove("MODELREPLAY"); +// }else{ + + courbe=new EGCourbeChild(groupe,model); +// } courbe.setTitle(title_); //graphiques @@ -77,6 +137,7 @@ courbe.setLigneMark(tLigneMarqueur_); courbe.setNuagePoints_(this.nuagePoints); + return courbe; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -278,7 +278,7 @@ List<EGCourbePersist> listeCourbesPersistantes = getPersitantCurvesList(false); for(EGCourbePersist cbPersist:listeCourbesPersistantes){ EGGroup container=model.getGroup(cbPersist.Idgroup); - EGCourbeChild newCurve=cbPersist.generateCourbe(container); + EGCourbeChild newCurve=cbPersist.generateCourbe(container,parameters); container.addEGComponent(newCurve); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -198,6 +198,6 @@ void setPersistSpecificDatas(Object data, Map infos); - //String getUnite(); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteInfo.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -30,6 +30,7 @@ _p.getModel().addModelListener(this); _p.getModel().addSelectionListener(this); p_=_p; + } @@ -59,6 +60,9 @@ updateState(); } + + + public void updateState(){ if (!isAvailable()) { return; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -110,7 +110,7 @@ } } - boolean isAvailable_; + protected boolean isAvailable_; protected Component parent_; protected JTable table_; 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 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -35,6 +35,9 @@ */ public class EbliWidget extends Widget implements BSelecteurTargetInterface, EbliWidgetInterface<EbliWidgetController> { + + public final static boolean AMELIO_LOT_VISIBLE=true; + public final static String COLORCONTOUR = "ColorContour"; public final static String COLORFOND = "colorFond"; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-15 17:48:55 UTC (rev 4357) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-15 17:49:33 UTC (rev 4358) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.graphe; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; @@ -14,6 +15,7 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; @@ -31,6 +33,7 @@ import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; +import org.fudaa.ebli.courbe.EGPaletteInfo; import org.fudaa.ebli.courbe.EGSpecificActions; import org.fudaa.ebli.courbe.EGTableGraphePanel; import org.fudaa.ebli.courbe.EGTree; @@ -496,9 +499,27 @@ final JScrollPane compTop = new JScrollPane(tree); compTop.setPreferredSize(new Dimension(150, 400)); pane.setTopComponent(compTop); + + //-- panel global qui contient la paletet d'infos + tableau de valeurs --// + if(EbliWidget.AMELIO_LOT_VISIBLE){ + final JSplitPane panelBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + EGPaletteInfo paletteInfos=new EGPaletteInfo( getGraphePanel()); + paletteInfos.setAvailable(true); + // final JScrollPane paletteInfos = new JScrollPane(paEg); + paletteInfos.setPreferredSize(new Dimension(150, 80)); + panelBottom.setTopComponent(paletteInfos); + final JScrollPane comp = new JScrollPane(tablePanel); comp.setPreferredSize(new Dimension(150, 200)); - pane.setBottomComponent(comp); + + panelBottom.setBottomComponent(comp); + pane.setBottomComponent(panelBottom); + }else{ + final JScrollPane comp = new JScrollPane(tablePanel); + comp.setPreferredSize(new Dimension(150, 200)); + pane.setBottomComponent(comp); + } + pane.setDividerLocation(0.5D); pane.resetToPreferredSizes(); getGraphePanel().majSelectionListener(tablePanel); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-28 19:17:31
|
Revision: 4422 http://fudaa.svn.sourceforge.net/fudaa/?rev=4422&view=rev Author: hadouxad Date: 2009-01-28 19:17:26 +0000 (Wed, 28 Jan 2009) Log Message: ----------- lot 3 EDF POST - Legendes graphes: edition blind?\195?\169e - Correction du bug de d?\195?\169centrage des mode ?\195?\169dition!! - suite de calcul modifi?\195?\169e Modified Paths: -------------- 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/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -0,0 +1,430 @@ +package org.fudaa.ebli.courbe; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JColorChooser; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListCellRenderer; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ListDataListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import jxl.Image; + +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluNumberFormatDefault; +import org.fudaa.ctulu.CtuluNumberFormatI; +import org.fudaa.ctulu.CtuluRange; +import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluPopupMenu; +import org.fudaa.ebli.calque.CalqueGISTreeModel.CellRenderer; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.palette.BPalettePlageLegende; +import org.fudaa.ebli.palette.BPalettePlageTarget; +import org.fudaa.ebli.palette.BPlageAbstract; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.BPlageInterface; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuButtonLayout; +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuEmptyList; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuMenuItem; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuToolButton; +import com.memoire.bu.BuVerticalLayout; + + +/** + * Palette de l\xE9gende des graphes. + * Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * @author Adrien Hadoux + * + */ +public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener,ListSelectionListener,BuBorders{ + + /** + * Graphe associ\xE9 a la palette + */ + EGGraphe graphe_; + + //Map<BuTextField,EGCourbe > mapTitles_; + + /** + * Bouton qui applique les changements + */ + JButton btApply_; + + BuToolButton btAssombrir_; + + JButton btColor_; + + BuToolButton btEcl_; + + BuButton btFormat_; + + JButton btRefresh_; + + BuCheckBox cbChangedLeg_; + + CtuluRange dataBoite_; + + TraceIcon ic_; + + boolean isAdjusting_; + + BuMenuItem itemRemove_; + + BuMenuItem itemSplit_; + + JLabel lbGrapheTitle_; + + + /** + * Format des nombres des l\xE9gendes + */ + CtuluNumberFormatI format_ =CtuluNumberFormatDefault.DEFAULT_FMT; + + /** + * S\xE9parateur entre les formats + */ + String separatorFormat_="-"; + + /** + * La liste des cournes + */ + JList list_; + + CtuluPopupMenu menu_; + + + /** + * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. + */ + JPanel panelData_; + + BPlageAbstract plageEnCours_; + + List plages_; + + /** + * LE scroll de la liste des courbe + */ + BuScrollPane sp_; + + BPalettePlageTarget target_; + + JTextField tfPlageLeg_; + /** + * Textfield du contenu du titre de la courbe + */ + JTextField tfTitleCourbeTop_; + + + //BuTextField txtTitleCourbe_=new BuTextField(10); + + + + + + private class PlageTableModel implements ListModel{ + EGCourbe[] liste_; + public PlageTableModel(EGCourbe[] list){ + super(); + liste_=list; + } + + public void addListDataListener(ListDataListener l) { + } + + public Object getElementAt(int index) { + return liste_[index]; + } + + public int getSize() { + return liste_.length; + } + + public void removeListDataListener(ListDataListener l) { + } + } + + /** + * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 + * @author Adrien Hadoux + * + */ + private class LegendeRenderer implements ListCellRenderer{ + + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + public LegendeRenderer(){ + + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + EGCourbe cb=(EGCourbe) value; + JLabel resultat=new JLabel(); + + BufferedImage image=new BufferedImage(20,20,BufferedImage.TYPE_INT_RGB); + Graphics2D g = image.createGraphics(); + final Rectangle rec = new Rectangle(20,20); + //g.translate(rec.x, rec.y); + // la ligne + g.setColor(Color.white); + g.fillRect(0, 0, 20, 20); + final TraceLigne l = new TraceLigne(cb.getLigneModel()); + l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); + // l'icone + final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); + icm.setTaille(Math.min(rec.width / 3, rec.height/3));// a voir + final TraceIcon ic = new TraceIcon(icm); + ic.paintIconCentre(g, rec.width / 2, rec.height / 2); + //g.translate(-rec.x, -rec.y); + + resultat.setIcon(new ImageIcon(image)); + resultat.setText(cb.getTitle()); + resultat.setOpaque(true); + //resultat.setIconTextGap(12); + if (isSelected) { + resultat.setBackground(HIGHLIGHT_COLOR); + resultat.setForeground(Color.white); + } + + return resultat; + } + + } + + PlageTableModel model_; + + public EGPaletteLegendeGraphe(EGGraphe graphe){ + graphe_=graphe; + //mapTitles_=new HashMap<BuTextField, EGCourbe>(); + //-- construction du panel des l\xE9gendes --// + buildContent(); + } + + + private EGCourbe getSelectedCourbe(){ + int select=this.list_.getSelectedIndex(); + if(select==-1) + return null; + EGCourbe courbe=graphe_.getModel().getCourbes()[select]; + return courbe; + } + + + BConfigurePalette paletteConf_=new BConfigurePalette(true); + /** + * Met a jour le panneau des donn\xE9es. + */ + private void updatePanelData() { + //-- on r\xE9cup\xE8re la courbe selectionnee --// + EGCourbe courbe=getSelectedCourbe(); + if(courbe!=null) + paletteConf_.setPalettePanelTarget(courbe); + } + + + private void buildContent(){ + + final EGCourbe[] cs = graphe_.getModel().getCourbes(); + + final BuBorderLayout lay = new BuBorderLayout(2, 2); + setLayout(lay); + + //-- liste des courbes --// + list_ = new BuEmptyList(); + model_ = new PlageTableModel(cs); + list_.setModel(model_); + list_.setCellRenderer(new LegendeRenderer()); + list_.getSelectionModel().addListSelectionListener(this); + list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + //list_.setFocusable(false); + sp_ = new BuScrollPane(list_); + sp_.setPreferredSize(new Dimension(150,100)); + sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); + add(sp_, BuBorderLayout.NORTH); + + final BuPanel pnColor = new BuPanel(); + pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); + + //-- update le panel des donn\xE9es + updatePanelData(); + + + //paletteConf_.setPreferredSize(new Dimension(300,300)); + paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); + + JScrollPane peast=new JScrollPane(paletteConf_); + peast.setPreferredSize(new Dimension(150,200)); + + add(peast, BorderLayout.CENTER); + btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); + btApply_.setText(BuResource.BU.getString("Appliquer")); + btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); + btApply_.addActionListener(this); + btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); + btRefresh_.setText(EbliLib.getS("initialiser")); + btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); + btRefresh_.addActionListener(this); + btRefresh_.setEnabled(true); +// btFormat_ = new BuButton(); +// btFormat_.setText(EbliLib.getS("Format des labels")); +// btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); +// btFormat_.addActionListener(this); +// btFormat_.setEnabled(false); + final BuPanel btpn = new BuPanel(); + btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); + + //btpn.add(btFormat_); + btpn.add(btRefresh_); + //btpn.add(btApply_); + add(btpn, BuBorderLayout.SOUTH); + + this.setPreferredSize(new Dimension(300,300)); + this.setMinimumSize(new Dimension(300,300)); + + this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); + //-- initialise au premier courbe --// + list_.setSelectedIndex(0); + } + + + + public void actionPerformed(ActionEvent _e) { + + EGCourbe courbe=getSelectedCourbe(); + if(courbe==null)return; + + final Object s = _e.getSource(); + if ((s == btColor_) ) { + final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); + if ((n != null) && (n != ic_.getCouleur())) { + // setModified(); + ic_.setCouleur(n); + if(courbe!=null) + courbe.setAspectContour(n); + } + } else if (s == btApply_) { + actionApply(); + } else if (s == btRefresh_) { + reinitPlages(); + } else if (btFormat_ == _e.getSource()) { + actionFormat(); + } + + + } + + + /** + * Appelee lorsqu'on appuie sur le bouton appliquer + */ + private void actionApply() { + + } + + /** + * Reinitialise les titres des courbes avec les donn\xE9es initiales. + */ + private void reinitPlages() { + + } + + /** + * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. + */ + protected void ajusteAllLegendes() { + + } + + + + public void valueChanged(ListSelectionEvent e) { + + updatePanelData(); + } + + + + private void actionFormat() { + CtuluNumberFormatI ctuluNumberFormatI =format_; + /* + * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } + */ + final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); + fmtSelect.setErrorTextUnable(); + final CtuluDialogPanel pn = new CtuluDialogPanel() { + public boolean valide() { + return fmtSelect.valide(); + } + }; + pn.setLayout(new BuVerticalLayout(4)); + final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); + pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); + final BuTextField tf = new BuTextField(); + tf.setText(separatorFormat_); + pnSep.add(tf); + pn.add(pnSep); + + if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { + fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); + pn.add(fmtSelect); + } + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { + format_= fmtSelect.getCurrentFmt(); + separatorFormat_= tf.getText(); + ajusteAllLegendes(); + + } + } + + +} 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 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -13,6 +13,8 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.palette.PaletteSelecteurCouleurPlage; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -43,10 +45,11 @@ // Font oldFont_; boolean mustUpdateFont_ = false; - + public EbliWidgetCalqueLegende(final EbliScene _scene, final boolean _controller/* , BArbreCalqueModel model */, final BCalqueLegendePanel _legendePanel) { super(_scene, _controller); + setCheckClipping(true); // oldFont_ = getFormeFont(); // -- la legende est un listener des modifs de son calque --// 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 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -203,7 +203,7 @@ public Rectangle getInitialEditorComponentBounds( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final Rectangle viewBounds) { - return convertLocalToScene(getClientArea()); + return null;// convertLocalToScene(getClientArea()); } public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, 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 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -245,10 +245,10 @@ public Rectangle getInitialEditorComponentBounds( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final Rectangle viewBounds) { - final Rectangle rec = convertLocalToScene(getClientArea()); - rec.width -= 1; - rec.height -= 1; - return rec; +// final Rectangle rec = convertLocalToScene(getClientArea()); +// rec.width -= 1; +// rec.height -= 1; + return null;//rec; } public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -47,10 +47,10 @@ // -- ajouter l option de remplacer le text dans le label --// // -- creation de l action --// - final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + //final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); // -- ajout de l action au label correspondant --// - intern_.getActions().addAction(editorAction); +// intern_.getActions().addAction(editorAction); // setEnabled(false); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -1,24 +1,36 @@ package org.fudaa.ebli.visuallibrary.graphe; +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 org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheModelListener; import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.courbe.EGPaletteLegendeGraphe; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; 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.Widget; import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.util.GeomUtil; +import com.memoire.bu.BuPanel; + /** * @author denf01a adrien hadoux * @creation 5 ao\xFBt 2008 @@ -39,13 +51,20 @@ /** * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font */ - public static class WidgetCalqueLegende extends EbliWidget { + public static class WidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<BuPanel> { Font oldFont_; - - public WidgetCalqueLegende(final EbliScene scene, final boolean _controller) { + EGGraphe graphe_; + public WidgetCalqueLegende(EGGraphe graphe,final EbliScene scene, final boolean _controller) { super(scene, _controller); + graphe_=graphe; oldFont_ = getFormeFont(); + // -- creation de l action --// + final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au label correspondant --// + this.getActions().addAction(editorAction); + } protected Rectangle resizeMaxLegende() { @@ -193,6 +212,80 @@ return true; } + + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget) { + EGPaletteLegendeGraphe palette =new EGPaletteLegendeGraphe(this.graphe_); + palette.setPreferredSize(new Dimension(300,300)); + + return palette; + } + + private void updateRectangleToFitToView(final Rectangle rectangle) { + final JComponent component = this.getScene().getView(); + if (rectangle.x + rectangle.width > component.getWidth()) rectangle.x = component.getWidth() - rectangle.width; + if (rectangle.y + rectangle.height > component.getHeight()) rectangle.y = component.getHeight() - rectangle.height; + if (rectangle.x < 0) rectangle.x = 0; + if (rectangle.y < 0) rectangle.y = 0; + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + return null; + } + + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, Rectangle viewBounds) { + + Rectangle rectangle = widget.getScene().convertSceneToView(widget.convertLocalToScene(widget.getBounds())); + + + final Point center = GeomUtil.center(rectangle); + final Dimension size = editor.getMinimumSize(); + if (rectangle.width > size.width) size.width = rectangle.width; + if (rectangle.height > size.height) size.height = rectangle.height; + final int x = center.x - size.width / 2; + final int y = center.y - size.height / 2; + rectangle = new Rectangle(x, y, size.width, size.height); + updateRectangleToFitToView(rectangle); + + //-- pour que ce soit clairment visible --// + int tailleMinW=400; + int tailleMinH=500; + if( rectangle.width<tailleMinW){ + int dim=tailleMinW-rectangle.width; + rectangle.width+=dim; + rectangle.x=rectangle.x-dim/2; + } + if( rectangle.height<tailleMinH){ + int dim=tailleMinH-rectangle.height; + rectangle.height+=dim; + rectangle.y=rectangle.y-dim/2; + } + + return rectangle; + } + + + public void notifyClosing( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + // TODO Auto-generated method stub + + } + + + public void notifyOpened( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + // TODO Auto-generated method stub + + } + } /** @@ -205,7 +298,7 @@ */ public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { final EGCourbe[] cs = g.getModel().getCourbes(); - final WidgetCalqueLegende res = new WidgetCalqueLegende(scene, false); + final WidgetCalqueLegende res = new WidgetCalqueLegende(g,scene, false); res.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5));// a // modifier // pour This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-05 18:20:54
|
Revision: 4443 http://fudaa.svn.sourceforge.net/fudaa/?rev=4443&view=rev Author: hadouxad Date: 2009-02-05 18:20:44 +0000 (Thu, 05 Feb 2009) Log Message: ----------- - calques destructibles (trajectoires, trace de courbes, cr?\195?\169ation depuis option origine du graphe) - cr?\195?\169ation de groupes pour rangement des traces de calques - ihm grilles et sous grilles graphe: sch?\195?\169ma des vues 2d - Refactorisation des algos de calculs fixes nb graduations et longueur de pas sous forme d iterator. - Grilles et sous grilles des graphes: - mode par nombre de graduations - mode par longueur de pas - ajout des tracelignemodel pour les 2 type de trac?\195?\169s - Utilisation des bselecteurs interfaces - Grilles et sous grilles des vues 2d - ajout des traceligne model pour les 2 versions - Wizard: - Texte avec case a cocher - Case par default a false - Undo/redo op?\195?\169rationnels pour les superposition des frames. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurLineModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.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/EGAxeRepereConfigurator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.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/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-05 18:18:47 UTC (rev 4442) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-05 18:20:44 UTC (rev 4443) @@ -27,12 +27,16 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; +import org.fudaa.ctulu.iterator.NumberIteratorGraduationsFixe; +import org.fudaa.ctulu.iterator.NumberIteratorPasFixe; +import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliUIProperties; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LinearRing; @@ -40,971 +44,1097 @@ /** * Un calque d'affichage d'une grille. * - * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: bmarchan $ + * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: + * bmarchan $ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - // -- sous graduations --// - int nbSousGraduationX_ = 3; - // -- sous graduations --// - int nbSousGraduationY_ = 3; + // -- sous graduations --// + int nbSousGraduationX_ = 3; + // -- sous graduations --// + int nbSousGraduationY_ = 3; - final BVueCalque vue_; + + private TraceLigneModel traceGraduations_=new TraceLigneModel(TraceLigne.TIRETE,1,Color.black); + private TraceLigneModel traceSousGraduations_=new TraceLigneModel(TraceLigne.TIRETE,(float)0.5,Color.gray); + + final BVueCalque vue_; - /** - * Indique la facon de calculer les graduations. pour l'axe des x. - */ - boolean modeAutomatiqueX_ = false; - /** - * Indique la facon de calculer les graduations. pour l'axe des y. - */ - boolean modeAutomatiqueY_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des x. + */ + boolean modeAutomatiqueX_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des y. + */ + boolean modeAutomatiqueY_ = false; - /** - * Indique si on utilise par taille de pas ou par nombre de graduations - */ - boolean modeLongueurPasX_ = false; - boolean modeLongueurPasY_ = false; + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_ = false; + boolean modeLongueurPasY_ = false; - /** - * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. - */ - double valeurPasX_; - double valeurPasY_; + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en + * mode taille pas. + */ + double valeurPasX_; + double valeurPasY_; - boolean drawSousGrilleX_ = false; - boolean drawSousGrilleY_ = false; + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; - boolean modeLongueurPasSousGradX_ = false; - boolean modeLongueurPasSousGradY_ = false; + boolean modeLongueurPasSousGradX_ = false; + boolean modeLongueurPasSousGradY_ = false; - double valeurPasSousGradX_; - double valeurPasSousGradY_; + double valeurPasSousGradX_; + double valeurPasSousGradY_; - private Color couleurSousGraduation_ = Color.blue; + private Color couleurSousGraduation_ = Color.blue; - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } + public void paintAllInImage(final Graphics2D _g, + final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); - } + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), + new GrPoint(maxx, maxy, 0)), false); + } - public int getNbXGraduations() { - return nbGraduationX_; - } + public int getNbXGraduations() { + return nbGraduationX_; + } - public int getNbYGraduations() { - return nbGraduationY_; - } + public int getNbYGraduations() { + return nbGraduationY_; + } - public int getNbXSousGraduations() { - return nbSousGraduationX_; - } + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - public int getNbYSousGraduations() { - return nbSousGraduationY_; - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - public void setSousGraduationColor(Color c) { - if (couleurSousGraduation_ != c) { - couleurSousGraduation_ = c; - grilleChanged(); - } + public void setSousGraduationColor(Color c) { + if (couleurSousGraduation_ != c) { + couleurSousGraduation_ = c; + grilleChanged(); + } - } + } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la + * taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - public boolean isCouleurModifiable() { - return true; - } + public boolean isCouleurModifiable() { + return true; + } - public int getTiretLength() { - return 3; - } + public int getTiretLength() { + return 3; + } - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, + final GrMorphisme _versReel, final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); +// GrBoite domaine = vue_.getViewBoite(); +// final GrBoite zv = domaine; - if (zv == null) { return; } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + if (zv == null) { + return; + } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - if (!_versEcran.isSame(getVersEcran())) { return; } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - final NumberIterator it = new NumberIterator(); - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; + if (!_versEcran.isSame(getVersEcran())) { + return; + } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); + + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() + && nbGraduationX_ > 0; - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString, it); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() + && nbGraduationY_ > 0; + if (isYPainted) { + yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); + } - // boolean rapide = isRapide(); - final GrMorphisme versEcran = _versEcran; - final int tiret = getTiretLength(); - final int marge = 1; - int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); - final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; - int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); - vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); + // boolean rapide = isRapide(); + final GrMorphisme versEcran = _versEcran; + final int tiret = getTiretLength(); + final int marge = 1; + int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); + final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + + tiret; + int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); + vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); - final GrBoite ecranBoite = domaine.applique(_versEcran); - if (ecranBoite.getMinX() - 5 > absyAxe) { - absyAxe = (int) (ecranBoite.getMinX() - 5); - } - if (ecranBoite.getMaxY() + 5 < ordxAxe) { - ordxAxe = (int) (ecranBoite.getMaxY() + 5); - } - if (isXPainted) { - fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); + final GrBoite ecranBoite = domaine.applique(_versEcran); + if (ecranBoite.getMinX() - 5 > absyAxe) { + absyAxe = (int) (ecranBoite.getMinX() - 5); + } + if (ecranBoite.getMaxY() + 5 < ordxAxe) { + ordxAxe = (int) (ecranBoite.getMaxY() + 5); + } + if (isXPainted) { + fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); - } + } - // l'axe des x - final double maxXForAxe = ecranBoite.getMaxX() - marge; + // l'axe des x + final double maxXForAxe = ecranBoite.getMaxX() - marge; - // l'axe des y - final double minYForAxe = ecranBoite.getMinY() + marge; - // les graduation en x + // l'axe des y + final double minYForAxe = ecranBoite.getMinY() + marge; + // les graduation en x - final int ascent = fm == null ? 0 : fm.getAscent(); - final int ordXString = ordxAxe + tiret + ascent; - if (isXPainted) { - drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); - drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, - ordXString); - } + final int ascent = fm == null ? 0 : fm.getAscent(); + final int ordXString = ordxAxe + tiret + ascent; + if (isXPainted) { + drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); + drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, + absyAxe, ordxAxe, ecranBoite, minYForAxe, ordXString); + } - // y + // y - if (isYPainted) { - fillYZone(_g, targetBoite, absyAxe, ecranBoite); - drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); - drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); - } - _g.setColor(old); - _g.setFont(oldFont); - } + if (isYPainted) { + fillYZone(_g, targetBoite, absyAxe, ecranBoite); + drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, + minYForAxe); + drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, + absyAxe, ordxAxe, ecranBoite, maxXForAxe); + } + _g.setColor(old); + _g.setFont(oldFont); + } - void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite) { - if (_ecranBoite.getMaxX() > _ordxAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); - } - } + void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, + final int _absyAxe, final int _ordxAxe, final GrBoite _ecranBoite) { + if (_ecranBoite.getMaxX() > _ordxAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() + - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); + } + } - private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { - if (_ecranBoite.getMinX() < _absyAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); - } - } + private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, + final int _absyAxe, final GrBoite _ecranBoite) { + if (_ecranBoite.getMinX() < _absyAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); + } + } - protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, - final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _maxXForAxe) { - final int nb = _yString.size(); - final int tiret = getTiretLength(); - final Font font = getFont(); - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final int ascent = fm == null ? 0 : fm.getAscent(); - int idxStr = -1; - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - GrPoint tmpSousGrille_ = new GrPoint(); - double longueurMoyenne = 0; - for (int i = 0; i < nb; i++) { - tmp_.y_ = _yValue.getQuick(i); - tmp_.autoApplique(_versEcran); - if (tmp_.y_ > _ordxAxe) { - continue; - } - if (tmp_.y_ < _ecranBoite.getMinY()) { - break; - } - // le tiret - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.setCouleur(fg); - final int w = _yStrWidth.getQuick(i); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); - if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { - _g.setColor(fg); - _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); - idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); - } + protected void drawYGraduations(final Graphics2D _g, + final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, + final List _yString, final GrMorphisme _versEcran, + final int _marge, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _maxXForAxe) { + final int nb = _yString.size(); + final int tiret = getTiretLength(); + final Font font = getFont(); + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final int ascent = fm == null ? 0 : fm.getAscent(); + int idxStr = -1; + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + GrPoint tmpSousGrille_ = new GrPoint(); + double longueurMoyenne = 0; + TraceLigne tl=new TraceLigne(traceGraduations_); + TraceLigne t1sousGrad=new TraceLigne(traceSousGraduations_); + for (int i = 0; i < nb; i++) { + tmp_.y_ = _yValue.getQuick(i); + tmp_.autoApplique(_versEcran); + if (tmp_.y_ > _ordxAxe) { + continue; + } + if (tmp_.y_ < _ecranBoite.getMinY()) { + break; + } + // le tiret + //tl_.setTypeTrait(TraceLigne.LISSE); + //tl_.setCouleur(fg); + final int w = _yStrWidth.getQuick(i); + tl.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe + - (w > 0 ? tiret : tiret - 2), tmp_.y_); + if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { + _g.setColor(fg); + _g.drawString((String) _yString.get(i), + (_absyAxe - w - tiret - _marge), + (int) (tmp_.y_ + ascent / 2D)); + idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); + } - // -- on trace ou non les sous graduations --// - if ((w > 0 || i == nb - 2) && drawSousGrilleY_ && i > 0 && i < nb - 1) { - int valNextPotable = -1; - for (int j = i + 1; valNextPotable == -1 && j < _yStrWidth.size(); j++) - if (_yStrWidth.getQuick(j) > 0) valNextPotable = j; + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleY_ && i > 0 + && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 + && j < _yStrWidth.size(); j++) + if (_yStrWidth.getQuick(j) > 0) + valNextPotable = j; - if (i == nb - 2) { - // -- la fin il faut creer le nouveau - valNextPotable = nb - 1; - _yValue.set(valNextPotable, _yValue.get(i) + longueurMoyenne); - } + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _yValue.set(valNextPotable, _yValue.get(i) + + longueurMoyenne); + } - if (valNextPotable != -1) { + if (valNextPotable != -1) { - tmpSousGrille_.y_ = _yValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(_versEcran); - double distanceEntre2Trait = Math.abs(tmpSousGrille_.y_ - tmp_.y_); - int nbSousGrilles = 0; - int taillePasSousgrille = 0; - if (!this.modeLongueurPasSousGradY_) { - // -- on trace des nombre de cesure --// - nbSousGrilles = this.getNbYSousGraduations(); - if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); - } else { - // -- on trace des pas par longueur --// - double ratio = (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); - if (ratio != 0) ratio = this.valeurPasSousGradY_ / ratio; + tmpSousGrille_.y_ = _yValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(_versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.y_ + - tmp_.y_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradY_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbYSousGraduations(); + if (nbSousGrilles != 0) + taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_yValue.getQuick(valNextPotable) - _yValue + .getQuick(i)); + if (ratio != 0) + ratio = this.valeurPasSousGradY_ / ratio; - taillePasSousgrille = (int) (ratio * distanceEntre2Trait); - if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); - } - // -- si on a des bons pas et nb de grilles --// - if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) + nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 + && taillePasSousgrille < distanceEntre2Trait) { - for (int k = 0; k < nbSousGrilles + 1; k++) { - // -- on trace un trait de couleur de subgrid --// - tl_.setTypeTrait(TraceLigne.POINTILLE); - tl_.setEpaisseur((float) 0.1); - tl_.setCouleur(this.couleurSousGraduation_); - double longueur = ((k) * taillePasSousgrille); - tmpSousGrille_.autoApplique(_versEcran); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_ + longueur, _maxXForAxe, tmp_.y_ + longueur); - } - longueurMoyenne = (int) (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); - } + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// +// t1sousGrad.setTypeTrait(TraceLigne.POINTILLE); +// t1sousGrad.setEpaisseur((float) 0.1); +// t1sousGrad.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(_versEcran); + t1sousGrad.dessineTrait(_g, _absyAxe, tmp_.y_ + longueur, + _maxXForAxe, tmp_.y_ + longueur); + } + longueurMoyenne = (int) (_yValue + .getQuick(valNextPotable) - _yValue.getQuick(i)); + } - } - } + } + } - if (drawGrid_ && w > 0) { - tl_.setTypeTrait(TraceLigne.TIRETE); - tl_.setEpaisseur(1); - tl_.setCouleur(subColor); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); - } - } - } + if (drawGrid_ && w > 0) { + //tl.setTypeTrait(TraceLigne.TIRETE); + //tl.setEpaisseur(1); + //tl.setCouleur(subColor); + tl.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); + } + } + } - private Color getSubColor() { - Color subColor = attenueCouleur(getForeground()); - if (isAttenue()) { - subColor = attenueCouleur(subColor); - } - return subColor; - } + private Color getSubColor() { + Color subColor = attenueCouleur(getForeground()); + if (isAttenue()) { + subColor = attenueCouleur(subColor); + } + return subColor; + } - private Color getDrawColor() { - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - return fg; - } + private Color getDrawColor() { + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + return fg; + } - final GrPoint tmp_ = new GrPoint(); + final GrPoint tmp_ = new GrPoint(); - private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { - final int nb = _xString.size(); - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - int idxStr = -1; - final GrMorphisme versEcran = getVersEcran(); - final int tiret = getTiretLength(); - final TraceLigne gtl = new TraceLigne(); - GrPoint tmpSousGrille_ = new GrPoint(); + private void drawXGraduations(final Graphics2D _g, + final GrBoite _targetBoite, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, + final int _absyAxe, final int _ordxAxe, final GrBoite _ecranBoite, + final double _minYForAxe, final int _ordXString) { + final int nb = _xString.size(); + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + int idxStr = -1; + final GrMorphisme versEcran = getVersEcran(); + final int tiret = getTiretLength(); + final TraceLigne gtl = new TraceLigne(traceGraduations_); + final TraceLigne gtlsousGrad = new TraceLigne(traceSousGraduations_); + + GrPoint tmpSousGrille_ = new GrPoint(); - double longueurMoyenne = 0; + double longueurMoyenne = 0; - for (int i = 0; i < nb; i++) { - tmp_.x_ = _xValue.getQuick(i); - tmp_.autoApplique(versEcran); - if (tmp_.x_ < _absyAxe) { - continue; - } - if (tmp_.x_ > _ecranBoite.getMaxX()) { - break; - } - // le tiret - gtl.setTypeTrait(TraceLigne.LISSE); - gtl.setCouleur(fg); - final int w = _xStrWidth.getQuick(i); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); - if (w > 0) { - final int start = (int) (tmp_.x_ - w / 2D); - if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { - _g.setColor(fg); - _g.drawString((String) _xString.get(i), start, _ordXString); - idxStr = start + w; - } - } + for (int i = 0; i < nb; i++) { + tmp_.x_ = _xValue.getQuick(i); + tmp_.autoApplique(versEcran); + if (tmp_.x_ < _absyAxe) { + continue; + } + if (tmp_.x_ > _ecranBoite.getMaxX()) { + break; + } + // le tiret + //gtl.setTypeTrait(TraceLigne.LISSE); + //gtl.setCouleur(fg); + final int w = _xStrWidth.getQuick(i); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + + (w > 0 ? tiret : tiret - 2)); + if (w > 0) { + final int start = (int) (tmp_.x_ - w / 2D); + if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { + _g.setColor(fg); + _g.drawString((String) _xString.get(i), start, _ordXString); + idxStr = start + w; + } + } - // -- on trace ou non les sous graduations --// - if ((w > 0 || i == nb - 2) && drawSousGrilleX_ && i < nb - 1) { - int valNextPotable = -1; - for (int j = i + 1; valNextPotable == -1 && j < _xStrWidth.size(); j++) - if (_xStrWidth.getQuick(j) > 0) valNextPotable = j; - if (i == nb - 2) { - // -- la fin il faut creer le nouveau - valNextPotable = nb - 1; - _xValue.set(valNextPotable, _xValue.get(i) + longueurMoyenne); - } - if (valNextPotable != -1) { + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleX_ && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 + && j < _xStrWidth.size(); j++) + if (_xStrWidth.getQuick(j) > 0) + valNextPotable = j; + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _xValue.set(valNextPotable, _xValue.get(i) + + longueurMoyenne); + } + if (valNextPotable != -1) { - tmpSousGrille_.x_ = _xValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(versEcran); - double distanceEntre2Trait = Math.abs(tmpSousGrille_.x_ - tmp_.x_); - int nbSousGrilles = 0; - int taillePasSousgrille = 0; - if (!this.modeLongueurPasSousGradX_) { - // -- on trace des nombre de cesure --// - nbSousGrilles = this.getNbXSousGraduations(); - if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); - } else { - // -- on trace des pas par longueur --// - double ratio = (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); - if (ratio != 0) ratio = this.valeurPasSousGradX_ / ratio; + tmpSousGrille_.x_ = _xValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.x_ + - tmp_.x_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradX_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbXSousGraduations(); + if (nbSousGrilles != 0) + taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_xValue.getQuick(valNextPotable) - _xValue + .getQuick(i)); + if (ratio != 0) + ratio = this.valeurPasSousGradX_ / ratio; - taillePasSousgrille = (int) (ratio * distanceEntre2Trait); - if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); - } - // -- si on a des bons pas et nb de grilles --// - if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) + nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 + && taillePasSousgrille < distanceEntre2Trait) { - for (int k = 0; k < nbSousGrilles + 1; k++) { - // -- on trace un trait de couleur de subgrid --// - gtl.setTypeTrait(TraceLigne.POINTILLE); - gtl.setEpaisseur((float) 0.1); - gtl.setCouleur(this.couleurSousGraduation_); - double longueur = ((k) * taillePasSousgrille); - tmpSousGrille_.autoApplique(versEcran); - gtl.dessineTrait(_g, tmp_.x_ + longueur, _ordxAxe, tmp_.x_ + longueur, _minYForAxe); - } + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// +// gtlsousGrad.setTypeTrait(TraceLigne.POINTILLE); +// gtlsousGrad.setEpaisseur((float) 0.1); +// gtlsousGrad.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(versEcran); + gtlsousGrad.dessineTrait(_g, tmp_.x_ + longueur, _ordxAxe, + tmp_.x_ + longueur, _minYForAxe); + } - longueurMoyenne = (int) (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); - } + longueurMoyenne = (int) (_xValue + .getQuick(valNextPotable) - _xValue.getQuick(i)); + } - } - } - if (drawGrid_ && w > 0) { - gtl.setTypeTrait(TraceLigne.TIRETE); - gtl.setCouleur(subColor); - gtl.setEpaisseur((float) 1); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); - } + } + } + if (drawGrid_ && w > 0) { +// gtl.setTypeTrait(TraceLigne.TIRETE); +// gtl.setCouleur(subColor); +// gtl.setEpaisseur((float) 1); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); + } - } - } + } + } - private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, - final double _minYForAxe) { - int minYDraw = _ordxAxe; - int maxYDraw = (int) _minYForAxe; + private void drawYaxe(final Graphics2D _g, final GrBoite _zv, + final TDoubleArrayList _xValue, final TDoubleArrayList _yValue, + final GrMorphisme _versEcran, final int _absyAxe, + final int _ordxAxe, final double _minYForAxe) { + int minYDraw = _ordxAxe; + int maxYDraw = (int) _minYForAxe; - // if (useCustom_) { - // tmp_.y_ = _zv.getMinY(); - // if (_yValue.size() > 0) { - // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.floor(tmp_.y_); - // if (tmp_.y_ > minYDraw) { - // minYDraw = (int) tmp_.y_; - // } - // tmp_.y_ = _zv.getMaxY(); - // if (_yValue.size() > 1) { - // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.ceil(tmp_.y_); - // if (tmp_.y_ < maxYDraw) { - // maxYDraw = (int) tmp_.y_; - // } - // } - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); - } + // if (useCustom_) { + // tmp_.y_ = _zv.getMinY(); + // if (_yValue.size() > 0) { + // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.floor(tmp_.y_); + // if (tmp_.y_ > minYDraw) { + // minYDraw = (int) tmp_.y_; + // } + // tmp_.y_ = _zv.getMaxY(); + // if (_yValue.size() > 1) { + // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.ceil(tmp_.y_); + // if (tmp_.y_ < maxYDraw) { + // maxYDraw = (int) tmp_.y_; + // } + // } + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); + } - final TraceLigne tl_ = new TraceLigne(); + final TraceLigne tl_ = new TraceLigne(); - private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { - int minXDraw = _absyAxe; - int maxXDraw = (int) _maxXForAxe; + private void drawXAxe(final Graphics2D _g, final GrBoite _zv, + final TDoubleArrayList _xValue, final GrMorphisme _versEcran, + final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { + int minXDraw = _absyAxe; + int maxXDraw = (int) _maxXForAxe; - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); - } + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); + } - private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + private void computeXValues(final GrBoite _zv, final Graphics2D _g, + final TDoubleArrayList _xValue, final TIntArrayList _xStrWidth, + final List _xString) { + TickIterator it=null; + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - // -- mode manuel --// - if (!modeAutomatiqueX_) { - if (modeLongueurPasX_) fillGraduationsWithPas(_g, this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, - _xStrWidth, _xString, fm); - else fillGraduations(_g, getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); - return; - } + // -- mode manuel --// + if (!modeAutomatiqueX_) { + if (modeLongueurPasX_){ + //fillGraduationsWithPas(_g, this.valeurPasX_, _zv.getMinX(), _zv + // .getMaxX(), _xValue, _xStrWidth, _xString, fm); + it=new NumberIteratorPasFixe(); + it.init(_zv.getMinX(), _zv.getMaxX(), this.valeurPasX_); + + } + else{ +// fillGraduations(_g, getNbXGraduations(), _zv.getMinX(), _zv +// .getMaxX(), _xValue, _xStrWidth, _xString, fm); + it=new NumberIteratorGraduationsFixe(); + it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + } + }else{ + it=new NumberIterator(); + it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + } + + if(it==null) + return; + // _it= + while (it.hasNext()) { + final double x = it.currentValue(); + _xValue.add(x); - _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + if (font == null || !it.isMajorTick()) { + _xStrWidth.add(0); + _xString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = it.currentLabel(); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + } + it.next(); + } + } - // _it= - while (_it.hasNext()) { - final double x = _it.currentValue(); - _xValue.add(x); + public boolean isModeAutomatiqueX() { + return modeAutomatiqueX_; + } - if (font == null || !_it.isMajorTick()) { - _xStrWidth.add(0); - _xString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = _it.currentLabel(); - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); - } - _it.next(); - } - } + public void setModeAutomatiqueX(boolean modeAutomatiqueX) { + this.modeAutomatiqueX_ = modeAutomatiqueX; + } - public boolean isModeAutomatiqueX() { - return modeAutomatiqueX_; - } + public boolean isModeAutomatiqueY() { + return modeAutomatiqueY_; + } - public void setModeAutomatiqueX(boolean modeAutomatiqueX) { - this.modeAutomatiqueX_ = modeAutomatiqueX; - } + public void setModeAutomatiqueY(boolean modeAutomatiqueY) { + this.modeAutomatiqueY_ = modeAutomatiqueY; + } - public boolean isModeAutomatiqueY() { - return modeAutomatiqueY_; - } + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur + * l'ecran que ce soit pour le mode par taille de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduations(Graphics2D _g, int nbGraduations, + double min, double max, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - public void setModeAutomatiqueY(boolean modeAutomatiqueY) { - this.modeAutomatiqueY_ = modeAutomatiqueY; - } + // -- distance tot a couvrir --// + final double distance = max - min;// e + final int taillePas = Math.max(1, (int) (distance / nbGraduations)); + double yMax = 0; + - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille - * de pas ou par nb de cesures. - * - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduations(Graphics2D _g, int nbGraduations, double min, double max, - final TDoubleArrayList _xValue, final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { + + NumberIteratorGraduationsFixe _it=new NumberIteratorGraduationsFixe(); + _it.init(min, max, nbGraduations); + + while (_it.hasNext()) { + final double x = _it.currentValue(); + _xValue.add(x); + final String currentLabel = _it.currentLabel(); + int stringWidth=fm.stringWidth(currentLabel); + _xStrWidth.add(stringWidth); + if (stringWidth > yMax) { + yMax = stringWidth; + } + _xString.add(currentLabel); + + _it.next(); + } + + return yMax; - // -- distance tot a couvrir --// - final double distance = max - min;// e - final int taillePas = Math.max(1, (int) (distance / nbGraduations));// FREd ne fonctionne pas toujours si on a des - // valeurs <1 + } - double yMax = 0; - // boucle infinie ! + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur + * l'ecran que ce soit pour le mode par taille de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduationsWithPas(Graphics2D _g, double pas, + double min, double max, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { + DecimalFormat df = new DecimalFormat("#.0"); + // -- distance tot a couvrir --// + final double distance = max - min; + final double taillePas = pas; + if (pas == 0) + return 0; + int nbGraduations = (int) (distance / taillePas); + double yMax = 0; - for (int i = 0; i < nbGraduations + 1; i++) { - int cesure = (int) (min + (taillePas * (i))); - _xValue.add(cesure); - final String currentLabel = Integer.toString(cesure); - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); + for (int i = 0; i < nbGraduations + 1; i++) { + double cesure = (min + (taillePas * (i))); + _xValue.add(cesure); + String currentLabel; - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - // boucle infinie ! - if (i == nbGraduations) if (cesure < max) nbGraduations++; - // Fred truc tempo pour eviter les crashs - if (i > 100) break; - } - return yMax; + currentLabel = df.format(cesure); + + String chiffreApresVirgule = currentLabel.substring(currentLabel + .lastIndexOf(",") + 1); + if (chiffreApresVirgule.equals("0")) + currentLabel = "" + (int) cesure; + _xString.add(currentLabel); + _xStrWidth.add(fm.stringWidth(currentLabel)); + final double stringWidth = fm == null ? 0 : fm.getStringBounds( + currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } - } + if (i == nbGraduations) { + if (cesure < max) + nbGraduations++;// ATTENTION boucle infinie ! + } + if (i > 100) + break;// a enlever bugfix temporaire. - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille - * de pas ou par nb de cesures. - * - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduationsWithPas(Graphics2D _g, double pas, double min, double max, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - DecimalFormat df = new DecimalFormat("#.0"); - // -- distance tot a couvrir --// - final double distance = max - min; - final double taillePas = pas; - if (pas == 0) return 0; - int nbGraduations = (int) (distance / taillePas); - double yMax = 0; + } + return yMax; - for (int i = 0; i < nbGraduations + 1; i++) { - double cesure = (min + (taillePas * (i))); - _xValue.add(cesure); - String currentLabel; - - currentLabel = df.format(cesure); - _xStrWidth.add(fm.stringWidth(currentLabel)); - String chiffreApresVirgule=currentLabel.substring(currentLabel.lastIndexOf(",")+1); - if( chiffreApresVirgule.equals("0")) - currentLabel=""+(int)cesure; - _xString.add(currentLabel); - - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } + } - if (i == nbGraduations) { - if (cesure < max) nbGraduations++;// ATTENTION boucle infinie ! - } - if (i > 100) break;// a enlever bugfix temporaire. + private double computeYValues(final Graphics2D _g, final GrBoite _zv, + final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, + final List _yString) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + double yMax = 0; + TickIterator it=null; - } - return yMax; + // -- mode manuel --// + if (!modeAutomatiqueY_) { + if (modeLongueurPasY_){ + + it=new NumberIteratorPasFixe(); + it.init(_zv.getMinY(), _zv.getMaxY(), this.valeurPasY_); +// yMax = fillGraduationsWithPas(_g, this.valeurPasY_, _zv +// .getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, +// _yString, fm); + } + else{ + it = new NumberIteratorGraduationsFixe(); + it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); +// yMax = fillGraduations(_g, nbGraduationY_, _zv.getMinY(), _zv +// .getMaxY(), _yValue, _yStrWidth, _yString, fm); + } + //return yMax; + }else{ + it = new NumberIterator(); + it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); + } - } + if(it==null) + return 0; + + while (it.hasNext()) { - private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, - final TIntArrayList _yStrWidth, final List _yString) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - double yMax = 0; - NumberIterator it; + final double x = it.currentValue(); + _yValue.add(x); + if (font == null || !it.isMajorTick()) { + _yStrWidth.add(0); + _yString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = it.currentLabel(); + final double stringWidth = fm == null ? 0 : fm.getStringBounds( + currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + _yStrWidth.add((int) stringWidth); + _yString.add(currentLabel); + } + it.next(); + } + return yMax; + } - // -- mode manuel --// - if (!modeAutomatiqueY_) { - if (modeLongueurPasY_) yMax = fillGraduationsWithPas(_g, this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, - _yStrWidth, _yString, fm); - else yMax = fillGraduations(_g, nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); - return yMax; - } + // private void updateBounds(final GrBoite _zv) { + // if (useCustom_ && customBounds_ != null) { + // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); + // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); + // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); + // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); + // } + // } - it = new NumberIterator(); - it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); - while (it.hasNext()) { + // Icon + /** + * Dessin de l'icone. + * + * @param _c + * composant dont l'icone peut deriver des proprietes (couleur, + * ...). Ce parametre peut etre <I>null</I>. Il est ignore ici. + * @param _g + * le graphics sur lequel dessiner l'icone + * @param _x + * lieu cible de l'icone (x) + * @param _y + * lieu cible de l'icone (y) + */ + public void paintIcon(final Component _c, final Graphics _g, final int _x, + final int _y) { + super.paintIcon(_c, _g, _x, _y); + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + _g.setColor(fg); + final int w = getIconWidth(); + final int h = getIconHeight(); + for (int i = 6; i < w - 2; i += 8) { + _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); + } + for (int j = 6; j < h - 2; j += 8) { + _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); + } + } - final double x = it.currentValue(); - _yValue.add(x); - if (font == null || !it.isMajorTick()) { - _yStrWidth.add(0); - _yString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = it.currentLabel(); - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - _yStrWidth.add((int) stringWidth); - _yString.add(currentLabel); - } - it.next(); - } - return yMax; - } + public void paintSelection(final Graphics2D _g, + final ZSelectionTrace _trace, final GrMorphisme _versEcran, + final GrBoite _clipReel) { + } - // private void updateBounds(final GrBoite _zv) { - // if (useCustom_ && customBounds_ != null) { - // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); - // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); - // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); - // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); - // } - // } + public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { + return null; + } - // Icon - /** - * Dessin de l'icone. - * - * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il - * est ignore ici. - * @param _g le graphics sur lequel dessiner l'icone - * @param _x lieu cible de l'icone (x) - * @param _y lieu cible de l'icone (y) - */ - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - super.paintIcon(_c, _g, _x, _y); - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - _g.setColor(fg); - final int w = getIconWidth(); - final int h = getIconHeight(); - for (int i = 6; i < w - 2; i += 8) { - _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); - } - for (int j = 6; j < h - 2; j += 8) { - _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); - } - } + public CtuluListSelection selection(final LinearRing _poly, final int _mode) { + return null; + } - public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) {} + public LineString getSelectedLine() { + return null; + } - public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { - return null; - } + /** + * Affectation de la propriete <I>boite</I>. + */ + // public void setBoite(final GrBoite _v) { + // if (boite_ != _v) { + // final GrBoite vp = boite_; + // boite_ = _v; + // firePropertyChange("boite", vp, _v); + // } + // } + public void setVisible(final boolean _v) { + // if (_v && boite_ == null) { + // boite_ = vue_.getAbstractCalque().getDomaine(); + // } + if (!_v) { + vue_.setUserInsets(null); + super.setVisible(false); + } else { + super.setVisible(_v); + } + firePropertyChange("grille", true, false); - public CtuluListSelection selection(final LinearRing _poly, final int _mode) { - return null; - } + } - public LineString getSelectedLine() { - return null; - } + public boolean isDrawGrid() { + return drawGrid_; + } - /** - * Affectation de la propriete <I>boite</I>. - */ - // public void setBoite(final GrBoite _v) { - // if (boite_ != _v) { - // final GrBoite vp = boite_; - // boite_ = _v; - // firePropertyChange("boite", vp, _v); - // } - // } - public void setVisible(final boolean _v) { - // if (_v && boite_ == null) { - // boite_ = vue_.getAbstractCalque().getDomaine(); - // } - if (!_v) { - vue_.setUserInsets(null); - super.setVisible(false); - } else { - super.setVisible(_v); - } - firePropertyChange("grille", true, false); + public void setDrawGrid(final boolean _drawGrid) { + if (_drawGrid != drawGrid_) { + drawGrid_ = _drawGrid; + grilleChanged(); + } + } - } + // public boolean isUseCustom() { + // return useCustom_; + // } + // + // public void setUseCustom(final boolean _useCustom) { + // if (useCustom_ != _useCustom) { + // useCustom_ = _useCustom; + // repaint(); + // } + // } + // + // public Envelope getCustomBounds() { + // return customBounds_ == null ? null : new Envelope(customBounds_); + // } + // + // public void setCustomBounds(final Envelope _customBounds) { + // if (customBounds_ != _customBounds) { + // customBounds_ = _customBounds; + // repaint(); + // } + // } - public boolean isDrawGrid() { - return drawGrid_; - } + public boolean isDrawX() { + return drawX_; + } - public void setDrawGrid(final boolean _drawGrid) { - if (_drawGrid != drawGrid_) { - drawGrid_ = _drawGrid; - grilleChanged(); - } - } + public void setDrawX(final boolean _drawX) { + if (drawX_ != _drawX) { + drawX_ = _drawX; + grilleChanged(); + } + } - // public boolean isUseCustom() { - // return useCustom_; - // } - // - // public void setUseCustom(final boolean _useCustom) { - // if (useCustom_ != _useCustom) { - // useCustom_ = _useCustom; - // repaint(); - // } - // } - // - // public Envelope getCustomBounds() { - // return customBounds_ == null ? null : new Envelope(customBounds_); - // } - // - // public void setCustomBounds(final Envelope _customBounds) { - // if (customBounds_ != _customBounds) { - // customBounds_ = _customBounds; - // repaint(); - // } - // } + public boolean isDrawY() { + return drawY_; + } - public boolean isDrawX() { - return drawX_; - } + public void setDrawY(final boolean _drawY) { + if (drawY_ != _drawY) { + drawY_ = _drawY; + grilleChanged(); + } + } - public void setDrawX(final boolean _drawX) { - if (drawX_ != _drawX) { - drawX_ = _drawX; - grilleChanged(); - } - } + public void setDrawSousGrilleY(final boolean _drawY) { + if (drawSousGrilleY_ != _drawY) { + drawSousGrilleY_ = _drawY; + grilleChanged(); + } + } - public boolean isDrawY() { - return drawY_; - } + public void setDrawSousGrilleX(final boolean _drawX) { + if (drawSousGrilleX_ != _drawX) { + drawSousGrilleX_ = _drawX; + grilleChanged(); + } + } - public void setDrawY(final boolean _drawY) { - if (drawY_ != _drawY) { - drawY_ = _drawY; - grilleChanged(); - } - } + private void grilleChanged() { + repaint(); + firePropertyChange("grille", true, false); + } - public void setDrawSousGrilleY(final boolean _drawY) { - if (drawSousGrilleY_ != _drawY) { - drawSousGrilleY_ = _drawY; - grilleChanged(); - } - } + @Override + public EbliUIProperties saveUIProperties() { + final EbliUIProperties res = super.saveUIProperties(); + res.put("graduation.x.nb", getNbXGraduations()); + res.put("graduation.y.nb", getNbYGraduations()); + res.put("graduation.x.visible", isDrawX()); + res.put("graduation.y.visible", isDrawY()); + res.put("grille.visible", isDrawGrid()); + return res; + } - public void setDrawSousGrilleX(final boolean _drawX) { - if (drawSousGrilleX_ != _drawX) { - drawSousGrilleX_ = _drawX; - grilleChanged(); - } - } + @Override + public void initFrom(EbliUIProperties _p) { + super.initFrom(_p); + if (_p.isDefined("graduation.x.nb")) { + setNbGraduationX(_p.getInteger("graduation.x.nb")); + } + if (_p.isDefined("graduation.y.nb")) { + setNbGraduationX(_p.getInteger("graduation.y.nb")); + } + if (_p.isDefined("graduation.y.visible")) { + setDrawY(_p.getBoolean("graduation.y.visible")); + } + if (_p.isDefined("graduation.x.visible")) { + setDrawX(_p.getBoolean("graduation.x.visible")); + } + if (_p.isDefined("grille.visible")) { + setDrawGrid(_p.getBoolean("grille.visible")); + } + } - private void grilleChanged() { - repaint(); - firePropertyChange("grille", true, false); - } + public void setNbGraduationX(final int _nbGraduationX) { + if (_nbGraduationX > 0 /* && nbGraduationX_ != _nbGraduationX */) { + nbGraduationX_ = _nbGraduationX; + modeLongueurPasX_ = false; + grilleChanged(); + } + } - @Override - public EbliUIProperties saveUIProperties() { - final EbliUIProperties res = super.saveUIProperties(); - res.put("graduation.x.nb", getNbXGraduations()); - res.put("graduation.y.nb", getNbYGraduations()); - res.put("graduation.x.visible", isDrawX()); - res.put("graduation.y.visible", isDrawY()); - res.put("grille.visible", isDrawGrid()); - return res; - } + public void setLenghtStepsX(final double _lenghtSteps) { + GrBoite boite = vue_.getViewBoite(); + if (_lenghtSteps == 0) + return; + double max = boite.getMaxX(); + int nbGraduationsX = (int) (max / _lenghtSteps); + if (nbGraduationsX + 1 > 0 /* && nbGraduationsX+1!=nbGraduationX_ */) { + nbGraduationX_ = nbGraduationsX; + valeurPasX_ = _lenghtSteps; + modeLongueurPasX_ = true; + grilleChanged(); + } - @Override - public void initFrom(EbliUIProperties _p) { - super.initFrom(_p); - if (_p.isDefined("graduation.x.nb")) { - setNbGraduationX(_p.getInteger("graduation.x.nb")); - } - if (_p.isDefined("graduation.y.nb")) { - setNbGraduationX(_p.getInteger("graduation.y.nb")); - } - if (_p.isDefined("graduation.y.visible")) { - setDrawY(_p.getBoolean("graduation.y.visible")); - } - if (_p.isDefined("graduation.x.visible")) { - setDrawX(_p.getBoolean("graduation.x.visible")); - } - if (_p.isDefined("grille.visible")) { - setDrawGrid(_p.getBoolean("grille.visible")); - } - } + } - public void setNbGraduationX(final int _nbGraduationX) { - if (_nbGraduationX > 0 /* && nbGraduationX_ != _nbGraduationX */) { - nbGraduationX_ = _nbGraduationX; - modeLongueurPasX_ = false; - grilleChanged(); - } - } + public void setLenghtStepsY(final double _lenghtSteps) { + GrBoite boite = vue_.getViewBoite(); + if (_lenghtSteps == 0) + return; + int nbGraduationsY = (int) (boite.getMaxY() / _lenghtSteps); + if (nbGraduationsY > 0 /* && nbGraduationsY!=nbGraduationY_ */) { + nbGraduationY_ = nbGraduationsY; + valeurPasY_ = _lenghtSteps;... [truncated message content] |