|
From: <bma...@us...> - 2011-09-08 15:43:35
|
Revision: 6378
http://fudaa.svn.sourceforge.net/fudaa/?rev=6378&view=rev
Author: bmarchan
Date: 2011-09-08 15:43:29 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
Mod : Panneau d'edition de geometrie : L'ordre des atrributs est conserv?\195?\169, l'attribut pour Z apparait en premier.
Fix : Traceback lors de la cr?\195?\169ation d'un rectangle ou ellipse avec keyPressed=CTRL
Modified Paths:
--------------
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueEditionInteraction.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueEditionInteraction.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueEditionInteraction.java 2011-09-08 08:56:10 UTC (rev 6377)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueEditionInteraction.java 2011-09-08 15:43:29 UTC (rev 6378)
@@ -18,8 +18,6 @@
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map.Entry;
import javax.swing.JComponent;
@@ -578,7 +576,8 @@
private ZEditionAttibutesContainer.LigneBriseeData data_;
private boolean moved_; // Vrai quand le curseur est en mouvement
private List<Integer> keyPresse_; // Pour la gestion du mode 'carre'
- private HashMap<GISAttributeInterface, JComponent> attributs_;
+ private List<JComponent> editorComp_;
+ private List<GISAttributeInterface> attEditable_;
public FormDelegateEllipse(){
keyPresse_=new ArrayList<Integer>();
@@ -721,7 +720,7 @@
*/
public void keyReleased(KeyEvent _e) {
if (keyPresse_.contains(_e.getKeyCode()))
- keyPresse_.remove(_e.getKeyCode());
+ keyPresse_.remove((Integer)_e.getKeyCode());
}
/*
@@ -731,20 +730,21 @@
*/
public void keyTyped(KeyEvent _e) {}
- public void setDataAttributs(HashMap<GISAttributeInterface, JComponent> _attributs){
- attributs_ = _attributs;
+ public void setDataAttributs(List<GISAttributeInterface> _attEditable, List<JComponent> _comps){
+ attEditable_ = _attEditable;
+ editorComp_=_comps;
}
public boolean isSetDataAttributs(){
- return attributs_ != null;
+ return attEditable_ != null && editorComp_!=null;
}
private void addData() {
- if (data_!=null&&attributs_!=null) {
+ if (data_!=null&&attEditable_!=null) {
// Pour chaque propri\xE9t\xE9es
- for (Entry<GISAttributeInterface, JComponent> element : attributs_.entrySet()) {
- GISAttributeInterface key=element.getKey();
- Object value=key.getEditor().getValue(element.getValue());
+ for (int j=0; j<attEditable_.size(); j++) {
+ GISAttributeInterface key=attEditable_.get(j);
+ Object value=key.getEditor().getValue(editorComp_.get(j));
// Si elle existe : inscrire la valeur
if (data_.atomicAttribute_.containsKey(key)) {
ArrayList<Object> values=data_.atomicAttribute_.get(key);
@@ -920,7 +920,8 @@
private GrPoint pointDep_, pointFin_; // Les deux points d\xE9finissant le rectangle
private List<Integer> keyPresse_; // Pour la gestion du mode 'carre'
private int nbPointsLargeur_, nbPointsHauteur_; // Nombres de point ajout\xE9 sur les cot\xE9s
- private HashMap<GISAttributeInterface, JComponent> attributs_;
+ private List<JComponent> editorComp_;
+ private List<GISAttributeInterface> attEditable_;
public FormDelegateRectangle() {
super();
@@ -928,13 +929,14 @@
nbPointsLargeur_ = 0;
nbPointsHauteur_ = 0;
}
-
- public void setDataAttributs(HashMap<GISAttributeInterface, JComponent> _attributs){
- attributs_ = _attributs;
+
+ public void setDataAttributs(List<GISAttributeInterface> _attEditable, List<JComponent> _comps){
+ attEditable_ = _attEditable;
+ editorComp_=_comps;
}
public boolean isSetDataAttributs(){
- return attributs_ != null;
+ return attEditable_ != null && editorComp_!=null;
}
/**
@@ -1134,7 +1136,7 @@
*/
public void keyReleased(KeyEvent _e) {
if (keyPresse_.contains(_e.getKeyCode()))
- keyPresse_.remove(_e.getKeyCode());
+ keyPresse_.remove((Integer)_e.getKeyCode());
}
/*
@@ -1145,11 +1147,11 @@
public void keyTyped(KeyEvent _e) {}
private void addData() {
- if (data_!=null&&attributs_!=null) {
+ if (data_!=null&&attEditable_!=null) {
// Pour chaque propri\xE9t\xE9es
- for (Entry<GISAttributeInterface, JComponent> element : attributs_.entrySet()) {
- GISAttributeInterface key=element.getKey();
- Object value=key.getEditor().getValue(element.getValue());
+ for (int j=0; j<attEditable_.size(); j++) {
+ GISAttributeInterface key=attEditable_.get(j);
+ Object value=key.getEditor().getValue(editorComp_.get(j));
// Si elle existe : inscrire la valeur
if (data_.atomicAttribute_.containsKey(key)) {
ArrayList<Object> values=data_.atomicAttribute_.get(key);
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java 2011-09-08 08:56:10 UTC (rev 6377)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java 2011-09-08 15:43:29 UTC (rev 6378)
@@ -15,7 +15,6 @@
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -49,6 +48,7 @@
import com.memoire.bu.BuVerticalLayout;
import com.memoire.fu.Fu;
import com.memoire.fu.FuLog;
+import java.util.LinkedHashMap;
import org.fudaa.ctulu.CtuluNumberFormatI;
import org.fudaa.ebli.commun.EbliCoordinateDefinition;
@@ -74,10 +74,9 @@
}
protected final void updateAtomicArrays() {
- if (editorComps_ != null && editorAttribute_ != null && editorAttribute_.size() > 0) {
- final List r = new ArrayList(editorAttribute_.size());
- for (final Iterator it = editorAttribute_.keySet().iterator(); it.hasNext();) {
- final GISAttributeInterface att = (GISAttributeInterface) it.next();
+ if (editorComps_ != null && attEditable_ != null && attEditable_.size() > 0) {
+ final List r = new ArrayList(attEditable_.size());
+ for (GISAttributeInterface att : attEditable_) {
if (att.isAtomicValue()) {
r.add(att);
}
@@ -293,7 +292,7 @@
*/
public void update() {
if (edition_!=null&&edition_.getFormeEnCours()!=null&&edition_.getFormeEnCours().enCours()) {
- ((FormDelegateEllipse)edition_.getFormeEnCours()).setDataAttributs(editorAttribute_);
+ ((FormDelegateEllipse)edition_.getFormeEnCours()).setDataAttributs(attEditable_,editorComps_);
GrPoint pointOrigine=((FormDelegateEllipse)edition_.getFormeEnCours()).getPointOrigine();
if (pointOrigine!=null) {
if (coordDefs_!=null) {
@@ -374,7 +373,7 @@
ell.setRayonX(rayonX);
ell.setRayonY(rayonY);
ell.setNbPoints(nbPoints);
- ell.setDataAttributs(editorAttribute_);
+ ell.setDataAttributs(attEditable_,editorComps_);
if(ell.buildEllipse())
reinitialisation();
}
@@ -546,7 +545,7 @@
public void update() {
if (edition_!=null&&edition_.getFormeEnCours()!=null&&edition_.getFormeEnCours().enCours()) {
GrPoint pointOrigine=(GrPoint)edition_.getFormeEnCours().getFormeEnCours();
- ((FormDelegateRectangle)edition_.getFormeEnCours()).setDataAttributs(editorAttribute_);
+ ((FormDelegateRectangle)edition_.getFormeEnCours()).setDataAttributs(attEditable_,editorComps_);
if (pointOrigine!=null) {
if (coordDefs_!=null) {
tfCoordX_.setText(coordDefs_[0].getFormatter().getXYFormatter().format(new Double(pointOrigine.x_)));
@@ -628,7 +627,7 @@
rec.setPointFin(new GrPoint(pointEndX, pointEndY, 0));
rec.setNbPointsLargeur(nbPointsX);
rec.setNbPointsHauteur(nbPointsY);
- rec.setDataAttributs(editorAttribute_);
+ rec.setDataAttributs(attEditable_,editorComps_);
if(rec.buildRectangle())
reinitialisation();
}
@@ -743,7 +742,7 @@
ZCalqueEditionInteraction edition_;
- HashMap<GISAttributeInterface, JComponent> editorAttribute_;
+// LinkedHashMap<GISAttributeInterface, JComponent> editorAttribute_;
/** Type de g\xE9ometrie a \xE9diter */
int typeForme_;
@@ -753,8 +752,12 @@
BPaletteEdition palette_;
protected GISAttributeInterface[] attributes_;
-
- protected JComponent[] editorComps_;
+ /** L'attribut utilis\xE9 pour Z s'il y en a 1 */
+ protected GISAttributeInterface attIsZ_;
+ /** Les editeurs pour chacun des attributs editables */
+ protected List<JComponent> editorComps_;
+ /** Les attributs editables, dans le meme ordre que les editeurs */
+ protected List<GISAttributeInterface> attEditable_=new ArrayList<GISAttributeInterface>();
/** Le nom des coordonn\xE9es */
protected EbliCoordinateDefinition[] coordDefs_;
@@ -895,28 +898,40 @@
final BuPanel pnFeature = new BuPanel();
pnFeature.setLayout(new BuGridLayout(2, 0, 0));
final List editor = new ArrayList(attributes_.length);
- if (editorAttribute_ == null) {
- editorAttribute_ = new HashMap();
- } else {
- editorAttribute_.clear();
- }
+// if (editorAttribute_ == null) {
+// editorAttribute_ = new LinkedHashMap<GISAttributeInterface, JComponent>();
+// } else {
+// editorAttribute_.clear();
+// }
+ attEditable_.clear();
for (int i = 0; i < attributes_.length; i++) {
final GISAttributeInterface attr = attributes_[i];
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.trace("EZM: add for " + attr.getName());
}
if (attr.isEditable()) {
- pnFeature.add(new BuLabel(attr.getName() + ':'));
final CtuluValueEditorI ed = attr.getEditor();
final JComponent ci = ed.createEditorComponent();
- editorAttribute_.put(attr, ci);
- editor.add(ci);
+// editorAttribute_.put(attr, ci);
final Object defaultVal = attr.getDefaultValue();
ed.setValue(defaultVal == null ? null : defaultVal.toString(), ci);
- pnFeature.add(ci);
+ // Si l'attribut est pris pour Z, on le place en premier.
+ if (attr.equals(attIsZ_)) {
+ attEditable_.add(0,attr);
+ editor.add(0,ci);
+ pnFeature.add(new BuLabel(attr.getName() + ':'),0);
+ pnFeature.add(ci,1);
+ }
+ else {
+ attEditable_.add(attr);
+ editor.add(ci);
+ pnFeature.add(new BuLabel(attr.getName() + ':'));
+ pnFeature.add(ci);
+ }
}
}
- editorComps_ = (JComponent[]) editor.toArray(new JComponent[editor.size()]);
+// editorComps_ = (JComponent[]) editor.toArray(new JComponent[editor.size()]);
+ editorComps_=editor;
add(pnFeature);
}
}
@@ -1000,8 +1015,9 @@
}
return null;
}
- final JComponent c = (JComponent) editorAttribute_.get(_attr);
- if (c != null) {
+ int ind=attEditable_.indexOf(_attr);
+ if (ind != -1) {
+ final JComponent c = (JComponent) editorComps_.get(ind);
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.trace("EZM: " + getClass().getName() + " component for attribute " + _attr.getName() + " value= "
+ _attr.getEditor().getValue(c));
@@ -1029,11 +1045,14 @@
public void targetChanged(final ZCalqueEditable _new) {
GISAttributeInterface[] newAtt = null;
+ GISAttributeInterface attIsZ=null;
if (_new != null && _new.getModelEditable() != null && _new.getModelEditable().getGeomData() != null) {
newAtt = _new.getModelEditable().getGeomData().getAttributes();
+ attIsZ = _new.getModelEditable().getGeomData().getAttributeIsZ();
}
- if (!Arrays.equals(newAtt, attributes_)) {
+ if (!Arrays.equals(newAtt, attributes_) || attIsZ_!=attIsZ) {
attributes_ = newAtt;
+ attIsZ_=attIsZ;
container_ = null;
removeAll();
add(btReprise_);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|