|
From: <bma...@us...> - 2011-04-06 08:32:44
|
Revision: 6206
http://fudaa.svn.sourceforge.net/fudaa/?rev=6206&view=rev
Author: bmarchan
Date: 2011-04-06 08:32:37 +0000 (Wed, 06 Apr 2011)
Log Message:
-----------
Fix : Pb d'?\195?\169dition d'un segment de g?\195?\169om?\195?\169trie
Add : Possibilit?\195?\169 d'ajout d'un panneau de repr?\195?\169sentation graphe dans le dialogue d'?\195?\169dition.
Modified Paths:
--------------
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/TableModelModeleAdapter.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java
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 2011-04-04 13:44:43 UTC (rev 6205)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2011-04-06 08:32:37 UTC (rev 6206)
@@ -25,7 +25,6 @@
import org.fudaa.ctulu.CtuluCommandContainer;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.gis.GISAttributeConstants;
-import org.fudaa.ctulu.gis.GISAttributeDouble;
import org.fudaa.ctulu.gis.GISAttributeModel;
import org.fudaa.ctulu.gis.GISCoordinateSequenceUnique;
import org.fudaa.ctulu.gis.GISPoint;
@@ -261,328 +260,6 @@
}
}
- /**
- * Cette classe repr\xE9sente l'information z sous forme d'une courbe.
- * Cette information peut-\xEAtre \xE9dit\xE9e via la courbe.
- *
- * @author MARTIN Emmanuel
- * @version $Id: EbliSingleObjectEditorPanel.java,v 1.10.6.2 2008-04-01
- * 07:28:15 emartin Exp $
- */
- public class CourbeRepresentation extends BuPanel /*implements TableModelListener, CtuluListSelectionListener, ListSelectionListener*/ {
-//
-// /**
-// * Cette classe donne un acc\xE8s restraint au model 'model_'. Le X et Y sont remplac\xE9s par un asbcisse curviligne.
-// *
-// * @author Emmanuel MARTIN
-// * @version $Id:$
-// */
-// protected class LimitedTableModel extends AbstractTableModel implements TableModelListener {
-//
-// /**
-// * Le renderer des cellules du tableau.
-// */
-// protected class Renderer extends DefaultTableCellRenderer {
-// public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
-// int column) {
-//
-// if(value instanceof Double)
-// return super.getTableCellRendererComponent(table, xyFormatter_.getXYFormatter().format((Double) value), isSelected, hasFocus, row, column);
-// if(value instanceof Boolean)
-// return table.getDefaultRenderer(Boolean.class).getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-// else
-// return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-// }
-// }
-//
-// private EbliFormatterInterface xyFormatter_;
-//
-// /**
-// * @param _xyFormatter le formateur pour la colonne des curvilignes
-// */
-// public LimitedTableModel(EbliFormatterInterface _xyFormatter){
-// xyFormatter_=_xyFormatter;
-// modelData_.addTableModelListener(this);
-// }
-//
-// public int getColumnCount() {
-// return modelData_.getColumnCount()-1;
-// }
-//
-// public int getRowCount() {
-// return modelData_.getRowCount();
-// }
-//
-// public Object getValueAt(int _rowIndex, int _columnIndex) {
-// switch (_columnIndex) {
-// case 0:
-// return _rowIndex+1;
-// case 1:
-// return getX(_rowIndex);
-// default:
-// return modelData_.getValueAt(_rowIndex, _columnIndex+1);
-// }
-// }
-//
-// public boolean isCellEditable(final int _rowIndex, final int _columnIndex) {
-// if (_columnIndex<2)
-// return false;
-//
-// return modelData_.isCellEditable(_rowIndex, _columnIndex+1);
-// }
-//
-// public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) {
-// if(_columnIndex >= 2)
-// modelData_.setValueAt(_value, _rowIndex, _columnIndex+1);
-// }
-//
-// public String getColumnName(int _column) {
-// switch (_column) {
-// case 0:
-// return EbliLib.getS(EbliLib.getS("Index"));
-// case 1:
-// return EbliLib.getS(EbliLib.getS("Abscisse"));
-// default:
-// return modelData_.getColumnName(_column+1);
-// }
-// }
-//
-// public Class<?> getColumnClass(int _columnIndex) {
-// switch (_columnIndex) {
-// case 0:
-// return Integer.class;
-// case 1:
-// return Double.class;
-// default:
-// return modelData_.getColumnClass(_columnIndex);
-// }
-// }
-//
-// public void tableChanged(TableModelEvent _e) {
-// int col=_e.getColumn();
-// if (_e.getColumn()==zCol_)
-// col=2;
-// fireTableChanged(new TableModelEvent((TableModel)_e.getSource(), _e.getFirstRow(), _e.getLastRow(), col, _e.getType()));
-// }
-//
-// public void updateCellEditor(JTable _table) {
-// TableColumnModel cols=_table.getColumnModel();
-//
-// // Renderer \\
-// Renderer renderer=new Renderer();
-// for(int i=0;i<cols.getColumnCount();i++)
-// cols.getColumn(i).setCellRenderer(renderer);
-//
-// // Editors \\
-// // Colonnes des attributs
-// if (modelData_!=null) {
-// for (int i=3; i<modelData_.getColumnCount(); i++) {
-// CtuluValueEditorI editor=modelData_.getAttribute(i).getEditor();
-// if (editor!=null)
-// cols.getColumn(i-1).setCellEditor(editor.createTableEditorComponent());
-// }
-// }
-// }
-// }
-//
-// // Taille de la polyligne, utile pour l'axe des abscisses
-// private double lengthPolyligne_;
-// // Association entre l'index du point et sa coordnn\xE9e x
-// private HashMap<Integer, Double> courbeModelIndCoordX_;
-// // Valeur actuelle maximal de z
-// private double maxZ_;
-// // Le conteneur de la courbe
-// private EGGraphe grapheVue_;
-// // Axes du la courbe
-// private EGAxeHorizontal axeX_;
-// private EGAxeVertical axeY_;
-// // Vue de la courbe
-// private EGCourbeSimple courbeVue_;
-// // Gestion de la selection
-// private CtuluListSelection listSelection_;
-// // Model du tableau
-// private CtuluTable tableauVue_;
-// // Selection update
-// private boolean disable;
-// /** Indice de la colonne z sur le modele data global. */
-// protected int zCol_;
-//
-// public CourbeRepresentation() {
-// disable = false;
-// zCol_=/*zone_.getIndiceOf(zone_.getAttributeIsZ())+*/3; // l'index + les colonnes index, x et y
-// modelData_.addTableModelListener(this);
-// // Construction de la courbe \\
-// setPreferredSize(new Dimension(650,450));
-// EGGrapheSimpleModel grapheModel=new EGGrapheSimpleModel();
-// grapheVue_=new EGGraphe(grapheModel);
-// // Axe des X
-// axeX_=new EGAxeHorizontal(false);
-// axeX_.setTitre(EbliLib.getS("Abscisse curviligne"));
-// axeX_.setUnite(EbliLib.getS("m\xE8tre"));
-// axeX_.setGraduations(true);
-// grapheVue_.setXAxe(axeX_);
-// // Axe des Y
-// axeY_=new EGAxeVertical();
-// axeY_.setGraduations(true);
-// axeY_.setTitre(EbliLib.getS("Ordonn\xE9e") + " : " + modelData_.getColumnName(zCol_));
-// axeY_.setUnite(EbliLib.getS("m\xE8tre"));
-// DecimalFormat df=CtuluLib.getDecimalFormat();
-// df.setMaximumFractionDigits(2);
-// axeY_.setSpecificFormat(new CtuluNumberFormatDefault(df));
-// // Calcule des x
-// generateCoordX();
-// axeX_.setBounds(0, lengthPolyligne_);
-// axeY_.setBounds(0, maxZ_);
-// // La courbe
-// EGCourbeModelProfile courbeModel=new EGCourbeModelProfile(this, "");
-// courbeVue_=new EGCourbeSimple(axeY_, courbeModel);
-// courbeVue_.setAspectContour(Color.BLUE);
-// courbeVue_.setIconeModel(new TraceIconModel(TraceIcon.CARRE_PLEIN,2,Color.BLUE));
-// grapheModel.addCourbe(courbeVue_, new CtuluCommandManager());
-// // Conteneur de graphe
-// EGFillePanel pnD=new EGFillePanel(grapheVue_);
-// listSelection_ = pnD.getSelection();
-// listSelection_.addListeSelectionListener(this);
-// // Construction des boutons \\
-// EbliActionInterface[] actions=pnD.getSpecificActions();
-// Container buttons=new Container();
-// buttons.setLayout(new GridLayout(1, 6));
-// EbliLib.updateMapKeyStroke(this, actions);
-// String[] tmpAction = {"SELECT", "RESTORE", "AUTO_REST", "ZOOM", "SUIVI", "MOVE_POINT"};
-// HashSet<String> actionsKept = new HashSet<String>();;
-// for(int i=0;i<tmpAction.length;i++)
-// actionsKept.add(tmpAction[i]);
-// for (int i=0; i<actions.length; i++) {
-// if(actions[i] != null && actionsKept.contains(actions[i].getValue(Action.ACTION_COMMAND_KEY))){
-// AbstractButton button = actions[i].buildButton(EbliComponentFactory.INSTANCE);
-// button.setText("");
-// buttons.add(button);
-// }
-// }
-// // Construction du tableau \\
-// LimitedTableModel tableau = new LimitedTableModel(modelData_.getFormatter());
-// tableauVue_ = new CtuluTable();
-// tableauVue_.setModel(tableau);
-// tableauVue_.getSelectionModel().addListSelectionListener(this);
-// tableau.updateCellEditor(tableauVue_);
-//
-// // Ajout au panel \\
-// BuScrollPane scrollPane = new BuScrollPane(tableauVue_);
-// BuPanel left = new BuPanel();
-// left.setLayout(new BuBorderLayout());
-// scrollPane.setPreferredSize(new Dimension(130, 335));
-// left.add(buttons, BuBorderLayout.NORTH);
-// left.add(scrollPane, BuBorderLayout.CENTER);
-// BuSplit2Pane splitPane = new BuSplit2Pane(left, pnD, BuSplit2Pane.HORIZONTAL);
-// setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
-// setLayout(new BorderLayout(0,0));
-// add(splitPane,BorderLayout.CENTER);
-// }
-//
-// public int getNbValues() {
-// return modelData_.getRowCount();
-// }
-//
-// public double getX(int _id) {
-// return courbeModelIndCoordX_.get(_id);
-// }
-//
-// public double getY(int _id) {
-// return (Double)modelData_.getValueAt(_id, zCol_);
-// }
-//
-// public void setY(int _id, double _value, CtuluCommandContainer _cmd) {
-// modelData_.setValueAt(new Double(_value), _id, zCol_);
-// }
-//
-// /**
-// * @return la s\xE9quence des coordonn\xE9es modifi\xE9es. Toujours null puisque ni x
-// * ni y ne sont modifi\xE9s (seulement z).
-// */
-// protected CoordinateSequence getNewCoordinate() {
-// return null;
-// }
-//
-// /**
-// * Build or rebuild 'courbeModelIndCoordX_' with data in model_.
-// */
-// protected void generateCoordX() {
-// double oldLengthPolyligne = lengthPolyligne_;
-// double oldMaxZ = maxZ_;
-// lengthPolyligne_=0;
-// courbeModelIndCoordX_=new HashMap<Integer, Double>(modelData_.getRowCount());
-// if (modelData_.getRowCount()>0) {
-// double lastX=(Double)modelData_.getValueAt(0, 1);
-// double lastY=(Double)modelData_.getValueAt(0, 2);
-// double currentX, currentY;
-// // Remplissage et construction des attributs
-// courbeModelIndCoordX_.put(0, lengthPolyligne_);
-// maxZ_=getY(0); // Le Y de getY (y de la courbe) est le Z du model
-// for (int i=1; i<modelData_.getRowCount(); i++) {
-// currentX=(Double)modelData_.getValueAt(i, 1);
-// currentY=(Double)modelData_.getValueAt(i, 2);
-// lengthPolyligne_+=Math.sqrt(Math.pow(lastX-currentX, 2)+Math.pow(lastY-currentY, 2));
-// courbeModelIndCoordX_.put(i, lengthPolyligne_);
-// maxZ_=Math.max(maxZ_, (Double)modelData_.getValueAt(i, 3));
-// lastX=currentX;
-// lastY=currentY;
-// }
-// if (oldLengthPolyligne!=lengthPolyligne_)
-// axeX_.setBounds(0, lengthPolyligne_);
-// if (grapheVue_.isAutoRestore()) {
-// if (oldMaxZ!=maxZ_)
-// axeY_.setBounds(0, maxZ_);
-// }
-// }
-// }
-//
-// public void tableChanged(TableModelEvent e) {
-// generateCoordX();
-// if(grapheVue_.isAutoRestore())
-// grapheVue_.restore();
-// else
-// grapheVue_.fullRepaint();
-// }
-//
-// public void listeSelectionChanged(CtuluListSelectionEvent _e) {
-// // Un changement de selection a \xE9t\xE9 effectu\xE9 dans la courbe \\
-// if (!disable) {
-// // Suppression de l'\xE9coute des changement de selection de le tableau
-// disable=true;
-// // Changement de selection dans le tableau
-// int[] selectedIndex=((CtuluListSelectionInterface)_e.getSource()).getSelectedIndex();
-// ListSelectionModel lstTableauSelect=tableauVue_.getSelectionModel();
-// lstTableauSelect.clearSelection();
-// if (selectedIndex!=null && selectedIndex.length>0) {
-// for (int i=0; i<selectedIndex.length; i++)
-// lstTableauSelect.addSelectionInterval(selectedIndex[i], selectedIndex[i]);
-// tableauVue_.scrollRectToVisible(tableauVue_.getCellRect(selectedIndex[selectedIndex.length-1], 0, false));
-// }
-// // R\xE9activation de l'\xE9coute de changement de selection de le tableau
-// disable=false;
-// }
-// }
-//
-// public void valueChanged(ListSelectionEvent _e) {
-// // Un changement de selection a \xE9t\xE9 effectu\xE9 dans le tableau \\
-// if (!disable) {
-// // Suppression de l'\xE9coute des changement de selection de la courbe
-// disable=true;
-// // Changement de selection de la courbe
-// CtuluListSelection lst=new CtuluListSelection();
-// ListSelectionModel lstSelect=tableauVue_.getSelectionModel();
-// listSelection_.clear();
-// for (int i=0; i<tableauVue_.getRowCount(); i++)
-// if (lstSelect.isSelectedIndex(i))
-// lst.add(i);
-// if (!lst.isEmpty())
-// listSelection_.setSelection(lst);
-// // R\xE9activation de l'\xE9coute de changement de selection de la courbe
-// disable=false;
-// }
-// }
- }
-
private CtuluCommandContainer cmd_;
// Num\xE9ro de la g\xE9om\xE9rie dans zone_ que l'on veut traiter
private final int idx_;
@@ -592,8 +269,6 @@
private final GISZoneCollection zone_;
// Onglet repr\xE9sentant les informations sous forme de table
private TableRepresentation tableRep_;
- // Onglet repr\xE9sentant une information sous forme de courbe
- private CourbeRepresentation courbeRep_;
/** Le modele de donn\xE9es \xE0 utiliser comme model de tabelau */
protected TableModelModeleAdapter modelData_;
// Tableau des attributs globaux
@@ -654,24 +329,31 @@
}
add(pnAttrGlobaux, BuBorderLayout.NORTH);
// Contruction du model de donn\xE9es commun aux deux repr\xE9sentations
- GISAttributeDouble zAttr=zone_.getAttributeIsZ();
- if (!(zone_.getGeometry(idx_) instanceof GISPoint)&&zAttr!=null&&zAttr.isAtomicValue()) {
- modelData_=new TableModelModeleAdapter(modeleSrc_, idx_, _defs, new CtuluCommandComposite(), _editVertexAttribut);
- // Gestionnaire d'onglet
+
+ modelData_=new TableModelModeleAdapter(modeleSrc_, idx_, _defs, new CtuluCommandComposite(), _editVertexAttribut);
+ tableRep_=new TableRepresentation(_editAttribut, _editVertexAttribut, _defs);
+ add(tableRep_, BuBorderLayout.CENTER);
+ }
+
+ public TableModelModeleAdapter getTableModel() {
+ return modelData_;
+ }
+
+ /**
+ * Ajoute un nouveau panneau en plus du panneau tableau. Des onglets sont
+ * apparents dans ce cas.
+ * @param _title Le titre
+ * @param _pn Le panneau.
+ */
+ public void addNewTab(String _title, BuPanel _pn) {
+ if (tabbedPane_==null) {
tabbedPane_=new JTabbedPane();
- // Les onglets
- tableRep_=new TableRepresentation(_editAttribut, _editVertexAttribut, _defs);
- courbeRep_=new CourbeRepresentation();
- // Ajout
+
+ remove(tableRep_);
tabbedPane_.add(EbliLib.getS("Table"), tableRep_);
- tabbedPane_.add(EbliLib.getS("Courbe"), courbeRep_);
add(tabbedPane_, BuBorderLayout.CENTER);
}
- else {
- modelData_=new TableModelModeleAdapter(modeleSrc_, idx_, _defs, new CtuluCommandComposite(), _editVertexAttribut);
- tableRep_=new TableRepresentation(_editAttribut, _editVertexAttribut, _defs);
- add(tableRep_, BuBorderLayout.CENTER);
- }
+ tabbedPane_.add(_title, _pn);
}
/**
@@ -701,6 +383,7 @@
* Enregistre les modifications effectu\xE9es. Cette m\xE9thode est automatiquement
* appell\xE9e lors du click sur le bouton 'Valider'
*/
+ @Override
public void apply() {
CtuluCommandComposite cmd=new CtuluCommandComposite("Modifications de la g\xE9om\xE9trie");
if (tableRep_!=null)
@@ -734,6 +417,7 @@
* Appell\xE9 lors du click sur le bouton 'valider' pour sortir de la fen\xEAtre.
* Retourne vrai si toutes les modifications sont valides.
*/
+ @Override
public boolean isDataValid() {
if (tableRep_!=null) {
tableRep_.stopCellEditing();
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/TableModelModeleAdapter.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/TableModelModeleAdapter.java 2011-04-04 13:44:43 UTC (rev 6205)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/TableModelModeleAdapter.java 2011-04-06 08:32:37 UTC (rev 6206)
@@ -73,6 +73,7 @@
*/
protected class Renderer extends DefaultTableCellRenderer {
+ @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
if(value instanceof Double)
@@ -499,11 +500,11 @@
}
/**
- * Retourne le formatter utilis\xE9.
+ * Retourne les d\xE9finitions de coordonn\xE9es.
*/
-// public EbliFormatterInterface getFormatter() {
-// return coorDefs_;
-// }
+ public EbliCoordinateDefinition[] getCoordinateDefs() {
+ return coordDefs_;
+ }
/**
* Change le formatter utilis\xE9.
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 2011-04-04 13:44:43 UTC (rev 6205)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2011-04-06 08:32:37 UTC (rev 6206)
@@ -478,9 +478,11 @@
private void buildActions() {
actionDelete_ = new EbliActionSimple(CtuluLib.getS("Supprimer"), BuResource.BU.getIcon("enlever"),"DeleteSelectedAction") {
+ @Override
public void actionPerformed(final ActionEvent _e) {
delete();
}
+ @Override
public void updateStateBeforeShow() {
super.setEnabled(target_ != null && !target_.isSelectionEmpty());
}
@@ -488,9 +490,11 @@
actionDelete_.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
actionCancel_ = new EbliActionSimple(CtuluLib.getS("Annuler"), BuResource.BU.getIcon("annuler"),"CancelEditionAction") {
+ @Override
public void actionPerformed(final ActionEvent _e) {
cancelEdition();
}
+ @Override
public void updateStateBeforeShow() {
super.setEnabled(dessin_ != null && !dessin_.isGele() && dessin_.isEnCours());
}
@@ -784,8 +788,7 @@
ZCalqueEditable calque=(ZCalqueEditable)calquesWithSelectedObjects.get(0);
// G\xE9n\xE9ration d'une boite d'\xE9dition selon le type de selection et
// d'\xE9dition \\
- /** TODO B.M. Gerer le mode segment */
- if (((ZCalqueEditable)calque).isAtomicMode()) {
+ if (calque.getSelectionMode() == SelectionMode.ATOMIC) {
// On controle qu'en mode sommet, une seule g\xE9om\xE9trie est selectionn\xE9e.
if (getSupport().getSelectionHelper().getUniqueSelectedIdx()==-1) {
ui_.warn(EbliLib.getS("Edition impossible"), EbliLib.getS("L'\xE9dition ne peut se faire simultan\xE9ment que sur\n des sommets d'une m\xEAme g\xE9om\xE9trie."), false);
@@ -793,6 +796,9 @@
}
editVertexObject(calque);
}
+ else if(calque.getSelectionMode() == SelectionMode.SEGMENT) {
+ editSegmentObject(calque);
+ }
else if (calque.isOnlyOneObjectSelected())
// Une seule g\xE9om\xE9trie est \xE0 \xE9diter
editSingleObject(calque);
@@ -813,13 +819,6 @@
}
return null;
}
-
- /**
- * Contient l'index de l'onglet selectionn\xE9 dans le panel d'edition d'objet
- * seul. C'est pour que d'une \xE9dition \xE0 l'autre le m\xEAme onglet soit
- * automatiquement selectionn\xE9.
- */
- private int selectedTabInSingleObjectEditorPanel_=0;
/**
* L'\xE9dition pour un objet selectionn\xE9 unique.
@@ -830,11 +829,7 @@
final EbliSingleObjectEditorPanel ed = new EbliSingleObjectEditorPanel(_target.getModelEditable(), idxSelected,
true, true, getCoordinateDefinitions());
ed.setCmd(getMng());
- if(ed.hasTab())
- ed.setSelectedTab(selectedTabInSingleObjectEditorPanel_);
ed.afficheModale(getFrame(), _target.getTitle());
- if(ed.hasTab())
- selectedTabInSingleObjectEditorPanel_=ed.getSelectedTab();
}
protected void editVertexObject(final ZCalqueEditable _target) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|