|
From: <de...@us...> - 2010-01-03 21:46:27
|
Revision: 5584
http://fudaa.svn.sourceforge.net/fudaa/?rev=5584&view=rev
Author: deniger
Date: 2010-01-03 21:46:16 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java 2010-01-03 21:43:37 UTC (rev 5583)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java 2010-01-03 21:46:16 UTC (rev 5584)
@@ -1,9 +1,13 @@
/*
- * @creation 29 ao\xFBt 2005
- * @modification $Date: 2007-04-30 14:22:38 $
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
- * @mail fud...@li...
+ * @creation 29 ao\xFBt 2005
+ *
+ * @modification $Date: 2007-04-30 14:22:38 $
+ *
+ * @license GNU General Public License 2
+ *
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ *
+ * @mail fud...@li...
*/
package org.fudaa.fudaa.tr.post;
@@ -22,6 +26,7 @@
import org.fudaa.fudaa.tr.post.data.TrPostDataCreated;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedExpr;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedSaver;
+import org.fudaa.fudaa.tr.post.data.TrPostDataHelper;
import org.nfunk.jep.Variable;
/**
@@ -41,15 +46,6 @@
}
- public static void loadVars(final TrPostSource _dest, final CtuluAnalyze _analyze, final ObjectContainer _db,
- final ProgressionInterface _prog, final CtuluUI _ui) {
- final TrPostUserVariableSaver doc = (TrPostUserVariableSaver) FudaaSaveLib.getUniqueData(
- TrPostUserVariableSaver.class, _db);
- if (doc != null) {
- doc.restore(_dest, _analyze, _prog, _ui);
- }
- }
-
public boolean isExprEmpty() {
return CtuluLibArray.isEmpty(varCreated_) || CtuluLibArray.isEmpty(expr_) || expr_.length != varCreated_.length;
}
@@ -67,8 +63,9 @@
* @param _prog
* @param _ui
*/
- public void restore(final TrPostSource _src, final CtuluAnalyze _analyze, final ProgressionInterface _prog,
- final CtuluUI _ui) {
+ public CtuluAnalyze restore(final TrPostSource _src, final CtuluAnalyze _analyze, final ProgressionInterface _prog,
+ final CtuluUI _ui, TrPostSourcesManager ctx) {
+ CtuluAnalyze log=new CtuluAnalyze();
if (g_ != null) {
_src.getGravity().setValue(g_);
}
@@ -88,10 +85,11 @@
final Map shortName = getShortNameVariable(_src);
final TrPostDataCreated[] newData = new TrPostDataCreated[saver_.length];
for (int i = 0; i < saver_.length; i++) {
- newData[i] = saver_[i].restore(varCreatedSimple_[i], _src, _ui, shortName);
+ newData[i] = saver_[i].restore(varCreatedSimple_[i], _src, _ui, shortName, ctx, log);
}
_src.addUserVar(varCreatedSimple_, newData, null);
}
+ return log;
}
public Map getShortNameVariable(final TrPostSource _src) {
@@ -107,56 +105,7 @@
public static void saveIn(final TrPostSourceAbstract _src, final ObjectContainer _db, final ProgressionInterface _prog) {
if (_db == null || _src == null) { return; }
FudaaSaveLib.deleteAll(_db, TrPostUserVariableSaver.class);
- final TrPostUserVariableSaver save = new TrPostUserVariableSaver();
- save.g_ = _src.getGravity().getValue();
-
- if (_src.varUserCreateData_ != null) {
- final Map map = new HashMap(_src.varUserCreateData_);
- // on enleve les variables import\xE9es
- final Set varToRemove = new HashSet();
- for (final Iterator it = map.entrySet().iterator(); it.hasNext();) {
- final Map.Entry e = (Map.Entry) it.next();
- final TrPostDataCreated created = (TrPostDataCreated) e.getValue();
- final H2dVariableType var = (H2dVariableTypeCreated) e.getKey();
- // pas de sauvegarde possible ou non basee sur une expression
- if (!created.isExpr() && created.createSaver() == null) {
- varToRemove.add(var);
- varToRemove.addAll(TrPostDataCreatedExpr.getAllVarDependingOn(var, _src));
- }
- }
- if (Fu.DEBUG && FuLog.isDebug()) {
- FuLog.debug("vars enlevees\n" + CtuluLibString.arrayToString(varToRemove.toArray()));
- }
- map.keySet().removeAll(varToRemove);
- final Map exprVar = new HashMap(map.size());
- final Map otherVar = new HashMap(map.size());
- for (final Iterator it = map.entrySet().iterator(); it.hasNext();) {
- final Map.Entry e = (Map.Entry) it.next();
- final TrPostDataCreated data = ((TrPostDataCreated) e.getValue());
- if (data.isExpr()) {
- exprVar.put(e.getKey(), data);
- } else {
- otherVar.put(e.getKey(), data);
- }
- }
-
- save.varCreated_ = new H2dVariableTypeCreated[exprVar.size()];
- save.expr_ = new String[exprVar.size()];
- int idx = 0;
- for (final Iterator it = exprVar.entrySet().iterator(); it.hasNext();) {
- final Map.Entry e = (Map.Entry) it.next();
- save.varCreated_[idx] = (H2dVariableTypeCreated) e.getKey();
- save.expr_[idx++] = ((TrPostDataCreatedExpr) e.getValue()).getFormule();
- }
- save.varCreatedSimple_ = new H2dVariableTypeCreated[otherVar.size()];
- save.saver_ = new TrPostDataCreatedSaver[otherVar.size()];
- for (final Iterator it = otherVar.entrySet().iterator(); it.hasNext();) {
- final Map.Entry e = (Map.Entry) it.next();
- save.varCreatedSimple_[idx] = (H2dVariableTypeCreated) e.getKey();
- save.saver_[idx++] = ((TrPostDataCreated) e.getValue()).createSaver();
- }
-
- }
+ final TrPostUserVariableSaver save = createSaver(_src, _prog);
_db.set(save);
_db.commit();
}
@@ -168,12 +117,11 @@
* @param _prog
* @return
*/
- public static TrPostUserVariableSaver saveIn(final TrPostSourceAbstract _src, final ProgressionInterface _prog) {
+ public static TrPostUserVariableSaver createSaver(final TrPostSourceAbstract _src, final ProgressionInterface _prog) {
if (_src == null) { return null; }
final TrPostUserVariableSaver save = new TrPostUserVariableSaver();
save.g_ = _src.getGravity().getValue();
-
if (_src.varUserCreateData_ != null) {
final Map map = new HashMap(_src.varUserCreateData_);
// on enleve les variables import\xE9es
@@ -185,7 +133,7 @@
// pas de sauvegarde possible ou non basee sur une expression
if (created != null && !created.isExpr() && created.createSaver() == null) {
varToRemove.add(var);
- varToRemove.addAll(TrPostDataCreatedExpr.getAllVarDependingOn(var, _src));
+ varToRemove.addAll(TrPostDataHelper.getAllVarDependingOn(var, _src));
}
}
if (Fu.DEBUG && FuLog.isDebug()) {
@@ -203,7 +151,6 @@
if (data != null) otherVar.put(e.getKey(), data);
}
}
-
save.varCreated_ = new H2dVariableTypeCreated[exprVar.size()];
save.expr_ = new String[exprVar.size()];
int idx = 0;
@@ -317,7 +264,7 @@
}
} else {
- varPostData.put(vari, TrPostDataCreatedExpr.createData(_src, expr.getParser(), varvar2d));
+ varPostData.put(vari, TrPostDataHelper.createData(_src, expr.getParser(), varvar2d));
}
}
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2010-01-03 21:43:37 UTC (rev 5583)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2010-01-03 21:46:16 UTC (rev 5584)
@@ -78,7 +78,7 @@
if (projet == null) return null;
// -- etape 1: recherche du source qui contient le path donn\xE9 --//
- TrPostSource src = projet.findSourceById(idSource);
+ TrPostSource src = projet.getSources().findSourceById(idSource);
// -- etape 2 si source pas trouv\xE9, chargement du source --//
if (src == null) {
@@ -87,7 +87,7 @@
((List<String>) parameters.get("errorMsg"))
// TODO traduire !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.add("Erreur, la frame calque ne trouve pas le fichier r\xE9sultat qui correspond \xE0 l'ID " + idSource);
- if (projet.listeSrc_.size() > 0) {
+ if (projet.getSources().isNotEmpty()) {
((List<String>) parameters.get("errorMsg")).add("Le calque chargera en contrepartie le fichier r\xE9sultat "
+ projet.getSource(0).getFiles().iterator().next().getPath());
// return null;
@@ -112,8 +112,7 @@
if (listeReloadSource != null && listeReloadSource.contains(idSource)) {
- }
- else {
+ } else {
// -- restorer les donn\xE9es --//
FudaaSaveZipLoader loader = null;
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|