|
From: <de...@us...> - 2012-12-13 14:58:23
|
Revision: 8127
http://fudaa.svn.sourceforge.net/fudaa/?rev=8127&view=rev
Author: deniger
Date: 2012-12-13 14:58:16 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -82,6 +82,7 @@
*/
double longueurPas_;
CtuluNumberFormatI specificFormat_;
+ CtuluNumberFormatI specificDetailFormat_;
String titre_;
boolean titreVisible_ = true;
String unite_;
@@ -109,10 +110,8 @@
}
public CtuluRange getRange() {
- return range_==null?new CtuluRange():new CtuluRange(range_);
+ return range_ == null ? new CtuluRange() : new CtuluRange(range_);
}
-
-
public void setIsDiscret(boolean isDiscret) {
this.isDiscret_ = isDiscret;
@@ -479,6 +478,12 @@
return specificFormat_ != null;
}
+ public CtuluNumberFormatI getSpecificDetailFormat() {
+ return specificDetailFormat_;
+ }
+
+
+
public boolean isTitreVisible() {
return titreVisible_;
}
@@ -653,6 +658,18 @@
}
}
+ /**
+ *
+ * @param _specificFormat format used for tooltips.
+ */
+ public final void setSpecificDetailFormat(final CtuluNumberFormatI _specificFormat) {
+ if (specificDetailFormat_ != _specificFormat) {
+ final CtuluNumberFormatI old = specificDetailFormat_;
+ specificDetailFormat_ = _specificFormat;
+ firePropertyChange("axeDetailFormat", old, specificDetailFormat_);
+ }
+ }
+
public boolean setTitre(final String _titre) {
if (!CtuluLibString.isEquals(titre_, _titre)) {
final String old = titre_;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -98,10 +98,10 @@
return CtuluLibString.ESPACE;
}
if (_rowIndex == c_.getModel().getNbValues()) {
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
return newX_ == null ? null : getX(newX_.doubleValue());
}
- if (_columnIndex == yRowIndex) {
+ if (_columnIndex == yColIndex) {
return newY_ == null ? null : getY(newY_.doubleValue());
}
}
@@ -121,9 +121,9 @@
if (d == null) {
return;
}
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
newX_ = d;
- } else if (_columnIndex == yRowIndex) {
+ } else if (_columnIndex == yColIndex) {
newY_ = d;
}
if (newX_ != null && newY_ != null) {
@@ -169,11 +169,11 @@
t.getCellEditor().stopCellEditing();
}
- if (col == tableModel.yRowIndex) {
- col = tableModel.xRowIndex;
+ if (col == tableModel.yColIndex) {
+ col = tableModel.xColIndex;
row++;
} else {
- col = tableModel.yRowIndex;
+ col = tableModel.yColIndex;
}
if (row >= t.getRowCount()) {
row = t.getRowCount() - 1;
@@ -221,11 +221,9 @@
@Override
protected String transformToString(Object value) {
-
+
return super.transformToString(value);
}
-
-
/**
* @param _values
@@ -440,9 +438,16 @@
if (_value != null) {
boolean ok = getSpecTableModel().isPointDrawn(_row);
res.setEnabled(ok);
+ setToolTipText(CtuluLibString.EMPTY_STRING);
if (!ok && _column == 1) {
setText(CtuluLibString.EMPTY_STRING);
}
+ SpecTableModel model = (SpecTableModel) _table.getModel();
+ if (_column == model.getXColIndex()) {
+ setToolTipText(model.getXDetailAsString(_row));
+ } else if (_column == model.getYColIndex()) {
+ setToolTipText(model.getYDetailAsString(_row));
+ }
}
return res;
}
@@ -450,7 +455,7 @@
@Override
protected void setValue(final Object _value) {
if (_value == null) {
- setText(EbliLib.getS("Ajouter"));
+ super.setValue(EbliLib.getS("Ajouter"));
} else {
super.setValue(_value);
}
@@ -506,7 +511,8 @@
@Override
public TableCellRenderer getDefaultRenderer(final Class _columnClass) {
- if (Double.class.equals(_columnClass)) {
+ if (Double.class
+ .equals(_columnClass)) {
return renderer_;
}
return super.getDefaultRenderer(_columnClass);
@@ -516,7 +522,8 @@
setDefaultEnterAction(t_);
final BuTextField txt = BuTextField.createDoubleField();
txt.setColumns(10);
- t_.setDefaultEditor(Double.class, new BuTableCellEditor(txt) {
+ t_
+ .setDefaultEditor(Double.class, new BuTableCellEditor(txt) {
@Override
public boolean isCellEditable(final EventObject _evt) {
if (_evt instanceof MouseEvent) {
@@ -656,6 +663,8 @@
actionDelete = new DeleteAction();
}
return actionDelete;
+
+
}
public class DeleteAction extends EbliActionSimple {
@@ -769,7 +778,7 @@
repaint();
}
- SpecTableModel getSpecTableModel() {
+ public SpecTableModel getSpecTableModel() {
return (SpecTableModel) t_.getModel();
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-12-13 14:57:41 UTC (rev 8126)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2012-12-13 14:58:16 UTC (rev 8127)
@@ -21,8 +21,8 @@
EGCourbe c_;
EGGraphe a_;
- protected int xRowIndex = 0;
- protected int yRowIndex = 1;
+ protected int xColIndex = 0;
+ protected int yColIndex = 1;
public EGTableModel() {
}
@@ -31,6 +31,14 @@
a_ = _a;
}
+ public int getXColIndex() {
+ return xColIndex;
+ }
+
+ public int getYColIndex() {
+ return yColIndex;
+ }
+
@Override
public int getColumnCount() {
return 2;
@@ -66,13 +74,13 @@
}
double x = c_.getModel().getX(_rowIndex);
double y = c_.getModel().getY(_rowIndex);
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
try {
x = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
return;
}
- } else if (_columnIndex == yRowIndex) {
+ } else if (_columnIndex == yColIndex) {
try {
y = Double.parseDouble(_value.toString());
} catch (final NumberFormatException _e) {
@@ -84,8 +92,8 @@
public void setValueAt(final double _val, final int _rowIndex, final int _columnIndex,
final CtuluCommandContainer _cmd) {
- final double x = _columnIndex == xRowIndex ? _val : c_.getModel().getX(_rowIndex);
- final double y = _columnIndex == yRowIndex ? _val : c_.getModel().getY(_rowIndex);
+ final double x = _columnIndex == xColIndex ? _val : c_.getModel().getX(_rowIndex);
+ final double y = _columnIndex == yColIndex ? _val : c_.getModel().getY(_rowIndex);
c_.getModel().setValue(_rowIndex, x, y, _cmd);
}
@@ -109,9 +117,9 @@
@Override
public String getColumnName(final int _column) {
String res = CtuluLibString.ESPACE;
- if (getH() != null && _column == xRowIndex) {
+ if (getH() != null && _column == xColIndex) {
res = getH().titre_;
- } else if (_column == yRowIndex && c_ != null && c_.getAxeY() != null) {
+ } else if (_column == yColIndex && c_ != null && c_.getAxeY() != null) {
res = c_.getAxeY().titre_;
}
return (res == null || res.length() == 0) ? CtuluLibString.ESPACE : res;
@@ -137,6 +145,26 @@
return Double.toString(_d);
}
+ protected String getXDetailAsString(int row) {
+ return getXDetail(getInitX(row));
+ }
+
+ protected String getYDetailAsString(int row) {
+ return getYDetail(getInitY(row));
+ }
+
+ protected String getXDetail(final double _d) {
+ final EGAxeHorizontal h = getH();
+
+ if (h != null) {
+ if (h.getSpecificDetailFormat() == null) {
+ return getX(_d);
+ }
+ return h.getSpecificDetailFormat().format(_d);
+ }
+ return Double.toString(_d);
+ }
+
protected String getY(final double _d) {
final EGAxeVertical h = c_ == null ? null : c_.getAxeY();
if (h != null && h.isSpecificFormat()) {
@@ -145,6 +173,25 @@
return Double.toString(_d);
}
+ protected String getYDetail(final double _d) {
+ final EGAxeVertical h = c_ == null ? null : c_.getAxeY();
+ if (h != null) {
+ if (h.getSpecificDetailFormat() == null) {
+ return getY(_d);
+ }
+ return h.getSpecificDetailFormat().format(_d);
+ }
+ return Double.toString(_d);
+ }
+
+ public double getInitX(int rowIndex) {
+ return c_.getModel().getX(rowIndex);
+ }
+
+ public double getInitY(int rowIndex) {
+ return c_.getModel().getY(rowIndex);
+ }
+
@Override
public Object getValueAt(final int _rowIndex, final int _columnIndex) {
final EGAxeHorizontal h = getH();
@@ -152,10 +199,10 @@
if (c_ == null || h == null || (_rowIndex >= c_.getModel().getNbValues())) {
return CtuluLibString.EMPTY_STRING;
}
- if (_columnIndex == yRowIndex) {
+ if (_columnIndex == yColIndex) {
return getY(c_.getModel().getY(_rowIndex));
}
- if (_columnIndex == xRowIndex) {
+ if (_columnIndex == xColIndex) {
return getX(c_.getModel().getX(_rowIndex));
}
return CtuluLibString.EMPTY_STRING;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|