|
From: <de...@us...> - 2012-10-05 15:09:46
|
Revision: 7712
http://fudaa.svn.sourceforge.net/fudaa/?rev=7712&view=rev
Author: deniger
Date: 2012-10-05 15:09:35 +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
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceBox.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 11:24:47 UTC (rev 7711)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-10-05 15:09:35 UTC (rev 7712)
@@ -84,7 +84,7 @@
// private boolean autoRestore_ = false;
private boolean autoRestore_ = EbliPreferences.EBLI.getBooleanProperty(getAutorRestorePref(), false);
private final RepereMouseKeyController repereController_;
- TObjectIntHashMap axeOffset_;
+ TObjectIntHashMap<EGAxeVertical> axeOffset_;
Image cache_;
CtuluCommandManager cmd_;
EGGrapheModel model_;
@@ -400,7 +400,7 @@
int prec = 0;
int precDroite = 0;
if (axeOffset_ == null) {
- axeOffset_ = new TObjectIntHashMap(nbElement);
+ axeOffset_ = new TObjectIntHashMap<EGAxeVertical>(nbElement);
} else {
axeOffset_.clear();
axeOffset_.ensureCapacity(nbElement);
@@ -483,8 +483,8 @@
}
}
- public List getAllAxeVertical() {
- return Arrays.asList(axeOffset_.keys());
+ public List<EGAxeVertical> getAllAxeVertical() {
+ return Arrays.<EGAxeVertical>asList(axeOffset_.keys(new EGAxeVertical[axeOffset_.size()]));
}
public final CtuluCommandManager getCmd() {
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 11:24:47 UTC (rev 7711)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EgHorizontalBanner.java 2012-10-05 15:09:35 UTC (rev 7712)
@@ -1,17 +0,0 @@
-/*
- 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);
-}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceBox.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceBox.java 2012-10-05 11:24:47 UTC (rev 7711)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceBox.java 2012-10-05 15:09:35 UTC (rev 7712)
@@ -10,7 +10,6 @@
import com.memoire.fu.FuLib;
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-10-09 16:58:05
|
Revision: 7728
http://fudaa.svn.sourceforge.net/fudaa/?rev=7728&view=rev
Author: deniger
Date: 2012-10-09 16:57:53 +0000 (Tue, 09 Oct 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/AbstractPropertyToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/BooleanToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/ColorToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/CtuluRangeToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/DoubleToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FloatToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FontToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/IntegerToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleArrayToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleToStringTransformer.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/PropertyToStringCacheDecorator.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/StringToStringTransformer.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.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/convert/EGAxePersistConverter.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGCourbePersistConverter.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGPersistHelper.java
trunk/framework/ebli-1d/src/test/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverterTest.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/ToStringTransfomerXstreamConverter.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceBoxToStringTransformer.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceIconModelToStringTransformer.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceLigneModelToStringTransformer.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/AbstractPropertyToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/AbstractPropertyToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/AbstractPropertyToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -7,7 +7,16 @@
public abstract class AbstractPropertyToStringTransformer<T> {
public static final String NULL_STRING = "null";
+ private final Class supportedClass;
+ public AbstractPropertyToStringTransformer(Class supportedClass) {
+ this.supportedClass = supportedClass;
+ }
+
+ public Class getSupportedClass() {
+ return supportedClass;
+ }
+
public String toString(T in) {
if (in == null) {
return "null";
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/BooleanToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/BooleanToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/BooleanToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -12,6 +12,10 @@
*/
public class BooleanToStringTransformer extends AbstractPropertyToStringTransformer<Boolean> {
+ public BooleanToStringTransformer() {
+ super(Boolean.class);
+ }
+
@Override
public Boolean fromStringSafe(String in) {
try {
@@ -31,5 +35,4 @@
public String toStringSafe(Boolean in) {
return in.toString();
}
-
}
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/ColorToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/ColorToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/ColorToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -15,6 +15,7 @@
public class ColorToStringTransformer extends AbstractPropertyToStringTransformer<Color> {
public ColorToStringTransformer() {
+ super(Color.class);
}
@Override
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/CtuluRangeToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/CtuluRangeToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/CtuluRangeToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -15,6 +15,10 @@
*/
public class CtuluRangeToStringTransformer extends AbstractPropertyToStringTransformer<CtuluRange> {
+ public CtuluRangeToStringTransformer() {
+ super(CtuluRange.class);
+ }
+
@Override
public CtuluRange fromStringSafe(String in) {
String[] split = FuLib.split(in, ' ');
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/DoubleToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/DoubleToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/DoubleToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -12,6 +12,10 @@
*/
public class DoubleToStringTransformer extends AbstractPropertyToStringTransformer<Double> {
+ public DoubleToStringTransformer() {
+ super(Double.class);
+ }
+
@Override
public Double fromStringSafe(String in) {
try {
@@ -36,5 +40,4 @@
public String toStringSafe(Double in) {
return in.toString();
}
-
}
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FloatToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FloatToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FloatToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -11,7 +11,10 @@
* @author Frederic Deniger
*/
public class FloatToStringTransformer extends AbstractPropertyToStringTransformer<Float> {
-
+ public FloatToStringTransformer() {
+ super(Float.class);
+ }
+
@Override
public Float fromStringSafe(String in) {
try {
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FontToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FontToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/FontToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -5,8 +5,6 @@
import com.memoire.fu.FuLib;
import java.awt.Font;
-import java.util.HashMap;
-import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -17,6 +15,7 @@
public class FontToStringTransformer extends AbstractPropertyToStringTransformer<Font> {
public FontToStringTransformer() {
+ super(Font.class);
}
@Override
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/IntegerToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/IntegerToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/IntegerToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -12,6 +12,10 @@
*/
public class IntegerToStringTransformer extends AbstractPropertyToStringTransformer<Integer> {
+ public IntegerToStringTransformer() {
+ super(Integer.class);
+ }
+
@Override
public Integer fromStringSafe(String in) {
try {
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleArrayToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleArrayToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleArrayToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -12,6 +12,10 @@
*/
public class Point2DDoubleArrayToStringTransformer extends AbstractPropertyToStringTransformer<Point2D.Double[]> {
+ public Point2DDoubleArrayToStringTransformer() {
+ super(Point2D.Double[].class);
+ }
+
@Override
public Point2D.Double[] fromStringSafe(String in) {
Point2DDoubleToStringTransformer elemTransformer = new Point2DDoubleToStringTransformer();
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/Point2DDoubleToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -14,6 +14,10 @@
*/
public class Point2DDoubleToStringTransformer extends AbstractPropertyToStringTransformer<Point2D.Double> {
+ public Point2DDoubleToStringTransformer() {
+ super(Point2D.Double.class);
+ }
+
@Override
public Point2D.Double fromStringSafe(String in) {
String[] split = FuLib.split(in, ' ');
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/PropertyToStringCacheDecorator.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/PropertyToStringCacheDecorator.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/PropertyToStringCacheDecorator.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -16,6 +16,7 @@
Map<String, T> cache = new HashMap<String, T>();
public PropertyToStringCacheDecorator(AbstractPropertyToStringTransformer<T> decorated) {
+ super(decorated.getSupportedClass());
this.decorated = decorated;
}
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/StringToStringTransformer.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/StringToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/converter/StringToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -9,6 +9,10 @@
*/
public class StringToStringTransformer extends AbstractPropertyToStringTransformer<String> {
+ public StringToStringTransformer() {
+ super(String.class);
+ }
+
@Override
public String fromStringSafe(String in) {
return in;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -13,61 +13,61 @@
*
* @author Adrien Hadoux
*/
-@XStreamAlias("horizontalAxis")
+@XStreamAlias("HorizontalAxis")
public class EGAxeHorizontalPersist {
- @XStreamAlias("title")
+ @XStreamAlias("Title")
String titre;
- @XStreamAlias("visibleTitle")
+ @XStreamAlias("VisibleTitle")
boolean titreVisible = true;
- @XStreamAlias("unit")
+ @XStreamAlias("Unit")
String unite;
- @XStreamAlias("grid")
+ @XStreamAlias("Grid")
TraceLigne grille;
- @XStreamAlias("visible")
+ @XStreamAlias("Visible")
boolean visible;
- @XStreamAlias("font")
+ @XStreamAlias("Font")
Font font;
- @XStreamAlias("graduations")
+ @XStreamAlias("Graduations")
boolean graduations;
- @XStreamAlias("isIteratorUptodate")
+ @XStreamAlias("IsIteratorUptodate")
boolean isIteratorUptodate;
- @XStreamAlias("lineColor")
+ @XStreamAlias("LineColor")
Color lineColor;
- @XStreamAlias("axisRange")
+ @XStreamAlias("AxisRange")
CtuluRange range;
/**
* Booleen qui indique si l'on trace ou non la graduation
*/
- @XStreamAlias("gridPainted")
+ @XStreamAlias("GridPainted")
boolean traceGrille_ = false;
/**
* Booleen qui indique si l'on trcae
*/
- @XStreamAlias("minorGridPainted")
+ @XStreamAlias("MinorGridPainted")
boolean traceSousGrille_ = false;
- @XStreamAlias("markLine")
+ @XStreamAlias("MarkLine")
TraceLigneModel traceGraduations_ = null;
- @XStreamAlias("minorMarkLine")
+ @XStreamAlias("MinorMarkLine")
TraceLigneModel traceSousGraduations_ = null;
/**
* Mode nb graduations
*/
- @XStreamAlias("step")
+ @XStreamAlias("Step")
int nbPas_;
/**
* Mode on donne la longueur des pas
*/
- @XStreamAlias("stepLength")
+ @XStreamAlias("StepLength")
double longueurPas_;
/**
* le mode de graduation
*/
- @XStreamAlias("modeGraduation")
+ @XStreamAlias("ModeGraduation")
int modeGraduations_;
- @XStreamAlias("sizeMinorGraduation")
+ @XStreamAlias("SizeMinorGraduation")
int nbSousGraduations_;
- @XStreamAlias("extremDisplayed")
+ @XStreamAlias("ExtremDisplayed")
private boolean isExtremiteDessinee_;
public EGAxeHorizontalPersist(final EGAxeHorizontal axeX) {
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 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -14,73 +14,74 @@
* @author Adrien Hadoux
*
*/
-@XStreamAlias("verticalAxis")
+@XStreamAlias("VerticalAxis")
public class EGAxeVerticalPersist {
- @XStreamAlias("right")
+ @XStreamAlias("Right")
boolean droite;
- @XStreamAlias("verticalTitle")
+ @XStreamAlias("VerticalTitle")
boolean titreVertical;
- @XStreamAlias("verticalRightTitle")
+ @XStreamAlias("VerticalRightTitle")
boolean titreVerticalDroite;
- @XStreamAlias("title")
+ @XStreamAlias("Title")
String titre;
- @XStreamAlias("titleIsVisible")
+ @XStreamAlias("TitleIsVisible")
boolean titreVisible = true;
- @XStreamAlias("unit")
+ @XStreamAlias("Unit")
String unite;
- @XStreamAlias("visible")
+ @XStreamAlias("Visible")
boolean visible;
- @XStreamAlias("font")
+ @XStreamAlias("Font")
Font font;
- @XStreamAlias("graduations")
+ @XStreamAlias("Graduations")
boolean graduations;
- @XStreamAlias("grille")
+ @XStreamAlias("Grille")
TraceLigne grille;
- @XStreamAlias("isIteratorUptodate")
+ @XStreamAlias("IsIteratorUptodate")
boolean isIteratorUptodate;
- @XStreamAlias("lineColor")
+ @XStreamAlias("LineColor")
Color lineColor;
- @XStreamAlias("axisRange")
+ @XStreamAlias("AxisRange")
CtuluRange range;
/**
* Booleen qui indique si l'on trace ou non la graduation
*/
- @XStreamAlias("gridPainted")
+ @XStreamAlias("GridPainted")
boolean traceGrille_ = false;
/**
* Booleen qui indique si l'on trcae
*/
- @XStreamAlias("minorGridPainted")
+ @XStreamAlias("MinorGridPainted")
boolean traceSousGrille_ = false;
- @XStreamAlias("markLine")
+ @XStreamAlias("MarkLine")
TraceLigneModel traceGraduations_ = null;
- @XStreamAlias("minorMarkLine")
+ @XStreamAlias("MinorMarkLine")
TraceLigneModel traceSousGraduations_ = null;
/**
* Mode nb graduations
*/
- @XStreamAlias("step")
+ @XStreamAlias("Step")
int nbPas_;
/**
* Mode on donne la longueur des pas
*/
- @XStreamAlias("stepLength")
+ @XStreamAlias("StepLength")
double longueurPas_;
/**
* le mode de graduation
*/
- @XStreamAlias("modeGraduation")
+ @XStreamAlias("ModeGraduation")
int modeGraduations_;
- @XStreamAlias("sizeMinorGraduation")
+ @XStreamAlias("SizeMinorGraduation")
int nbSousGraduations_;
- @XStreamAlias("extremDisplayed")
+ @XStreamAlias("ExtremDisplayed")
private boolean isExtremiteDessinee_;
public EGAxeVerticalPersist(EGAxeVertical axeY) {
// TODO Auto-generated constructor stub
fillInfoWith(axeY);
}
+
public EGAxeVerticalPersist() {
}
@@ -259,8 +260,6 @@
public void setIsExtremiteDessinee(boolean isExtremiteDessinee_) {
this.isExtremiteDessinee_ = isExtremiteDessinee_;
}
-
-
private void fillInfoWith(EGAxeVertical axeY) {
this.droite = axeY.droite_;
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 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -14,16 +14,16 @@
*
* @author Adrien Hadoux
*/
-@XStreamAlias("curve")
+@XStreamAlias("Curve")
public class EGCourbePersist extends EGPersist {
- @XStreamAlias("title")
+ @XStreamAlias("Title")
String title_;
- @XStreamAlias("idGroup")
+ @XStreamAlias("IdGroup")
int Idgroup;
- @XStreamAlias("id")
+ @XStreamAlias("Id")
int id = -1;
- @XStreamAlias("nuagePoint")
+ @XStreamAlias("NuagePoint")
boolean nuagePoints = false;
// /-- les min et max sont purement informatifs --//
@XStreamOmitField
@@ -49,13 +49,13 @@
@XStreamOmitField
double[] ordonnees;
// -- proprietes graphiques --//
- @XStreamAlias("traceBox")
+ @XStreamAlias("TraceBox")
TraceBox tracebox;
- @XStreamAlias("line")
+ @XStreamAlias("Line")
TraceLigneModel lineModel_;
- @XStreamAlias("markLine")
+ @XStreamAlias("MarkLine")
TraceLigneModel tLigneMarqueur_;
- @XStreamAlias("icon")
+ @XStreamAlias("Icon")
TraceIconModel iconeModel;
// -- data specifiques --//
@XStreamOmitField
@@ -63,18 +63,18 @@
@XStreamOmitField
String classeModel;
// -- liste des marqueurs --//
- @XStreamImplicit(itemFieldName = "marks")
+ @XStreamImplicit(itemFieldName = "Marks")
List<EGCourbeMarqueur> listeMarqueurs_;
- @XStreamAlias("surface")
+ @XStreamAlias("Surface")
EGCourbeSurfacePersist surfacePainter;
// -- inverse ou non les x et y --//
- @XStreamAlias("inverse")
+ @XStreamAlias("Inverse")
boolean inverse = false;
- @XStreamAlias("displayLabels")
+ @XStreamAlias("DisplayLabels")
boolean displayLabels = false;
- @XStreamAlias("displayTitle")
+ @XStreamAlias("DisplayTitle")
boolean displayTitle = false;
- @XStreamAlias("verticalLabels")
+ @XStreamAlias("VerticalLabels")
boolean verticalLabels = false;
public EGCourbePersist() {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverter.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverter.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverter.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -8,9 +8,6 @@
import org.fudaa.ebli.converter.TraceToStringConverter;
import org.fudaa.ebli.courbe.EGAxeHorizontalPersist;
import org.fudaa.ebli.courbe.EGAxeVerticalPersist;
-import org.fudaa.ebli.courbe.EGCourbeMarqueur;
-import org.fudaa.ebli.courbe.EGCourbePersist;
-import org.fudaa.ebli.courbe.EGPersist;
/**
*
@@ -39,13 +36,16 @@
public void init() {
if (xstream == null) {
- xstream = EGPersistHelper.initXstream(traceToStringConverter);
+ xstream = EGPersistHelper.createXstream();
+ initXstream(xstream);
}
+ }
+
+ public void initXstream(XStream xstream) {
+ EGPersistHelper.registerDefaultConverters(xstream, traceToStringConverter);
xstream.processAnnotations(EGAxeHorizontalPersist.class);
xstream.processAnnotations(EGAxeVerticalPersist.class);
xstream.alias("range", CtuluRange.class);
- xstream.alias("range", CtuluRange.class);
-
}
public String toXml(EGAxeHorizontalPersist in) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGCourbePersistConverter.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGCourbePersistConverter.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGCourbePersistConverter.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -36,12 +36,9 @@
public void init() {
if (xstream == null) {
- xstream = EGPersistHelper.initXstream(traceToStringConverter);
+ xstream = EGPersistHelper.createXstream();
+ initXstream(xstream);
}
- xstream.omitField(EGPersist.class, "builderClass");
- xstream.omitField(EGPersist.class, "specificValues");
- xstream.processAnnotations(EGCourbePersist.class);
- xstream.processAnnotations(EGCourbeMarqueur.class);
}
public String toXml(EGCourbePersist in) {
@@ -57,4 +54,14 @@
}
return (EGCourbePersist) xstream.fromXML(in);
}
+
+ public void initXstream(final XStream xstream) {
+ EGPersistHelper.registerDefaultConverters(xstream, traceToStringConverter);
+ xstream.omitField(EGPersist.class, "builderClass");
+ xstream.omitField(EGCourbePersist.class, "id");
+ xstream.omitField(EGCourbePersist.class, "Idgroup");
+ xstream.omitField(EGCourbePersist.class, "specificValues");
+ xstream.processAnnotations(EGCourbePersist.class);
+ xstream.processAnnotations(EGCourbeMarqueur.class);
+ }
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGPersistHelper.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGPersistHelper.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/convert/EGPersistHelper.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -8,6 +8,7 @@
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
import java.awt.Color;
import java.awt.Font;
+import javax.swing.plaf.FontUIResource;
import org.fudaa.ctulu.CtuluRange;
import org.fudaa.ctulu.converter.CtuluRangeToStringTransformer;
import org.fudaa.ebli.converter.ToStringTransfomerXstreamConverter;
@@ -27,6 +28,7 @@
public static void registerDefaultConverters(XStream xstream, TraceToStringConverter traceToStringConverter) {
xstream.registerConverter(new ToStringTransfomerXstreamConverter(traceToStringConverter.getColorToStringTransformer(), Color.class));
xstream.registerConverter(new ToStringTransfomerXstreamConverter(traceToStringConverter.getFontToStringTransformer(), Font.class));
+ xstream.registerConverter(new ToStringTransfomerXstreamConverter(traceToStringConverter.getFontToStringTransformer(), FontUIResource.class));
xstream.registerConverter(new ToStringTransfomerXstreamConverter(traceToStringConverter.getTraceBoxToStringTransformer(), TraceBox.class));
xstream.registerConverter(new ToStringTransfomerXstreamConverter(traceToStringConverter.getTraceIconModelToStringTransformer(), TraceIconModel.class));
final TraceLigneModelToStringTransformer traceLigneModelToStringTransformer = traceToStringConverter.getTraceLigneModelToStringTransformer();
@@ -35,11 +37,10 @@
xstream.registerConverter(new TraceLigneToStringXstreamConverter(traceLigneModelToStringTransformer));
}
- public static XStream initXstream(TraceToStringConverter traceToStringConverter) {
+ public static XStream createXstream() {
final XmlFriendlyNameCoder replacer = new XmlFriendlyNameCoder("#", "_");
final StaxDriver staxDriver = new StaxDriver(replacer);
final XStream xstream = new XStream(staxDriver);
- registerDefaultConverters(xstream, traceToStringConverter);
return xstream;
}
}
Modified: trunk/framework/ebli-1d/src/test/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverterTest.java
===================================================================
--- trunk/framework/ebli-1d/src/test/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverterTest.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-1d/src/test/java/org/fudaa/ebli/courbe/convert/EGAxePersistConverterTest.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -3,6 +3,7 @@
*/
package org.fudaa.ebli.courbe.convert;
+import com.memoire.bu.BuLib;
import java.awt.Color;
import junit.framework.TestCase;
import org.fudaa.ctulu.CtuluRange;
@@ -16,22 +17,23 @@
* @author Frederic Deniger
*/
public class EGAxePersistConverterTest extends TestCase {
-
+
public EGAxePersistConverterTest(String testName) {
super(testName);
}
-
+
public void testToStringVertical() {
try {
EGAxeVerticalPersist verticalPersist = new EGAxeVerticalPersist();
verticalPersist.setDroite(true);
verticalPersist.setRange(new CtuluRange(0, 10));
+ verticalPersist.setFont(BuLib.DEFAULT_FONT);
EGAxePersistConverter converter = new EGAxePersistConverter();
String toXml = converter.toXml(verticalPersist);
EGAxeVerticalPersist fromXml = converter.fromXmlVertical(toXml);
assertNotNull(fromXml);
assertEquals(verticalPersist.isDroite(), fromXml.isDroite());
-
+
verticalPersist.setGrille(new TraceLigne(new TraceLigneModel(4, 4, Color.DARK_GRAY)));
toXml = converter.toXml(verticalPersist);
fromXml = converter.fromXmlVertical(toXml);
@@ -42,7 +44,7 @@
fail(e.getMessage());
}
}
-
+
public void testToStringHorizontal() {
try {
EGAxeHorizontalPersist hPersist = new EGAxeHorizontalPersist();
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/ToStringTransfomerXstreamConverter.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/ToStringTransfomerXstreamConverter.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/ToStringTransfomerXstreamConverter.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -3,11 +3,13 @@
*/
package org.fudaa.ebli.converter;
+import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import java.util.Collection;
import org.fudaa.ctulu.converter.AbstractPropertyToStringTransformer;
/**
@@ -16,18 +18,22 @@
*
* @author Frederic Deniger
*/
-public class ToStringTransfomerXstreamConverter implements Converter {
+public class ToStringTransfomerXstreamConverter<T> implements Converter {
- private final AbstractPropertyToStringTransformer toStringTransformer;
+ private final AbstractPropertyToStringTransformer<T> toStringTransformer;
private final Class supportedClass;
- public ToStringTransfomerXstreamConverter(AbstractPropertyToStringTransformer toStringTransformer, Class supportedClass) {
+ public ToStringTransfomerXstreamConverter(AbstractPropertyToStringTransformer<T> toStringTransformer, Class supportedClass) {
this.toStringTransformer = toStringTransformer;
this.supportedClass = supportedClass;
}
+ public AbstractPropertyToStringTransformer<T> getToStringTransformer() {
+ return toStringTransformer;
+ }
+
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
- writer.setValue(toStringTransformer.toString(source));
+ writer.setValue(toStringTransformer.toString((T) source));
}
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
@@ -37,4 +43,11 @@
public boolean canConvert(Class type) {
return supportedClass.equals(type);
}
+
+ public static void register(Collection<? extends AbstractPropertyToStringTransformer> transformers, XStream xstream) {
+ for (AbstractPropertyToStringTransformer transformer : transformers) {
+ xstream.registerConverter(new ToStringTransfomerXstreamConverter(transformer, transformer.getSupportedClass()));
+
+ }
+ }
}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceBoxToStringTransformer.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceBoxToStringTransformer.java 2012-10-08 20:22:12 UTC (rev 7727)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/converter/TraceBoxToStringTransformer.java 2012-10-09 16:57:53 UTC (rev 7728)
@@ -26,6 +26,7 @@
}
public TraceBoxToStringTransformer(AbstractPro...
[truncated message content] |
|
From: <de...@us...> - 2012-10-10 20:25:19
|
Revision: 7733
http://fudaa.svn.sourceforge.net/fudaa/?rev=7733&view=rev
Author: deniger
Date: 2012-10-10 20:25:08 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionInteraction.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionAbstract.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionInterface.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliLib.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionInteraction.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionInteraction.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionInteraction.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -1,8 +1,8 @@
/**
- * @creation 24 juin 2004
- * @modification $Date: 2006-07-13 13:35:42 $
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @creation 24 juin 2004
+ * @modification $Date: 2006-07-13 13:35:42 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
* @mail de...@fu...
*/
package org.fudaa.ebli.courbe;
@@ -19,30 +19,31 @@
* @version $Id: EGActionInteraction.java,v 1.5 2006-07-13 13:35:42 deniger Exp $
*/
public class EGActionInteraction extends EbliActionChangeState implements PropertyChangeListener {
-
+
@Override
public void propertyChange(final PropertyChangeEvent _evt) {
final boolean newVal = ((Boolean) _evt.getNewValue()).booleanValue();
- if(newVal!=isSelected()) {
+ if (newVal != isSelected()) {
setSelected(newVal);
}
}
-
EGInteractiveComponent interComp_;
-
+
public EGActionInteraction(final String _name, final Icon _ic, final String _action, final EGInteractiveComponent _inter) {
super(_name, _ic, _action);
setTarget(_inter);
}
-
+
public final void setTarget(final EGInteractiveComponent _inter) {
+ if (interComp_ != null) {
+ interComp_.removePropertyChangeListener("active", this);
+ }
interComp_ = _inter;
interComp_.addPropertyChangeListener("active", this);
}
-
+
@Override
public void changeAction() {
interComp_.setActive(isSelected());
}
-
-}
\ No newline at end of file
+}
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-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -59,7 +59,7 @@
*/
public class EGFillePanel extends BuPanel implements PropertyChangeListener, ActionListener, CtuluSelectionInterface,
CtuluImageProducer {
-
+
protected final EGVue vue_;
JLabel lbTools_;
EbliActionInterface[] personnalAction_;
@@ -72,16 +72,24 @@
public EGFillePanel(final EGGraphe _a) {
this(_a, null);
}
-
+
public EGFillePanel duplicate() {
return new EGFillePanel(vue_.getGraphe().duplicate());
}
-
+
+ /**
+ * doit etre appelee si le panneau est ferm\xE9 definitivement
+ */
+ public void cleanListeners() {
+ EbliLib.cleanListener(personnalAction_);
+ EbliLib.cleanListener(specificTools_);
+ }
+
public void addSelectionListener(final CtuluListSelectionListener _l) {
selection_.addSelectionListener(_l);
-
+
}
-
+
public EGFillePanel(final EGGraphe _a, final EbliActionInterface[] _userAction) {
setLayout(new BuBorderLayout(5, 0));
personnalAction_ = _userAction;
@@ -96,7 +104,7 @@
lbTools_.setPreferredSize(new Dimension(200, 20));
lbTools_.setSize(new Dimension(100, 20));
lbTools_.setOpaque(false);
-
+
add(lbTools_, BuBorderLayout.SOUTH);
vue_ = new EGVue(_a);
add(vue_, BuBorderLayout.CENTER);
@@ -105,7 +113,7 @@
// suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe());
}
-
+
protected void addListenerCourbePoint(final CtuluListSelectionListener _l) {
selection_.getSelection().addListeSelectionListener(_l);
}
@@ -126,7 +134,7 @@
r.add(a);
selection_.addPropertyChangeListener(this);
actionForGroup.add(a);
-
+
EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI
.getIcon("restore"), "RESTORE") {
@Override
@@ -161,7 +169,7 @@
r.add(a);
actionForGroup.add(a);
zoom.addPropertyChangeListener(this);
-
+
final EGInteractionMove move = new EGInteractionMove(vue_.graphe_);
move.setDefaultInteractiveComponent(selection_);
vue_.addInteractiveCmp(move);
@@ -170,7 +178,7 @@
a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('m'));
r.add(a);
actionForGroup.add(a);
-
+
final EGInteractionSuivi suivi = new EGInteractionSuivi(vue_.getGraphe());
vue_.addInteractiveCmp(suivi);
a = new EGActionInteraction(EbliLib.getS("suivi"), EbliResource.EBLI.getIcon("pointeur"), "SUIVI", suivi);
@@ -181,7 +189,7 @@
actionForGroup.add(a);
EbliActionSimple actionpal = new EGActionPaletteAllCoordonnees(this);
r.add(actionpal);
-
+
if (getModel().isContentModifiable()) {
r.add(null);
final EGInteractionAddPoint addPt = new EGInteractionAddPoint(this);
@@ -200,7 +208,7 @@
r.add(a);
pt.addPropertyChangeListener(this);
actionForGroup.add(a);
-
+
EbliActionSimple act = new EGSimplificationAction(vue_.graphe_);
r.add(act);
r.add(null);
@@ -215,16 +223,16 @@
EGPaletteLegendeGraphe palette = new EGPaletteLegendeGraphe(getGraphe());
palette.setPreferredSize(new Dimension(500, 600));
palette.afficheModale(CtuluLibSwing.getFrameAncestor(EGFillePanel.this));
-
+
}
});
-
+
final BPaletteInfoAbstractAction info = new BPaletteInfoAbstractAction() {
@Override
public JComponent buildContentPane() {
return new EGPaletteInfo(EGFillePanel.this, null);
}
-
+
@Override
protected boolean mustBeUpdated() {
return getModel().getNbSelectedObjects() >= 0;
@@ -232,9 +240,9 @@
};
r.add(info);
r.add(new EGTableAction(getGraphe()));
-
+
new EbliActionGroup(actionForGroup);
-
+
if (personnalAction_ != null) {
r.add(null);
final int nb = personnalAction_.length;
@@ -259,43 +267,43 @@
| InputEvent.SHIFT_DOWN_MASK));
r.add(addAction);
}
-
+
final EbliActionInterface[] rf = new EbliActionInterface[r.size()];
r.toArray(rf);
EbliLib.updateMapKeyStroke(this, rf);
-
+
return rf;
}
-
+
protected EGCourbe getCourbeSelected() {
return vue_.graphe_.getSelectedComponent();
}
-
+
public EGGraphe getGraphe() {
return vue_.graphe_;
}
-
+
protected EGGrapheModel getModel() {
return vue_.graphe_.getModel();
}
-
+
public CtuluListSelection getSelection() {
return selection_.getSelection();
}
-
+
public void majSelectionListener(final EGTableGraphePanel _tablePanel) {
if ((selection_ != null) && (_tablePanel != null)) {
_tablePanel.setListenerToSelection(selection_);
}
}
-
+
protected void majLabelInfo(final String _s) {
lbTools_.setText(_s);
}
-
+
protected void fillPopupMenu(final BuPopupMenu _menu) {
}
-
+
public void popupMenu(final int _x, final int _y) {
final BuPopupMenu m = new BuPopupMenu();
m.setInvoker(this);
@@ -305,7 +313,7 @@
fillSpecificMenu(m);
m.show(this, _x, _y);
}
-
+
@Override
public void actionPerformed(final ActionEvent _evt) {
if (FuLog.isTrace()) {
@@ -377,7 +385,7 @@
}
}
}
-
+
@Override
public void find() {
}
@@ -389,23 +397,23 @@
public Dimension getDefaultImageDimension() {
return vue_.getDefaultImageDimension();
}
-
+
public EGVue getView() {
return vue_;
}
-
+
public EbliActionInterface[] getSpecificActions() {
if (specificTools_ == null) {
specificTools_ = buildActions();
}
return specificTools_;
}
-
+
@Override
public void clearSelection() {
selection_.clearSelection();
}
-
+
@Override
public void inverseSelection() {
selection_.inverseSelection();
@@ -416,15 +424,15 @@
*/
@Override
public BufferedImage produceImage(final Map _params) {
-
+
return vue_.produceImage(_params);
}
-
+
@Override
public BufferedImage produceImage(final int _w, final int _h, final Map _params) {
return vue_.produceImage(_w, _h, _params);
}
-
+
@Override
public void propertyChange(final PropertyChangeEvent _evt) {
if (_evt.getSource() instanceof EGInteractiveComponent) {
@@ -436,11 +444,11 @@
}
}
}
-
+
@Override
public void replace() {
}
-
+
@Override
public void select() {
selection_.selectAll();
@@ -461,65 +469,65 @@
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());
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -55,10 +55,9 @@
import org.fudaa.ebli.palette.BPaletteInfo;
/**
- * Un controleur des actions du panneau d'affichage 2D des calques. Il gere en particulier les actions de navigation, de
- * selection. Il g\xE8re \xE9galement les actions exclusives. Une action est exclusive lorsqu'elle d\xE9sactive une autre action en cours.
- * <p> Exemple : une action s\xE9lection d\xE9sactivera une action zoom en cours. <p> Ce controleur peut \xE9galement g\xE9rer des actions
- * exclusives sp\xE9cifiques.
+ * Un controleur des actions du panneau d'affichage 2D des calques. Il gere en particulier les actions de navigation, de selection. Il g\xE8re \xE9galement
+ * les actions exclusives. Une action est exclusive lorsqu'elle d\xE9sactive une autre action en cours. <p> Exemple : une action s\xE9lection d\xE9sactivera
+ * une action zoom en cours. <p> Ce controleur peut \xE9galement g\xE9rer des actions exclusives sp\xE9cifiques.
*
* @author Fred Deniger
* @version $Id$
@@ -140,7 +139,7 @@
// TODO : Le calque interactif d'accrochage pourrait n'etre actif que si le calque courant interactif est un calque
// implementant ZCatchListener
if (cqInteractionActif_ == null || !(cqInteractionActif_ instanceof ZCatchListener)
- || !((ZCatchListener) cqInteractionActif_).isCachingEnabled()) {
+ || !((ZCatchListener) cqInteractionActif_).isCachingEnabled()) {
return;
}
@@ -179,7 +178,7 @@
String[] vars = {cqName, idxGeom, idxVertex, xname, x, yname, y, zname, z};
String text =
- EbliResource.EBLI.getString(
+ EbliResource.EBLI.getString(
"Accroche : Calque={0} Geom={1} Sommet={2} {3}={4} {5}={6} {7}={8} (n:Suivant, u:D\xE9crocher)", vars);
pn_.setInfoText(text);
} else {
@@ -243,6 +242,16 @@
this(true, _ui);
}
+ /**
+ * Attention a n'utiliser que si les composants est d\xE9truit et plus utilise.
+ */
+ public void clearListeners() {
+ EbliLib.cleanListener(navigationActionGroup_);
+ EbliLib.cleanListener(specificActionGroup_);
+ EbliLib.cleanListener(standardActionGroup_);
+
+ }
+
private void activeActionForSelectedLayer() {
// Le panneau des boutons de s\xE9lection est invisible => Pas d'action.
if (selectedActionGroup_ == null) {
@@ -289,9 +298,8 @@
protected EbliActionInterface createRepereAction() {
final EbliActionPaletteAbstract plAction = new EbliActionPaletteAbstract(EbliLib.getS("Rep\xE8re"),
- EbliResource.EBLI.getIcon("repere"),
- "CHANGE_REFERENCE") {
-
+ EbliResource.EBLI.getIcon("repere"),
+ "CHANGE_REFERENCE") {
@Override
public JComponent buildContentPane() {
final BControleRepereTexte crt = new BControleRepereTexte(pn_.getVueCalque());
@@ -315,8 +323,7 @@
navigationActionGroup_ = new EbliActionInterface[7];
// RESTORE ACTION
final EbliActionSimple restore = new EbliActionSimple(EbliLib.getS("Restaurer"), EbliResource.EBLI.getIcon("restore"),
- "RESTORE") {
-
+ "RESTORE") {
@Override
public void actionPerformed(ActionEvent _arg) {
pn_.restaurer();
@@ -329,7 +336,7 @@
navigationActionGroup_[i++] = restore;
// ZOOM ACTION
CalqueActionInteraction action = new CalqueActionInteraction(EbliLib.getS("Zoom"), EbliResource.EBLI.getIcon("loupe"), "ZOOM",
- cqZoomI_);
+ cqZoomI_);
action.setDefaultToolTip(EbliLib.getZoomDesc());
action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('z'));
@@ -338,8 +345,7 @@
// VIEW NAVIGATION
navigationActionGroup_[i] = new EbliActionSimple(EbliLib.getS("Derni\xE8re vue"), EbliResource.EBLI.getIcon("zoom-previous"),
- "LAST_VIEW") {
-
+ "LAST_VIEW") {
@Override
public void actionPerformed(final ActionEvent _arg) {
pn_.getVueCalque().undoRepere();
@@ -349,7 +355,7 @@
navigationActionGroup_[i++].setDefaultToolTip(EbliLib.getS("Retourner \xE0 la derni\xE8re vue"));
// action.putValue(Action.MNEMONIC_KEY, new Int);
action = new CalqueActionInteraction(EbliLib.getS("D\xE9placer la vue"), EbliResource.EBLI.getIcon("main"), "MOVE_VIEW",
- cqDepVueI_);
+ cqDepVueI_);
action.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("D\xE9placer la vue"));
action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('m'));
navigationActionGroup_[i++] = action;
@@ -360,8 +366,7 @@
}
// NAVIGATION
final EbliActionPaletteAbstract plAction = new EbliActionPaletteAbstract(EbliLib.getS("Navigation"),
- EbliResource.EBLI.getIcon("navigation"), "NAVIGATE") {
-
+ EbliResource.EBLI.getIcon("navigation"), "NAVIGATE") {
@Override
public JComponent buildContentPane() {
return new ZTransformationDomaine(pn_.getVueCalque());
@@ -386,19 +391,19 @@
// les eblistatebutton permettent de creer des etats et de mettre
// a jour la fenetre en fonction.
CalqueSelectionAction action = new CalqueSelectionAction(this, EbliResource.EBLI.getIcon("fleche"),
- "RECTANGLE_SELECTION", ZCalqueSelectionInteractionAbstract.RECTANGLE);
+ "RECTANGLE_SELECTION", ZCalqueSelectionInteractionAbstract.RECTANGLE);
action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('s'));
final String tltTip = "<table><tr><td><b>" + EbliLib.getS("Raccourci") + "</b></td><td><b>"
- + EbliLib.getS("Action") + "</td></tr><tr><td><i>Shift</i></td><td>"
- + EbliLib.getS("Ajouter \xE0 la s\xE9lection courante") + "</td></tr><tr><td><i>Ctrl</i></td><td>"
- + EbliLib.getS("Enlever de la s\xE9lection courante") + "</td></tr><tr><td><i>Ctrl+Shift</i></td><td>"
- + EbliLib.getS("Op\xE9ration OU Exclusif") + "</td></tr><tr><td><i>Ctrl+Alt</i> (opt.) </td><td>"
- + EbliLib.getS("S\xE9lectionner entre 2 points") + "</td></tr></table>";;
+ + EbliLib.getS("Action") + "</td></tr><tr><td><i>Shift</i></td><td>"
+ + EbliLib.getS("Ajouter \xE0 la s\xE9lection courante") + "</td></tr><tr><td><i>Ctrl</i></td><td>"
+ + EbliLib.getS("Enlever de la s\xE9lection courante") + "</td></tr><tr><td><i>Ctrl+Shift</i></td><td>"
+ + EbliLib.getS("Op\xE9ration OU Exclusif") + "</td></tr><tr><td><i>Ctrl+Alt</i> (opt.) </td><td>"
+ + EbliLib.getS("S\xE9lectionner entre 2 points") + "</td></tr></table>";;
action.setDefaultToolTip(tltTip);
selectedActionGroup_[i++] = action;
action = new CalqueSelectionAction(this, EbliResource.EBLI.getIcon("fleche-polygone"), "POLYGON_SELECTION",
- ZCalqueSelectionInteractionAbstract.POLYGONE);
+ ZCalqueSelectionInteractionAbstract.POLYGONE);
action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('p'));
action.setDefaultToolTip(tltTip);
selectedActionGroup_[i++] = action;
@@ -419,9 +424,8 @@
plAction.setParent(pn_);
l.add(plAction);
EbliActionPaletteAbstract ebliActionPaletteAbstract = new EbliActionPaletteAbstract(EbliLib.getS("L\xE9gende"),
- EbliResource.EBLI.getToolIcon("legend"),
- "EDIT_LEGEND", true) {
-
+ EbliResource.EBLI.getToolIcon("legend"),
+ "EDIT_LEGEND", true) {
@Override
public JComponent buildContentPane() {
return new BCalqueLegendeCustomizer(getView().getCqLegend());
@@ -432,7 +436,6 @@
l.add(new BConfigurePaletteAction(getView().getArbreCalqueModel().getTreeSelectionModel()));
if (useInfo_) {
infoPalette_ = new BPaletteInfoAbstractAction() {
-
@Override
protected boolean mustBeUpdated() {
return getCalqueActif() != null;
@@ -666,6 +669,7 @@
/**
* Seulement les actions non specifiques d'une vue 2d.
+ *
* @return
*/
public List<EbliActionInterface> getNonSpecificsActions() {
@@ -781,7 +785,7 @@
if ("visible".equals(_evt.getPropertyName())) {
activeActionForSelectedLayer();
} else if ((_evt.getSource() == pn_.getScene().getCalqueActif())
- || ((cqInteractionActif_ != null) && (_evt.getSource() == cqInteractionActif_))) {
+ || ((cqInteractionActif_ != null) && (_evt.getSource() == cqInteractionActif_))) {
updateModeText();
}
}
@@ -876,6 +880,7 @@
/**
* Affecte les d\xE9finitions pour les coordonn\xE9es affich\xE9es dans la barre de statut.
+ *
* @param _defs Les d\xE9finitions.
*/
public void setCoordinateDefinitions(EbliCoordinateDefinition[] _defs) {
@@ -884,6 +889,7 @@
/**
* Retourne les d\xE9finition des coordonn\xE9es du syst\xE8me de coordonn\xE9es.
+ *
* @return Les d\xE9finitions
*/
public EbliCoordinateDefinition[] getCoordinateDefinitions() {
@@ -953,8 +959,8 @@
/**
* TreeSelection (mise a jour des etats des boutons de Selection en fonction du calque). Affecte le calque actif (
- * <code>getCalqueActif</code>) de cette classe, modifie les calque actifs du calque de selection ( un seul calque actif) et met
- * a jour l'etat des specific tools (si option validee).
+ * <code>getCalqueActif</code>) de cette classe, modifie les calque actifs du calque de selection ( un seul calque actif) et met a jour l'etat des
+ * specific tools (si option validee).
*
* @param _evt
*/
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -365,6 +365,14 @@
public ZEbliCalquesPanel(final BCalque _gcInit, final ZEbliCalquePanelController _controller) {
this(_gcInit, _controller, true);
}
+
+ /**
+ * Attention a n'utiliser que si les composants est d\xE9truit et plus utilise.
+ */
+ public void clearListeners() {
+ controller_.clearListeners();
+ contextTools_.removeAll();
+ }
/**
* Construction des calques par defaut.
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionAbstract.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionAbstract.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionAbstract.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -10,6 +10,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeListener;
import java.util.Collection;
import javax.swing.AbstractAction;
@@ -22,8 +23,8 @@
import org.fudaa.ctulu.CtuluResource;
/**
- * Une action avec tooltip adapt\xE9 \xE0 l'\xE9tat du bouton. Si le bouton est d\xE9sactiv\xE9, un tooltip expliquant commant
- * le rendre actif est affich\xE9.
+ * Une action avec tooltip adapt\xE9 \xE0 l'\xE9tat du bouton. Si le bouton est d\xE9sactiv\xE9, un tooltip expliquant commant le rendre actif est affich\xE9.
+ *
* @author deniger
* @version $Id: EbliActionAbstract.java,v 1.14.6.1 2008-02-22 16:25:43 bmarchan Exp $
*/
@@ -48,6 +49,16 @@
putValue(Action.SMALL_ICON, _ic);
}
+ /**
+ * attention: doit etre appele pour faire le menage uniquement !
+ */
+ public void cleanListener() {
+ PropertyChangeListener[] propertyChangeListeners = getPropertyChangeListeners();
+ for (PropertyChangeListener propertyChangeListener : propertyChangeListeners) {
+ removePropertyChangeListener(propertyChangeListener);
+ }
+ }
+
public String getTitle() {
return (String) super.getValue(Action.NAME);
}
@@ -93,7 +104,8 @@
return r.toString();
}
- public void actionPerformed(final ActionEvent _e) {}
+ public void actionPerformed(final ActionEvent _e) {
+ }
public AbstractButton buildButton(final EbliComponentFactory _f) {
return null;
@@ -111,10 +123,10 @@
final StringBuffer r = new StringBuffer("<p style=\"margin:2px\">").append(getDefaultTooltip()).append("</p>");
if (_endMessage != null) {
r.append("<p style=\"margin:5px;margin-top:2px;\"><u color=\"red\">").append(
- CtuluResource.CTULU.getString("Message:")).append("</u>").append(_endMessage).append("</p>");
+ CtuluResource.CTULU.getString("Message:")).append("</u>").append(_endMessage).append("</p>");
}
r.append("<p style=\"margin:5px;margin-top:2px\"><u>").append(EbliLib.getS("Condition:")).append("</u><br>")
- .append(_message).append("</p>");
+ .append(_message).append("</p>");
return r.toString();
}
@@ -158,7 +170,6 @@
}
public void updateStateBeforeShow() {
-
}
public final void setDefaultToolTip(final String _s) {
@@ -180,10 +191,14 @@
* @return l'action trouvee ou null sinon.
*/
public static Action findAction(Collection<EbliActionInterface> acts, String _actionCmd) {
- if ((acts == null) || (_actionCmd == null)) { return null; }
+ if ((acts == null) || (_actionCmd == null)) {
+ return null;
+ }
for (Action action : acts) {
- if (action != null && action.getValue(Action.ACTION_COMMAND_KEY).equals(_actionCmd)) return action;
+ if (action != null && action.getValue(Action.ACTION_COMMAND_KEY).equals(_actionCmd)) {
+ return action;
+ }
}
return null;
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionInterface.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionInterface.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionInterface.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -11,9 +11,8 @@
import javax.swing.Action;
/**
- * Une interface Action au sens Ebli. Cette interface sait creer les boutons correspondants
- * \xE0 l'action.
- *
+ * Une interface Action au sens Ebli. Cette interface sait creer les boutons correspondants \xE0 l'action.
+ *
* @author deniger
* @version $Id: EbliActionInterface.java,v 1.7.8.1 2008-01-17 11:42:52 bmarchan Exp $
*/
@@ -31,10 +30,14 @@
*/
AbstractButton buildToolButton(EbliComponentFactory _f);
-
void setDefaultToolTip(String _s);
/**
+ * attention: doit etre appele pour faire le menage uniquement !
+ */
+ void cleanListener();
+
+ /**
* @param _f l'usine des JComponent
* @return un bouton pour les panels normaux
*/
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliLib.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliLib.java 2012-10-09 23:18:52 UTC (rev 7732)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliLib.java 2012-10-10 20:25:08 UTC (rev 7733)
@@ -46,25 +46,24 @@
/**
* Ensemble de methodes utilitaires non classees.
- *
+ *
* @author Fred Deniger
* @version $Id: EbliLib.java,v 1.37 2007-05-04 13:49:47 deniger Exp $
*/
public final class EbliLib {
private EbliLib() {
-
}
public static ObjectInputStream createObjectInpuStream(final File file, XStream parser) throws IOException,
- FileNotFoundException {
+ FileNotFoundException {
return parser.createObjectInputStream(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
}
public static ObjectOutputStream createObjectOutpuStream(final File file, XStream parser) throws IOException,
- FileNotFoundException {
+ FileNotFoundException {
return parser
- .createObjectOutputStream(new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")));
+ .createObjectOutputStream(new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")));
}
public static boolean isAlphaChanged(final int _alpha) {
@@ -72,7 +71,9 @@
}
public static Color getAlphaColor(final Color _init, final int _alpha) {
- if (_init == null || _alpha <= 0 || _alpha >= 255) { return _init; }
+ if (_init == null || _alpha <= 0 || ...
[truncated message content] |
|
From: <de...@us...> - 2012-10-26 11:00:58
|
Revision: 7812
http://fudaa.svn.sourceforge.net/fudaa/?rev=7812&view=rev
Author: deniger
Date: 2012-10-26 11:00:45 +0000 (Fri, 26 Oct 2012)
Log Message:
-----------
Utilisation de SwingX 1.6
Modified Paths:
--------------
trunk/framework/ctulu-ui/pom.xml
trunk/framework/ebli-1d/pom.xml
trunk/framework/ebli-2d/pom.xml
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteRefreshPanel.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java
trunk/framework/fudaa-common/pom.xml
trunk/framework/pom.xml
Modified: trunk/framework/ctulu-ui/pom.xml
===================================================================
--- trunk/framework/ctulu-ui/pom.xml 2012-10-25 21:59:52 UTC (rev 7811)
+++ trunk/framework/ctulu-ui/pom.xml 2012-10-26 11:00:45 UTC (rev 7812)
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.fudaa.framework</groupId>
- <artifactId>fudaa-framework</artifactId>
- <version>1.4-SNAPSHOT</version>
- </parent>
- <groupId>org.fudaa.framework.ctulu</groupId>
- <artifactId>ctulu-ui</artifactId>
- <name>ctulu-ui</name>
- <dependencies>
- <dependency>
- <groupId>${ctuluGroupId}</groupId>
- <artifactId>ctulu-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.swinglabs</groupId>
- <artifactId>swingx</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.fudaa.framework</groupId>
+ <artifactId>fudaa-framework</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <groupId>org.fudaa.framework.ctulu</groupId>
+ <artifactId>ctulu-ui</artifactId>
+ <name>ctulu-ui</name>
+ <dependencies>
+ <dependency>
+ <groupId>${ctuluGroupId}</groupId>
+ <artifactId>ctulu-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/framework/ebli-1d/pom.xml
===================================================================
--- trunk/framework/ebli-1d/pom.xml 2012-10-25 21:59:52 UTC (rev 7811)
+++ trunk/framework/ebli-1d/pom.xml 2012-10-26 11:00:45 UTC (rev 7812)
@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.fudaa.framework</groupId>
- <artifactId>fudaa-framework</artifactId>
- <version>1.4-SNAPSHOT</version>
- </parent>
- <groupId>org.fudaa.framework.ebli</groupId>
- <artifactId>ebli-1d</artifactId>
- <name>ebli-1d</name>
- <dependencies>
- <dependency>
- <groupId>${ebliGroupId}</groupId>
- <artifactId>ebli-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.swinglabs</groupId>
- <artifactId>swingx</artifactId>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.fudaa.framework.dodico</groupId>
- <artifactId>dodico-common</artifactId>
- </dependency>
- </dependencies>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.fudaa.framework</groupId>
+ <artifactId>fudaa-framework</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <groupId>org.fudaa.framework.ebli</groupId>
+ <artifactId>ebli-1d</artifactId>
+ <name>ebli-1d</name>
+ <dependencies>
+ <dependency>
+ <groupId>${ebliGroupId}</groupId>
+ <artifactId>ebli-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.fudaa.framework.dodico</groupId>
+ <artifactId>dodico-common</artifactId>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/framework/ebli-2d/pom.xml
===================================================================
--- trunk/framework/ebli-2d/pom.xml 2012-10-25 21:59:52 UTC (rev 7811)
+++ trunk/framework/ebli-2d/pom.xml 2012-10-26 11:00:45 UTC (rev 7812)
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.fudaa.framework</groupId>
- <artifactId>fudaa-framework</artifactId>
- <version>1.4-SNAPSHOT</version>
- </parent>
- <groupId>org.fudaa.framework.ebli</groupId>
- <artifactId>ebli-2d</artifactId>
- <name>ebli-2d</name>
- <dependencies>
- <dependency>
- <groupId>${ebliGroupId}</groupId>
- <artifactId>ebli-common</artifactId>
- </dependency>
- <dependency>
- <groupId>${ebliGroupId}</groupId>
- <artifactId>ebli-common</artifactId>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.swinglabs</groupId>
- <artifactId>swingx</artifactId>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.fudaa.framework</groupId>
+ <artifactId>fudaa-framework</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <groupId>org.fudaa.framework.ebli</groupId>
+ <artifactId>ebli-2d</artifactId>
+ <name>ebli-2d</name>
+ <dependencies>
+ <dependency>
+ <groupId>${ebliGroupId}</groupId>
+ <artifactId>ebli-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${ebliGroupId}</groupId>
+ <artifactId>ebli-common</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteRefreshPanel.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteRefreshPanel.java 2012-10-25 21:59:52 UTC (rev 7811)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteRefreshPanel.java 2012-10-26 11:00:45 UTC (rev 7812)
@@ -50,6 +50,7 @@
import com.memoire.bu.BuLib;
import com.memoire.bu.BuPanel;
import com.memoire.bu.BuVerticalLayout;
+import org.fudaa.ctulu.CtuluNumberFormatI;
/**
* @author DENIGER
@@ -57,27 +58,16 @@
public class PaletteRefreshPanel extends CtuluDialogPanel implements ActionListener, ItemListener {
private final JTextField newNb_;
-
JButton btMax_;
-
JButton btMin_;
-
BuComboBox cbPalette_;
-
JCheckBox cbModifyRange_;
-
TraceIcon icMax_;
-
TraceIcon icMin_;
-
JComponent newMax_;
-
JComponent newMin_;
-
final PaletteSelecteurCouleurPlage plage_;
-
BuGlassPaneStop stop_;
-
JDialog owner_;
final void setOwner(final JDialog _owner) {
@@ -86,13 +76,12 @@
private String getHelpTextString() {
return "<html><body>" + EbliLib.getS("Les modifications sont automatiquement sauvegard\xE9es") + ".<br><br>"
- + EbliLib.getS("Il est possible de partager des palettes gr\xE2ce aux fonction d'import/export") + ".<br><br>"
- + EbliLib.getS("Il y a deux types de palettes:") + "<br><ul><li>"
- + EbliLib.getS("Palette lin\xE9aire: toutes les couleurs de l'intervalle seront utilis\xE9es") + "</li><li>"
- + EbliLib.getS("Palette sp\xE9cifi\xE9e par l'utilisateur: seules les couleurs sp\xE9cifi\xE9es seront utilis\xE9es (si suffisantes)")
- + "</li></ul></body></html>";
+ + EbliLib.getS("Il est possible de partager des palettes gr\xE2ce aux fonction d'import/export") + ".<br><br>"
+ + EbliLib.getS("Il y a deux types de palettes:") + "<br><ul><li>"
+ + EbliLib.getS("Palette lin\xE9aire: toutes les couleurs de l'intervalle seront utilis\xE9es") + "</li><li>"
+ + EbliLib.getS("Palette sp\xE9cifi\xE9e par l'utilisateur: seules les couleurs sp\xE9cifi\xE9es seront utilis\xE9es (si suffisantes)")
+ + "</li></ul></body></html>";
}
-
CtuluTitledPanelCheckBox pnMinMaxRanges_;
/**
@@ -109,7 +98,7 @@
pnMinMaxRanges_ = CtuluLibSwing.createTitleCheckBox(EbliLib.getS("Modifier les plages"));
cbModifyRange_ = pnMinMaxRanges_.getTitleCb();
cbModifyRange_.setToolTipText("<html>" + EbliLib.getS("Si s\xE9lectionn\xE9, les plages de la palette seront modifi\xE9es") + "<br>"
- + EbliLib.getS("Si non s\xE9lectionn\xE9, seules les couleurs seront mises \xE0 jour") + "</html>");
+ + EbliLib.getS("Si non s\xE9lectionn\xE9, seules les couleurs seront mises \xE0 jour") + "</html>");
pnMinMaxRanges_.setLayout(new BuGridLayout(2, 5, 5));
newNb_ = addLabelIntegerText(pnMinMaxRanges_, EbliLib.getS("Nombre de plages"));
@@ -134,8 +123,8 @@
pnMinMaxRanges_.add(newMax_);
final double[] ds = this.plage_.getMinMax();
if (ds != null) {
- plage_.valueEditor_.setValue(Double.toString(ds[1]), newMax_);
- plage_.valueEditor_.setValue(Double.toString(ds[0]), newMin_);
+ plage_.valueEditor_.setValue(doubleToString(ds[1]), newMax_);
+ plage_.valueEditor_.setValue(doubleToString(ds[0]), newMin_);
}
if ((this.plage_.target_ != null) && (this.plage_.target_.isDonneesBoiteAvailable())) {
final BuPanel right = new BuPanel();
@@ -157,7 +146,6 @@
// affiche
btMax_ = new JButton();
btMax_.addActionListener(new ActionListener() {
-
public void actionPerformed(final ActionEvent _e) {
icMax_.setCouleur(JColorChooser.showDialog(owner_, EbliResource.EBLI.getString("Couleur pour le max"), icMax_.getCouleur()));
paletteContinu_.setMax(icMax_.getCouleur());
@@ -176,7 +164,6 @@
icMax_.setCouleur(plage == null ? Color.CYAN : plage.getCouleur());
btMin_ = new JButton();
btMin_.addActionListener(new ActionListener() {
-
public void actionPerformed(final ActionEvent _e) {
icMin_.setCouleur(JColorChooser.showDialog(owner_, EbliResource.EBLI.getString("Couleur pour le min"), icMin_.getCouleur()));
paletteContinu_.setMin(icMin_.getCouleur());
@@ -225,6 +212,16 @@
cbPalette_.addItemListener(this);
updateEditPanel();
}
+
+ private String doubleToString(double d){
+ if(plage_.isUseFormatter()){
+ CtuluNumberFormatI defaultFormatter = plage_.getDefaultFormatter();
+ if(defaultFormatter!=null){
+ return defaultFormatter.format(d);
+ }
+ }
+ return Double.toString(d);
+ }
/**
* @return le bouton a utiliser pour rechercher le min max sur le pas de temps en cours
@@ -235,18 +232,14 @@
bt.setText(EbliLib.getS("les valeurs max/min du pas de temps"));
bt.setToolTipText(EbliLib.getS("Initialiser les champs avec le maximum et le minimum des donn\xE9es sur la pas de temps"));
bt.addActionListener(new ActionListener() {
-
public void actionPerformed(final ActionEvent _e) {
BuLib.invokeNow(new Runnable() {
-
public void run() {
startComputing();
}
-
});
new Thread() {
-
public void run() {
if (PaletteRefreshPanel.this.plage_.dataBoite_ == null) {
PaletteRefreshPanel.this.plage_.dataBoite_ = new CtuluRange();
@@ -257,11 +250,10 @@
plage_.valueEditor_.setValue(null, newMin_);
erreurNotFound();
} else {
- plage_.valueEditor_.setValue(Double.toString(PaletteRefreshPanel.this.plage_.dataBoite_.max_), newMax_);
- plage_.valueEditor_.setValue(Double.toString(PaletteRefreshPanel.this.plage_.dataBoite_.min_), newMin_);
+ plage_.valueEditor_.setValue(doubleToString(PaletteRefreshPanel.this.plage_.dataBoite_.max_), newMax_);
+ plage_.valueEditor_.setValue(doubleToString(PaletteRefreshPanel.this.plage_.dataBoite_.min_), newMin_);
}
final Runnable r = new Runnable() {
-
public void run() {
stopComputing();
}
@@ -277,10 +269,9 @@
protected void erreurNotFound() {
EventQueue.invokeLater(new Runnable() {
-
public void run() {
CtuluLibDialog.showWarn(owner_, "Min/max",
- EbliLib.getS("Les bornes n'ont pas \xE9t\xE9 trouv\xE9es.\n Avez-vous s\xE9lectionner une variable et \xE9ventuellement un pas de temps ?"));
+ EbliLib.getS("Les bornes n'ont pas \xE9t\xE9 trouv\xE9es.\n Avez-vous s\xE9lectionner une variable et \xE9ventuellement un pas de temps ?"));
}
});
}
@@ -293,17 +284,13 @@
bt.setText(EbliLib.getS("les valeurs max/min pour tous les pas de temps"));
bt.setToolTipText(EbliLib.getS("Initialiser les champs avec le maximum et le minimum des donn\xE9es sur tous les pas de temps"));
bt.addActionListener(new ActionListener() {
-
public void actionPerformed(final ActionEvent _e) {
BuLib.invokeNow(new Runnable() {
-
public void run() {
startComputing();
}
-
});
new Thread() {
-
public void run() {
if (PaletteRefreshPanel.this.plage_.dataBoite_ == null) {
PaletteRefreshPanel.this.plage_.dataBoite_ = new CtuluRange();
@@ -314,11 +301,10 @@
plage_.valueEditor_.setValue(null, newMin_);
erreurNotFound();
} else {
- plage_.valueEditor_.setValue(Double.toString(PaletteRefreshPanel.this.plage_.dataBoite_.max_), newMax_);
- plage_.valueEditor_.setValue(Double.toString(PaletteRefreshPanel.this.plage_.dataBoite_.min_), newMin_);
+ plage_.valueEditor_.setValue(doubleToString(PaletteRefreshPanel.this.plage_.dataBoite_.max_), newMax_);
+ plage_.valueEditor_.setValue(doubleToString(PaletteRefreshPanel.this.plage_.dataBoite_.min_), newMin_);
}
final Runnable r = new Runnable() {
-
public void run() {
stopComputing();
}
@@ -358,7 +344,6 @@
final PaletteCouleurDiscontinu d = (PaletteCouleurDiscontinu) o;
final PaletteEditorPanel panel = new PaletteEditorPanel(d.getTitle(), PaletteManager.copy(d.getCs()));
final CtuluDialogPanel pn = new CtuluDialogPanel() {
-
public boolean isDataValid() {
if (panel.getColors().length == 0) {
@@ -391,17 +376,11 @@
}
}
}
-
BuPanel palette_;
-
BuPanel pnContinu_;
-
BuPanel pnDisc_;
-
PaletteCouleurContinu paletteContinu_;
-
JComponent editPalette_;
-
private BuCheckBox cbLog;
void startComputing() {
@@ -443,7 +422,9 @@
newPalette.setLogScale(isLogScale);
this.plage_.model_.setPlages(newPalette);
this.plage_.ajusteAllLegendes();
- this.plage_.target_.getPaletteCouleur().setLogScale(isLogScale);
+ if (plage_.target_.getPaletteCouleur() != null) {
+ this.plage_.target_.getPaletteCouleur().setLogScale(isLogScale);
+ }
} else {
plage_.model_.modifyColors(c);
}
@@ -510,14 +491,13 @@
public static void initPlages(final int _nb, final double _min, final double _max, final List _l, final BPalettePlage _p, boolean useLogScale) {
// int nb = Math.max(_nb, 1);
int nb = _nb;
- if (_min == _max && nb!=0) {
+ if (_min == _max && nb != 0) {
nb = 1;
}
_l.clear();
// initialisation des plages
for (int i = 0; i < nb; i++) {
-
}
double max = _max;
final double min = _min;
@@ -531,7 +511,7 @@
_l.add(p0);
p0.setMin(min);
p0.setMax(max);
- } else if (nb!=0) {
+ } else if (nb != 0) {
// par construction les plages sont dans le bon ordre !
TDoubleArrayList values = new TDoubleArrayList();
values.add(min);
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java 2012-10-25 21:59:52 UTC (rev 7811)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java 2012-10-26 11:00:45 UTC (rev 7812)
@@ -12,7 +12,6 @@
package org.fudaa.ebli.palette;
import java.awt.BorderLayout;
-import java.awt.Checkbox;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
@@ -33,7 +32,6 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
-import com.lowagie.text.pdf.PdfFormField;
import com.memoire.bu.*;
import org.fudaa.ctulu.CtuluLibString;
@@ -45,7 +43,6 @@
import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel;
import org.fudaa.ctulu.gui.CtuluDialog;
import org.fudaa.ctulu.gui.CtuluDialogPanel;
-import org.fudaa.ctulu.gui.CtuluLibDialog;
import org.fudaa.ctulu.gui.CtuluLibSwing;
import org.fudaa.ctulu.gui.CtuluPopupMenu;
import org.fudaa.ebli.commun.BPalettePanelInterface;
@@ -61,8 +58,13 @@
* @version $Id: PaletteSelecteurCouleurPlage.java,v 1.10 2007-06-05 08:58:38 deniger Exp $
*/
public class PaletteSelecteurCouleurPlage extends JPanel implements PropertyChangeListener, ListSelectionListener,
- ActionListener, MouseListener, BPalettePanelInterface, BuBorders {
+ ActionListener, MouseListener, BPalettePanelInterface, BuBorders {
+ public CtuluNumberFormatI getDefaultFormatter() {
+ CtuluNumberFormatI ctuluNumberFormatI = default_ == null ? null : default_.getFormatter();
+ return ctuluNumberFormatI;
+ }
+
class PlageTableModel extends AbstractListModel implements TraceIsoPlageInterface {
public PlageTableModel() {
@@ -188,70 +190,42 @@
public static boolean isTargetValid(final Object _o) {
return (_o instanceof BPalettePlageTarget) && ((BPalettePlageTarget) _o).isPaletteModifiable();
}
-
private transient BPalettePlageDefault default_;
-
JButton btApply_;
-
BuToolButton btAssombrir_;
-
JButton btColor_;
-
BuToolButton btEcl_;
-
BuButton btFormat_;
BuButton btExport_;
BuButton btImport_;
-
JButton btRefresh_;
-
BuCheckBox cbChangedLeg_;
-
CtuluRange dataBoite_;
-
TraceIcon ic_;
-
boolean isAdjusting_;
-
BuMenuItem itemRemove_;
-
BuMenuItem itemSplit_;
-
JLabel lbPalTitle_;
JCheckBox subTitleVisible;
JCheckBox cbReduit;
-
JList list_;
-
CtuluPopupMenu menu_;
-
PlageTableModel model_;
-
JPanel panelData_;
-
BPlageAbstract plageEnCours_;
-
List plages_;
-
BuScrollPane sp_;
-
BPalettePlageTarget target_;
-
JTextField tfPlageLeg_;
-
JTextField tfTitlePalette_;
-
JComponent txtMax_;
-
JComponent txtMin_;
BuLabel lbMax_;
BuLabel lbMin_;
-
CtuluValueEditorI valueEditor_ = CtuluValueEditorDefaults.DOUBLE_EDITOR;
-
protected boolean isDiscreteTarget_;
-
private BuPanel btpn;
+ final BuPanel pnTitle;
public PaletteSelecteurCouleurPlage() {
super();
@@ -265,9 +239,9 @@
subTitleVisible.setVisible(false);
cbReduit = new JCheckBox();
cbReduit.setText(EbliLib.getS("L\xE9gende r\xE9duite"));
-
+
tfTitlePalette_ = new BuTextField(10);
- final BuPanel pnTitle = new BuPanel(new BuGridLayout(2));
+ pnTitle = new BuPanel(new BuGridLayout(2));
pnTitle.add(new BuLabel(EbliLib.getS("Titre:")));
pnTitle.add(tfTitlePalette_);
top.add(lbPalTitle_);
@@ -346,7 +320,20 @@
btpn.add(bt);
}
- private void actionApply() {
+ public JButton getBtApply() {
+ return btApply_;
+ }
+
+ public JTextField getTfTitlePalette() {
+ return tfTitlePalette_;
+ }
+
+ public void setTitlePanelVisible(boolean b) {
+ pnTitle.setVisible(b);
+ lbPalTitle_.setVisible(b);
+ }
+
+ public void actionApply() {
savePanel();
final BPlageInterface[] vp = new BPlageInterface[plages_.size()];
plages_.toArray(vp);
@@ -356,7 +343,7 @@
if (subTitleVisible.isVisible()) {
default_.setSubTitleVisible(subTitleVisible.isSelected());
}
- if(cbReduit.isEnabled()){
+ if (cbReduit.isEnabled()) {
default_.setReduit(cbReduit.isSelected());
}
target_.setPaletteCouleurPlages(default_);
@@ -377,7 +364,7 @@
}
private void actionFormat() {
- CtuluNumberFormatI ctuluNumberFormatI = default_ == null ? null : default_.getFormatter();
+ CtuluNumberFormatI ctuluNumberFormatI = getDefaultFormatter();
/*
* CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; }
*/
@@ -432,15 +419,21 @@
}
private void actionSplit() {
- if (plageEnCours_ == null) { return; }
+ if (plageEnCours_ == null) {
+ return;
+ }
JSpinner spinner = new JSpinner(new SpinnerNumberModel(2, 2, 100, 1));
CtuluDialogPanel pn = new CtuluDialogPanel();
pn.setLayout(new BuHorizontalLayout());
pn.addLabel(EbliLib.getS("Nombre de plages \xE0 cr\xE9er"));
pn.add(spinner);
- if (!pn.afficheModaleOk(this)) return;
+ if (!pn.afficheModaleOk(this)) {
+ return;
+ }
int nb = ((Number) spinner.getValue()).intValue();
- if (nb < 2) return;
+ if (nb < 2) {
+ return;
+ }
final double min = plageEnCours_.getMin();
final double max = plageEnCours_.getMax();
final int lengthMin = plageEnCours_.getMinString().length();
@@ -463,13 +456,18 @@
final BPlage nplage = new BPlage(plageEnCours_);
double mini = min + i * step;
double maxi = min + (i + 1) * step;
- if (i == nb - 1) maxi = max;
+ if (i == nb - 1) {
+ maxi = max;
+ }
nplage.setMinMax(Double.parseDouble(default_.formatter_.format(mini)),
- Double.parseDouble(default_.formatter_.format(maxi)));
+ Double.parseDouble(default_.formatter_.format(maxi)));
nplage.ajusteLegendes(default_.formatter_, default_.sep_);
nplage.setCouleur(BPalettePlageAbstract.getCouleur(minColor, sup, (double) i / nb));
- if (isLast) plages_.add(nplage);
- else plages_.add(idx + i, nplage);
+ if (isLast) {
+ plages_.add(nplage);
+ } else {
+ plages_.add(idx + i, nplage);
+ }
}
model_.fireAdd(idx + 1, idx + nb - 1);
updatePanel();
@@ -500,15 +498,14 @@
} else {
final String dataDesc = target_.getDataDescription();
setTitre(dataDesc == null ? CtuluLibString.EMPTY_STRING : dataDesc);
- cbReduit.setSelected(target_.getPaletteCouleur()!=null && target_.getPaletteCouleur().isReduit());
- cbReduit.setEnabled(target_.getPaletteCouleur()!=null && target_.getPaletteCouleur().isReduitEnable());
+ cbReduit.setSelected(target_.getPaletteCouleur() != null && target_.getPaletteCouleur().isReduit());
+ cbReduit.setEnabled(target_.getPaletteCouleur() != null && target_.getPaletteCouleur().isReduitEnable());
}
}
/*
* void setModified(){ btApply_.setEnabled(true); }
*/
-
/**
* Met a jour le panneau des donn\xE9es.
*/
@@ -538,7 +535,6 @@
if (cbChangedLeg_ == null) {
cbChangedLeg_ = new BuCheckBox(EbliLib.getS("Label") + suff);
cbChangedLeg_.addItemListener(new ItemListener() {
-
public void itemStateChanged(final ItemEvent _e) {
if (cbChangedLeg_.isSelected()) {
if (plageEnCours_ != null && tfPlageLeg_ != null) {
@@ -548,7 +544,9 @@
} else if (tfPlageLeg_ != null) {
tfPlageLeg_.setText(CtuluLibString.EMPTY_STRING);
}
- if (tfPlageLeg_ != null) tfPlageLeg_.setEnabled(cbChangedLeg_.isSelected());
+ if (tfPlageLeg_ != null) {
+ tfPlageLeg_.setEnabled(cbChangedLeg_.isSelected());
+ }
}
});
@@ -570,13 +568,17 @@
}
BPlageAbstract getMaxPlage() {
- if (list_.getModel().getSize() == 0) { return null; }
+ if (list_.getModel().getSize() == 0) {
+ return null;
+ }
return (BPlageAbstract) list_.getModel().getElementAt(0);
}
double[] getMinMax() {
final double[] r = new double[2];
- if ((plages_ == null) || (plages_.size() == 0)) { return null; }
+ if ((plages_ == null) || (plages_.size() == 0)) {
+ return null;
+ }
BPlage p = (BPlage) plages_.get(0);
r[0] = p.getMin();
r[1] = p.getMax();
@@ -595,7 +597,9 @@
}
BPlageAbstract getMinPlage() {
- if (list_.getModel().getSize() == 0) { return null; }
+ if (list_.getModel().getSize() == 0) {
+ return null;
+ }
return (BPlageAbstract) list_.getModel().getElementAt(list_.getModel().getSize() - 1);
}
@@ -611,14 +615,23 @@
modified |= p.setLegende(tfPlageLeg_.getText());
// Fred deja effectue par la premiere ligne
} /*
- * else { modified |= p.ajusteLegendes(default_.getFormatter(), default_.getSep()); }
- */
+ * else { modified |= p.ajusteLegendes(default_.getFormatter(), default_.getSep()); }
+ */
}
if (modified) {
model_.fireModified(plageEnCours_);
}
}
+ boolean useFormatter;
+ public boolean isUseFormatter() {
+ return useFormatter;
+ }
+
+ public void setUseFormatter(boolean useFormatter) {
+ this.useFormatter = useFormatter;
+ }
+
void updatePanel() {
if (plageEnCours_ == null) {
ic_.setCouleur(btColor_.getForeground());
@@ -631,9 +644,21 @@
ic_.setType(plageEnCours_.getIconeType());
// final CtuluNumberFormatI fmt = plageEnCours_.getgetDefaultFormat();
String s = Double.toString(plageEnCours_.getMin());
+ if (useFormatter) {
+ CtuluNumberFormatI ctuluNumberFormatI = getDefaultFormatter();
+ if (ctuluNumberFormatI != null) {
+ s = ctuluNumberFormatI.format(plageEnCours_.getMin());
+ }
+ }
valueEditor_.setValue(s, txtMin_);
txtMin_.setToolTipText(s);
s = Double.toString(plageEnCours_.getMax());
+ if (useFormatter) {
+ CtuluNumberFormatI ctuluNumberFormatI = getDefaultFormatter();
+ if (ctuluNumberFormatI != null) {
+ s = ctuluNumberFormatI.format(plageEnCours_.getMax());
+ }
+ }
valueEditor_.setValue(s, txtMax_);
txtMax_.setToolTipText(s);
tfPlageLeg_.setText(plageEnCours_.getLegende());
@@ -650,14 +675,16 @@
protected void ajusteAllLegendes(boolean fireEvent) {
BPalettePlageAbstract.updatePlageLegendes(model_, default_.formatter_, default_.sep_);
- if (fireEvent) model_.fireAllModified();
+ if (fireEvent) {
+ model_.fireAllModified();
+ }
}
protected final boolean ajusteSelectedPlageLegende(final boolean _fireEvent) {
if (!isDiscreteTarget_ && plageEnCours_ != null) {
final BPlage p = (BPlage) plageEnCours_;
if (p != null && (valueEditor_.isValueValidFromComponent(txtMin_))
- && (valueEditor_.isValueValidFromComponent(txtMax_))) {
+ && (valueEditor_.isValueValidFromComponent(txtMax_))) {
double nmin = Double.parseDouble(valueEditor_.getStringValue(txtMin_));
double nmax = Double.parseDouble(valueEditor_.getStringValue(txtMax_));
@@ -719,6 +746,10 @@
}
}
+ public BuButton getBtFormat() {
+ return btFormat_;
+ }
+
private void importPalette() {
BuFileChooser chooser = new BuFileChooser();
PaletteFileFilter filter = new PaletteFileFilter();
@@ -753,19 +784,24 @@
}
}
- public void doAfterDisplay() {}
+ public void doAfterDisplay() {
+ }
public JComponent getComponent() {
return this;
}
- public void mouseClicked(final MouseEvent _e) {}
+ public void mouseClicked(final MouseEvent _e) {
+ }
- public void mouseEntered(final MouseEvent _e) {}
+ public void mouseEntered(final MouseEvent _e) {
+ }
- public void mouseExited(final MouseEvent _e) {}
+ public void mouseExited(final MouseEvent _e) {
+ }
- public void mousePressed(final MouseEvent _e) {}
+ public void mousePressed(final MouseEvent _e) {
+ }
public void mouseReleased(final MouseEvent _e) {
if (!isDiscreteTarget_ && EbliLib.isPopupMouseEvent(_e)) {
@@ -784,7 +820,8 @@
}
}
- public void paletteDeactivated() {}
+ public void paletteDeactivated() {
+ }
public void propertyChange(final PropertyChangeEvent _evt) {
setTargetPalette(target_, true);
@@ -792,7 +829,9 @@
public boolean setPalettePanelTarget(final Object _target) {
- if (_target instanceof BPalettePlageTarget) { return setTargetPalette((BPalettePlageTarget) _target); }
+ if (_target instanceof BPalettePlageTarget) {
+ return setT...
[truncated message content] |
|
From: <de...@us...> - 2012-11-02 07:13:39
|
Revision: 7845
http://fudaa.svn.sourceforge.net/fudaa/?rev=7845&view=rev
Author: deniger
Date: 2012-11-02 07:13:31 +0000 (Fri, 02 Nov 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/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java
trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionInfoOnCourbe.java
trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/tooltip.png
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-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -52,6 +52,7 @@
import org.fudaa.ebli.trace.TraceLigneModel;
import com.vividsolutions.jts.geom.Envelope;
+import gnu.trove.TDoubleArrayList;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.HashMap;
@@ -790,6 +791,12 @@
}
}
+ /**
+ * Attention, cela suppose que les x sont strictement croissants:
+ *
+ * @param _x
+ * @return
+ */
public int getNearestIdx(final double _x) {
int low = 0;
int high = model_.getNbValues() - 1;
@@ -805,7 +812,23 @@
}
}
return -(low + 1); // value not found.
+ }
+ public TIntArrayList getSegmentIdxContaining(final double x) {
+ TIntArrayList res = new TIntArrayList();
+ for (int i = 0; i < model_.getNbValues() - 1; i++) {
+ double min = getModel().getX(i);
+ double max = getModel().getX(i + 1);
+ if (min > max) {
+ double tmp = max;
+ max = min;
+ min = tmp;
+ }
+ if (x >= min && x <= max) {
+ res.add(i);
+ }
+ }
+ return res;
}
public BConfigurableInterface getSingleConfigureInterface() {
@@ -870,6 +893,58 @@
return yup - (xup - _x) / (xup - xlow) * (yup - ylow);
}
+ public TDoubleArrayList interpolPointsOnEcran(final double _x, final EGRepere _rep) {
+ TDoubleArrayList res = new TDoubleArrayList();
+ if (model_.getNbValues() == 0) {
+ return res;
+ }
+ final EGAxeVertical vert = getAxeY();
+ final TIntArrayList idxs = getSegmentIdxContaining(_x);
+ if (idxs.isEmpty()) {
+ return res;
+ }
+ int nb = idxs.size();
+ for (int i = 0; i < nb; i++) {
+ int seg = idxs.get(i);
+ double xmin = model_.getX(seg);
+ double ymin = model_.getY(seg);
+ double xmax = model_.getX(seg + 1);
+ double ymax = model_.getY(seg + 1);
+ double y = ymax - (xmax - _x) / (xmax - xmin) * (ymax - ymin);
+ y = _rep.getYEcran(y, vert);
+ res.add(y);
+ }
+ return res;
+ }
+ public TDoubleArrayList interpolPoints(final double _x, final EGRepere _rep) {
+ TDoubleArrayList res = new TDoubleArrayList();
+ if (model_.getNbValues() == 0) {
+ return res;
+ }
+ final EGAxeVertical vert = getAxeY();
+ final TIntArrayList idxs = getSegmentIdxContaining(_x);
+ if (idxs.isEmpty()) {
+ return res;
+ }
+ int nb = idxs.size();
+ for (int i = 0; i < nb; i++) {
+ int seg = idxs.get(i);
+ double xmin = model_.getX(seg);
+ double ymin = model_.getY(seg);
+ double xmax = model_.getX(seg + 1);
+ double ymax = model_.getY(seg + 1);
+ double y = ymax - (xmax - _x) / (xmax - xmin) * (ymax - ymin);
+ res.add(y);
+ }
+ return res;
+ }
+
+ /**
+ *
+ * @param _x
+ * @param _rep
+ * @return attention, cela suppose que les x sont strictement croissants.
+ */
public double interpolOnEcran(final double _x, final EGRepere _rep) {
if (model_.getNbValues() == 0) {
return 0d;
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-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -179,6 +179,13 @@
r.add(a);
actionForGroup.add(a);
+ final EGInteractionInfoOnCourbe infoOnCourbe = new EGInteractionInfoOnCourbe(vue_.graphe_);
+ vue_.addInteractiveCmp(infoOnCourbe);
+ a = new EGActionInteraction(EbliLib.getS("Afficher le nom de la courbe sous la souris"), EbliResource.EBLI.getIcon("tooltip"), "INFO", infoOnCourbe);
+ a.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Afficher le nom de la courbe sous la souris"));
+ a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('n'));
+ r.add(a);
+
final EGInteractionSuivi suivi = new EGInteractionSuivi(vue_.getGraphe());
vue_.addInteractiveCmp(suivi);
a = new EGActionInteraction(EbliLib.getS("suivi"), EbliResource.EBLI.getIcon("pointeur"), "SUIVI", suivi);
Copied: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionInfoOnCourbe.java (from rev 7771, trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java)
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionInfoOnCourbe.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionInfoOnCourbe.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -0,0 +1,162 @@
+/*
+ * @creation 23 juin 2004
+ * @modification $Date: 2006-09-19 14:55:53 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @mail de...@fu...
+ */
+package org.fudaa.ebli.courbe;
+
+import gnu.trove.TDoubleArrayList;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.MouseInfo;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import org.apache.commons.lang.StringUtils;
+
+import org.fudaa.ebli.trace.TraceBox;
+
+/**
+ * @author Fred Deniger
+ * @version $Id: EGInteractionSuivi.java,v 1.13 2006-09-19 14:55:53 deniger Exp $
+ */
+public class EGInteractionInfoOnCourbe extends EGInteractiveComponent implements MouseListener,
+ MouseMotionListener {
+
+ EGGraphe target_;
+ TraceBox tb_;
+ String info;
+
+ @Override
+ public String getDescription() {
+ return "";
+ }
+// int selectedPtIdx_;
+
+ /**
+ * @param _a la cible pour le suivi.
+ */
+ public EGInteractionInfoOnCourbe(final EGGraphe _a) {
+ target_ = _a;
+ target_.addMouseListener(this);
+ target_.addMouseMotionListener(this);
+ }
+ int deltaInPixel = 5;
+
+ private String updateWithMouse(final int _x, final int _y) {
+ if (!isActive()) {
+ return null;
+ }
+ StringBuilder names = new StringBuilder();
+ double xreel = target_.getTransformer().getXReel(_x);
+ if (target_.getTransformer().getXAxe().isDiscret()) {
+ xreel = (int) xreel;
+ }
+
+ for (int i = 0; i < target_.getModel().getCourbes().length; i++) {
+ final EGCourbe ci = target_.getModel().getCourbes()[i];
+ if (ci.getAxeY() == null) {
+ continue;
+ }
+ TDoubleArrayList yPressed = ci.interpolPointsOnEcran(xreel, target_.getTransformer());
+ int nb = yPressed.size();
+ for (int j = 0; j < nb; j++) {
+ if (Math.abs(yPressed.get(j) - _y) <= deltaInPixel) {
+ if (names.length() > 0) {
+ names.append('\n');
+ }
+ names.append(ci.getTitle());
+
+ }
+ }
+ }
+ return names.toString();
+ }
+
+ @Override
+ protected void paintComponent(final Graphics _g) {
+ if (isActive() && StringUtils.isNotBlank(info)) {
+ if (tb_ == null) {
+ tb_ = new TraceBox();
+ tb_.setVPosition(SwingConstants.BOTTOM);
+ tb_.setHPosition(SwingConstants.CENTER);
+ tb_.setColorFond(UIManager.getColor("ToolTip.background"));
+ tb_.setColorText(UIManager.getColor("ToolTip.foreground"));
+ }
+ Point location = MouseInfo.getPointerInfo().getLocation();
+ SwingUtilities.convertPointFromScreen(location, this);
+ tb_.paintBox((Graphics2D) _g, location.x, location.y, info);
+ }
+ }
+
+ @Override
+ public void mouseDragged(final MouseEvent e) {
+ updateWhenMouseMoved(e);
+ }
+
+ @Override
+ public void mouseEntered(final MouseEvent e) {
+ updateWhenMouseMoved(e);
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ updateWhenMouseMoved(e);
+ }
+
+ @Override
+ public void mouseExited(final MouseEvent e) {
+ info = null;
+ repaint();
+ }
+
+ @Override
+ public void mouseMoved(final MouseEvent e) {
+ updateWhenMouseMoved(e);
+ }
+
+ @Override
+ public void mousePressed(final MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(final MouseEvent e) {
+ }
+
+ /**
+ * Methode appelee a chque activation
+ */
+ @Override
+ public void setActive(final boolean _b) {
+ super.setActive(_b);
+ if (!_b) {
+ if (target_ != null) {
+ target_.repaint();
+
+
+
+
+ }
+
+ }
+ }
+
+ private void updateWhenMouseMoved(final MouseEvent e) {
+ if (!isActive()) {
+ return;
+ }
+ if (e.isConsumed()) {
+ return;
+ }
+ info = updateWithMouse(e.getX(), e.getY());
+ repaint();
+ }
+}
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-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionSuivi.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -7,6 +7,7 @@
*/
package org.fudaa.ebli.courbe;
+import gnu.trove.TDoubleArrayList;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
@@ -28,28 +29,19 @@
public class EGInteractionSuivi extends EGInteractiveComponent implements MouseListener, MouseMotionListener {
boolean dessine_;
-
TraceIcon selected_;
-
TraceIcon normal_;
-
EGGraphe target_;
-
TraceBox tb_;
-
Color traceColor_;
-
EGAxeVertical v_;
-
double xreel_;
@Override
public String getDescription() {
return EbliLib.getS("suivi");
}
-
- double yreel_;
-
+ double[] yreel_;
int selectedPtIdx_;
/**
@@ -60,9 +52,8 @@
target_.addMouseListener(this);
target_.addMouseMotionListener(this);
}
+ TDoubleArrayList yPressed_;
- int yPressed_;
-
private void updateWithMouse(final int _x, final int _y) {
if (!isActive()) {
return;
@@ -83,11 +74,12 @@
v_ = ci.getAxeY();
if (selectedPtIdx_ >= 0) {
xreel_ = ci.getModel().getX(selectedPtIdx_);
- yreel_ = ci.getModel().getY(selectedPtIdx_);
+ yreel_ = new double[]{ci.getModel().getY(selectedPtIdx_)};
} else {
- yreel_ = ci.interpol(xreel_);
+ TDoubleArrayList interpol = ci.interpolPoints(xreel_, target_.getTransformer());
+ yreel_ = interpol.toNativeArray();
if (target_.getTransformer().getXAxe().isLogarithmique()) {
- yPressed_ = (int) ci.interpolOnEcran(xreel_, target_.getTransformer());
+ yPressed_ = ci.interpolPointsOnEcran(xreel_, target_.getTransformer());
}
}
@@ -105,6 +97,7 @@
@Override
protected void paintComponent(final Graphics _g) {
if (isActive() && dessine_ && (v_ != null)) {
+ final Color old = _g.getColor();
if (tb_ == null) {
tb_ = new TraceBox();
}
@@ -115,47 +108,45 @@
return;
}
final int x = r.getXEcran(xreel_);
- final int y = r.getYEcran(yreel_, v_);
- if (isExactPtSelect()) {
- getSelectedIcone().paintIconCentre(_g, x, y);
- } else {
- getNormalIcone().paintIconCentre(_g, x, y);
- }
- boolean logAndEcart = false;
- if (r.getXAxe().isLogarithmique() && Math.abs(yPressed_ - y) > 3) {
- logAndEcart = true;
- getNormalIcone().paintIconCentre(_g, x, yPressed_);
- }
- final Color old = _g.getColor();
- _g.setColor(getTraceColor());
- final int mx = r.getMaxEcranY() + 2;
- _g.drawLine(x, r.getMinEcranY(), x, mx);
+ for (int i = 0; i < yreel_.length; i++) {
+ final int y = r.getYEcran(yreel_[i], v_);
+ if (isExactPtSelect()) {
+ getSelectedIcone().paintIconCentre(_g, x, y);
+ } else {
+ getNormalIcone().paintIconCentre(_g, x, y);
+ }
+ boolean logAndEcart = false;
+ if (r.getXAxe().isLogarithmique() && Math.abs(yPressed_.get(i) - y) > 3) {
+ logAndEcart = true;
+ getNormalIcone().paintIconCentre(_g, x, yPressed_.get(i));
+ }
+ _g.setColor(getTraceColor());
+ final int mx = r.getMaxEcranY() + 2;
+ _g.drawLine(x, r.getMinEcranY(), x, mx);
- final int xmin = v_.isDroite() ? r.getMinEcranX() : r.getMinEcranX() - target_.getOffSet(v_) - 3;
- final int xmax = v_.isDroite() ? r.getMaxEcranX() + target_.getOffSet(v_) + 3 : r.getMaxEcranX();
- _g.drawLine(xmin, y, xmax, y);
- if (logAndEcart) {
- _g.drawLine(xmin, yPressed_, xmax, yPressed_);
+ final int xmin = v_.isDroite() ? r.getMinEcranX() : r.getMinEcranX() - target_.getOffSet(v_) - 3;
+ final int xmax = v_.isDroite() ? r.getMaxEcranX() + target_.getOffSet(v_) + 3 : r.getMaxEcranX();
+ _g.drawLine(xmin, y, xmax, y);
+ if (logAndEcart) {
+ _g.drawLine(xmin, (int) yPressed_.get(i), xmax, (int) yPressed_.get(i));
+ }
+ tb_.setColorText(r.getXAxe().getLineColor());
+ tb_.getTraceLigne().setCouleur(r.getXAxe().getLineColor());
+ tb_.setHPosition(SwingConstants.CENTER);
+ tb_.setVPosition(SwingConstants.TOP);
+ final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_);
+ 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]));
+ if (logAndEcart) {
+ tb_.paintBox((Graphics2D) _g, x + 5, (int) yPressed_.get(i), v_.getStringInterpolatedAffiche(r.getYReel(
+ (int) yPressed_.get(i), v_)));
+ }
}
- tb_.setColorText(r.getXAxe().getLineColor());
- tb_.getTraceLigne().setCouleur(r.getXAxe().getLineColor());
- tb_.setHPosition(SwingConstants.CENTER);
- tb_.setVPosition(SwingConstants.TOP);
- final String s = r.getXAxe().getStringInterpolatedAffiche(xreel_);
- 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_));
- tb_.paintBox((Graphics2D) _g,xmax , 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);
}
}
@@ -207,19 +198,24 @@
}
@Override
- public void mouseEntered(final MouseEvent _e) {}
+ public void mouseEntered(final MouseEvent _e) {
+ }
@Override
- public void mouseExited(final MouseEvent _e) {}
+ public void mouseExited(final MouseEvent _e) {
+ }
@Override
- public void mouseMoved(final MouseEvent _e) {}
+ public void mouseMoved(final MouseEvent _e) {
+ }
@Override
- public void mousePressed(final MouseEvent _e) {}
+ public void mousePressed(final MouseEvent _e) {
+ }
@Override
- public void mouseReleased(final MouseEvent _e) {}
+ public void mouseReleased(final MouseEvent _e) {
+ }
@Override
public void setActive(final boolean _b) {
@@ -231,5 +227,4 @@
}
}
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -1,6 +1,8 @@
/**
- * @creation 24 oct. 2003 @modification $Date: 2008-05-13 12:10:36 $ @license GNU General Public License 2 @copyright (c)1998-2001
- * CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @creation 24 oct. 2003
+ * @modification $Date: 2008-05-13 12:10:36 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
*/
package org.fudaa.ebli.calque;
@@ -67,10 +69,9 @@
double hT = _envGeneral.getDeltaY();
if (wT <= 0) {
wT = hT;
+ } else if (hT <= 0) {
+ hT = wT;
}
- else if(hT<=0){
- hT=wT;
- }
final double coef = 0.1;
// premier test: le zoom ne doit pas etre inferieur a 10% du domaine total
// sinon l'utilisateur ne sait pas ou il est
@@ -101,14 +102,14 @@
*/
protected TraceLigneModel ligneModel_;
/**
- * Le modele pour le trac\xE9 des surfaces. Si null, le selecteur de surface n'est pas repr\xE9sent\xE9 dans la configuration du calque,
- * le trac\xE9 de surface ne se fait pas.
+ * Le modele pour le trac\xE9 des surfaces. Si null, le selecteur de surface n'est pas repr\xE9sent\xE9 dans la configuration du calque, le trac\xE9 de surface
+ * ne se fait pas.
*/
protected TraceSurfaceModel surfModel_;
protected int alpha_ = 255;
/**
- * Permet de savoir si la palette de couleur doit etre utilisee ou non. Jusqu'a maintenant on testait paletteCouleur_: si null
- * pas de palette et sinon palette. Or cette methode ne permet pas de sauvegarder l'etat de la palette.
+ * Permet de savoir si la palette de couleur doit etre utilisee ou non. Jusqu'a maintenant on testait paletteCouleur_: si null pas de palette et
+ * sinon palette. Or cette methode ne permet pas de sauvegarder l'etat de la palette.
*/
protected boolean isPaletteCouleurUsed_;
protected boolean painted_ = true;
@@ -152,7 +153,7 @@
}
public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
- final GrBoite _clipReel) {
+ final GrBoite _clipReel) {
if (isVisible()) {
paintDonnees(_g, _versEcran, _versReel, _clipReel);
}
@@ -229,8 +230,8 @@
}
/**
- * Permet d'ajuster le zoom (la boite _r) en fonction du modele: la boite est au moins egale a 10% du domaine total et elle est
- * ensuite agrandie de 10% pour tout voir.
+ * Permet d'ajuster le zoom (la boite _r) en fonction du modele: la boite est au moins egale a 10% du domaine total et elle est ensuite agrandie de
+ * 10% pour tout voir.
*
* @param _r la boite de zoom a modifier
*/
@@ -309,7 +310,7 @@
}
public void paintTransient(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
- final GrBoite _clipReel) {
+ final GrBoite _clipReel) {
}
public CtuluListSelectionInterface getLayerSelection() {
@@ -607,8 +608,8 @@
}
/**
- * @return true si la l\xE9gende ne contient que des donn\xE9es concerant la palette de couleur. dans ce cas, la legende est enlevee
- * si aucune palette n'est utilis\xE9e.
+ * @return true si la l\xE9gende ne contient que des donn\xE9es concerant la palette de couleur. dans ce cas, la legende est enlevee si aucune palette
+ * n'est utilis\xE9e.
*/
public boolean legendContainsOnlyPalette() {
return true;
@@ -623,17 +624,22 @@
painted_ = _b;
}
+ @Override
public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) {
- if (paletteCouleur_ == null) {
- if (isDiscrete()) {
- paletteCouleur_ = new BPalettePlageDiscret(new Object[0]);
- paletteCouleur_.setPlages(_newPlage.getPlages());
+ if (_newPlage == null) {
+ paletteCouleur_=null;
+ } else {
+ if (paletteCouleur_ == null) {
+ if (isDiscrete()) {
+ paletteCouleur_ = new BPalettePlageDiscret(new Object[0]);
+ paletteCouleur_.setPlages(_newPlage.getPlages());
+ } else {
+ paletteCouleur_ = new BPalettePlage();
+ paletteCouleur_.initFrom(_newPlage);
+ }
} else {
- paletteCouleur_ = new BPalettePlage();
paletteCouleur_.initFrom(_newPlage);
}
- } else {
- paletteCouleur_.initFrom(_newPlage);
}
isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0;
construitLegende();
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java 2012-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java 2012-11-02 07:13:31 UTC (rev 7845)
@@ -11,6 +11,7 @@
*/
package org.fudaa.ebli.commun;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.util.HashMap;
import java.util.Map;
@@ -26,7 +27,9 @@
*/
public final class EbliUIProperties {
+ @XStreamAlias("Name")
private String name_;
+ @XStreamAlias("Values")
private final Map values_;
public EbliUIProperties() {
Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
===================================================================
--- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-02 06:58:05 UTC (rev 7844)
+++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-02 07:13:31 UTC (rev 7845)
@@ -852,4 +852,5 @@
Configurer les courbes=Configure curves
Ajouter des points=Add points
Afficher les labels des points=Display points label
-Labels verticaux=Vertical labels
\ No newline at end of file
+Labels verticaux=Vertical labels
+Afficher le nom de la courbe sous la souris=Display the name of the curve pointed by the mouse
\ No newline at end of file
Added: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/tooltip.png
===================================================================
(Binary files differ)
Property changes on: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/tooltip.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-02 18:23:33
|
Revision: 7852
http://fudaa.svn.sourceforge.net/fudaa/?rev=7852&view=rev
Author: deniger
Date: 2012-11-02 18:23:26 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java 2012-11-02 18:23:03 UTC (rev 7851)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibString.java 2012-11-02 18:23:26 UTC (rev 7852)
@@ -26,7 +26,7 @@
/**
* Classe utilitaire permettant de manipuler des chaines de caracteres.
- *
+ *
* @author Fred Deniger
* @version $Id: CtuluLibString.java,v 1.30 2007-06-20 12:20:45 deniger Exp $
*/
@@ -38,24 +38,23 @@
public final static String VIR = ",";
public final static String DOT = ".";
public final static String CINQ = "5";
-
/**
* Chaine "2". Utile pour la conversion.
*/
public final static String DEUX = "2";
-
/**
* Chaine "10". Utile pour la conversion.
*/
public final static String DIX = "10";
-
/**
* Chaine vide.
*/
public final static String EMPTY_STRING = "";
public static boolean containsVirgule(final String _num) {
- if (isEmpty(_num)) { return false; }
+ if (isEmpty(_num)) {
+ return false;
+ }
final String s = _num.trim();
try {
Double.parseDouble(s);
@@ -74,11 +73,15 @@
* @return true si la chaine est vide ou null ou si elle ne contient que des espaces
*/
public static boolean isEmpty(final String _s) {
- if (_s == null || _s == EMPTY_STRING) { return true; }
+ if (_s == null || _s == EMPTY_STRING) {
+ return true;
+ }
final int nb = _s.length();
for (int i = nb - 1; i >= 0; i--) {
- if (!Character.isWhitespace(_s.charAt(i))) { return false; }
+ if (!Character.isWhitespace(_s.charAt(i))) {
+ return false;
+ }
}
return true;
@@ -99,68 +102,61 @@
* @return true si c'est un nombre
*/
public static boolean isNumeric(final String _s) {
- if (isEmpty(_s)) { return false; }
+ if (isEmpty(_s)) {
+ return false;
+ }
final String s = _s.trim();
try {
Double.parseDouble(s);
return true;
} catch (final NumberFormatException e) {
- if (s.indexOf(',') > 0) { return isNumeric(FuLib.replace(s, CtuluLibString.VIR, CtuluLibString.DOT)); }
+ if (s.indexOf(',') > 0) {
+ return isNumeric(FuLib.replace(s, CtuluLibString.VIR, CtuluLibString.DOT));
+ }
return false;
}
}
-
/**
* Tableau vide.
*/
public final static String[] EMPTY_STRING_ARRAY = new String[0];
-
/**
* Chaine " ".
*/
public final static String ESPACE = " ";
-
/**
* Chaine "8". Utile pour la conversion.
*/
public final static String HUIT = "8";
-
/**
* Chaine separatrice de ligne.
*/
public final static String LINE_SEP = System.getProperty("line.separator");
public final static String LINE_SEP_SIMPLE = "\n";
-
/**
* Chaine "9". Utile pour la conversion.
*/
public final static String NEUF = "9";
-
/**
* Chaine "4". Utile pour la conversion.
*/
public final static String QUATRE = "4";
-
/**
* Chaine "7". Utile pour la conversion.
*/
public final static String SEPT = "7";
-
/**
* Chaine "6". Utile pour la conversion.
*/
public final static String SIX = "6";
-
/**
* Chaine "3". Utile pour la conversion.
*/
public final static String TROIS = "3";
-
/**
* Chaine "1". Utile pour la conversion.
*/
public final static String UN = "1";
-
/**
* Chaine "0". Utile pour la conversion.
*/
@@ -175,9 +171,10 @@
}
/**
- * Ajuste la taille de _s a <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s
- * seront enleves. Sinon, les espaces n\xE9cessaires seront ajoutes.
- *
+ * Ajuste la taille de _s a
+ * <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s seront enleves. Sinon, les espaces n\xE9cessaires seront
+ * ajoutes.
+ *
* @param _taille la taille
* @param _s la chaine a ajuster
* @return la chaine ajustee.
@@ -187,9 +184,10 @@
}
/**
- * Ajuste la taille de _s a <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s
- * seront enleves. Sinon, les espaces n\xE9cessaires seront ajoutes.
- *
+ * Ajuste la taille de _s a
+ * <code>_taille</code>. Si la taille de _s est plus grande, les derniers caracteres de s seront enleves. Sinon, les espaces n\xE9cessaires seront
+ * ajoutes.
+ *
* @param _taille la taille
* @param _s la chaine a ajuster
* @param _addSpaceBefore true si les espace doivent etre ajoute avant
@@ -198,7 +196,9 @@
public static String adjustSize(final int _taille, final String _s, boolean _addSpaceBefore) {
final String s = _s == null ? EMPTY_STRING : _s;
final int l = s.length();
- if (l > _taille) { return s.substring(0, _taille); }
+ if (l > _taille) {
+ return s.substring(0, _taille);
+ }
final StringBuffer r = new StringBuffer(_taille);
if (!_addSpaceBefore) {
r.append(s);
@@ -211,22 +211,22 @@
r.append(b);
}
switch (sup) {
- case 0:
- break;
- case 1:
- r.append(ESPACE);
- break;
- case 2:
- r.append(" ");
- break;
- case 3:
- r.append(" ");
- break;
- case 4:
- r.append(" ");
- break;
- default:
- break;
+ case 0:
+ break;
+ case 1:
+ r.append(ESPACE);
+ break;
+ case 2:
+ r.append(" ");
+ break;
+ case 3:
+ r.append(" ");
+ break;
+ case 4:
+ r.append(" ");
+ break;
+ default:
+ break;
}
if (_addSpaceBefore) {
r.append(s);
@@ -248,7 +248,9 @@
public static String adjustSize(final int _taille, final String _s, boolean _addSpaceBefore, final char _charToUse) {
final String s = _s == null ? EMPTY_STRING : _s;
final int l = s.length();
- if (l > _taille) { return s.substring(0, _taille); }
+ if (l > _taille) {
+ return s.substring(0, _taille);
+ }
final StringBuffer r = new StringBuffer(_taille);
if (!_addSpaceBefore) {
r.append(s);
@@ -262,22 +264,22 @@
r.append(b);
}
switch (sup) {
- case 0:
- break;
- case 1:
- r.append(_charToUse);
- break;
- case 2:
- r.append(_charToUse).append(_charToUse);
- break;
- case 3:
- r.append(_charToUse).append(_charToUse).append(_charToUse);
- break;
- case 4:
- r.append(_charToUse).append(_charToUse).append(_charToUse).append(_charToUse);
- break;
- default:
- break;
+ case 0:
+ break;
+ case 1:
+ r.append(_charToUse);
+ break;
+ case 2:
+ r.append(_charToUse).append(_charToUse);
+ break;
+ case 3:
+ r.append(_charToUse).append(_charToUse).append(_charToUse);
+ break;
+ case 4:
+ r.append(_charToUse).append(_charToUse).append(_charToUse).append(_charToUse);
+ break;
+ default:
+ break;
}
if (_addSpaceBefore) {
r.append(s);
@@ -312,9 +314,21 @@
return arrayToString(_o, ", ");
}
+ public static String arrayToString(final float[] _o) {
+ return arrayToString(_o, ", ");
+ }
+
+ public static String arrayToString(final int[] _o) {
+ return arrayToString(_o, ", ");
+ }
+
public static String arrayToString(final double[] _o, final String _sep) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
@@ -322,66 +336,82 @@
}
return r.toString();
}
-
- public static String arrayToString(final boolean[] _o, final String _sep) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
- final StringBuffer r = new StringBuffer();
- r.append(_o[0]);
- for (int i = 1; i < _o.length; i++) {
- r.append(_sep).append(_o[i]);
- }
- return r.toString();
- }
- /**
- * @param _o le tableau d'entier a voir
- * @return une chaine contenant tous les entiers separees par des virgules
- */
- public static String arrayToString(final long[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+
+ public static String arrayToString(final int[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
- appendInArray(r, Long.toString(_o[i]));
+ r.append(_sep).append(_o[i]);
}
return r.toString();
}
- public static String arrayToString(final float[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ public static String arrayToString(final float[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0]);
for (int i = 1; i < _o.length; i++) {
- appendInArray(r, Float.toString(_o[i]));
+ r.append(_sep).append(_o[i]);
}
return r.toString();
}
+ public static String arrayToString(final boolean[] _o, final String _sep) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
+ final StringBuffer r = new StringBuffer();
+ r.append(_o[0]);
+ for (int i = 1; i < _o.length; i++) {
+ r.append(_sep).append(_o[i]);
+ }
+ return r.toString();
+ }
+
/**
- * @param _array le tableau d'entier a voir
+ * @param _o le tableau d'entier a voir
* @return une chaine contenant tous les entiers separees par des virgules
*/
- public static String arrayToString(final int[] _array) {
- if (_array == null) { return getNullString(); }
- if (_array.length == 0) { return getEmptyTableau(); }
+ public static String arrayToString(final long[] _o) {
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
- r.append(_array[0]);
- for (int i = 1; i < _array.length; i++) {
- appendInArray(r, Integer.toString(_array[i]));
+ r.append(_o[0]);
+ for (int i = 1; i < _o.length; i++) {
+ appendInArray(r, Long.toString(_o[i]));
}
return r.toString();
}
/**
* @param _o le tableau a transformer en chaine
- * @return une chaine contenant tous les elements du tableau transformes en chaine ( toString) separes par des
- * virgules.
+ * @return une chaine contenant tous les elements du tableau transformes en chaine ( toString) separes par des virgules.
*/
public static String arrayToString(final Object[] _o) {
- if (_o == null) { return getNullString(); }
- if (_o.length == 0) { return getEmptyTableau(); }
+ if (_o == null) {
+ return getNullString();
+ }
+ if (_o.length == 0) {
+ return getEmptyTableau();
+ }
final StringBuffer r = new StringBuffer();
r.append(_o[0].toString());
for (int i = 1; i < _o.length; i++) {
@@ -391,7 +421,9 @@
}
public static String arrayToHtmlString(final Object[] _o) {
- if ((_o == null) || (_o.length == 1)) { return EMPTY_STRING; }
+ if ((_o == null) || (_o.length == 1)) {
+ return EMPTY_STRING;
+ }
final StringBuffer r = new StringBuffer("<html><body>");
r.append(_o[0].toString());
for (int i = 1; i < _o.length; i++) {
@@ -402,7 +434,7 @@
/**
* Transforme un tableau de chaine en une unique chaine avec des saut de lignes.
- *
+ *
* @param _tab le tableau a transformer
* @return la chaine
*/
@@ -412,22 +444,25 @@
/**
* Transforme un tableau de chaine en une unique chaine avec des saut de lignes.
- *
+ *
* @param _tab le tableau a transformer
* @return la chaine
*/
public static String arrayToString(final String[] _tab, final String _sep) {
- return arrayToString(_tab,0,_sep);
+ return arrayToString(_tab, 0, _sep);
}
+
/**
* @param _tab
* @param offset le premier indice a utiliser dans le tableau
* @param _sep
* @return
*/
- public static String arrayToString(final String[] _tab, int offset,final String _sep) {
- if (_tab == null) { return CtuluLibString.EMPTY_STRING; }
+ public static String arrayToString(final String[] _tab, int offset, final String _sep) {
+ if (_tab == null) {
+ return CtuluLibString.EMPTY_STRING;
+ }
final int n = _tab.length;
if (n > 0) {
final StringBuffer obj = new StringBuffer();
@@ -440,7 +475,7 @@
return obj.toString();
}
return null;
-
+
}
/**
@@ -448,7 +483,9 @@
* @return la chaine avec la premier lettre en majuscule.
*/
public static String capitalyze(final String _s) {
- if (isEmpty(_s)) { return _s; }
+ if (isEmpty(_s)) {
+ return _s;
+ }
final String prem = _s.substring(0, 1);
return prem.toUpperCase() + _s.substring(1);
}
@@ -458,16 +495,18 @@
* @return le tableau de string correspondant. Renvoie null si la taille est null ou si _v null.
*/
public static String[] enTableau(final Collection _v) {
- if ((_v == null) || (_v.size() == 0)) { return null; }
+ if ((_v == null) || (_v.size() == 0)) {
+ return null;
+ }
final String[] r = new String[_v.size()];
_v.toArray(r);
return r;
}
/**
- * Recherche parmi parmi le tableau ( en commencant par la fin) <code>_prefixe</code> la chaine. ayant le prefixe
- * demande
- *
+ * Recherche parmi parmi le tableau ( en commencant par la fin)
+ * <code>_prefixe</code> la chaine. ayant le prefixe demande
+ *
* @param _tabToTest le tableau a parcourir
* @param _prefixe le prefixe a chercher
* @return la chaine du tableau ayant le prefixe demande. null si aucune.
@@ -475,14 +514,16 @@
public static String findPrefixInTab(final String[] _tabToTest, final String _prefixe) {
for (int i = _tabToTest.length - 1; i >= 0; i--) {
final String s = _tabToTest[i];
- if (_prefixe.startsWith(s)) { return s; }
+ if (_prefixe.startsWith(s)) {
+ return s;
+ }
}
return null;
}
/**
* Recherche dans le tableau la chaine finissant par _end. Commence la recherche a la fin du tableau.
- *
+ *
* @param _tab le tableau a parcourir
* @param _end le suffixe cherche
* @return la chaine du tableau finissant par _end. null si aucune
@@ -491,15 +532,18 @@
if (_tab != null) {
for (int i = _tab.length - 1; i >= 0; i--) {
final String s = _tab[i];
- if (s.endsWith(_end)) { return s; }
+ if (s.endsWith(_end)) {
+ return s;
+ }
}
}
return null;
}
/**
- * Recherche dans le tableau (a partir de la fin) une chaine contenue dans la ligne a tester ( <code>_sToTest</code>).
- *
+ * Recherche dans le tableau (a partir de la fin) une chaine contenue dans la ligne a tester (
+ * <code>_sToTest</code>).
+ *
* @param _stringToLookFor le tableau a parcourir
* @param _sToTest la chaine qui doit contenir un des elements du tableau
* @return La chaine du tableau contenue dans _sToTest
@@ -507,7 +551,9 @@
public static String findStringIn(final String[] _stringToLookFor, final String _sToTest) {
for (int i = _stringToLookFor.length - 1; i >= 0; i--) {
final String s = _stringToLookFor[i];
- if (_sToTest.indexOf(s) >= 0) { return s; }
+ if (_sToTest.indexOf(s) >= 0) {
+ return s;
+ }
}
return null;
}
@@ -520,16 +566,17 @@
public static String findStringStartsWith(final String[] _tab, final String _start) {
for (int i = _tab.length - 1; i >= 0; i--) {
final String s = _tab[i];
- if (s.startsWith(_start)) { return s; }
+ if (s.startsWith(_start)) {
+ return s;
+ }
}
return null;
}
/**
- * Le format renvoy\xE9 permet d'ecrire des entiers sur le meme nombre de caract\xE8re. Par exemple <br>
- * NumberFormat fm=getFormgetFormatForIndexingInteger(5); <br>
- * String cinq= fm.format(5); //cinq =00005 String quinze=fm.format(15); //quinze=00015
- *
+ * Le format renvoy\xE9 permet d'ecrire des entiers sur le meme nombre de caract\xE8re. Par exemple <br> NumberFormat
+ * fm=getFormgetFormatForIndexingInteger(5); <br> String cinq= fm.format(5); //cinq =00005 String quinze=fm.format(15); //quinze=00015
+ *
* @param _nb le nombre d'entier a consid\xE9rer
* @return un format permettant d'ecrire les entiers de 0 a _nb sur le meme nombre de caract\xE8res
*/
@@ -548,15 +595,17 @@
}
/**
- * Renvoie sous forme de String l'objet _o. Pour une matrice, renvoie "[taille]" si non verbose. Si _verbose, renvoie
- * la description de tous les objets de la matrice (peut etre ennuyeux si les matrices sont tres grandes.
- *
+ * Renvoie sous forme de String l'objet _o. Pour une matrice, renvoie "[taille]" si non verbose. Si _verbose, renvoie la description de tous les
+ * objets de la matrice (peut etre ennuyeux si les matrices sont tres grandes.
+ *
* @param _o l'objet a decrire
* @param _verbose si true decrit tous les objets de la matrice.
* @return descriprion
*/
public static String getObjectInString(final Object _o, final boolean _verbose) {
- if (_o == null) { return "null"; }
+ if (_o == null) {
+ return "null";
+ }
final StringBuffer b = new StringBuffer();
if (_o.getClass().isArray()) {
final int n = Array.getLength(_o);
@@ -580,37 +629,37 @@
/**
* Utilise une constante si _i <11. Sinon utilise la methode Integer.
- *
+ *
* @param _i l'entier a transformer en chaine
* @return la chaine correpondante
*/
public static String getString(final int _i) {
if (_i < 11) {
switch (_i) {
- case 0:
- return ZERO;
- case 1:
- return UN;
- case 2:
- return DEUX;
- case 3:
- return TROIS;
- case 4:
- return QUATRE;
- case 5:
- return CINQ;
- case 6:
- return SIX;
- case 7:
- return SEPT;
- case 8:
- return HUIT;
- case 9:
- return NEUF;
- case 10:
- return DIX;
- default:
- return Integer.toString(_i);
+ case 0:
+ return ZERO;
+ case 1:
+ return UN;
+ case 2:
+ return DEUX;
+ case 3:
+ return TROIS;
+ case 4:
+ return QUATRE;
+ case 5:
+ return CINQ;
+ case 6:
+ return SIX;
+ case 7:
+ return SEPT;
+ case 8:
+ return HUIT;
+ case 9:
+ return NEUF;
+ case 10:
+ return DIX;
+ default:
+ return Integer.toString(_i);
}
}
return Integer.toString(_i);
@@ -622,14 +671,16 @@
/**
* Methode permettant de parser les arguments passes a une methode main. Stocke les valeurs pour chaque
- * <code>_ids</code> dans la table de correspondance passee en argument. Les arguments du type -f=monFichier seront
- * ajoutee sous la forme cle=-f et valeur=monFichier. Les arguments de type -l donneront cle=-l et valeur=null.
- *
+ * <code>_ids</code> dans la table de correspondance passee en argument. Les arguments du type -f=monFichier seront ajoutee sous la forme cle=-f et
+ * valeur=monFichier. Les arguments de type -l donneront cle=-l et valeur=null.
+ *
* @param _args les argument a parser
* @return table cle,valeur ( voir doc)
*/
public static synchronized Map parseArgs(final String[] _args) {
- if (_args == null) { return null; }
+ if (_args == null) {
+ return null;
+ }
final int l = _args.length;
final Map r = new HashMap(l);
int index;
@@ -647,20 +698,23 @@
}
/**
- * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie
- * [1,3,4];
- *
+ * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie [1,3,4];
+ *
* @param _s la chaine a traiter
* @param _sepChar le separateur
* @return le tableau des champs ou null si un des 2 parametres est nul.
*/
public static String[] parseString(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
return enTableau(parseStringList(_s, _sepChar));
}
public static double[] parseStringDouble(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
final List l = (parseStringList(_s, _sepChar));
final TDoubleArrayList res = new TDoubleArrayList();
for (int i = 0; i < l.size(); i++) {
@@ -674,37 +728,40 @@
return res.toNativeArray();
}
-
public static boolean[] parseStringBoolean(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
- final List l = (parseStringList(_s, _sepChar));
- final List<Boolean> res = new ArrayList<Boolean>();
- for (int i = 0; i < l.size(); i++) {
- try {
- res.add(Boolean.parseBoolean((String) l.get(i)));
- } catch (final NumberFormatException _evt) {
- FuLog.error(_evt);
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
+ final List l = (parseStringList(_s, _sepChar));
+ final List<Boolean> res = new ArrayList<Boolean>();
+ for (int i = 0; i < l.size(); i++) {
+ try {
+ res.add(Boolean.parseBoolean((String) l.get(i)));
+ } catch (final NumberFormatException _evt) {
+ FuLog.error(_evt);
- }
- }
- boolean[] tab=new boolean[res.size()];
- int cpt=0;
- for(Boolean bool:res)
- tab[cpt++]=bool.booleanValue();
-
- return tab;
- }
+ }
+ }
+ boolean[] tab = new boolean[res.size()];
+ int cpt = 0;
+ for (Boolean bool : res) {
+ tab[cpt++] = bool.booleanValue();
+ }
+ return tab;
+ }
+
/**
- * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie
- * [1,3,4];
- *
+ * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie [1,3,4];
+ *
* @param _s la chaine a traiter
* @param _sepChar le separateur
* @return le tableau des champs ou null si un des 2 parametres est nul.
*/
public static List parseStringList(final String _s, final String _sepChar) {
- if ((_s == null) || (_sepChar == null)) { return null; }
+ if ((_s == null) || (_sepChar == null)) {
+ return null;
+ }
final StringTokenizer tk = new StringTokenizer(_s, _sepChar);
final List l = new ArrayList();
while (tk.hasMoreTokens()) {
@@ -714,20 +771,26 @@
}
public static String trimRight(String _s) {
- if (_s == null || _s.length() == 0) return _s;
+ if (_s == null || _s.length() == 0) {
+ return _s;
+ }
int idxToTrim = _s.length() - 1;
while (idxToTrim >= 0 && Character.isWhitespace(_s.charAt(idxToTrim))) {
idxToTrim--;
}
- if (idxToTrim < 0) return EMPTY_STRING;
- if (idxToTrim == _s.length() - 1) return _s;
+ if (idxToTrim < 0) {
+ return EMPTY_STRING;
+ }
+ if (idxToTrim == _s.length() - 1) {
+ return _s;
+ }
return _s.substring(0, idxToTrim + 1);
}
/**
* A partir d'un nom de fichier ou d'une url locale incorrecte, construit une url locale valide.
- *
+ *
* @return url valide pour _file
* @param _file le chemin du fichier a transformer
*/
@@ -745,5 +808,4 @@
private CtuluLibString() {
super();
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2012-11-02 18:23:03 UTC (rev 7851)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2012-11-02 18:23:26 UTC (rev 7852)
@@ -57,9 +57,9 @@
import com.vividsolutions.jts.geom.Geometry;
/**
- * Un panneau d'\xE9dition d'un objet GIS unique contenu dans un calque editable
- * {@link ZCalqueEditable}. Ce panneau permet l'edition des coordonn\xE9es de l'objet ainsi que de ses attributs. Ce panneau est
- * associ\xE9 \xE0 un mod\xE8le \xE9ditable de calque. Un gestionnaire de commandes peut \xEAtre ajout\xE9 au panneau.
+ * Un panneau d'\xE9dition d'un objet GIS unique contenu dans un calque editable {@link ZCalqueEditable}. Ce panneau permet l'edition des coordonn\xE9es de
+ * l'objet ainsi que de ses attributs. Ce panneau est associ\xE9 \xE0 un mod\xE8le \xE9ditable de calque. Un gestionnaire de commandes peut \xEAtre ajout\xE9 au
+ * panneau.
*
* @author Fred Deniger
* @version $Id: EbliSingleObjectEditorPanel.java,v 1.10.6.2 2008-04-01 07:28:15 bmarchan Exp $
@@ -71,8 +71,7 @@
}
/**
- * Cette classe repr\xE9sente les informations sous forme d'un tableau de donn\xE9es. Les donn\xE9es affich\xE9es dans ce tableau peuvent
- * \xEAtre \xE9dit\xE9es.
+ * Cette classe repr\xE9sente les informations sous forme d'un tableau de donn\xE9es. Les donn\xE9es affich\xE9es dans ce tableau peuvent \xEAtre \xE9dit\xE9es.
*
* @author MARTIN Emmanuel
* @version $Id: EbliSingleObjectEditorPanel.java,v 1.10.6.2 2008-04-01 07:28:15 emartin Exp $
@@ -101,13 +100,12 @@
protected BuCheckBox modeChangement_;
/**
- * @param _editAttribut indique si les attributs globaux sont \xE9ditable (dans le cas o\xF9 ils ne le sont pas, ils ne sont pas
- * affich\xE9s)
+ * @param _editAttribut indique si les attributs globaux sont \xE9ditable (dans le cas o\xF9 ils ne le sont pas, ils ne sont pas affich\xE9s)
* @param _editVertexAttribut indique si les attributs des points sont \xE9ditable (ils seront dans tout les cas affich\xE9s)
* @param _xyFormatter formateur g\xE9rant le format des informations \xE0 afficher
*/
public TableRepresentation(final boolean _editAttributGlobaux, final boolean _editVertexAttribut,
- final EbliCoordinateDefinition[] _defs) {
+ final EbliCoordinateDefinition[] _defs) {
coordDefs_ = _defs;
// Zone centrale contenant soit le tableau de coordonn\xE9es en cas de points
// multiple, soit les informations d'un point unique.
@@ -151,7 +149,6 @@
// Gestion des erreurs
setErrorText(modelData_.getErrorMessage());
modelData_.addTableModelModeleAdapterErrorListener(new EbliSingleObjectTableModelErrorListener() {
-
public void modeleAdapterError(String _message) {
setErrorText(_message);
}
@@ -177,7 +174,6 @@
btDown_.setEnabled(false);
btUp_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int[] newSelection = modelData_.movePoints(table_.getSelectedRows(), -1);
@@ -189,7 +185,6 @@
}
});
btDown_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int[] newSelection = modelData_.movePoints(table_.getSelectedRows(), 1);
@@ -216,7 +211,6 @@
btDel_.setEnabled(false);
btAdd_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
int idxSel = modelData_.addPoint(table_.getSelectedRow());
@@ -224,7 +218,6 @@
}
});
btDel_.addActionListener(new ActionListener() {
-
public void actionPerformed(ActionEvent e) {
setErrorText("");
modelData_.removePoints(table_.getSelectedRows());
@@ -234,7 +227,6 @@
pnAdd.add(btDel_);
table_.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
-
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
@@ -257,7 +249,6 @@
EbliLib.getS(
"<html>En mode diff\xE9r\xE9 : les modifications ne sont appliqu\xE9es qu'\xE0 la fin.<br>En mode imm\xE9diat : les modifications sont appliqu\xE9es imm\xE9diatement.</html>"));
modeChangement_.addChangeListener(new ChangeListener() {
-
public void stateChanged(ChangeEvent e) {
if (modeChangement_.isSelected()) {
modelData_.setDeferredModifications(true);
@@ -375,7 +366,7 @@
* @param _xyFormatter
*/
public EbliSingleObjectEditorPanel(final ZModeleEditable _model, final int _idx, final boolean _editAttribut,
- final boolean _editVertexAttribut, final EbliCoordinateDefinition[] _defs) {
+ final boolean _editVertexAttribut, final EbliCoordinateDefinition[] _defs)...
[truncated message content] |
|
From: <de...@us...> - 2012-11-09 08:19:27
|
Revision: 7863
http://fudaa.svn.sourceforge.net/fudaa/?rev=7863&view=rev
Author: deniger
Date: 2012-11-09 08:19:19 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheTreeModel.java
Added Paths:
-----------
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/XstreamCustomizer.java
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-06 17:03:01 UTC (rev 7862)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphePersist.java 2012-11-09 08:19:19 UTC (rev 7863)
@@ -28,6 +28,7 @@
import org.fudaa.ctulu.gui.CtuluLibSwing;
import org.fudaa.ctulu.gui.CtuluUIDialog;
import org.fudaa.ebli.commun.EbliLib;
+import org.fudaa.ebli.commun.XstreamCustomizer;
/**
* Classe qui se charge de rendre persistant les donn\xE9es des graphes en xml.
@@ -35,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...
@@ -46,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");
}
@@ -99,7 +100,7 @@
private String getMainFilePath() {
return directoryPath_ + File.separator + MAINFILE;
}
-
+
private String getPanelFilePath() {
return directoryPath_ + File.separator + MAINFILE;
}
@@ -136,7 +137,7 @@
while (list.size() != 0) {
list.remove(0);
}
-
+
}
/**
@@ -160,11 +161,11 @@
// 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;
- int idxCurve=0;
+ int idxCurve = 0;
Map<EGCourbe, Integer> idByCurve = new HashMap<EGCourbe, Integer>();
Map<EGGroup, Integer> groupIdx = new HashMap<EGGroup, Integer>();
for (int egObjectIdx = 0; egObjectIdx < nbEgObjects; egObjectIdx++) {
@@ -176,23 +177,23 @@
EGGroupPersistBuilder<EGGroup> persistBuilder = groupe.createPersistBuilder();
EGGroupPersist persist = persistBuilder.persistObject(groupe, grapheTopersist, null);
persist.setIdx(idxGroup++);
- int groupId=persist.getIdx();
+ int groupId = persist.getIdx();
listeGroupePersistance.add(persist);
EGObject[] childs = groupe.getEGChilds();
for (int k = 0; k < childs.length; k++) {
if (childs[k] instanceof EGCourbeChild) {
// -- ajout de la courbe persitante dans un fichier avec pour groupee le i eme
EGCourbeChild courbeChild = (EGCourbeChild) childs[k];
- persistCurves.add(createPersist(courbeChild, groupId, grapheTopersist,idxCurve));
- idByCurve.put(courbeChild,idxCurve);
+ persistCurves.add(createPersist(courbeChild, groupId, grapheTopersist, idxCurve));
+ idByCurve.put(courbeChild, idxCurve);
idxCurve++;
persistedCurves.add(courbeChild);
}
}
} else if (objet instanceof EGCourbeChild) {
// le groupe d appartenance est -1
- persistCurves.add(createPersist((EGCourbeChild) objet, -1, grapheTopersist,idxCurve));
- idByCurve.put((EGCourbeChild) objet,idxCurve);
+ persistCurves.add(createPersist((EGCourbeChild) objet, -1, grapheTopersist, idxCurve));
+ idByCurve.put((EGCourbeChild) objet, idxCurve);
idxCurve++;
persistedCurves.add((EGCourbeChild) objet);
}
@@ -206,7 +207,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);
@@ -261,18 +262,18 @@
} finally {
CtuluLibFile.close(out);
}
-
+
}
-
+
@SuppressWarnings("unchecked")
- private EGCourbePersist createPersist(EGCourbeChild egCourbeChild, int groupIdx, EGGraphe grapheTopersist,int courbeUniqueId) {
+ private EGCourbePersist createPersist(EGCourbeChild egCourbeChild, int groupIdx, EGGraphe grapheTopersist, int courbeUniqueId) {
EGCourbePersistBuilder<EGCourbeChild> builder = (EGCourbePersistBuilder<EGCourbeChild>) egCourbeChild.createPersistBuilder();
EGCourbePersist courbePersist = builder.persistObject(egCourbeChild, grapheTopersist, getBinFileForCurve(courbeUniqueId));
courbePersist.setId(courbeUniqueId);
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) {
@@ -284,8 +285,7 @@
}
/**
- * Genere une instance de model par rapport au model serializ\xE9. Renvoie forc\xE9ment une class implements EGGrapheTreeModel sinon
- * null
+ * Genere une instance de model par rapport au model serializ\xE9. Renvoie forc\xE9ment une class implements EGGrapheTreeModel sinon null
*
* @param className
* @return
@@ -308,12 +308,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>();
@@ -344,16 +344,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 +365,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 +393,7 @@
} catch (EOFException eof) {
} catch (Exception e) {
FuLog.error(e);
-
+
}
// -- Etape 4: lecture des courbes --//
@@ -403,7 +403,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) {
@@ -413,7 +413,7 @@
}
courbeParameters.put(EGCourbePersistBuilder.GROUPE_KEY, container);
EGCourbeChild newCurve = builder.restoreObject(cbPersist, courbeParameters, log, getBinFileForCurve(cbPersist.getId()));
- if(newCurve==null){
+ if (newCurve == null) {
continue;
}
if (cbPersist.getId() >= 0) {
@@ -440,7 +440,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 +460,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,13 +477,17 @@
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 {
@@ -508,12 +512,12 @@
} catch (Exception e) {
FuLog.error(e);
}
-
+
}
-
+
return new EGFillePanel(graphe);
}
-
+
@SuppressWarnings("unchecked")
private EGGroupPersistBuilder<EGGroup> getGroupBuilder(EGGroupPersist groupPersist) {
String builderClass = groupPersist.builderClass;
@@ -535,7 +539,7 @@
}
return builder;
}
-
+
@SuppressWarnings("unchecked")
private EGCourbePersistBuilder<? extends EGCourbeChild> getCourbeBuilder(EGCourbePersist courbePersist) {
String builderClass = courbePersist.builderClass;
@@ -557,7 +561,7 @@
}
return builder;
}
-
+
public static void addEGAxeHorizontalPersistCompatibilityConfiguration(XStream parser) {
parser.aliasAttribute(EGAxeHorizontalPersist.class, "range", "minMax");
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheTreeModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2012-11-06 17:03:01 UTC (rev 7862)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2012-11-09 08:19:19 UTC (rev 7863)
@@ -80,11 +80,10 @@
}
}
- class CommandAddCourbe implements CtuluCommand {
+ public class CommandAddCourbe implements CtuluCommand {
EGCourbeChild c_;
int idx_;
-
EGGroup parentGroup_;
public CommandAddCourbe(final EGCourbeChild _c) {
@@ -97,7 +96,7 @@
@Override
public void redo() {
parentGroup_.addEGComponent(c_, idx_);
- nodesWereInserted(parentGroup_, new int[] { parentGroup_.getChildCount() - 1 });
+ nodesWereInserted(parentGroup_, new int[]{parentGroup_.getChildCount() - 1});
// fullRepaint();
selectPath(c_);
@@ -107,16 +106,15 @@
public void undo() {
final int i = parentGroup_.getIndex(c_);
parentGroup_.removeEGComponent(c_);
- nodesWereRemoved(parentGroup_, new int[] { i }, new Object[] { c_ });
+ nodesWereRemoved(parentGroup_, new int[]{i}, new Object[]{c_});
// fullRepaint();
selectPath(parentGroup_);
}
}
- class CommandAddCourbes implements CtuluCommand {
+ public class CommandAddCourbes implements CtuluCommand {
final EGCourbeChild[] c_;
-
final EGGroup parentGroup_;
public CommandAddCourbes(final EGCourbeChild[] _c) {
@@ -151,7 +149,6 @@
final List curveCopied_;
final List curveToCopy_;
-
final EGGroup groupDest_;
public CommandCourbeCopie(final EGGroup _dest, final List _courbeToCopy, final List _curveCopied) {
@@ -180,7 +177,6 @@
class CommandCourbeMove implements CtuluCommand {
Map curveOldGroup_;
-
EGGroup groupDest_;
public CommandCourbeMove(final EGGroup _dest, final Map _curveOldGroup) {
@@ -231,9 +227,11 @@
}
public EGGroup getGroup(final int _i) {
- if (components_.size() > _i)
+ if (components_.size() > _i) {
return (EGGroup) components_.get(_i);
- else return null;
+ } else {
+ return null;
+ }
}
protected void setDispatcher(final EGParent.Tree _dispatcher) {
@@ -403,7 +401,6 @@
@Override
public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
-
}
}
@@ -435,10 +432,9 @@
}
}
- protected class CommandAddCourbesMulti implements CtuluCommand {
+ public class CommandAddCourbesMulti implements CtuluCommand {
final EGCourbeChild[] c_;
-
final EGGroup[] parentGroup_;
public CommandAddCourbesMulti(final EGCourbeChild[] _c, final EGGroup[] _parentGroup) {
@@ -531,9 +527,7 @@
}
}
}
-
EGAxeHorizontal axeX_;
-
TreeSelectionModel selectionModel_;
public EGGrapheTreeModel() {
@@ -604,7 +598,7 @@
if (_c == null) {
return;
}
- nodesWereInserted(_c.getParentGroup(), new int[] { _c.getParentGroup().getChildCount() - 1 });
+ nodesWereInserted(_c.getParentGroup(), new int[]{_c.getParentGroup().getChildCount() - 1});
// fullRepaint();
selectPath(_c);
if (_mng != null) {
@@ -705,7 +699,7 @@
/**
* n'envoie pas d'evt.
- *
+ *
* @param _g le groupe a ajouter
*/
public void add(final EGGroup _g) {
@@ -860,7 +854,7 @@
/**
* methode qui demande a l user de choisir sa courbe puis genere une copie avec la source en cours.
- *
+ *
* @param _child
* @return
*/
@@ -907,7 +901,6 @@
internFireCourbeChanged(_o);
fireCourbeAspectChanged(_o, _visibility, listenerList);
}
-
protected boolean blockEvents_;
@Override
@@ -1066,7 +1059,6 @@
groupeMoved(_o);
}
}
-
boolean isUpdating;
@Override
@@ -1220,7 +1212,6 @@
@Override
public void setSpecificPersitDatas(Object sepcPersitData, Map Params) {
-
}
@Override
@@ -1229,11 +1220,10 @@
}
/**
- * Methode qui est appelee apres avoir charg\xE9 un model de graphe persistant. Doit etre surcharg\xE9 a plus haut niveau
- * pour effectuer des actions de finalisation specifiques.
+ * Methode qui est appelee apres avoir charg\xE9 un model de graphe persistant. Doit etre surcharg\xE9 a plus haut niveau pour effectuer des actions de
+ * finalisation specifiques.
*/
public void finalizePersistance() {
-
}
/**
@@ -1250,5 +1240,4 @@
public void setUpdating(boolean isUpdating) {
this.isUpdating = isUpdating;
}
-
}
\ No newline at end of file
Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/XstreamCustomizer.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/XstreamCustomizer.java (rev 0)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/XstreamCustomizer.java 2012-11-09 08:19:19 UTC (rev 7863)
@@ -0,0 +1,17 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.commun;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface XstreamCustomizer {
+
+ String PARAMETER_ID = "parameterId";
+
+ void configureXstream(XStream xstream);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-27 16:03:58
|
Revision: 8073
http://fudaa.svn.sourceforge.net/fudaa/?rev=8073&view=rev
Author: deniger
Date: 2012-11-27 16:03:46 +0000 (Tue, 27 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCsvWriter.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelDefault.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelInterface.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.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/EGMultiCourbeTableModel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java
Added Paths:
-----------
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/ExportTableCommentSupplier.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCsvWriter.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCsvWriter.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCsvWriter.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -12,8 +12,10 @@
import com.memoire.bu.BuFileFilter;
import java.text.DecimalFormat;
+import java.util.List;
import org.fudaa.ctulu.CsvWriter;
+import org.fudaa.ctulu.CtuluLibArray;
import org.fudaa.ctulu.CtuluLibString;
import org.fudaa.ctulu.CtuluResource;
import org.fudaa.ctulu.ProgressionInterface;
@@ -66,11 +68,19 @@
}
updater.setValue(4, maxRow);
updater.majProgessionStateOnly();
+ List<String> comments = table_.getComments();
+ if (CtuluLibArray.isNotEmpty(comments)) {
+ for (String comment : comments) {
+ w_.appendString("# " + comment);
+ w_.newLine();
+ }
+ }
+
if (writeHeader_) {
try {
- w_.appendString("#'" + table_.getColumnName(0) + '\'');
+ w_.appendString("#\"" + table_.getColumnName(0) + '\"');
for (int i = 1; i < maxCol; i++) {
- w_.appendString('\'' + table_.getColumnName(i) + '\'');
+ w_.appendString('\"' + table_.getColumnName(i) + '\"');
}
} catch (java.nio.charset.UnmappableCharacterException _evt) {
}
@@ -82,7 +92,11 @@
if (doubleFmt_ != null && (o instanceof Double)) {
w_.appendString(doubleFmt_.format((Double) o));
} else {
- w_.appendString(o == null ? CtuluLibString.EMPTY_STRING : o.toString());
+ String string = o == null ? CtuluLibString.EMPTY_STRING : o.toString();
+ if (string.indexOf(' ') > 0 || string.indexOf(w_.getSepChar()) > 0) {
+ string = "\"" + string + "\"";
+ }
+ w_.appendString(string);
}
}
w_.newLine();
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelDefault.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelDefault.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelDefault.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -7,6 +7,7 @@
*/
package org.fudaa.ctulu.table;
+import java.util.List;
import javax.swing.JTable;
import jxl.write.Label;
@@ -22,6 +23,8 @@
int[] column_;
int[] row_;
final JTable t_;
+ private boolean commentSetByUser;
+ private List<String> comments;
public CtuluTableModelDefault(final JTable _t, final int[] _column, final int[] _row) {
super();
@@ -30,7 +33,20 @@
t_ = _t;
}
+ public void setComments(List<String> comments) {
+ commentSetByUser = true;
+ this.comments = comments;
+ }
+
@Override
+ public List<String> getComments() {
+ if (commentSetByUser) {
+ return comments;
+ }
+ return (List<String>) t_.getClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY);
+ }
+
+ @Override
public String getColumnName(final int _i) {
if (column_ == null) {
return t_.getColumnName(_i);
@@ -63,7 +79,8 @@
}
try {
return new Number(_colInXls, _rowInXls, Double.parseDouble(s));
- } catch (final NumberFormatException e) {}
+ } catch (final NumberFormatException e) {
+ }
return new Label(_colInXls, _rowInXls, s);
}
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelInterface.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelInterface.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableModelInterface.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -1,12 +1,13 @@
/**
- * @creation 10 f\xE9vr. 2005
- * @modification $Date: 2007-04-16 16:33:53 $
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
- * @mail fud...@li...
+ * @creation 10 f\xE9vr. 2005
+ * @modification $Date: 2007-04-16 16:33:53 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @mail fud...@li...
*/
package org.fudaa.ctulu.table;
+import java.util.List;
import jxl.write.WritableCell;
/**
@@ -14,8 +15,19 @@
* @version $Id: CtuluTableModelInterface.java,v 1.2 2007-04-16 16:33:53 deniger Exp $
*/
public interface CtuluTableModelInterface {
+
+ /**
+ * property used in JComponent to give comments
+ */
+ public static final String EXPORT_COMMENT_PROPERTY = "EXPORT_COMMENT";
/**
+ *
+ * @return liste de commentaire \xE0 ajouter en d\xE9but de fichier.
+ */
+ List<String> getComments();
+
+ /**
* @return le nombre max de colonnes
*/
int getMaxCol();
@@ -45,5 +57,4 @@
* @return l'objet permettant d'ecrire la cellule. Si null ne fait rien.
*/
WritableCell getExcelWritable(int _rowInModel, int _colInModel, int _rowInXls, int _colInXls);
-
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -32,6 +32,8 @@
*/
public abstract class EGExportData implements CtuluTableModelInterface {
+ private List<String> comments;
+
public Object getXValueFor(final double xValue) {
if (g_.getModel().getAxeX().getSpecificFormat() != null) {
return g_.getModel().getAxeX().getSpecificFormat().format(xValue);
@@ -201,6 +203,15 @@
g_ = _g;
}
+ @Override
+ public List<String> getComments() {
+ return comments;
+ }
+
+ public void setComments(List<String> comments) {
+ this.comments = comments;
+ }
+
public EGCourbe[] getCourbes() {
return cs_;
}
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-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -51,6 +51,7 @@
import org.fudaa.ctulu.image.CtuluImageProducer;
import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.commun.EbliPreferences;
+import org.fudaa.ebli.commun.ExportTableCommentSupplier;
import org.fudaa.ebli.palette.BPaletteInfo;
import org.fudaa.ebli.repere.RepereMouseKeyController;
import org.fudaa.ebli.repere.RepereMouseKeyTarget;
@@ -91,6 +92,7 @@
protected EGRepere transformer_;
protected CtuluRange xRange_;
EGHorizontalBanner horizontalBanner;
+ private ExportTableCommentSupplier exportTableCommentSupplier;
public EGGraphe(final EGGrapheModel _m) {
addComponentListener(this);
@@ -108,6 +110,16 @@
initTitlesOrigins();
}
+ public void setExportTableCommentSupplier(ExportTableCommentSupplier exportTableCommentSupplier) {
+ this.exportTableCommentSupplier = exportTableCommentSupplier;
+ }
+
+ public ExportTableCommentSupplier getExportTableCommentSupplier() {
+ return exportTableCommentSupplier;
+ }
+
+
+
private void ajusteXAxe() {
final EGAxeHorizontal hAxe = getTransformer().getXAxe();
final double xmin = getXMin();
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -7,6 +7,7 @@
*/
package org.fudaa.ebli.courbe;
+import java.util.List;
import javax.swing.table.AbstractTableModel;
import jxl.write.WritableCell;
import org.fudaa.ctulu.table.CtuluTableModelInterface;
@@ -16,103 +17,111 @@
* @version $Id: EGMultiCourbeTableModel.java,v 1.4 2007-05-04 13:49:41 deniger Exp $
*/
public class EGMultiCourbeTableModel extends AbstractTableModel implements CtuluTableModelInterface {
-
+
final EGCourbe[] allCourbes_;
final EGCourbe[] selectedCourbes_;
boolean showOnlySelected_;
EGExportData current_;
final EGGraphe g_;
-
+ private List<String> comments;
+
public EGMultiCourbeTableModel(final EGCourbe[] _allCourbes, final EGCourbe[] _selectedCourbes, final EGGraphe _g) {
super();
allCourbes_ = _allCourbes == null ? new EGCourbe[0] : _allCourbes;
selectedCourbes_ = _selectedCourbes == null ? new EGCourbe[0] : _selectedCourbes;
g_ = _g;
current_ = EGExportData.createExportData(allCourbes_, g_, false, false, null);
-
}
-
+
@Override
+ public List<String> getComments() {
+ return comments;
+ }
+
+ public void setComments(List<String> comments) {
+ this.comments = comments;
+ current_.setComments(comments);
+ }
+
+ @Override
public WritableCell getExcelWritable(final int _rowInModel, final int _colInModel, final int _rowInXls, final int _colInXls) {
return current_.getExcelWritable(_rowInModel, _colInModel, _rowInXls, _colInXls);
}
-
+
@Override
public int getMaxCol() {
return current_.getMaxCol();
}
-
+
@Override
public int getMaxRow() {
return current_.getMaxRow();
}
-
+
@Override
public Object getValue(final int _row, final int _col) {
return current_.getValue(_row, _col);
}
-
boolean showOneTime_;
-
+
@Override
public int getColumnCount() {
return getMaxCol();
}
-
+
@Override
public int getRowCount() {
return getMaxRow();
}
-
+
@Override
public Class getColumnClass(final int _columnIndex) {
return Double.class;
}
-
+
@Override
public String getColumnName(final int _column) {
return current_.getColumnName(_column);
}
-
+
@Override
public boolean isCellEditable(final int _rowIndex, final int _columnIndex) {
return false;
}
-
+
@Override
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
return getValue(_rowIndex, _columnIndex);
}
-
+
protected boolean isShowOneTime() {
return showOneTime_;
}
-
+
protected EGCourbe[] getCourbes() {
return showOnlySelected_ ? selectedCourbes_ : allCourbes_;
}
-
+
protected void setShowOneTime(final boolean _showOneTime) {
if (showOneTime_ != _showOneTime) {
showOneTime_ = _showOneTime;
upateCurrentModel();
}
}
-
+
private void upateCurrentModel() {
current_ = EGExportData.createExportData(getCourbes(), g_, showOneTime_, false, null);
fireTableStructureChanged();
}
-
+
protected boolean isShowOnlySelected() {
return showOnlySelected_;
}
-
+
protected void setShowOnlySelected(final boolean _showOnlySelected) {
if (showOnlySelected_ != _showOnlySelected) {
showOnlySelected_ = _showOnlySelected;
upateCurrentModel();
}
}
-
}
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-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -45,39 +45,40 @@
* @version $Id: EGTableAction.java,v 1.3 2007-05-04 13:49:42 deniger Exp $
*/
public class EGTableAction extends EbliActionSimple implements EbliTableInfoTarget {
-
+
final EGGraphe graphe_;
-
+
public EGTableAction(final EGGraphe _graphe) {
super(EbliLib.getS("Tableau des valeurs"), BuResource.BU.getToolIcon("tableau"), "TABLE");
graphe_ = _graphe;
}
-
+
@Override
public void actionPerformed(final ActionEvent _e) {
-
+
final EbliTableInfoPanel pn = new EbliTableInfoPanel(new CtuluUIDialog(graphe_), this, null);
+ pn.setExportTableCommentSupplier(graphe_.getExportTableCommentSupplier());
pn.showInDialog();
}
boolean displayAll;
boolean addOptions = true;
-
+
public boolean isDisplayAll() {
return displayAll;
}
-
+
public void setDisplayAll(boolean displayAll) {
this.displayAll = displayAll;
}
-
+
public boolean isAddOptions() {
return addOptions;
}
-
+
public void setAddOptions(boolean addOptions) {
this.addOptions = addOptions;
}
-
+
protected boolean isExportable(EGCourbe cs) {
if (cs == null) {
return false;
@@ -88,14 +89,14 @@
}
return true;
}
-
+
protected boolean isExportable(EGObject cs) {
if (cs instanceof EGCourbe) {
return isExportable((EGCourbe) cs);
}
return false;
}
-
+
@Override
public BuTable createValuesTable() {
EGCourbe[] cs = graphe_.getModel().getCourbes();
@@ -163,18 +164,18 @@
EbliTableInfoPanel.setShowSelectedRow(table, false);
return table;
}
-
+
static class OptionActionListener implements ActionListener {
-
+
final EGMultiCourbeTableModel target_;
final CtuluTable table_;
-
+
public OptionActionListener(final EGMultiCourbeTableModel _target, final CtuluTable _dest) {
super();
target_ = _target;
table_ = _dest;
}
-
+
@Override
public void actionPerformed(final ActionEvent _e) {
final String com = _e.getActionCommand();
@@ -184,7 +185,7 @@
model = (CtuluTableSortModel) table_.getModel();
idx = model.getSortingColumn();
}
-
+
if ("SHOW_SELECTED_COURBES".equals(com)) {
Map<Object, TableCellRenderer> cellsRenderer = getCellsRenderer();
target_.setShowOnlySelected(((AbstractButton) _e.getSource()).isSelected());
@@ -197,9 +198,9 @@
if (idx > 0 && model != null) {
model.removeSortingColumn(idx);
}
-
+
}
-
+
private Map<Object, TableCellRenderer> getCellsRenderer() {
TableColumnModel columnModel = table_.getColumnModel();
Map<Object, TableCellRenderer> res = new HashMap<Object, TableCellRenderer>();
@@ -208,9 +209,9 @@
res.put(columnModel.getColumn(colIdx).getIdentifier(), columnModel.getColumn(colIdx).getCellRenderer());
}
return res;
-
+
}
-
+
private void putCellsRenderer(Map<Object, TableCellRenderer> renderer) {
if (renderer == null) {
return;
@@ -224,15 +225,15 @@
}
columnModel.getColumn(colIdx).setCellRenderer(tableCellRenderer);
}
-
+
}
}
-
+
@Override
public int[] getSelectedObjectInTable() {
return null;
}
-
+
@Override
public boolean isValuesTableAvailable() {
return true;
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2012-11-27 12:32:27 UTC (rev 8072)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -39,6 +39,7 @@
import org.fudaa.ctulu.gui.CtuluLibSwing;
import org.fudaa.ctulu.gui.CtuluTableExportPanel;
import org.fudaa.ctulu.table.CtuluTableColumnHeader;
+import org.fudaa.ctulu.table.CtuluTableModelInterface;
import org.fudaa.ctulu.table.CtuluTableSortModel;
/**
@@ -49,7 +50,7 @@
/**
* Le modele de table utilise pour afficher les valeurs des indices selectionn\xE9 uniquement.
- *
+ *
* @author Fred Deniger
* @version $Id: EbliTableInfoPanel.java,v 1.3 2007-05-04 13:49:47 deniger Exp $
*/
@@ -115,7 +116,7 @@
/**
* Enregistre le titre dans les propriete (putClientProperty) de la table.
- *
+ *
* @param _b le composant a modifier
* @param _t le titre quie sera utilise dans ce panneau
*/
@@ -125,7 +126,7 @@
/**
* Enregistre le titre dans les propriete (putClientProperty) de la table.
- *
+ *
* @param _b le composant a modifier
* @param _t le titre quie sera utilise dans ce panneau
*/
@@ -144,9 +145,7 @@
public static void setShowSelectedRow(final BuTable _b, final boolean _show) {
_b.putClientProperty("TABLE_SHOW_SELECTED_ROW", Boolean.valueOf(_show));
}
-
final TableColumnModel colModel_;
-
JDialog dialog_;
boolean displaySelected_;
TableModel globalModel_;
@@ -155,24 +154,24 @@
CtuluTableSortModel sortedModel_;
BuTable table_;
final CtuluUI ui_;
-
+
/**
- * Un constructeur, avec les formats pour les colonnes X et Y et Z. Le format
- * de Z est aussi utilis\xE9 pour les autres colonnes Double.
+ * Un constructeur, avec les formats pour les colonnes X et Y et Z. Le format de Z est aussi utilis\xE9 pour les autres colonnes Double.
+ *
* @param _defs Les definitions de coordonn\xE9es.
* @param _layer Le calque cible.
*/
public EbliTableInfoPanel(final CtuluUI _ui, final EbliTableInfoTarget _layer, EbliCoordinateDefinition[] _defs) {
super();
-
- if (_defs==null) {
- _defs=new EbliCoordinateDefinition[]{
- new EbliCoordinateDefinition("X", new EbliFormatter(SI.METER)),
- new EbliCoordinateDefinition("Y", new EbliFormatter(SI.METER)),
- new EbliCoordinateDefinition("Z", new EbliFormatter(SI.METER))
+
+ if (_defs == null) {
+ _defs = new EbliCoordinateDefinition[]{
+ new EbliCoordinateDefinition("X", new EbliFormatter(SI.METER)),
+ new EbliCoordinateDefinition("Y", new EbliFormatter(SI.METER)),
+ new EbliCoordinateDefinition("Z", new EbliFormatter(SI.METER))
};
}
-
+
target_ = _layer;
ui_ = _ui;
sortedModel_ = new CtuluTableSortModel();
@@ -182,7 +181,7 @@
if (table_ == null) {
setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BuBorders.EMPTY5555));
add(new JLabel(CtuluLib.getS("Pas de valeurs disponibles"), UIManager.getIcon("OptionPane.warningIcon"),
- SwingConstants.CENTER));
+ SwingConstants.CENTER));
colModel_ = null;
} else {
colModel_ = new DefaultTableColumnModel();
@@ -194,14 +193,12 @@
TableColumn column = init.getColumn(i);
int modelIdx = column.getModelIndex();
if (table_.getModel().getColumnClass(modelIdx).equals(Double.class)) {
- CtuluCellTextDecimalRenderer renderer=new CtuluCellTextDecimalRenderer();
+ CtuluCellTextDecimalRenderer renderer = new CtuluCellTextDecimalRenderer();
if (_defs[0].getName().equalsIgnoreCase(table_.getModel().getColumnName(modelIdx))) {
renderer.setFormatter(_defs[0].getFormatter().getXYFormatter());
- }
- else if (_defs[1].getName().equalsIgnoreCase(table_.getModel().getColumnName(modelIdx))) {
+ } else if (_defs[1].getName().equalsIgnoreCase(table_.getModel().getColumnName(modelIdx))) {
renderer.setFormatter(_defs[1].getFormatter().getXYFormatter());
- }
- else {
+ } else {
renderer.setFormatter(_defs[2].getFormatter().getXYFormatter());
}
column.setCellRenderer(renderer);
@@ -280,7 +277,7 @@
it.addActionListener(this);
it.setIcon(BuResource.BU.getIcon("exporter"));
menu.addMenuItem(BuResource.BU.getString("Copier"), "COPIER", BuResource.BU.getIcon("copier"), true,
- KeyEvent.VK_C, this);
+ KeyEvent.VK_C, this);
b.add(menu);
if (showSelectedRows(table_)) {
final BuCheckBox bc = new BuCheckBox();
@@ -309,12 +306,21 @@
dialog_.dispose();
dialog_ = null;
}
+ private ExportTableCommentSupplier exportTableCommentSupplier;
+ public void setExportTableCommentSupplier(ExportTableCommentSupplier exportTableCommentSupplier) {
+ this.exportTableCommentSupplier = exportTableCommentSupplier;
+ }
+
public void actionPerformed(final ActionEvent _e) {
if ("COPIER".equals(_e.getActionCommand())) {
copy();
} else if ("EXPORT_CSV".equals(_e.getActionCommand())) {
- CtuluTableExportPanel.doExport(table_, ui_);
+ table_.putClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY, null);
+ if (exportTableCommentSupplier != null) {
+ table_.putClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY, exportTableCommentSupplier.getComments());
+ }
+ CtuluTableExportPanel.doExport(';', table_, ui_);
}
}
@@ -322,5 +328,4 @@
public void itemStateChanged(final ItemEvent _e) {
changeSelectedIndexDisplayed();
}
-
-}
\ No newline at end of file
+}
Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/ExportTableCommentSupplier.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/ExportTableCommentSupplier.java (rev 0)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/ExportTableCommentSupplier.java 2012-11-27 16:03:46 UTC (rev 8073)
@@ -0,0 +1,15 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.commun;
+
+import java.util.List;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface ExportTableCommentSupplier {
+
+ List<String> getComments();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-28 14:41:17
|
Revision: 8082
http://fudaa.svn.sourceforge.net/fudaa/?rev=8082&view=rev
Author: deniger
Date: 2012-11-28 14:41:06 +0000 (Wed, 28 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetArrowConfigure.java
Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
===================================================================
--- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 13:59:49 UTC (rev 8081)
+++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 14:41:06 UTC (rev 8082)
@@ -1,4 +1,6 @@
Arri\xE8re plan=Background
+Bloqu\xE9=Blocked
+Fl\xE8che=Arrow
Editer la l\xE9gende=Edit legend
Editer le calque=Edit view
Afficher le temps=Display time informations
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetArrowConfigure.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetArrowConfigure.java 2012-11-28 13:59:49 UTC (rev 8081)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetArrowConfigure.java 2012-11-28 14:41:06 UTC (rev 8082)
@@ -39,7 +39,7 @@
@Override
public String getTitle() {
- return "test";
+ return EbliLib.getS("Fl\xE8che");
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-28 15:50:48
|
Revision: 8083
http://fudaa.svn.sourceforge.net/fudaa/?rev=8083&view=rev
Author: deniger
Date: 2012-11-28 15:50:38 +0000 (Wed, 28 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java
Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
===================================================================
--- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 14:41:06 UTC (rev 8082)
+++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 15:50:38 UTC (rev 8083)
@@ -13,8 +13,15 @@
3ivx Vid\xE9o codec=3ivx video codec
Zone d'impression=Print area
Densit\xE9=Density
+Choix couleur contour=Foreground color
+Choix couleur de fond=Background color
+Police=Font
+Choisir=Choose
+Transparence=Transparency
Paysage=Landscape
Format papier=Media size
+Editer le graphe=Edit graph
+Ajouter la l\xE9gende=Add legend
Afficher une fraction les vecteurs=Display a fraction of vectors
<html><body>Il est possible d'utiliser plusieurs sondes<br>en utilisant l'option ajouter ci-dessous=<html><body>It's possible to use several sound<br>by choosing the add option above.
<html><body>Interpoler les valeurs en un point<br /><b>On peut construire une ligne bris\xE9e en cr\xE9ant plusieurs sondes en maintenant shift. </b></body></html>=**<html><body>Interpoler les valeurs en un point<br /><b>On peut construire une ligne bris\xE9e en cr\xE9ant plusieurs sondes en maintenant shift. </b></body></html>**
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2012-11-28 14:41:06 UTC (rev 8082)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2012-11-28 15:50:38 UTC (rev 8083)
@@ -12,9 +12,8 @@
/**
* classe qui permet de creer les selecteurs necessaires pour la configuration.
- *
- * @author Adrien Hadoux TODO a revoir: ce sont les widgets qui doivent la responsabilite de savoir ce qui peut etre
- * configurer ou non
+ *
+ * @author Adrien Hadoux TODO a revoir: ce sont les widgets qui doivent la responsabilite de savoir ce qui peut etre configurer ou non
*/
public class WidgetConfigure implements BConfigurableInterface {
@@ -27,7 +26,7 @@
private boolean transparence;
public WidgetConfigure(final boolean lineModel_, final boolean colorsContours_, final boolean colorFonds_, final boolean rotations_,
- final boolean police_, final boolean transparence, final EbliWidget widget_) {
+ final boolean police_, final boolean transparence, final EbliWidget widget_) {
this.colorFonds_ = colorFonds_;
this.colorsContours_ = colorsContours_;
@@ -60,19 +59,19 @@
// -- model des colors contours --//
if (colorsContours_) {
final BSelecteurColorChooserBt modelCc = new BSelecteurColorChooserBt(EbliWidget.COLORCONTOUR);
- modelCc.setTitle("Choix couleur contour");
+ modelCc.setTitle(EbliLib.getS("Choix couleur contour"));
listeComposants.add(modelCc);
}
// -- model des colors de fond --//
if (colorFonds_) {
final BSelecteurColorChooserBt modelCf = new BSelecteurColorChooserBt(EbliWidget.COLORFOND);
- modelCf.setTitle("Choix couleur de fond");
+ modelCf.setTitle(EbliLib.getS("Choix couleur de fond"));
listeComposants.add(modelCf);
}
if (rotations_) {
final BSelecteurSlider slider = new BSelecteurSlider(EbliWidget.ROTATION, 0, 360);
- slider.setTitle("Rotation");
+ slider.setTitle(EbliLib.getS("Rotation"));
slider.slider_.setMajorTickSpacing(30);
slider.slider_.setMinorTickSpacing(10);
slider.slider_.setPaintTicks(true);
@@ -109,15 +108,15 @@
}
};
- modelF.bt_.setText("Choisir");
- modelF.setTitle("Police");
+ modelF.bt_.setText(EbliLib.getS("Choisir"));
+ modelF.setTitle(EbliLib.getS("Police"));
modelF.bt_.setFont(new Font("Helvetica.Italic", Font.PLAIN, 12));
listeComposants.add(modelF);
}
if (transparence) {
- BSelecteurCheckBox selectionTransparence = new BSelecteurCheckBox(EbliWidget.TRANSPARENCE, "Transparence");
+ BSelecteurCheckBox selectionTransparence = new BSelecteurCheckBox(EbliWidget.TRANSPARENCE, EbliLib.getS("Transparence"));
listeComposants.add(selectionTransparence);
}
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2012-11-28 14:41:06 UTC (rev 8082)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2012-11-28 15:50:38 UTC (rev 8083)
@@ -183,7 +183,7 @@
* @param _popup
*/
private void constructPopupMenuSpecifique(final JPopupMenu _popup) {
- JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende");
+ JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Ajouter la l\xE9gende"));
menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire"));
menuItem.addActionListener(new ActionListener() {
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-11-28 18:51:54
|
Revision: 8085
http://fudaa.svn.sourceforge.net/fudaa/?rev=8085&view=rev
Author: deniger
Date: 2012-11-28 18:51:46 +0000 (Wed, 28 Nov 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/animation/EbliAnimation.java
trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java
trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java
trunk/framework/fudaa-common/src/main/resources/org/fudaa/fudaa/ressource/fudaa_en.fr_txt
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-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2012-11-28 18:51:46 UTC (rev 8085)
@@ -563,11 +563,17 @@
paintSurface(_g, _t, i);
if (!nuagePoints_) {
- double newyie = getYEcran(yi, _t);
- double newyie2 = getYEcran(ypeVal, _t);
+ boolean canDraw = true;
+ if (getAxeY() != null) {
+ CtuluRange range = getAxeY().getRange();
+ canDraw = range.isValueContained(yi) || range.isValueContained(ypeVal);
+ }
+ if (canDraw) {
+ double newyie = getYEcran(yi, _t);
+ double newyie2 = getYEcran(ypeVal, _t);
+ trLigne.dessineTrait(_g, xie, newyie, xpe, newyie2);
+ }
- trLigne.dessineTrait(_g, xie, newyie, xpe, newyie2);
-
} else {
// -- trace un + --//
// -- ligne | --//
@@ -912,6 +918,7 @@
}
return res;
}
+
public TDoubleArrayList interpolPoints(final double _x, final EGRepere _rep) {
TDoubleArrayList res = new TDoubleArrayList();
if (model_.getNbValues() == 0) {
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/animation/EbliAnimation.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/animation/EbliAnimation.java 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/animation/EbliAnimation.java 2012-11-28 18:51:46 UTC (rev 8085)
@@ -45,7 +45,7 @@
/**
* Le composant d'animation, sous forme de palette. Il permet de controler le deroulement de l'animation.
- *
+ *
* @author Fred Deniger
* @version $Id: EbliAnimation.java,v 1.29 2008-04-22 14:30:27 jm_lacombe Exp $
*/
@@ -54,41 +54,23 @@
private final class LauncherPanel extends JPanel implements ActionListener, Observer, ItemListener, DocumentListener {
JCheckBox partialTs_;
-
BuProgressBar bar_;
-
BuButton btOut_;
-
BuComboBox cb_;
-
transient JComboBox cbFirst_;
-
transient JComboBox cbLast_;
-
BuComboBox cbOut_;
-
JCheckBox cbSaveVideo_;
-
BuToggleButton configure_;
-
BuLabel lbInfo_;
-
BuLabel lbSize_;
-
ComponentListener listener_;
-
Component old_;
-
JToggleButton pause_;
-
BuPanel pnConfigure_;
-
CtuluImageDimensionChooserPanel pnDimImages_;
-
JButton start_;
-
JButton stop_;
-
BuTextField txtInc_;
public LauncherPanel() {
@@ -105,12 +87,14 @@
final BuIcon icon = EbliResource.EBLI.getIcon("anim-play.png");
start_ = new JButton(icon);
start_.setBorderPainted(false);
+ start_.setContentAreaFilled(false);
start_.setToolTipText(EbliLib.getS("Lancer"));
start_.setActionCommand("GOGOGO_ETREGO");
start_.addActionListener(this);
pnButton.add(start_);
pause_ = new JToggleButton(EbliResource.EBLI.getIcon("anim-pause.png"));
pause_.setBorderPainted(false);
+ pause_.setContentAreaFilled(false);
pause_.setToolTipText(EbliLib.getS("Pause"));
pause_.setActionCommand("PAUSE");
pause_.addActionListener(this);
@@ -118,6 +102,7 @@
pnButton.add(pause_);
stop_ = new JButton(EbliResource.EBLI.getIcon("anim-stop.png"));
stop_.setBorderPainted(false);
+ stop_.setContentAreaFilled(false);
stop_.setToolTipText(EbliLib.getS("Arr\xEAter"));
stop_.setActionCommand("STOP");
stop_.addActionListener(this);
@@ -129,7 +114,9 @@
configure_.addItemListener(this);
configure_.setHorizontalAlignment(SwingConstants.LEFT);
final BuPanel pnConfigure = new BuPanel(new BuButtonLayout(0, SwingConstants.LEFT));
- if (cmpOptions_ != null) pnConfigure.add(cmpOptions_);
+ if (cmpOptions_ != null) {
+ pnConfigure.add(cmpOptions_);
+ }
pnConfigure.add(configure_);
pnButton.setBorder(new CtuluRoundEtchBorder(30));
lbTitle_ = new JLabel();
@@ -164,7 +151,6 @@
add(pn, BuBorderLayout.SOUTH);
srcChanged();
}
-
JLabel lbTitle_;
private void buildConfigure() {
@@ -268,16 +254,18 @@
protected ComponentListener getListener() {
if (listener_ == null) {
listener_ = new ComponentListener() {
+ public void componentHidden(final ComponentEvent _e) {
+ }
- public void componentHidden(final ComponentEvent _e) {}
+ public void componentMoved(final ComponentEvent _e) {
+ }
- public void componentMoved(final ComponentEvent _e) {}
-
public void componentResized(final ComponentEvent _e) {
updateSizeLabel();
}
- public void componentShown(final ComponentEvent _e) {}
+ public void componentShown(final ComponentEvent _e) {
+ }
};
}
return listener_;
@@ -293,7 +281,7 @@
protected void majInfo() {
final StringBuffer bf = new StringBuffer(CtuluLibString.ESPACE).append(EbliLib.getS("pas:")).append(
- task_.getNbDisplayedAnimStep());
+ task_.getNbDisplayedAnimStep());
if (outs_ != null) {
for (int i = 0; i < outs_.length; i++) {
if (outs_[i].isActivated() && outs_[i].isValid(false) == null) {
@@ -307,7 +295,7 @@
}
protected void majTimeStep() {
- if (task_.getSrc().getNbTimeStep()==0) {
+ if (task_.getSrc().getNbTimeStep() == 0) {
bar_.setToolTipText("");
return;
}
@@ -356,9 +344,9 @@
((TimeCbModel) cbLast_.getModel()).updateSelectIdx();
}
if (maxStep > 0) {
- if ((partialTs_ !=null && !partialTs_.isSelected()) ||
- (task_.getLastIdx() > maxStep) || (task_.getLastIdx() < 0) ||
- (task_.getFirstIdx() > maxStep) || (task_.getFirstIdx() < 0)) {
+ if ((partialTs_ != null && !partialTs_.isSelected())
+ || (task_.getLastIdx() > maxStep) || (task_.getLastIdx() < 0)
+ || (task_.getFirstIdx() > maxStep) || (task_.getFirstIdx() < 0)) {
cbFirst_.setSelectedIndex(0);
cbLast_.setSelectedIndex(maxStep - 1);
txtInc_.setText(CtuluLibString.UN);
@@ -448,7 +436,9 @@
parent.pack();
} else {
final Window winParent = (Window) SwingUtilities.getAncestorOfClass(Window.class, pn_);
- if (winParent != null) winParent.pack();
+ if (winParent != null) {
+ winParent.pack();
+ }
}
}
@@ -546,7 +536,6 @@
protected class TimeCbModel extends AbstractListModel implements ComboBoxModel {
transient int idx_ = -1;
-
transient Object select_;
public Object getElementAt(final int _index) {
@@ -581,8 +570,8 @@
*/
public void updateSelectIdx() {
if (idx_ >= 0) {
- Object old=select_;
- select_=null;
+ Object old = select_;
+ select_ = null;
setSelectedItem(old);
}
}
@@ -595,23 +584,14 @@
public final static int getTimeForAnim(final int _i) {
return getOffset() + 500 * _i;
}
-
// JDialog d_;
-
boolean mustUpdateAfterPlay_;
-
EbliAnimationSourceInterface newSrc_;
-
EbliAnimationOutputInterface[] outs_;
-
LauncherPanel pn_;
-
TimerTask swingTimer_;
-
EbliAnimationTask task_;
-
Timer timerContainer_;
-
/**
* Composant optionel ajouter par l'utilisateur
*/
@@ -638,16 +618,17 @@
private void createTimer() {
if (swingTimer_ == null) {
final Runnable r = new Runnable() {
-
public void run() {
- if (task_.isFinished_) { return; }
- if (isPaused()) { return; }
+ if (task_.isFinished_) {
+ return;
+ }
+ if (isPaused()) {
+ return;
+ }
task_.doAnim();
}
-
};
swingTimer_ = new TimerTask() {
-
public void run() {
try {
EventQueue.invokeAndWait(r);
@@ -659,20 +640,18 @@
}
}
-
};
}
}
// TrIsoModel m_;
// SwingRepainter repainter_;
-
private void updateTitle() {
if (pn_ != null) {
pn_.lbTitle_
- .setText(EbliLib.getS("animation")
+ .setText(EbliLib.getS("animation")
+ (task_.getSrc() == null ? CtuluLibString.EMPTY_STRING : (CtuluLibString.ESPACE + task_.getSrc()
- .getTitle())));
+ .getTitle())));
}
}
@@ -694,7 +673,7 @@
}
protected void animPause() {
- // if (!isPaused() && !task_.isFinished_) swingTimer_.start();
+ // if (!isPaused() && !task_.isFinished_) swingTimer_.start();
}
protected void animStart() {
@@ -761,13 +740,15 @@
timerContainer_.schedule(swingTimer_, 0, pn_.getVitesse());
// createTimer();
} /*
- * else swingTimer_ = null;
- */
+ * else swingTimer_ = null;
+ */
}
public void active() {
- if (task_.getSrc() == null) { return; }
+ if (task_.getSrc() == null) {
+ return;
+ }
getPanel();
}
@@ -781,7 +762,9 @@
}
public JToggleButton getConfigureBt() {
- if (pn_ != null) { return pn_.configure_; }
+ if (pn_ != null) {
+ return pn_.configure_;
+ }
return null;
}
@@ -838,5 +821,4 @@
updateTitle();
return pn_;
}
-
}
Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt
===================================================================
--- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2012-11-28 18:51:46 UTC (rev 8085)
@@ -2,9 +2,14 @@
Bloqu\xE9=Blocked
Fl\xE8che=Arrow
Editer la l\xE9gende=Edit legend
+Choisir les sources=Choose views
+Impression=Print
Editer le calque=Edit view
Afficher le temps=Display time informations
Nuage de points=Scatter plot
+Plein=Filled
+Contour=Outline
+Invers\xE9=Opposite
Rejouer=Recompute
Aucune courbe s\xE9lectionn\xE9e=No selected curves
Afficher le titre=Display the title
@@ -152,7 +157,6 @@
Configurer=Configure
Conserver le ratio hauteur/largeur=Preserve width/height ratio
Continuer la saisie apr\xE8s un zoom ou un d\xE9placement de vue=Continue typing after zooming or moving on view
-Contour=Contour
Coord=Coord
Coordonn\xE9es=Coordinates
Copie de=Copy of
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2012-11-28 18:51:46 UTC (rev 8085)
@@ -15,13 +15,12 @@
import org.netbeans.api.visual.widget.Widget;
/**
- * Action qui permet de realiser l alignement des composants. ATTTENTION CHOIX DE CONCEPTION: il faut que les EbliNode
- * soit movables (isMovable()== true) pour pouvoir les aligner il faut donc lorss de la creation des nodes remplir les
- * infos dimensions et size comme suit: EbliNodeDefault node = new EbliNodeDefault(); node.setCreator(new
- * EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); node.setPreferedSize(new Dimension(300, 300));
+ * Action qui permet de realiser l alignement des composants. ATTTENTION CHOIX DE CONCEPTION: il faut que les EbliNode soit movables (isMovable()==
+ * true) pour pouvoir les aligner il faut donc lorss de la creation des nodes remplir les infos dimensions et size comme suit: EbliNodeDefault node =
+ * new EbliNodeDefault(); node.setCreator(new EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); node.setPreferedSize(new Dimension(300, 300));
* node.setPreferedLocation(new Point(4, 4)); scene.addNode(node);
- *
- *@author Adrien Hadoux
+ *
+ * @author Adrien Hadoux
*/
@SuppressWarnings("serial")
public abstract class EbliWidgetActionAlign extends EbliWidgetActionFilteredAbstract {
@@ -40,10 +39,10 @@
// determiner
// la position d'un widget: ily a aussi les bounds
int maxY = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y
- + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height;
+ + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height;
for (final Widget widget : _widgetToMove) {
maxY = Math.max(maxY, widget.convertLocalToScene(widget.getBounds()).y
- + widget.convertLocalToScene(widget.getBounds()).height);
+ + widget.convertLocalToScene(widget.getBounds()).height);
}
final List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size());
for (final Widget widget : _widgetToMove) {
@@ -61,14 +60,13 @@
}
return newPoints;
}
-
}
public static class Center extends EbliWidgetActionAlign {
public Center(final EbliScene _scene) {
super(_scene, EbliResource.EBLI.getString("Centrer horizontalement"), EbliResource.EBLI.getToolIcon("aocenterv"),
- "CENTERV");
+ "CENTERV");
}
@Override
@@ -76,36 +74,35 @@
// TODO A terminer pour centrer horizontalement les widgets
// on recupere les coordonnees les plus a gauche
- int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y;
+ int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x;
for (final Widget widget : _widgetToMove) {
- minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).y);
+ minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).x);
}
// on recupere les coordonnees les plus a droite
- int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y
- + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height;
+ int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x
+ + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width;
for (final Widget widget : _widgetToMove) {
- maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).y
- + widget.convertLocalToScene(widget.getBounds()).height);
+ maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x
+ + widget.convertLocalToScene(widget.getBounds()).width);
}
final List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size());
for (final Widget widget : _widgetToMove) {
final Point p = widget.getPreferredLocation();
// toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint
- final int oldY = p.x;
+ final int oldY = p.y;
// p.x se trouve a la moyenne des 2
- p.y = (maxx + minx) / 2;
+ p.x = (maxx + minx) / 2;
widget.getParentWidget().convertSceneToLocal(p);
// maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut.
//
// la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure
- p.y = p.y - widget.getBounds().height / 2 - widget.getBounds().y;
- p.x = oldY;
+ p.x = p.x - widget.getBounds().width / 2 - widget.getBounds().x;
+ p.y = oldY;
newPoints.add(p);
}
return newPoints;
}
-
}
public static class Left extends EbliWidgetActionAlign {
@@ -141,14 +138,13 @@
}
return newPoints;
}
-
}
public static class Middle extends EbliWidgetActionAlign {
public Middle(final EbliScene _scene) {
super(_scene, EbliResource.EBLI.getString("Centrer verticalement"), EbliResource.EBLI.getToolIcon("aocenterh"),
- "CENTERH");
+ "CENTERH");
}
@Override
@@ -156,43 +152,42 @@
// TODO A terminer pour centrer horizontalement les widgets
// on recupere les coordonnees les plus a gauche
- int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x;
+ int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y;
for (final Widget widget : _widgetToMove) {
- minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).x);
+ minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).y);
}
// on recupere les coordonnees les plus a droite
- int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x
- + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width;
+ int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y
+ + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height;
for (final Widget widget : _widgetToMove) {
- maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x
- + widget.convertLocalToScene(widget.getBounds()).width);
+ maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).y
+ + widget.convertLocalToScene(widget.getBounds()).height);
}
final List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size());
for (final Widget widget : _widgetToMove) {
final Point p = widget.getPreferredLocation();
// toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint
- final int oldY = p.y;
+ final int oldY = p.x;
// p.x se trouve a la moyenne des 2
- p.x = (maxx + minx) / 2;
+ p.y = (maxx + minx) / 2;
widget.getParentWidget().convertSceneToLocal(p);
// maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut.
//
// la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure
- p.x = p.x - widget.getBounds().width / 2 - widget.getBounds().x;
- p.y = oldY;
+ p.y = p.y - widget.getBounds().height / 2 - widget.getBounds().y;
+ p.x = oldY;
newPoints.add(p);
}
return newPoints;
}
-
}
public static class Right extends EbliWidgetActionAlign {
public Right(final EbliScene _scene) {
super(_scene, EbliResource.EBLI.getString("Alignement \xE0 droite"), EbliResource.EBLI.getToolIcon("aoright"),
- "RIGHT");
+ "RIGHT");
}
@Override
@@ -203,10 +198,10 @@
// determiner
// la position d'un widget: ily a aussi les bounds
int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x
- + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width;
+ + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width;
for (final Widget widget : _widgetToMove) {
maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x
- + widget.convertLocalToScene(widget.getBounds()).width);
+ + widget.convertLocalToScene(widget.getBounds()).width);
}
final List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size());
for (final Widget widget : _widgetToMove) {
@@ -224,7 +219,6 @@
}
return newPoints;
}
-
}
public static class Top extends EbliWidgetActionAlign {
@@ -260,12 +254,10 @@
}
return newPoints;
}
-
}
-
/**
- *
- */
+ *
+ */
private static final long serialVersionUID = 1L;
public EbliWidgetActionAlign(final EbliScene _scene, final String name, final Icon ic, final String id) {
@@ -313,5 +305,4 @@
* @return les nouvelles positions correspondantes aux points pass\xE9s en parametres
*/
protected abstract List<Point> getNewPositionFor(List<Widget> _widgetToMove);
-
}
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2012-11-28 18:51:46 UTC (rev 8085)
@@ -13,7 +13,7 @@
/**
* Classe qui genere une widget editeur de texte. TODO a enlever
- *
+ *
* @author Adrien Hadoux
*/
@SuppressWarnings("serial")
@@ -29,8 +29,8 @@
// -- creation de la widget et ajout dans la scene --//
final EbliNode nodeText = new EbliNodeDefault();
- nodeText.setTitle("Texte");
- final CtuluHtmlEditorPanel editor = new CtuluHtmlEditorPanel("<html><body><font size=4>"+EbliLib.getS("Texte")+"</font></body></html>");
+ nodeText.setTitle(EbliLib.getS("Texte"));
+ final CtuluHtmlEditorPanel editor = new CtuluHtmlEditorPanel("<html><body><font size=4>" + EbliLib.getS("Texte") + "</font></body></html>");
EbliWidgetCreatorTextEditor creator = new EbliWidgetCreatorTextEditor(editor);
nodeText.setCreator(creator);
@@ -42,5 +42,4 @@
scene_.refresh();
}
-
}
Modified: trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java
===================================================================
--- trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/ebli-visuallibrary/src/main/java/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2012-11-28 18:51:46 UTC (rev 8085)
@@ -30,6 +30,7 @@
import org.fudaa.ebli.commun.EbliActionInterface;
import org.fudaa.ebli.commun.EbliActionSimple;
import org.fudaa.ebli.commun.EbliComponentFactory;
+import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.controle.BSelecteurListComboBox;
import org.fudaa.ebli.courbe.EGActionAfficheOrigineCourbe;
import org.fudaa.ebli.courbe.EGActionReplayDataCourbe;
@@ -149,7 +150,7 @@
// -- nom de la legende --//
EbliNode nodeLegende = new EbliNodeDefault();
- nodeLegende.setTitle("L\xE9gende " + (indiceLegende++));
+ nodeLegende.setTitle(EbliLib.getS("L\xE9gende")+" " + (indiceLegende++));
final EbliWidgetCreatorLegende creator = new EbliWidgetCreatorLegende(widgetGraphe_.getGraphe(), creatorGraphe_);
Modified: trunk/framework/fudaa-common/src/main/resources/org/fudaa/fudaa/ressource/fudaa_en.fr_txt
===================================================================
--- trunk/framework/fudaa-common/src/main/resources/org/fudaa/fudaa/ressource/fudaa_en.fr_txt 2012-11-28 18:42:28 UTC (rev 8084)
+++ trunk/framework/fudaa-common/src/main/resources/org/fudaa/fudaa/ressource/fudaa_en.fr_txt 2012-11-28 18:51:46 UTC (rev 8085)
@@ -1,4 +1,5 @@
Activer les applications s\xE9lectionn\xE9es=Activate the selected softwares
+Importation graphe=Import graph
A partir d'une date=From a date
Adresse email=Email adress
Affichage=View
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-11 17:30:57
|
Revision: 8113
http://fudaa.svn.sourceforge.net/fudaa/?rev=8113&view=rev
Author: deniger
Date: 2012-12-11 17:30:50 +0000 (Tue, 11 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
Modified: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java 2012-12-11 17:30:28 UTC (rev 8112)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java 2012-12-11 17:30:50 UTC (rev 8113)
@@ -99,6 +99,9 @@
public void writelnToOut() throws IOException {
out_.write(lineSep_);
}
+ public void writeSpace() throws IOException {
+ out_.write(" ");
+ }
/**
* Ecrit la chaine plus un retour chariot.
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-12-11 17:30:28 UTC (rev 8112)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-12-11 17:30:50 UTC (rev 8113)
@@ -24,8 +24,12 @@
import java.awt.geom.Rectangle2D;
import org.fudaa.ctulu.CtuluListSelection;
import org.fudaa.ctulu.CtuluListSelectionInterface;
+import org.fudaa.ctulu.CtuluRange;
+import org.fudaa.ctulu.gis.GISAttributeDouble;
import org.fudaa.ctulu.gis.GISAttributeInterface;
import org.fudaa.ctulu.gis.GISAttributeModel;
+import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface;
+import org.fudaa.ctulu.gis.GISAttributeModelObjectInterface;
import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface;
import org.fudaa.ctulu.gis.GISGeometryFactory;
import org.fudaa.ctulu.gis.GISLib;
@@ -59,6 +63,9 @@
*/
public class ZCalqueGeometry<M extends ZModeleGeometry> extends ZCalqueAffichageDonneesLineAbstract implements ZModelGeometryListener {
+ protected void initTraceForAtomics(TraceIconModel iconeModel, int idxPoly, int idxVertexInPoly) {
+ }
+
/**
* Une enumearion pour le mode de selection
*/
@@ -130,6 +137,28 @@
_ligne.setCouleur(EbliLib.getAlphaColor(_ligne.getCouleur(), alpha_));
}
}
+
+ @Override
+ public boolean getRange(CtuluRange _b) {
+ GISAttributeDouble attributeIsZ = modeleDonnees().getGeomData().getAttributeIsZ();
+ if (attributeIsZ != null) {
+ GISAttributeModel model = modeleDonnees().getGeomData().getModel(attributeIsZ);
+ if (model instanceof GISAttributeModelDoubleInterface) {
+ GISAttributeModelDoubleInterface doubleModel = (GISAttributeModelDoubleInterface) model;
+ _b.expandTo(doubleModel.getMax());
+ _b.expandTo(doubleModel.getMin());
+ } else if (model instanceof GISAttributeModelObjectInterface) {
+ int nb = model.getSize();
+ for (int i = 0; i < nb; i++) {
+ GISAttributeModelDoubleInterface objectValueAt = (GISAttributeModelDoubleInterface) model.getObjectValueAt(i);
+ _b.expandTo(objectValueAt.getMax());
+ _b.expandTo(objectValueAt.getMin());
+ }
+ }
+ return true;
+ }
+ return super.getRange(_b);
+ }
protected void paintSelectionMulti(final Graphics _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran,
final GrBoite _clipReel) {
@@ -697,6 +726,7 @@
continue;
}
// La g\xE9ometrie n'est pas visible
+ //a enlever car deja fait plus haut
if (!isPainted(i, _versEcran)) {
continue;
}
@@ -721,6 +751,9 @@
if (!_clipReel.contientXY(ptDest)) {
continue;
}
+ if (!isRapide()) {
+ initTraceForAtomics(iconeModel, i,j);
+ }
ptDest.autoApplique(versEcran);
icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-12 16:45:57
|
Revision: 8121
http://fudaa.svn.sourceforge.net/fudaa/?rev=8121&view=rev
Author: deniger
Date: 2012-12-12 16:45:45 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluIOResult.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUI.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUIAbstract.java
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalqueAffichage.java
Added Paths:
-----------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluAnalyze.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -25,7 +25,7 @@
/**
* Cette classe sert a transmettre les informations d'une operation de lecture ou d'ecriture. Les informations et les erreurs de l'operation sont
* stockees avec eventuellement leur numero de ligne.
- * @deprecated use CtuluLog.
+ * @deprecated use CtuluLog and LogConverter
* @author deniger
* @version $Id: CtuluAnalyze.java,v 1.12 2007-05-21 10:28:29 deniger Exp $
*/
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluIOResult.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluIOResult.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluIOResult.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -3,7 +3,7 @@
* @modification $Date: 2006-09-19 14:36:54 $
* @license GNU General Public License 2
* @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
-* @mail de...@fu...
+ * @mail de...@fu...
*/
package org.fudaa.ctulu;
@@ -14,13 +14,21 @@
public class CtuluIOResult<T> {
private CtuluLog log;
-
private String exClose_;
-
private T source_;
- public CtuluIOResult() {}
+ public CtuluIOResult() {
+ }
+ public CtuluIOResult(CtuluLog log) {
+ this.log = log;
+ }
+
+ public CtuluIOResult(CtuluLog log, T source_) {
+ this.log = log;
+ this.source_ = source_;
+ }
+
/**
* @return true si exception lors de la fermeture des flux.
*/
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUI.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUI.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUI.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -11,7 +11,7 @@
/**
* Interface utilisateur minimale.
- *
+ *
* @author fred deniger
* @version $Id: CtuluUI.java,v 1.8 2006-10-27 10:22:24 deniger Exp $
*/
@@ -23,6 +23,7 @@
* @param _tempo true si message temporaire: a effacer apres un temps donn\xE9
*/
void error(String _titre, String _msg, boolean _tempo);
+
void error(String _msg);
/**
@@ -36,20 +37,24 @@
/**
* Gere l'analyse d'une commande. En general, affiche un message si erreur fatale.
- *
+ *
* @param _analyze l'analyse a considerer
* @return true si contient une erreur fatale
*/
boolean manageAnalyzeAndIsFatal(CtuluAnalyze _analyze);
+ boolean manageAnalyzeAndIsFatal(CtuluLog _analyze);
+
/**
* Gere les erreurs survenues pour l'operation et renvoie true si erreur fatale.
- *
+ *
* @return true si erreure fatale
* @param _opResult l'operation a considerer
*/
boolean manageErrorOperationAndIsFatal(CtuluIOOperationSynthese _opResult);
+ boolean manageErrorOperationAndIsFatal(CtuluIOResult _opResult);
+
CtuluTaskDelegate createTask(String _name);
/**
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUIAbstract.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUIAbstract.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluUIAbstract.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -24,11 +24,16 @@
protected String warnString_;
protected String questionString_;
- public CtuluUIAbstract() {}
+ public CtuluUIAbstract() {
+ }
public static void showAnalyzeWarnAndInfo(final CtuluAnalyze _analyze, final CtuluUI _ui) {
- if (_analyze == null) { return; }
- if (_analyze.isEmpty()) { return; }
+ if (_analyze == null) {
+ return;
+ }
+ if (_analyze.isEmpty()) {
+ return;
+ }
// _analyze.printResume();
_ui.message(_analyze.getDesc(), _analyze.getResume(), false);
@@ -51,7 +56,9 @@
}
protected String getErrorTitle(final String _init) {
- if (_init != null) { return _init; }
+ if (_init != null) {
+ return _init;
+ }
if (errorString_ == null) {
errorString_ = getDefaultErrorTitle();
}
@@ -59,7 +66,9 @@
}
protected String getInfoTitle(final String _init) {
- if (_init != null) { return _init; }
+ if (_init != null) {
+ return _init;
+ }
if (infoString_ == null) {
infoString_ = getDefaultInfoTitle();
}
@@ -67,7 +76,9 @@
}
protected String getWarnTitle(final String _init) {
- if (_init != null) { return _init; }
+ if (_init != null) {
+ return _init;
+ }
if (warnString_ == null) {
warnString_ = getDefaultWarnTitle();
}
@@ -75,7 +86,9 @@
}
protected String getQuestionTitle(final String _init) {
- if (_init != null) { return _init; }
+ if (_init != null) {
+ return _init;
+ }
if (questionString_ == null) {
questionString_ = getDefaultQuestionTitle();
}
@@ -94,7 +107,9 @@
@Override
public boolean manageAnalyzeAndIsFatal(final CtuluAnalyze _analyze) {
- if (_analyze == null) { return false; }
+ if (_analyze == null) {
+ return false;
+ }
if (_analyze.containsFatalError() || _analyze.containsErrors()) {
error(_analyze.getDesc(), _analyze.getResume(), false);
}
@@ -102,9 +117,29 @@
}
@Override
+ public boolean manageAnalyzeAndIsFatal(final CtuluLog _analyze) {
+ if (_analyze == null) {
+ return false;
+ }
+ if (_analyze.containsErrorOrSevereError()) {
+ error(_analyze.getDesc(), _analyze.getResume(), false);
+ }
+ return _analyze.containsSevereError();
+ }
+
+ @Override
public boolean manageErrorOperationAndIsFatal(final CtuluIOOperationSynthese _opResult) {
- if (_opResult == null) { return false; }
+ if (_opResult == null) {
+ return false;
+ }
return manageAnalyzeAndIsFatal(_opResult.getAnalyze());
}
+ @Override
+ public boolean manageErrorOperationAndIsFatal(final CtuluIOResult _opResult) {
+ if (_opResult == null) {
+ return false;
+ }
+ return manageAnalyzeAndIsFatal(_opResult.getAnalyze());
+ }
}
Added: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java (rev 0)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -0,0 +1,67 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu;
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class LogConverter {
+
+ public static CtuluLogLevel getLevel(Level level) {
+ if (CtuluAnalyze.FATAL == level) {
+ return CtuluLogLevel.FATAL;
+ }
+ if (CtuluAnalyze.ERROR == level) {
+ return CtuluLogLevel.ERROR;
+ }
+ if (Level.SEVERE == level) {
+ return CtuluLogLevel.SEVERE;
+ }
+ if (Level.INFO == level || Level.FINE == level || Level.FINER == level || Level.FINEST == level || Level.FINE == level) {
+ return CtuluLogLevel.INFO;
+ }
+ if (Level.WARNING == level) {
+ return CtuluLogLevel.WARNING;
+ }
+ return CtuluLogLevel.ERROR;
+
+
+ }
+
+ public static CtuluLogRecord convert(LogRecord record) {
+ CtuluLogRecord res = new CtuluLogRecord(getLevel(record.getLevel()), record.getMessage());
+ res.setArgs(record.getParameters());
+ res.setThrown(record.getThrown());
+ return res;
+ }
+
+ public static CtuluLog convert(CtuluAnalyze in) {
+ CtuluLog res = new CtuluLog(in.getDefaultResourceBundle());
+ res.setDesc(in.getDesc());
+ for (LogRecord logRecord : in.getRecords()) {
+ res.addRecord(convert(logRecord));
+ }
+ return res;
+ }
+
+ public static CtuluLogGroup convert(CtuluAnalyzeGroup in) {
+ CtuluLogGroup res = new CtuluLogGroup(in.defaultResource);
+ res.setDescription(in.getMainDesc());
+ List<CtuluAnalyze> analyser = in.getAnalyser();
+ for (CtuluAnalyze ctuluAnalyze : analyser) {
+ res.addLog(convert(ctuluAnalyze));
+ }
+ List<CtuluAnalyzeGroup> groups = in.getGroups();
+ for (CtuluAnalyzeGroup group : groups) {
+ res.addGroup(convert(group));
+
+ }
+ return res;
+ }
+}
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -15,7 +15,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
-import java.util.logging.LogRecord;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
@@ -30,12 +29,16 @@
import javax.swing.tree.DefaultTreeCellRenderer;
import org.fudaa.ctulu.CtuluAnalyze;
import org.fudaa.ctulu.CtuluAnalyzeGroup;
-import org.fudaa.ctulu.CtuluDefaultLogFormatter;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibImage;
import org.fudaa.ctulu.CtuluLibString;
+import org.fudaa.ctulu.CtuluLog;
+import org.fudaa.ctulu.CtuluLogGroup;
+import org.fudaa.ctulu.CtuluLogLevel;
+import org.fudaa.ctulu.CtuluLogRecord;
import org.fudaa.ctulu.CtuluResource;
import org.fudaa.ctulu.CtuluUI;
+import org.fudaa.ctulu.LogConverter;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.JXTreeTable;
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
@@ -45,7 +48,7 @@
/**
* Affiche la dialog avec le resultata du ctuluAnalyse.
- *
+ *
* @param ui
* @param title
*/
@@ -53,48 +56,48 @@
showDialogErrorFiltre(errors, ui, title, false);
}
- private static void addLines(final CtuluAnalyze message, final DefaultMutableTreeTableNode rootFic, final boolean onlyError) {
- final List<LogRecord> all = new ArrayList<LogRecord>();
- final List<LogRecord> warn = new ArrayList<LogRecord>();
- final List<LogRecord> info = new ArrayList<LogRecord>();
- for (final LogRecord log : message.getRecords()) {
- if (log.getLevel() == Level.SEVERE||log.getLevel()==CtuluAnalyze.FATAL) {
+ private static void addLines(final CtuluLog message, final DefaultMutableTreeTableNode rootFic, final boolean onlyError) {
+ final List<CtuluLogRecord> all = new ArrayList<CtuluLogRecord>();
+ final List<CtuluLogRecord> warn = new ArrayList<CtuluLogRecord>();
+ final List<CtuluLogRecord> info = new ArrayList<CtuluLogRecord>();
+ for (final CtuluLogRecord log : message.getRecords()) {
+ if (log.getLevel() == CtuluLogLevel.SEVERE || log.getLevel() == CtuluLogLevel.FATAL || log.getLevel() == CtuluLogLevel.ERROR) {
all.add(log);
} else if (!onlyError) {
- if (log.getLevel() == Level.WARNING) {
+ if (log.getLevel() == CtuluLogLevel.WARNING) {
warn.add(log);
- } else if (log.getLevel() == Level.INFO) {
+ } else if (log.getLevel() == CtuluLogLevel.INFO) {
info.add(log);
}
}
}
all.addAll(warn);
all.addAll(info);
- for (final LogRecord log : all) {
+ for (final CtuluLogRecord log : all) {
if (log != null) {
- rootFic.add(new MessageTreeTableNode(CtuluDefaultLogFormatter.DEFAULT.format(log), log.getLevel()));
+ rootFic.add(new MessageTreeTableNode(log.getLocalizedMessage(), log.getLevel()));
}
}
}
- private static DefaultMutableTreeTableNode constructArborescence(final CtuluAnalyzeGroup listemessage, final DefaultMutableTreeTableNode parent,
- final boolean onlyError) {
- final DefaultMutableTreeTableNode root = parent == null ? new MessageTreeTableNode("root", "") : parent;
+ private static DefaultMutableTreeTableNode constructArborescence(final CtuluLogGroup listemessage, final DefaultMutableTreeTableNode parent,
+ final boolean onlyError) {
+ final DefaultMutableTreeTableNode root = parent == null ? new MessageTreeTableNode(listemessage.getDesci18n(), "") : parent;
- for (final CtuluAnalyze message : listemessage.getAnalyser()) {
+ for (final CtuluLog message : listemessage.getLogs()) {
if (onlyError && !message.containsErrors()) {
continue;
}
- final DefaultMutableTreeTableNode rootFic = listemessage.getMainAnalyze() == message ? root : new MessageTreeTableNode(message.getDesci18n(),
- "");
+ final DefaultMutableTreeTableNode rootFic = new MessageTreeTableNode(message.getDesci18n(),
+ "");
if (root != rootFic) {
root.add(rootFic);
}
addLines(message, rootFic, onlyError);
}
- for (final CtuluAnalyzeGroup err : listemessage.getGroups()) {
- final MessageTreeTableNode rootFic = new MessageTreeTableNode(err.getMainDesc(), "");
+ for (final CtuluLogGroup err : listemessage.getGroups()) {
+ final MessageTreeTableNode rootFic = new MessageTreeTableNode(err.getDesci18n(), "");
rootFic.setGroup(true);
root.add(rootFic);
constructArborescence(err, rootFic, onlyError);
@@ -105,7 +108,6 @@
protected static void loadTablePreferencesLater(final JXTable table) {
EventQueue.invokeLater(new Runnable() {
-
@Override
public void run() {
UserPreferencesSaver.loadTablePreferences(table);
@@ -119,11 +121,23 @@
showDialogErrorFiltre(gr, ui, title, onlyError);
}
+ public static void showDialogErrorFiltre(final CtuluLog errors, final CtuluUI ui, final String title, final boolean onlyError) {
+ CtuluLogGroup gr = new CtuluLogGroup(null);
+ gr.addLog(errors);
+ showDialogErrorFiltre(gr, ui, title, onlyError);
+ }
+
@SuppressWarnings("serial")
public static void showDialogErrorFiltre(final CtuluAnalyzeGroup errors, final CtuluUI ui, final String title, final boolean onlyError) {
+ showDialogErrorFiltre(LogConverter.convert(errors), ui, title, onlyError);
+ }
+
+ @SuppressWarnings("serial")
+ public static void showDialogErrorFiltre(final CtuluLogGroup errors, final CtuluUI ui, final String title, final boolean onlyError) {
if (!errors.containsSomething() && ui != null) {
return;
}
+ boolean containsError = errors.containsError();
final DefaultTreeTableModel modeleJX = new DefaultTreeTableModel(constructArborescence(errors, null, onlyError));
final List<String> colonnes = new ArrayList<String>();
colonnes.add(CtuluResource.CTULU.getString("Message"));
@@ -134,7 +148,6 @@
final JXTreeTable table = new JXTreeTable(modeleJX);
PopupMenuReceiver.installDefault(table, ui);
table.setTreeCellRenderer(new DefaultTreeCellRenderer() {
-
Icon err = CtuluLibImage.resize(UIManager.getIcon("OptionPane.errorIcon"), 16, 16);
Icon warn = CtuluLibImage.resize(UIManager.getIcon("OptionPane.warningIcon"), 16, 16);
Icon info = CtuluLibImage.resize(UIManager.getIcon("OptionPane.informationIcon"), 16, 16);
@@ -142,14 +155,14 @@
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded,
- final boolean leaf, final int row, final boolean hasFocus) {
+ final boolean leaf, final int row, final boolean hasFocus) {
final MessageTreeTableNode node = (MessageTreeTableNode) value;
final Component res = super.getTreeCellRendererComponent(tree, node.getValueAt(0), sel, expanded, leaf, row, hasFocus);
- if (node.level == Level.SEVERE) {
+ if (node.level == CtuluLogLevel.SEVERE || node.level == CtuluLogLevel.FATAL || node.level == CtuluLogLevel.ERROR) {
setIcon(err);
- } else if (node.level == Level.WARNING) {
+ } else if (node.level == CtuluLogLevel.WARNING) {
setIcon(warn);
- } else if (node.level == Level.INFO) {
+ } else if (node.level == CtuluLogLevel.INFO) {
setIcon(info);
}
if (node.isGroup()) {
@@ -164,7 +177,6 @@
return res;
}
-
});
table.setSortable(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
@@ -194,15 +206,12 @@
table.expandAll();
btContinue.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
-
});
cbOnlyError.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(final ActionEvent e) {
UserPreferencesSaver.saveTablePreferences(table);
@@ -214,7 +223,7 @@
});
JPanel pnNorth = new JPanel(new BuBorderLayout());
- boolean containsError = errors.containsError();
+
JLabel lb = new JLabel(CtuluResource.CTULU.getString(containsError ? "Erreurs rencontr\xE9es" : "Pas d'erreur"));
lb.setForeground(containsError ? Color.RED : Color.GREEN.darker());
pnNorth.add(cbOnlyError, BorderLayout.EAST);
@@ -238,7 +247,8 @@
}
private static class MessageTreeTableNode extends DefaultMutableTreeTableNode {
- private final Level level;
+
+ private final CtuluLogLevel level;
private final String replacer;
boolean group;
@@ -258,6 +268,12 @@
public MessageTreeTableNode(final String msg, final Level level) {
super(msg);
+ this.level = LogConverter.getLevel(level);
+ replacer = CtuluLibString.EMPTY_STRING;
+ }
+
+ public MessageTreeTableNode(final String msg, final CtuluLogLevel level) {
+ super(msg);
this.level = level;
replacer = CtuluLibString.EMPTY_STRING;
}
@@ -281,10 +297,10 @@
if (level == null) {
return replacer;
}
- if (level == Level.SEVERE) {
+ if (level == CtuluLogLevel.SEVERE || level == CtuluLogLevel.FATAL || level == CtuluLogLevel.ERROR) {
return CtuluLib.getS("Erreur");
}
- if (level == Level.WARNING) {
+ if (level == CtuluLogLevel.WARNING) {
return CtuluLib.getS("Avertissement");
}
return CtuluLib.getS("Information");
@@ -294,7 +310,5 @@
public boolean isEditable(final int column) {
return false;
}
-
}
-
}
Modified: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/FileOpWriterCharSimpleAbstract.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -99,6 +99,18 @@
public void writelnToOut() throws IOException {
out_.write(lineSep_);
}
+ public void writeInt(int i) throws IOException {
+ out_.write(Integer.toString(i));
+ }
+ public void writeString(String str) throws IOException {
+ out_.write(str);
+ }
+ public void writeDouble(double d) throws IOException {
+ out_.write(Double.toString(d));
+ }
+
+
+
public void writeSpace() throws IOException {
out_.write(" ");
}
Modified: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -41,9 +41,11 @@
*/
public TestIO(String _fic) {
eps_ = 1E-15;
- fic_ = getFile(_fic);
- assertNotNull(fic_);
- assertTrue(fic_.exists());
+ if (_fic != null) {
+ fic_ = getFile(_fic);
+ assertNotNull(fic_);
+ assertTrue(fic_.exists());
+ }
}
/**
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-12-12 16:41:48 UTC (rev 8120)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-12-12 16:45:45 UTC (rev 8121)
@@ -1,6 +1,9 @@
/**
- * @creation 15 sept. 2003 @modification $Date$ @license GNU General Public
- * License 2 @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne @mail de...@fu...
+ * @creation 15 sept. 2003
+ * @modification $Date$
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @mail de...@fu...
*/
package org.fudaa.ebli.calque;
@@ -53,7 +56,7 @@
public static final String LAYER_REMOVED = "removed";
private static final Object[] PROP_TO_LISTEN = CtuluLibArray.sort(
new String[]{"foreground", "visible", "attenue",
- "rapide", "ajustement", "paletteCouleur", "iconeChanged", "title", "nodeEdit", "alpha", "model"});
+ "rapide", "ajustement", "paletteCouleur", "iconeChanged", "title", "nodeEdit", "alpha", "model"});
private static String getActLast() {
return "DERNIER";
@@ -95,19 +98,19 @@
mustListen_ = _listener;
calque_ = _calque;
if ((calque_ != null) && (calque_.isGroupeCalque())) {
- addGroupeCalque((BGroupeCalque) calque_);
+ addGroupeCalque( calque_);
}
refresh();
}
- private void addGroupeCalque(final BGroupeCalque _g) {
+ private void addGroupeCalque(final BCalque _g) {
if (mustListen_) {
_g.addContainerListener(this);
_g.addPropertyChangeListener(this);
for (int i = _g.getComponentCount() - 1; i >= 0; i--) {
final BCalque c = (BCalque) _g.getComponent(i);
if (c.isGroupeCalque()) {
- addGroupeCalque((BGroupeCalque) c);
+ addGroupeCalque(c);
} else {
c.addPropertyChangeListener(this);
}
@@ -147,13 +150,13 @@
}
}
- private void removeGroupeCalque(final BGroupeCalque _g) {
+ private void removeGroupeCalque(final BCalque _g) {
if (mustListen_) {
_g.removeContainerListener(this);
for (int i = _g.getComponentCount() - 1; i >= 0; i--) {
final BCalque c = (BCalque) _g.getComponent(i);
if (c.isGroupeCalque()) {
- removeGroupeCalque((BGroupeCalque) c);
+ removeGroupeCalque( c);
} else {
c.removePropertyChangeListener(this);
}
@@ -259,6 +262,7 @@
/**
* Rend les calques s\xE9lectionnables ou non, en controlaant qu'ils puissent l'etre.
+ *
* @param _c Les calques.
* @param _b True : Selectionnables.
*/
@@ -334,7 +338,7 @@
final BCalque c = (BCalque) _e.getChild();
if (mustListen_) {
if (c.isGroupeCalque()) {
- addGroupeCalque((BGroupeCalque) c);
+ addGroupeCalque( c);
} else {
c.addPropertyChangeListener(this);
}
@@ -342,7 +346,7 @@
final int directCalqueIdx = parent.getDirectCalqueIdx(c);
Object[] path = getPath(parent);
fireTreeModelEventAdded(new TreeModelEvent(this, new TreePath(path), new int[]{directCalqueIdx},
- new Object[]{c}));
+ new Object[]{c}));
}
setSelectionCalque(c);
fireObservableChanged(LAYER_ADDED);
@@ -369,7 +373,7 @@
final BCalque c = (BCalque) _e.getChild();
if (mustListen_) {
if (c.isGroupeCalque()) {
- removeGroupeCalque((BGroupeCalque) c);
+ removeGroupeCalque(c);
} else {
c.removePropertyChangeListener(this);
}
@@ -389,12 +393,12 @@
public void fillMenu(final BuMenu _m) {
_m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"),
- true, 0, this);
+ true, 0, this);
_m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, true, 0, this);
_m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", BuResource.BU.getIcon("cacher"), true, 0, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, 0,
- this);
+ this);
_m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon(
"non-selectionnable"), true, 0, this);
_m.addSeparator();
@@ -408,11 +412,11 @@
_m.addMenuItem(EbliResource.EBLI.getString("Actif"), "GELE_NON", null, true, 0, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"),
- true, 0, this);
+ true, 0, this);
_m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, 0, this);
_m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, 0, this);
_m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, 0, this);
+ true, 0, this);
_m.addSeparator();
_m.add(new JMenuItem(actDelete_));
}
@@ -423,13 +427,13 @@
public void fillMenu(final CtuluPopupMenu _m) {
_m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"),
- true, this);
+ true, this);
_m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, true, this);
final JMenuItem it = _m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", null, true, this);
it.setIcon(BuResource.BU.getIcon("cacher"));
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true,
- this);
+ this);
_m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon(
"non-selectionnable"), true, this);
_m.addSeparator();
@@ -443,11 +447,11 @@
_m.addMenuItem(EbliResource.EBLI.getString("Actif"), "GELE_NON", null, true, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"),
- true, this);
+ true, this);
_m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, this);
_m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, this);
_m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, this);
+ true, this);
_m.addSeparator();
_m.add(new JMenuItem(actDelete_));
}
@@ -465,7 +469,7 @@
return;
}
_m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"),
- true, this);
+ true, this);
/*
* if (_c instanceof BCalqueAffichage) { final BCalqueAffichage ca = (BCalqueAffichage) _c;
* _m.addCheckBox(EbliResource.EBLI.getString("Att\xE9nu\xE9"), "ATTENUE", true, ca.isAttenue(), _arbre);
@@ -480,7 +484,7 @@
ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) _c;
if (cq.canSetSelectable()) {
BuCheckBoxMenuItem mi =
- _m.addCheckBox(EbliResource.EBLI.getString("S\xE9lectionnable"), "SELECTABLE", EbliResource.EBLI.getIcon(
+ _m.addCheckBox(EbliResource.EBLI.getString("S\xE9lectionnable"), "SELECTABLE", EbliResource.EBLI.getIcon(
"fleche"), true, cq.isSelectable());
mi.addActionListener(this);
}
@@ -488,15 +492,15 @@
if (_c.isMovable()) {
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"),
- true, this);
+ true, this);
_m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, this);
_m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, this);
_m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, this);
+ true, this);
}...
[truncated message content] |
|
From: <de...@us...> - 2012-12-15 00:36:13
|
Revision: 8142
http://fudaa.svn.sourceforge.net/fudaa/?rev=8142&view=rev
Author: deniger
Date: 2012-12-15 00:36:06 +0000 (Sat, 15 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java
Added Paths:
-----------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/AbstractComparator.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/CoordinateComparator.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/PointComparator.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java 2012-12-15 00:35:42 UTC (rev 8141)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/LogConverter.java 2012-12-15 00:36:06 UTC (rev 8142)
@@ -12,7 +12,7 @@
* @author Frederic Deniger
*/
public class LogConverter {
-
+
public static CtuluLogLevel getLevel(Level level) {
if (CtuluAnalyze.FATAL == level) {
return CtuluLogLevel.FATAL;
@@ -30,17 +30,18 @@
return CtuluLogLevel.WARNING;
}
return CtuluLogLevel.ERROR;
-
-
+
+
}
-
+
public static CtuluLogRecord convert(LogRecord record) {
CtuluLogRecord res = new CtuluLogRecord(getLevel(record.getLevel()), record.getMessage());
+ res.setLocalizedMessage(record.getMessage());
res.setArgs(record.getParameters());
res.setThrown(record.getThrown());
return res;
}
-
+
public static CtuluLog convert(CtuluAnalyze in) {
CtuluLog res = new CtuluLog(in.getDefaultResourceBundle());
res.setDesc(in.getDesc());
@@ -49,7 +50,7 @@
}
return res;
}
-
+
public static CtuluLogGroup convert(CtuluAnalyzeGroup in) {
CtuluLogGroup res = new CtuluLogGroup(in.defaultResource);
res.setDescription(in.getMainDesc());
@@ -60,7 +61,7 @@
List<CtuluAnalyzeGroup> groups = in.getGroups();
for (CtuluAnalyzeGroup group : groups) {
res.addGroup(convert(group));
-
+
}
return res;
}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/AbstractComparator.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/AbstractComparator.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/AbstractComparator.java 2012-12-15 00:36:06 UTC (rev 8142)
@@ -0,0 +1,45 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.comparator;
+
+import com.vividsolutions.jts.geom.Point;
+import java.util.Comparator;
+import org.fudaa.ctulu.gis.CtuluLibGeometrie;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class AbstractComparator {
+
+ private double eps = 1e-3;
+
+ public AbstractComparator() {
+ }
+
+ public AbstractComparator(double eps) {
+ this.eps = eps;
+ }
+
+ public int compare(double x1, double y1, double x2, double y2) {
+ double distance = CtuluLibGeometrie.getDistance(x1, y1, x2, y2);
+ if (distance < eps) {
+ return 0;
+ }
+ if (x1 > x2) {
+ return 1;
+ }
+ if (x1 < x2) {
+ return -1;
+ }
+ if (y1 > y2) {
+ return 1;
+ }
+ if (y1 < y2) {
+ return -1;
+ }
+
+ return 0;
+ }
+}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/CoordinateComparator.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/CoordinateComparator.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/CoordinateComparator.java 2012-12-15 00:36:06 UTC (rev 8142)
@@ -0,0 +1,41 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.comparator;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import java.util.Comparator;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class CoordinateComparator extends AbstractComparator implements Comparator<Coordinate> {
+
+ /**
+ * comparaison par defaut a 1e-3
+ */
+ public CoordinateComparator() {
+ }
+
+ /**
+ * @param eps le eps de comparaison
+ */
+ public CoordinateComparator(double eps) {
+ super(eps);
+ }
+
+ @Override
+ public int compare(Coordinate o1, Coordinate o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ return super.compare(o1.x, o1.y, o2.x, o2.y);
+ }
+}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/PointComparator.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/PointComparator.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/comparator/PointComparator.java 2012-12-15 00:36:06 UTC (rev 8142)
@@ -0,0 +1,41 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.comparator;
+
+import com.vividsolutions.jts.geom.Point;
+import java.util.Comparator;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class PointComparator extends AbstractComparator implements Comparator<Point> {
+
+ /**
+ * comparaison par defaut a 1e-3
+ */
+ public PointComparator() {
+ }
+
+ /**
+ * @param eps le eps de comparaison
+ */
+ public PointComparator(double eps) {
+ super(eps);
+ }
+
+ @Override
+ public int compare(Point o1, Point o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ return super.compare(o1.getX(), o1.getY(), o2.getX(), o2.getY());
+ }
+}
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java 2012-12-15 00:35:42 UTC (rev 8141)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluAnalyzeGUI.java 2012-12-15 00:36:06 UTC (rev 8142)
@@ -55,7 +55,7 @@
public static void showDialog(final CtuluAnalyzeGroup errors, final CtuluUI ui, final String title) {
showDialogErrorFiltre(errors, ui, title, false);
}
-
+
private static void addLines(final CtuluLog message, final DefaultMutableTreeTableNode rootFic, final boolean onlyError) {
final List<CtuluLogRecord> all = new ArrayList<CtuluLogRecord>();
final List<CtuluLogRecord> warn = new ArrayList<CtuluLogRecord>();
@@ -75,16 +75,19 @@
all.addAll(info);
for (final CtuluLogRecord log : all) {
if (log != null) {
+ if (log.getLocalizedMessage() == null) {
+ log.setLocalizedMessage(log.getMsg());
+ }
rootFic.add(new MessageTreeTableNode(log.getLocalizedMessage(), log.getLevel()));
}
-
+
}
}
-
+
private static DefaultMutableTreeTableNode constructArborescence(final CtuluLogGroup listemessage, final DefaultMutableTreeTableNode parent,
final boolean onlyError) {
final DefaultMutableTreeTableNode root = parent == null ? new MessageTreeTableNode(listemessage.getDesci18n(), "") : parent;
-
+
for (final CtuluLog message : listemessage.getLogs()) {
if (onlyError && !message.containsErrors()) {
continue;
@@ -101,11 +104,11 @@
rootFic.setGroup(true);
root.add(rootFic);
constructArborescence(err, rootFic, onlyError);
-
+
}
return root;
}
-
+
protected static void loadTablePreferencesLater(final JXTable table) {
EventQueue.invokeLater(new Runnable() {
@Override
@@ -114,24 +117,24 @@
}
});
}
-
+
public static void showDialogErrorFiltre(final CtuluAnalyze errors, final CtuluUI ui, final String title, final boolean onlyError) {
CtuluAnalyzeGroup gr = new CtuluAnalyzeGroup(null);
gr.addAnalyzer(errors);
showDialogErrorFiltre(gr, ui, title, onlyError);
}
-
+
public static void showDialogErrorFiltre(final CtuluLog errors, final CtuluUI ui, final String title, final boolean onlyError) {
CtuluLogGroup gr = new CtuluLogGroup(null);
gr.addLog(errors);
showDialogErrorFiltre(gr, ui, title, onlyError);
}
-
+
@SuppressWarnings("serial")
public static void showDialogErrorFiltre(final CtuluAnalyzeGroup errors, final CtuluUI ui, final String title, final boolean onlyError) {
showDialogErrorFiltre(LogConverter.convert(errors), ui, title, onlyError);
}
-
+
@SuppressWarnings("serial")
public static void showDialogErrorFiltre(final CtuluLogGroup errors, final CtuluUI ui, final String title, final boolean onlyError) {
if (!errors.containsSomething() && ui != null) {
@@ -142,9 +145,9 @@
final List<String> colonnes = new ArrayList<String>();
colonnes.add(CtuluResource.CTULU.getString("Message"));
colonnes.add(CtuluResource.CTULU.getString("Niveau"));
-
+
modeleJX.setColumnIdentifiers(colonnes);
-
+
final JXTreeTable table = new JXTreeTable(modeleJX);
PopupMenuReceiver.installDefault(table, ui);
table.setTreeCellRenderer(new DefaultTreeCellRenderer() {
@@ -152,7 +155,7 @@
Icon warn = CtuluLibImage.resize(UIManager.getIcon("OptionPane.warningIcon"), 16, 16);
Icon info = CtuluLibImage.resize(UIManager.getIcon("OptionPane.informationIcon"), 16, 16);
Font bdFont;
-
+
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded,
final boolean leaf, final int row, final boolean hasFocus) {
@@ -175,12 +178,12 @@
setFont(tree.getFont());
}
return res;
-
+
}
});
table.setSortable(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
+
table.setEditable(false);
final Frame f;
if (ui != null) {
@@ -194,11 +197,11 @@
final JPanel container = new JPanel(new BorderLayout(2, 10));
container.setBorder(BuBorders.EMPTY2222);
final JScrollPane comp = new JScrollPane(table);
-
+
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
final JCheckBox cbOnlyError = new JCheckBox(CtuluResource.CTULU.getString("Afficher uniquement les erreurs"));
cbOnlyError.setSelected(onlyError);
-
+
container.add(comp, BorderLayout.CENTER);
final JButton btContinue = new JButton(BuResource.BU.getString("Continuer"), BuResource.BU.getIcon("crystal_valider"));
// final JButton btSave= new JButton(CtuluLib.getS("Tout copier dans le presse-papier"), BuResource.BU
@@ -218,12 +221,12 @@
UserPreferencesSaver.saveLocationAndDimension(dialog);
dialog.dispose();
showDialogErrorFiltre(errors, ui, title, cbOnlyError.isSelected());
-
+
}
});
JPanel pnNorth = new JPanel(new BuBorderLayout());
-
-
+
+
JLabel lb = new JLabel(CtuluResource.CTULU.getString(containsError ? "Erreurs rencontr\xE9es" : "Pas d'erreur"));
lb.setForeground(containsError ? Color.RED : Color.GREEN.darker());
pnNorth.add(cbOnlyError, BorderLayout.EAST);
@@ -233,7 +236,7 @@
pnBt.setLayout(new FlowLayout(FlowLayout.CENTER));
pnBt.add(btContinue);
container.add(pnBt, BorderLayout.SOUTH);
-
+
dialog.setContentPane(container);
table.packAll();
dialog.pack();
@@ -243,11 +246,11 @@
dialog.setVisible(true);
UserPreferencesSaver.saveTablePreferences(table);
UserPreferencesSaver.saveLocationAndDimension(dialog);
-
+
}
-
+
private static class MessageTreeTableNode extends DefaultMutableTreeTableNode {
-
+
private final CtuluLogLevel level;
private final String replacer;
boolean group;
@@ -265,30 +268,30 @@
public void setGroup(boolean group) {
this.group = group;
}
-
+
public MessageTreeTableNode(final String msg, final Level level) {
super(msg);
this.level = LogConverter.getLevel(level);
replacer = CtuluLibString.EMPTY_STRING;
}
-
+
public MessageTreeTableNode(final String msg, final CtuluLogLevel level) {
super(msg);
this.level = level;
replacer = CtuluLibString.EMPTY_STRING;
}
-
+
public MessageTreeTableNode(final String msg, final String replace) {
super(msg);
this.level = null;
this.replacer = replace == null ? CtuluLibString.EMPTY_STRING : replace;
}
-
+
@Override
public int getColumnCount() {
return 2;
}
-
+
@Override
public Object getValueAt(final int column) {
if (column == 0) {
@@ -305,7 +308,7 @@
}
return CtuluLib.getS("Information");
}
-
+
@Override
public boolean isEditable(final int column) {
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-19 16:34:02
|
Revision: 8157
http://fudaa.svn.sourceforge.net/fudaa/?rev=8157&view=rev
Author: deniger
Date: 2012-12-19 16:33:55 +0000 (Wed, 19 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableCellEditor.java
trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTextField.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Modified: trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableCellEditor.java
===================================================================
--- trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableCellEditor.java 2012-12-19 16:33:20 UTC (rev 8156)
+++ trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableCellEditor.java 2012-12-19 16:33:55 UTC (rev 8157)
@@ -1,17 +1,17 @@
/**
* @modification $Date: 2006-09-19 14:35:10 $
- * @statut unstable
- * @file BuTableCellEditor.java
- * @version 0.43
- * @author Axel von Arnim
- * @email axe...@eq...
- * @license GNU General Public License 2 (GPL2)
- * @copyright 1998-2005 Guillaume Desnoix
+ * @statut unstable
+ * @file BuTableCellEditor.java
+ * @version 0.43
+ * @author Axel von Arnim
+ * @email axe...@eq...
+ * @license GNU General Public License 2 (GPL2)
+ * @copyright 1998-2005 Guillaume Desnoix
*/
-
package com.memoire.bu;
import java.awt.Component;
+import java.awt.EventQueue;
import java.util.Enumeration;
import java.util.EventObject;
import java.util.Vector;
@@ -22,66 +22,71 @@
import javax.swing.table.TableCellEditor;
/**
- * An editor for table cells, which controls input through
- * input validators like date or integer validators.
+ * An editor for table cells, which controls input through input validators like date or integer validators.
+ *
* @author Axel von Arnim, axe...@eq...
*/
public class BuTableCellEditor
- implements TableCellEditor
-{
- Object oldValue_;
+ implements TableCellEditor {
+
+ Object oldValue_;
BuTextField tf_;
- Vector listeners_;
-
- public BuTableCellEditor(BuTextField _tf)
- {
- if(_tf==null)
- throw new IllegalArgumentException /*System.err.println*/
- ("BuTableCellEditor: param _tf is null in the constructor");
-
- tf_=_tf;
- listeners_=new Vector(1,1);
+ Vector listeners_;
+
+ public BuTableCellEditor(BuTextField _tf) {
+ if (_tf == null) {
+ throw new IllegalArgumentException /*System.err.println*/("BuTableCellEditor: param _tf is null in the constructor");
+ }
+
+ tf_ = _tf;
+ listeners_ = new Vector(1, 1);
}
-
- public Component getTableCellEditorComponent
- (JTable _table, Object _value, boolean _selected, int _row, int _column)
- {
- oldValue_=_value;
+
+ public void setSelectAll(boolean selectAll) {
+ tf_.setSelectAllIsGainFocus(selectAll);
+ }
+
+ public Component getTableCellEditorComponent(JTable _table, Object _value, boolean _selected, int _row, int _column) {
+ oldValue_ = _value;
tf_.setValue(_value);
return tf_;
}
-
- public void addCellEditorListener(CellEditorListener _l)
- {
- if(!listeners_.contains(_l))
+
+ public void addCellEditorListener(CellEditorListener _l) {
+ if (!listeners_.contains(_l)) {
listeners_.addElement(_l);
+ }
}
-
- public void cancelCellEditing()
- {
+
+ public void cancelCellEditing() {
tf_.setValue(oldValue_);
- ChangeEvent evt=new ChangeEvent(this);
- for(Enumeration e=listeners_.elements(); e.hasMoreElements();)
- ((CellEditorListener)e.nextElement()).editingCanceled(evt);
+ ChangeEvent evt = new ChangeEvent(this);
+ for (Enumeration e = listeners_.elements(); e.hasMoreElements();) {
+ ((CellEditorListener) e.nextElement()).editingCanceled(evt);
+ }
}
-
- public Object getCellEditorValue()
- { return tf_.getValue(); }
-
- public boolean isCellEditable(EventObject _evt)
- { return true; }
-
- public void removeCellEditorListener(CellEditorListener _l)
- { listeners_.removeElement(_l); }
-
- public boolean shouldSelectCell(EventObject _evt)
- { return true; }
-
- public boolean stopCellEditing()
- {
- ChangeEvent evt=new ChangeEvent(this);
- for(Enumeration e=listeners_.elements(); e.hasMoreElements();)
- ((CellEditorListener)e.nextElement()).editingStopped(evt);
+
+ public Object getCellEditorValue() {
+ return tf_.getValue();
+ }
+
+ public boolean isCellEditable(EventObject _evt) {
+ return true;
+ }
+
+ public void removeCellEditorListener(CellEditorListener _l) {
+ listeners_.removeElement(_l);
+ }
+
+ public boolean shouldSelectCell(EventObject _evt) {
+ return true;
+ }
+
+ public boolean stopCellEditing() {
+ ChangeEvent evt = new ChangeEvent(this);
+ for (Enumeration e = listeners_.elements(); e.hasMoreElements();) {
+ ((CellEditorListener) e.nextElement()).editingStopped(evt);
+ }
return false;
}
}
Modified: trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTextField.java
===================================================================
--- trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTextField.java 2012-12-19 16:33:20 UTC (rev 8156)
+++ trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTextField.java 2012-12-19 16:33:55 UTC (rev 8157)
@@ -1,12 +1,12 @@
/**
* @modification $Date: 2007-05-04 13:41:58 $
- * @statut unstable
- * @file BuTextField.java
- * @version 0.43
- * @author Guillaume Desnoix
- * @email gui...@de...
- * @license GNU General Public License 2 (GPL2)
- * @copyright 1998-2005 Guillaume Desnoix
+ * @statut unstable
+ * @file BuTextField.java
+ * @version 0.43
+ * @author Guillaume Desnoix
+ * @email gui...@de...
+ * @license GNU General Public License 2 (GPL2)
+ * @copyright 1998-2005 Guillaume Desnoix
*/
package com.memoire.bu;
@@ -36,13 +36,14 @@
* An extended text field which takes validators.
*/
public class BuTextField extends JTextField implements DtDragSensible {
+
private Color textFg_;
private Color errorFg_;
- private Format displayFormat_ ;
+ private Format displayFormat_;
private boolean focusSelection_;
- private String realText_ ;
- private String previousText_ ;
-
+ private String realText_;
+ private String previousText_;
+ private boolean selectAllIsGainFocus;
private BuCharValidator charValidator_;
private BuStringValidator stringValidator_;
private BuValueValidator valueValidator_;
@@ -51,6 +52,10 @@
this(null, -1);
}
+ public void setSelectAllIsGainFocus(boolean selectAllIsGainFocus) {
+ this.selectAllIsGainFocus = selectAllIsGainFocus;
+ }
+
public BuTextField(int _cols) {
this(null, _cols);
}
@@ -65,27 +70,31 @@
// Avoid using the text as a command
setActionCommand("TEXT_CHANGED");
- if (_cols > 0) setColumns(_cols);
+ if (_cols > 0) {
+ setColumns(_cols);
+ }
setText(_text == null ? "" : _text);
errorFg_ = UIManager.getColor("TextField.errorForeground");
- if (errorFg_ == null) errorFg_ = BuLib.getColor(Color.red);
+ if (errorFg_ == null) {
+ errorFg_ = BuLib.getColor(Color.red);
+ }
}
// Property Display Format
-
public Format getDisplayFormat() {
return displayFormat_;
}
public void setDisplayFormat(Format _format) {
- if (_format == null) realText_ = null;
+ if (_format == null) {
+ realText_ = null;
+ }
displayFormat_ = _format;
}
// Property Selection Mode
-
public boolean isFocusSelection() {
return focusSelection_;
}
@@ -95,26 +104,34 @@
}
// Property Text
-
public String getText() {
String r;
- if ((displayFormat_ != null) && !hasFocus()) r = realText_;
- else
+ if ((displayFormat_ != null) && !hasFocus()) {
+ r = realText_;
+ } else {
r = super.getText();
+ }
return r;
}
public void setAcceptEmptyValue() {
- if (valueValidator_ != null) valueValidator_ = new BuValueValidator.EmptyValueValidator(valueValidator_);
- if (stringValidator_ != null) stringValidator_ = BuStringValidator.getEmptyEnable(stringValidator_);
+ if (valueValidator_ != null) {
+ valueValidator_ = new BuValueValidator.EmptyValueValidator(valueValidator_);
+ }
+ if (stringValidator_ != null) {
+ stringValidator_ = BuStringValidator.getEmptyEnable(stringValidator_);
+ }
}
public void setText(String _text) {
boolean ok = true;
String s = _text;
- if (!isStringValid(s)) ok = false;
- else if (!isValueValid(stringToValue(s))) ok = false;
+ if (!isStringValid(s)) {
+ ok = false;
+ } else if (!isValueValid(stringToValue(s))) {
+ ok = false;
+ }
if (ok && !hasFocus()) {
Object v = stringToValue(s);
@@ -127,22 +144,25 @@
}
}
- if (!ok) super.setForeground(errorFg_);
- else
+ if (!ok) {
+ super.setForeground(errorFg_);
+ } else {
super.setForeground(textFg_);
+ }
super.setText(s);
- if (!isEditable()) setCaretPosition(0);
+ if (!isEditable()) {
+ setCaretPosition(0);
+ }
}
// Properties Validators
-
public BuCharValidator getCharValidator() {
return charValidator_;
}
/**
- * Ce validator est sert \xE0 accepter ou non un caract\xE8re saisi. Il est
- * consult\xE9 \xE0 chaque caract\xE8re saisi.
+ * Ce validator est sert \xE0 accepter ou non un caract\xE8re saisi. Il est consult\xE9 \xE0 chaque caract\xE8re saisi.
+ *
* @param _validator Le validator.
*/
public void setCharValidator(BuCharValidator _validator) {
@@ -154,8 +174,8 @@
}
/**
- * Ce validator sert \xE0 accepter ou non le format de la chaine saisie.
- * Il est consult\xE9 lors de la perte de focus.
+ * Ce validator sert \xE0 accepter ou non le format de la chaine saisie. Il est consult\xE9 lors de la perte de focus.
+ *
* @param _validator Le validator
*/
public void setStringValidator(BuStringValidator _validator) {
@@ -167,8 +187,8 @@
}
/**
- * Ce validator sert \xE0 accepter la valeur de la chaine saisie. Il peut limiter
- * la plage de valeurs. Il est consult\xE9 lors de la perte de focus.
+ * Ce validator sert \xE0 accepter la valeur de la chaine saisie. Il peut limiter la plage de valeurs. Il est consult\xE9 lors de la perte de focus.
+ *
* @param _validator Le validator
*/
public void setValueValidator(BuValueValidator _validator) {
@@ -176,9 +196,13 @@
}
public void setEditable(boolean _editable) {
- if (_editable == isEditable()) return;
+ if (_editable == isEditable()) {
+ return;
+ }
super.setEditable(_editable);
- if (!isEditable()) setCaretPosition(0);
+ if (!isEditable()) {
+ setCaretPosition(0);
+ }
}
public void setForeground(Color _c) {
@@ -193,16 +217,23 @@
public void replaceSelection(String _s) {
boolean b = true;
- for (int i = 0; i < _s.length(); i++)
+ for (int i = 0; i < _s.length(); i++) {
b &= isCharValid(_s.charAt(i));
+ }
- if (b) super.replaceSelection(_s);
- else
+ if (b) {
+ super.replaceSelection(_s);
+ } else {
getToolkit().beep();
+ }
}
protected void processKeyEvent(KeyEvent _evt) {
- if (_evt.getID() == KeyEvent.KEY_TYPED) if (!isCharValid(_evt.getKeyChar())) return;
+ if (_evt.getID() == KeyEvent.KEY_TYPED) {
+ if (!isCharValid(_evt.getKeyChar())) {
+ return;
+ }
+ }
super.setForeground(textFg_);
super.processKeyEvent(_evt);
@@ -213,10 +244,15 @@
if (_evt.getID() == FocusEvent.FOCUS_LOST) {
String s = super.getText();
- if (!isStringValid(s)) ok = false;
- else if (!isValueValid(stringToValue(s))) ok = false;
+ if (!isStringValid(s)) {
+ ok = false;
+ } else if (!isValueValid(stringToValue(s))) {
+ ok = false;
+ }
- if (displayFormat_ != null) realText_ = s;
+ if (displayFormat_ != null) {
+ realText_ = s;
+ }
if (ok) {
Object v = stringToValue(s);
@@ -228,11 +264,16 @@
s = displayFormat_.format(v);
}
- if (s != null && !s.equals(super.getText())) super.setText(s);
+ if (s != null && !s.equals(super.getText())) {
+ super.setText(s);
+ }
- if (((previousText_ == null) && (s != null)) || ((previousText_ != null) && !previousText_.equals(s))) fireActionPerformed();
- } else
+ if (((previousText_ == null) && (s != null)) || ((previousText_ != null) && !previousText_.equals(s))) {
+ fireActionPerformed();
+ }
+ } else {
getToolkit().beep();
+ }
}
if (_evt.getID() == FocusEvent.FOCUS_GAINED) {
@@ -247,7 +288,9 @@
p = getCaretPosition();
s = valueToString(v);
previousText_ = s;
- if (!s.equals(super.getText())) super.setText(s);
+ if (!s.equals(super.getText())) {
+ super.setText(s);
+ }
}
}
@@ -255,7 +298,9 @@
setSelectionStart(0);
setSelectionEnd(s.length());
} else {
- if (p >= 0) setCaretPosition(Math.max(0, Math.min(p, s.length())));
+ if (p >= 0) {
+ setCaretPosition(Math.max(0, Math.min(p, s.length())));
+ }
}
Container parent = getParent();
@@ -266,11 +311,16 @@
r = getBounds();
((JComponent) parent).scrollRectToVisible(r);
}
+ if(selectAllIsGainFocus){
+ selectAll();
+ }
}
- if (!ok) super.setForeground(errorFg_);
- else
+ if (!ok) {
+ super.setForeground(errorFg_);
+ } else {
super.setForeground(textFg_);
+ }
repaint();
super.processFocusEvent(_evt);
@@ -281,9 +331,12 @@
if ((r != null) && (stringValidator_ != null)) {
if (isStringValid(_string)) {
r = stringValidator_.stringToValue(_string);
- if (!isValueValid(r)) r = null;
- } else
+ if (!isValueValid(r)) {
+ r = null;
+ }
+ } else {
r = null;
+ }
}
return r;
}
@@ -291,32 +344,47 @@
public String valueToString(Object _value) {
String r = null;
- if (isValueValid(_value)) if (stringValidator_ != null) r = stringValidator_.valueToString(_value);
+ if (isValueValid(_value)) {
+ if (stringValidator_ != null) {
+ r = stringValidator_.valueToString(_value);
+ }
+ }
- if (_value == null) r = "";
- else if (r == null) r = "" + _value;
+ if (_value == null) {
+ r = "";
+ } else if (r == null) {
+ r = "" + _value;
+ }
return r;
}
private boolean isCharValid(char _char) {
boolean r = true;
- if (_char == 8) r = true;
- else if (_char == 255) r = false;
- else if (charValidator_ != null) r = charValidator_.isCharValid(_char);
+ if (_char == 8) {
+ r = true;
+ } else if (_char == 255) {
+ r = false;
+ } else if (charValidator_ != null) {
+ r = charValidator_.isCharValid(_char);
+ }
return r;
}
private boolean isStringValid(String _value) {
boolean r = true;
- if (stringValidator_ != null) r = stringValidator_.isStringValid(_value);
+ if (stringValidator_ != null) {
+ r = stringValidator_.isStringValid(_value);
+ }
return r;
}
private boolean isValueValid(Object _value) {
boolean r = true;
- if (valueValidator_ != null) r = valueValidator_.isValueValid(_value);
+ if (valueValidator_ != null) {
+ r = valueValidator_.isValueValid(_value);
+ }
return r;
}
@@ -329,7 +397,6 @@
}
// Anti-aliasing
-
public void paint(Graphics _g) {
BuLib.setAntialiasing(this, _g);
super.paint(_g);
@@ -344,20 +411,20 @@
}
// Drop
-
public void setDropTarget(DropTarget _dt) {
super.setDropTarget(_dt);
if (_dt != null) {
// FuLog.debug("BTF: setDropTarget");
try {
_dt.removeDropTargetListener(DtDragSensible.SINGLETON);
- } catch (IllegalArgumentException ex) {}
+ } catch (IllegalArgumentException ex) {
+ }
try {
_dt.addDropTargetListener(DtDragSensible.SINGLETON);
- } catch (TooManyListenersException ex) {}
+ } catch (TooManyListenersException ex) {
+ }
}
}
-
protected boolean drop_;
protected Rectangle getDropRect() {
@@ -387,7 +454,6 @@
}
// Factory
-
public static BuTextField createIntegerField() {
BuTextField r = new BuTextField();
r.setCharValidator(BuCharValidator.INTEGER);
@@ -469,7 +535,6 @@
}
// Test
-
public static final JComponent launch(String argv[]) {
JComponent content = new JPanel();
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-19 16:33:20 UTC (rev 8156)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-19 16:33:55 UTC (rev 8157)
@@ -14,6 +14,7 @@
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
+import java.awt.event.FocusEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
@@ -35,7 +36,6 @@
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;
@@ -51,36 +51,42 @@
* @version $Id: EGTableGraphePanel.java,v 1.31 2007-06-05 08:58:39 deniger Exp $
*/
public class EGTableGraphePanel extends BuPanel implements EGSelectionListener, EGGrapheModelListener {
-
+
+ public BuTextField createEditorDoubleTextField() {
+ BuTextField r = BuTextField.createDoubleField();
+ r.setSelectAllIsGainFocus(true);
+ return r;
+ }
+
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);
}
-
+
@Override
public Class getColumnClass(final int _columnIndex) {
return Double.class;
}
-
+
@Override
public int getRowCount() {
final EGAxeHorizontal h = getH();
@@ -92,7 +98,7 @@
}
return super.getRowCount();
}
-
+
@Override
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
if (c_ == null) {
@@ -109,7 +115,7 @@
return super.getValueAt(_rowIndex, _columnIndex);
}
boolean updating_;
-
+
@Override
public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) {
if (updating_ || c_ == null || _value == null || _value.toString().trim().length() == 0) {
@@ -117,7 +123,7 @@
}
if (_rowIndex == c_.getModel().getNbValues()) {
try {
-
+
final Double d = CtuluDoubleParser.parseValue(_value.toString());
if (d == null) {
return;
@@ -157,7 +163,7 @@
}
}
}
-
+
private static Action getEnterAction() {
return new AbstractAction() {
@Override
@@ -169,7 +175,7 @@
if (t.isEditing()) {
t.getCellEditor().stopCellEditing();
}
-
+
if (col == tableModel.yColIndex) {
col = tableModel.xColIndex;
row++;
@@ -184,11 +190,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());
@@ -212,17 +218,17 @@
* @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());
}
-
+
@Override
protected String transformToString(Object value) {
-
+
return super.transformToString(value);
}
@@ -242,20 +248,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();
}
@@ -272,7 +278,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);
@@ -284,7 +290,7 @@
}
model.a_.getCmd().addCmd(cmp.getSimplify());
}
-
+
public void cut() {
// vide on fait rien
if (getSelectionModel().isSelectionEmpty()) {
@@ -301,7 +307,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();
@@ -343,15 +349,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();
@@ -386,7 +392,7 @@
return maxUpdate;
}
private boolean canEdit_;
-
+
@Override
protected boolean processKeyBinding(final KeyStroke _ks, final KeyEvent _e, final int _condition,
final boolean _pressed) {
@@ -396,7 +402,7 @@
if (action != null) {
return SwingUtilities.notifyAction(action, _ks, _e, this,
_e.getModifiers());
-
+
}
}
final int keyCode = _ks.getKeyCode();
@@ -421,7 +427,7 @@
}
return super.processKeyBinding(_ks, _e, _condition, _pressed);
}
-
+
@Override
public boolean editCellAt(final int _row, final int _column) {
if (canEdit_) {
@@ -431,14 +437,10 @@
return false;
}
}
-
+
public CtuluCellTextRenderer getDefaultRenderer() {
return renderer_;
}
-
-
-
-
final CtuluCellTextRenderer renderer_ = new CtuluCellTextRenderer() {
@Override
public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected,
@@ -463,7 +465,7 @@
}
return this;
}
-
+
@Override
protected void setValue(final Object _value) {
if (_value == null) {
@@ -475,16 +477,16 @@
};
EGInteractionSelection selection_;
EvolTable t_;
-
+
public EGTableGraphePanel() {
this(true);
}
-
+
public EvolTable getTable() {
return t_;
}
boolean afficheNomCourbe_ = true;
-
+
public BuLabel getTitleLabel() {
return lb_;
}
@@ -511,16 +513,21 @@
return null;
}
CtuluValueEditorI r = null;
- if (_column == 0 && a_ != null && a_.getTransformer().getXAxe() != null) {
+ SpecTableModel tableModel = (SpecTableModel) t_.getModel();
+ if (_column == tableModel.getXColIndex() && a_ != null && a_.getTransformer().getXAxe() != null) {
r = a_.getTransformer().getXAxe().getValueEditor();
- } else if (_column == 1 && a_ != null && a_.getSelectedComponent() != null) {
+ } else if (_column == tableModel.getYColIndex() && 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;
+ final TableCellEditor finalCellEditor = ed == null ? super.getCellEditor(_row, _column) : ed;
+ if (finalCellEditor instanceof BuTableCellEditor) {
+ ((BuTableCellEditor) finalCellEditor).setSelectAll(true);
+ }
+ return finalCellEditor;
}
-
+
@Override
public TableCellRenderer getDefaultRenderer(final Class _columnClass) {
if (Double.class
@@ -532,7 +539,7 @@
};
t_.setDeleteAction(getActionDelete());
setDefaultEnterAction(t_);
- final BuTextField txt = BuTextField.createDoubleField();
+ final BuTextField txt = createEditorDoubleTextField();
txt.setColumns(10);
t_
.setDefaultEditor(Double.class, new BuTableCellEditor(txt) {
@@ -544,7 +551,7 @@
return true;
}
});
-
+
t_.setModel(createValuesTableModel());
t_.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
t_.setCellSelectionEnabled(true);
@@ -562,11 +569,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();
@@ -589,7 +596,7 @@
}
}
}
-
+
void updateButtons() {
final EGCourbe c = a_.getSelectedComponent();
if (btAdd_ != null) {
@@ -619,7 +626,7 @@
}
}
}
-
+
private void updateDatas(final EGCourbe _c) {
if (t_.getCellEditor() != null) {
t_.getCellEditor().cancelCellEditing();
@@ -631,7 +638,7 @@
TableColumn column = t_.getColumnModel().getColumn(i);
column.setHeaderValue(getSpecTableModel().getColumnName(i));
}
-
+
if (_c == null) {
lb_.setText(CtuluLibString.ESPACE);
lbCourbeInfo_.setText(CtuluLibString.ESPACE);
@@ -656,60 +663,60 @@
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, getDeleteKeyStroke());
}
-
+
@Override
public void updateStateBeforeShow() {
setEnabled(btRemove_.isEnabled());
}
-
+
@Override
public void actionPerformed(ActionEvent _e) {
btRemove_.doClick();
}
}
-
+
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 ....
@@ -761,51 +768,51 @@
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;
}
-
+
@Override
public void axeAspectChanged(final EGAxe _c) {
}
-
+
@Override
public void axeContentChanged(final EGAxe _c) {
(getSpecTableModel()).fireTableChanged(new TableModelEvent(getSpecTableModel(), 0, getSpecTableModel().getRowCount() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE));
repaint();
}
-
+
public SpecTableModel getSpecTableModel() {
return (SpecTableModel) t_.getModel();
}
-
+
@Override
public void courbeAspectChanged(final EGObject _c, final boolean _visibil) {
}
-
+
@Override
public void courbeContentChanged(final EGObject _c, final boolean _mustRestore) {
eventReceived();
}
-
+
public void intervalAdded(final ListDataEvent _e) {
}
-
+
public void intervalRemoved(final ListDataEvent _e) {
}
@@ -827,7 +834,7 @@
updateDatas(_a.getSelectedComponent());
eventReceived();
}
-
+
public void updateState() {
updateDatas(a_.getSelectedComp...
[truncated message content] |
|
From: <de...@us...> - 2012-12-20 10:14:58
|
Revision: 8158
http://fudaa.svn.sourceforge.net/fudaa/?rev=8158&view=rev
Author: deniger
Date: 2012-12-20 10:14:50 +0000 (Thu, 20 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java
Added Paths:
-----------
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java 2012-12-19 16:33:55 UTC (rev 8157)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java 2012-12-20 10:14:50 UTC (rev 8158)
@@ -5,13 +5,14 @@
import com.vividsolutions.jts.geom.Coordinate;
import org.fudaa.ctulu.CtuluLibArray;
+import org.fudaa.ctulu.interpolation.SupportLocationI;
/**
* Adapte une collection en un fournisseur de points.
*
* @author Frederic Deniger
*/
-public class GisZoneCollectionAsListPointAdapter {
+public class GisZoneCollectionAsListPointAdapter implements SupportLocationI {
private final GISZoneCollection points;
private final int[] nbPointsBySemis;
@@ -26,7 +27,8 @@
nbPts = CtuluLibArray.getSum(nbPointsBySemis);
}
- public int getNbPoints() {
+ @Override
+ public int getPtsNb() {
return nbPts;
}
@@ -53,11 +55,13 @@
return null;
}
- public double getX(int idxPt) {
+ @Override
+ public double getPtX(int idxPt) {
return getCoordinate(idxPt).x;
}
- public double getY(int idxPt) {
+ @Override
+ public double getPtY(int idxPt) {
return getCoordinate(idxPt).y;
}
}
Copied: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java (from rev 7771, trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaver.java)
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java (rev 0)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java 2012-12-20 10:14:50 UTC (rev 8158)
@@ -0,0 +1,189 @@
+package org.fudaa.dodico.fortran;
+
+import com.memoire.fu.FuEmptyArrays;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.fudaa.ctulu.fileformat.FortranLib;
+import org.fudaa.dodico.fichiers.NativeBinarySystem;
+
+import com.memoire.fu.FuLog;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import org.fudaa.ctulu.CtuluLibArray;
+import org.fudaa.ctulu.CtuluLibFile;
+
+/**
+ * Permet d'\xE9crire facilement des tableaux d'entier, bool\xE9ens dans un fichier binaire.
+ * @author Frederic Deniger
+ */
+public class DodicoIntegerArrayBinaryFileSaver {
+
+ public DodicoIntegerArrayBinaryFileSaver() {
+ }
+
+ public boolean saveSimpleArray(File file, int[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
+ }
+
+ public boolean saveSimpleArray(OutputStream file, int[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
+ }
+
+ public int[] loadSimpleArray(File file) {
+ int[][] res = load(file);
+ return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
+ }
+
+ public int[] loadSimpleArray(InputStream file) {
+ int[][] res = load(file);
+ return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
+ }
+
+ private static int[] toInt(boolean[] in) {
+ if (in == null) {
+ return FuEmptyArrays.INT0;
+ }
+ int[] out = new int[in.length];
+ for (int i = 0; i < out.length; i++) {
+ out[i] = in[i] ? 1 : 0;
+ }
+ return out;
+ }
+
+ private static boolean[] toBoolean(int[][] in) {
+ if (in == null || in.length == 0 || in[0].length == 0) {
+ return FuEmptyArrays.BOOLEAN0;
+ }
+ final int[] values = in[0];
+ boolean[] out = new boolean[values.length];
+ for (int i = 0; i < out.length; i++) {
+ out[i] = values[i] == 1 ? true : false;
+ }
+ return out;
+ }
+
+ public boolean saveBoolean(File file, boolean[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = toInt(in);
+ return save(file, toSave);
+ }
+
+ public boolean saveBoolean(OutputStream file, boolean[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = toInt(in);
+ return save(file, toSave);
+ }
+
+ public boolean[] loadBoolean(File file) {
+ int[][] res = load(file);
+ return toBoolean(res);
+ }
+
+ public boolean[] loadBoolean(InputStream file) {
+ int[][] res = load(file);
+ return toBoolean(res);
+ }
+
+ public int[][] load(File file) {
+ FileInputStream input = null;
+ int[][] res = null;
+ try {
+ input = new FileInputStream(file);
+ res = load(input);
+ } catch (Exception e) {
+ FuLog.error(e);
+ } finally {
+ CtuluLibFile.close(input);
+ }
+ return res == null ? new int[0][0] : res;
+ }
+
+ public int[][] load(InputStream in) {
+ FortranBinaryInputStream input = null;
+ if (in == null) {
+ return new int[0][0];
+ }
+ boolean ok = true;
+ int[][] mapOfValues = null;
+ try {
+ try {
+ input = new FortranBinaryInputStream(in, true, NativeBinarySystem.X86);
+ input.readRecord();
+ int nbValues = input.readInteger();
+ if (nbValues >= 0) {
+ mapOfValues = new int[nbValues][];
+ for (int i = 0; i < nbValues; i++) {
+ input.readRecord();
+ int nbItem = input.readInteger();
+ if (nbItem < 0) {
+ ok = false;
+ break;
+ }
+ mapOfValues[i] = new int[nbItem];
+ for (int j = 0; j < nbItem; j++) {
+ mapOfValues[i][j] = input.readInteger();
+ }
+ }
+ } else {
+ ok = false;
+ }
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+ if (ok) {
+ return mapOfValues;
+ }
+ return new int[0][0];
+ }
+
+ public boolean save(File file, int[][] mapOfValues) {
+ boolean ok = false;
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(file);
+ ok = save(out, mapOfValues);
+ } catch (Exception exception) {
+ ok = false;
+ FuLog.error(exception);
+ } finally {
+ CtuluLibFile.close(out);
+ }
+ return ok;
+ }
+
+ public boolean save(OutputStream out, int[][] mapOfValues) {
+ FortranBinaryOutputStream output = null;
+ boolean ok = true;
+ try {
+ output = new FortranBinaryOutputStream(out, true, NativeBinarySystem.X86);
+ int nbValues = mapOfValues.length;
+ output.writeInteger(nbValues);
+ output.writeRecord();
+ for (int i = 0; i < nbValues; i++) {
+ int[] values = mapOfValues[i];
+ output.writeInteger(values.length);
+ for (int j = 0; j < values.length; j++) {
+ output.writeInteger(values[j]);
+ }
+ output.writeRecord();
+ }
+ } catch (Exception e) {
+ ok = false;
+ FuLog.error(e);
+ } finally {
+ FortranLib.close(output);
+ }
+ return ok;
+
+ }
+}
Added: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java (rev 0)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2012-12-20 10:14:50 UTC (rev 8158)
@@ -0,0 +1,70 @@
+/*
+ GPL 2
+ */
+package org.fudaa.dodico.fortran;
+
+import java.io.File;
+import org.fudaa.dodico.common.TestIO;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class DodicoIntegerArrayBinaryFileSaverTest extends TestIO {
+
+ public DodicoIntegerArrayBinaryFileSaverTest() {
+ super(null);
+ }
+
+ public void testReadWriteIntArrayArray() {
+ int[][] values = new int[10][];
+ int k = 5;
+ for (int i = 0; i < values.length; i++) {
+ values[i] = new int[k++];
+ for (int j = 0; j < values[i].length; j++) {
+ values[i][j] = i * j;
+ }
+ }
+ File tempFile = createTempFile();
+ DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ saver.save(tempFile, values);
+ int[][] load = saver.load(tempFile);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i].length, load[i].length);
+ for (int j = 0; j < values[i].length; j++) {
+ assertEquals(values[i][j], load[i][j]);
+ }
+ }
+ }
+
+ public void testReadWriteIntArray() {
+ int[] values = new int[10];
+ for (int i = 0; i < values.length; i++) {
+ values[i] = i * 2;
+ }
+ File tempFile = createTempFile();
+ DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ saver.saveSimpleArray(tempFile, values);
+ int[] load = saver.loadSimpleArray(tempFile);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i], load[i]);
+ }
+ }
+
+ public void testReadWriteBooleanArray() {
+ boolean[] values = new boolean[11];
+ for (int i = 0; i < values.length; i++) {
+ values[i] = i % 2 == 0;
+ }
+ File tempFile = createTempFile();
+ DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ saver.saveBoolean(tempFile, values);
+ boolean[] load = saver.loadBoolean(tempFile);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i], load[i]);
+ }
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-12-20 14:02:41
|
Revision: 8159
http://fudaa.svn.sourceforge.net/fudaa/?rev=8159&view=rev
Author: deniger
Date: 2012-12-20 14:02:32 +0000 (Thu, 20 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/fileformat/FileOperationAbstract.java
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaver.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java
Added Paths:
-----------
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java
Removed Paths:
-------------
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/fileformat/FileOperationAbstract.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/fileformat/FileOperationAbstract.java 2012-12-20 10:14:50 UTC (rev 8158)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/fileformat/FileOperationAbstract.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -7,6 +7,7 @@
* @mail de...@fu...
*/
package org.fudaa.ctulu.fileformat;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
@@ -18,20 +19,24 @@
import org.fudaa.ctulu.CtuluAnalyze;
import org.fudaa.ctulu.CtuluIOOperationSynthese;
import org.fudaa.ctulu.ProgressionInterface;
+
/**
* @deprecated use {@link FileReadWriteAbstract}
* @author deniger
* @version $Id: FileOperationAbstract.java,v 1.5 2006-07-13 13:34:41 deniger Exp $
*/
public abstract class FileOperationAbstract {
+
protected ProgressionInterface progress_;
protected CtuluAnalyze analyze_;
+
/**
* @param _progressReceiver l'ecouter pour la progression
*/
public void setProgressReceiver(final ProgressionInterface _progressReceiver) {
- progress_= _progressReceiver;
+ progress_ = _progressReceiver;
}
+
protected abstract FortranInterface getFortranInterface();
/**
@@ -40,35 +45,52 @@
public abstract void setFile(File _f);
protected final CtuluIOOperationSynthese closeOperation(final Object _o) {
- final CtuluIOOperationSynthese r= new CtuluIOOperationSynthese();
- final FortranInterface out= getFortranInterface();
- r.setClosingOperation(FortranLib.closeState(out));
+ final CtuluIOOperationSynthese r = new CtuluIOOperationSynthese();
+ final FortranInterface out = getFortranInterface();
+ if (closeStreamAtEnd) {
+ r.setClosingOperation(FortranLib.closeState(out));
+ }
r.setAnalyze(analyze_);
r.setSource(_o);
- progress_= null;
- analyze_= null;
+ progress_ = null;
+ analyze_ = null;
return r;
}
+ private boolean closeStreamAtEnd = true;
+
/**
+ *
+ * @param closeStreamAtEnd si false, le flux ne sera pas ferm\xE9 \xE0 la fin
+ */
+ public void setCloseOutputStreamAtEnd(boolean closeStreamAtEnd) {
+ this.closeStreamAtEnd = closeStreamAtEnd;
+ }
+
+ /**
* @param _f le fichier a lire
* @return le FileReader correspondant
*/
public static final FileReader initFileReader(final File _f) {
- FileReader r= null;
+ FileReader r = null;
try {
- r= new FileReader(_f);
- } catch (final FileNotFoundException _e) {FuLog.error(_e);}
+ r = new FileReader(_f);
+ } catch (final FileNotFoundException _e) {
+ FuLog.error(_e);
+ }
return r;
}
+
/**
* @param _f le fichier a ecrire
* @return le FileWriter correspondant
*/
public static final FileWriter initFileWriter(final File _f) {
- FileWriter r= null;
+ FileWriter r = null;
try {
- r= new FileWriter(_f);
- } catch (final IOException _e) {FuLog.error(_e);}
+ r = new FileWriter(_f);
+ } catch (final IOException _e) {
+ FuLog.error(_e);
+ }
return r;
}
}
Copied: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java (from rev 8158, trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java)
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java (rev 0)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -0,0 +1,281 @@
+package org.fudaa.dodico.fortran;
+
+import com.memoire.fu.FuEmptyArrays;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.fudaa.ctulu.fileformat.FortranLib;
+import org.fudaa.dodico.fichiers.NativeBinarySystem;
+
+import com.memoire.fu.FuLog;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import org.fudaa.ctulu.CtuluLibArray;
+import org.fudaa.ctulu.CtuluLibFile;
+
+/**
+ * Permet d'\xE9crire facilement des tableaux d'entier, bool\xE9ens dans un fichier binaire.
+ *
+ * @author Frederic Deniger
+ */
+public class DodicoArraysBinaryFileSaver {
+
+ public DodicoArraysBinaryFileSaver() {
+ }
+
+ public boolean saveSimpleArray(File file, int[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
+ }
+
+ public boolean saveSimpleArray(OutputStream file, int[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
+ }
+
+ public boolean saveDouble(File file, double[] in) {
+ boolean ok = false;
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(file);
+ ok = saveDouble(out, in);
+ } catch (Exception exception) {
+ ok = false;
+ FuLog.error(exception);
+ } finally {
+ CtuluLibFile.close(out);
+ }
+ return ok;
+
+ }
+
+ public boolean saveDouble(OutputStream file, double[] in) {
+ FortranBinaryOutputStream output = null;
+ boolean ok = true;
+ try {
+ output = new FortranBinaryOutputStream(file, true, NativeBinarySystem.X86);
+ int nbValues = in.length;
+ output.writeInteger(nbValues);
+ output.writeRecord();
+ for (int i = 0; i < nbValues; i++) {
+ output.writeDoublePrecision(in[i]);
+ }
+ output.writeRecord();
+ } catch (Exception e) {
+ ok = false;
+ FuLog.error(e);
+ } finally {
+ }
+ return ok;
+ }
+
+ public int[] loadSimpleArray(File file) {
+ int[][] res = load(file);
+ return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
+ }
+
+ public int[] loadSimpleArray(InputStream file) {
+ int[][] res = load(file);
+ return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
+ }
+
+ private static int[] toInt(boolean[] in) {
+ if (in == null) {
+ return FuEmptyArrays.INT0;
+ }
+ int[] out = new int[in.length];
+ for (int i = 0; i < out.length; i++) {
+ out[i] = in[i] ? 1 : 0;
+ }
+ return out;
+ }
+
+ private static boolean[] toBoolean(int[][] in) {
+ if (in == null || in.length == 0 || in[0].length == 0) {
+ return FuEmptyArrays.BOOLEAN0;
+ }
+ final int[] values = in[0];
+ boolean[] out = new boolean[values.length];
+ for (int i = 0; i < out.length; i++) {
+ out[i] = values[i] == 1 ? true : false;
+ }
+ return out;
+ }
+
+ public boolean saveBoolean(File file, boolean[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = toInt(in);
+ return save(file, toSave);
+ }
+
+ public boolean saveBoolean(OutputStream file, boolean[] in) {
+ int[][] toSave = new int[1][];
+ toSave[0] = toInt(in);
+ return save(file, toSave);
+ }
+
+ public boolean[] loadBoolean(File file) {
+ int[][] res = load(file);
+ return toBoolean(res);
+ }
+
+ public boolean[] loadBoolean(InputStream file) {
+ int[][] res = load(file);
+ return toBoolean(res);
+ }
+
+ public int[][] load(File file) {
+ FileInputStream input = null;
+ int[][] res = null;
+ try {
+ input = new FileInputStream(file);
+ res = load(input);
+ } catch (Exception e) {
+ FuLog.error(e);
+ } finally {
+ CtuluLibFile.close(input);
+ }
+ return res == null ? new int[0][0] : res;
+ }
+
+ public double[] loadDouble(File file) {
+ FileInputStream input = null;
+ double[] res = null;
+ try {
+ input = new FileInputStream(file);
+ res = loadDouble(input);
+ } catch (Exception e) {
+ FuLog.error(e);
+ } finally {
+ CtuluLibFile.close(input);
+ }
+ return res == null ? FuEmptyArrays.DOUBLE0 : res;
+ }
+
+ public int[][] load(InputStream in) {
+ FortranBinaryInputStream input = null;
+ if (in == null) {
+ return new int[0][0];
+ }
+ boolean ok = true;
+ int[][] mapOfValues = null;
+ try {
+ try {
+ input = new FortranBinaryInputStream(in, true, NativeBinarySystem.X86);
+ input.readRecord();
+ int nbValues = input.readInteger();
+ if (nbValues >= 0) {
+ mapOfValues = new int[nbValues][];
+ for (int i = 0; i < nbValues; i++) {
+ input.readRecord();
+ int nbItem = input.readInteger();
+ if (nbItem < 0) {
+ ok = false;
+ break;
+ }
+ mapOfValues[i] = new int[nbItem];
+ for (int j = 0; j < nbItem; j++) {
+ mapOfValues[i][j] = input.readInteger();
+ }
+ }
+ } else {
+ ok = false;
+ }
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+ if (ok) {
+ return mapOfValues;
+ }
+ return new int[0][0];
+ }
+
+ public double[] loadDouble(InputStream in) {
+ if (in == null) {
+ return FuEmptyArrays.DOUBLE0;
+ }
+ boolean ok = true;
+ double[] mapOfValues = null;
+ FortranBinaryInputStream input = null;
+ try {
+ try {
+ input = new FortranBinaryInputStream(in, true, NativeBinarySystem.X86);
+ input.readRecord();
+ int nbValues = input.readInteger();
+ input.readRecord();
+ if (nbValues >= 0) {
+ mapOfValues = new double[nbValues];
+ for (int i = 0; i < nbValues; i++) {
+ mapOfValues[i] = input.readDoublePrecision();
+ }
+ } else {
+ ok = false;
+ }
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+ if (ok) {
+ return mapOfValues;
+ }
+ return FuEmptyArrays.DOUBLE0;
+ }
+
+ public boolean save(File file, int[][] mapOfValues) {
+ boolean ok = false;
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(file);
+ ok = save(out, mapOfValues);
+ } catch (Exception exception) {
+ ok = false;
+ FuLog.error(exception);
+ } finally {
+ CtuluLibFile.close(out);
+ }
+ return ok;
+ }
+
+ public boolean save(OutputStream out, int[][] mapOfValues) {
+ return save(out, mapOfValues, false);
+
+ }
+
+ public boolean save(OutputStream out, int[][] mapOfValues, boolean close) {
+ FortranBinaryOutputStream output = null;
+ boolean ok = true;
+ try {
+ output = new FortranBinaryOutputStream(out, true, NativeBinarySystem.X86);
+ int nbValues = mapOfValues.length;
+ output.writeInteger(nbValues);
+ output.writeRecord();
+ for (int i = 0; i < nbValues; i++) {
+ int[] values = mapOfValues[i];
+ output.writeInteger(values.length);
+ for (int j = 0; j < values.length; j++) {
+ output.writeInteger(values[j]);
+ }
+ output.writeRecord();
+ }
+ } catch (Exception e) {
+ ok = false;
+ FuLog.error(e);
+ } finally {
+ if (close) {
+ FortranLib.close(output);
+ }
+ }
+ return ok;
+
+ }
+}
Modified: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaver.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaver.java 2012-12-20 10:14:50 UTC (rev 8158)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaver.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -23,11 +23,11 @@
}
public Map<String, double[]> load() {
- FortranBinaryInputStream input = null;
Map<String, double[]> mapOfValues = new HashMap<String, double[]>();
if (destFile.length() == 0) {
return mapOfValues;
}
+ FortranBinaryInputStream input = null;
try {
try {
input = new FortranBinaryInputStream(new FileInputStream(destFile), true, NativeBinarySystem.X86);
@@ -46,7 +46,7 @@
mapOfValues.put(name, values);
}
} catch (EOFException e) {
- e.printStackTrace();
+ FuLog.error(e);
}
} catch (Exception e) {
Deleted: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java 2012-12-20 10:14:50 UTC (rev 8158)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaver.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -1,189 +0,0 @@
-package org.fudaa.dodico.fortran;
-
-import com.memoire.fu.FuEmptyArrays;
-import java.io.File;
-import java.io.FileOutputStream;
-
-import org.fudaa.ctulu.fileformat.FortranLib;
-import org.fudaa.dodico.fichiers.NativeBinarySystem;
-
-import com.memoire.fu.FuLog;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.fudaa.ctulu.CtuluLibArray;
-import org.fudaa.ctulu.CtuluLibFile;
-
-/**
- * Permet d'\xE9crire facilement des tableaux d'entier, bool\xE9ens dans un fichier binaire.
- * @author Frederic Deniger
- */
-public class DodicoIntegerArrayBinaryFileSaver {
-
- public DodicoIntegerArrayBinaryFileSaver() {
- }
-
- public boolean saveSimpleArray(File file, int[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = in;
- return save(file, toSave);
- }
-
- public boolean saveSimpleArray(OutputStream file, int[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = in;
- return save(file, toSave);
- }
-
- public int[] loadSimpleArray(File file) {
- int[][] res = load(file);
- return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
- }
-
- public int[] loadSimpleArray(InputStream file) {
- int[][] res = load(file);
- return CtuluLibArray.isEmpty(res) ? FuEmptyArrays.INT0 : res[0];
- }
-
- private static int[] toInt(boolean[] in) {
- if (in == null) {
- return FuEmptyArrays.INT0;
- }
- int[] out = new int[in.length];
- for (int i = 0; i < out.length; i++) {
- out[i] = in[i] ? 1 : 0;
- }
- return out;
- }
-
- private static boolean[] toBoolean(int[][] in) {
- if (in == null || in.length == 0 || in[0].length == 0) {
- return FuEmptyArrays.BOOLEAN0;
- }
- final int[] values = in[0];
- boolean[] out = new boolean[values.length];
- for (int i = 0; i < out.length; i++) {
- out[i] = values[i] == 1 ? true : false;
- }
- return out;
- }
-
- public boolean saveBoolean(File file, boolean[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = toInt(in);
- return save(file, toSave);
- }
-
- public boolean saveBoolean(OutputStream file, boolean[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = toInt(in);
- return save(file, toSave);
- }
-
- public boolean[] loadBoolean(File file) {
- int[][] res = load(file);
- return toBoolean(res);
- }
-
- public boolean[] loadBoolean(InputStream file) {
- int[][] res = load(file);
- return toBoolean(res);
- }
-
- public int[][] load(File file) {
- FileInputStream input = null;
- int[][] res = null;
- try {
- input = new FileInputStream(file);
- res = load(input);
- } catch (Exception e) {
- FuLog.error(e);
- } finally {
- CtuluLibFile.close(input);
- }
- return res == null ? new int[0][0] : res;
- }
-
- public int[][] load(InputStream in) {
- FortranBinaryInputStream input = null;
- if (in == null) {
- return new int[0][0];
- }
- boolean ok = true;
- int[][] mapOfValues = null;
- try {
- try {
- input = new FortranBinaryInputStream(in, true, NativeBinarySystem.X86);
- input.readRecord();
- int nbValues = input.readInteger();
- if (nbValues >= 0) {
- mapOfValues = new int[nbValues][];
- for (int i = 0; i < nbValues; i++) {
- input.readRecord();
- int nbItem = input.readInteger();
- if (nbItem < 0) {
- ok = false;
- break;
- }
- mapOfValues[i] = new int[nbItem];
- for (int j = 0; j < nbItem; j++) {
- mapOfValues[i][j] = input.readInteger();
- }
- }
- } else {
- ok = false;
- }
- } catch (Exception e) {
- FuLog.error(e);
- }
-
- } catch (Exception e) {
- FuLog.error(e);
- }
- if (ok) {
- return mapOfValues;
- }
- return new int[0][0];
- }
-
- public boolean save(File file, int[][] mapOfValues) {
- boolean ok = false;
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(file);
- ok = save(out, mapOfValues);
- } catch (Exception exception) {
- ok = false;
- FuLog.error(exception);
- } finally {
- CtuluLibFile.close(out);
- }
- return ok;
- }
-
- public boolean save(OutputStream out, int[][] mapOfValues) {
- FortranBinaryOutputStream output = null;
- boolean ok = true;
- try {
- output = new FortranBinaryOutputStream(out, true, NativeBinarySystem.X86);
- int nbValues = mapOfValues.length;
- output.writeInteger(nbValues);
- output.writeRecord();
- for (int i = 0; i < nbValues; i++) {
- int[] values = mapOfValues[i];
- output.writeInteger(values.length);
- for (int j = 0; j < values.length; j++) {
- output.writeInteger(values[j]);
- }
- output.writeRecord();
- }
- } catch (Exception e) {
- ok = false;
- FuLog.error(e);
- } finally {
- FortranLib.close(output);
- }
- return ok;
-
- }
-}
Modified: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2012-12-20 10:14:50 UTC (rev 8158)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -26,7 +26,7 @@
}
}
File tempFile = createTempFile();
- DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
saver.save(tempFile, values);
int[][] load = saver.load(tempFile);
assertEquals(values.length, load.length);
@@ -44,7 +44,7 @@
values[i] = i * 2;
}
File tempFile = createTempFile();
- DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
saver.saveSimpleArray(tempFile, values);
int[] load = saver.loadSimpleArray(tempFile);
assertEquals(values.length, load.length);
@@ -59,7 +59,7 @@
values[i] = i % 2 == 0;
}
File tempFile = createTempFile();
- DodicoIntegerArrayBinaryFileSaver saver = new DodicoIntegerArrayBinaryFileSaver();
+ DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
saver.saveBoolean(tempFile, values);
boolean[] load = saver.loadBoolean(tempFile);
assertEquals(values.length, load.length);
@@ -67,4 +67,19 @@
assertEquals(values[i], load[i]);
}
}
+
+ public void testReadWriteDoubleArray() {
+ double[] values = new double[11];
+ for (int i = 0; i < values.length; i++) {
+ values[i] = Math.random() * 100;
+ }
+ File tempFile = createTempFile();
+ DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
+ saver.saveDouble(tempFile, values);
+ double[] load = saver.loadDouble(tempFile);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i], load[i], 1e-5);
+ }
+ }
}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java 2012-12-20 10:14:50 UTC (rev 8158)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliUIProperties.java 2012-12-20 14:02:32 UTC (rev 8159)
@@ -14,14 +14,14 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang.ObjectUtils;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibString;
/**
- * Classe decrivant les propri\xE9t\xE9s d'un calque. NE MODIFIER QUE SI VRAIMENT NECESSAIRE: utiliser pour serialiser l'etat
- * d'un calque
- *
+ * Classe decrivant les propri\xE9t\xE9s d'un calque. NE MODIFIER QUE SI VRAIMENT NECESSAIRE: utiliser pour serialiser l'etat d'un calque
+ *
* @author Fred Deniger
* @version $Id: EbliUIProperties.java,v 1.7 2007-04-16 16:35:09 deniger Exp $
*/
@@ -36,6 +36,50 @@
values_ = new HashMap();
}
+ public void addAll(EbliUIProperties other) {
+ if (other == null) {
+ return;
+ }
+ for (Object object : other.values_.entrySet()) {
+ java.lang.Object key = ((Map.Entry) object).getKey();
+ java.lang.Object value = ((Map.Entry) object).getValue();
+ values_.put(key, value);
+ }
+ }
+
+ /**
+ *
+ * @param prefix le prefix \xE0 ajouter \xE0 toutes les propri\xE9t\xE9s
+ * @return une nouvelles instance de EbliUIProperties
+ */
+ public EbliUIProperties cloneWithPrefix(String prefix) {
+ EbliUIProperties res = new EbliUIProperties(name_);
+ for (Object object : values_.entrySet()) {
+ java.lang.Object key = ((Map.Entry) object).getKey();
+ java.lang.Object value = ((Map.Entry) object).getValue();
+ res.values_.put(prefix + key, value);
+ }
+ return res;
+ }
+
+ /**
+ *
+ * @param prefix
+ * @return une map de propri\xE9t\xE9 contenant uniquement celles commencant par le prefix.
+ */
+ public EbliUIProperties extractSubset(String prefix) {
+ EbliUIProperties res = new EbliUIProperties(name_);
+ int prefixSize = prefix.length();
+ for (Object object : values_.entrySet()) {
+ String key = ObjectUtils.toString(((Map.Entry) object).getKey());
+ java.lang.Object value = ((Map.Entry) object).getValue();
+ if (key != null && key.startsWith(prefix)) {
+ res.values_.put(key.substring(prefixSize), value);
+ }
+ }
+ return res;
+ }
+
public EbliUIProperties(final String _name) {
this();
name_ = _name;
@@ -116,5 +160,4 @@
public void setLayerName(final String _name) {
name_ = _name;
}
-
}
\ 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-01-03 23:00:50
|
Revision: 8175
http://fudaa.svn.sourceforge.net/fudaa/?rev=8175&view=rev
Author: deniger
Date: 2013-01-03 23:00:41 +0000 (Thu, 03 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -122,7 +122,8 @@
// le vecteur de norme (on reutilise le variable projx)
projx = (_x - _segX1) - projx;
projy = (_y - _segY1) - projy;
- return Math.hypot(projx, projy);
+ return Math.sqrt(projx * projx + projy * projy);
+// too slow: return Math.hypot(projx, projy);
}
// public static double distanceAuCarreFromSegment(final double _segX1, final double _segY1, final double _segX2,
@@ -175,7 +176,7 @@
// le vecteur de norme (on reutilise le variable projx)
projx = (_x3 - _x1) - projx;
projy = (_y3 - _y1) - projy;
- return d1d2 * Math.hypot(projx, projy) / 2;
+ return d1d2 * Math.sqrt(projx * projx + projy * projy) / 2;
}
/**
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -917,12 +917,12 @@
Coordinate coord = new Coordinate();
int dim;
String numb;
- StringBuffer sb;
+ StringBuilder sb;
int t;
char ch;
// remove \n and \r and replace with spaces
- sb = new StringBuffer(_ptString);
+ sb = new StringBuilder(_ptString);
for (t = 0; t < sb.length(); t++) {
ch = sb.charAt(t);
@@ -931,8 +931,8 @@
sb.setCharAt(t, ' ');
}
}
-
final StringTokenizer stokenizer = new StringTokenizer(new String(sb), CtuluLibString.ESPACE, false);
+
while (stokenizer.hasMoreElements()) {
// have a point in memory - handle the single point
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -193,11 +193,14 @@
* Cr\xE9ation du modele a partir de la racine des calques.
*/
public CalqueGISTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) {
+ this(_model,_root,GISLib.MASK_ALL);
+ }
+ public CalqueGISTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root,int mask) {
super(new LayerNode(_root));
+ finder_.setMask(mask);
if (_model != null) {
_model.getObservable().addObserver(this);
}
-
setRootLayer(_root);
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -35,7 +35,7 @@
if (found_) {
return false;
}
- if (_cq == null || _cq.isGroupeCalque()) {
+ if (_cq == null) {
return true;
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -585,6 +585,7 @@
@Override
public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
final GrBoite _clipReel) {
+ long to = System.nanoTime();
if ((modele_ == null) || (modele_.getNombre() <= 0)) {
return;
}
@@ -654,6 +655,7 @@
paintIconsOnAtomics(_g, _versEcran, _versReel, _clipReel);
// Enfin les labels sur les atomiques.
paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel);
+ System.err.println("time to paint " + (System.nanoTime() - to) / 1e6);
}
protected void paintSurfaces(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
@@ -744,6 +746,8 @@
} else {
icone = iconeModel == null ? null : new TraceIcon(iconeModel);
}
+ int w = getWidth() + 1;
+ CtuluListSelection memory = new CtuluListSelection(w * getHeight());
// on trace les icones apres pour qu'ils soient dessin\xE9s au-dessus des lignes.
if (icone != null) {
@@ -781,8 +785,12 @@
if (!isRapide()) {
initTraceForAtomics(iconeModel, i, j);
}
- ptDest.autoApplique(versEcran);
- icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ ptDest.autoApplique2D(versEcran);
+ int idxOnScreen = (int) ptDest.x_ + (int) ptDest.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ memory.add(idxOnScreen);
+ }
}
}
}
@@ -844,7 +852,7 @@
continue;
}
- ptDest.autoApplique(versEcran);
+ ptDest.autoApplique2D(versEcran);
final Rectangle2D rec = fm.getStringBounds(s, _g);
double x = ptDest.x_ - rec.getWidth() / 2;
double y = ptDest.y_ - 5;
@@ -862,6 +870,7 @@
@Override
public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran,
final GrBoite _clipReel) {
+ long to = System.nanoTime();
if (isSelectionEmpty()) {
return;
}
@@ -878,6 +887,7 @@
} else {
paintSelectionSimple(_g, _trace, _versEcran, _clipReel, selection_);
}
+ System.err.println("time to selection " + (System.nanoTime() - to) / 1e6);
}
public void paintSelectionSimple(final Graphics _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran,
@@ -916,16 +926,30 @@
boolean bferm = modele_.isGeometryFermee(i);
boolean breli = modele_.isGeometryReliee(i);
+ int w = getWidth() + 1;
+ CtuluListSelection memory = new CtuluListSelection(w * getHeight());
+
+
final GrPoint ptOri = new GrPoint();
modele_.point(ptOri, i, nbPoints - 1);
- ptOri.autoApplique(versEcran);
- ic.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ ptOri.autoApplique2D(versEcran);
+
+ int idxOnScreen = (int) ptOri.x_ + (int) ptOri.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ ic.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ memory.add(idxOnScreen);
+ }
+
final GrPoint ptDest = new GrPoint();
for (int j = nbPoints - 2; j >= 0; j--) {
// le point de dest est initialise
modele_.point(ptDest, i, j);
- ptDest.autoApplique(versEcran);
- ic.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ ptDest.autoApplique2D(versEcran);
+ idxOnScreen = (int) ptDest.x_ + (int) ptDest.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ ic.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ memory.add(idxOnScreen);
+ }
if (breli) {
tlSelection.dessineTrait((Graphics2D) _g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
@@ -933,7 +957,7 @@
}
if (bferm) {
modele_.point(ptOri, i, nbPoints - 1);
- ptOri.autoApplique(versEcran);
+ ptOri.autoApplique2D(versEcran);
if (breli) {
tlSelection.dessineTrait((Graphics2D) _g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -44,10 +44,9 @@
import org.fudaa.ebli.ressource.EbliResource;
/**
- * Une classe permettant d'avoir un TreeModel repr\xE9sentant les calques conteant des lignes bris\xE9es et les lignes bris\xE9es
- * Il est possible d'avoir que les calques contenant des lignes ferm\xE9es. Ce mod\xE8le est automatiquement mis a jour si une
- * instance de l'arbre des calque lui est fourni.
- *
+ * Une classe permettant d'avoir un TreeModel repr\xE9sentant les calques conteant des lignes bris\xE9es et les lignes bris\xE9es Il est possible d'avoir que
+ * les calques contenant des lignes ferm\xE9es. Ce mod\xE8le est automatiquement mis a jour si une instance de l'arbre des calque lui est fourni.
+ *
* @author fred deniger
* @version $Id: CalqueFindCourbeTreeModel.java,v 1.5 2007-05-04 13:49:46 deniger Exp $
*/
@@ -59,6 +58,7 @@
final CalqueFindPolyligneVisitor finder_ = new CalqueFindPolyligneVisitor(false);
public static class CellRenderer extends JLabel implements TreeCellRenderer {
+
final Color selectedBackground_ = UIManager.getColor("Tree.selectionBackground");
final Color selectedForground_ = UIManager.getColor("Tree.selectionForeground");
final Border focusBorderColor_ = BorderFactory.createLineBorder(UIManager.getColor("Tree.selectionBorderColor"), 1);
@@ -72,7 +72,9 @@
protected boolean isSelectable(final Object _value, final boolean _leaf) {
if (onlyLineSelectable_) {
- if (!_leaf) { return false; }
+ if (!_leaf) {
+ return false;
+ }
final LayerNode node = (LayerNode) _value;
return node.idxPoly_ >= 0;
}
@@ -82,7 +84,7 @@
@Override
public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected,
- final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) {
+ final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) {
this.setFont(_tree.getFont());
setIcon(((LayerNode) _value).getIcon());
setText(_value.toString());
@@ -132,7 +134,7 @@
final List correctPath = new ArrayList(paths.length);
for (int i = 0; i < paths.length; i++) {
if (paths[i] != null && paths[i].getLastPathComponent() != null
- && ((LayerNode) paths[i].getLastPathComponent()).idxPoly_ >= 0) {
+ && ((LayerNode) paths[i].getLastPathComponent()).idxPoly_ >= 0) {
correctPath.add(paths[i]);
}
}
@@ -142,7 +144,6 @@
}
return paths;
}
-
}
public static class LayerNode extends DefaultMutableTreeNode {
@@ -182,9 +183,8 @@
}
}
- } else {
- addPolygones(_dest, (BCalque) userObject);
}
+ addPolygones(_dest, (BCalque) userObject);
}
@@ -199,7 +199,9 @@
@Override
public String toString() {
- if (titre_ != null) { return titre_; }
+ if (titre_ != null) {
+ return titre_;
+ }
return ((BCalque) userObject).getTitle();
}
@@ -210,9 +212,7 @@
public int getIdxPoly() {
return idxPoly_;
}
-
}
-
DefaultTreeModel treeModel_;
public CalqueFindCourbeTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) {
@@ -234,7 +234,6 @@
treeModel_.setRoot(rootNode_);
}
-
private boolean containsAtLeastOnLayer;
protected boolean containsLigne(final BCalque _cq) {
@@ -245,7 +244,9 @@
void addLayer(final LayerNode _parent, final BGroupeCalque _gc) {
final BCalque[] cq = _gc.getCalques();
- if (CtuluLibArray.isEmpty(cq)) { return; }
+ if (CtuluLibArray.isEmpty(cq)) {
+ return;
+ }
for (int i = 0; i < cq.length; i++) {
final LayerNode node = new LayerNode(cq[i]);
if (finder_.isMatching(cq[i])) {
@@ -264,13 +265,12 @@
public boolean isContainsAtLeastOnLayer() {
return containsAtLeastOnLayer;
}
-
GISVisitorChooser chooser_ = new GISVisitorChooser();
void addLigne(final LayerNode _parent, final ZCalqueLigneBrisee _brisee) {
final GISZoneCollectionLigneBrisee collec = (GISZoneCollectionLigneBrisee) _brisee.modeleDonnees().getGeomData();
final GISAttributeModelObjectInterface str = (GISAttributeModelObjectInterface) collec
- .getModel(GISAttributeConstants.TITRE);
+ .getModel(GISAttributeConstants.TITRE);
final int nb = collec.getNumGeometries();
for (int i = 0; i < nb; i++) {
chooser_.clear();
@@ -324,5 +324,4 @@
}
return tree;
}
-
}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -18,11 +18,12 @@
/**
* Un point 3D.
- *
+ *
* @version $Revision: 1.19 $ $Date: 2006-12-20 16:08:24 $ by $Author: deniger $
* @author Guillaume Desnoix
*/
public final class GrPoint extends GrObjet implements GrContour {
+
public double x_;
public double y_;
public double z_;
@@ -149,8 +150,15 @@
z_ = tz;
}
+ public void autoApplique2D(final GrMorphisme _t) {
+ final double tx = x_ * _t.a_[0][0] + y_ * _t.a_[1][0] + z_ * _t.a_[2][0] + _t.a_[3][0];
+ final double ty = x_ * _t.a_[0][1] + y_ * _t.a_[1][1] + z_ * _t.a_[2][1] + _t.a_[3][1];
+ x_ = tx;
+ y_ = ty;
+ }
+
public GrPoint[] contour() {
- return new GrPoint[] { this };
+ return new GrPoint[]{this};
}
/**
@@ -176,7 +184,7 @@
/**
* Indique si l'objet est s\xE9lectionn\xE9 pour un point donn\xE9.
- *
+ *
* @param _ecran Le morphisme pour la transformation en coordonn\xE9es \xE9cran.
* @param _dist La tol\xE9rence en coordonn\xE9es \xE9cran pour laquelle on consid\xE8re l'objet s\xE9lectionn\xE9.
* @param _pt Le point de s\xE9lection en coordonn\xE9es \xE9cran.
@@ -189,8 +197,10 @@
}
/**
- * Indique si l'objet <code>_pTest</code> est s\xE9lectionn\xE9 pour un point donn\xE9 <code>_pRef</code>.
- *
+ * Indique si l'objet
+ * <code>_pTest</code> est s\xE9lectionn\xE9 pour un point donn\xE9
+ * <code>_pRef</code>.
+ *
* @param _dist La tol\xE9rence en coordonn\xE9es \xE9cran pour laquelle on consid\xE8re l'objet s\xE9lectionn\xE9.
* @param _pRef Le point de s\xE9lection en coordonn\xE9es \xE9cran (il estmodifie ).
* @param _pTest Le point a teste.
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -39,6 +39,8 @@
public final static int PLUS_DOUBLE = 13;
public final static int CARRE_ARRONDI = 14;
private TraceIconModel model_;
+ private TraceLigneModel ligneModel = new TraceLigneModel();
+ private TraceLigne traceLigne = new TraceLigne(ligneModel);
public final TraceIconModel getModel() {
return model_;
@@ -109,8 +111,10 @@
Stroke oldStroke = (g2d).getStroke();
if (model_.typeLigne_ > 0 && model_.epaisseurLigne_ > 0) {
- TraceLigneModel ligneModel = new TraceLigneModel(model_.typeLigne_, model_.epaisseurLigne_, g2d.getColor());
- new TraceLigne(ligneModel).initialisationGraphics(g2d);
+ ligneModel.setEpaisseur(model_.epaisseurLigne_);
+ ligneModel.setTypeTrait(model_.typeLigne_);
+ ligneModel.setColor(g2d.getColor());
+ traceLigne.initialisationGraphics(g2d);
}
final int x = _x;
final int y = _y;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-07 15:53:01
|
Revision: 8189
http://fudaa.svn.sourceforge.net/fudaa/?rev=8189&view=rev
Author: deniger
Date: 2013-01-07 15:52:54 +0000 (Mon, 07 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java
trunk/framework/pom.xml
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-07 15:52:34 UTC (rev 8188)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-07 15:52:54 UTC (rev 8189)
@@ -40,7 +40,6 @@
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.List;
-import java.util.StringTokenizer;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipInputStream;
@@ -922,36 +921,17 @@
*/
private void parsePoints(final String _ptString, final GeometryFactory _geometryFactory) {
String aPoint;
-// StringTokenizer stokenizerPoint;
Coordinate coord = new Coordinate();
int dim;
String numb;
-// StringBuilder sb;
-// int t;
-// char ch;
- // // remove \n and \r and replace with spaces
- // sb = new StringBuilder(_ptString);
- //
- // for (t = 0; t < sb.length(); t++) {
- // ch = sb.charAt(t);
- //
- // if ((ch == '\n') || (ch == '\r')) {
- // sb.setCharAt(t, ' ');
- // }
- // }
- // StringUtils.split(numb, ch)
- // final StringTokenizer stokenizer = new StringTokenizer(new String(sb), CtuluLibString.ESPACE, false);
List<String> splitWorker = splitCoordinate(_ptString);
final int nb = splitWorker.size();
for (int i = 0; i < nb; i++) {
-// while (stokenizer.hasMoreElements()) {
// have a point in memory - handle the single point
-// aPoint = stokenizer.nextToken();
aPoint = splitWorker.get(i);
List<String> splitVirgule = splitVirgule(aPoint);
-// stokenizerPoint = new StringTokenizer(aPoint, CtuluLibString.VIR, false);
coord.x = Double.NaN;
coord.y = Double.NaN;
coord.z = Double.NaN;
@@ -959,7 +939,6 @@
final int nbVirg = splitVirgule.size();
for (int j = 0; j < nbVirg; j++) {
-// while (stokenizerPoint.hasMoreElements()) {
numb = splitVirgule.get(j);
if (dim == 0) {
coord.x = Double.parseDouble(numb);
@@ -976,7 +955,6 @@
}
pointList_.add(coord); // remember it
coord = new Coordinate();
-// stokenizerPoint = null;
}
}
Modified: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java 2013-01-07 15:52:34 UTC (rev 8188)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/TestIO.java 2013-01-07 15:52:54 UTC (rev 8189)
@@ -80,6 +80,9 @@
public void assertDoubleEquals(double _v1, double _v2) {
assertEquals(_v1, _v2, eps_);
}
+ public void assertDoubleEquals(String message,double _v1, double _v2) {
+ assertEquals(message,_v1, _v2, eps_);
+ }
/**
* Permet de trouver une ressource presente dans le rep de la classe donnee.
Modified: trunk/framework/pom.xml
===================================================================
--- trunk/framework/pom.xml 2013-01-07 15:52:34 UTC (rev 8188)
+++ trunk/framework/pom.xml 2013-01-07 15:52:54 UTC (rev 8189)
@@ -200,7 +200,6 @@
-->
<version>2.0.4</version>
</dependency>
-
<dependency>
<groupId>PDFRenderer</groupId>
<artifactId>PDFRenderer</artifactId>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-10 14:12:54
|
Revision: 8194
http://fudaa.svn.sourceforge.net/fudaa/?rev=8194&view=rev
Author: deniger
Date: 2013-01-10 14:12:46 +0000 (Thu, 10 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2013-01-10 14:11:56 UTC (rev 8193)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2013-01-10 14:12:46 UTC (rev 8194)
@@ -104,7 +104,8 @@
/**
* Initialise avec une liste de taille de 20 par defaut.
*/
- protected CtuluCollectionObjectAbstract() {}
+ protected CtuluCollectionObjectAbstract() {
+ }
@Override
protected void fireObjectChanged(int _indexGeom, Object _newValue) {
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2013-01-10 14:11:56 UTC (rev 8193)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2013-01-10 14:12:46 UTC (rev 8194)
@@ -132,6 +132,8 @@
@Override
public GISAttributeModelObservable createAtomicModel(final Object[] _initValues, final int _nbValues) {
if (_initValues != null) {
+
+ //TODO voir ici
if (_initValues.length != _nbValues) {
throw new IllegalArgumentException("bad size value=" + _nbValues + " used=" + _initValues.length);
}
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2013-01-10 14:11:56 UTC (rev 8193)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2013-01-10 14:12:46 UTC (rev 8194)
@@ -37,7 +37,7 @@
* @version $Id$
*/
public abstract class GISZoneCollection extends GISCollection implements GISAttributeListener, GISDataModel {
-
+
private String title_;
/**
* La liste ordonn\xE9e des mod\xE8les d'attributs associ\xE9es \xE0 la collection.
@@ -69,15 +69,15 @@
*/
protected boolean attListHasChanged_ = true;
protected boolean isGeomModifiable_ = true;
-
+
public GISZoneCollection() {
super();
}
-
+
public GISZoneCollection(final boolean _isGeomModifiable) {
isGeomModifiable_ = _isGeomModifiable;
}
-
+
public void setGeomModifiable(boolean isGeomModifiable) {
this.isGeomModifiable_ = isGeomModifiable;
}
@@ -96,35 +96,35 @@
public GISZoneCollection(final int _nbObject) {
super(_nbObject);
}
-
+
@Override
public long getId() {
return -1;
}
-
+
protected void fireAttributeAdded(int _newIdx, GISAttributeInterface _newAtt) {
if (listener_ != null) {
listener_.attributeAction(this, _newIdx, _newAtt, GISZoneListener.ATTRIBUTE_ACTION_ADD);
}
}
-
+
protected void fireAttributeRemoved(int _oldIdx, GISAttributeInterface _oldAtt) {
if (listener_ != null) {
listener_.attributeAction(this, _oldIdx, _oldAtt, GISZoneListener.ATTRIBUTE_ACTION_REMOVE);
}
}
-
+
protected void fireAttributeValueChanged(int _idxAtt, GISAttributeInterface _att, int _idxGeom, Object _newValue) {
if (listener_ != null) {
listener_.attributeValueChangeAction(this, _idxAtt, _att, _idxGeom, _newValue);
}
}
-
+
@Override
public void gisDataChanged(GISAttributeInterface _att, int _indexGeom, Object _newValue) {
fireAttributeValueChanged(getIndiceOf(_att), _att, _indexGeom, _newValue);
}
-
+
protected void fireTitleChanged() {
}
@@ -136,11 +136,11 @@
protected CtuluCollection getData(final int _i) {
return isDataCreated(_i) ? attr_[_i] : null;
}
-
+
protected Object getDefaultValuesObject(final int _idxValues) {
return isDataCreated(_idxValues) ? attr_[_idxValues].getAttribute().getDefaultValue() : null;
}
-
+
@Override
public Object clone() {
GISZoneCollection cloned = (GISZoneCollection) super.superClone();
@@ -173,6 +173,7 @@
}
}
}
+ cloned.updateListeners();
return cloned;
}
@@ -183,7 +184,7 @@
protected GISAttributeModelObservable getModelListener(final int _i) {
return (GISAttributeModelObservable) getData(_i);
}
-
+
protected void initAttributes(final GISAttributeInterface[] _att) {
if (_att != null) {
badIdxAttZ_ = true;
@@ -199,7 +200,7 @@
}
}
}
-
+
protected void initAttributes(final GISAttributeModelObservable[] _att) {
badIdxAttZ_ = true;
attListHasChanged_ = true;
@@ -225,16 +226,16 @@
public void redo() {
initAttributes(_att, null);
}
-
+
@Override
public void undo() {
initAttributes(old, null);
}
});
}
-
+
}
-
+
}
/**
@@ -244,7 +245,7 @@
protected boolean isDataCreated(final int _i) {
return attr_ != null && attr_.length > _i && attr_[_i] != null;
}
-
+
@Override
public abstract boolean accept(GISVisitor _v);
@@ -279,15 +280,16 @@
os[igeom] = createOrAssignAttribut(iatt, _model.getValue(iatt, igeom), pt[igeom]);
}
data.add(nbGeom == 1 ? os[0] : os);
-
+
}
-
+
final int firstIdx = super.geometry_.getSize() - 1;
super.geometry_.addAll(pt, data, _cmd);
if (_doPostImport) {
postImport(firstIdx);
}
-
+ updateListeners();
+
return true;
}
@@ -308,6 +310,10 @@
val = _init;
}
ret = getDataModel(_iatt).getAttribute().createDataForGeom(val, nbPt);
+ //Fred pour mettre a jour le listener
+ if (ret instanceof GISAttributeModelObservable) {
+ ((GISAttributeModelObservable) ret).setListener(this);
+ }
// FIXME B.M. : Pas sur que ce soit le bienvenu. Si on veut des valeurs par d\xE9faut et que la g\xE9om\xE9trie poss\xE8de
// des Z, il ne faudrait pas que ce soit initialis\xE9 (cas d'import de fichier et ajout par addAll).
if (getIdxAttZ() != -1 && getAttributeIsZ() != null && getAttributeIsZ().isAtomicValue() && _init == null
@@ -319,7 +325,7 @@
}
return ret;
}
-
+
public abstract void addCoordinateSequence(CoordinateSequence _seq, Object[] _datas, CtuluCommandContainer _cmd);
/**
@@ -331,7 +337,7 @@
* @return l'index de la g\xE9om\xE9trie cr\xE9\xE9e, -1 si rien n'est cr\xE9e
*/
public abstract int addGeometry(Geometry _geom, Object[] _datas, CtuluCommandContainer _cmd);
-
+
public void removeGeometries(final int[] _idx, final CtuluCommandContainer _cmd) {
if (!isGeomModifiable_) {
return;
@@ -349,7 +355,7 @@
geometry_.removeAll(_cmd);
}
}
-
+
public GISAttributeModel[] getAtomicAttributeSubModel(final int _geomIdx) {
final int nb = getNbAttributes();
final List<GISAttributeModel> r = new ArrayList<GISAttributeModel>(nb);
@@ -364,7 +370,7 @@
r.toArray(rf);
return rf;
}
-
+
@Override
public GISAttributeInterface getAttribute(final int _i) {
final GISAttributeModel model = getDataModel(_i);
@@ -387,7 +393,7 @@
res[i] = getAttribute(i);
}
return res;
-
+
}
/**
@@ -403,7 +409,7 @@
* @return la classe a utiliser pour les sauvegardes dans les data stores
*/
public abstract Class getDataStoreClass();
-
+
@Override
public int getIndiceOf(final GISAttributeInterface _att) {
if (attListHasChanged_) {
@@ -421,7 +427,7 @@
}
return -1;
}
-
+
public GISAttributeInterface getAttributeWithID(final String _attributId) {
if (attr_ != null && _attributId != null) {
for (int i = attr_.length - 1; i >= 0; i--) {
@@ -444,22 +450,22 @@
}
return null;
}
-
+
public GISAttributeModel getModel(final int _i) {
return (GISAttributeModelObservable) getData(_i);
}
-
+
public GISAttributeModel[] getModels() {
final GISAttributeModel[] res = new GISAttributeModel[attr_.length];
System.arraycopy(attr_, 0, res, 0, attr_.length);
return res;
}
-
+
@Override
public int getNbAttributes() {
return attr_ == null ? 0 : attr_.length;
}
-
+
public int getNbGeometries() {
return super.getNumGeometries();
}
@@ -470,7 +476,7 @@
public final String getTitle() {
return title_;
}
-
+
@Override
public Object getValue(final int _idxAtt, final int _idxGeom) {
if (_idxAtt < 0 || _idxAtt > getNbAttributes()) {
@@ -521,13 +527,13 @@
if (getIdxAttZ() == -1) {
return;
}
-
+
final int nb = getNumGeometries();
for (int i = (_firstIdx < 0 ? 0 : _firstIdx); i < nb; i++) {
initZAttribute(i);
}
}
-
+
@Override
public void preload(final GISAttributeInterface[] _att, final ProgressionInterface _prog) {
}
@@ -542,13 +548,13 @@
if (getIdxAttZ() == -1) {
return;
}
-
+
final int nb = getNumGeometries();
for (int i = 0; i < nb; i++) {
initZCoordinate(i);
}
}
-
+
protected int getIdxAttZ() {
if (badIdxAttZ_) {
idxAttZ_ = getIndiceOf(attributeIsZ_);
@@ -569,7 +575,7 @@
// Il s'agit d'un polygone => Le dernier point doit prendre comme valeur celle du premier.
boolean bgone = getGeometry(_idxGeom) instanceof GISPolygone;
-
+
final GISAttributeModel model = getModel(getIdxAttZ());
if (!model.getAttribute().isAtomicValue()) {
final CoordinateSequence seq = getCoordinateSequence(_idxGeom);
@@ -612,9 +618,9 @@
// Il s'agit d'un polygone => Le dernier point doit prendre comme valeur celle du premier.
boolean bgone = getGeometry(_idxGeom) instanceof GISPolygone;
-
+
final GISAttributeModel model = getModel(getIdxAttZ());
-
+
if (model instanceof GISAttributeModelObjectInterface) {
final CoordinateSequence seq = getCoordinateSequence(_idxGeom);
final GISAttributeModelDoubleArray arr = (GISAttributeModelDoubleArray) model.getObjectValueAt(_idxGeom);
@@ -694,7 +700,7 @@
// on recupere les valeurs d\xE9j\xE0 utilis\xE9es
final Map<GISAttributeInterface, GISAttributeModel> exist = new HashMap<GISAttributeInterface, GISAttributeModel>(
attr_ == null ? 0 : attr_.length);
-
+
if (attr_ != null) {
for (int i = attr_.length - 1; i >= 0; i--) {
exist.put(attr_[i].getAttribute(), attr_[i]);
@@ -722,7 +728,7 @@
fireAttributeAdded(-1, null);
fireAttributeRemoved(-1, null);
}
-
+
@Override
public void undo() {
attr_ = old;
@@ -731,9 +737,9 @@
}
});
}
-
+
}
-
+
public abstract void setCoordinateSequence(int _idx, CoordinateSequence _newSeq, CtuluCommandContainer _cmd);
/**
@@ -755,7 +761,7 @@
public void redo() {
setTitle(_title, null);
}
-
+
@Override
public void undo() {
setTitle(old, null);
@@ -763,20 +769,20 @@
});
}
return true;
-
+
}
/**
* Mise a jour des listeners.
*/
public abstract void updateListeners();
-
+
@Override
protected void internActionCleared(final CtuluCommandContainer _c) {
for (int i = getNbAttributes() - 1; i >= 0; i--) {
getData(i).removeAll(_c);
}
-
+
}
/**
@@ -819,14 +825,14 @@
} else {
getData(i).addObject(o, _c);
}
-
+
} else {
// la liste est cree automatiquement
// elle fait deja la taille du nombre de point
if (_nbValues > 1) {
final int[] idx = new int[_nbValues];
final int max = getNumGeometries() - 1;
-
+
for (int k = _nbValues - 1; k >= 0; k--) {
idx[k] = max - k;
}
@@ -845,9 +851,9 @@
}
}
}
-
+
}
-
+
@Override
protected void internActionPointInserted(final int _i, final List _l, final CtuluCommandContainer _c) {
if (_l == null) {
@@ -877,9 +883,9 @@
}
}
}
-
+
}
-
+
@Override
protected void internActionPointRemoved(final int _i, final CtuluCommandContainer _c) {
for (int i = getNbAttributes() - 1; i >= 0; i--) {
@@ -888,7 +894,7 @@
}
}
}
-
+
@Override
protected void internActionPointRemoved(final int[] _i, final CtuluCommandContainer _c) {
for (int i = getNbAttributes() - 1; i >= 0; i--) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-10 15:58:39
|
Revision: 8197
http://fudaa.svn.sourceforge.net/fudaa/?rev=8197&view=rev
Author: deniger
Date: 2013-01-10 15:58:33 +0000 (Thu, 10 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java 2013-01-10 14:22:01 UTC (rev 8196)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisZoneCollectionAsListPointAdapter.java 2013-01-10 15:58:33 UTC (rev 8197)
@@ -55,6 +55,21 @@
return null;
}
+ /**
+ *
+ * @param idxSemis l'indice de la g\xE9ometrie
+ * @param idxPtInSemis l'indice du point dans la g\xE9ometrie
+ * @return permet de connaitre l'indice dans ce r\xE9f\xE9rentiel.
+ */
+ public int getIdx(int idxSemis, int idxPtInSemis) {
+ int sum = 0;
+ int nb = Math.min(nbPointsBySemis.length, idxSemis);
+ for (int i = 0; i < nb; i++) {
+ sum = sum + nbPointsBySemis[i];
+ }
+ return sum + idxPtInSemis;
+ }
+
@Override
public double getPtX(int idxPt) {
return getCoordinate(idxPt).x;
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-10 14:22:01 UTC (rev 8196)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-10 15:58:33 UTC (rev 8197)
@@ -204,7 +204,7 @@
Color old = this.labelsBackgroundColor;
this.labelsBackgroundColor = labelsBackgroundColor;
repaint();
- firePropertyChange(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND, old, labelsBackgroundColor);
+ firePropertyChange(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND, old, labelsBackgroundColor);
}
}
@@ -565,9 +565,13 @@
if (_p.isDefined(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND)) {
setLabelsBackgroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND));
}
+ else{
+ setLabelsBackgroundColor(null);
+ }
if (_p.isDefined(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND)) {
setLabelsForegroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND));
}
+
}
@@ -822,11 +826,6 @@
if (modele_.getNbPointForGeometry(i) <= 0 || !isPainted(i, _versEcran)) {
continue;
}
- // La g\xE9ometrie n'est pas visible
- //a enlever car deja fait plus haut
- if (!isPainted(i, _versEcran)) {
- continue;
- }
modele_.getDomaineForGeometry(i, bPoly);
// Si la boite du polygone n'est pas dans la boite d'affichage on passe
@@ -843,6 +842,10 @@
final GrPoint ptDest = new GrPoint();
for (int j = nbPoints - 1; j >= 0; j--) {
+ //l'icone ne doit pas \xEAtre paint:
+ if (!isIconOnAtomicsPainted(i, j)) {
+ continue;
+ }
// le point de dest est initialise
modele_.point(ptDest, i, j);
if (!_clipReel.contientXY(ptDest)) {
@@ -862,6 +865,10 @@
}
}
+ protected boolean isIconOnAtomicsPainted(int idxGeometry, int idxPoint) {
+ return true;
+ }
+
protected void paintLabelsOnAtomics(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
final GrBoite _clipReel) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-14 12:44:38
|
Revision: 8205
http://fudaa.svn.sourceforge.net/fudaa/?rev=8205&view=rev
Author: deniger
Date: 2013-01-14 12:44:27 +0000 (Mon, 14 Jan 2013)
Log Message:
-----------
Ajout support filtre de points
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
Added Paths:
-----------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java
trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/
trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
Removed Paths:
-------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
Modified: trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt
===================================================================
--- trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2013-01-14 12:44:27 UTC (rev 8205)
@@ -329,4 +329,5 @@
Une erreur est survenue lors de l'analyse du fichier xml\: {0}=An error occured while analyzing the xml file\: {0}
L'URL n'est pas renseign\xE9e=The URL is not defined
Une incoh\xE9rence a \xE9t\xE9 d\xE9tect\xE9e\: le fichier xml est valide mais les balises {0} ne sont pas support\xE9es par l'application=A mismatch has been detected\: the xml file is valid but the application doesn't support the tag {0}
-Erreur lors de la validation du fichier xml\: {0}=Error while validating the XML file\: {0}
\ No newline at end of file
+Erreur lors de la validation du fichier xml\: {0}=Error while validating the XML file\: {0}
+Indexation des points=Points indexation
\ No newline at end of file
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -32,7 +32,7 @@
this.eps = eps;
}
- public GisZonePointCollectionPointFiltered createFiltered(ProgressionInterface prog) {
+ public PointsMappingDefault createFiltered(ProgressionInterface prog) {
ProgressionUpdater updater = new ProgressionUpdater(prog);
updater.majProgessionStateOnly(CtuluLib.getS("Indexation des points"));
TreeMap<Coordinate, Integer> indexs = new TreeMap<Coordinate, Integer>(new CoordinateComparator(eps));
@@ -56,6 +56,6 @@
correspondance[idx++] = entry.getValue();
updater.majAvancement();
}
- return new GisZonePointCollectionPointFiltered(correspondance, in);
+ return new PointsMappingDefault(correspondance, in);
}
}
Deleted: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -1,41 +0,0 @@
-/*
- GPL 2
- */
-package org.fudaa.ctulu.gis.process;
-
-import org.fudaa.ctulu.interpolation.SupportLocationI;
-
-/**
- * Le r\xE9sultat d'un filtre de points.
- *
- * @author Frederic Deniger
- */
-public class GisZonePointCollectionPointFiltered implements SupportLocationI {
-
- private int[] correspondance;
- SupportLocationI init;
-
- public GisZonePointCollectionPointFiltered(int[] correspondance, SupportLocationI init) {
- this.correspondance = correspondance;
- this.init = init;
- }
-
- @Override
- public int getPtsNb() {
- return correspondance.length;
- }
-
- public int getInitialIdx(int _i) {
- return correspondance[_i];
- }
-
- @Override
- public double getPtX(int _i) {
- return init.getPtX(correspondance[_i]);
- }
-
- @Override
- public double getPtY(int _i) {
- return init.getPtY(correspondance[_i]);
- }
-}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,23 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface PointsMapping extends SupportLocationI {
+
+ int getInitialIdx(int _i);
+
+ /**
+ * Attention, pour des raisons de performances le tableau n'est pas copi\xE9.
+ * O
+ * @return null si aucun filtre.
+ */
+ int[] getMapping();
+
+}
Copied: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java (from rev 8202, trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java)
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,47 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ * Le r\xE9sultat d'un filtre de points.
+ *
+ * @author Frederic Deniger
+ */
+public class PointsMappingDefault implements PointsMapping {
+
+ private int[] mapping;
+ SupportLocationI init;
+
+ public PointsMappingDefault(int[] correspondance, SupportLocationI init) {
+ this.mapping = correspondance;
+ this.init = init;
+ }
+
+ @Override
+ public int getPtsNb() {
+ return mapping.length;
+ }
+
+ @Override
+ public int[] getMapping() {
+ return mapping;
+ }
+
+ @Override
+ public int getInitialIdx(int _i) {
+ return mapping[_i];
+ }
+
+ @Override
+ public double getPtX(int _i) {
+ return init.getPtX(mapping[_i]);
+ }
+
+ @Override
+ public double getPtY(int _i) {
+ return init.getPtY(mapping[_i]);
+ }
+}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,45 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ * Adapter sans modification d'indice.
+ *
+ * @author Frederic Deniger
+ */
+public class PointsMappingEmpty implements PointsMapping {
+
+ private final SupportLocationI init;
+
+ public PointsMappingEmpty(SupportLocationI init) {
+ this.init = init;
+ }
+
+ @Override
+ public int getInitialIdx(int _i) {
+ return _i;
+ }
+
+ @Override
+ public int[] getMapping() {
+ return null;
+ }
+
+ @Override
+ public int getPtsNb() {
+ return init.getPtsNb();
+ }
+
+ @Override
+ public double getPtX(int _i) {
+ return init.getPtX(_i);
+ }
+
+ @Override
+ public double getPtY(int _i) {
+ return init.getPtY(_i);
+ }
+}
Added: trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java
===================================================================
--- trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java (rev 0)
+++ trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,37 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.TestCase;
+import org.fudaa.ctulu.interpolation.SupportCoordinate;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class GisZoneCollectionPointDoublonRemoverTest extends TestCase {
+
+ public void testFilter() {
+ List<Coordinate> coords = new ArrayList<Coordinate>();
+ coords.add(new Coordinate(1, 2));
+ coords.add(new Coordinate(1, 2));//doublon
+ coords.add(new Coordinate(1, 3));
+ coords.add(new Coordinate(1, 5));
+ coords.add(new Coordinate(-100, 5));
+ int[] expected = new int[]{4, 0, 2, 3};
+
+ SupportCoordinate support = new SupportCoordinate((Coordinate[]) coords.toArray(new Coordinate[coords.size()]));
+ GisZoneCollectionPointDoublonRemover remover = new GisZoneCollectionPointDoublonRemover(support, 1e-1);
+ PointsMappingDefault createFiltered = remover.createFiltered(null);
+ assertNotNull(createFiltered);
+ assertEquals(coords.size() - 1, createFiltered.getPtsNb());
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], createFiltered.getInitialIdx(i));
+ }
+
+ }
+}
Modified: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -31,9 +31,9 @@
}
public boolean saveSimpleArray(OutputStream file, int[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = in;
- return save(file, toSave);
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
}
public boolean saveDouble(File file, double[] in) {
Deleted: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -1,62 +0,0 @@
-package org.fudaa.dodico.common.fortran;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import org.fudaa.ctulu.CtuluLibArray;
-
-import junit.framework.TestCase;
-import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
-
-public class DodicoDoubleArrayBinaryFileSaverTest extends TestCase {
-
- public void testWriteRead() {
- File des = null;
- try {
- des = File.createTempFile("test", ".bin");
- DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(des);
- Random random = new Random();
- Map<String, double[]> mapOfValues = generateMaps(random);
- boolean saved = saver.save(mapOfValues);
- assertTrue(saved);
- Map<String, double[]> loaded = saver.load();
- assertEquals(loaded.size(), mapOfValues.size());
- for (Entry<String, double[]> entry : loaded.entrySet()) {
- double[] ds = mapOfValues.get(entry.getKey());
- assertNotNull(ds);
- assertTrue(CtuluLibArray.equals(ds, entry.getValue(), 1e-15));
- }
-
- } catch (Exception e) {
- fail(e.getMessage());
- } finally {
- if (des != null) {
- des.delete();
- }
- }
- }
-
- private static Map<String, double[]> generateMaps(Random random) {
- Map<String, double[]> mapOfValues = new HashMap<String, double[]>();
- for (int i = 10; i < 20; i++) {
- String key = Integer.toString(i);
- double[] values = new double[i];
- for (int j = 0; j < values.length; j++) {
- values[j] = random.nextDouble() * 100;
- }
- values[values.length - 1] = 0;
- mapOfValues.put(key, values);
- }
- return mapOfValues;
- }
-
- public static void main(String[] args) {
- File f = new File(
- "/home/genesis/Devel/test-Fudaa-Prepro/edf/perf/casEdfRElectureVariable/export_partiel_cas180210_p10.res.1.2RC1.POST/Vue_2D_N_4.LAY/GRAPHES/Graphe_0_profil_spatial3136/COURBES/3.bin");
- DodicoDoubleArrayBinaryFileSaver saver=new DodicoDoubleArrayBinaryFileSaver(f);
- Map<String, double[]> load = saver.load();
- System.err.println("load "+load.size());
- }
-}
\ No newline at end of file
Copied: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java (from rev 7771, trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java)
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java (rev 0)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,64 @@
+package org.fudaa.dodico.fortran;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import org.fudaa.ctulu.CtuluLibArray;
+
+import junit.framework.TestCase;
+import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
+import org.fudaa.dodico.fortran.DodicoIntegerArrayBinaryFileSaverTest;
+
+public class DodicoDoubleArrayBinaryFileSaverTest extends TestCase {
+
+
+ public void testWriteRead() {
+ File des = null;
+ try {
+ des = File.createTempFile("test", ".bin");
+ DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(des);
+ Random random = new Random();
+ Map<String, double[]> mapOfValues = generateMaps(random);
+ boolean saved = saver.save(mapOfValues);
+ assertTrue(saved);
+ Map<String, double[]> loaded = saver.load();
+ assertEquals(loaded.size(), mapOfValues.size());
+ for (Entry<String, double[]> entry : loaded.entrySet()) {
+ double[] ds = mapOfValues.get(entry.getKey());
+ assertNotNull(ds);
+ assertTrue(CtuluLibArray.equals(ds, entry.getValue(), 1e-15));
+ }
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ } finally {
+ if (des != null) {
+ des.delete();
+ }
+ }
+ }
+
+ private static Map<String, double[]> generateMaps(Random random) {
+ Map<String, double[]> mapOfValues = new HashMap<String, double[]>();
+ for (int i = 10; i < 20; i++) {
+ String key = Integer.toString(i);
+ double[] values = new double[i];
+ for (int j = 0; j < values.length; j++) {
+ values[j] = random.nextDouble() * 100;
+ }
+ values[values.length - 1] = 0;
+ mapOfValues.put(key, values);
+ }
+ return mapOfValues;
+ }
+
+ public static void main(String[] args) {
+ File f = new File(
+ "/home/genesis/Devel/test-Fudaa-Prepro/edf/perf/casEdfRElectureVariable/export_partiel_cas180210_p10.res.1.2RC1.POST/Vue_2D_N_4.LAY/GRAPHES/Graphe_0_profil_spatial3136/COURBES/3.bin");
+ DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(f);
+ Map<String, double[]> load = saver.load();
+ System.err.println("load " + load.size());
+ }
+}
\ No newline at end of file
Modified: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -4,6 +4,10 @@
package org.fudaa.dodico.fortran;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
import org.fudaa.dodico.common.TestIO;
/**
@@ -27,14 +31,20 @@
}
File tempFile = createTempFile();
DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
- saver.save(tempFile, values);
- int[][] load = saver.load(tempFile);
- assertEquals(values.length, load.length);
- for (int i = 0; i < values.length; i++) {
- assertEquals(values[i].length, load[i].length);
- for (int j = 0; j < values[i].length; j++) {
- assertEquals(values[i][j], load[i][j]);
+ try {
+ OutputStream out = new FileOutputStream(tempFile);
+ saver.save(out, values);
+ InputStream in = new FileInputStream(tempFile);
+ int[][] load = saver.load(in);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i].length, load[i].length);
+ for (int j = 0; j < values[i].length; j++) {
+ assertEquals(values[i][j], load[i][j]);
+ }
}
+ } catch (Exception fileNotFoundException) {
+ fail(fileNotFoundException.getMessage());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-18 18:05:13
|
Revision: 8226
http://fudaa.svn.sourceforge.net/fudaa/?rev=8226&view=rev
Author: deniger
Date: 2013-01-18 18:05:03 +0000 (Fri, 18 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -204,7 +204,6 @@
}
Point2D ptImage1 = _ptImages[0];
Point2D ptReel1 = _ptReels[0];
- double dy = ptReel1.getY() - ptImage1.getY();
double distReel = _ptReels[0].distance(_ptReels[1]);
if (distReel < 1E-5) {
@@ -220,7 +219,7 @@
newPtImage[1] = _ptImages[1];
//y inverse
newPtImage[2] = new Point2D.Double(_ptImages[0].getX() - _ptImages[0].getY() + _ptImages[1].getY(),
- _ptImages[0].getY() + _ptImages[1].getX() - _ptImages[0].getX());
+ _ptImages[0].getY() - _ptImages[1].getX() + _ptImages[0].getX());
newPtReel[0] = _ptReels[0];
newPtReel[1] = _ptReels[1];
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -46,29 +46,27 @@
import org.fudaa.ebli.repere.AbstractCalque;
/**
- * Une classe de base pour tous les calques. Elle gere les transformations du repere et l'organisation des calques en
- * une hierarchie arborescente. Un calque peut etre de trois sortes:
- * <UL>
- * <LI>un groupe de calques: structurant, regroupant plusieurs calques ou familles de calques,
- * <LI>un calque d'affichage: calque representant des donnees a l'ecran,
- * <LI>un calque d'interaction: gerant les evenements exterieurs et generalement associe a un calque d'affichage (ex:
- * BCalqueDessin et BCalqueDessinInteraction).
- * </UL>
- *
+ * Une classe de base pour tous les calques. Elle gere les transformations du repere et l'organisation des calques en une hierarchie arborescente. Un
+ * calque peut etre de trois sortes: <UL> <LI>un groupe de calques: structurant, regroupant plusieurs calques ou familles de calques, <LI>un calque
+ * d'affichage: calque representant des donnees a l'ecran, <LI>un calque d'interaction: gerant les evenements exterieurs et generalement associe a un
+ * calque d'affichage (ex: BCalqueDessin et BCalqueDessinInteraction). </UL>
+ *
* @version $Id: BCalque.java,v 1.54 2007-05-04 13:49:42 deniger Exp $
* @author Guillaume Desnoix , Axel von Arnim
*/
public abstract class BCalque extends AbstractCalque implements Icon, BConfigurePaletteTargetInterface {
+
public static final Comparator createComparator() {
return new Comparator() {
-
@Override
public int compare(final Object _o1, final Object _o2) {
if ((_o1 instanceof BCalque) && (_o2 instanceof BCalque)) {
int i = ((BCalque) _o1).getTitle().compareTo(((BCalque) _o2).getTitle());
if ((i == 0) && (_o1 != _o2)) {
i = ((BCalque) _o1).getName().compareTo(((BCalque) _o2).getName());
- if (i == 0) { return _o1.hashCode() - _o2.hashCode(); }
+ if (i == 0) {
+ return _o1.hashCode() - _o2.hashCode();
+ }
}
return i;
}
@@ -80,55 +78,55 @@
public static BCalque findCalqueByName(final BCalque[] _cq, final String _name) {
if (_cq != null && _name != null) {
for (int i = 0; i < _cq.length; i++) {
- if (_name.equals(_cq[i].getName())) { return _cq[i]; }
+ if (_name.equals(_cq[i].getName())) {
+ return _cq[i];
+ }
}
}
return null;
}
-
+
/**
- *
- * @return true if the layer can be move up or down.
+ *
+ * @return true if the layer can be move up or down.
*/
- public boolean isMovable(){
+ public boolean isMovable() {
return true;
}
public static int findCalqueIdxByName(final BCalque[] _cq, final String _name) {
if (_cq != null && _name != null) {
for (int i = 0; i < _cq.length; i++) {
- if (_name.equals(_cq[i].getName())) { return i; }
+ if (_name.equals(_cq[i].getName())) {
+ return i;
+ }
}
}
return -1;
}
-
private boolean destructible_;
protected boolean titleModifiable_;
-
// Informations
/**
* Chaine affichee dans l'arbre des calques.
*/
private String title_;
- /** Le titre long affich\xE9 dans le tooltip de l'arbre des calques */
+ /**
+ * Le titre long affich\xE9 dans le tooltip de l'arbre des calques
+ */
private String longTitle_;
-
private transient GrMorphisme versEcran_;
-
private transient GrMorphisme versReel_;
-
EbliActionInterface[] actions_;
-
// Proprietes
protected boolean rapide_;
/**
- * Constructeur. Le constructeur initialise les transformations versEcran et versReel avec la transformation identite.
- * versEcran transforme les coordonnees reelles en coordonnees ecran et versReel fait l'inverse. versEcran sert a
- * l'affichage des objets et versReel a la gestion de la souris dans le repere reel.
+ * Constructeur. Le constructeur initialise les transformations versEcran et versReel avec la transformation identite. versEcran transforme les
+ * coordonnees reelles en coordonnees ecran et versReel fait l'inverse. versEcran sert a l'affichage des objets et versReel a la gestion de la
+ * souris dans le repere reel.
*/
protected BCalque() {
super();
@@ -143,9 +141,9 @@
}
/**
- * Methode de la classe Container surchargee. Elle est appelee lors de l'ajout d'un nouveau sous-calque. Elle
- * initialise les transformations versEcran et versReel aux valeurs du calque hote.
- *
+ * Methode de la classe Container surchargee. Elle est appelee lors de l'ajout d'un nouveau sous-calque. Elle initialise les transformations
+ * versEcran et versReel aux valeurs du calque hote.
+ *
* @param _comp calque a ajouter
* @param _constraints contraintes de layout
* @param _index indice dans la liste de calques
@@ -175,7 +173,7 @@
clip = new Rectangle(0, 0, getWidth(), getHeight());
}
return new GrBoite(new GrPoint(clip.x, clip.y, 0.), new GrPoint(clip.x + clip.width - 1, clip.y + clip.height - 1,
- 0.));
+ 0.));
}
protected Dimension getTargetDimension(final GrMorphisme _versEcran, final GrMorphisme _versReel) {
@@ -183,7 +181,9 @@
}
protected Dimension getTargetDimension(final GrMorphisme _versEcran, final GrMorphisme _versReel, final Dimension _d) {
- if (_versEcran == null) { return null; }
+ if (_versEcran == null) {
+ return null;
+ }
if (getVersEcran().isSame(_versEcran)) {
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.debug("ECA: target is same size");
@@ -227,8 +227,10 @@
for (int i = 0; i < nb; i++) {
// B.M. : Certains calques comportent des composants autres que des calques !!
// (BCalqueLegend entre autres).
- if ((getComponent(i) instanceof BCalque) &&
- !((BCalque) getComponent(i)).apply(_visitor)) { return false; }
+ if ((getComponent(i) instanceof BCalque)
+ && !((BCalque) getComponent(i)).apply(_visitor)) {
+ return false;
+ }
}
return true;
}
@@ -238,14 +240,12 @@
public JMenuItem createRenamerItem() {
return new BuMenuItem(BuResource.BU.getIcon("aucun"), BuResource.BU.getString("renommer")) {
-
@Override
protected void fireActionPerformed(final ActionEvent _event) {
super.fireActionPerformed(_event);
final BuTextField ft = new BuTextField(getTitle());
ft.setColumns(12);
final CtuluDialogPanel pn = new CtuluDialogPanel() {
-
@Override
public void apply() {
BCalque.this.setTitle(ft.getText());
@@ -278,13 +278,17 @@
/**
* Place le calque specifie en tete de la liste des fils.
- *
+ *
* @see #enPremier()
*/
public void descendre(final BCalque _c) {
- if (_c == null) { return; }
+ if (_c == null) {
+ return;
+ }
final Component[] cqs = getComponents();
- if (cqs == null) { return; }
+ if (cqs == null) {
+ return;
+ }
final int idx = CtuluLibArray.findObjectEgalEgal(cqs, _c);
if (idx >= 0 && idx < cqs.length - 1) {
add(_c, idx + 1);
@@ -294,11 +298,13 @@
/**
* Detruit ce calque. Equivalent a pere.detruire(this)
- *
+ *
* @see #detruire(BCalque)
*/
public void detruire() {
- if (!isDestructible()) { return; }
+ if (!isDestructible()) {
+ return;
+ }
final Container p = getParent();
if (p instanceof BCalque) {
((BCalque) p).detruire(this);
@@ -312,7 +318,7 @@
/**
* Detruit le calque specifie de la liste des fils.
- *
+ *
* @see #detruire()
*/
public void detruire(final BCalque _c) {
@@ -342,7 +348,7 @@
/**
* Place ce calque en fin de la liste des calques fils du pere. Equivalent a pere.enDernier(this)
- *
+ *
* @see #enDernier(BCalque)
*/
public void enDernier() {
@@ -354,19 +360,19 @@
/**
* Place le calque specifie en fin de la liste des fils.
- *
+ *
* @see #enDernier()
*/
public void enDernier(final BCalque _c) {
- if (_c == null) { return; }
+ if (_c == null) {
+ return;
+ }
add(_c);
_c.revalidate();
}
-
JMenuItem[] spec_;
protected void buildSpecificMenuItemsForAction(final List _l) {
-
}
public final JMenuItem[] getSpecificMenuItems() {
@@ -385,6 +391,13 @@
}
spec_ = (JMenuItem[]) l.toArray(new JMenuItem[l.size()]);
}
+ } else {
+ final EbliActionInterface[] act = getActions();
+ for (int i = 0; i < act.length; i++) {
+ if (act[i] != null) {
+ act[i].updateStateBeforeShow();
+ }
+ }
}
return spec_;
}
@@ -392,7 +405,7 @@
// Organisation
/**
* Place ce calque en tete de la liste des calques fils du pere. Equivalent a pere.enPremier(this)
- *
+ *
* @see #enPremier(BCalque)
*/
public void enPremier() {
@@ -404,7 +417,7 @@
/**
* Place le calque specifie en tete de la liste des fils.
- *
+ *
* @see #enPremier()
*/
public void enPremier(final BCalque _c) {
@@ -423,7 +436,7 @@
/**
* Renvoie le premier sous-calque de ce calque de nom donn\xE9.
- *
+ *
* @param _name Nom du sous calque.
* @return Le sous calque de nom donn\xE9. <i>null </i> si aucun sous calque ne porte ce nom.
* @deprecated
@@ -442,7 +455,7 @@
/**
* Renvoie le premier sous-calque de ce calque de nom donn\xE9.
- *
+ *
* @param _name Nom du sous calque.
* @return Le sous calque de nom donn\xE9. <i>null </i> si aucun sous calque ne porte ce nom.
*/
@@ -452,22 +465,26 @@
/**
* Renvoie le premier sous-calque de ce calque de nom donn\xE9.
- *
+ *
* @param _title Le titre du sous calque.
* @return Le sous calque de titre donn\xE9. <i>null </i> si aucun sous calque ne porte ce titre.
*/
public BCalque getCalqueParTitre(final String _title) {
- if (_title == null) { return null; }
+ if (_title == null) {
+ return null;
+ }
final BCalque[] cqs = getTousCalques();
for (int i = 0; i < cqs.length; i++) {
- if (_title.equals(cqs[i].getTitle())) { return cqs[i]; }
+ if (_title.equals(cqs[i].getTitle())) {
+ return cqs[i];
+ }
}
return null;
}
/**
* Renvoie les calques fils de ce calque.
- *
+ *
* @return les calques fils
* @see #getTousCalques()
*/
@@ -496,14 +513,14 @@
@Override
public BConfigurableInterface[] getConfigureInterfaces() {
- return new BConfigurableInterface[] { getSingleConfigureInterface() };
+ return new BConfigurableInterface[]{getSingleConfigureInterface()};
}
/**
- * Oblige de creer une m\xE9thode soeur a getForeground() pour la methode de BGroupeCalque. Dans la logique des calques,
- * la couleur d'un groupe est la couleur commune \xE0 ces calques fils. Or dans la logique de swing, la couleur d'un
- * composant (qui n'a pas de couleur) est celui de son p\xE8re. Dans ce cas, on boucle ...
- *
+ * Oblige de creer une m\xE9thode soeur a getForeground() pour la methode de BGroupeCalque. Dans la logique des calques, la couleur d'un groupe est la
+ * couleur commune \xE0 ces calques fils. Or dans la logique de swing, la couleur d'un composant (qui n'a pas de couleur) est celui de son p\xE8re. Dans
+ * ce cas, on boucle ...
+ *
* @return getForeground()
*/
public Color getCouleur() {
@@ -516,7 +533,7 @@
/**
* Renvoie le domaine (l'etendue) du contenu du calque. null si non significatif.
- *
+ *
* @return domaine en coordonnees reelles
*/
@Override
@@ -545,7 +562,7 @@
/**
* la hauteur de l'icone correspondant (vue de l'arbre).
- *
+ *
* @return 24
*/
@Override
@@ -555,7 +572,7 @@
/**
* Icone: la largeur de l'icone correspondant (vue de l'arbre).
- *
+ *
* @return 24
*/
@Override
@@ -569,7 +586,7 @@
/**
* Accesseur generique de propriete.
- *
+ *
* @param _name nom de la propriete a lire
* @return valeur de la propriete
*/
@@ -595,7 +612,7 @@
/**
* Renvoie tous les sous-calques de ce calque. parcourt toute l'arborescence des sous-calques jusqu'aux feuilles.
- *
+ *
* @return les sous-calques
* @see #getCalques()
*/
@@ -622,16 +639,14 @@
}
/**
- * Accesseur de la propriete versEcran. Elle est la matrice de transformation a appliquer lors de l'affichage du
- * calque.
+ * Accesseur de la propriete versEcran. Elle est la matrice de transformation a appliquer lors de l'affichage du calque.
*/
public GrMorphisme getVersEcran() {
return versEcran_;
}
/**
- * Accesseur de la propriete versReel. Elle est la matrice de transformation a appliquer lors de la lecture d'un
- * evenement souris par exemple.
+ * Accesseur de la propriete versReel. Elle est la matrice de transformation a appliquer lors de la lecture d'un evenement souris par exemple.
*/
public GrMorphisme getVersReel() {
return versReel_;
@@ -660,7 +675,7 @@
/**
* Indique si un calque peut etre detruit par l'utilisateur. Faux par defaut.
- *
+ *
* @return vrai si destructible
*/
public boolean isDestructible() {
@@ -677,9 +692,9 @@
}
/**
- * Accesseur de la propriete ajustement. Elle est envoyee par les beans de controle de repere comme
- * BTransformationGlissiere pour preciser que l'evenement repere associe est intermediaire. Ceci permet de passer en
- * mode rapide pour l'affichage des calques lors des rafales d'evenements repere.
+ * Accesseur de la propriete ajustement. Elle est envoyee par les beans de controle de repere comme BTransformationGlissiere pour preciser que
+ * l'evenement repere associe est intermediaire. Ceci permet de passer en mode rapide pour l'affichage des calques lors des rafales d'evenements
+ * repere.
*/
public boolean isRapide() {
return rapide_;
@@ -692,13 +707,14 @@
public boolean isTitleModifiable() {
return titleModifiable_;
}
-
+
/**
- * Definit si le titre peut etre modifie depuis l'arbre des calques
+ * Definit si le titre peut etre modifie depuis l'arbre des calques
+ *
* @param _b True : Il peut l'etre.
*/
public void setTitleModifiable(boolean _b) {
- titleModifiable_=_b;
+ titleModifiable_ = _b;
}
@Override
@@ -715,11 +731,13 @@
/**
* Place le calque specifie en tete de la liste des fils.
- *
+ *
* @see #enPremier()
*/
public void monter(final BCalque _c) {
- if (_c == null) { return; }
+ if (_c == null) {
+ return;
+ }
final int idx = CtuluLibArray.findObjectEgalEgal(getComponents(), _c);
if (idx > 0) {
add(_c, idx - 1);
@@ -741,23 +759,22 @@
}
public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
- final GrBoite _clipReel) {
- /*
- * if(isVisible()) paint(_g);
- */
+ final GrBoite _clipReel) {
+ /*
+ * if(isVisible()) paint(_g);
+ */
}
@Override
public void paintComponent(final Graphics _g) {
- // super.paintComponent(_g);
- // surchargee dans chaque calque
+ // super.paintComponent(_g);
+ // surchargee dans chaque calque
}
/**
* Dessin de l'icone.
- *
- * @param _c composant dont l'icone peut utiliser des proprietes (couleur, ...). Ce parametre est le calque lui-meme.
- * Il est ignore ici.
+ *
+ * @param _c composant dont l'icone peut utiliser des proprietes (couleur, ...). Ce parametre est le calque lui-meme. Il est ignore ici.
* @param _g le graphics sur lequel dessiner l'icone
* @param _x lieu cible de l'icone (x)
* @param _y lieu cible de l'icone (y)
@@ -798,7 +815,7 @@
/**
* repaint apres un delai.
- *
+ *
* @param _tm delai en millisecondes
*/
@Override
@@ -850,12 +867,12 @@
@Override
public void setOpaque(final boolean _isOpaque) {
- // super.setOpaque(_isOpaque);
+ // super.setOpaque(_isOpaque);
}
/**
* Affectation generique de propriete.
- *
+ *
* @param _name nom de la propriete a modifier
* @param _value nouvelle valeur
*/
@@ -872,7 +889,8 @@
try {
z = (Class) (z.getField("TYPE").get(z));
- } catch (final Exception ey) {}
+ } catch (final Exception ey) {
+ }
final Class[] c = new Class[1];
final Class thisClass = getClass();
Method m = null;
@@ -885,9 +903,8 @@
res = false;
}
z = z.getSuperclass();
- }
- while ((m == null) && (z != null));
- final Object[] o = new Object[] { _value };
+ } while ((m == null) && (z != null));
+ final Object[] o = new Object[]{_value};
if (m != null) {
m.invoke(this, o);
res = true;
@@ -937,14 +954,15 @@
}
return false;
}
-
+
/**
* Definit le titre long, affich\xE9 en tooltip dans l'arbre des calques.
+ *
* @param _title Le nouveau titre long. Peut \xEAtre null.
* @return true si changement.
*/
public boolean setLongTitle(final String _title) {
- if (_title != longTitle_ || (_title!=null && !_title.equals(longTitle_))) {
+ if (_title != longTitle_ || (_title != null && !_title.equals(longTitle_))) {
final String old = longTitle_;
longTitle_ = _title;
firePropertyChange("longTitle", old, longTitle_);
@@ -954,13 +972,12 @@
}
/**
- * @return Le titre long, affich\xE9 en tooltip dans l'arbre des calques. null si aucun
- * titre long d\xE9fini.
+ * @return Le titre long, affich\xE9 en tooltip dans l'arbre des calques. null si aucun titre long d\xE9fini.
*/
public String getLongTitle() {
return longTitle_;
}
-
+
/**
* Affectation de la propriete versEcran. Cette affectation est appliquee aux calques fils.
*/
@@ -1001,28 +1018,32 @@
/**
* Controle si tous les calques descendants sont visible.
- *
+ *
* @return Vrai si tous les calques descendants sont visibles.
*/
public boolean isAllChildrenVisible() {
BCalque[] cqs = getTousCalques();
// Le calque d'indice 0 est le calque courant.
for (int i = 1; i < cqs.length; i++) {
- if (!cqs[i].isVisible()) return false;
+ if (!cqs[i].isVisible()) {
+ return false;
+ }
}
return true;
}
/**
* Controle si tous les calques descendants sont invisible.
- *
+ *
* @return Vrai si tous les calques descendants sont invisibles.
*/
public boolean isAllChildrenUnvisible() {
BCalque[] cqs = getTousCalques();
// Le calque d'indice 0 est le calque courant.
for (int i = 1; i < cqs.length; i++) {
- if (cqs[i].isVisible()) return false;
+ if (cqs[i].isVisible()) {
+ return false;
+ }
}
return true;
}
@@ -1038,5 +1059,4 @@
}
return r;
}
-
}
\ No newline at end of file
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -636,7 +636,7 @@
}
public final void setDefaultCursor() {
- setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ setCursor(getDefaultCursor());
}
public final void setListener(final BCalqueContextuelListener _listener) {
@@ -793,4 +793,8 @@
public void zoomOut() {
zoom(true);
}
+
+ public Cursor getDefaultCursor() {
+ return new Cursor(Cursor.CROSSHAIR_CURSOR);
+ }
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -46,6 +46,7 @@
*/
public abstract class ZCalqueSelectionInteractionAbstract extends BCalqueInteraction implements MouseListener, ZCatchListener,
MouseMotionListener, KeyListener, ZCalqueAffichageInterface {
+ public static final int DEFAULT_TOLERANCE_PIXEL = 4;
// Modes de s\xE9lection
/**
@@ -167,7 +168,7 @@
plHelper_ = new GrPolyligne();
plHelper_.sommets_ = listePoints_;
enCours_ = false;
- tolerancePixel_ = 4;
+ tolerancePixel_ = DEFAULT_TOLERANCE_PIXEL;
modificateur_ = new EbliSelectionState();
modificateur_.setXor(true);
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -253,7 +253,14 @@
EbliLib.cleanListener(navigationActionGroup_);
EbliLib.cleanListener(specificActionGroup_);
EbliLib.cleanListener(standardActionGroup_);
+ }
+ public Cursor getDefautCursor() {
+ if (cqInteractionActif_ != null && !cqInteractionActif_.isGele()) {
+ return cqInteractionActif_.getSpecificCursor();
+ }
+
+ return getView().getVueCalque().getDefaultCursor();
}
private void activeActionForSelectedLayer() {
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2013-01-18 18:04:25 UTC (rev 8225)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2013-01-18 18:05:03 UTC (rev 8226)
@@ -98,6 +98,7 @@
}
}
private String state_;
+ private boolean displayInfo = true;
// protected ZAttributeEditorMapper attrEditors_ = new
// ZAttributeEditorMapper();
BuDesktop desktop_;
@@ -110,6 +111,14 @@
protected BPaletteEdition palette_;
ZEbliCalquesPanel panel_;
+ public boolean isDisplayInfo() {
+ return displayInfo;
+ }
+
+ public void setDisplayInfo(boolean displayInfo) {
+ this.displayInfo = displayInfo;
+ }
+
// ZEditorRotationPanel pnRotation_=null;
public final EbliActionSimple getActionCancel() {
return actionCancel_;
@@ -666,7 +675,9 @@
final String msg = EbliLib.getS("point ajout\xE9: {0}", _pt.toString());
FuLog.warning("MOD:" + msg);
editorPanel_.objectAdded();
- getUi().message(null, msg, true);
+ if (displayInfo) {
+ getUi().message(null, msg, true);
+ }
}
return r;
}
@@ -684,7 +695,9 @@
final String msg = EbliLib.getS("ligne ferm\xE9e avec {0} sommets ajout\xE9e", Integer.toString(_pt.sommets_.nombre()));
FuLog.warning("MOD:" + msg);
editorPanel_.objectAdded();
- getUi().message(null, msg, true);
+ if (displayInfo) {
+ getUi().message(null, msg, true);
+ }
}
return r;
}
@@ -703,7 +716,9 @@
final String msg = EbliLib.getS("{0} points ajout\xE9s", Integer.toString(_pt.sommets_.nombre()));
FuLog.warning("MOD:" + msg);
editorPanel_.objectAdded();
- getUi().message(null, msg, true);
+ if (displayInfo) {
+ getUi().message(null, msg, true);
+ }
}
return r;
}
@@ -722,7 +737,9 @@
final String msg = EbliLib.getS("ligne ouverte avec {0} sommets ajout\xE9e", Integer.toString(_pt.sommets_.nombre()));
FuLog.warning("MOD:" + msg);
editorPanel_.objectAdded();
- getUi().message(null, msg, true);
+ if (displayInfo) {
+ getUi().message(null, msg, true);
+ }
}
return r;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-21 10:50:32
|
Revision: 8232
http://fudaa.svn.sourceforge.net/fudaa/?rev=8232&view=rev
Author: deniger
Date: 2013-01-21 10:50:25 +0000 (Mon, 21 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-fu/src/main/java/com/memoire/fu/FuLog.java
trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntitePanel.java
trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntiteTableModel.java
trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoFiltreController.java
Modified: trunk/framework/ctulu-fu/src/main/java/com/memoire/fu/FuLog.java
===================================================================
--- trunk/framework/ctulu-fu/src/main/java/com/memoire/fu/FuLog.java 2013-01-21 10:03:36 UTC (rev 8231)
+++ trunk/framework/ctulu-fu/src/main/java/com/memoire/fu/FuLog.java 2013-01-21 10:50:25 UTC (rev 8232)
@@ -251,7 +251,7 @@
boolean header = (r.msg_ != null) && (r.msg_.length() >= 4) && (r.msg_.charAt(3) == ':');
- StringBuffer sb = new StringBuffer(256);
+ StringBuilder sb = new StringBuilder(256);
sb.append(header ? r.msg_.substring(0, 4) : "???:");
sb.append(' ');
@@ -349,7 +349,6 @@
}
}
- System.err.println(sb.toString());
if (LOGSTREAM != null) {
LOGSTREAM.println(sb.toString());
}
Modified: trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntitePanel.java
===================================================================
--- trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntitePanel.java 2013-01-21 10:03:36 UTC (rev 8231)
+++ trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntitePanel.java 2013-01-21 10:50:25 UTC (rev 8232)
@@ -1,9 +1,9 @@
/**
- * @creation 13 mai 2003
- * @modification $Date: 2007-06-28 09:28:19 $
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
- * @mail fud...@li...
+ * @creation 13 mai 2003
+ * @modification $Date: 2007-06-28 09:28:19 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @mail fud...@li...
*/
package org.fudaa.fudaa.fdico;
@@ -59,16 +59,34 @@
* @version $Id: FDicoEntitePanel.java,v 1.32 2007-06-28 09:28:19 deniger Exp $
*/
public class FDicoEntitePanel extends BuSplit2Pane implements ActionListener, CtuluUndoRedoInterface,
- CtuluPopupListener.PopupReceiver {
+ CtuluPopupListener.PopupReceiver {
+
+ public FDicoFiltreController updateFilters() {
+ FDicoFiltreController old = tableModel_.getFiltreController();
+ final FDicoFiltreController filtre = new FDicoFiltreController();
+ findFiltre_ = new FDicoFiltreChooserName();
+ filtre.add(findFiltre_);
+ filtre.add(new FDicoFiltreChooserModified(tableModel_.getParams()));
+ if (filtreNiveau) {
+ filtre.add(new FDIcoFiltreChooserMode());
+ }
+ filtre.add(new FDicoFiltreChooserRubrique(tableModel_.getParams()));
+ if (old != null) {
+ filtre.setTargetPanel(old.getTargetPanel());
+ }
+ tableModel_.setFiltreController(filtre);
+ return filtre;
+ }
/**
* @author Fred Deniger
* @version $Id: FDicoEntitePanel.java,v 1.32 2007-06-28 09:28:19 deniger Exp $
*/
class DecoratorCellRenderer implements CtuluCellDecorator {
-
- public void decore(final JComponent _cmp, final JList _list, final Object _value, final int _index) {}
-
+
+ public void decore(final JComponent _cmp, final JList _list, final Object _value, final int _index) {
+ }
+
public void decore(final JComponent _cmp, final JTable _table, final Object _value, final int _row, final int _col) {
final boolean b = tableModel_.isValide(_row);
final DicoEntite e = tableModel_.getEntite(_row);
@@ -82,22 +100,23 @@
} else {
_cmp.setForeground(Color.black);
}
-
+
final FDicoTableColumnIdentifier id = (FDicoTableColumnIdentifier) _table.getColumnModel().getColumn(_col)
- .getIdentifier();
-
+ .getIdentifier();
+
if ((id != FDicoTableColumnIdentifier.COLUMN_VALEUR) && (tableModel_.getParams().getComment(e) != null)
- && (_cmp instanceof JLabel)) {
+ && (_cmp instanceof JLabel)) {
final String txt = ((JLabel) _cmp).getText();
((JLabel) _cmp).setText("<html><u>" + txt + "</u></html>");
}
}
}
-
+
final class DecoratorModifiedCellRenderer implements CtuluCellDecorator {
-
- public void decore(final JComponent _cmp, final JList _list, final Object _value, final int _index) {}
-
+
+ public void decore(final JComponent _cmp, final JList _list, final Object _value, final int _index) {
+ }
+
public void decore(final JComponent _cmpc, final JTable _table, final Object _value, final int _row, final int _col) {
final DicoEntite e = tableModel_.getEntite(_row);
if (tableModel_.getParams().isValueSetFor(e)) {
@@ -107,9 +126,9 @@
}
}
}
-
+
class DecoratorValueCellRenderer extends DecoratorCellRenderer {
-
+
public void decore(final JComponent _cmp, final JTable _table, final Object _value, final int _row, final int _col) {
super.decore(_cmp, _table, _value, _row, _col);
final DicoEntite e = tableModel_.getEntite(_row);
@@ -124,41 +143,35 @@
}
}
}
-
+
private class PanelInfo extends BuTabbedPane implements DicoParamsListener, FDicoEntiteTableModel.CommentForwader {
-
+
JButton btComportAffichage_;
-
JButton btEditer_;
-
JButton btInitialiser_;
-
JLabel lbNom_;
-
BuTextArea txtAreaHelp_;
-
BuTextArea txtComment_;
-
JLabel txtDefault_;
-
JLabel txtError_;
-
JLabel txtRubrique_;
-
JLabel txtValue_;
-
- public void dicoParamsVersionChanged(final DicoParams _cas) {}
-
+
+ @Override
+ public void dicoParamsVersionChanged(final DicoParams _cas) {
+ updateFilters();
+ }
+
PanelInfo(final boolean _comment, final boolean _keywordLie) {
init(_comment, _keywordLie);
}
-
+
public void dicoParamsEntiteCommentUpdated(final DicoParams _cas, final DicoEntite _ent) {
if (_ent == lastEntiteSelected_) {
refreshValue();
}
}
-
+
private void clearComportButton() {
if (btComportAffichage_ != null) {
btComportAffichage_.setForeground(Color.black);
@@ -166,7 +179,7 @@
btComportAffichage_.setText(FDicoLib.getS("aucun"));
}
}
-
+
private void init(final boolean _comment, final boolean _kwTied) {
final BuPanel main = new BuPanel();
main.setLayout(new BuBorderLayout(3, 3, true, true));
@@ -205,7 +218,7 @@
clearComportButton();
pnLabels.add(btComportAffichage_);
}
-
+
main.add(pnLabels, BuBorderLayout.CENTER);
final JPanel pnButtons = new BuPanel();
pnButtons.setLayout(new BuVerticalLayout());
@@ -234,7 +247,6 @@
return;
}
txtComment_ = new BuTextArea() {
-
protected void processFocusEvent(final FocusEvent _evt) {
if (_evt.getID() == FocusEvent.FOCUS_LOST) {
saveCurrentComment();
@@ -249,9 +261,8 @@
*/
txtComment_.setEditable(false);
txtComment_.setToolTipText(FDicoLib
- .getS("Pour \xE9diter le commentaire, double-cliquer sur le mot-cl\xE9 ou sur cette zone"));
+ .getS("Pour \xE9diter le commentaire, double-cliquer sur le mot-cl\xE9 ou sur cette zone"));
txtComment_.addMouseListener(new MouseAdapter() {
-
public void mouseClicked(final MouseEvent _e) {
if (_e.getClickCount() == 2 && lastEntiteSelected_ != null) {
showHelpComment(lastEntiteSelected_);
@@ -260,7 +271,7 @@
});
final BuPanel pn = new BuPanel();
pn.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), BorderFactory
- .createEtchedBorder()));
+ .createEtchedBorder()));
pn.setLayout(new BuBorderLayout(2, 2, true, true));
js = new BuScrollPane(txtComment_);
js.setPreferredWidth(100);
@@ -299,7 +310,7 @@
clearComportButton();
}
}
-
+
void clearPanel() {
lbNom_.setText(CtuluLibString.EMPTY_STRING);
txtAreaHelp_.setText(CtuluLibString.EMPTY_STRING);
@@ -316,29 +327,31 @@
}
clearComportButton();
}
-
+
public void dicoParamsEntiteAdded(final DicoParams _cas, final DicoEntite _ent) {
if (_ent == lastEntiteSelected_) {
refreshValue();
}
}
-
+
public void dicoParamsEntiteRemoved(final DicoParams _cas, final DicoEntite _ent, final String _oldValue) {
if (_ent == lastEntiteSelected_) {
refreshValue();
}
}
-
+
public void dicoParamsEntiteUpdated(final DicoParams _cas, final DicoEntite _ent, final String _oldValue) {
if (_ent == lastEntiteSelected_) {
refreshValue();
}
}
-
- public void dicoParamsProjectModifyStateChanged(final DicoParams _cas) {}
-
- public void dicoParamsStateLoadedEntiteChanged(final DicoParams _cas, final DicoEntite _ent) {}
-
+
+ public void dicoParamsProjectModifyStateChanged(final DicoParams _cas) {
+ }
+
+ public void dicoParamsStateLoadedEntiteChanged(final DicoParams _cas, final DicoEntite _ent) {
+ }
+
public void dicoParamsValidStateEntiteUpdated(final DicoParams _cas, final DicoEntite _ent) {
if (_ent == lastEntiteSelected_) {
refreshValue();
@@ -375,37 +388,26 @@
txtAreaHelp_.setCaretPosition(0);
txtRubrique_.setText(lastEntiteSelected_.getRubrique());
txtDefault_.setText(lastEntiteSelected_.getDefautValue());
-
+
}
}
-
+
public final void saveCurrentComment() {
if ((txtComment_ != null) && (lastEntiteSelected_ != null)) {
tableModel_.setCommentaire(lastEntiteSelected_, txtComment_.getText());
}
}
}
-
EbliActionSimple actionDefaultSelected_;
-
EbliActionSimple actionEditerSelected_;
-
FDicoTableColumnIdentifier.ColumnManager colMng_;
-
FDicoTableColumnIdentifier.ColumnModelWithoutException colModel_;
-
FDicoFiltreChooserName findFiltre_;
-
DicoEntite lastEntiteSelected_;
-
PanelInfo pnInfos_;
-
BuPanel pnTable_;
-
JTable table_;
-
FDicoEntiteTableModel tableModel_;
-
JTextField txtFind_;
/**
@@ -419,17 +421,17 @@
* @param _model le model pour les mot-cles
*/
public FDicoEntitePanel(final FDicoEntiteTableModel _model, final boolean _comment, final boolean _kwTied,
- final boolean _filtreNiveau) {
+ final boolean _filtreNiveau) {
this(_model, null, _comment, _kwTied, _filtreNiveau);
}
-
+
public FDicoEntitePanel(final FDicoEntiteTableModel _model, final Component _leftUp) {
this(_model, _leftUp, true, true, true);
}
/**
* Permet d'editer le commentaire et d'afficher l'aide du mot-cle passe en parametres.
- *
+ *
* @param _entite le mot-cle concerne
*/
protected void showHelpComment(final DicoEntite _entite) {
@@ -465,48 +467,48 @@
pn.setLayout(new BuBorderLayout());
pn.add(pane, BuBorderLayout.CENTER);
if (CtuluDialogPanel.isOkResponse(pn.afficheModale(CtuluLibSwing.getFrameAncestorHelper(this), _entite.getNom()))
- && (txtComment != null) && txtComment.isEditable()) {
+ && (txtComment != null) && txtComment.isEditable()) {
tableModel_.setCommentaire(lastEntiteSelected_, txtComment.getText());
}
}
+ private boolean filtreNiveau;
/**
* @param _model le model pour les mot-cles
* @param _leftUp un composant qui sera ajoute en haut a gauche (si non null)
*/
public FDicoEntitePanel(final FDicoEntiteTableModel _model, final Component _leftUp, final boolean _comment,
- final boolean _keywordLie, final boolean _fitreNiveau) {
+ final boolean _keywordLie, final boolean _fitreNiveau) {
+ this.filtreNiveau = _fitreNiveau;
tableModel_ = _model;
final TableCellRenderer valueRenderer = FDicoTableRendererChooser.createCellRendererChooser(tableModel_,
- new DecoratorValueCellRenderer());
+ new DecoratorValueCellRenderer());
final TableCellEditor valueEditor = FDicoTableEditorChooser.createCellEditorChooser(tableModel_);
final CtuluCellRenderer defaultRenderer = new CtuluCellTextRenderer(new DecoratorCellRenderer());
final CtuluCellButtonEditor nomEditor = new CtuluCellButtonEditor(null) {
-
public Component getTableCellEditorComponent(final JTable _table, final Object _value, final boolean _isSelected,
- final int _row, final int _column) {
+ final int _row, final int _column) {
final Component c = super.getTableCellEditorComponent(_table, _value, _isSelected, _row, _column);
super.value_ = tableModel_.getEntite(_row);
return c;
}
-
+
protected void doAction() {
showHelpComment((DicoEntite) super.value_);
}
};
nomEditor.setDoubleClick(true);
colMng_ = new FDicoTableColumnIdentifier.ColumnManager(defaultRenderer, new CtuluCellTextRenderer(
- new DecoratorModifiedCellRenderer()), valueRenderer, valueEditor, nomEditor);
+ new DecoratorModifiedCellRenderer()), valueRenderer, valueEditor, nomEditor);
colModel_ = colMng_.createColModel();
table_ = new JTable(tableModel_, colModel_) {
-
public String getToolTipText(final MouseEvent _event) {
final java.awt.Point p = _event.getPoint();
final int rowIndex = rowAtPoint(p);
final int colIndex = convertColumnIndexToModel(columnAtPoint(p));
return tableModel_.getTooltip(rowIndex, colIndex);
}
-
+
public void tableChanged(final TableModelEvent _evt) {
if (getCellEditor() != null) {
getCellEditor().cancelCellEditing();
@@ -527,7 +529,6 @@
CtuluPopupListener l = new CtuluPopupListener(this, table_);
// table_.addMouseListener(l);
final ListSelectionModel tableSelectionModel = new DefaultListSelectionModel() {
-
public void fireValueChanged(final int _f, final int _l, final boolean _isAdjusting) {
super.fireValueChanged(_f, _l, _isAdjusting);
if ((!_isAdjusting)) {
@@ -536,15 +537,14 @@
}
};
actionEditerSelected_ = new EbliActionSimple(BuResource.BU.getString("Editer"), BuResource.BU.getIcon("editer"),
- "EDIT") {
-
+ "EDIT") {
public void actionPerformed(final ActionEvent _ae) {
if (lastEntiteSelected_ == null) {
return;
}
final int i = tableModel_.getEntiteRow(lastEntiteSelected_);
if (i >= 0
- && table_.editCellAt(i, table_.getColumnModel().getColumnIndex(FDicoTableColumnIdentifier.COLUMN_VALEUR))) {
+ && table_.editCellAt(i, table_.getColumnModel().getColumnIndex(FDicoTableColumnIdentifier.COLUMN_VALEUR))) {
final Component c = table_.getEditorComponent();
c.requestFocus();
if (c instanceof AbstractButton) {
@@ -554,8 +554,7 @@
}
};
actionDefaultSelected_ = new EbliActionSimple(FudaaLib.getS("Initialiser"), BuResource.BU.getIcon("enlever"),
- "DELETE") {
-
+ "DELETE") {
public void actionPerformed(final ActionEvent _ae) {
if ((table_.isEditing()) && (table_.getCellEditor() != null)) {
table_.getCellEditor().stopCellEditing();
@@ -587,19 +586,11 @@
table_.setSelectionModel(tableSelectionModel);
tableModel_.setTableSelectionModel(tableSelectionModel);
final FDicoTableSortIndicator sortIndicator = new FDicoTableSortIndicator(table_, BuResource.BU
- .getIcon("bu_menu_down"), BuResource.BU.getIcon("bu_menu_up"));
+ .getIcon("bu_menu_down"), BuResource.BU.getIcon("bu_menu_up"));
sortIndicator.getSortDescription().setColumnSorted(
- colModel_.findColumnWithIdentifierFast(FDicoTableColumnIdentifier.COLUMN_NOM));
+ colModel_.findColumnWithIdentifierFast(FDicoTableColumnIdentifier.COLUMN_NOM));
table_.getTableHeader().addMouseListener(l);
- final FDicoFiltreController filtre = new FDicoFiltreController();
- findFiltre_ = new FDicoFiltreChooserName();
- filtre.add(findFiltre_);
- filtre.add(new FDicoFiltreChooserModified(_model.getParams()));
- if (_fitreNiveau) {
- filtre.add(new FDIcoFiltreChooserMode());
- }
- filtre.add(new FDicoFiltreChooserRubrique(_model.getParams()));
- tableModel_.setFiltreController(filtre);
+ FDicoFiltreController filtre = updateFilters();
tableModel_.setSortIndicator(sortIndicator);
tableModel_.show();
pnTable_ = new BuPanel();
@@ -621,8 +612,8 @@
if (_leftUp != null) {
left.add(_leftUp);
}
- filtre.buildPanel(left);
- // JPanel pn= filtre.buildPanel();
+ filtre.setTargetPanel(left);
+ // JPanel pn= filtre.setTargetPanel();
left.setPreferredSize(new Dimension(150, 500));
setLeftComponent(left);
setOneTouchExpandable(true);
@@ -643,14 +634,14 @@
setPreferredSize(new Dimension(400, 450));
resetToPreferredSizes();
}
-
+
protected void saveLastModification() {
if (table_.getCellEditor() != null) {
table_.getCellEditor().stopCellEditing();
}
pnInfos_.saveCurrentComment();
}
-
+
protected void saveView() {
for (final Iterator it = FDicoTableColumnIdentifier.IDENTIFIERS.iterator(); it.hasNext();) {
final FDicoTableColumnIdentifier colId = (FDicoTableColumnIdentifier) it.next();
@@ -663,7 +654,7 @@
}
}
}
-
+
void refreshSelectionEntite() {
final ListSelectionModel select = table_.getSelectionModel();
final int lead = select.getLeadSelectionIndex();
@@ -687,7 +678,7 @@
}
}
}
-
+
public void popup(MouseEvent _evt) {
// create the popupmenu
final CtuluPopupMenu menu = new CtuluPopupMenu();
@@ -714,7 +705,7 @@
}
menu.show(_evt.getComponent(), _evt.getX(), _evt.getY());
}
-
+
public void actionPerformed(final ActionEvent _evt) {
// mis en place d'un filtre temporaire.
if ((pnInfos_ != null) && (_evt.getSource() == pnInfos_.btComportAffichage_)) {
@@ -746,7 +737,7 @@
}
}
}
-
+
public void activeFind() {
if (txtFind_ == null) {
final JComponent leftCp = getLeftComponent();
@@ -769,17 +760,17 @@
txtFind_.requestFocus();
}
}
-
+
public void clearCmd(final CtuluCommandManager _source) {
if (tableModel_.getCmdMng() != _source) {
tableModel_.getCmdMng().clean();
}
}
-
+
public CtuluCommandManager getCmdMng() {
return tableModel_.getCmdMng();
}
-
+
public JTable getTable() {
return table_;
}
@@ -802,7 +793,7 @@
table_.setColumnSelectionInterval(i, i);
}
}
-
+
public void setTxtAreaHelpVisible(boolean _b) {
if (_b && (pnInfos_ == null)) {
pnInfos_ = new PanelInfo(true, true);
@@ -814,4 +805,4 @@
pnInfos_ = null;
}
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntiteTableModel.java
===================================================================
--- trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntiteTableModel.java 2013-01-21 10:03:36 UTC (rev 8231)
+++ trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoEntiteTableModel.java 2013-01-21 10:50:25 UTC (rev 8232)
@@ -64,6 +64,12 @@
commentForwarder_ = _f;
}
+ public FDicoFiltreController getFiltreController() {
+ return filtreController_;
+ }
+
+
+
public void setFiltreController(final FDicoFiltreController _c) {
if (filtreController_ != null) {
filtreController_.setListener(null);
@@ -79,9 +85,6 @@
return projet_.getDicoParams().getInvalidMessage(_e);
}
- public FDicoFiltreController getFiltreController() {
- return filtreController_;
- }
public void setTableSelectionModel(final ListSelectionModel _listSelection) {
listSelection_ = _listSelection;
Modified: trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoFiltreController.java
===================================================================
--- trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoFiltreController.java 2013-01-21 10:03:36 UTC (rev 8231)
+++ trunk/framework/fudaa-dico/ui/src/main/java/org/fudaa/fudaa/fdico/FDicoFiltreController.java 2013-01-21 10:50:25 UTC (rev 8232)
@@ -25,6 +25,7 @@
import javax.swing.ListCellRenderer;
import com.memoire.bu.BuVerticalLayout;
+import javax.swing.JComponent;
import org.fudaa.ctulu.gui.CtuluCellTextRenderer;
@@ -35,13 +36,16 @@
* @version $Id: FDicoFiltreController.java,v 1.12 2007-05-04 13:59:04 deniger Exp $
*/
public class FDicoFiltreController implements Observer, FDicoFiltre, ActionListener {
+
/**
* @author fred deniger
* @version $Id: FDicoFiltreController.java,v 1.12 2007-05-04 13:59:04 deniger Exp $
*/
- static final class FiltreCellRenderer extends CtuluCellTextRenderer {
+ static final class FiltreCellRenderer extends CtuluCellTextRenderer {
+
+ @Override
public Component getListCellRendererComponent(JList _list, Object _value, int _index, boolean _isSelected,
- boolean _cellHasFocus) {
+ boolean _cellHasFocus) {
super.getListCellRendererComponent(_list, _value, _index, _isSelected, _cellHasFocus);
setToolTipText((String) _value);
return this;
@@ -49,6 +53,7 @@
}
public interface FiltreControllerListener {
+
void controllerChanged();
void controllerMoreRestrictive(FDicoFiltre _f);
@@ -102,13 +107,27 @@
}
}
}
+ private JPanel targetPanel;
- public void buildPanel(final JPanel _p) {
+ public JPanel getTargetPanel() {
+ return targetPanel;
+ }
+
+ public void setTargetPanel(final JPanel _p) {
+ this.targetPanel = _p;
final ListCellRenderer renderer = new FiltreCellRenderer();
final Font f = new Font("SansSerif", Font.PLAIN, 10);
+ Component[] components = _p.getComponents();
+ for (Component component : components) {
+ if (Boolean.TRUE.equals(((JComponent) component).getClientProperty("IS_FILTER"))) {
+ _p.remove(component);
+ }
+ }
for (final Iterator it = filtreChoosers_.iterator(); it.hasNext();) {
final FDicoFiltreChooserAbstract filtre = (FDicoFiltreChooserAbstract) it.next();
- _p.add(filtre.buildPanel(f, renderer));
+ final JPanel buildPanel = filtre.buildPanel(f, renderer);
+ buildPanel.putClientProperty("IS_FILTER", Boolean.TRUE);
+ _p.add(buildPanel);
}
}
@@ -116,7 +135,7 @@
public JPanel buildPanel() {
final JPanel r = new JPanel();
r.setLayout(new BuVerticalLayout(5, true, false));
- buildPanel(r);
+ setTargetPanel(r);
return r;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-23 22:45:44
|
Revision: 8248
http://fudaa.svn.sourceforge.net/fudaa/?rev=8248&view=rev
Author: deniger
Date: 2013-01-23 22:45:35 +0000 (Wed, 23 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectTableModel.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2013-01-23 21:45:29 UTC (rev 8247)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2013-01-23 22:45:35 UTC (rev 8248)
@@ -43,6 +43,7 @@
import com.memoire.fu.FuLog;
import com.vividsolutions.jts.geom.Geometry;
import java.util.Date;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.fudaa.ctulu.gis.GISDataModelFeatureAdapter;
@@ -214,9 +215,9 @@
StringBuilder sb = new StringBuilder();
if (value instanceof GISAttributeModel) {
GISAttributeModel md = (GISAttributeModel) value;
- sb.append('{').append(StringUtils.replace(md.getObjectValueAt(0).toString(), GISDataModelFeatureAdapter.VALUE_SEPARATOR, GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING));
+ sb.append('{').append(StringUtils.replace(ObjectUtils.toString(md.getObjectValueAt(0)), GISDataModelFeatureAdapter.VALUE_SEPARATOR, GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING));
for (int k = 1; k < md.getSize(); k++) {
- sb.append(',').append(StringUtils.replace(md.getObjectValueAt(k).toString(), GISDataModelFeatureAdapter.VALUE_SEPARATOR, GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING));
+ sb.append(',').append(StringUtils.replace(ObjectUtils.toString(md.getObjectValueAt(k)), GISDataModelFeatureAdapter.VALUE_SEPARATOR, GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING));
}
sb.append('}');
} else if (value != null) {
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2013-01-23 21:45:29 UTC (rev 8247)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2013-01-23 22:45:35 UTC (rev 8248)
@@ -419,6 +419,10 @@
add(tableRep_, BuBorderLayout.CENTER);
}
+ public void setDeferredModifications(boolean _active) {
+ modelData_.setDeferredModifications(_active);
+ }
+
public EbliSingleObjectTableModel getTableModel() {
return modelData_;
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectTableModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectTableModel.java 2013-01-23 21:45:29 UTC (rev 8247)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectTableModel.java 2013-01-23 22:45:35 UTC (rev 8248)
@@ -288,6 +288,7 @@
coordSeq_.setOrdinate(coordSeq_.size() - 1, _idxCol - 1, (Double) _value);
}
} else if (_idxCol > 2) {
+ modificationDone_=true;
lattmdls.get(_idxCol - 3).setObject(_idxRow, _value, null);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|