|
From: <de...@us...> - 2010-01-03 20:29:32
|
Revision: 5572
http://fudaa.svn.sourceforge.net/fudaa/?rev=5572&view=rev
Author: deniger
Date: 2010-01-03 20:29:21 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2009-12-23 02:48:43 UTC (rev 5571)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2010-01-03 20:29:21 UTC (rev 5572)
@@ -215,7 +215,7 @@
}
public void addModelListener(final EGGrapheModelListener _l) {
- listenerList.add(EGGrapheModelListener.class, _l);
+ getModel().addModelListener(_l);
}
public synchronized void addPropertyChangeListener(final String _propertyName, final PropertyChangeListener _listener) {
@@ -551,7 +551,7 @@
}
public void removeModelListener(final EGGrapheModelListener _l) {
- listenerList.remove(EGGrapheModelListener.class, _l);
+ getModel().removeModelListener(_l);
}
public void restore() {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-12-23 02:48:43 UTC (rev 5571)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2010-01-03 20:29:21 UTC (rev 5572)
@@ -39,7 +39,6 @@
import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel;
import org.fudaa.ctulu.gui.CtuluDialogPanel;
import org.fudaa.ebli.commun.EbliLib;
-import org.fudaa.ebli.controle.BConfigurePalette;
import org.fudaa.ebli.ressource.EbliResource;
import org.fudaa.ebli.trace.TraceIcon;
import org.fudaa.ebli.trace.TraceLigne;
@@ -52,6 +51,26 @@
public class EGPaletteLegendeGraphe extends CtuluDialogPanel implements ActionListener, ListSelectionListener,
BuBorders {
+ private final class EGGrapheModelListenerImplementation implements EGGrapheModelListener {
+ public void structureChanged() {
+
+ }
+
+ public void courbeContentChanged(final EGObject c, final boolean mustRestore) {
+ }
+
+ public void courbeAspectChanged(final EGObject c, final boolean visibil) {
+ model_.fireContentsChanged(this, 0, model_.getSize() - 1);
+
+ }
+
+ public void axeContentChanged(final EGAxe c) {
+
+ }
+
+ public void axeAspectChanged(final EGAxe c) {}
+ }
+
/**
* Un icone
*
@@ -69,17 +88,17 @@
return 30;
}
- public void paintIcon(Component _c, Graphics _g, int _x, int _y) {
- Graphics2D g = (Graphics2D) _g;
+ public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
+ final Graphics2D g = (Graphics2D) _g;
g.setColor(Color.white);
g.fillRect(_x, _y, _x + getIconWidth(), _y + getIconHeight());
- int middleH = _y + getIconHeight() / 2;
+ final int middleH = _y + getIconHeight() / 2;
traceLigne_.dessineTrait(g, _x, middleH, _x + getIconWidth(), middleH);
traceIcon_.paintIconCentre(g, _x + getIconWidth() / 2, middleH);
}
- protected void setCourbe(EGCourbe _c) {
+ protected void setCourbe(final EGCourbe _c) {
traceLigne_.getModel().updateData(_c.getLigneModel());
traceIcon_.getModel().updateData(_c.getIconModel());
traceIcon_.setTaille(getIconHeight() / 4);// a voir
@@ -100,8 +119,8 @@
public LegendeRenderer() {}
@Override
- protected void setValue(Object _value) {
- EGCourbe cb = (EGCourbe) _value;
+ protected void setValue(final Object _value) {
+ final EGCourbe cb = (EGCourbe) _value;
icon_.setCourbe(cb);
setIcon(icon_);
setText(cb.getTitle());
@@ -110,10 +129,29 @@
}
+ class CustomDefaultListModel extends DefaultListModel {
+
+ @Override
+ public void fireContentsChanged(Object source, int index0, int index1) {
+ super.fireContentsChanged(source, index0, index1);
+ }
+
+ @Override
+ public void fireIntervalAdded(Object source, int index0, int index1) {
+ super.fireIntervalAdded(source, index0, index1);
+ }
+
+ @Override
+ public void fireIntervalRemoved(Object source, int index0, int index1) {
+ super.fireIntervalRemoved(source, index0, index1);
+ }
+
+ }
+
/**
* Graphe associ\xE9 a la palette
*/
- private EGGraphe graphe_;
+ private final EGGraphe graphe_;
/**
* Bouton qui applique les changements
@@ -141,17 +179,37 @@
*/
private JList list_;
- DefaultListModel model_;
+ CustomDefaultListModel model_;
+ private EGGrapheModelListenerImplementation modelListener;
+
// BConfigurePalette paletteConf_ = new BConfigurePalette(true);
- public EGPaletteLegendeGraphe(EGGraphe graphe) {
+ public EGPaletteLegendeGraphe(final EGGraphe graphe) {
graphe_ = graphe;
// mapTitles_=new HashMap<BuTextField, EGCourbe>();
// -- construction du panel des l\xE9gendes --//
buildContent();
}
+
+ @Override
+ public void cancel() {
+ graphe_.removeModelListener(modelListener);
+ super.cancel();
+ }
+
+ @Override
+ public boolean ok() {
+ graphe_.removeModelListener(modelListener);
+ return super.ok();
+ }
+ @Override
+ public void closeDialog() {
+ graphe_.removeModelListener(modelListener);
+ super.closeDialog();
+ }
+
/**
* Appelee lorsqu'on appuie sur le bouton appliquer
*/
@@ -160,13 +218,14 @@
}
private void actionFormat() {
- CtuluNumberFormatI ctuluNumberFormatI = format_;
+ final 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() {
+ @Override
public boolean valide() {
return fmtSelect.valide();
}
@@ -191,7 +250,7 @@
}
}
- public void actionPerformed(ActionEvent _e) {
+ public void actionPerformed(final ActionEvent _e) {
final Object s = _e.getSource();
if (s == btApply_) {
@@ -220,7 +279,9 @@
// -- liste des courbes --//
list_ = new JList();
- model_ = new DefaultListModel();
+ modelListener = new EGGrapheModelListenerImplementation();
+ graphe_.getModel().addModelListener(modelListener);
+ model_ = new CustomDefaultListModel();
for (int i = 0; i < cs.length; i++) {
model_.addElement(cs[i]);
}
@@ -229,7 +290,7 @@
list_.getSelectionModel().addListSelectionListener(this);
list_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- BuScrollPane sp = new BuScrollPane(list_);
+ final BuScrollPane sp = new BuScrollPane(list_);
sp.setPreferredSize(new Dimension(150, 100));
sp.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes")));
add(sp, BuBorderLayout.NORTH);
@@ -238,9 +299,9 @@
pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT));
// -- update le panel des donn\xE9es
-
+
paletteAction = new EGConfigureActionPalette();
- JComponent paletteComp = paletteAction.buildContentPane();
+ final JComponent paletteComp = paletteAction.buildContentPane();
updatePanelData();
// paletteConf_.setPreferredSize(new Dimension(300,300));
paletteComp.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage")));
@@ -253,7 +314,7 @@
btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications"));
btApply_.addActionListener(this);
btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir"));
- btRefresh_.setText(EbliLib.getS("initialiser"));
+ btRefresh_.setText(EbliLib.getS("R\xE9initialiser les titres"));
btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs"));
btRefresh_.addActionListener(this);
btRefresh_.setEnabled(true);
@@ -274,11 +335,11 @@
}
private EGCourbe[] getSelectedCourbes() {
- int[] select = this.list_.getSelectedIndices();
- if (select == null) return null;
- EGCourbe[] res = new EGCourbe[select.length];
+ final int[] select = this.list_.getSelectedIndices();
+ if (select == null) { return null; }
+ final EGCourbe[] res = new EGCourbe[select.length];
for (int i = 0; i < res.length; i++) {
- res[i] = (EGCourbe) list_.getModel().getElementAt(i);
+ res[i] = (EGCourbe) list_.getModel().getElementAt(select[i]);
}
return res;
}
@@ -298,8 +359,7 @@
paletteAction.setPaletteTarget(getSelectedCourbes());
}
- public void valueChanged(ListSelectionEvent e) {
-
+ public void valueChanged(final ListSelectionEvent e) {
updatePanelData();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2010-03-14 19:43:05
|
Revision: 5714
http://fudaa.svn.sourceforge.net/fudaa/?rev=5714&view=rev
Author: deniger
Date: 2010-03-14 19:42:58 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGroupPersist.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMergeAxisPersist.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -3,6 +3,7 @@
import java.awt.Color;
import java.awt.Font;
+import org.fudaa.ctulu.CtuluRange;
import org.fudaa.ebli.trace.TraceLigne;
import org.fudaa.ebli.trace.TraceLigneModel;
@@ -25,6 +26,7 @@
TraceLigne grille;
boolean isIteratorUptodate;
Color lineColor;
+ CtuluRange range;
/**
* Booleen qui indique si l'on trace ou non la graduation
@@ -82,6 +84,7 @@
longueurPas_=axeY.longueurPas_;
modeGraduations_=axeY.modeGraduations_;
nbSousGraduations_=axeY.nbSousGraduations_;
+ range=axeY.range_;
}
@@ -110,6 +113,8 @@
axeY.longueurPas_=longueurPas_;
axeY.modeGraduations_=modeGraduations_;
axeY.nbSousGraduations_=nbSousGraduations_;
+ if(range!=null)
+ axeY.range_.initWith(range);
return axeY;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -990,7 +990,7 @@
return getTitle();
}
- public TraceBox getTbox_() {
+ public TraceBox getTbox() {
return tbox_;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -5,6 +5,7 @@
import org.fudaa.ctulu.CtuluCommandManager;
import org.fudaa.ebli.trace.TraceBox;
+import org.fudaa.ebli.trace.TraceIconModel;
import org.fudaa.ebli.trace.TraceLigneModel;
/**
@@ -30,6 +31,7 @@
TraceBox tracebox;
TraceLigneModel lineModel_;
TraceLigneModel tLigneMarqueur_;
+ TraceIconModel iconeModel;
//-- data specifiques --//
Object dataSpecifiques;
@@ -61,12 +63,13 @@
}
//graphiques
- if(courbe.getTbox_()!=null)
- tracebox=courbe.getTbox_();
+ if(courbe.getTbox()!=null)
+ tracebox=courbe.getTbox();
if(courbe.getLigneModel()!=null)
lineModel_=courbe.getLigneModel();
if(courbe.getMarkLigneModel()!=null)
tLigneMarqueur_=courbe.getMarkLigneModel();
+ iconeModel=courbe.getIconModel();
listeMarqueurs_=courbe.getMarqueurs();
@@ -128,6 +131,9 @@
courbe.setLigneType(lineModel_);
if(tLigneMarqueur_!=null)
courbe.setLigneMark(tLigneMarqueur_);
+ if(iconeModel!=null){
+ courbe.setIconeModel(iconeModel);
+ }
courbe.setNuagePoints(this.nuagePoints);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -387,6 +387,10 @@
public Dimension getDefaultImageDimension() {
return vue_.getDefaultImageDimension();
}
+
+ public EGVue getView(){
+ return vue_;
+ }
public EbliActionInterface[] getSpecificActions() {
if (specificTools_ == null) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -14,14 +14,29 @@
import gnu.trove.TObjectIntHashMap;
import gnu.trove.TObjectIntIterator;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Shape;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeListener;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.swing.JComponent;
@@ -793,7 +808,7 @@
*/
public void useOneAxeVertical(final EGAxeVertical[] _axes, final String _s, final CtuluRange _r) {
if (_axes == null || _axes.length < 2) { return; }
- final EGAxeVertical newAxe = new EGAxeVertical(_axes[0]);
+ final EGAxeVertical newAxe = _axes[0].duplicate();
String t = _s;
if (CtuluLibString.isEmpty(_s)) {
t = EbliLib.getS("Axe");
@@ -815,6 +830,10 @@
* if (_pas > 0) { newAxe.pas = _pas; } else newAxe.pas = newAxe.getEcart() / 5;
*/
newAxe.unite_ = unite;
+ mergeAxis(_axes, newAxe);
+ }
+
+ public void mergeAxis(final EGAxeVertical[] _axes, final EGAxeVertical newAxe) {
for (int i = getObjectNb() - 1; i >= 0; i--) {
final EGObject o = getObject(i);
if (o.getAxeY() != null && CtuluLibArray.findObject(_axes, o.getAxeY()) >= 0) {
@@ -850,6 +869,46 @@
return false;
}
+ /**
+ * @param o l'objedt
+ * @return si axe vertical de l'objet o a ete fusionne, renvoie l'axe initiale
+ */
+ public EGAxeVertical getInitVerticalAxis(EGObject o) {
+ if (objectInitAxe_ != null) { return objectInitAxe_.get(o); }
+ return null;
+ }
+
+ /**
+ * @return the merge axis-> the objects using the merges axis.
+ */
+ public Map<EGAxeVertical, List<EGObject>> getMergeAxis() {
+ Map<EGAxeVertical, List<EGObject>> res = new HashMap<EGAxeVertical, List<EGObject>>();
+ int nbEgObjects = getModel().getNbEGObject();
+ for (int i = 0; i < nbEgObjects; i++) {
+ EGObject egObject = getModel().getEGObject(i);
+ //l'objet utilise un axe merge
+ if (isVerticalAxisMerged(egObject)) {
+ //si oui, on enregistre l'axe
+ EGAxeVertical mergeAxis = egObject.getAxeY();
+ List<EGObject> objects = res.get(mergeAxis);
+ if (objects == null) {
+ objects = new ArrayList<EGObject>();
+ res.put(mergeAxis, objects);
+ }
+ objects.add(egObject);
+ }
+ }
+ return res;
+ }
+
+ /**
+ * @param o l'objedt
+ * @return si axe vertical de l'objet o a ete fusionne, renvoie l'axe initiale
+ */
+ public boolean isVerticalAxisMerged(EGObject o) {
+ return getInitVerticalAxis(o) != null;
+ }
+
public void zoom(final boolean _out) {
final double factor = _out ? 1 / getZoomCoef() : getZoomCoef();
final int width = (int) (factor * transformer_.getWSansMarges() / 2);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -1,5 +1,7 @@
package org.fudaa.ebli.courbe;
+import gnu.trove.TIntArrayList;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
@@ -8,6 +10,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -139,11 +143,16 @@
List<EGGroupPersist> listeGroupePersistance = new ArrayList<EGGroupPersist>(grapheTopersist.getModel()
.getNbEGObject());
int nbEgObjects = grapheTopersist.getModel().getNbEGObject();
+ int idxGroup = 1;
+ Map<EGGroup, Integer> groupIdx = new HashMap<EGGroup, Integer>();
for (int i = 0; i < nbEgObjects; i++) {
EGObject objet = grapheTopersist.getModel().getEGObject(i);
if (objet instanceof EGGroup) {
EGGroup groupe = (EGGroup) objet;
- listeGroupePersistance.add(new EGGroupPersist(groupe));
+
+ groupIdx.put(groupe, idxGroup);
+ // WARN les groupes enregistre l'axe initial.
+ listeGroupePersistance.add(new EGGroupPersist(groupe, grapheTopersist, idxGroup++));
for (int k = 0; k < groupe.getEGChilds().length; k++) {
if (groupe.getEGChilds()[k] instanceof EGCourbeChild) {
// -- ajout de la courbe persitante dans un fichier avec pour groupee le i eme
@@ -177,9 +186,22 @@
for (EGGroupPersist gp : listeGroupePersistance) {
out.writeObject(gp);
}
+ Map<EGAxeVertical, List<EGObject>> mergeAxis = grapheTopersist.getMergeAxis();
+ List<EGMergeAxisPersist> merges = new ArrayList<EGMergeAxisPersist>();
+ if (mergeAxis.size() > 0) {
+ for (Map.Entry<EGAxeVertical, List<EGObject>> entry : mergeAxis.entrySet()) {
+ List<EGObject> list = entry.getValue();
+ final TIntArrayList groupIdxInMap = getGroupIdxInMap(groupIdx, list);
+ if (groupIdxInMap.size() > 0) {
+ merges.add(new EGMergeAxisPersist(groupIdxInMap.toNativeArray(), entry.getKey()));
+ }
+ }
+ }
+ if (merges.size() > 0) {
+ out.writeObject(merges);
+ }
}
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
@@ -210,6 +232,16 @@
}
+ private static TIntArrayList getGroupIdxInMap(Map<EGGroup, Integer> groupIdx, List<EGObject> list) {
+ TIntArrayList idx = new TIntArrayList(list.size());
+ for (EGObject o : list) {
+ if (groupIdx.containsKey(o)) {
+ idx.add(groupIdx.get(o).intValue());
+ }
+ }
+ return idx;
+ }
+
/**
* Genere une instance de model par rapport au model serializ\xE9. Renvoie forc\xE9ment une class implements
* EGGrapheTreeModel sinon null
@@ -262,12 +294,22 @@
// -- Etape 3: on ajoute tous nos amis les groupes --//
int nbGroups = in.readInt();
+ Map<Integer, EGGroup> groupIdx = new HashMap<Integer, EGGroup>();
for (int i = 0; i < nbGroups; i++) {
// -- lecture du groupe --//
- EGGroup newGroup = ((EGGroupPersist) in.readObject()).generateGroupe();
+ EGGroupPersist groupPersist = (EGGroupPersist) in.readObject();
+ EGGroup newGroup = groupPersist.generateGroupe();
+ groupIdx.put(groupPersist.getIdx(), newGroup);
// ajout du groupe
model.add(newGroup);
}
+ List<EGMergeAxisPersist> mergeAxis=Collections.emptyList();
+
+ //on essaie de lire si dispo: bizarre isAvailable n'est pas supporte.
+ try {
+ mergeAxis = (List<EGMergeAxisPersist>) in.readObject();
+ } catch (Exception e) {}
+
// -- Etape 4: lecture des courbes --//
// get the persitant list of curves:
List<EGCourbePersist> listeCourbesPersistantes = getPersitantCurvesList(false);
@@ -284,7 +326,7 @@
model.finalizePersistance();
} catch (Exception e) {
((List<String>) parameters.get("errorMsg"))
- .add("Erreur, la tentative de finalisation des donn\xE9es du graphe a \xE9chou\xE9 ");
+ .add("Erreur, la tentative de finalisation des donn\xE9es du graphe a \xE9chou\xE9 ");
((List<String>) parameters.get("errorMsg"))
.add("Cette erreur est peut \xEAtre due \xE0 une incompatibilit\xE9 des variables pour un rejoue de donn\xE9es.");
@@ -296,7 +338,17 @@
for (int t = 0; t < nbGroups; t++) {
EGGroup group = model.getGroup(t);
if (group != null) graphe.setZoomAdaptedFor(group);
+ }
+ if (mergeAxis != null && mergeAxis.size() > 0) {
+ for (EGMergeAxisPersist merge : mergeAxis) {
+ int[] idxs = merge.getGroupeUsingTheAxis();
+ List<EGAxeVertical> axeToMerge = new ArrayList<EGAxeVertical>();
+ for (int i = 0; i < idxs.length; i++) {
+ axeToMerge.add(groupIdx.get(Integer.valueOf(idxs[i])).getAxeY());
+ }
+ graphe.mergeAxis(axeToMerge.toArray(new EGAxeVertical[axeToMerge.size()]), merge.getPersist().generateAxe());
+ }
}
// mise a jour des b\xE9b\xE9s
model.fireStructureChanged();
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGroupPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGroupPersist.java 2010-03-14 19:39:14 UTC (rev 5713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGroupPersist.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -9,20 +9,28 @@
public class EGGroupPersist {
String title;
+ int idx;
- EGAxeVerticalPersist axeY;
+ public int getIdx() {
+ return idx;
+ }
+
+ EGAxeVerticalPersist axeY;
boolean isVisible;
-public EGGroupPersist(EGGroup group) {
+public EGGroupPersist(EGGroup group,EGGraphe graphe,int idx) {
super();
- fillInfoWith(group);
+ this.idx=idx;
+ fillInfoWith(group,graphe);
}
-private void fillInfoWith(EGGroup groupe){
+private void fillInfoWith(EGGroup groupe,EGGraphe graphe){
title=groupe.getTitle();
-
- axeY=new EGAxeVerticalPersist(groupe.getAxeY());
+ EGAxeVertical axeVertical = graphe.getInitVerticalAxis(groupe);
+ //axe non fusionne
+ if(axeVertical==null) axeVertical=groupe.getAxeY();
+ axeY=new EGAxeVerticalPersist(axeVertical);
isVisible=groupe.isVisible_;
}
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMergeAxisPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMergeAxisPersist.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMergeAxisPersist.java 2010-03-14 19:42:58 UTC (rev 5714)
@@ -0,0 +1,29 @@
+package org.fudaa.ebli.courbe;
+
+public class EGMergeAxisPersist {
+
+ private int[] groupeUsingTheAxis;
+ private EGAxeVerticalPersist persist;
+ /**
+ * @param groupeUsingTheAxis
+ * @param persist
+ */
+ public EGMergeAxisPersist(int[] groupeUsingTheAxis, EGAxeVertical persist) {
+ super();
+ this.groupeUsingTheAxis = groupeUsingTheAxis;
+ this.persist = new EGAxeVerticalPersist(persist);
+ }
+ public int[] getGroupeUsingTheAxis() {
+ return groupeUsingTheAxis;
+ }
+ public void setGroupeUsingTheAxis(int[] groupeUsingTheAxis) {
+ this.groupeUsingTheAxis = groupeUsingTheAxis;
+ }
+ public EGAxeVerticalPersist getPersist() {
+ return persist;
+ }
+ public void setPersist(EGAxeVerticalPersist persist) {
+ this.persist = persist;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2010-06-28 22:49:12
|
Revision: 5779
http://fudaa.svn.sourceforge.net/fudaa/?rev=5779&view=rev
Author: deniger
Date: 2010-06-28 22:49:06 +0000 (Mon, 28 Jun 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGSpecificActions.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTransfoLib.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -14,6 +14,7 @@
* @author Adrien Hadoux
*
*/
+@SuppressWarnings("serial")
public class EGActionAfficheOrigineCourbe extends EbliActionSimple{
/**
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -42,7 +42,6 @@
import com.memoire.bu.BuTextField;
import com.memoire.bu.BuValueValidator;
import com.memoire.bu.BuVerticalLayout;
-import com.sun.xml.internal.ws.util.StringUtils;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibArray;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -24,7 +24,7 @@
*/
public class EGCourbeSurfacePainter {
public interface Delegate {
- boolean isValid();
+ boolean isDataValid();
void paint(EGCourbeSurfacePainter _parent, Graphics2D _g2d, EGRepere _r, int _idx);
}
@@ -75,7 +75,7 @@
public void courbeContentChanged(final EGObject _c, final boolean _mustRestore) {}
- public boolean isValid() {
+ public boolean isDataValid() {
return cs_ != null && model_.contains(cs_);
}
@@ -153,7 +153,7 @@
public abstract int getEcranValue(EGRepere _r, EGAxeVertical _y);
- public boolean isValid() {
+ public boolean isDataValid() {
return true;
}
@@ -519,7 +519,7 @@
}
if (delegateCourbe_ != null) {
- if (!delegateCourbe_.isValid()) {
+ if (!delegateCourbe_.isDataValid()) {
delegateCourbe_.setCs(null);
}
// pas la peine ...
@@ -528,7 +528,7 @@
}
}
final Color old = _g2d.getColor();
- if (painter_ != null && painter_.isValid()) {
+ if (painter_ != null && painter_.isDataValid()) {
painter_.paint(this, _g2d, _r, _idx);
}
_g2d.setColor(old);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -226,8 +226,8 @@
fmtSelect.setErrorTextUnable();
final CtuluDialogPanel pn = new CtuluDialogPanel() {
@Override
- public boolean valide() {
- return fmtSelect.valide();
+ public boolean isDataValid() {
+ return fmtSelect.isDataValid();
}
};
pn.setLayout(new BuVerticalLayout(4));
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGSpecificActions.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGSpecificActions.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGSpecificActions.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -283,7 +283,7 @@
return f_.getText();
}
- public boolean valide() {
+ public boolean isDataValid() {
if (f_.getText().trim().length() == 0) {
setErrorText(EbliLib.getS("Le nom ne doit pas \xEAtre vide"));
return false;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTransfoLib.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTransfoLib.java 2010-06-28 22:48:38 UTC (rev 5778)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTransfoLib.java 2010-06-28 22:49:06 UTC (rev 5779)
@@ -182,7 +182,7 @@
final BuLabel lb = new BuLabel(EbliLib.getS("Nombre de points \xE0 ajouter"));
final CtuluDialogPanel pn = new CtuluDialogPanel() {
- public boolean valide() {
+ public boolean isDataValid() {
boolean r = ((Number) nbPt.getValue()).intValue() >= 1;
if (!r) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bma...@us...> - 2011-04-01 10:50:16
|
Revision: 6203
http://fudaa.svn.sourceforge.net/fudaa/?rev=6203&view=rev
Author: bmarchan
Date: 2011-04-01 10:50:10 +0000 (Fri, 01 Apr 2011)
Log Message:
-----------
ADD : Selecteur de la visibilit?\195?\169 des labels sur points
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2011-04-01 09:32:50 UTC (rev 6202)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2011-04-01 10:50:10 UTC (rev 6203)
@@ -72,6 +72,8 @@
boolean displayTitleOnCurve_;
+ boolean displayPointLabels_;
+
Font font_ = CtuluLibSwing.getMiniFont();
final TraceIconModel iconeModel_;
@@ -305,6 +307,10 @@
return displayTitleOnCurve_;
}
+ public boolean isDisplayPointLabels() {
+ return displayPointLabels_;
+ }
+
protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y,
final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) {
return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision);
@@ -335,6 +341,14 @@
return true;
}
+ public boolean setDisplayPointLabels(final boolean _displayPointLabels) {
+ if (_displayPointLabels == displayPointLabels_) { return false; }
+ displayPointLabels_ = _displayPointLabels;
+ fireCourbeAspectChanged(false);
+ firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_POINT_LABELS, displayPointLabels_);
+ return true;
+ }
+
protected boolean setFont(final Font _font) {
if (_font == font_) { return false; }
font_ = _font;
@@ -468,25 +482,32 @@
if(model_.isPointDrawn(i) && xiVisible && yiVisible) {
// Paint point label
- String pLabel=model_.getPointLabel(i);
- if(pLabel!=null) {
- // Dessin de la boite et du label
- // X
- int xBox;
- if(((int) xie)<=_t.getMinEcranX())
- xBox=((int) xie);
- else if(((int) xie)>=_t.getMaxEcranX())
- xBox=((int) xie)-_g.getFontMetrics().stringWidth(pLabel)-3;
- else
- xBox=((int) xie)-_g.getFontMetrics().stringWidth(pLabel)/2-2;
- // Y
- int yBox;
- if(((int) yie)>=_t.getMaxEcranY())
- yBox=((int) yie)-10;
- else
- yBox=((int) yie)+10;
- // Paint
- tboxLabels_.paintBox(_g, xBox, yBox, pLabel);
+ if (displayPointLabels_) {
+ String pLabel=model_.getPointLabel(i);
+ if (pLabel != null) {
+ // Dessin de la boite et du label
+ // X
+ int xBox;
+ if (((int) xie) <= _t.getMinEcranX()) {
+ xBox=((int) xie);
+ }
+ else if (((int) xie) >= _t.getMaxEcranX()) {
+ xBox=((int) xie) - _g.getFontMetrics().stringWidth(pLabel) - 3;
+ }
+ else {
+ xBox=((int) xie) - _g.getFontMetrics().stringWidth(pLabel) / 2 - 2;
+ }
+ // Y
+ int yBox;
+ if (((int) yie) >= _t.getMaxEcranY()) {
+ yBox=((int) yie) - 10;
+ }
+ else {
+ yBox=((int) yie) + 10;
+ }
+ // Paint
+ tboxLabels_.paintBox(_g, xBox, yBox, pLabel);
+ }
}
// Paint point
if(iconeModel_.getType() != TraceIcon.RIEN) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2011-04-01 09:32:50 UTC (rev 6202)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2011-04-01 10:50:10 UTC (rev 6203)
@@ -54,6 +54,9 @@
if (_key == PROP_DISPLAY_TITLE_CURVE) {
return Boolean.valueOf(target_.isDisplayTitleOnCurve());
}
+ if (_key == PROP_DISPLAY_POINT_LABELS) {
+ return Boolean.valueOf(target_.isDisplayPointLabels());
+ }
if (_key == BSelecteurReduitFonteNewVersion.PROPERTY) {
return target_.getFont();
}
@@ -80,6 +83,9 @@
if (_key == PROP_DISPLAY_TITLE_CURVE) {
return target_.setDisplayTitleOnCurve(((Boolean) _newProp).booleanValue());
}
+ if (_key == PROP_DISPLAY_POINT_LABELS) {
+ return target_.setDisplayPointLabels(((Boolean) _newProp).booleanValue());
+ }
if (_key == BSelecteurReduitFonteNewVersion.PROPERTY) {
return target_.setFont((Font) _newProp);
}
@@ -93,7 +99,7 @@
}
public BSelecteurInterface[] createSelecteurs() {
- final BSelecteurInterface[] res = new BSelecteurInterface[7];
+ final BSelecteurInterface[] res = new BSelecteurInterface[8];
int idx = 0;
res[idx] = new BSelecteurColorChooserBt();
((BSelecteurColorChooserBt) res[idx]).setAddListenerToTarget(false);
@@ -105,7 +111,9 @@
((BSelecteurCheckBox) res[idx++]).setTitle(EbliLib.getS("Nuage de points"));
res[idx] = new BSelecteurCheckBox(PROP_DISPLAY_TITLE_CURVE);
((BSelecteurCheckBox) res[idx++]).setTitle(EbliLib.getS("Afficher le titre sur la courbe"));
- res[idx] = new BSelecteurFont();
+ res[idx++] = new BSelecteurFont();
+ res[idx] = new BSelecteurCheckBox(PROP_DISPLAY_POINT_LABELS);
+ ((BSelecteurCheckBox) res[idx]).setTitle(EbliLib.getS("Afficher les labels des points"));
return res;
}
@@ -339,6 +347,7 @@
public final static String PROP_DISPLAY_TITLE_CURVE = "courbeDisplayCurve";
public final static String PROP_MARK_MIN = "courbeMarkMin";
public final static String PROP_MARK_LINE = "courbeMarkLine";
+ public final static String PROP_DISPLAY_POINT_LABELS = "courbeDisplayPointsLabels";
//-- proprietes propres aux liste des marqueurs --//
public final static String PROP_MARK_VALUES = "courbeMarkValues";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-07-18 15:21:59
|
Revision: 7508
http://fudaa.svn.sourceforge.net/fudaa/?rev=7508&view=rev
Author: deniger
Date: 2012-07-18 15:21:48 +0000 (Wed, 18 Jul 2012)
Log Message:
-----------
ajout m?\195?\169thode utilitaires
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EgCourbeTransfertHandler.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-07-18 15:20:28 UTC (rev 7507)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-07-18 15:21:48 UTC (rev 7508)
@@ -42,8 +42,10 @@
import org.fudaa.ctulu.gui.CtuluLibSwing;
import org.fudaa.ctulu.gui.CtuluSelectionListTableModelUpdater;
import org.fudaa.ctulu.table.CtuluTable;
+import org.fudaa.ebli.commun.EbliActionSimple;
import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.ressource.EbliResource;
+import org.geotools.math.Statistics;
/**
* Un panneau qui affiche une table de la courbe selectionne par le graphe.
@@ -53,11 +55,26 @@
*/
public class EGTableGraphePanel extends BuPanel implements EGSelectionListener, EGGrapheModelListener {
- class SpecTableModel extends EGTableModel {
+ public static class SpecTableModel extends EGTableModel {
+ private EGTableGraphePanel graphePanel;
Double newX_;
Double newY_;
+ protected int xRowIndex = 0;
+ protected int yRowIndex = 1;
+ public SpecTableModel(EGTableGraphePanel graphePanel) {
+ this.graphePanel = graphePanel;
+ }
+
+ @Override
+ public void fireTableRowsDeleted(int firstRow, int lastRow) {
+ newX_ = null;
+ newY_ = null;
+ super.fireTableRowsDeleted(firstRow, lastRow);
+ }
+
+ @Override
protected void selectedCourbeChanged(final EGCourbe _a) {
newX_ = null;
newY_ = null;
@@ -84,10 +101,12 @@
return CtuluLibString.ESPACE;
}
if (_rowIndex == c_.getModel().getNbValues()) {
- if (_columnIndex == 0) {
+ if (_columnIndex == xRowIndex) {
return newX_ == null ? null : getX(newX_.doubleValue());
}
- return newY_ == null ? null : getY(newY_.doubleValue());
+ if (_columnIndex == yRowIndex) {
+ return newY_ == null ? null : getY(newY_.doubleValue());
+ }
}
return super.getValueAt(_rowIndex, _columnIndex);
}
@@ -104,9 +123,9 @@
if (d == null) {
return;
}
- if (_columnIndex == 0) {
+ if (_columnIndex == xRowIndex) {
newX_ = d;
- } else if (_columnIndex == 1) {
+ } else if (_columnIndex == yRowIndex) {
newY_ = d;
}
if (newX_ != null && newY_ != null) {
@@ -115,12 +134,12 @@
if (r) {
fireTableRowsInserted(0, _rowIndex);
}
- if (!r && lbXyInfo_ != null) {
- lbError_.setText(EbliLib.getS("Point non ajout\xE9 !"));
+ if (!r && graphePanel.lbXyInfo_ != null) {
+ graphePanel.lbError_.setText(EbliLib.getS("Point non ajout\xE9 !"));
new Timer().schedule(new TimerTask() {
public void run() {
- lbError_.setText(CtuluLibString.ESPACE);
+ graphePanel.lbError_.setText(CtuluLibString.ESPACE);
}
}, 3 * 1000);
}
@@ -134,8 +153,8 @@
} else {
super.setValueAt(_value, _rowIndex, _columnIndex);
}
- if (t_.getCellEditor() != null) {
- t_.getCellEditor().cancelCellEditing();
+ if (graphePanel.t_.getCellEditor() != null) {
+ graphePanel.t_.getCellEditor().cancelCellEditing();
}
}
}
@@ -145,17 +164,18 @@
public void actionPerformed(final ActionEvent _e) {
final JTable t = (JTable) _e.getSource();
+ SpecTableModel tableModel = (SpecTableModel) t.getModel();
int row = t.getSelectedRow();
int col = t.getSelectedColumn();
if (t.isEditing()) {
t.getCellEditor().stopCellEditing();
}
- if (col == 1) {
- col = 0;
+ if (col == tableModel.yRowIndex) {
+ col = tableModel.xRowIndex;
row++;
} else {
- col = 1;
+ col = tableModel.yRowIndex;
}
if (row >= t.getRowCount()) {
row = t.getRowCount() - 1;
@@ -194,8 +214,11 @@
*/
public static class EvolTable extends CtuluTable {
+ Action deleteAction;
+
public EvolTable() {
super();
+ setTransferHandler(new EgCourbeTransfertHandler());
}
/**
@@ -204,13 +227,39 @@
*/
public EvolTable(final Object[][] _values, final Object[] _names) {
super(_values, _names);
+ setTransferHandler(new EgCourbeTransfertHandler());
}
/**
+ * @param _model
+ */
+ public EvolTable(final TableModel _model) {
+ super(_model);
+ setTransferHandler(new EgCourbeTransfertHandler());
+ }
+
+ void setDeleteAction(Action deleteAction) {
+ this.deleteAction = deleteAction;
+ }
+
+ protected void delete() {
+ deleteAction.actionPerformed(null);
+ }
+
+ @Override
+ public TransferHandler getTransferHandler() {
+ return super.getTransferHandler();
+ }
+
+ public EGTableModel getEGTableModel() {
+ return (EGTableModel) super.getModel();
+ }
+
+ /**
* @param _tab ArrayList
*/
protected void insertTableInTable(final ArrayList _tab) {
- final EGTableModel model = (EGTableModel) getModel();
+ final EGTableModel model = getEGTableModel();
if (!model.isModelModifiable()) {
return;
}
@@ -218,15 +267,14 @@
int selectedRow = getSelectedRow();
final CtuluDoubleParser doubleParser = new CtuluDoubleParser();
- if ((selectedColumm == -1) || (selectedRow == -1)) {
- selectedColumm = 0;
- selectedRow = 0;
- }
final CtuluCommandComposite cmp = new CtuluCommandComposite();
- final int maxUpdate = updateLines(_tab, model, selectedColumm, selectedRow, doubleParser, cmp);
- if (model.isModelXModifiable() && selectedColumm == 0) {
- addValuesInModel(_tab, model, doubleParser, cmp, maxUpdate);
-
+ if (selectedRow >= 0) {
+ int maxUpdate = updateLines(_tab, model, selectedColumm, selectedRow, doubleParser, cmp);
+ if (model.isModelXModifiable()) {
+ addValuesInModel(_tab, model, doubleParser, cmp, maxUpdate);
+ }
+ } else if (model.isModelXModifiable()) {
+ addValuesInModel(_tab, model, doubleParser, cmp, 0);
}
model.a_.getCmd().addCmd(cmp.getSimplify());
}
@@ -331,17 +379,20 @@
}
return maxUpdate;
}
-
- /**
- * @param _model
- */
- public EvolTable(final TableModel _model) {
- super(_model);
- }
private boolean canEdit_;
+ @Override
protected boolean processKeyBinding(final KeyStroke _ks, final KeyEvent _e, final int _condition,
final boolean _pressed) {
+ Object key = getInputMap(_condition).get(_ks);
+ if (key != null) {
+ Action action = getActionMap().get(key);
+ if (action != null) {
+ return SwingUtilities.notifyAction(action, _ks, _e, this,
+ _e.getModifiers());
+
+ }
+ }
final int keyCode = _ks.getKeyCode();
if (!isEditing() && (keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) && _pressed) {
return false;
@@ -402,6 +453,10 @@
public EGTableGraphePanel() {
this(true);
}
+
+ public EvolTable getTable() {
+ return t_;
+ }
boolean afficheNomCourbe_ = true;
/**
@@ -440,6 +495,7 @@
return renderer_;
}
};
+ t_.setDeleteAction(getActionDelete());
setDefaultEnterAction(t_);
final BuTextField txt = BuTextField.createDoubleField();
txt.setColumns(10);
@@ -453,7 +509,7 @@
}
});
- t_.setModel(new SpecTableModel());
+ t_.setModel(createValuesTableModel());
t_.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
t_.setCellSelectionEnabled(true);
// t_.getSelectionModel().addListSelectionListener(this);
@@ -473,7 +529,14 @@
setPreferredSize(new Dimension(150, 200));
}
+ protected SpecTableModel createValuesTableModel() {
+ return new SpecTableModel(this);
+ }
+
private void eventReceived() {
+ if (t_.getCellEditor() != null) {
+ t_.getCellEditor().cancelCellEditing();
+ }
if (a_.getSelectedComponent() == null) {
lb_.setText(CtuluLibString.ESPACE);
t_.repaint();
@@ -488,6 +551,7 @@
} else {
nbPoint_ = pt;
(getSpecTableModel()).fireTableRowsDeleted(0, nbPoint_);
+ (getSpecTableModel()).fireTableRowsInserted(0, nbPoint_);
}
}
}
@@ -495,11 +559,12 @@
void updateButtons() {
final EGCourbe c = a_.getSelectedComponent();
if (btAdd_ != null) {
- btAdd_.setEnabled(c != null && c.getModel().isModifiable() && c.getModel().isXModifiable()
+ final boolean modifiable = c != null && c.getModel().isModifiable();
+ btAdd_.setEnabled(modifiable && c.getModel().isXModifiable()
&& selection_.getSelection() != null && selection_.getSelection().getNbSelectedIndex() >= 2);
- btRemove_.setEnabled(c != null && c.getModel().isModifiable() && c.getModel().isXModifiable()
+ btRemove_.setEnabled(modifiable && c.getModel().isXModifiable()
&& selection_.getSelection() != null && (!selection_.getSelection().isEmpty()));
- btAlign_.setEnabled(c != null && c.getModel().isModifiable() && selection_.getSelection() != null
+ btAlign_.setEnabled(modifiable && selection_.getSelection() != null
&& selection_.getSelection().getNbSelectedIndex() >= 2);
}
if (lbXyInfo_ != null) {
@@ -562,7 +627,33 @@
protected void tablePaste() {
t_.paste();
}
+ EbliActionSimple actionDelete;
+ public EbliActionSimple getActionDelete() {
+ if (actionDelete == null) {
+ actionDelete = new DeleteAction();
+ }
+ return actionDelete;
+ }
+
+ public class DeleteAction extends EbliActionSimple {
+
+ public DeleteAction() {
+ super(EbliLib.getS("Supprimer des points"), EbliResource.EBLI.getToolIcon("node-delete"), "REMOVE_POINTS");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));
+ }
+
+ @Override
+ public void updateStateBeforeShow() {
+ setEnabled(btRemove_.isEnabled());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent _e) {
+ btRemove_.doClick();
+ }
+ }
+
public void addPanelAction(final EGFillePanel _p) {
// si le contenu n'est pas modifiable ou si les boutons ont deja ete
// initialise on oublie ....
@@ -741,4 +832,4 @@
}
updateButtons();
}
-}
\ No newline at end of file
+}
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EgCourbeTransfertHandler.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EgCourbeTransfertHandler.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EgCourbeTransfertHandler.java 2012-07-18 15:21:48 UTC (rev 7508)
@@ -0,0 +1,51 @@
+package org.fudaa.ebli.courbe;
+
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.InputEvent;
+import javax.swing.JComponent;
+import javax.swing.TransferHandler;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class EgCourbeTransfertHandler extends TransferHandler {
+
+ protected void exportDone(final JComponent _source, final Transferable _data, final int _action) {
+ if (_action == MOVE) {
+ EGTableGraphePanel.EvolTable table = (EGTableGraphePanel.EvolTable) _source;
+ table.delete();
+ } else {
+ super.exportDone(_source, _data, _action);
+ }
+ }
+
+ @Override
+ protected Transferable createTransferable(JComponent c) {
+ EGTableGraphePanel.EvolTable table = (EGTableGraphePanel.EvolTable) c;
+ return table.createTransferable();
+ }
+
+ @Override
+ public boolean canImport(final JComponent _comp, final DataFlavor[] _transferFlavors) {
+ return true;
+ }
+
+ public void exportAsDrag(final JComponent _comp, final InputEvent _e, final int _action) {
+ super.exportAsDrag(_comp, _e, _action);
+ }
+
+ public void exportToClipboard(final JComponent _comp, final Clipboard _clip, final int _action) {
+ super.exportToClipboard(_comp, _clip, _action);
+ }
+
+ public int getSourceActions(final JComponent _c) {
+ EGTableGraphePanel.EvolTable table = (EGTableGraphePanel.EvolTable) _c;
+ if (table.getEGTableModel().isModelXModifiable()) {
+ return COPY_OR_MOVE;
+ }
+ return COPY;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-07-18 22:24:00
|
Revision: 7510
http://fudaa.svn.sourceforge.net/fudaa/?rev=7510&view=rev
Author: deniger
Date: 2012-07-18 22:23:54 +0000 (Wed, 18 Jul 2012)
Log Message:
-----------
ajout m?\195?\169thode utilitaires
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-07-18 15:37:07 UTC (rev 7509)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-07-18 22:23:54 UTC (rev 7510)
@@ -45,7 +45,6 @@
import org.fudaa.ebli.commun.EbliActionSimple;
import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.ressource.EbliResource;
-import org.geotools.math.Statistics;
/**
* Un panneau qui affiche une table de la courbe selectionne par le graphe.
@@ -60,8 +59,6 @@
private EGTableGraphePanel graphePanel;
Double newX_;
Double newY_;
- protected int xRowIndex = 0;
- protected int yRowIndex = 1;
public SpecTableModel(EGTableGraphePanel graphePanel) {
this.graphePanel = graphePanel;
@@ -493,7 +490,10 @@
}
public TableCellRenderer getDefaultRenderer(final Class _columnClass) {
- return renderer_;
+ if (Double.class.equals(_columnClass)) {
+ return renderer_;
+ }
+ return super.getDefaultRenderer(_columnClass);
}
};
t_.setDeleteAction(getActionDelete());
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-07-18 15:37:07 UTC (rev 7509)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-07-18 22:23:54 UTC (rev 7510)
@@ -14,17 +14,19 @@
/**
* Un model pour pour les courbes.
- *
+ *
* @author Fred Deniger
* @version $Id: EGTableModel.java,v 1.16 2007-05-22 14:19:04 deniger Exp $
*/
public class EGTableModel extends AbstractTableModel {
EGCourbe c_;
-
EGGraphe a_;
+ protected int xRowIndex = 0;
+ protected int yRowIndex = 1;
- public EGTableModel() {}
+ public EGTableModel() {
+ }
protected void setGraphe(final EGGraphe _a) {
a_ = _a;
@@ -58,13 +60,13 @@
}
double x = c_.getModel().getX(_rowIndex);
double y = c_.getModel().getY(_rowIndex);
- if (_columnIndex == 0) {
+ if (_columnIndex == xRowIndex) {
try {
x = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
return;
}
- } else if (_columnIndex == 1) {
+ } else if (_columnIndex == yRowIndex) {
try {
y = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
@@ -75,9 +77,9 @@
}
public void setValueAt(final double _val, final int _rowIndex, final int _columnIndex,
- final CtuluCommandContainer _cmd) {
- final double x = _columnIndex == 0 ? _val : c_.getModel().getX(_rowIndex);
- final double y = _columnIndex == 1 ? _val : c_.getModel().getY(_rowIndex);
+ final CtuluCommandContainer _cmd) {
+ final double x = _columnIndex == xRowIndex ? _val : c_.getModel().getX(_rowIndex);
+ final double y = _columnIndex == yRowIndex ? _val : c_.getModel().getY(_rowIndex);
c_.getModel().setValue(_rowIndex, x, y, _cmd);
}
@@ -91,7 +93,7 @@
protected void selectedCourbeChanged(final EGCourbe _a) {
c_ = _a;
- fireTableStructureChanged();
+ fireTableDataChanged();
}
public EGAxeHorizontal getH() {
@@ -100,9 +102,9 @@
public String getColumnName(final int _column) {
String res = CtuluLibString.ESPACE;
- if (getH() != null && _column == 0) {
+ if (getH() != null && _column == xRowIndex) {
res = getH().titre_;
- } else if (c_ != null && c_.getAxeY() != null) {
+ } else if (_column == yRowIndex && c_ != null && c_.getAxeY() != null) {
res = c_.getAxeY().titre_;
}
return (res == null || res.length() == 0) ? CtuluLibString.ESPACE : res;
@@ -141,10 +143,12 @@
if (c_ == null || h == null || (_rowIndex >= c_.getModel().getNbValues())) {
return CtuluLibString.EMPTY_STRING;
}
- if (_columnIndex == 1) {
+ if (_columnIndex == yRowIndex) {
return getY(c_.getModel().getY(_rowIndex));
}
- return getX(c_.getModel().getX(_rowIndex));
+ if (_columnIndex == xRowIndex) {
+ return getX(c_.getModel().getX(_rowIndex));
+ }
+ return CtuluLibString.EMPTY_STRING;
}
-
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-07-19 09:03:58
|
Revision: 7513
http://fudaa.svn.sourceforge.net/fudaa/?rev=7513&view=rev
Author: deniger
Date: 2012-07-19 09:03:51 +0000 (Thu, 19 Jul 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-07-18 22:31:53 UTC (rev 7512)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-07-19 09:03:51 UTC (rev 7513)
@@ -1,8 +1,6 @@
/**
- * @creation 1999-07-29
- * @modification $Date: 2007-05-22 14:19:05 $
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @creation 1999-07-29 @modification $Date: 2007-05-22 14:19:05 $ @license GNU General Public License 2 @copyright (c)1998-2001 CETMEF 2 bd Gambetta
+ * F-60231 Compiegne
*/
package org.fudaa.ebli.courbe;
@@ -37,41 +35,29 @@
public static final String PROP_EXTREMITE_VISIBLE = "axeExtremiteVisible";
public static final String PROP_TITLE_VISIBLE = "axeTitleVisible";
public static final String PROP_UNIT_VISIBLE = "axeUnitVisible";
-
public static final String PROP_GRADUATIONS = "axeGraduations";
public static final String PROP_TRACE_GRADUATIONS = "traceGraduation";
public static final String PROP_TRACE_SOUS_GRADUATIONS = "traceSousGraduation";
public static final String PROP_IS_GRID_GRADUATIONS_PAINTED = "displayGraduation";
public static final String PROP_IS_GRID_SOUS_GRADUATIONS_PAINTED = "displaySousGraduation";
-
public static final String PROP_TITLE_CENTERED = "axeTitleCentered";
public static final String PROP_BOUNDS = "axeBounds";
-
final CtuluRange range_ = new CtuluRange();
-
TickIterator axisIterator_;
-
Font font_;
-
boolean graduations_;
-
/**
* Booleen qui indique si l'on trace ou non la graduation
*/
boolean traceGrille_ = false;
-
/**
* Booleen qui indique si l'on trcae
*/
boolean traceSousGrille_ = false;
-
TraceLigneModel traceGraduations_;
TraceLigneModel traceSousGraduations_;
-
boolean isIteratorUptodate_;
-
Color lineColor_;
-
public static int MANUEL_GRADUATIONS = 0;
public static int MANUEL_LONGUEURPAS = 1;
public static int AUTO_GRADUATIONS = 2;
@@ -81,41 +67,28 @@
protected boolean isGridPainted() {
return isTraceGrille() || isTraceSousGrille();
}
-
/**
- * Mode automatique ou manuel manuel graduations calcul le meme nombre de graduations . manuel calcul les graduations
- * tous les longueur pas. automatique graduations: calcul au mieux les graduations automatique longueur pas: calcul
- * les graduations puis au mieux logarithmique.
+ * Mode automatique ou manuel manuel graduations calcul le meme nombre de graduations . manuel calcul les graduations tous les longueur pas.
+ * automatique graduations: calcul au mieux les graduations automatique longueur pas: calcul les graduations puis au mieux logarithmique.
*/
protected int modeGraduations_ = AUTO_GRADUATIONS;
/**
* Mode nb graduations
*/
int nbPas_;
-
/**
* Mode on donne la longueur des pas
*/
double longueurPas_;
-
CtuluNumberFormatI specificFormat_;
-
String titre_;
-
boolean titreVisible_ = true;
-
String unite_;
-
boolean uniteVisible_ = true;
-
CtuluValueEditorI valueEditor_;
-
boolean visible_;
-
protected boolean isExtremiteDessinee_;
-
protected boolean isTitreCentre_ = true;
-
protected TickIterator reuseIterator_;
public EGAxe() {
@@ -160,10 +133,11 @@
isTitreCentre_ = _a.isTitreCentre_;
font_ = _a.font_;
nbPas_ = _a.nbPas_;
- modeGraduations_=_a.modeGraduations_;
- longueurPas_=_a.longueurPas_;
- if(_a.specificFormat_!=null)
- specificFormat_=_a.specificFormat_.getCopy();
+ modeGraduations_ = _a.modeGraduations_;
+ longueurPas_ = _a.longueurPas_;
+ if (_a.specificFormat_ != null) {
+ specificFormat_ = _a.specificFormat_.getCopy();
+ }
if (_a.traceGraduations_ != null) {
traceGraduations_ = new TraceLigneModel(_a.traceGraduations_);
}
@@ -175,12 +149,16 @@
/**
* Peut retour l'iterateur principal: ne pas faire de init.
- *
+ *
* @return un iterateur a jour.
*/
private TickIterator getUpdatedTickIterator() {
- if (axisIterator_ == null) { return buildUpToDateMainTickIterator(); }
- if (isIteratorUptodate_) { return axisIterator_; }
+ if (axisIterator_ == null) {
+ return buildUpToDateMainTickIterator();
+ }
+ if (isIteratorUptodate_) {
+ return axisIterator_;
+ }
try {
TickIterator r = null;
if (reuseIterator_ != null && reuseIterator_.getClass().equals(axisIterator_.getClass())) {
@@ -197,7 +175,6 @@
}
return null;
}
-
/**
* nombre de sous graduations
*/
@@ -256,7 +233,7 @@
/**
* Modifie la propriete extremite dessinee.
- *
+ *
* @param _isExtremiteDessinee
*/
final boolean setExtremiteDessinee(final boolean _isExtremiteDessinee) {
@@ -285,26 +262,25 @@
}
protected void firePropertyChange(final String _prop) {
- /*
- * if (listener_ != null) { listener_.firePropertyChange(_prop, false, true); }
- */
+ /*
+ * if (listener_ != null) { listener_.firePropertyChange(_prop, false, true); }
+ */
}
protected void firePropertyChange(final String _prop, final Object _old, final Object _new) {
- /*
- * if (listener_ != null) { listener_.firePropertyChange(_prop, _old, _new); }
- */
+ /*
+ * if (listener_ != null) { listener_.firePropertyChange(_prop, _old, _new); }
+ */
}
protected void firePropertyChange(final String _prop, final boolean _new) {
- /*
- * if (listener_ != null) { listener_.firePropertyChange(_prop, !_new, _new); }
- */
+ /*
+ * if (listener_ != null) { listener_.firePropertyChange(_prop, !_new, _new); }
+ */
}
/**
- * Met a jour l'iterateur reutilisable. Faire attention lorsque on parcourt cet iterateur: Acces concurrents non
- * geres.
+ * Met a jour l'iterateur reutilisable. Faire attention lorsque on parcourt cet iterateur: Acces concurrents non geres.
*/
protected void updateReuseIterator() {
// on cree si necessaire l'iterateur principal pour le cloner.
@@ -312,7 +288,9 @@
buildUpToDateMainTickIterator();
}
// prob on laisse tomber
- if (axisIterator_ == null) { return; }
+ if (axisIterator_ == null) {
+ return;
+ }
// le reuse iterateur n'est pas correct: on clone le principal
if (reuseIterator_ == null || (!reuseIterator_.getClass().equals(axisIterator_.getClass()))) {
try {
@@ -329,9 +307,8 @@
}
/**
- * Permet d'ajuster les bornes de cet axe par rapport � _a : si le min de _a est inf au min de cet axe, le this.min
- * est modifie.
- *
+ * Permet d'ajuster les bornes de cet axe par rapport � _a : si le min de _a est inf au min de cet axe, le this.min est modifie.
+ *
* @param _a l'axe a ajuster
*/
public void adjustBounds(final EGAxe _a) {
@@ -381,7 +358,6 @@
/*
* public double getPas(){ return getInitializedTickIterator().getIncrement(); }
*/
-
public double getMinimum() {
return range_.isNill() ? 0 : range_.getMin();
}
@@ -394,7 +370,9 @@
}
public double getPositionFromValue(final double _v) {
- if (axisIterator_ == null) { return _v; }
+ if (axisIterator_ == null) {
+ return _v;
+ }
return axisIterator_.getPositionFromValue(_v);
}
@@ -407,7 +385,9 @@
* @return la chaine a utiliser pour l'affichage
*/
public String getStringAffiche(final double _val) {
- if (specificFormat_ != null) { return specificFormat_.format(_val); }
+ if (specificFormat_ != null) {
+ return specificFormat_.format(_val);
+ }
return getUpdatedTickIterator().formatValue(_val);
}
@@ -416,7 +396,9 @@
* @return la chaine a utiliser pour l'affichage de valeur interpolee
*/
public String getStringInterpolatedAffiche(final double _val) {
- if (specificFormat_ != null) { return specificFormat_.format(_val); }
+ if (specificFormat_ != null) {
+ return specificFormat_.format(_val);
+ }
return getUpdatedTickIterator().formatSubValue(_val);
}
@@ -436,7 +418,9 @@
}
public double getValueFromPosition(final double _v) {
- if (axisIterator_ == null) { return _v; }
+ if (axisIterator_ == null) {
+ return _v;
+ }
return axisIterator_.getValueFromPosition(_v);
}
@@ -444,10 +428,9 @@
return graduations_;
}
-
public boolean isLogarithmique() {
return axisIterator_ != null
- && (axisIterator_ instanceof LogarithmicNumberIterator || modeGraduations_ == LOGARITHMIQUE);
+ && (axisIterator_ instanceof LogarithmicNumberIterator || modeGraduations_ == LOGARITHMIQUE);
}
@@ -469,7 +452,6 @@
return visible_;
}
-
public final void setAxisIterator(final TickIterator _axisIterator) {
axisIterator_ = _axisIterator;
isIteratorUptodate_ = false;
@@ -497,7 +479,7 @@
/**
* SetBounds versions nombre de graduations
- *
+ *
* @param _min
* @param _max
* @param _nbPas
@@ -532,7 +514,7 @@
nbPas_ = TickIterator.DEFAULT_STICK_NUMBER;
}
if (oldPas != nbPas_ || Double.doubleToLongBits(oldMin) != Double.doubleToLongBits(range_.min_)
- || Double.doubleToLongBits(oldMax) != Double.doubleToLongBits(range_.max_) || oldMode != modeGraduations_) {
+ || Double.doubleToLongBits(oldMax) != Double.doubleToLongBits(range_.max_) || oldMode != modeGraduations_) {
isIteratorUptodate_ = false;
firePropertyChange(PROP_BOUNDS);
return true;
@@ -543,7 +525,7 @@
/**
* SetBounds versions nombre de graduations
- *
+ *
* @param _min
* @param _max
* @param _nbPas
@@ -583,7 +565,7 @@
nbPas_ = TickIterator.DEFAULT_STICK_NUMBER;
}
if (oldLongPas != longueurPas_ || Double.doubleToLongBits(oldMin) != Double.doubleToLongBits(range_.min_)
- || Double.doubleToLongBits(oldMax) != Double.doubleToLongBits(range_.max_) || oldMode != modeGraduations_) {
+ || Double.doubleToLongBits(oldMax) != Double.doubleToLongBits(range_.max_) || oldMode != modeGraduations_) {
isIteratorUptodate_ = false;
firePropertyChange(PROP_BOUNDS);
return true;
@@ -612,7 +594,6 @@
}
// }
-
public boolean setLineColor(final Color _lineColor) {
if (lineColor_ != _lineColor) {
final Color old = lineColor_;
@@ -669,7 +650,21 @@
}
return false;
}
+ boolean titleModifiable = true;
+ boolean uniteModifiable = true;
+ public void setTitleModifiable(boolean titleModifiable) {
+ this.titleModifiable = titleModifiable;
+ }
+
+ public boolean isUniteModifiable() {
+ return uniteModifiable;
+ }
+
+ public void setUniteModifiable(boolean uniteModifiable) {
+ this.uniteModifiable = uniteModifiable;
+ }
+
public boolean isTitleModifiable() {
return false;
}
@@ -698,8 +693,7 @@
public boolean setTraceGrille(final boolean traceGrille) {
if (this.traceGrille_ != traceGrille) {
this.traceGrille_ = traceGrille;
- firePropertyChange(PROP_IS_GRID_GRADUATIONS_PAINTED, Boolean.valueOf(!traceGrille_), Boolean
- .valueOf(traceGrille_));
+ firePropertyChange(PROP_IS_GRID_GRADUATIONS_PAINTED, Boolean.valueOf(!traceGrille_), Boolean.valueOf(traceGrille_));
return true;
}
return false;
@@ -712,8 +706,7 @@
public boolean setTraceSousGrille(final boolean traceSousGrille) {
if (traceSousGrille != traceSousGrille_) {
this.traceSousGrille_ = traceSousGrille;
- firePropertyChange(PROP_IS_GRID_SOUS_GRADUATIONS_PAINTED, Boolean.valueOf(!traceSousGrille_), Boolean
- .valueOf(traceSousGrille_));
+ firePropertyChange(PROP_IS_GRID_SOUS_GRADUATIONS_PAINTED, Boolean.valueOf(!traceSousGrille_), Boolean.valueOf(traceSousGrille_));
return true;
}
return false;
@@ -749,7 +742,9 @@
* @param traceGraduations the traceGraduations_ to set
*/
public boolean setTraceGraduations(final TraceLigneModel traceGraduations) {
- if (traceGraduations == null) { return false; }
+ if (traceGraduations == null) {
+ return false;
+ }
if (!traceGraduations.equals(traceGraduations_)) {
traceGraduations_.updateData(traceGraduations);
firePropertyChange(PROP_TRACE_GRADUATIONS, Boolean.TRUE, Boolean.FALSE);
@@ -769,7 +764,9 @@
* @param traceSousGraduations the traceSousGraduations_ to set
*/
public boolean setTraceSousGraduations(final TraceLigneModel traceSousGraduations) {
- if (traceSousGraduations == null) { return false; }
+ if (traceSousGraduations == null) {
+ return false;
+ }
if (!traceSousGraduations.equals(traceSousGraduations_)) {
traceSousGraduations_.updateData(traceSousGraduations);
firePropertyChange(PROP_TRACE_SOUS_GRADUATIONS, Boolean.TRUE, Boolean.FALSE);
@@ -777,5 +774,4 @@
}
return false;
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2012-07-18 22:31:53 UTC (rev 7512)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2012-07-19 09:03:51 UTC (rev 7513)
@@ -66,16 +66,14 @@
* @version $Id: EGAxeRepereConfigurator.java,v 1.12 2007-05-04 13:49:41 deniger Exp $
*/
public class EGAxeRepereConfigurator extends BuPanel implements ActionListener, BuBorders, KeyListener,
- BSelecteurTargetInterface {
+ BSelecteurTargetInterface {
private final static CtuluValueEditorI DEFAULT_EDITOR = CtuluValueEditorDefaults.DOUBLE_EDITOR;
-
public static String GRILLE_AXE_X = "GRILLE_AXE_X";
-
public static String GRILLE_AXE_Y = "GRILLE_AXE_Y";
public static String SOUS_GRILLE_AXE_X = "SOUS_GRILLE_AXE_X";
-
public static String SOUS_GRILLE_AXE_Y = "SOUS_GRILLE_AXE_Y";
+
private static JPanel createPanel(JComponent... components) {
JPanel pn = new JPanel(new BuGridLayout(components.length, 1, 1, true, true));
for (JComponent jComponent : components) {
@@ -83,15 +81,16 @@
}
return pn;
}
+
protected static void initPanel(final JPanel _p, final String _title) {
_p.setLayout(new BuGridLayout(2, 5, 5));
_p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(
- BorderFactory.createEtchedBorder(), _title), EMPTY2222));
+ BorderFactory.createEtchedBorder(), _title), EMPTY2222));
}
/**
* Rend les largeurs des labels homog\xE8nes.
- *
+ *
* @param _p un panneau contenant des panneaux contenant des labels en premiere ligne
*/
public static void updateLabelWidth(final JPanel _p) {
@@ -122,70 +121,54 @@
BuCheckBox axeYVisible;
BuCheckBox boxAfficheGraduationsX_ = new BuCheckBox(EbliLib.getS("Afficher la grille"));
BuCheckBox boxAfficheGraduationsY_ = new BuCheckBox(EbliLib.getS("Afficher la grille"));
-
BuCheckBox boxAfficheSousGraduationsX_ = new BuCheckBox(EbliLib.getS("Afficher la sous grille"));
-
BuCheckBox boxAfficheSousGraduationsY_ = new BuCheckBox(EbliLib.getS("Afficher la sous grille"));
-
private BuCheckBox boxChooserUserLimitY;
private BuCheckBox boxChooseUserLimitX_;
private BuCheckBox cbInitialConf_;
// private BuCheckBox cbUnblockBlockHView_;
private BuCheckBox cbUseSameAxe_;
-
BuComboBox comboHorizontal_ = null;
BuComboBox comboVertical_ = null;
private CtuluValueEditorI editorH_;
private CtuluValueEditorI editorV_;
private final CtuluNumberFormatFixedFigure formatter = new CtuluNumberFormatFixedFigure(6);
private final EGGraphe graphe_;
-
private Map mapRangesY_ = null;
/**
- * 4 mode pour les graduations: 0: mode manuel graduations 1: mode manuel longueurs de pas 2: mode automatique
- * graduations 3: mode automatique longueurs de pas
+ * 4 mode pour les graduations: 0: mode manuel graduations 1: mode manuel longueurs de pas 2: mode automatique graduations 3: mode automatique
+ * longueurs de pas
*/
public int modeGraduationX_ = EGAxe.AUTO_GRADUATIONS;
/**
- * 4 mode pour les graduations: 0: mode manuel graduations 1: mode manuel longueurs de pas 2: mode automatique
- * graduations 3: mode automatique longueurs de pas
+ * 4 mode pour les graduations: 0: mode manuel graduations 1: mode manuel longueurs de pas 2: mode automatique graduations 3: mode automatique
+ * longueurs de pas
*/
public int modeGraduationY_ = EGAxe.AUTO_GRADUATIONS;
BSelecteurLineModel modelGraduationsX_;
BSelecteurLineModel modelGraduationsY_;
-
BSelecteurLineModel modelSousGraduationsX_;
-
BSelecteurLineModel modelSousGraduationsY_;
-
private final BuPanel pnAxeX;
-
private final BuPanel pnAxeY_;
-
EGObject[] targets_;
-
private JComponent tfHorMax_;
-
private JComponent tfHorMin_;
private BuTextField tfHorPas_;
-
private BuTextField tfHorSousPas_;
private JComponent tfVertMax_;
private JComponent tfVertMin_;
private BuTextField tfVertPas_;
-
private BuTextField tfVertSousPas_;
private BuTextField titreAxeXNom;
BuCheckBox titreAxeXVisible;
private BuTextField titreAxeYNom;
-
BuCheckBox titreAxeYVisible;
private BuTextField uniteAxeXNom;
-
BuCheckBox uniteAxeXVisible;
private BuTextField uniteAxeY_;
-
BuCheckBox uniteAxeYVisible;
+
public EGAxeRepereConfigurator(final EGGraphe _m) {
graphe_ = _m;
// -- on recupere les valeurs des y --//
@@ -224,8 +207,8 @@
btValid.setMnemonic(KeyEvent.VK_A);
btValid.addActionListener(this);
add(bt);
- final EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI
- .getIcon("restore"), "RESTORE") {
+ final EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI.getIcon("restore"), "RESTORE") {
+
@Override
public void actionPerformed(final ActionEvent _e) {
// -- on reinitialise les mioin/max saisi par l'user --//
@@ -243,12 +226,15 @@
EGAxeRepereConfigurator.updateLabelWidth(this);
}
+
public void actionPerformed(final ActionEvent _e) {
apply();
}
protected void apply() {
- if ((axes_ == null && axeX_ == null)) { return; }
+ if ((axes_ == null && axeX_ == null)) {
+ return;
+ }
// un seul | pour forcer l'appel aux deux methodes
// normal ....
if (applyVertical() | applyHorizontal()) {
@@ -295,7 +281,7 @@
if (pasEdited) {
if (modeGraduationX_ == EGAxe.MANUEL_GRADUATIONS || modeGraduationX_ == EGAxe.AUTO_GRADUATIONS
- || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
+ || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
r = axeX_.setBounds(minVal, maxVal, (int) pasVal, modeGraduationX_);
} else if (modeGraduationX_ == EGAxe.MANUEL_LONGUEURPAS || modeGraduationX_ == EGAxe.AUTO_LONGUEURPAS) {
r = axeX_.setBounds(minVal, maxVal, pasVal, modeGraduationX_);
@@ -375,7 +361,9 @@
private boolean applyVertical() {
boolean r = false;
- if (CtuluLibArray.isEmpty(axes_)) { return false; }
+ if (CtuluLibArray.isEmpty(axes_)) {
+ return false;
+ }
double maxVal = 0;
double minVal = 0;
boolean minEdited = false;
@@ -428,7 +416,6 @@
if (!minEdited || !boxChooserUserLimitY.isSelected()) {
min = axe.getMinimum();
} else {
-
}
if (!maxEdited || !boxChooserUserLimitY.isSelected()) {
max = axe.getMaximum();
@@ -446,7 +433,7 @@
if (pasModif) {
if (modeGraduationY_ == EGAxe.MANUEL_GRADUATIONS || modeGraduationY_ == EGAxe.AUTO_GRADUATIONS
- || modeGraduationY_ == EGAxe.LOGARITHMIQUE) {
+ || modeGraduationY_ == EGAxe.LOGARITHMIQUE) {
r |= axe.setBounds(min, max, (int) pasVal, modeGraduationY_);
} else if (modeGraduationY_ == EGAxe.MANUEL_LONGUEURPAS || modeGraduationY_ == EGAxe.AUTO_LONGUEURPAS) {
r |= axe.setBounds(min, max, pasVal, modeGraduationY_);
@@ -560,7 +547,7 @@
tfHorPas_.addKeyListener(this);
if (axeX_.getModeGraduations() == EGAxe.AUTO_GRADUATIONS || modeGraduationX_ == EGAxe.MANUEL_GRADUATIONS
- || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
+ || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
tfHorPas_.setText("" + axeX_.nbPas_);
} else if (axeX_.getModeGraduations() == EGAxe.AUTO_LONGUEURPAS || modeGraduationX_ == EGAxe.MANUEL_LONGUEURPAS) {
tfHorPas_.setText("" + axeX_.longueurPas_);
@@ -611,25 +598,25 @@
pnAxeX.add(new BuLabel());
if (boxChooseUserLimitX_ == null) {
boxChooseUserLimitX_ = new BuCheckBox(EbliLib.getS("Affiche uniquement jusqu'aux limites"));
- boxChooseUserLimitX_.setToolTipText(EbliLib
- .getS("Si s\xE9lectionn\xE9, les donn\xE9es de la courbe ne pourront d\xE9passer les valeurs pr\xE9c\xE9dentes"));
+ boxChooseUserLimitX_.setToolTipText(EbliLib.getS("Si s\xE9lectionn\xE9, les donn\xE9es de la courbe ne pourront d\xE9passer les valeurs pr\xE9c\xE9dentes"));
}
pnAxeX.add(boxChooseUserLimitX_);
boxChooseUserLimitX_.setSelected(true);
// -- selection du type de graduations
if (comboHorizontal_ == null) {
- comboHorizontal_ = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"),
- EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
- EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique") });
+ comboHorizontal_ = new BuComboBox(new String[]{EbliLib.getS("Manuel: Nombre de graduations"),
+ EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
+ EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")});
lb = new BuLabel(typePasTxt);
// -- listener de la combo --//
comboHorizontal_.addActionListener(new ActionListener() {
+
public void actionPerformed(final ActionEvent e) {
modeGraduationX_ = comboHorizontal_.getSelectedIndex();
if (modeGraduationX_ == EGAxe.AUTO_GRADUATIONS || modeGraduationX_ == EGAxe.AUTO_LONGUEURPAS
- || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
+ || modeGraduationX_ == EGAxe.LOGARITHMIQUE) {
tfHorSousPas_.setEnabled(false);
} else {
tfHorSousPas_.setEnabled(true);
@@ -645,7 +632,6 @@
// graphe_.axeUpdated();
}
-
});
}
@@ -684,8 +670,8 @@
final String pasTxt = EbliLib.getS("Graduation:");
final String tooltipPas = EbliLib.getS("Nombre maximal de graduations principales");
final String tooltipTxt = "<html>"
- + EbliLib.getS("Si plusieurs axes sont s\xE9lectionn\xE9s, ce champ est vide si les valeurs ne sont pas identiques")
- + "<br>" + EbliLib.getS("Utiliser une valeur vide pour garder la valeur initiale") + "</html>";
+ + EbliLib.getS("Si plusieurs axes sont s\xE9lectionn\xE9s, ce champ est vide si les valeurs ne sont pas identiques")
+ + "<br>" + EbliLib.getS("Utiliser une valeur vide pour garder la valeur initiale") + "</html>";
// les textes fields
if (editorV_ == null) {
tfVertMax_ = new BuLabel(EbliLib.getS("Non \xE9ditable"));
@@ -731,8 +717,8 @@
axeYVisible = new BuCheckBox();
}
- titreAxeYNom.setEnabled(enabled);
- uniteAxeYVisible.setEnabled(enabled);
+ titreAxeYNom.setEnabled(enabled && axeChoisi.isTitleModifiable());
+ uniteAxeYVisible.setEnabled(enabled && axeChoisi.isUniteModifiable());
axeYVisible.setEnabled(enabled);
uniteAxeY_.setEnabled(enabled);
if (enabled) {
@@ -766,8 +752,7 @@
pnAxeY_.add(new BuLabel());
if (boxChooserUserLimitY == null) {
boxChooserUserLimitY = new BuCheckBox(EbliLib.getS("Affiche uniquement jusqu'aux limites"));
- boxChooserUserLimitY.setToolTipText(EbliLib
- .getS("Si s\xE9lectionn\xE9, les donn\xE9es de la courbe ne pourront d\xE9passer les valeurs pr\xE9c\xE9dentes"));
+ boxChooserUserLimitY.setToolTipText(EbliLib.getS("Si s\xE9lectionn\xE9, les donn\xE9es de la courbe ne pourront d\xE9passer les valeurs pr\xE9c\xE9dentes"));
}
pnAxeY_.add(boxChooserUserLimitY);
boxChooserUserLimitY.setSelected(true);
@@ -778,9 +763,10 @@
// pnAxeV_.add(lb);
// -- selection du type de graduations
- comboVertical_ = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"),
- EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
- EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique") }) {
+ comboVertical_ = new BuComboBox(new String[]{EbliLib.getS("Manuel: Nombre de graduations"),
+ EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
+ EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")}) {
+
public void setSelectedIndex(int anIndex) {
super.setSelectedIndex(anIndex);
@@ -794,10 +780,10 @@
pnAxeY_.add(tfVertSousPas_);
// -- listener de la combo --//
comboVertical_.addActionListener(new ActionListener() {
+
public void actionPerformed(final ActionEvent e) {
updateModeGraduationForY();
}
-
});
updateModeGraduationForY();
if (axeChoisi == null && axes_ != null && axes_.length > 0) {
@@ -843,8 +829,7 @@
// same axis
if (cbUseSameAxe_ == null) {
cbUseSameAxe_ = new BuCheckBox(EbliLib.getS("Utiliser le m\xEAme axe"));
- cbUseSameAxe_
- .setToolTipText(EbliLib.getS("Si s\xE9lectionn\xE9, toutes courbes s\xE9lectionn\xE9es utiliseront le m\xEAme axe"));
+ cbUseSameAxe_.setToolTipText(EbliLib.getS("Si s\xE9lectionn\xE9, toutes courbes s\xE9lectionn\xE9es utiliseront le m\xEAme axe"));
// cbUseSameAxe_.addItemListener(this);
}
pnAxeY_.add(new BuLabel());
@@ -852,8 +837,7 @@
// configuration initiale
if (cbInitialConf_ == null) {
cbInitialConf_ = new BuCheckBox(EbliLib.getS("Axes: configuration intiale"));
- cbInitialConf_.setToolTipText(EbliLib
- .getS("Si s\xE9lectionn\xE9, la configuration initiale des axes s\xE9lectionn\xE9s sera r\xE9tablie"));
+ cbInitialConf_.setToolTipText(EbliLib.getS("Si s\xE9lectionn\xE9, la configuration initiale des axes s\xE9lectionn\xE9s sera r\xE9tablie"));
// cbInitialConf_.addItemListener(this);
}
pnAxeY_.add(new BuLabel());
@@ -875,10 +859,11 @@
});
}
titreAxeXVisible.setSelected(axeX_.titreVisible_);
+
if (axeX_.titre_ != null) {
titreAxeXNom.setText(axeX_.titre_);
}
- titreAxeXNom.setEnabled(titreAxeXVisible.isSelected());
+ titreAxeXNom.setEnabled(titreAxeXVisible.isSelected() && axeX_.isTitleModifiable());
}
private void createAxeXUnitComponents() {
@@ -897,7 +882,7 @@
}
uniteAxeXVisible.setSelected(axeX_.uniteVisible_);
- uniteAxeXNom.setEnabled(uniteAxeXVisible.isSelected());
+ uniteAxeXNom.setEnabled(uniteAxeXVisible.isSelected() && axeX_.isUniteModifiable());
if (axeX_.unite_ != null) {
uniteAxeXNom.setText(axeX_.unite_);
}
@@ -912,10 +897,10 @@
titreAxeYVisible = new BuCheckBox();
titreAxeYVisible.setToolTipText(EbliLib.getS("Affichage ou non du titre de l'axe"));
titreAxeYVisible.addActionListener(new ActionListener() {
+
public void actionPerformed(ActionEvent e) {
titreAxeYNom.setEnabled(titreAxeYVisible.isSelected());
}
-
});
}
}
@@ -929,10 +914,10 @@
uniteAxeYVisible = new BuCheckBox();
uniteAxeYVisible.setToolTipText(EbliLib.getS("Affichage ou non de l'unit\xE9"));
uniteAxeYVisible.addActionListener(new ActionListener() {
+
public void actionPerformed(ActionEvent e) {
uniteAxeY_.setEnabled(uniteAxeYVisible.isSelected());
}
-
});
}
}
@@ -965,7 +950,7 @@
private String getPas(EGAxeVertical firstAxe) {
if (firstAxe.getModeGraduations() == EGAxe.AUTO_GRADUATIONS
- || firstAxe.getModeGraduations() == EGAxe.MANUEL_GRADUATIONS) {
+ || firstAxe.getModeGraduations() == EGAxe.MANUEL_GRADUATIONS) {
return CtuluLibString.getString(firstAxe.getNbPas());
} else {
return Double.toString(firstAxe.longueurPas_);
@@ -973,8 +958,12 @@
}
public Object getProperty(final String _key) {
- if (_key.equals(GRILLE_AXE_X)) { return axeX_.traceGraduations_; }
- if (_key.equals(SOUS_GRILLE_AXE_X)) { return axeX_.traceSousGraduations_; }
+ if (_key.equals(GRILLE_AXE_X)) {
+ return axeX_.traceGraduations_;
+ }
+ if (_key.equals(SOUS_GRILLE_AXE_X)) {
+ return axeX_.traceSousGraduations_;
+ }
EGAxe axeChoisi = null;
if (graphe_.getSelectedComponent() != null) {
@@ -988,13 +977,18 @@
// if(axes_==null || axes_.length==0)
return null;
}
- if (_key.equals(GRILLE_AXE_Y)) { return axeChoisi.traceGraduations_; }
- if (_key.equals(SOUS_GRILLE_AXE_Y)) { return axeChoisi.traceSousGraduations_; }
+ if (_key.equals(GRILLE_AXE_Y)) {
+ return axeChoisi.traceGraduations_;
+ }
+ if (_key.equals(SOUS_GRILLE_AXE_Y)) {
+ return axeChoisi.traceSousGraduations_;
+ }
return null;
}
- public void keyPressed(final KeyEvent _e) {}
+ public void keyPressed(final KeyEvent _e) {
+ }
public void keyReleased(final ...
[truncated message content] |
|
From: <de...@us...> - 2012-07-19 15:21:42
|
Revision: 7515
http://fudaa.svn.sourceforge.net/fudaa/?rev=7515&view=rev
Author: deniger
Date: 2012-07-19 15:21:31 +0000 (Thu, 19 Jul 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-07-19 09:08:41 UTC (rev 7514)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-07-19 15:21:31 UTC (rev 7515)
@@ -11,6 +11,7 @@
*/
package org.fudaa.ebli.courbe;
+import com.memoire.bu.BuLib;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -126,7 +127,6 @@
if (traceSousGrille_) {
traceSousGraduations.dessineTrait(_g, xe, y, xe, yMaxGrad);
} else {
-
}
}
}
@@ -137,9 +137,9 @@
}
/**
- * Appelee uniquement si isIntegerStep est true: permet de donner une repr\xE9sentation specifique pour la graduation
- * passee en parametres. Par defaut, l'entier est traduit en string.
- *
+ * Appelee uniquement si isIntegerStep est true: permet de donner une repr\xE9sentation specifique pour la graduation passee en parametres. Par defaut,
+ * l'entier est traduit en string.
+ *
* @param _i la graduation a dessiner
* @return la chaine representant cette graduation
*/
@@ -173,12 +173,14 @@
/**
* Dessine l'axe horizontal.
- *
+ *
* @param _g le graphics cible
* @param _f le repere
*/
public void dessine(final Graphics2D _g, final EGRepere _f) {
- if (!visible_) { return; }
+ if (!visible_) {
+ return;
+ }
final Font old = _g.getFont();
if (font_ != null) {
_g.setFont(font_);
@@ -215,7 +217,11 @@
_g.setColor(lineColor_);
int width = 0;
- final FontMetrics fm = _g.getFontMetrics(getFont());
+ Font font = getFont();
+ if (font == null) {
+ font = BuLib.DEFAULT_FONT;
+ }
+ final FontMetrics fm = _g.getFontMetrics(font);
if (isTitreCentre_) {
String txt = t;
if (unit != null) {
@@ -257,8 +263,10 @@
public int getBottomHeightNeeded(final Graphics2D _g) {
// epaisseur trait
int r = 3;
- if (_g == null) { return r; }
- if (graduations_ || isGridPainted()){
+ if (_g == null) {
+ return r;
+ }
+ if (graduations_ || isGridPainted()) {
if (font_ == null) {
font_ = EGGraphe.DEFAULT_FONT;
}
@@ -273,7 +281,6 @@
return r;
}
-
/**
* @param _g le graphics dessine
* @return l'espace requis a droite de l'axe
@@ -303,7 +310,9 @@
*/
@Override
public String getStringAffiche(final double _val) {
- if (specificFormat_ != null) { return specificFormat_.format(_val); }
+ if (specificFormat_ != null) {
+ return specificFormat_.format(_val);
+ }
return super.getStringAffiche(_val);
}
@@ -312,15 +321,13 @@
}
/**
- * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est effectuee en consequence: seul des
- * entiers sont dessin\xE9s.
- *
+ * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est effectuee en consequence: seul des entiers sont dessin\xE9s.
+ *
* @return true si la graduation est faite par palier.
*/
/*
* public final boolean isIntegerStep(){ return isIntegerStep_; }
*/
-
@Override
public final boolean isVertical() {
return false;
@@ -347,10 +354,8 @@
* @param _isIntegerStep si la graduation est faite par palier.
*/
/*
- * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = _isIntegerStep; if(axisIterator_!=null)
- * axisIterator_=null; }
+ * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = _isIntegerStep; if(axisIterator_!=null) axisIterator_=null; }
*/
-
public EGAxeHorizontal duplicate() {
final EGAxeHorizontal duplic = new EGAxeHorizontal(this);
@@ -372,5 +377,4 @@
duplic.nbSousGraduations_ = nbSousGraduations_;
return duplic;
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2012-07-19 09:08:41 UTC (rev 7514)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2012-07-19 15:21:31 UTC (rev 7515)
@@ -910,13 +910,18 @@
titreAxeYVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- EGAxe selectedAxeY = getSelectedAxeY();
- titreAxeYNom.setEnabled(titreAxeYVisible.isSelected() && selectedAxeY != null && selectedAxeY.isTitleModifiable());
+ updateTitreAxeY();
}
});
}
+ updateTitreAxeY();
}
+ protected void updateTitreAxeY() {
+ EGAxe selectedAxeY = getSelectedAxeY();
+ titreAxeYNom.setEnabled(titreAxeYVisible.isSelected() && selectedAxeY != null && selectedAxeY.isTitleModifiable());
+ }
+
private void createAxeYUnitComponents() {
if (uniteAxeY_ == null) {
uniteAxeY_ = new BuTextField();
@@ -928,13 +933,18 @@
uniteAxeYVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- EGAxe selectedAxeY = getSelectedAxeY();
- uniteAxeY_.setEnabled(uniteAxeYVisible.isSelected() && selectedAxeY != null && selectedAxeY.isUniteModifiable());
+ updateUniteAxeY();
}
});
}
+ updateUniteAxeY();
}
+ protected void updateUniteAxeY() {
+ EGAxe selectedAxeY = getSelectedAxeY();
+ uniteAxeY_.setEnabled(uniteAxeYVisible.isSelected() && selectedAxeY != null && selectedAxeY.isUniteModifiable());
+ }
+
private BuLabel createTitleNameLabel() {
return new BuLabel(EbliResource.EBLI.getString("Nom du titre"));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-08-22 10:00:04
|
Revision: 7566
http://fudaa.svn.sourceforge.net/fudaa/?rev=7566&view=rev
Author: deniger
Date: 2012-08-22 09:59:53 +0000 (Wed, 22 Aug 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-08-21 15:06:50 UTC (rev 7565)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-08-22 09:59:53 UTC (rev 7566)
@@ -7,7 +7,7 @@
import org.fudaa.ctulu.CtuluAnalyze;
import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
-public abstract class EGCourbePersistBuilder<T extends EGCourbeChild> extends EGPersistBuilder<T, EGCourbePersist> {
+public abstract class EGCourbePersistBuilder<T extends EGCourbe> extends EGPersistBuilder<T, EGCourbePersist> {
public static final String GROUPE_KEY = "GROUPE";
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-08-21 15:06:50 UTC (rev 7565)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-08-22 09:59:53 UTC (rev 7566)
@@ -40,6 +40,14 @@
_table.put(pre + EbliLib.getS("Borne max"), axe.getStringAffiche(axe.getMaximum()));
}
+ public void initGraphicConfigurationFrom(EGCourbeSimple courbe) {
+ EGCourbeSimplePersistBuilderDefault builder = new EGCourbeSimplePersistBuilderDefault();
+ EGCourbePersist createPersistUnit = builder.persistGraphicsData(courbe);
+ if (createPersistUnit != null) {
+ builder.initGraphicConfiguration(this, createPersistUnit);
+ }
+ }
+
boolean setYaxe(final EGAxeVertical _v) {
if (_v != v_) {
v_ = _v;
Copied: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java (from rev 7534, trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilderDefault.java)
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java 2012-08-22 09:59:53 UTC (rev 7566)
@@ -0,0 +1,18 @@
+package org.fudaa.ebli.courbe;
+
+import java.util.Map;
+
+import org.fudaa.ctulu.CtuluAnalyze;
+
+/**
+ * Attention pas compl\xE8tement impl\xE9ment\xE9.
+ *
+ * @author Frederic Deniger
+ */
+public class EGCourbeSimplePersistBuilderDefault extends EGCourbePersistBuilder<EGCourbeSimple> {
+
+ @Override
+ protected EGCourbeSimple createEGObject(EGCourbePersist target, Map params, CtuluAnalyze log) {
+ return null;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-08-30 14:50:44
|
Revision: 7593
http://fudaa.svn.sourceforge.net/fudaa/?rev=7593&view=rev
Author: deniger
Date: 2012-08-30 14:50:33 +0000 (Thu, 30 Aug 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeChild.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2012-08-30 06:20:42 UTC (rev 7592)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2012-08-30 14:50:33 UTC (rev 7593)
@@ -55,41 +55,28 @@
/**
* Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre croissant.
- *
+ *
* @author deniger
* @version $Id: EGCourbe.java,v 1.32 2007-05-22 14:19:05 deniger Exp $
*/
public abstract class EGCourbe extends EGObject {
private int alpha_ = 255;
-
private final TraceLigneModel lineModel_;
-
// private double[] markH_;
-
/**
* la liste des valeurs marquees
*/
private List<EGCourbeMarqueur> listeMarqueurs_ = null;
-
private boolean markMaxLine_;
-
private boolean markMinLine_;
-
private EGModel model_;
-
private TraceLigneModel tLigneMarqueur_;
-
boolean displayTitleOnCurve_;
-
boolean displayPointLabels_;
-
Font font_ = CtuluLibSwing.getMiniFont();
-
final TraceIconModel iconeModel_;
-
EGCourbeSurfacePainter surfacePainter_;
-
TraceBox tbox_;
TraceBox tboxLabels_;
@@ -102,13 +89,11 @@
model_ = _model;
}
-
- public Collection<EGCourbe> getAssociatesCourbesForExport(){
+
+ public Collection<EGCourbe> getAssociatesCourbesForExport() {
return Collections.emptyList();
}
-
-
private void buildLigneMarqueur() {
if (tLigneMarqueur_ == null) {
tLigneMarqueur_ = new TraceLigneModel();
@@ -117,6 +102,10 @@
}
}
+ public abstract EGCourbePersist getPersitUiConfig();
+
+ public abstract void applyPersitUiConfig(EGCourbePersist persist);
+
private TraceLigne getLineMarkeur() {
buildLigneMarqueur();
final TraceLigne trMarqueur = new TraceLigne(new TraceLigneModel(tLigneMarqueur_));
@@ -143,8 +132,8 @@
}
private void initLabelsTraceBox(Color _c) {
- if (tboxLabels_==null) {
- tboxLabels_=new TraceBox();
+ if (tboxLabels_ == null) {
+ tboxLabels_ = new TraceBox();
tboxLabels_.setColorFond(Color.WHITE);
tboxLabels_.setHMargin(1);
tboxLabels_.setVMargin(1);
@@ -215,27 +204,28 @@
final int yie = _t.getYEcran(marqueur.getValue(), axeY);
int x = xmin + 3;
final String str;
- if (marqueur.getTitle()!=null)
- str=marqueur.getTitle();
- else
- str=axeY.getStringAffiche(marqueur.getValue());
-
+ if (marqueur.getTitle() != null) {
+ str = marqueur.getTitle();
+ } else {
+ str = axeY.getStringAffiche(marqueur.getValue());
+ }
+
if (axeY.isDroite()) {
x = xmax - 6 - _g.getFontMetrics().stringWidth(str);
}
new TraceLigne(marqueur.model_).dessineTrait(_g, xmin, yie, xmax, yie);
tbox_.paintBox(_g, x, yie, str);
- }
- // -- tracer marqueurs verticaux --//
+ } // -- tracer marqueurs verticaux --//
else if (getAxeX() != null && getAxeX().containsPoint(marqueur.getValue()) && marqueur.isVisible()
- && !marqueur.traceHorizontal_) {
+ && !marqueur.traceHorizontal_) {
final int xie = _t.getXEcran(marqueur.getValue());
int y = 0 + 6;
final String str;
- if (marqueur.getTitle()!=null)
- str=marqueur.getTitle();
- else
+ if (marqueur.getTitle() != null) {
+ str = marqueur.getTitle();
+ } else {
str = getAxeX().getStringAffiche(marqueur.getValue());
+ }
// if (getAxeX().isDroite()) {
// x = xmax - 6 - _g.getFontMetrics().stringWidth(str);
// }
@@ -260,7 +250,7 @@
getModel().fillWithInfo(_table, _selectedPt);
_table.put(EbliLib.getS("Nombre de points"), CtuluLibString.getString(model_.getNbValues()));
_table.put(EbliLib.getS("Nombre de points s\xE9lectionn\xE9s"), CtuluLibString.getString(_selectedPt == null ? 0
- : _selectedPt.getNbSelectedIndex()));
+ : _selectedPt.getNbSelectedIndex()));
_table.put(EbliLib.getS("X min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMin()));
_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()));
@@ -326,7 +316,7 @@
}
protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y,
- final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) {
+ final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) {
return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision);
}
@@ -348,7 +338,9 @@
}
protected boolean setDisplayTitleOnCurve(final boolean _displayTitleOnCurve) {
- if (_displayTitleOnCurve == displayTitleOnCurve_) { return false; }
+ if (_displayTitleOnCurve == displayTitleOnCurve_) {
+ return false;
+ }
displayTitleOnCurve_ = _displayTitleOnCurve;
fireCourbeAspectChanged(false);
firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_TITLE_CURVE, displayTitleOnCurve_);
@@ -356,7 +348,9 @@
}
public boolean setDisplayPointLabels(final boolean _displayPointLabels) {
- if (_displayPointLabels == displayPointLabels_) { return false; }
+ if (_displayPointLabels == displayPointLabels_) {
+ return false;
+ }
displayPointLabels_ = _displayPointLabels;
fireCourbeAspectChanged(false);
firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_POINT_LABELS, displayPointLabels_);
@@ -364,7 +358,9 @@
}
protected boolean setFont(final Font _font) {
- if (_font == font_) { return false; }
+ if (_font == font_) {
+ return false;
+ }
font_ = _font;
fireCourbeAspectChanged(false);
firePropertyChange(BSelecteurReduitFonteNewVersion.PROPERTY);
@@ -372,7 +368,9 @@
}
protected void traceTitle(final Graphics2D _g, final EGRepere _t, final Envelope _r) {
- if (_r == null) { return; }
+ if (_r == null) {
+ return;
+ }
final double x = _r.getMinX();
double y = interpol(x);
final Font old = _g.getFont();
@@ -391,7 +389,7 @@
}
}
final int yie = _t.getYEcran(y, getAxeY()) - fm.getHeight();
- _g.drawString(title, xie+3, yie);
+ _g.drawString(title, xie + 3, yie);
_g.setFont(old);
}
@@ -449,7 +447,6 @@
public void descendre() {
getEGParent().descendre(this);
}
-
/**
* Boolean si oui ou non le graphe est un nuage de points
*/
@@ -460,8 +457,12 @@
protected int largeurPointsNuage_ = 5;
public void dessine(final Graphics2D _g, final EGRepere _t) {
- if (!isVisible_) { return; }
- if (model_.getNbValues() == 0) { return; }
+ if (!isVisible_) {
+ return;
+ }
+ if (model_.getNbValues() == 0) {
+ return;
+ }
final Shape oldClip = _g.getClip();
final int minX = _t.getMinEcranX();
@@ -494,37 +495,34 @@
xiVisible = _t.getXAxe().containsPoint(xi);
yiVisible = getAxeY().containsPoint(yi);
- if(model_.isPointDrawn(i) && xiVisible && yiVisible) {
+ if (model_.isPointDrawn(i) && xiVisible && yiVisible) {
// Paint point label
if (displayPointLabels_) {
- String pLabel=model_.getPointLabel(i);
+ String pLabel = model_.getPointLabel(i);
if (pLabel != null) {
// Dessin de la boite et du label
// X
int xBox;
if (((int) xie) <= _t.getMinEcranX()) {
- xBox=((int) xie);
+ xBox = ((int) xie);
+ } else if (((int) xie) >= _t.getMaxEcranX()) {
+ xBox = ((int) xie) - _g.getFontMetrics().stringWidth(pLabel) - 3;
+ } else {
+ xBox = ((int) xie) - _g.getFontMetrics().stringWidth(pLabel) / 2 - 2;
}
- else if (((int) xie) >= _t.getMaxEcranX()) {
- xBox=((int) xie) - _g.getFontMetrics().stringWidth(pLabel) - 3;
- }
- else {
- xBox=((int) xie) - _g.getFontMetrics().stringWidth(pLabel) / 2 - 2;
- }
// Y
int yBox;
if (((int) yie) >= _t.getMaxEcranY()) {
- yBox=((int) yie) - 10;
+ yBox = ((int) yie) - 10;
+ } else {
+ yBox = ((int) yie) + 10;
}
- else {
- yBox=((int) yie) + 10;
- }
// Paint
tboxLabels_.paintBox(_g, xBox, yBox, pLabel);
}
}
// Paint point
- if(iconeModel_.getType() != TraceIcon.RIEN) {
+ if (iconeModel_.getType() != TraceIcon.RIEN) {
if (displayTitleOnCurve_) {
if (rangeDisplayed == null) {
rangeDisplayed = new Envelope();
@@ -571,7 +569,7 @@
}
_g.setClip(oldClip);
traceMarks(_g, _t);
-
+
traceTitle(_g, _t, rangeDisplayed);
}
@@ -607,19 +605,22 @@
/**
* @param _xDeb l'abscisse de deb
* @param _xEnd l'abscisse de deb
- * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses
- * dans ]_xDeb,_xEnd[
+ * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses dans ]_xDeb,_xEnd[
*/
public void fillWithIdxStrictlyIncluded(final double _xDeb, final double _xEnd, final TIntArrayList _dest) {
_dest.clear();
- if (getModel().getNbValues() == 0) { return; }
+ if (getModel().getNbValues() == 0) {
+ return;
+ }
int idx = getNearestIdx(_xDeb);
if (idx < 0) {
idx = -idx - 1;
} else {
idx++;
}
- if (idx < 0 || idx >= getModel().getNbValues()) { return; }
+ if (idx < 0 || idx >= getModel().getNbValues()) {
+ return;
+ }
double x = getModel().getX(idx);
while (x > _xDeb && x < _xEnd) {
_dest.add(idx);
@@ -674,7 +675,7 @@
}
public BConfigurableInterface[] getConfigureInterfaces() {
- return new BConfigurableInterface[] { getSingleConfigureInterface() };
+ return new BConfigurableInterface[]{getSingleConfigureInterface()};
}
public int getIconeType() {
@@ -702,9 +703,8 @@
}
/**
- * Definit le modele de ligne pour le trac\xE9 de la courbe. Conditionne aussi
- * l'encadrement des labels.
- *
+ * Definit le modele de ligne pour le trac\xE9 de la courbe. Conditionne aussi l'encadrement des labels.
+ *
* @param _ic Le modele.
* @return True : Le mod\xE8le a \xE9t\xE9 accept\xE9.
*/
@@ -738,7 +738,7 @@
/**
* A ne pas utiliser pour la persistance, il se peut que le eg model soit un decorator.
- *
+ *
* @return
*/
public EGModel getModel() {
@@ -747,12 +747,15 @@
/**
* Retourne le modele initial, sans decorateur.
- *
+ *
* @return
*/
public EGModel getInitialModel() {
- if (getModel() instanceof EGModelDecorator) return ((EGModelDecorator) getModel()).getModeleInitial();
- else return getModel();
+ if (getModel() instanceof EGModelDecorator) {
+ return ((EGModelDecorator) getModel()).getModeleInitial();
+ } else {
+ return getModel();
+ }
}
public int getNearestIdx(final double _x) {
@@ -782,13 +785,15 @@
surface = new EGCourbeSurfacePainterConfigure(surfacePainter_);
}
final BConfigurableComposite axeY = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(
- getAxeY(), getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib
- .getS("Axes verticaux"));
+ getAxeY(), getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib
+ .getS("Axes verticaux"));
final BConfigurableComposite axeX = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(
- getAxeX(), getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib
- .getS("Axe horizontal"));
- if (surface == null) return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX,
- null);
+ getAxeX(), getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib
+ .getS("Axe horizontal"));
+ if (surface == null) {
+ return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX,
+ null);
+ }
return new BConfigurableComposite(null, aff, surface, new EGCourbeConfigureTarget.Marks(this), axeY, axeX);
}
@@ -818,9 +823,13 @@
public double interpol(final double _x) {
final int i = getNearestIdx(_x);
- if (i >= 0) { return model_.getY(i); }
+ if (i >= 0) {
+ return model_.getY(i);
+ }
final int idx = -i - 2;
- if ((idx < 0) || (idx >= model_.getNbValues() - 1)) { return 0D; }
+ if ((idx < 0) || (idx >= model_.getNbValues() - 1)) {
+ return 0D;
+ }
final double xlow = model_.getX(idx);
final double xup = model_.getX(idx + 1);
final double ylow = model_.getY(idx);
@@ -829,14 +838,24 @@
}
public double interpolOnEcran(final double _x, final EGRepere _rep) {
- if (model_.getNbValues() == 0) { return 0d; }
+ if (model_.getNbValues() == 0) {
+ return 0d;
+ }
final EGAxeVertical vert = getAxeY();
final int i = getNearestIdx(_x);
- if (i >= 0) { return _rep.getYEcran(model_.getY(i), vert); }
+ if (i >= 0) {
+ return _rep.getYEcran(model_.getY(i), vert);
+ }
final int idx = -i - 2;
- if (model_.getNbValues() == 0) { return 0d; }
- if (idx < 0) { return _rep.getYEcran(model_.getY(0), vert); }
- if (idx >= model_.getNbValues() - 1) { return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert); }
+ if (model_.getNbValues() == 0) {
+ return 0d;
+ }
+ if (idx < 0) {
+ return _rep.getYEcran(model_.getY(0), vert);
+ }
+ if (idx >= model_.getNbValues() - 1) {
+ return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert);
+ }
final double xlow = _rep.getXEcran(model_.getX(idx));
final double xup = _rep.getXEcran(model_.getX(idx + 1));
final double ylow = _rep.getYEcran(model_.getY(idx), vert);
@@ -918,15 +937,20 @@
}
}
- public void removePropertyChangeListener(final PropertyChangeListener _l) {}
+ public void removePropertyChangeListener(final PropertyChangeListener _l) {
+ }
public int select(final int _xEcran, final int _yEcran, final EGRepere _repere, final int _prec) {
- if (model_.getNbValues() == 0) { return -1; }
+ if (model_.getNbValues() == 0) {
+ return -1;
+ }
final double x = _repere.getXReel(_xEcran);
int idx = getNearestIdx(x);
if (idx >= 0) {
final boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec);
- if (r) { return idx; }
+ if (r) {
+ return idx;
+ }
}
idx = -idx - 2;
final int maxIdx = model_.getNbValues() - 1;
@@ -937,17 +961,23 @@
idx = maxIdx;
}
boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec);
- if (r) { return idx; }
+ if (r) {
+ return idx;
+ }
if (idx < maxIdx) {
idx++;
r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec);
- if (r) { return idx; }
+ if (r) {
+ return idx;
+ }
}
return -1;
}
public boolean setAspectContour(final Color _c) {
- if (_c == null) { return false; }
+ if (_c == null) {
+ return false;
+ }
boolean r = false;
if (!_c.equals(lineModel_.getCouleur())) {
lineModel_.setCouleur(_c);
@@ -1012,7 +1042,7 @@
/**
* Applique les modifs sur le graphe des la modif d'un marqueur.
- *
+ *
* @param marqueur
*/
public void modifyMarqueur(EGCourbeMarqueur marqueur) {
@@ -1022,7 +1052,7 @@
/**
* Ajoute un marqueur g\xE9n\xE9rique initialis\xE9 a visible=false.
- *
+ *
* @return
*/
public boolean addMarqueur() {
@@ -1046,7 +1076,9 @@
}
public EGCourbeMarqueur getMarqueur(int indice) {
- if (getMarqueurs() != null && getMarqueurs().size() > indice) return getMarqueurs().get(indice);
+ if (getMarqueurs() != null && getMarqueurs().size() > indice) {
+ return getMarqueurs().get(indice);
+ }
return null;
}
@@ -1088,7 +1120,6 @@
public BConfigurePalette getPalette() {
return paletteEnCours_;
}
-
BConfigurePalette paletteEnCours_ = null;
@Override
@@ -1096,7 +1127,6 @@
paletteEnCours_ = pal;
}
-
public static String INDICE_PANEL_SHOW = "indicePtoshow";
@Override
@@ -1107,11 +1137,12 @@
panelToShow = ((Integer) infos.get(INDICE_PANEL_SHOW)).intValue();
}
- if (paletteEnCours_ != null) return paletteEnCours_.setPalettePanelTarget(this, panelToShow);
+ if (paletteEnCours_ != null) {
+ return paletteEnCours_.setPalettePanelTarget(this, panelToShow);
+ }
return false;
}
-
public boolean isInverse = false;
/**
@@ -1151,5 +1182,4 @@
this.getAxeY().ajusteFor(this);
this.getAxeX().setBounds(getXMin(), getXMax());
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeChild.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeChild.java 2012-08-30 06:20:42 UTC (rev 7592)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeChild.java 2012-08-30 14:50:33 UTC (rev 7593)
@@ -19,7 +19,7 @@
/**
* Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre croissant.
- *
+ *
* @author deniger
* @version $Id: EGCourbeChild.java,v 1.8 2007-05-04 13:49:41 deniger Exp $
*/
@@ -46,6 +46,19 @@
createPersistBuilder.initGraphicConfiguration(to, createPersistBuilder.persistGraphicsData(this));
}
+ @Override
+ public EGCourbePersist getPersitUiConfig() {
+ EGCourbePersistBuilder createPersistBuilder = createPersistBuilder();
+ return createPersistBuilder.persistGraphicsData(this);
+ }
+
+ @Override
+ public void applyPersitUiConfig(EGCourbePersist persist) {
+ if (persist != null) {
+ createPersistBuilder().initGraphicConfiguration(this, persist);
+ }
+ }
+
boolean setYaxe(final EGAxeVertical _v) {
FuLog.warning(new Throwable());
return false;
@@ -99,8 +112,11 @@
EGCourbeChild duplic = null;
- if (this.getModel() != null) duplic = new EGCourbeChild((EGGroup) newParent, this.getModel().duplicate());
- else duplic = new EGCourbeChild((EGGroup) newParent, null);
+ if (this.getModel() != null) {
+ duplic = new EGCourbeChild((EGGroup) newParent, this.getModel().duplicate());
+ } else {
+ duplic = new EGCourbeChild((EGGroup) newParent, null);
+ }
duplic.isVisible_ = this.isVisible_;
@@ -108,25 +124,38 @@
// 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();
+ if (this.tbox_ != null) {
+ duplic.tbox_ = this.tbox_.duplicate();
+ }
// -- duplication du egCourbeSurfacePainter --//
- if (this.surfacePainter_ != null) duplic.surfacePainter_ = this.surfacePainter_.duplicate(duplic, _duplicator);
+ if (this.surfacePainter_ != null) {
+ 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());
+ 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());
// -- duplicate les marqueurs --//
duplic.setMarqueurs(new ArrayList<EGCourbeMarqueur>());
- for (EGCourbeMarqueur mark : getMarqueurs())
+ for (EGCourbeMarqueur mark : getMarqueurs()) {
duplic.getMarqueurs().add(mark.duplique());
+ }
return duplic;
}
@@ -138,5 +167,4 @@
builder.initGraphicConfiguration(this, createPersistUnit);
}
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-08-30 06:20:42 UTC (rev 7592)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-08-30 14:50:33 UTC (rev 7593)
@@ -48,6 +48,19 @@
}
}
+ @Override
+ public EGCourbePersist getPersitUiConfig() {
+ EGCourbeSimplePersistBuilderDefault builder = new EGCourbeSimplePersistBuilderDefault();
+ return builder.createPersistUnit(this);
+ }
+
+ @Override
+ public void applyPersitUiConfig(EGCourbePersist persist) {
+ if (persist != null) {
+ new EGCourbeSimplePersistBuilderDefault().initGraphicConfiguration(this, persist);
+ }
+ }
+
boolean setYaxe(final EGAxeVertical _v) {
if (_v != v_) {
v_ = _v;
@@ -83,4 +96,4 @@
return duplic;
}
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-08-31 07:59:32
|
Revision: 7596
http://fudaa.svn.sourceforge.net/fudaa/?rev=7596&view=rev
Author: deniger
Date: 2012-08-31 07:59:25 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilderDefault.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-08-30 14:55:22 UTC (rev 7595)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-08-31 07:59:25 UTC (rev 7596)
@@ -3,8 +3,8 @@
import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import org.fudaa.ctulu.CtuluAnalyze;
-import org.fudaa.ctulu.CtuluAnalyze;
import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
public abstract class EGCourbePersistBuilder<T extends EGCourbe> extends EGPersistBuilder<T, EGCourbePersist> {
@@ -20,8 +20,16 @@
return (EGGroup) params.get(GROUPE_KEY);
}
+ /**
+ * Attention, il est important de garder cette signature pour la restauration des courbes des dossiers POST
+ *
+ * @param egObject
+ * @param persist
+ * @param params
+ * @param log
+ */
@Override
- protected void postRestore(T egObject, EGCourbePersist persist, Map params, CtuluAnalyze log) {
+ protected void postRestore(EGCourbe egObject, EGCourbePersist persist, Map params, CtuluAnalyze log) {
initGraphicConfiguration(egObject, persist);
egObject.setTitle(persist.getTitle());
if (persist.inverse) {
@@ -29,6 +37,7 @@
}
}
+
public boolean saveXY() {
return true;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilderDefault.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilderDefault.java 2012-08-30 14:55:22 UTC (rev 7595)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilderDefault.java 2012-08-31 07:59:25 UTC (rev 7596)
@@ -1,12 +1,11 @@
package org.fudaa.ebli.courbe;
-import java.io.File;
import java.util.Map;
import org.fudaa.ctulu.CtuluAnalyze;
public class EGCourbePersistBuilderDefault extends EGCourbePersistBuilder<EGCourbeChild> {
-
+
@Override
protected EGCourbeChild createEGObject(EGCourbePersist target, Map params, CtuluAnalyze log) {
EGGroup parent = getGroup(params);
@@ -14,4 +13,6 @@
egCourbeChild.setModel(createModel(target, params));
return egCourbeChild;
}
+
+
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java 2012-08-30 14:55:22 UTC (rev 7595)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimplePersistBuilderDefault.java 2012-08-31 07:59:25 UTC (rev 7596)
@@ -15,4 +15,13 @@
protected EGCourbeSimple createEGObject(EGCourbePersist target, Map params, CtuluAnalyze log) {
return null;
}
+
+ @Override
+ protected void postRestore(EGCourbeSimple egObject, EGCourbePersist persist, Map params, CtuluAnalyze log) {
+ initGraphicConfiguration(egObject, persist);
+ egObject.setTitle(persist.getTitle());
+ if (persist.inverse) {
+ egObject.inverserModele();
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-08-31 17:25:35
|
Revision: 7599
http://fudaa.svn.sourceforge.net/fudaa/?rev=7599&view=rev
Author: deniger
Date: 2012-08-31 17:25:25 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGIconForCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2012-08-31 09:13:28 UTC (rev 7598)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2012-08-31 17:25:25 UTC (rev 7599)
@@ -41,48 +41,74 @@
* @version $Id: EGGrapheSimpleModel.java,v 1.19 2007-05-04 13:49:42 deniger Exp $
*/
public class EGGrapheSimpleModel extends AbstractListModel implements EGGrapheModel {
-
+
+ public void removeCurves(final TIntObjectHashMap curvesRemoveOldIndice, final CtuluCommandManager _mng) {
+ if (!curvesRemoveOldIndice.isEmpty()) {
+ element_.removeAll(Arrays.asList(curvesRemoveOldIndice.getValues()));
+ final int[] idx = curvesRemoveOldIndice.keys();
+ Arrays.sort(idx);
+ final EGCourbeSimple[] courbes = new EGCourbeSimple[idx.length];
+ int minIdxRemove = idx[0];
+ courbes[0] = (EGCourbeSimple) curvesRemoveOldIndice.get(minIdxRemove);
+ int maxIdxRemove = minIdxRemove;
+ for (int i = idx.length - 1; i > 0; i--) {
+ final int k = idx[i];
+ courbes[i] = (EGCourbeSimple) curvesRemoveOldIndice.get(k);
+ if (k < minIdxRemove) {
+ minIdxRemove = k;
+ }
+ if (k > maxIdxRemove) {
+ maxIdxRemove = k;
+ }
+ }
+ if (_mng != null) {
+ _mng.addCmd(new CourbesRemovedCommand(idx, courbes));
+ }
+ fireIntervalRemoved(this, minIdxRemove, maxIdxRemove);
+ }
+ }
+
public class CbModel extends AbstractListModel implements ComboBoxModel {
-
+
Object selected_;
EGAxeVertical vert_;
-
+
public CbModel(final EGAxeVertical _vert) {
super();
vert_ = _vert;
}
-
+
public Object getElementAt(final int _index) {
return getCourbe(_index);
}
-
+
public Object getSelectedItem() {
return selected_;
}
-
+
public int getSize() {
return getNbEGObject();
}
-
+
public void setSelectedItem(final Object _anItem) {
if (_anItem != selected_ && (vert_ != null && vert_ != _anItem)) {
selected_ = _anItem;
fireContentsChanged(this, -1, -1);
}
-
+
}
}
-
+
private class CourbeAddCommand implements CtuluCommand {
-
+
EGCourbeSimple courbeAdd_;
int idx_;
-
+
public CourbeAddCommand(final EGCourbeSimple _s, final int _idx) {
courbeAdd_ = _s;
idx_ = _idx;
}
-
+
public void redo() {
if (idx_ >= 0) {
internalAddElement(idx_, courbeAdd_);
@@ -92,34 +118,34 @@
internalAddElement(courbeAdd_);
selection_.setSelectionInterval(i, i);
}
-
+
}
-
+
public void undo() {
internalRemoveElement(courbeAdd_);
}
}
-
+
private class CourbesAddCommand implements CtuluCommand {
-
+
EGCourbeSimple[] courbeAdd_;
-
+
public CourbesAddCommand(final EGCourbeSimple[] _s) {
courbeAdd_ = _s;
}
-
+
public void redo() {
internalAddElement(courbeAdd_);
-
+
}
-
+
public void undo() {
internalRemoveElement(courbeAdd_);
}
}
-
+
private class CourbesRemovedCommand implements CtuluCommand {
-
+
EGCourbeSimple[] courbes_;
int[] idx_;
@@ -131,7 +157,7 @@
idx_ = _idx;
courbes_ = _cs;
}
-
+
public void redo() {
selection_.clearSelection();
for (int i = idx_.length - 1; i >= 0; i--) {
@@ -139,7 +165,7 @@
}
fireIntervalRemoved(this, idx_[0], idx_[idx_.length - 1]);
}
-
+
public void undo() {
final int n = idx_.length;
selection_.clearSelection();
@@ -156,18 +182,18 @@
}
}
}
-
+
class SimpleTableModel extends AbstractTableModel {
-
+
@Override
public Class getColumnClass(final int _columnIndex) {
return EGObject.class;
}
-
+
public int getColumnCount() {
return 3;
}
-
+
@Override
public String getColumnName(final int _column) {
if (_column == 2) {
@@ -177,22 +203,22 @@
}
return CtuluLibString.ESPACE;
}
-
+
public int getRowCount() {
return getSize();
}
-
+
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
return getElementAt(_rowIndex);
}
-
+
@Override
public boolean isCellEditable(final int _rowIndex, final int _columnIndex) {
// la colonne 1 represente la case a cocher visible
// la colonne 2 : le nom de la courbe: modifiable si le model l'autorise
return _columnIndex == 1 || (_columnIndex == 2 && getCourbe(_rowIndex).isTitleModifiable());
}
-
+
@Override
public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) {
if (_columnIndex == 1 && _value instanceof Boolean) {
@@ -205,19 +231,19 @@
}
}
}
-
+
public static EGGrapheSimpleModel createSimpleModel(final EGCourbeSimple[] _cs) {
return new EGGrapheSimpleModel(_cs) {
@Override
public boolean canAddCourbe() {
return false;
}
-
+
@Override
public boolean isContentModifiable() {
return false;
}
-
+
@Override
public boolean isStructureModifiable() {
return false;
@@ -229,11 +255,11 @@
boolean isUpdating;
protected DefaultListSelectionModel selection_;
SimpleTableModel tableModel_;
-
+
public EGGrapheSimpleModel() {
this(null);
}
-
+
public EGGrapheSimpleModel(final EGCourbeSimple[] _s) {
if (_s != null) {
element_ = new ArrayList(Arrays.asList(_s));
@@ -271,7 +297,7 @@
public void addCourbe(final EGCourbeSimple _obj, final CtuluCommandManager _mng, final int _idx) {
addCourbe(_obj, _mng, _idx, true);
}
-
+
public void addCourbe(final EGCourbeSimple _obj, final CtuluCommandManager _mng, final int _idx, boolean select) {
if (!isStructureModifiable()) {
return;
@@ -282,7 +308,7 @@
}
createCmdForCourbeAdd(_obj, _mng, _idx);
}
-
+
public void addCourbes(final EGCourbeSimple[] _obj, final CtuluCommandManager _mng) {
if (!isStructureModifiable()) {
return;
@@ -293,22 +319,22 @@
for (int i = idx.length - 1; i >= 0; i--) {
selection_.addSelectionInterval(idx[i], idx[i]);
}
-
+
}
createCmdForCourbeAdd(_obj, _mng);
}
-
+
public void addModelListener(final EGGrapheModelListener _l) {
listenerList.add(EGGrapheModelListener.class, _l);
}
-
+
public void addNewCourbe(final CtuluCommandManager _cmd, final Component _p, final EGGraphe _graphe) {
}
-
+
public void addSelectionListener(final EGSelectionListener _l) {
selection_.addListSelectionListener(_l);
}
-
+
public boolean canAddCourbe() {
return true;
}
@@ -322,11 +348,11 @@
protected boolean canAddCourbe(final EGCourbeSimple _s) {
return true;
}
-
+
public boolean canDeleteCourbes() {
return isStructureModifiable();
}
-
+
public boolean canDescendre(final EGObject _o) {
if (element_.size() <= 1) {
return false;
@@ -334,7 +360,7 @@
final int i = element_.indexOf(_o);
return i >= 0 && i < element_.size() - 1;
}
-
+
public boolean canMonter(final EGObject _o) {
if (element_.size() <= 1) {
return false;
@@ -351,44 +377,44 @@
public boolean canRemoveCourbe(final EGCourbeSimple _s) {
return _s.getModel().isRemovable();
}
-
+
public boolean contains(final EGCourbe _c) {
return element_ == null ? false : element_.contains(_c);
}
-
+
public JComboBox createCbForSelectCourbe() {
return createCbForSelectCourbe(null);
}
-
+
public JComboBox createCbForSelectCourbe(final EGAxeVertical _vertical) {
final BuComboBox cb = new BuComboBox(new CbModel(null));
cb.setRenderer(_vertical == null ? new EGTreeCellRenderer(true) : new EGTreeCellRenderer.AxeChooserRenderer(
_vertical));
return cb;
}
-
+
protected void createCmdForCourbeAdd(final EGCourbeSimple _courbeAdd, final CtuluCommandManager _cmd, final int _idx) {
if (_cmd != null) {
_cmd.addCmd(new CourbeAddCommand(_courbeAdd, _idx));
}
}
-
+
protected void createCmdForCourbeAdd(final EGCourbeSimple[] _courbeAdd, final CtuluCommandManager _cmd) {
if (_cmd != null) {
_cmd.addCmd(new CourbesAddCommand(_courbeAdd));
}
}
-
+
public TableModel createTableTreeModel() {
if (tableModel_ == null) {
tableModel_ = new SimpleTableModel();
}
return tableModel_;
}
-
+
public void decoreAddButton(final EbliActionInterface _b) {
}
-
+
public void descendre(final EGObject _o) {
final int i = element_.indexOf(_o);
final int lastIdx = element_.size() - 1;
@@ -402,9 +428,9 @@
fireContentsChanged(this, i, i + 1);
selection_.setSelectionInterval(i + 1, i + 1);
}
-
+
}
-
+
protected EGCourbeSimple doDuplicateCourbe(final EGCourbe _c) {
return null;
}
@@ -415,12 +441,12 @@
//--duplication de la liste des courbes --//
ArrayList<EGCourbeSimple> listeElements = new ArrayList<EGCourbeSimple>(element_.size());
-
+
for (Iterator<EGCourbeSimple> it = this.element_.iterator(); it.hasNext();) {
EGCourbeSimple courbe = it.next();
listeElements.add((EGCourbeSimple) courbe.duplicate(this, _duplicator));
}
-
+
EGGrapheSimpleModel duplic = new EGGrapheSimpleModel((EGCourbeSimple[]) listeElements.toArray());
//a corriger
duplic.axeX_ = this.axeX_.duplicate();
@@ -440,10 +466,10 @@
//FRED ok
// duplic.tableModel_ = new SimpleTableModel();
-
+
return duplic;
}
-
+
public void duplicateCourbe(final CtuluCommandManager _mng, final EGCourbe _c) {
if (_c == null || (element_ == null) || element_.size() == 0) {
return;
@@ -456,15 +482,15 @@
if (c != null) {
addCourbe(c, _mng, idx + 1);
}
-
+
}
-
+
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);
final int lastIdx = element_.size() - 1;
@@ -474,9 +500,9 @@
fireContentsChanged(this, i, lastIdx);
selection_.setSelectionInterval(lastIdx, lastIdx);
}
-
+
}
-
+
public void enPremier(final EGObject _o) {
final int i = element_.indexOf(_o);
if (i > 0) {
@@ -485,17 +511,17 @@
fireContentsChanged(this, 0, i);
selection_.setSelectionInterval(0, 0);
}
-
+
}
-
+
public final void fireAxeAspectChanged(final EGAxe _a) {
EGGrapheTreeModel.fireAxeAspectChanged(_a, listenerList);
}
-
+
public final void fireAxeContentChanged(final EGAxe _a) {
EGGrapheTreeModel.fireAxeContentChanged(_a, listenerList);
}
-
+
@Override
protected final void fireContentsChanged(final Object _source, final int _index0, final int _index1) {
super.fireContentsChanged(_source, _index0, _index1);
@@ -503,22 +529,22 @@
tableModel_.fireTableRowsUpdated(_index0, _index1);
}
}
-
+
public final void fireCourbeAspectChanged(final EGObject _o, final boolean _visibility) {
internFireCourbeChanged(_o);
EGGrapheTreeModel.fireCourbeAspectChanged(_o, _visibility, listenerList);
}
-
+
public final void fireCourbeContentChanged(final EGObject _o) {
fireCourbeContentChanged(_o, false);
}
-
+
public final void fireCourbeContentChanged(final EGObject _o, final boolean _mustRestore) {
internFireCourbeChanged(_o);
-
+
EGGrapheTreeModel.fireCourbeContentChanged(_o, listenerList, _mustRestore);
}
-
+
@Override
protected final void fireIntervalAdded(final Object _source, final int _index0, final int _index1) {
super.fireIntervalAdded(_source, _index0, _index1);
@@ -528,7 +554,7 @@
EGGrapheTreeModel.fireStructureChanged(listenerList);
selection_.setSelectionInterval(_index0, _index1);
}
-
+
@Override
protected final void fireIntervalRemoved(final Object _source, final int _index0, final int _index1) {
super.fireIntervalRemoved(_source, _index0, _index1);
@@ -538,7 +564,7 @@
selection_.clearSelection();
EGGrapheTreeModel.fireStructureChanged(listenerList);
}
-
+
public void fireObjectChanged(final EGObject _o) {
if (element_ != null) {
if (_o == null) {
@@ -550,27 +576,27 @@
}
}
}
-
+
}
-
+
public final void fireStructureChanged() {
fireIntervalAdded(this, 0, getNbEGObject());
if (tableModel_ != null) {
tableModel_.fireTableStructureChanged();
}
}
-
+
public EGAxeHorizontal getAxeX() {
return axeX_;
}
-
+
public EGCourbeSimple getCourbe(final int _i) {
if (element_ == null) {
return null;
}
return (EGCourbeSimple) element_.get(_i);
}
-
+
public EGCourbeSimple[] getCourbes() {
final EGCourbeSimple[] r = new EGCourbeSimple[element_ == null ? 0 : element_.size()];
if (element_ != null) {
@@ -578,27 +604,27 @@
}
return r;
}
-
+
public synchronized EGObject getEGObject(final int _i) {
return element_ == null ? null : (EGObject) element_.get(_i);
}
-
+
public Object getElementAt(final int _index) {
return getEGObject(_index);
}
-
+
public ListSelectionModel getListSelection() {
return selection_;
}
-
+
public EGGrapheModel getMainModel() {
return this;
}
-
+
public int getNbEGObject() {
return element_ == null ? 0 : element_.size();
}
-
+
public int getNbSelectedObjects() {
if (selection_.isSelectionEmpty()) {
return 0;
@@ -612,7 +638,7 @@
}
return r;
}
-
+
public EGCourbe getSelectedComponent() {
if (selection_ == null || selection_.isSelectionEmpty()) {
return null;
@@ -625,11 +651,11 @@
}
return null;
}
-
+
public EGObject getSelectedObject() {
return getSelectedComponent();
}
-
+
public EGObject[] getSelectedObjects() {
if (selection_.isSelectionEmpty()) {
return null;
@@ -648,21 +674,21 @@
r.toArray(rf);
return rf;
}
-
+
public int getSize() {
return getNbEGObject();
}
-
+
public Object getSpecificPersitDatas(Map parameters) {
// TODO Auto-generated method stub
return null;
}
-
+
public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target, CtuluUI ui) {
// TODO Auto-generated method stub
return null;
}
-
+
protected int internalAddElement(final EGCourbeSimple _obj) {
if (!canAddCourbe(_obj)) {
return -1;
@@ -676,7 +702,7 @@
fireIntervalAdded(this, i, i);
return i;
}
-
+
protected int[] internalAddElement(final EGCourbeSimple[] _obj) {
if (_obj == null) {
return null;
@@ -690,7 +716,7 @@
}
return list.toNativeArray();
}
-
+
protected int internalAddElement(final int _index, final EGCourbeSimple _g) {
if (_index < 0 || element_ == null || _index == element_.size()) {
internalAddElement(_g);
@@ -704,7 +730,7 @@
fireIntervalAdded(this, _index, _index);
return _index;
}
-
+
protected void internalRemoveElement(final EGCourbeSimple _o) {
if (!canRemoveCourbe(_o)) {
return;
@@ -718,7 +744,7 @@
fireIntervalRemoved(this, i, i);
}
}
-
+
protected void internalRemoveElement(final EGCourbeSimple[] _o) {
if (_o != null) {
for (int i = _o.length - 1; i >= 0; i--) {
@@ -726,10 +752,10 @@
}
}
}
-
+
private void internFireCourbeChanged(final EGObject _o) {
if (_o == null) {
-
+
fireContentsChanged(this, 0, getNbEGObject());
} else {
if (element_ == null) {
@@ -739,17 +765,17 @@
fireContentsChanged(this, i, i);
}
}
-
+
protected void internFireStructureChanged() {
if (element_ != null) {
super.fireIntervalAdded(this, 0, element_.size());
}
}
-
+
public boolean isContentModifiable() {
return true;
}
-
+
public boolean isSomethingToDisplay() {
for (int i = getNbEGObject() - 1; i >= 0; i--) {
if (getCourbe(i).isVisible_) {
@@ -758,7 +784,7 @@
}
return false;
}
-
+
public boolean isStructureModifiable() {
return true;
}
@@ -769,7 +795,7 @@
public boolean isUpdating() {
return isUpdating;
}
-
+
public void monter(final EGObject _o) {
final int i = element_.indexOf(_o);
if (i > 0) {
@@ -779,11 +805,25 @@
selection_.setSelectionInterval(i - 1, i - 1);
}
}
-
+
public void removeModelListener(final EGGrapheModelListener _l) {
listenerList.remove(EGGrapheModelListener.class, _l);
}
-
+
+ public void removeCurves(int[] idx, final CtuluCommandManager _mng) {
+ if (idx == null) {
+ return;
+ }
+ final TIntObjectHashMap curvesRemoveOldIndice = new TIntObjectHashMap();
+ for (int i = 0; i < idx.length; i++) {
+ int index = idx[i];
+ if (getCourbe(index).getModel().isRemovable()) {
+ curvesRemoveOldIndice.put(index, element_.get(index));
+ }
+ }
+ removeCurves(curvesRemoveOldIndice, _mng);
+ }
+
public void removeSelectedCurves(final CtuluCommandManager _mng) {
if (selection_.isSelectionEmpty()) {
return;
@@ -795,29 +835,7 @@
curvesRemoveOldIndice.put(i, getCourbe(i));
}
}
- if (!curvesRemoveOldIndice.isEmpty()) {
- element_.removeAll(Arrays.asList(curvesRemoveOldIndice.getValues()));
- final int[] idx = curvesRemoveOldIndice.keys();
- Arrays.sort(idx);
- final EGCourbeSimple[] courbes = new EGCourbeSimple[idx.length];
- int minIdxRemove = idx[0];
- courbes[0] = (EGCourbeSimple) curvesRemoveOldIndice.get(minIdxRemove);
- int maxIdxRemove = minIdxRemove;
- for (int i = idx.length - 1; i > 0; i--) {
- final int k = idx[i];
- courbes[i] = (EGCourbeSimple) curvesRemoveOldIndice.get(k);
- if (k < minIdxRemove) {
- minIdxRemove = k;
- }
- if (k > maxIdxRemove) {
- maxIdxRemove = k;
- }
- }
- if (_mng != null) {
- _mng.addCmd(new CourbesRemovedCommand(idx, courbes));
- }
- fireIntervalRemoved(this, minIdxRemove, maxIdxRemove);
- }
+ removeCurves(curvesRemoveOldIndice, _mng);
}
/**
@@ -829,14 +847,14 @@
return;
}
CtuluLibArray.fillIncremental(idx, 0);
-
+
if (_mng != null) {
_mng.addCmd(new CourbesRemovedCommand(idx, getCourbes()));
}
fireIntervalRemoved(this, 0, idx.length - 1);
internalRemoveElement(getCourbes());
}
-
+
public void removeSelectionListener(final EGSelectionListener _l) {
selection_.removeListSelectionListener(_l);
}
@@ -847,20 +865,20 @@
public void select(final int _i) {
selection_.setSelectionInterval(_i, _i);
}
-
+
public void setAxeX(final EGAxeHorizontal _h) {
axeX_ = _h;
-
+
}
-
+
public void setSelectedComponent(final EGCourbe _c) {
final int idx = element_.indexOf(_c);
if (idx >= 0) {
select(idx);
}
-
+
}
-
+
public void setSpecificPersitDatas(Object sepcPersitData, Map parameters) {
// TODO Auto-generated method stub
}
@@ -871,4 +889,4 @@
public void setUpdating(boolean isUpdating) {
this.isUpdating = isUpdating;
}
-}
\ No newline at end of file
+}
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGIconForCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGIconForCourbe.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGIconForCourbe.java 2012-08-31 17:25:25 UTC (rev 7599)
@@ -0,0 +1,49 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import javax.swing.Icon;
+import org.fudaa.ebli.trace.TraceIcon;
+import org.fudaa.ebli.trace.TraceLigne;
+
+/**
+ * Un icone
+ *
+ * @author deniger
+ */
+public class EGIconForCourbe implements Icon {
+
+ TraceLigne traceLigne_ = new TraceLigne();
+ TraceIcon traceIcon_ = new TraceIcon();
+ int height = 20;
+ int width = 30;
+
+ public int getIconHeight() {
+ return height;
+ }
+
+ public int getIconWidth() {
+ return width;
+ }
+
+ public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
+ final Graphics2D g = (Graphics2D) _g;
+ g.setColor(Color.white);
+ g.fillRect(_x, _y, _x + getIconWidth(), _y + getIconHeight());
+ final int middleH = _y + getIconHeight() / 2;
+ traceLigne_.dessineTrait(g, _x, middleH, _x + getIconWidth(), middleH);
+ traceIcon_.paintIconCentre(g, _x + getIconWidth() / 2, middleH);
+ }
+
+ public void updateFromCourbe(final EGCourbe _c) {
+ traceLigne_.getModel().updateData(_c.getLigneModel());
+ traceIcon_.getModel().updateData(_c.getIconModel());
+ traceIcon_.setTaille(getIconHeight() / 4); // a voir
+ // a voir
+ }
+}
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2012-08-31 17:25:25 UTC (rev 7599)
@@ -0,0 +1,121 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+import com.memoire.bu.BuGridLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import org.fudaa.ctulu.gui.CtuluPopupListener;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class EGLegendPanelManager extends MouseAdapter implements EGGrapheModelListener {
+
+ JPanel panel;
+ EGGraphe graphe;
+
+ void createPanel() {
+ panel = new JPanel(new BuGridLayout(1, 1, 3, true, true));
+ rebuild();
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (graphe == null) {
+ return;
+ }
+ if (e.getClickCount() >= 2) {
+ JComponent jc = (JComponent) e.getComponent();
+ Object clientProperty = jc.getClientProperty("COURBE");
+ if (clientProperty != null) {
+ EGPaletteLegendeGraphe pnLegend = new EGPaletteLegendeGraphe(graphe);
+ pnLegend.selectCourbe((EGCourbe) clientProperty);
+ pnLegend.afficheModale(panel);
+ }
+
+ }
+ }
+
+ public void setGraphe(EGGraphe graphe) {
+ if (this.graphe != null) {
+ this.graphe.getModel().removeModelListener(this);
+ }
+ this.graphe = graphe;
+ if (graphe == null) {
+ return;
+ }
+ this.graphe.getModel().addModelListener(this);
+ if (panel != null) {
+ rebuild();
+ }
+ }
+ boolean editable = true;
+
+ public boolean isEditable() {
+ return editable;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ @Override
+ public void structureChanged() {
+ rebuild();
+ }
+
+ @Override
+ public void courbeContentChanged(EGObject _c, boolean _mustRestore) {
+ }
+
+ @Override
+ public void courbeAspectChanged(EGObject _c, boolean _visibil) {
+ rebuild();
+ }
+
+ @Override
+ public void axeContentChanged(EGAxe _c) {
+ }
+
+ @Override
+ public void axeAspectChanged(EGAxe _c) {
+ }
+
+ public EGGraphe getGraphe() {
+ return graphe;
+ }
+
+ public JPanel getPanel() {
+ if (panel == null) {
+ createPanel();
+ }
+ return panel;
+ }
+
+ private void rebuild() {
+ panel.removeAll();
+ panel.setDoubleBuffered(false);
+ EGCourbe[] courbes = graphe.getModel().getCourbes();
+ for (EGCourbe eGCourbe : courbes) {
+ JLabel label = new JLabel();
+ EGIconForCourbe icon = new EGIconForCourbe();
+ icon.updateFromCourbe(eGCourbe);
+ label.setIcon(icon);
+ label.setText(eGCourbe.getTitle());
+ label.setToolTipText(eGCourbe.getTitle());
+ label.putClientProperty("COURBE", eGCourbe);
+ label.setOpaque(false);
+ panel.add(label);
+ label.addMouseListener(this);
+ }
+ panel.revalidate();
+ panel.repaint(0);
+// if(panel.get)
+ }
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2012-08-31 09:13:28 UTC (rev 7598)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2012-08-31 17:25:25 UTC (rev 7599)
@@ -3,17 +3,12 @@
import gnu.trove.TIntArrayList;
import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
-import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JList;
@@ -43,165 +38,118 @@
import org.fudaa.ctulu.gui.CtuluDialogPanel;
import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.ressource.EbliResource;
-import org.fudaa.ebli.trace.TraceIcon;
-import org.fudaa.ebli.trace.TraceLigne;
/**
* Palette de l\xE9gende des graphes. Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes
- *
+ *
* @author Adrien Hadoux
*/
public class EGPaletteLegendeGraphe extends CtuluDialogPanel implements ActionListener, ListSelectionListener,
- BuBorders {
-
+ BuBorders {
+
private final class EGGrapheModelListenerImplementation implements EGGrapheModelListener {
+
public void structureChanged() {
-
}
-
- public void courbeContentChanged(final EGObject c, final boolean mustRestore) {}
-
+
+ public void courbeContentChanged(final EGObject c, final boolean mustRestore) {
+ }
+
public void courbeAspectChanged(final EGObject c, final boolean visibil) {
model_.fireContentsChanged(this, 0, model_.getSize() - 1);
-
+
}
-
+
public void axeContentChanged(final EGAxe c) {
-
}
-
- public void axeAspectChanged(final EGAxe c) {}
- }
-
- /**
- * Un icone
- *
- * @author deniger
- */
- private static class CellRendererIcon implements Icon {
- TraceLigne traceLigne_ = new TraceLigne();
- TraceIcon traceIcon_ = new TraceIcon();
-
- public int getIconHeight() {
- return 20;
+
+ public void axeAspectChanged(final EGAxe c) {
}
-
- public int getIconWidth() {
- return 30;
- }
-
- public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
- final Graphics2D g = (Graphics2D) _g;
- g.setColor(Color.white);
- g.fillRect(_x, _y, _x + getIconWidth(), _y + getIconHeight());
- final int middleH = _y + getIconHeight() / 2;
- traceLigne_.dessineTrait(g, _x, middleH, _x + getIconWidth(), middleH);
- traceIcon_.paintIconCentre(g, _x + getIconWidth() / 2, middleH);
-
- }
-
- protected void setCourbe(final EGCourbe _c) {
- traceLigne_.getModel().updateData(_c.getLigneModel());
- traceIcon_.getModel().updateData(_c.getIconModel());
- traceIcon_.setTaille(getIconHeight() / 4);// a voir
- }
-
}
/**
* Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9
- *
+ *
* @author Adrien Hadoux
*/
@SuppressWarnings("serial")
private static class LegendeRenderer extends CtuluCellTextRenderer { // ne pas refaire le travail !!!!!!!
- private final CellRendererIcon icon_ = new CellRendererIcon();
-
- public LegendeRenderer() {}
-
+ private final EGIconForCourbe icon_ = new EGIconForCourbe();
+
+ public LegendeRenderer() {
+ }
+
@Override
protected void setValue(final Object _value) {
final EGCourbe cb = (EGCourbe) _value;
- icon_.setCourbe(cb);
+ icon_.updateFromCourbe(cb);
setIcon(icon_);
setText(cb.getTitle());
setOpaque(true);
}
-
}
-
+
class CustomDefaultListModel extends DefaultListModel {
-
+
@Override
public void fireContentsChanged(Object source, int index0, int index1) {
super.fireContentsChanged(source, index0, index1);
}
-
+
@Override
public void fireIntervalAdded(Object source, int index0, int index1) {
super.fireIntervalAdded(source, index0, index1);
}
-
+
@Override
public void fireIntervalRemoved(Object source, int index0, int index1) {
super.fireIntervalRemoved(source, index0, index1);
}
-
}
-
/**
* Graphe associ\xE9 a la palette
*/
private final EGGraphe graphe_;
-
/**
* Bouton qui applique les changements
*/
private JButton btApply_;
-
private BuButton btFormat_;
-
private JButton btRefresh_;
-
EGConfigureActionPalette palett...
[truncated message content] |
|
From: <de...@us...> - 2012-09-03 12:44:27
|
Revision: 7601
http://fudaa.svn.sourceforge.net/fudaa/?rev=7601&view=rev
Author: deniger
Date: 2012-09-03 12:44:21 +0000 (Mon, 03 Sep 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-08-31 17:28:09 UTC (rev 7600)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2012-09-03 12:44:21 UTC (rev 7601)
@@ -51,7 +51,7 @@
@Override
public EGCourbePersist getPersitUiConfig() {
EGCourbeSimplePersistBuilderDefault builder = new EGCourbeSimplePersistBuilderDefault();
- return builder.createPersistUnit(this);
+ return builder.persistGraphicsData(this);
}
@Override
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2012-08-31 17:28:09 UTC (rev 7600)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2012-09-03 12:44:21 UTC (rev 7601)
@@ -9,22 +9,23 @@
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import org.fudaa.ctulu.gui.CtuluPopupListener;
/**
*
* @author Frederic Deniger
*/
public class EGLegendPanelManager extends MouseAdapter implements EGGrapheModelListener {
-
+
JPanel panel;
EGGraphe graphe;
-
+
void createPanel() {
panel = new JPanel(new BuGridLayout(1, 1, 3, true, true));
+ panel.setOpaque(false);
+ panel.setDoubleBuffered(false);
rebuild();
}
-
+
@Override
public void mouseClicked(MouseEvent e) {
if (graphe == null) {
@@ -38,10 +39,10 @@
pnLegend.selectCourbe((EGCourbe) clientProperty);
pnLegend.afficheModale(panel);
}
-
+
}
}
-
+
public void setGraphe(EGGraphe graphe) {
if (this.graphe != null) {
this.graphe.getModel().removeModelListener(this);
@@ -56,48 +57,48 @@
}
}
boolean editable = true;
-
+
public boolean isEditable() {
return editable;
}
-
+
public void setEditable(boolean editable) {
this.editable = editable;
}
-
+
@Override
public void structureChanged() {
rebuild();
}
-
+
@Override
public void courbeContentChanged(EGObject _c, boolean _mustRestore) {
}
-
+
@Override
public void courbeAspectChanged(EGObject _c, boolean _visibil) {
rebuild();
}
-
+
@Override
public void axeContentChanged(EGAxe _c) {
}
-
+
@Override
public void axeAspectChanged(EGAxe _c) {
}
-
+
public EGGraphe getGraphe() {
return graphe;
}
-
+
public JPanel getPanel() {
if (panel == null) {
createPanel();
}
return panel;
}
-
+
private void rebuild() {
panel.removeAll();
panel.setDoubleBuffered(false);
@@ -116,6 +117,5 @@
}
panel.revalidate();
panel.repaint(0);
-// if(panel.get)
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-09-12 08:11:08
|
Revision: 7623
http://fudaa.svn.sourceforge.net/fudaa/?rev=7623&view=rev
Author: deniger
Date: 2012-09-12 08:10:59 +0000 (Wed, 12 Sep 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-09-12 08:10:41 UTC (rev 7622)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-09-12 08:10:59 UTC (rev 7623)
@@ -1,6 +1,8 @@
/**
- * @creation 1999-07-29 @modification $Date: 2007-05-22 14:19:05 $ @license GNU General Public License 2 @copyright (c)1998-2001 CETMEF 2 bd Gambetta
- * F-60231 Compiegne
+ * @creation 1999-07-29
+ * @modification $Date: 2007-05-22 14:19:05 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
*/
package org.fudaa.ebli.courbe;
@@ -90,7 +92,6 @@
protected boolean isExtremiteDessinee_;
protected boolean isTitreCentre_ = true;
protected TickIterator reuseIterator_;
-
protected Object key;
public EGAxe() {
@@ -102,7 +103,16 @@
lineColor_ = Color.black;
initDisplayValues();
}
+ protected boolean isDiscret_;
+ public final boolean isDiscret() {
+ return isDiscret_;
+ }
+
+ public void setIsDiscret(boolean isDiscret) {
+ this.isDiscret_ = isDiscret;
+ }
+
public Object getKey() {
return key;
}
@@ -110,8 +120,6 @@
public void setKey(Object key) {
this.key = key;
}
-
-
public final void initDisplayValues() {
if (traceGraduations_ == null) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-09-12 08:10:41 UTC (rev 7622)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-09-12 08:10:59 UTC (rev 7623)
@@ -37,7 +37,7 @@
*/
public class EGAxeHorizontal extends EGAxe {
- private boolean isDiscret_;
+
/**
* Rien.
@@ -47,15 +47,13 @@
}
public EGAxeHorizontal(final boolean _isDiscret) {
- isDiscret_ = _isDiscret;
+ super.isDiscret_ = _isDiscret;
}
- public void setIsDiscret(boolean isDiscret) {
- this.isDiscret_ = isDiscret;
- }
+
/**
* @param _a l'axe servant pour l'initialisation
@@ -323,9 +321,7 @@
return super.getStringAffiche(_val);
}
- public final boolean isDiscret() {
- return isDiscret_;
- }
+
/**
* Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est effectuee en consequence: seul des entiers sont dessin\xE9s.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-09-12 09:24:45
|
Revision: 7624
http://fudaa.svn.sourceforge.net/fudaa/?rev=7624&view=rev
Author: deniger
Date: 2012-09-12 09:24:35 +0000 (Wed, 12 Sep 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-12 08:10:59 UTC (rev 7623)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-12 09:24:35 UTC (rev 7624)
@@ -53,35 +53,35 @@
* @version $Id: EGTableGraphePanel.java,v 1.31 2007-06-05 08:58:39 deniger Exp $
*/
public class EGTableGraphePanel extends BuPanel implements EGSelectionListener, EGGrapheModelListener {
-
+
public static class SpecTableModel extends EGTableModel {
-
+
private EGTableGraphePanel graphePanel;
Double newX_;
Double newY_;
-
+
public SpecTableModel(EGTableGraphePanel graphePanel) {
this.graphePanel = graphePanel;
}
-
+
@Override
public void fireTableRowsDeleted(int firstRow, int lastRow) {
newX_ = null;
newY_ = null;
super.fireTableRowsDeleted(firstRow, lastRow);
}
-
+
@Override
protected void selectedCourbeChanged(final EGCourbe _a) {
newX_ = null;
newY_ = null;
super.selectedCourbeChanged(_a);
}
-
+
public Class getColumnClass(final int _columnIndex) {
return Double.class;
}
-
+
public int getRowCount() {
final EGAxeHorizontal h = getH();
if (c_ == null || h == null) {
@@ -92,7 +92,7 @@
}
return super.getRowCount();
}
-
+
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
if (c_ == null) {
return CtuluLibString.ESPACE;
@@ -108,14 +108,14 @@
return super.getValueAt(_rowIndex, _columnIndex);
}
boolean updating_;
-
+
public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) {
if (updating_ || c_ == null || _value == null || _value.toString().trim().length() == 0) {
return;
}
if (_rowIndex == c_.getModel().getNbValues()) {
try {
-
+
final Double d = CtuluDoubleParser.parseValue(_value.toString());
if (d == null) {
return;
@@ -154,7 +154,7 @@
}
}
}
-
+
private static Action getEnterAction() {
return new AbstractAction() {
public void actionPerformed(final ActionEvent _e) {
@@ -165,7 +165,7 @@
if (t.isEditing()) {
t.getCellEditor().stopCellEditing();
}
-
+
if (col == tableModel.yRowIndex) {
col = tableModel.xRowIndex;
row++;
@@ -180,11 +180,11 @@
t.getColumnModel().getSelectionModel().setSelectionInterval(col, col);
t.scrollRectToVisible(t.getCellRect(row, col, true));
}
-
+
}
};
}
-
+
public static void setDefaultEnterAction(final JTable _t) {
final ActionMap map = _t.getActionMap();
map.put("theSuperActionOfTheyear", EGTableGraphePanel.getEnterAction());
@@ -208,9 +208,9 @@
* @version $Id: EGTableGraphePanel.java,v 1.31 2007-06-05 08:58:39 deniger Exp $
*/
public static class EvolTable extends CtuluTable {
-
+
Action deleteAction;
-
+
public EvolTable() {
super();
setTransferHandler(new EgCourbeTransfertHandler());
@@ -232,20 +232,20 @@
super(_model);
setTransferHandler(new EgCourbeTransfertHandler());
}
-
+
void setDeleteAction(Action deleteAction) {
this.deleteAction = deleteAction;
}
-
+
protected void delete() {
deleteAction.actionPerformed(null);
}
-
+
@Override
public TransferHandler getTransferHandler() {
return super.getTransferHandler();
}
-
+
public EGTableModel getEGTableModel() {
return (EGTableModel) super.getModel();
}
@@ -262,7 +262,7 @@
int selectedColumm = getSelectedColumn();
int selectedRow = getSelectedRow();
final CtuluDoubleParser doubleParser = new CtuluDoubleParser();
-
+
final CtuluCommandComposite cmp = new CtuluCommandComposite();
if (selectedRow >= 0) {
int maxUpdate = updateLines(_tab, model, selectedColumm, selectedRow, doubleParser, cmp);
@@ -274,7 +274,7 @@
}
model.a_.getCmd().addCmd(cmp.getSimplify());
}
-
+
public void cut() {
// vide on fait rien
if (getSelectionModel().isSelectionEmpty()) {
@@ -291,7 +291,7 @@
model.c_.getModel().removeValue(row, model.a_.getCmd());
}
}
-
+
private void addValuesInModel(final List _tab, final EGTableModel _model, final CtuluDoubleParser _doubleParser,
final CtuluCommandComposite _cmp, final int _maxUpdate) {
final int nbLine = _tab.size();
@@ -333,15 +333,15 @@
newX.add(x);
newY.add(y);
}
-
+
}
-
+
}
if (newX.size() > 0) {
_model.addValueAt(newX.toNativeArray(), newY.toNativeArray(), _cmp);
}
}
-
+
private int updateLines(final List _tab, final EGTableModel _model, final int _selectedColumm,
final int _selectedRow, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp) {
final int nbLine = _tab.size();
@@ -376,7 +376,7 @@
return maxUpdate;
}
private boolean canEdit_;
-
+
@Override
protected boolean processKeyBinding(final KeyStroke _ks, final KeyEvent _e, final int _condition,
final boolean _pressed) {
@@ -386,7 +386,7 @@
if (action != null) {
return SwingUtilities.notifyAction(action, _ks, _e, this,
_e.getModifiers());
-
+
}
}
final int keyCode = _ks.getKeyCode();
@@ -411,7 +411,7 @@
}
return super.processKeyBinding(_ks, _e, _condition, _pressed);
}
-
+
public boolean editCellAt(final int _row, final int _column) {
if (canEdit_) {
canEdit_ = false;
@@ -433,7 +433,7 @@
}
return res;
}
-
+
protected void setValue(final Object _value) {
if (_value == null) {
setText(EbliLib.getS("Ajouter"));
@@ -444,21 +444,19 @@
};
EGInteractionSelection selection_;
EvolTable t_;
-
+
public EGTableGraphePanel() {
this(true);
}
-
+
public EvolTable getTable() {
return t_;
}
boolean afficheNomCourbe_ = true;
-
+
public BuLabel getTitleLabel() {
return lb_;
}
-
-
/**
* Initialise tous les composants n\xE9cessaires.
@@ -485,12 +483,12 @@
r = a_.getTransformer().getXAxe().getValueEditor();
} else if (_column == 1 && a_ != null && a_.getSelectedComponent() != null) {
r = a_.getSelectedComponent().getAxeY().getValueEditor();
-
+
}
final TableCellEditor ed = r == null ? null : r.createTableEditorComponent();
return ed == null ? super.getCellEditor(_row, _column) : ed;
}
-
+
public TableCellRenderer getDefaultRenderer(final Class _columnClass) {
if (Double.class.equals(_columnClass)) {
return renderer_;
@@ -510,13 +508,11 @@
return true;
}
});
-
+
t_.setModel(createValuesTableModel());
t_.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
t_.setCellSelectionEnabled(true);
- // t_.getSelectionModel().addListSelectionListener(this);
- // t_.getColumnModel().getColumn(0).setHeaderValue("t");
- add(new BuScrollPane(t_), BuBorderLayout.CENTER);
+ add(new JScrollPane(t_), BuBorderLayout.CENTER);
lbError_ = new BuLabel(CtuluLibString.ESPACE);
lbError_.setForeground(Color.RED);
final BuPanel pn = new BuPanel();
@@ -530,11 +526,11 @@
add(pn, BuBorderLayout.SOUTH);
setPreferredSize(new Dimension(150, 200));
}
-
+
protected SpecTableModel createValuesTableModel() {
return new SpecTableModel(this);
}
-
+
private void eventReceived() {
if (t_.getCellEditor() != null) {
t_.getCellEditor().cancelCellEditing();
@@ -557,7 +553,7 @@
}
}
}
-
+
void updateButtons() {
final EGCourbe c = a_.getSelectedComponent();
if (btAdd_ != null) {
@@ -587,13 +583,13 @@
}
}
}
-
+
private void updateDatas(final EGCourbe _c) {
if (t_.getCellEditor() != null) {
t_.getCellEditor().cancelCellEditing();
}
getSpecTableModel().selectedCourbeChanged(_c);
-
+
if (_c == null) {
lb_.setText(CtuluLibString.ESPACE);
lbCourbeInfo_.setText(CtuluLibString.ESPACE);
@@ -613,49 +609,51 @@
}
lbCourbeInfo_.setText(txt);
}
+ t_.doLayout();
+ t_.setPreferredSize(t_.getPreferredSize());
revalidate();
doLayout();
repaint();
}
-
+
protected void tableCopy() {
t_.copy();
}
-
+
protected void tableCut() {
t_.cut();
}
-
+
protected void tablePaste() {
t_.paste();
}
EbliActionSimple actionDelete;
-
+
public EbliActionSimple getActionDelete() {
if (actionDelete == null) {
actionDelete = new DeleteAction();
}
return actionDelete;
}
-
+
public class DeleteAction extends EbliActionSimple {
-
+
public DeleteAction() {
super(EbliLib.getS("Supprimer des points"), EbliResource.EBLI.getToolIcon("node-delete"), "REMOVE_POINTS");
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));
}
-
+
@Override
public void updateStateBeforeShow() {
setEnabled(btRemove_.isEnabled());
}
-
+
@Override
public void actionPerformed(ActionEvent _e) {
btRemove_.doClick();
}
}
-
+
public void addPanelAction(final EGFillePanel _p) {
// si le contenu n'est pas modifiable ou si les boutons ont deja ete
// initialise on oublie ....
@@ -704,47 +702,47 @@
btRemove_.doClick();
}
});
-
+
}
-
+
public static void removeButton(JButton bt) {
if (bt != null && bt.getParent() != null) {
bt.getParent().remove(bt);
}
}
-
+
public void removeEditButtons() {
removeButton(btAdd_);
removeButton(btAlign_);
removeButton(btRemove_);
}
-
+
public void setLabel(final BuLabel _lb) {
lbXyInfo_ = _lb;
}
-
+
public void axeAspectChanged(final EGAxe _c) {
}
-
+
public void axeContentChanged(final EGAxe _c) {
(getSpecTableModel()).fireTableChanged(new TableModelEvent(getSpecTableModel(), 0, getSpecTableModel().getRowCount() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE));
repaint();
}
-
+
SpecTableModel getSpecTableModel() {
return (SpecTableModel) t_.getModel();
}
-
+
public void courbeAspectChanged(final EGObject _c, final boolean _visibil) {
}
-
+
public void courbeContentChanged(final EGObject _c, final boolean _mustRestore) {
eventReceived();
}
-
+
public void intervalAdded(final ListDataEvent _e) {
}
-
+
public void intervalRemoved(final ListDataEvent _e) {
}
@@ -766,7 +764,7 @@
updateDatas(_a.getSelectedComponent());
eventReceived();
}
-
+
public void updateState() {
updateDatas(a_.getSelectedComponent());
updateButtons();
@@ -782,7 +780,7 @@
return;
}
if (selection_ != null && updater_ != null) {
-
+
selection_.getSelection().removeListeSelectionListener(updater_);
t_.getSelectionModel().removeListSelectionListener(updater_);
}
@@ -791,14 +789,14 @@
protected void doAfterCtuluListSectionChanged() {
updateButtons();
}
-
+
protected void doAfterTableSectionChanged() {
updateButtons();
updateRowSelection();
}
};
}
-
+
protected void updateRowSelection() {
final int[] rows = t_.getSelectedRows();
if (rows != null) {
@@ -825,16 +823,16 @@
t_.getColumnModel().getColumn(1).setHeaderValue(_t);
revalidate();
}
-
+
public void structureChanged() {
}
-
+
public void valueChanged(final ListSelectionEvent _e) {
updateDatas(a_.getSelectedComponent());
updateButtons();
-
+
}
-
+
public void valueChanged(final TreeSelectionEvent _e) {
final Object o = _e.getPath().getLastPathComponent();
if (o instanceof EGCourbe) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-09-12 08:10:59 UTC (rev 7623)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-09-12 09:24:35 UTC (rev 7624)
@@ -98,12 +98,14 @@
protected void selectedCourbeChanged(final EGCourbe _a) {
c_ = _a;
fireTableDataChanged();
+ fireTableStructureChanged();
}
public EGAxeHorizontal getH() {
return a_ == null ? null : a_.getTransformer().getXAxe();
}
+ @Override
public String getColumnName(final int _column) {
String res = CtuluLibString.ESPACE;
if (getH() != null && _column == xRowIndex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-09-21 14:13:04
|
Revision: 7652
http://fudaa.svn.sourceforge.net/fudaa/?rev=7652&view=rev
Author: deniger
Date: 2012-09-21 14:12:53 +0000 (Fri, 21 Sep 2012)
Log Message:
-----------
recherche
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2012-09-19 19:19:02 UTC (rev 7651)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2012-09-21 14:12:53 UTC (rev 7652)
@@ -34,6 +34,7 @@
import com.memoire.bu.BuBorderLayout;
import com.memoire.bu.BuLib;
+import com.memoire.bu.BuMenuItem;
import com.memoire.bu.BuPanel;
import com.memoire.bu.BuPopupMenu;
import com.memoire.bu.BuResource;
@@ -46,6 +47,7 @@
import org.fudaa.ctulu.CtuluListSelectionListener;
import org.fudaa.ctulu.CtuluSelectionInterface;
import org.fudaa.ctulu.gui.CtuluLibSwing;
+import org.fudaa.ctulu.gui.CtuluPopupMenu;
import org.fudaa.ctulu.image.CtuluImageProducer;
import org.fudaa.ebli.commun.*;
import org.fudaa.ebli.palette.BPaletteInfoAbstractAction;
@@ -287,24 +289,7 @@
final BuPopupMenu m = new BuPopupMenu();
m.setInvoker(this);
fillPopupMenu(m);
- boolean actif = false;
- final EGCourbe c = vue_.graphe_.getSelectedComponent();
- final boolean cModifiable = (c != null) && (c.getModel().isModifiable()) && (getSelection() != null)
- && (!getSelection().isEmpty());
- m.addMenuItem(EbliLib.getS("Modifier les points s\xE9lectionn\xE9s"), "MODIFY_POINTS", EbliResource.EBLI
- .getToolIcon("node-edit"), cModifiable)/* .addActionListener(this) */;
- actif = cModifiable && (getSelection().getNbSelectedIndex() >= 2);
- m.addMenuItem(EbliLib.getS("Aligner les points"), "ALIGN_POINTS", EbliResource.EBLI.getToolIcon("node-corner"),
- actif)/* .addActionListener(this) */;
- actif = c != null && c.getModel().isModifiable() && c.getModel().isXModifiable()
- && (getSelection().getNbSelectedIndex() >= 2);
- m.addMenuItem(EbliLib.getS("Raffiner"), "ADD_POINTS", EbliResource.EBLI.getToolIcon("node-add"), actif)/*
- * .addActionListener
- * (this)
- */;
- actif = c != null && cModifiable && c.getModel().isXModifiable() && c.getModel().getNbValues() > 2;
- m.addMenuItem(EbliLib.getS("Supprimer un point"), "REMOVE_POINTS", EbliResource.EBLI.getToolIcon("node-delete"),
- actif)/* .addActionListener(this) */;
+ fillMenuWithActions(m);
m.add(new BuSeparator());
fillSpecificMenu(m);
m.show(this, _x, _y);
@@ -451,4 +436,72 @@
}
personnalAction_ = _a;
}
+ BuMenuItem modifiyPointsMenuItem;
+ BuMenuItem alignPointMenuItem;
+ BuMenuItem refinePointMenuItem;
+ BuMenuItem removePointMenuItem;
+
+ public void fillMenuWithActions(final BuPopupMenu m) {
+ modifiyPointsMenuItem = addModifiyPointsMenuItem(m);
+ alignPointMenuItem = addAlignPointMenuItem(m);
+ refinePointMenuItem = addRefinePointMenuItem(m);
+ removePointMenuItem = addRemovePointMenuItem(m);
+ }
+
+ public boolean isSelectedCourbeModifiable() {
+ final EGCourbe c = vue_.graphe_.getSelectedComponent();
+ return (c != null) && (c.getModel().isModifiable()) && (getSelection() != null)
+ && (!getSelection().isEmpty());
+ }
+
+ public boolean isSelectionAlignable() {
+ return isSelectedCourbeModifiable() && (getSelection().getNbSelectedIndex() >= 2);
+ }
+
+ public boolean isSelectionRefinable() {
+ return isSelectedCourbeModifiable()
+ && (getSelection().getNbSelectedIndex() >= 2);
+ }
+
+ public boolean isSelectionRemovable() {
+ return isSelectedCourbeModifiable();
+ }
+
+ public BuMenuItem addModifiyPointsMenuItem(final BuPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Modifier les points s\xE9lectionn\xE9s"), "MODIFY_POINTS", EbliResource.EBLI
+ .getToolIcon("node-edit"), isSelectedCourbeModifiable());
+ }
+
+ public BuMenuItem addModifiyPointsMenuItem(final CtuluPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Modifier les points s\xE9lectionn\xE9s"), "MODIFY_POINTS", EbliResource.EBLI
+ .getToolIcon("node-edit"), isSelectedCourbeModifiable());
+ }
+
+ public BuMenuItem addAlignPointMenuItem(final CtuluPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Aligner les points"), "ALIGN_POINTS", EbliResource.EBLI.getToolIcon("node-corner"), isSelectionAlignable());
+ }
+
+ public BuMenuItem addAlignPointMenuItem(final BuPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Aligner les points"), "ALIGN_POINTS", EbliResource.EBLI.getToolIcon("node-corner"), isSelectionAlignable());
+ }
+
+ public BuMenuItem addRefinePointMenuItem(final CtuluPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Raffiner"), "ADD_POINTS", EbliResource.EBLI.getToolIcon("node-add"), isSelectionRefinable());
+ }
+
+ public BuMenuItem addRefinePointMenuItem(final BuPopupMenu m) {
+ return m.addMenuItem(EbliLib.getS("Raffiner"), "ADD_POINTS", EbliResource.EBLI.getToolIcon("node-add"), isSelectionRefinable());
+ }
+
+ public BuMenuItem addRemovePointMenuItem(final CtuluPopupMenu m) {
+ final BuMenuItem addMenuItem = m.addMenuItem(EbliLib.getS("Supprimer un point"), "REMOVE_POINTS", EbliResource.EBLI.getToolIcon("node-delete"), isSelectionRemovable());
+ addMenuItem.setAccelerator(EGTableGraphePanel.getDeleteKeyStroke());
+ return addMenuItem;
+ }
+
+ public BuMenuItem addRemovePointMenuItem(final BuPopupMenu m) {
+ final BuMenuItem addMenuItem = m.addMenuItem(EbliLib.getS("Supprimer un point"), "REMOVE_POINTS", EbliResource.EBLI.getToolIcon("node-delete"), isSelectionRemovable());
+ addMenuItem.setAccelerator(EGTableGraphePanel.getDeleteKeyStroke());
+ return addMenuItem;
+ }
}
\ No newline at end of file
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-19 19:19:02 UTC (rev 7651)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-21 14:12:53 UTC (rev 7652)
@@ -646,7 +646,7 @@
public DeleteAction() {
super(EbliLib.getS("Supprimer des points"), EbliResource.EBLI.getToolIcon("node-delete"), "REMOVE_POINTS");
- putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));
+ putValue(ACCELERATOR_KEY, getDeleteKeyStroke());
}
@Override
@@ -660,6 +660,19 @@
}
}
+ public static KeyStroke getDeleteKeyStroke() {
+ return KeyStroke.getKeyStroke("control D");
+ }
+ boolean addTopButtons = true;
+
+ public boolean isAddTopButtons() {
+ return addTopButtons;
+ }
+
+ public void setAddTopButtons(boolean addTopButtons) {
+ this.addTopButtons = addTopButtons;
+ }
+
public void addPanelAction(final EGFillePanel _p) {
// si le contenu n'est pas modifiable ou si les boutons ont deja ete
// initialise on oublie ....
@@ -693,12 +706,14 @@
if (afficheNomCourbe_) {
north.add(lb_, BuBorderLayout.NORTH);
}
- final BuPanel pnBt = new BuPanel();
- pnBt.setLayout(new BuButtonLayout(1, SwingConstants.LEFT));
- pnBt.add(btAdd_);
- pnBt.add(btAlign_);
- pnBt.add(btRemove_);
- north.add(pnBt, BuBorderLayout.CENTER);
+ if (addTopButtons) {
+ final BuPanel pnBt = new BuPanel();
+ pnBt.setLayout(new BuButtonLayout(1, SwingConstants.LEFT));
+ pnBt.add(btAdd_);
+ pnBt.add(btAlign_);
+ pnBt.add(btRemove_);
+ north.add(pnBt, BuBorderLayout.CENTER);
+ }
remove(lb_);
add(north, BuBorderLayout.NORTH);
final InputMap m = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-09-25 14:56:09
|
Revision: 7661
http://fudaa.svn.sourceforge.net/fudaa/?rev=7661&view=rev
Author: deniger
Date: 2012-09-25 14:55:58 +0000 (Tue, 25 Sep 2012)
Log Message:
-----------
la molette du milieu d?\195?\169place la vue
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelExportable.java
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelExportable.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelExportable.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelExportable.java 2012-09-25 14:55:58 UTC (rev 7661)
@@ -0,0 +1,15 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+/**
+ * Interface pour les courbes qui ne peuvent pas \xEAtre export\xE9es sous format tabulaire
+ * @author Frederic Deniger
+ */
+public interface EGModelExportable {
+
+
+ boolean isViewableinTable();
+
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2012-09-25 14:55:11 UTC (rev 7660)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2012-09-25 14:55:58 UTC (rev 7661)
@@ -81,9 +81,34 @@
this.addOptions = addOptions;
}
+ protected boolean isExportable(EGCourbe cs) {
+ if (cs == null) {
+ return false;
+ }
+ EGModel model = cs.getModel();
+ if (model instanceof EGModelExportable) {
+ return ((EGModelExportable) model).isViewableinTable();
+ }
+ return true;
+ }
+
+ protected boolean isExportable(EGObject cs) {
+ if (cs instanceof EGCourbe) {
+ return isExportable((EGCourbe) cs);
+ }
+ return false;
+ }
+
@Override
public BuTable createValuesTable() {
- final EGCourbe[] cs = graphe_.getModel().getCourbes();
+ EGCourbe[] cs = graphe_.getModel().getCourbes();
+ List<EGCourbe> exportable = new ArrayList<EGCourbe>();
+ for (EGCourbe courbe : cs) {
+ if (isExportable(courbe)) {
+ exportable.add(courbe);
+ }
+ }
+ cs = (EGCourbe[]) exportable.toArray(new EGCourbe[exportable.size()]);
final EGObject[] selected = graphe_.getModel().getSelectedObjects();
final int nb = selected == null ? 0 : selected.length;
final List courbesSelected = new ArrayList(nb);
@@ -93,7 +118,9 @@
}
} else if (selected != null) {
for (int i = 0; i < nb; i++) {
- selected[i].fillWithCurves(courbesSelected);
+ if (isExportable(selected[i])) {
+ selected[i].fillWithCurves(courbesSelected);
+ }
}
}
final EGMultiCourbeTableModel tableModel = new EGMultiCourbeTableModel(cs, (EGCourbe[]) courbesSelected.toArray(new EGCourbe[courbesSelected
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-25 14:55:11 UTC (rev 7660)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-09-25 14:55:58 UTC (rev 7661)
@@ -223,6 +223,14 @@
setTransferHandler(new EgCourbeTransfertHandler());
}
+ @Override
+ protected String transformToString(Object value) {
+
+ return super.transformToString(value);
+ }
+
+
+
/**
* @param _values
* @param _names
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-10-04 22:59:59
|
Revision: 7706
http://fudaa.svn.sourceforge.net/fudaa/?rev=7706&view=rev
Author: deniger
Date: 2012-10-04 22:59:53 +0000 (Thu, 04 Oct 2012)
Log Message:
-----------
am?\195?\169lioration des courbes: labels verticaux, banni?\195?\168res...
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-10-04 22:53:11 UTC (rev 7705)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-10-04 22:59:53 UTC (rev 7706)
@@ -110,6 +110,12 @@
return isDiscret_;
}
+ public CtuluRange getRange() {
+ return range_==null?new CtuluRange():new CtuluRange(range_);
+ }
+
+
+
public void setIsDiscret(boolean isDiscret) {
this.isDiscret_ = isDiscret;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-10-04 22:53:11 UTC (rev 7705)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2012-10-04 22:59:53 UTC (rev 7706)
@@ -106,7 +106,7 @@
final double wordWidth = fm.stringWidth(t);
final double xLeft = xe - wordWidth / 2;
// pour eviter que les graduations se chevauchent
- if (xLeft > (lastMaxX + 2) && (xe + wordWidth / 2) < (_f.getMaxEcranX() + _f.getMargesDroite())) {
+ if (xLeft > (lastMaxX + 2) && (xe + wordWidth / 2) < (_f.getMaxEcranX() + _f.getMargesDroite())) {
if (traceGrille_) {
traceGraduations.dessineTrait(_g, xe, y, xe, yMaxGrad);
}
@@ -229,7 +229,7 @@
}
}
final int xtext = _xi + (_f.getMaxEcranX() - _xi) / 2 - fm.stringWidth(txt) / 2;
- _g.drawString(txt, xtext, _y + _f.getMargesBas() - fm.getHeight() - 1);
+ _g.drawString(txt, xtext, _y + getBottomHeightNeeded(_g) - fm.getHeight() - 1);
} else {
if (t != null) {
width = fm.stringWidth(t);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-10-05 15:12:21
|
Revision: 7713
http://fudaa.svn.sourceforge.net/fudaa/?rev=7713&view=rev
Author: deniger
Date: 2012-10-05 15:12:10 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
am?\195?\169lioration des courbes: labels verticaux, banni?\195?\168res...
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java
Removed Paths:
-------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-10-05 15:09:35 UTC (rev 7712)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-10-05 15:12:10 UTC (rev 7713)
@@ -93,7 +93,7 @@
protected double coeffLarger_ = 0.1;
protected EGRepere transformer_;
protected CtuluRange xRange_;
- EGHorizontalBanner horizontalBanner;
+ EGHorizontalBannerd horizontalBanner;
public EGGraphe(final EGGrapheModel _m) {
addComponentListener(this);
@@ -164,11 +164,11 @@
return 0.8;
}
- public EGHorizontalBanner getHorizontalBanner() {
+ public EGHorizontalBannerd getHorizontalBanner() {
return horizontalBanner;
}
- public void setHorizontalBanner(EGHorizontalBanner horizontalBanner) {
+ public void setHorizontalBanner(EGHorizontalBannerd horizontalBanner) {
this.horizontalBanner = horizontalBanner;
}
Deleted: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java 2012-10-05 15:09:35 UTC (rev 7712)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java 2012-10-05 15:12:10 UTC (rev 7713)
@@ -1,17 +0,0 @@
-/*
- GPL 2
- */
-package org.fudaa.ebli.courbe;
-
-import java.awt.Graphics2D;
-
-/**
- *ddsd
- * @author Frederic Deniger
- */
-public interface EGHorizontalBanner {
-
- void dessine(final Graphics2D _g, final EGRepere _f);
-
- int getHeightNeeded(final Graphics2D _g);
-}
Copied: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java (from rev 7703, trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java)
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java 2012-10-05 15:12:10 UTC (rev 7713)
@@ -0,0 +1,17 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+import java.awt.Graphics2D;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface EGHorizontalBannerd {
+
+ void dessine(final Graphics2D _g, final EGRepere _f);
+
+ int getHeightNeeded(final Graphics2D _g);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-10-05 15:13:17
|
Revision: 7714
http://fudaa.svn.sourceforge.net/fudaa/?rev=7714&view=rev
Author: deniger
Date: 2012-10-05 15:13:11 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
am?\195?\169lioration des courbes: labels verticaux, banni?\195?\168res...
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java
Removed Paths:
-------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-10-05 15:12:10 UTC (rev 7713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-10-05 15:13:11 UTC (rev 7714)
@@ -93,7 +93,7 @@
protected double coeffLarger_ = 0.1;
protected EGRepere transformer_;
protected CtuluRange xRange_;
- EGHorizontalBannerd horizontalBanner;
+ EGHorizontalBanner horizontalBanner;
public EGGraphe(final EGGrapheModel _m) {
addComponentListener(this);
@@ -164,11 +164,11 @@
return 0.8;
}
- public EGHorizontalBannerd getHorizontalBanner() {
+ public EGHorizontalBanner getHorizontalBanner() {
return horizontalBanner;
}
- public void setHorizontalBanner(EGHorizontalBannerd horizontalBanner) {
+ public void setHorizontalBanner(EGHorizontalBanner horizontalBanner) {
this.horizontalBanner = horizontalBanner;
}
Copied: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java (from rev 7713, trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java)
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBanner.java 2012-10-05 15:13:11 UTC (rev 7714)
@@ -0,0 +1,17 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+import java.awt.Graphics2D;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface EGHorizontalBanner {
+
+ void dessine(final Graphics2D _g, final EGRepere _f);
+
+ int getHeightNeeded(final Graphics2D _g);
+}
Deleted: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java 2012-10-05 15:12:10 UTC (rev 7713)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGHorizontalBannerd.java 2012-10-05 15:13:11 UTC (rev 7714)
@@ -1,17 +0,0 @@
-/*
- GPL 2
- */
-package org.fudaa.ebli.courbe;
-
-import java.awt.Graphics2D;
-
-/**
- *
- * @author Frederic Deniger
- */
-public interface EGHorizontalBannerd {
-
- void dessine(final Graphics2D _g, final EGRepere _f);
-
- int getHeightNeeded(final Graphics2D _g);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-12 16:22:50
|
Revision: 7873
http://fudaa.svn.sourceforge.net/fudaa/?rev=7873&view=rev
Author: deniger
Date: 2012-11-12 16:22:39 +0000 (Mon, 12 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-11-12 16:19:11 UTC (rev 7872)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2012-11-12 16:22:39 UTC (rev 7873)
@@ -1,5 +1,6 @@
package org.fudaa.ebli.courbe;
+import com.memoire.fu.FuEmptyArrays;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@@ -74,18 +75,27 @@
if (classeModel != null) {
model = forName(classeModel);
}
-
- if (model == null) {
- model = new EGCourbeModelDefault(persist.abscisses, persist.ordonnees);
- } else if (saveXY()) {
- double[] savedX = (double[]) _infos.get(X_KEY);
+ double[] savedX = null;
+ double[] savedY = null;
+ if (saveXY()) {
+ savedX = (double[]) _infos.get(X_KEY);
if (savedX == null) {
savedX = persist.abscisses;
}
- double[] savedY = (double[]) _infos.get(Y_KEY);
+ savedY = (double[]) _infos.get(Y_KEY);
if (savedY == null) {
savedY = persist.ordonnees;
}
+ }
+ if (savedX == null) {
+ savedX = FuEmptyArrays.DOUBLE0;
+ }
+ if (savedY == null) {
+ savedY = FuEmptyArrays.DOUBLE0;
+ }
+ if (model == null) {
+ model = new EGCourbeModelDefault(savedX, savedY);
+ } else {
// -- ajout des coordonnees --//
model.addValue(savedX, savedY, null);
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java 2012-11-12 16:19:11 UTC (rev 7872)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java 2012-11-12 16:22:39 UTC (rev 7873)
@@ -36,7 +36,7 @@
* @author Adrien Hadoux
*/
public class EGGraphePersist {
-
+
private static final String PANEL = "Panel:";
/**
* Path du repertoire dans lequel seront enregistr\xE9 toute les courbes, groupes et model...
@@ -47,11 +47,11 @@
private static String SPECIFIQUEFILE = "specificDatas.xml";
private static String COURBEDIRECTORY = "COURBES";
CtuluAnalyze log = new CtuluAnalyze();
-
+
public EGGraphePersist(String directoryPath_) throws IOException {
this.directoryPath_ = directoryPath_;
}
-
+
private File getBinFileForCurve(int i) {
return new File(getDirectoryCurves(), i + ".bin");
}
@@ -100,7 +100,7 @@
private String getMainFilePath() {
return directoryPath_ + File.separator + MAINFILE;
}
-
+
private String getPanelFilePath() {
return directoryPath_ + File.separator + MAINFILE;
}
@@ -137,7 +137,7 @@
while (list.size() != 0) {
list.remove(0);
}
-
+
}
/**
@@ -151,7 +151,12 @@
// -- outputstream du xstream pour enregistrement des diff\xE9rents groupes--//
ObjectOutputStream out = null;
try {
- out = EbliLib.createObjectOutpuStream(new File(mainfile), getParser());
+ final XStream parser = getParser();
+ XstreamCustomizer customizer = (XstreamCustomizer) parameters.get(XstreamCustomizer.PARAMETER_ID);
+ if (customizer != null) {
+ customizer.configureXstream(parser);
+ }
+ out = EbliLib.createObjectOutpuStream(new File(mainfile), parser);
// -- enregistrement des courbes --//
// strategy pour la liste xml: aun fichier par courbe.
@@ -161,7 +166,7 @@
// creates the list of curves:
List<EGCourbePersist> persistCurves = new ArrayList<EGCourbePersist>();
List<EGCourbe> persistedCurves = new ArrayList<EGCourbe>();
-
+
List<EGGroupPersist> listeGroupePersistance = new ArrayList<EGGroupPersist>(grapheTopersist.getModel().getNbEGObject());
int nbEgObjects = grapheTopersist.getModel().getNbEGObject();
int idxGroup = 0;
@@ -207,7 +212,7 @@
persistCurves.get(i).surfacePainter = builder.build(egCourbe.getSurfacePainter(), idByCurve);
}
savedCurves.add(persistCurves.get(i));
-
+
}
// --on enregistre des infos bidons pour l'utilisateur --//
out.writeObject(PANEL + graphePanelClass);
@@ -262,9 +267,9 @@
} finally {
CtuluLibFile.close(out);
}
-
+
}
-
+
@SuppressWarnings("unchecked")
private EGCourbePersist createPersist(EGCourbeChild egCourbeChild, int groupIdx, EGGraphe grapheTopersist, int courbeUniqueId) {
EGCourbePersistBuilder<EGCourbeChild> builder = (EGCourbePersistBuilder<EGCourbeChild>) egCourbeChild.createPersistBuilder();
@@ -273,7 +278,7 @@
courbePersist.setIdgroup(groupIdx);
return courbePersist;
}
-
+
private static TIntArrayList getGroupIdxInMap(Map<EGGroup, Integer> groupIdx, List<EGObject> list) {
TIntArrayList idx = new TIntArrayList(list.size());
for (EGObject o : list) {
@@ -308,12 +313,12 @@
if (myModel == null) {
myModel = new EGGrapheTreeModel();
}
-
+
if (myModel instanceof EGGrapheTreeModel) {
return (EGGrapheTreeModel) myModel;
}
return null;
-
+
}
Map<String, EGGroupPersistBuilder> cacheGroupBuilder = new HashMap<String, EGGroupPersistBuilder>();
Map<String, EGCourbePersistBuilder> cacheCurveBuilder = new HashMap<String, EGCourbePersistBuilder>();
@@ -334,6 +339,10 @@
String mainfile = getMainFilePath();
File fichierCourbes = getDirectoryCurves();
XStream parser = getParser();
+ XstreamCustomizer customizer = (XstreamCustomizer) parameters.get(XstreamCustomizer.PARAMETER_ID);
+ if (customizer != null) {
+ customizer.configureXstream(parser);
+ }
String graphePanelClass = null;
EGGraphePersist.addEGAxeHorizontalPersistCompatibilityConfiguration(parser);
if (fichierCourbes.isDirectory()) {
@@ -344,16 +353,16 @@
// --lecture biddon --//
graphePanelClass = (String) in.readObject();
in.readObject();
-
+
boolean doHorizontalRezoom = false;
// - Etape 1: lecture de l'axe --//
EGAxeHorizontalPersist axeHorizontalPersist = (EGAxeHorizontalPersist) in.readObject();
-
+
if (axeHorizontalPersist.range == null) {
doHorizontalRezoom = true;
}
-
+
EGAxeHorizontal axeX = axeHorizontalPersist.generateAxe();
// - Etape 2: lecture du modele --//
@@ -365,11 +374,11 @@
int nbGroups = in.readInt();
Map<Integer, EGGroup> groupIdx = new HashMap<Integer, EGGroup>();
Set<EGGroup> groupToRefresh = new HashSet<EGGroup>();
-
+
for (int i = 0; i < nbGroups; i++) {
// -- lecture du groupe --//
EGGroupPersist groupPersist = (EGGroupPersist) in.readObject();
-
+
EGGroupPersistBuilder<EGGroup> builder = getGroupBuilder(groupPersist);
Map groupParam = new HashMap();
if (parameters != null) {
@@ -393,7 +402,7 @@
} catch (EOFException eof) {
} catch (Exception e) {
FuLog.error(e);
-
+
}
// -- Etape 4: lecture des courbes --//
@@ -403,7 +412,7 @@
List<EGCourbe> restoredCurves = new ArrayList<EGCourbe>();
for (EGCourbePersist cbPersist : listeCourbesPersistantes) {
EGGroup container = model.getGroup(cbPersist.Idgroup);
-
+
if (container != null) {
EGCourbePersistBuilder<? extends EGCourbeChild> builder = getCourbeBuilder(cbPersist);
if (builder != null) {
@@ -440,7 +449,7 @@
} catch (Exception e) {
((List<String>) parameters.get("errorMsg")).add("Erreur, la tentative de finalisation des donn\xE9es du graphe a \xE9chou\xE9 ");
((List<String>) parameters.get("errorMsg")).add("Cette erreur est peut \xEAtre due \xE0 une incompatibilit\xE9 des variables pour un rejoue de donn\xE9es.");
-
+
}
// -- Etape finale: creation du graphe --//
graphe = new EGGraphe(model);
@@ -460,7 +469,7 @@
axeToMerge.add(groupIdx.get(Integer.valueOf(idxs[i])).getAxeY());
}
graphe.mergeAxis(axeToMerge.toArray(new EGAxeVertical[axeToMerge.size()]), merge.getPersist().generateAxe());
-
+
}
}
// mise a jour des b\xE9b\xE9s
@@ -477,17 +486,12 @@
try {
// -- inputstream du xstream pour chargement des diff\xE9rents groupes--//
in = EbliLib.createObjectInpuStream(new File(getSpecifiqueDataFilePath()), parser);
- XstreamCustomizer customizer = (XstreamCustomizer) parameters.get(XstreamCustomizer.PARAMETER_ID);
- if (customizer != null) {
- customizer.configureXstream(parser);
- }
-
// -- lecture des donn\xE9es specifiques --//
Object specifiquesDatas = in.readObject();
// -- remplissage du modele avec les donn\xE9es persistantes --//
graphe.getModel().setSpecificPersitDatas(specifiquesDatas, parameters);
-
+
} catch (IOException e) {
FuLog.error(e);
} finally {
@@ -512,12 +516,12 @@
} catch (Exception e) {
FuLog.error(e);
}
-
+
}
-
+
return new EGFillePanel(graphe);
}
-
+
@SuppressWarnings("unchecked")
private EGGroupPersistBuilder<EGGroup> getGroupBuilder(EGGroupPersist groupPersist) {
String builderClass = groupPersist.builderClass;
@@ -539,7 +543,7 @@
}
return builder;
}
-
+
@SuppressWarnings("unchecked")
private EGCourbePersistBuilder<? extends EGCourbeChild> getCourbeBuilder(EGCourbePersist courbePersist) {
String builderClass = courbePersist.builderClass;
@@ -561,7 +565,7 @@
}
return builder;
}
-
+
public static void addEGAxeHorizontalPersistCompatibilityConfiguration(XStream parser) {
parser.aliasAttribute(EGAxeHorizontalPersist.class, "range", "minMax");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-13 14:58:23
|
Revision: 8127
http://fudaa.svn.sourceforge.net/fudaa/?rev=8127&view=rev
Author: deniger
Date: 2012-12-13 14:58:16 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -82,6 +82,7 @@
*/
double longueurPas_;
CtuluNumberFormatI specificFormat_;
+ CtuluNumberFormatI specificDetailFormat_;
String titre_;
boolean titreVisible_ = true;
String unite_;
@@ -109,10 +110,8 @@
}
public CtuluRange getRange() {
- return range_==null?new CtuluRange():new CtuluRange(range_);
+ return range_ == null ? new CtuluRange() : new CtuluRange(range_);
}
-
-
public void setIsDiscret(boolean isDiscret) {
this.isDiscret_ = isDiscret;
@@ -479,6 +478,12 @@
return specificFormat_ != null;
}
+ public CtuluNumberFormatI getSpecificDetailFormat() {
+ return specificDetailFormat_;
+ }
+
+
+
public boolean isTitreVisible() {
return titreVisible_;
}
@@ -653,6 +658,18 @@
}
}
+ /**
+ *
+ * @param _specificFormat format used for tooltips.
+ */
+ public final void setSpecificDetailFormat(final CtuluNumberFormatI _specificFormat) {
+ if (specificDetailFormat_ != _specificFormat) {
+ final CtuluNumberFormatI old = specificDetailFormat_;
+ specificDetailFormat_ = _specificFormat;
+ firePropertyChange("axeDetailFormat", old, specificDetailFormat_);
+ }
+ }
+
public boolean setTitre(final String _titre) {
if (!CtuluLibString.isEquals(titre_, _titre)) {
final String old = titre_;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -98,10 +98,10 @@
return CtuluLibString.ESPACE;
}
if (_rowIndex == c_.getModel().getNbValues()) {
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
return newX_ == null ? null : getX(newX_.doubleValue());
}
- if (_columnIndex == yRowIndex) {
+ if (_columnIndex == yColIndex) {
return newY_ == null ? null : getY(newY_.doubleValue());
}
}
@@ -121,9 +121,9 @@
if (d == null) {
return;
}
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
newX_ = d;
- } else if (_columnIndex == yRowIndex) {
+ } else if (_columnIndex == yColIndex) {
newY_ = d;
}
if (newX_ != null && newY_ != null) {
@@ -169,11 +169,11 @@
t.getCellEditor().stopCellEditing();
}
- if (col == tableModel.yRowIndex) {
- col = tableModel.xRowIndex;
+ if (col == tableModel.yColIndex) {
+ col = tableModel.xColIndex;
row++;
} else {
- col = tableModel.yRowIndex;
+ col = tableModel.yColIndex;
}
if (row >= t.getRowCount()) {
row = t.getRowCount() - 1;
@@ -221,11 +221,9 @@
@Override
protected String transformToString(Object value) {
-
+
return super.transformToString(value);
}
-
-
/**
* @param _values
@@ -440,9 +438,16 @@
if (_value != null) {
boolean ok = getSpecTableModel().isPointDrawn(_row);
res.setEnabled(ok);
+ setToolTipText(CtuluLibString.EMPTY_STRING);
if (!ok && _column == 1) {
setText(CtuluLibString.EMPTY_STRING);
}
+ SpecTableModel model = (SpecTableModel) _table.getModel();
+ if (_column == model.getXColIndex()) {
+ setToolTipText(model.getXDetailAsString(_row));
+ } else if (_column == model.getYColIndex()) {
+ setToolTipText(model.getYDetailAsString(_row));
+ }
}
return res;
}
@@ -450,7 +455,7 @@
@Override
protected void setValue(final Object _value) {
if (_value == null) {
- setText(EbliLib.getS("Ajouter"));
+ super.setValue(EbliLib.getS("Ajouter"));
} else {
super.setValue(_value);
}
@@ -506,7 +511,8 @@
@Override
public TableCellRenderer getDefaultRenderer(final Class _columnClass) {
- if (Double.class.equals(_columnClass)) {
+ if (Double.class
+ .equals(_columnClass)) {
return renderer_;
}
return super.getDefaultRenderer(_columnClass);
@@ -516,7 +522,8 @@
setDefaultEnterAction(t_);
final BuTextField txt = BuTextField.createDoubleField();
txt.setColumns(10);
- t_.setDefaultEditor(Double.class, new BuTableCellEditor(txt) {
+ t_
+ .setDefaultEditor(Double.class, new BuTableCellEditor(txt) {
@Override
public boolean isCellEditable(final EventObject _evt) {
if (_evt instanceof MouseEvent) {
@@ -656,6 +663,8 @@
actionDelete = new DeleteAction();
}
return actionDelete;
+
+
}
public class DeleteAction extends EbliActionSimple {
@@ -769,7 +778,7 @@
repaint();
}
- SpecTableModel getSpecTableModel() {
+ public SpecTableModel getSpecTableModel() {
return (SpecTableModel) t_.getModel();
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -21,8 +21,8 @@
EGCourbe c_;
EGGraphe a_;
- protected int xRowIndex = 0;
- protected int yRowIndex = 1;
+ protected int xColIndex = 0;
+ protected int yColIndex = 1;
public EGTableModel() {
}
@@ -31,6 +31,14 @@
a_ = _a;
}
+ public int getXColIndex() {
+ return xColIndex;
+ }
+
+ public int getYColIndex() {
+ return yColIndex;
+ }
+
@Override
public int getColumnCount() {
return 2;
@@ -66,13 +74,13 @@
}
double x = c_.getModel().getX(_rowIndex);
double y = c_.getModel().getY(_rowIndex);
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
try {
x = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
return;
}
- } else if (_columnIndex == yRowIndex) {
+ } else if (_columnIndex == yColIndex) {
try {
y = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
@@ -84,8 +92,8 @@
public void setValueAt(final double _val, final int _rowIndex, final int _columnIndex,
final CtuluCommandContainer _cmd) {
- final double x = _columnIndex == xRowIndex ? _val : c_.getModel().getX(_rowIndex);
- final double y = _columnIndex == yRowIndex ? _val : c_.getModel().getY(_rowIndex);
+ final double x = _columnIndex == xColIndex ? _val : c_.getModel().getX(_rowIndex);
+ final double y = _columnIndex == yColIndex ? _val : c_.getModel().getY(_rowIndex);
c_.getModel().setValue(_rowIndex, x, y, _cmd);
}
@@ -109,9 +117,9 @@
@Override
public String getColumnName(final int _column) {
String res = CtuluLibString.ESPACE;
- if (getH() != null && _column == xRowIndex) {
+ if (getH() != null && _column == xColIndex) {
res = getH().titre_;
- } else if (_column == yRowIndex && c_ != null && c_.getAxeY() != null) {
+ } else if (_column == yColIndex && c_ != null && c_.getAxeY() != null) {
res = c_.getAxeY().titre_;
}
return (res == null || res.length() == 0) ? CtuluLibString.ESPACE : res;
@@ -137,6 +145,26 @@
return Double.toString(_d);
}
+ protected String getXDetailAsString(int row) {
+ return getXDetail(getInitX(row));
+ }
+
+ protected String getYDetailAsString(int row) {
+ return getYDetail(getInitY(row));
+ }
+
+ protected String getXDetail(final double _d) {
+ final EGAxeHorizontal h = getH();
+
+ if (h != null) {
+ if (h.getSpecificDetailFormat() == null) {
+ return getX(_d);
+ }
+ return h.getSpecificDetailFormat().format(_d);
+ }
+ return Double.toString(_d);
+ }
+
protected String getY(final double _d) {
final EGAxeVertical h = c_ == null ? null : c_.getAxeY();
if (h != null && h.isSpecificFormat()) {
@@ -145,6 +173,25 @@
return Double.toString(_d);
}
+ protected String getYDetail(final double _d) {
+ final EGAxeVertical h = c_ == null ? null : c_.getAxeY();
+ if (h != null) {
+ if (h.getSpecificDetailFormat() == null) {
+ return getY(_d);
+ }
+ return h.getSpecificDetailFormat().format(_d);
+ }
+ return Double.toString(_d);
+ }
+
+ public double getInitX(int rowIndex) {
+ return c_.getModel().getX(rowIndex);
+ }
+
+ public double getInitY(int rowIndex) {
+ return c_.getModel().getY(rowIndex);
+ }
+
@Override
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
final EGAxeHorizontal h = getH();
@@ -152,10 +199,10 @@
if (c_ == null || h == null || (_rowIndex >= c_.getModel().getNbValues())) {
return CtuluLibString.EMPTY_STRING;
}
- if (_columnIndex == yRowIndex) {
+ if (_columnIndex == yColIndex) {
return getY(c_.getModel().getY(_rowIndex));
}
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
return getX(c_.getModel().getX(_rowIndex));
}
return CtuluLibString.EMPTY_STRING;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-14 09:58:57
|
Revision: 8130
http://fudaa.svn.sourceforge.net/fudaa/?rev=8130&view=rev
Author: deniger
Date: 2012-12-14 09:58:50 +0000 (Fri, 14 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-14 07:21:48 UTC (rev 8129)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-14 09:58:50 UTC (rev 8130)
@@ -93,6 +93,7 @@
protected boolean isTitreCentre_ = true;
protected TickIterator reuseIterator_;
protected Object key;
+ protected Object userObject;
public EGAxe() {
titre_ = "";
@@ -109,6 +110,14 @@
return isDiscret_;
}
+ public void setUserObject(Object userObject) {
+ this.userObject = userObject;
+ }
+
+ public Object getUserObject() {
+ return userObject;
+ }
+
public CtuluRange getRange() {
return range_ == null ? new CtuluRange() : new CtuluRange(range_);
}
@@ -481,8 +490,6 @@
public CtuluNumberFormatI getSpecificDetailFormat() {
return specificDetailFormat_;
}
-
-
public boolean isTitreVisible() {
return titreVisible_;
@@ -659,7 +666,7 @@
}
/**
- *
+ *
* @param _specificFormat format used for tooltips.
*/
public final void setSpecificDetailFormat(final CtuluNumberFormatI _specificFormat) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-14 07:21:48 UTC (rev 8129)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-14 09:58:50 UTC (rev 8130)
@@ -35,6 +35,7 @@
import org.fudaa.ctulu.CtuluDoubleParser;
import org.fudaa.ctulu.CtuluLibString;
import org.fudaa.ctulu.editor.CtuluValueEditorI;
+import org.fudaa.ctulu.gui.CtuluCellDecorator;
import org.fudaa.ctulu.gui.CtuluCellTextRenderer;
import org.fudaa.ctulu.gui.CtuluLibSwing;
import org.fudaa.ctulu.gui.CtuluSelectionListTableModelUpdater;
@@ -430,26 +431,37 @@
return false;
}
}
- final TableCellRenderer renderer_ = new CtuluCellTextRenderer() {
+
+ public CtuluCellTextRenderer getDefaultRenderer() {
+ return renderer_;
+ }
+
+
+
+
+ final CtuluCellTextRenderer renderer_ = new CtuluCellTextRenderer() {
@Override
public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected,
boolean _hasFocus, int _row, int _column) {
+ setToolTipText(CtuluLibString.EMPTY_STRING);
Component res = super.getTableCellRendererComponent(_table, _value, _isSelected, _hasFocus, _row, _column);
if (_value != null) {
boolean ok = getSpecTableModel().isPointDrawn(_row);
res.setEnabled(ok);
- setToolTipText(CtuluLibString.EMPTY_STRING);
if (!ok && _column == 1) {
setText(CtuluLibString.EMPTY_STRING);
}
SpecTableModel model = (SpecTableModel) _table.getModel();
- if (_column == model.getXColIndex()) {
- setToolTipText(model.getXDetailAsString(_row));
- } else if (_column == model.getYColIndex()) {
- setToolTipText(model.getYDetailAsString(_row));
+ //on modifie le tooltip que si non modifi\xE9 par le decorator eventuelle...
+ if (!CtuluLibString.EMPTY_STRING.equals(getToolTipText())) {
+ if (_column == model.getXColIndex()) {
+ setToolTipText(model.getXDetailAsString(_row));
+ } else if (_column == model.getYColIndex()) {
+ setToolTipText(model.getYDetailAsString(_row));
+ }
}
}
- return res;
+ return this;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-14 10:28:52
|
Revision: 8132
http://fudaa.svn.sourceforge.net/fudaa/?rev=8132&view=rev
Author: deniger
Date: 2012-12-14 10:28:45 +0000 (Fri, 14 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-14 09:59:58 UTC (rev 8131)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-14 10:28:45 UTC (rev 8132)
@@ -428,7 +428,10 @@
* @param _val la valeur a considerer
* @return la chaine a utiliser pour l'affichage de valeur interpolee
*/
- public String getStringInterpolatedAffiche(final double _val) {
+ public String getStringInterpolatedAffiche(final double _val, boolean detail) {
+ if (detail && specificDetailFormat_ != null) {
+ return specificDetailFormat_.format(_val);
+ }
if (specificFormat_ != null) {
return specificFormat_.format(_val);
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java 2012-12-14 09:59:58 UTC (rev 8131)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java 2012-12-14 10:28:45 UTC (rev 8132)
@@ -131,16 +131,16 @@
tb_.getTraceLigne().setCouleur(r.getXAxe().getLineColor());
tb_.setHPosition(SwingConstants.CENTER);
tb_.setVPosition(SwingConstants.TOP);
- final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_);
+ final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_, true);
tb_.paintBox((Graphics2D) _g, x, mx, s);
tb_.setColorText(v_.getLineColor());
tb_.getTraceLigne().setCouleur(v_.getLineColor());
tb_.setHPosition(v_.isDroite() ? SwingConstants.LEFT : SwingConstants.RIGHT);
tb_.setVPosition(SwingConstants.CENTER);
- tb_.paintBox((Graphics2D) _g, xmax, y, v_.getStringInterpolatedAffiche(yreel_[i]));
+ tb_.paintBox((Graphics2D) _g, xmax, y, v_.getStringInterpolatedAffiche(yreel_[i], true));
if (logAndEcart) {
tb_.paintBox((Graphics2D) _g, x + 5, (int) yPressed_.get(i), v_.getStringInterpolatedAffiche(r.getYReel(
- (int) yPressed_.get(i), v_)));
+ (int) yPressed_.get(i), v_), true));
}
}
_g.setColor(old);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2012-12-14 09:59:58 UTC (rev 8131)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2012-12-14 10:28:45 UTC (rev 8132)
@@ -22,33 +22,24 @@
/**
* @author Fred Deniger
- * @version $Id: EGInteractionSuivi.java,v 1.13 2006-09-19 14:55:53 deniger Exp
- * $
+ * @version $Id: EGInteractionSuivi.java,v 1.13 2006-09-19 14:55:53 deniger Exp $
*/
public class EGInteractionSuiviAllOrdonnees extends EGInteractiveComponent implements MouseListener,
- MouseMotionListener/* , EGGrapheModelListener */{
+ MouseMotionListener/* , EGGrapheModelListener */ {
boolean dessine_;
-
TraceIcon selected_;
-
TraceIcon normal_;
-
EGGraphe target_;
-
TraceBox tb_;
-
Color traceColor_;
-
EGAxeVertical v_;
-
double xreel_;
// TreeTableModelGraphe modelGraphe_ = new TreeTableModelGraphe();
// JXTreeTable treeTableNodes_ = new JXTreeTable(modelGraphe_);
// HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>();
// JLabel labelX_ = new JLabel("");
-
// public class TreeTableModelGraphe extends DefaultTreeTableModel {
// String[] titre_;
//
@@ -105,21 +96,6 @@
//
//
// }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
// /** Methode qui construit la structure du model **/
// public void constructStructureModel() {
//
@@ -144,12 +120,10 @@
//
// }
//
-
// modelGraphe_.setRoot(root);
//
//
// }
-
// /**
// * Recupere la valeure associee a la courbe dans la map
// *
@@ -162,12 +136,9 @@
// else
// return new Double(0);
// }
-
-
/**
- * Retourne le composant graphique qui se met a jour auto en fonction du clic
- * utilisateur.
- *
+ * Retourne le composant graphique qui se met a jour auto en fonction du clic utilisateur.
+ *
* @return
*/
// JPanel tableInfo_;
@@ -186,21 +157,16 @@
//
// return tableInfo_;
// }
-
@Override
public String getDescription() {
return EbliLib.getS("suivi");
}
-
double yreel_;
-
int selectedPtIdx_;
-
EGActionPaletteAllCoordonnees paelette_;
-
+
/**
- * @param _a
- * la cible pour le suivi.
+ * @param _a la cible pour le suivi.
*/
public EGInteractionSuiviAllOrdonnees(final EGGraphe _a, EGActionPaletteAllCoordonnees palette) {
target_ = _a;
@@ -228,12 +194,12 @@
// palette_.setSize(200, 200);
//
// this.addPropertyChangeListener(palette_);
-
-
- }
+
+ }
int yPressed_;
HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>();
+
private void updateWithMouse(final int _x, final int _y) {
if (!isActive()) {
return;
@@ -244,7 +210,7 @@
xreel_ = (int) xreel_;
}
- for (int i = 0; i < target_.getModel().getCourbes().length; i++) {
+ for (int i = 0; i < target_.getModel().getCourbes().length; i++) {
final EGCourbe ci = target_.getModel().getCourbes()[i]; // target_.
// getSelectedComponent();
@@ -269,11 +235,11 @@
}
paelette_.maj(xreel_, mapCurvesY_);
-
+
repaint();
-
-
-
+
+
+
}
private boolean isExactPtSelect() {
@@ -319,16 +285,12 @@
tb_.getTraceLigne().setCouleur(r.getXAxe().getLineColor());
tb_.setHPosition(SwingConstants.CENTER);
tb_.setVPosition(SwingConstants.TOP);
- final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_);
+ final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_, true);
tb_.paintBox((Graphics2D) _g, x, mx, s);
tb_.setColorText(v_.getLineColor());
tb_.getTraceLigne().setCouleur(v_.getLineColor());
tb_.setHPosition(v_.isDroite() ? SwingConstants.LEFT : SwingConstants.RIGHT);
tb_.setVPosition(SwingConstants.CENTER);
-// tb_.paintBox((Graphics2D) _g, v_.isDroite() ? xmax : xmin, y, v_.getStringInterpolatedAffiche(yreel_));
-// if (logAndEcart) {
-// tb_.paintBox((Graphics2D) _g, x + 5, yPressed_, v_.getStringInterpolatedAffiche(r.getYReel(yPressed_, v_)));
- // }
final Font oldF = _g.getFont();
_g.setColor(old);
_g.setFont(oldF);
@@ -402,7 +364,6 @@
public void mouseReleased(final MouseEvent _e) {
}
-
/**
* Methode appelee a chque activation
*/
@@ -413,17 +374,16 @@
v_ = null;
if (target_ != null) {
target_.repaint();
-
-
-
-
+
+
+
+
}
- // palette_.firePropertyChange("visible", 1, 0);
-
+ // palette_.firePropertyChange("visible", 1, 0);
+
}
- // palette_.firePropertyChange("visible", 0, 1);
+ // palette_.firePropertyChange("visible", 0, 1);
}
-
// public void axeAspectChanged(EGAxe _c) {
// constructStructureModel();
//
@@ -449,11 +409,4 @@
//
//
// }
-
-
-
-
-
-
-
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-02-26 16:22:44
|
Revision: 8302
http://fudaa.svn.sourceforge.net/fudaa/?rev=8302&view=rev
Author: deniger
Date: 2013-02-26 16:22:36 +0000 (Tue, 26 Feb 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeModelDefault.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelDecoratorInverse.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelTransformed.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -205,7 +205,6 @@
btValid.addActionListener(this);
add(bt);
final EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI.getIcon("restore"), "RESTORE") {
-
@Override
public void actionPerformed(final ActionEvent _e) {
// -- on reinitialise les mioin/max saisi par l'user --//
@@ -620,7 +619,6 @@
lb = new BuLabel(typePasTxt);
// -- listener de la combo --//
comboHorizontal_.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(final ActionEvent e) {
modeGraduationX_ = comboHorizontal_.getSelectedIndex();
@@ -776,8 +774,7 @@
comboVertical_ = new BuComboBox(new String[]{EbliLib.getS("Manuel: Nombre de graduations"),
EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")}) {
-
- @Override
+ @Override
public void setSelectedIndex(int anIndex) {
super.setSelectedIndex(anIndex);
@@ -791,7 +788,6 @@
pnAxeY_.add(tfVertSousPas_);
// -- listener de la combo --//
comboVertical_.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(final ActionEvent e) {
updateModeGraduationForY();
@@ -864,7 +860,6 @@
titreAxeXVisible = new BuCheckBox();
titreAxeXVisible.setToolTipText(EbliLib.getS("Affichage ou non du titre de l'axe"));
titreAxeXVisible.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(ActionEvent e) {
titreAxeXNom.setEnabled(titreAxeXVisible.isSelected() && axeX_.isTitleModifiable());
@@ -887,7 +882,6 @@
uniteAxeXVisible = new BuCheckBox();
uniteAxeXVisible.setToolTipText(EbliLib.getS("Affichage ou non de l'unit\xE9"));
uniteAxeXVisible.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(ActionEvent e) {
uniteAxeXNom.setEnabled(uniteAxeXVisible.isSelected() && axeX_.isUniteModifiable());
@@ -911,7 +905,6 @@
titreAxeYVisible = new BuCheckBox();
titreAxeYVisible.setToolTipText(EbliLib.getS("Affichage ou non du titre de l'axe"));
titreAxeYVisible.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(ActionEvent e) {
updateTitreAxeY();
@@ -935,7 +928,6 @@
uniteAxeYVisible = new BuCheckBox();
uniteAxeYVisible.setToolTipText(EbliLib.getS("Affichage ou non de l'unit\xE9"));
uniteAxeYVisible.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(ActionEvent e) {
updateUniteAxeY();
@@ -959,7 +951,7 @@
}
private CtuluValueEditorI getEditorFor(final EGAxe _a) {
- CtuluValueEditorI r = _a.getValueEditor();
+ CtuluValueEditorI r = _a == null ? null : _a.getValueEditor();
if (r == null) {
r = DEFAULT_EDITOR;
}
@@ -1104,7 +1096,10 @@
final Set s = new HashSet();
if (targets_ != null) {
for (int i = targets_.length - 1; i >= 0; i--) {
- s.add(targets_[i].getAxeY());
+ final EGAxeVertical axeY = targets_[i].getAxeY();
+ if (axeY != null) {
+ s.add(axeY);
+ }
}
}
if (s.size() > 0) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -76,6 +76,9 @@
boolean displayPointLabels_;
Font font_ = CtuluLibSwing.getMiniFont();
final TraceIconModel iconeModel_;
+ TraceIconModel iconeModelSpecific_;
+ private String specificIconTitle = EbliLib.getS("Icone pour points sp\xE9cifiques");
+ private boolean useSpecificIcon;
EGCourbeSurfacePainter surfacePainter_;
TraceBox tbox_;
protected TraceBox tboxLabels_;
@@ -85,12 +88,28 @@
*/
public EGCourbe(final EGModel _model) {
iconeModel_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK);
+ iconeModelSpecific_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK);
lineModel_ = new TraceLigneModel();
model_ = _model;
initLabelsTraceBox(Color.BLACK);
+ }
+ public boolean isUseSpecificIcon() {
+ return useSpecificIcon;
}
+ public String getSpecificIconTitle() {
+ return specificIconTitle;
+ }
+
+ public void setSpecificIconTitle(String specificIconTitle) {
+ this.specificIconTitle = specificIconTitle;
+ }
+
+ public void setUseSpecificIcon(boolean useSpecificIcon) {
+ this.useSpecificIcon = useSpecificIcon;
+ }
+
public Collection<EGCourbe> getAssociatesCourbesForExport() {
return Collections.emptyList();
}
@@ -469,6 +488,17 @@
*/
protected int largeurPointsNuage_ = 5;
+ protected TraceIcon getSpecificIcon() {
+ if (useSpecificIcon && iconeModelSpecific_ != null) {
+ return new TraceIcon(new TraceIconModel(iconeModelSpecific_));
+ }
+ return null;
+ }
+
+ protected boolean useSpecific(int idx) {
+ return getModel().useSpecificIcon(idx);
+ }
+
@Override
public void dessine(final Graphics2D _g, final EGRepere _t) {
if (!isVisible_) {
@@ -494,10 +524,14 @@
_g.setColor(EbliLib.getAlphaColor(getAspectContour(), alpha_));
final boolean isAlphaChanged = EbliLib.isAlphaChanged(alpha_);
final TraceIcon trIcon = new TraceIcon(isAlphaChanged ? new TraceIconModel(iconeModel_) : iconeModel_);
+ final TraceIcon trIconSpecific = getSpecificIcon();
final TraceLigne trLigne = new TraceLigne(isAlphaChanged ? new TraceLigneModel(lineModel_) : lineModel_);
if (isAlphaChanged) {
trIcon.setCouleur(EbliLib.getAlphaColor(trIcon.getCouleur(), alpha_));
trLigne.setCouleur(EbliLib.getAlphaColor(trLigne.getCouleur(), alpha_));
+ if (trIconSpecific != null) {
+ trIconSpecific.setCouleur(EbliLib.getAlphaColor(trIconSpecific.getCouleur(), alpha_));
+ }
}
// Les labels ont m\xEAme couleur que la courbe.
initLabelsTraceBox(trLigne.getCouleur());
@@ -541,16 +575,20 @@
}
}
}
+ final boolean useSpecific = trIconSpecific != null && useSpecific(i);
// Paint point
- if (iconeModel_.getType() != TraceIcon.RIEN) {
+ if (iconeModel_.getType() != TraceIcon.RIEN || (useSpecific && trIconSpecific.getType() != TraceIcon.RIEN)) {
if (displayTitleOnCurve_) {
if (rangeDisplayed == null) {
rangeDisplayed = new Envelope();
}
rangeDisplayed.expandToInclude(xi, yi);
}
- // icone_.couleur(getAspectContour());
- trIcon.paintIconCentre(_g, xie, yie);
+ if (useSpecific) {
+ trIconSpecific.paintIconCentre(_g, xie, yie);
+ } else {
+ trIcon.paintIconCentre(_g, xie, yie);
+ }
}
}
if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) {
@@ -724,6 +762,10 @@
return iconeModel_;
}
+ public TraceIconModel getIconModelSpecific() {
+ return iconeModelSpecific_;
+ }
+
@Override
public int getIconWidth() {
return 24;
@@ -1121,6 +1163,20 @@
return r;
}
+ public boolean setIconeModelSpecific(TraceIconModel traceIconModel) {
+ boolean r = false;
+ if (iconeModelSpecific_ == null) {
+ r = true;
+ iconeModelSpecific_ = new TraceIconModel();
+ }
+ r = iconeModelSpecific_.updateData(traceIconModel);
+ if (r) {
+ fireCourbeAspectChanged(false);
+ super.firePropertyChange(EGCourbeConfigureTarget.SPECIFIC_ICON, null, iconeModelSpecific_);
+ }
+ return r;
+ }
+
public boolean setLigneMark(final TraceLigneModel _data) {
if (tLigneMarqueur_ == null) {
buildLigneMarqueur();
@@ -1327,4 +1383,4 @@
protected void paintLabelBox(final Graphics2D _g, int xBox, int yBox, String pLabel, final EGRepere _t, Rectangle view) {
tboxLabels_.paintBox(_g, xBox, yBox, pLabel, view);
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -29,6 +29,8 @@
public abstract class EGCourbeConfigureTarget implements /*BConfigurableSectionInterface, */ BSelecteurTargetInterface,
BConfigurableInterface {
+ public static final String SPECIFIC_ICON = "SPECIFIC_ICON";
+
public static class Display extends EGCourbeConfigureTarget {
public Display(final EGCourbe _target) {
@@ -37,31 +39,34 @@
@Override
public Object getProperty(final String _key) {
- if (_key == BSelecteurIconModel.DEFAULT_PROPERTY) {
+ if (BSelecteurIconModel.DEFAULT_PROPERTY.equals(_key)) {
return target_.getIconModel();
}
- if (_key == BSelecteurColorChooser.DEFAULT_PROPERTY) {
+ if (SPECIFIC_ICON.equals(_key)) {
+ return target_.getIconModelSpecific();
+ }
+ if (BSelecteurColorChooser.DEFAULT_PROPERTY.equals(_key)) {
return target_.getAspectContour();
}
- if (_key == BSelecteurLineModel.PROPERTY) {
+ if (BSelecteurLineModel.PROPERTY.equals(_key)) {
return target_.getLigneModel();
}
- if (_key == BSelecteurAlpha.DEFAULT_PROPERTY) {
+ if (BSelecteurAlpha.DEFAULT_PROPERTY.equals(_key)) {
return new Integer(target_.getAlpha());
}
- if (_key == PROP_DISPLAY_TITLE_CURVE) {
+ if (PROP_DISPLAY_TITLE_CURVE.equals(_key)) {
return Boolean.valueOf(target_.isDisplayTitleOnCurve());
}
- if (_key == PROP_DISPLAY_POINT_LABELS) {
+ if (PROP_DISPLAY_POINT_LABELS.equals(_key)) {
return Boolean.valueOf(target_.isDisplayPointLabels());
}
- if (_key == PROP_DISPLAY_VERTICAL_LABELS) {
+ if (PROP_DISPLAY_VERTICAL_LABELS.equals(_key)) {
return Boolean.valueOf(target_.isVerticalLabels());
}
- if (_key == BSelecteurReduitFonteNewVersion.PROPERTY) {
+ if (BSelecteurReduitFonteNewVersion.PROPERTY.equals(_key)) {
return target_.getFont();
}
- if (_key == EGCourbeConfigureTarget.PROP_NUAGE_POINTS) {
+ if (EGCourbeConfigureTarget.PROP_NUAGE_POINTS.equals(_key)) {
return target_.isNuagePoints();
}
@@ -70,31 +75,34 @@
@Override
public boolean setProperty(final String _key, final Object _newProp) {
- if (_key == BSelecteurIconModel.DEFAULT_PROPERTY) {
+ if (BSelecteurIconModel.DEFAULT_PROPERTY.equals(_key)) {
return target_.setIconeModel((TraceIconModel) _newProp);
}
- if (_key == BSelecteurColorChooser.DEFAULT_PROPERTY) {
+ if (SPECIFIC_ICON.equals(_key)) {
+ return target_.setIconeModelSpecific((TraceIconModel) _newProp);
+ }
+ if (BSelecteurColorChooser.DEFAULT_PROPERTY.equals(_key)) {
return target_.setAspectContour((Color) _newProp);
}
- if (_key == BSelecteurLineModel.PROPERTY) {
+ if (BSelecteurLineModel.PROPERTY.equals(_key)) {
return target_.setLigneType((TraceLigneModel) _newProp);
}
- if (_key == BSelecteurAlpha.DEFAULT_PROPERTY) {
+ if (BSelecteurAlpha.DEFAULT_PROPERTY.equals(_key)) {
return target_.setAlpha(((Integer) _newProp).intValue());
}
- if (_key == PROP_DISPLAY_TITLE_CURVE) {
+ if (PROP_DISPLAY_TITLE_CURVE.equals(_key)) {
return target_.setDisplayTitleOnCurve(((Boolean) _newProp).booleanValue());
}
- if (_key == PROP_DISPLAY_POINT_LABELS) {
+ if (PROP_DISPLAY_POINT_LABELS.equals(_key)) {
return target_.setDisplayPointLabels(((Boolean) _newProp).booleanValue());
}
- if (_key == PROP_DISPLAY_VERTICAL_LABELS) {
+ if (PROP_DISPLAY_VERTICAL_LABELS.equals(_key)) {
return target_.setVerticalLabels(((Boolean) _newProp).booleanValue());
}
- if (_key == BSelecteurReduitFonteNewVersion.PROPERTY) {
+ if (BSelecteurReduitFonteNewVersion.PROPERTY.equals(_key)) {
return target_.setFont((Font) _newProp);
}
- if (_key == EGCourbeConfigureTarget.PROP_NUAGE_POINTS) {
+ if (EGCourbeConfigureTarget.PROP_NUAGE_POINTS.equals(_key)) {
boolean value = ((Boolean) _newProp).booleanValue();
return target_.setNuagePointEtApplique(value);
@@ -105,7 +113,8 @@
@Override
public BSelecteurInterface[] createSelecteurs() {
- final BSelecteurInterface[] res = new BSelecteurInterface[9];
+ boolean useSpecific = target_.isUseSpecificIcon();
+ final BSelecteurInterface[] res = new BSelecteurInterface[useSpecific ? 10 : 9];
int idx = 0;
res[idx] = new BSelecteurColorChooserBt();
((BSelecteurColorChooserBt) res[idx]).setAddListenerToTarget(false);
@@ -113,6 +122,11 @@
res[idx++] = new BSelecteurAlpha();
res[idx++] = new BSelecteurLineModel();
res[idx++] = new BSelecteurIconModel();
+ if (useSpecific) {
+ final BSelecteurIconModel bSelecteurIconModel = new BSelecteurIconModel(SPECIFIC_ICON);
+ bSelecteurIconModel.setTitle(target_.getSpecificIconTitle());
+ res[idx++] = bSelecteurIconModel;
+ }
res[idx] = new BSelecteurCheckBox(PROP_NUAGE_POINTS);
((BSelecteurCheckBox) res[idx++]).setTitle(EbliLib.getS("Nuage de points"));
res[idx] = new BSelecteurCheckBox(PROP_DISPLAY_TITLE_CURVE);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeModelDefault.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -79,6 +79,11 @@
y_ = CtuluLibArray.copy(_y);
}
+ @Override
+ public boolean useSpecificIcon(int idx) {
+ return false;
+ }
+
/**
* ACHTUNG: Constructeur uniquement utilis\xE9 pour la persistance des donn\xE9es.
*/
@@ -283,10 +288,8 @@
@Override
public boolean isGenerationSourceVisible() {
- return false;
+ return false;
}
-
-
@Override
public Object savePersistSpecificDatas() {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -56,6 +56,8 @@
TraceLigneModel tLigneMarqueur_;
@XStreamAlias("Icon")
TraceIconModel iconeModel;
+ @XStreamAlias("IconSpecific")
+ TraceIconModel iconeModelSpecific;
// -- data specifiques --//
@XStreamOmitField
Object dataSpecifiques;
@@ -119,10 +121,20 @@
return iconeModel;
}
+ public TraceIconModel getIconeModelSpecific() {
+ return iconeModelSpecific;
+ }
+
+
public void setIconeModel(TraceIconModel iconeModel) {
this.iconeModel = iconeModel;
}
+ public void setIconeModelSpecific(TraceIconModel iconeModelSpecific) {
+ this.iconeModelSpecific = iconeModelSpecific;
+ }
+
+
public List<EGCourbeMarqueur> getListeMarqueurs() {
return listeMarqueurs_;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -118,6 +118,11 @@
courbeToModify.setIconeModel(persist.iconeModel);
}
+ if (persist.iconeModelSpecific != null) {
+ courbeToModify.setIconeModelSpecific(persist.iconeModelSpecific);
+ }
+
+
courbeToModify.setNuagePoints(persist.nuagePoints);
if (persist.listeMarqueurs_ != null) {
@@ -177,6 +182,9 @@
res.tLigneMarqueur_ = new TraceLigneModel(courbe.getMarkLigneModel());
}
res.iconeModel = new TraceIconModel(courbe.getIconModel());
+ if (courbe.isUseSpecificIcon() && courbe.getIconModelSpecific() != null) {
+ res.iconeModelSpecific = new TraceIconModel(courbe.getIconModelSpecific());
+ }
final List<EGCourbeMarqueur> initMarqueurs = courbe.getMarqueurs();
if (initMarqueurs != null) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModel.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModel.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -236,7 +236,13 @@
* @param infos
*/
void restoreFromSpecificDatas(Object data, Map infos);
+
+ /**
+ *
+ * @param idx
+ * @return true if a specific icon must be used for this point
+ */
+ boolean useSpecificIcon(int idx);
-
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelDecoratorInverse.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelDecoratorInverse.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelDecoratorInverse.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -7,8 +7,8 @@
import org.fudaa.ebli.palette.BPaletteInfo.InfoData;
/**
- * Decorator pour le EGModel, inverse les x et y de la courbe. utilise le design pattern decorator. permet de g\xE9rer sans trop de
- * d\xE9gat l'inversion des donn\xE9es.
+ * Decorator pour le EGModel, inverse les x et y de la courbe. utilise le design pattern decorator. permet de g\xE9rer sans trop de d\xE9gat l'inversion des
+ * donn\xE9es.
*
* @author Adrien Hadoux
*
@@ -27,6 +27,11 @@
}
@Override
+ public boolean useSpecificIcon(int idx) {
+ return instanceModele_.useSpecificIcon(idx);
+ }
+
+ @Override
public boolean addValue(double[] _x, double[] _y, CtuluCommandContainer _cmd) {
return instanceModele_.addValue(_y, _x, _cmd);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelTransformed.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelTransformed.java 2013-02-23 00:10:39 UTC (rev 8301)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGModelTransformed.java 2013-02-26 16:22:36 UTC (rev 8302)
@@ -7,9 +7,8 @@
import org.fudaa.ebli.palette.BPaletteInfo.InfoData;
/**
- * Decorator pour le EGModel, permet de g\xE9rer sans trop de d\xE9gat des egmodel aux comportements diff\xE9rents. Utilise le
- * design pattern decorator.
- *
+ * Decorator pour le EGModel, permet de g\xE9rer sans trop de d\xE9gat des egmodel aux comportements diff\xE9rents. Utilise le design pattern decorator.
+ *
* @author Adrien Hadoux
*/
public class EGModelTransformed extends EGModelDecorator {
@@ -64,6 +63,11 @@
}
@Override
+ public boolean useSpecificIcon(int idx) {
+ return instanceModele_.useSpecificIcon(idx);
+ }
+
+ @Override
public double getXMax() {
return instanceModele_.getXMax();
}
@@ -150,19 +154,19 @@
@Override
public void viewGenerationSource(Map infos, CtuluUI impl) {
}
-
+
@Override
public boolean isGenerationSourceVisible() {
- return false;
+ return false;
}
@Override
public void replayData(EGGrapheModel model, Map infos, CtuluUI impl) {
}
-
+
@Override
public boolean isReplayable() {
- return false;
+ return false;
}
@Override
@@ -173,5 +177,4 @@
@Override
public void restoreFromSpecificDatas(Object data, Map infos) {
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|