|
From: <de...@us...> - 2010-01-03 21:48:45
|
Revision: 5587
http://fudaa.svn.sourceforge.net/fudaa/?rev=5587&view=rev
Author: deniger
Date: 2010-01-03 21:48:34 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSource.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2010-01-03 21:48:10 UTC (rev 5586)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2010-01-03 21:48:34 UTC (rev 5587)
@@ -45,7 +45,6 @@
*/
public JXTreeTable listProjets_;
-
TreeTableModelGraphe modelList_;
BuButton boutonAjoutSrc_ = new BuButton("Ajouter un projet", BuResource.BU.getIcon("crystal_ouvrirprojet"));
@@ -64,32 +63,30 @@
projet_.getObservable().addObserver(this);
// --creation de la liste graphique des projets --//
- modelList_ = constructStructureModel() ;//new TreeTableModelGraphe();
+ modelList_ = constructStructureModel();// new TreeTableModelGraphe();
listProjets_ = new JXTreeTable(modelList_);
-
listProjets_.setBorder(BorderFactory.createEtchedBorder());
-
- //-- listener du tree --//
+ // -- listener du tree --//
listProjets_.addMouseListener(new MouseAdapter() {
- @Override
- public void mousePressed(final MouseEvent e) {
- if (e.isPopupTrigger() && e.getClickCount() == 1) {
- affichePopupNode(e.getX(), e.getY());
+ @Override
+ public void mousePressed(final MouseEvent e) {
+ if (e.isPopupTrigger() && e.getClickCount() == 1) {
+ affichePopupNode(e.getX(), e.getY());
- }
}
+ }
- @Override
- public void mouseReleased(final MouseEvent e) {
- if (e.isPopupTrigger() && e.getClickCount() == 1) {
- affichePopupNode(e.getX(), e.getY());
- }
+ @Override
+ public void mouseReleased(final MouseEvent e) {
+ if (e.isPopupTrigger() && e.getClickCount() == 1) {
+ affichePopupNode(e.getX(), e.getY());
}
- });
-
+ }
+ });
+
setTitle(TrResource.getS("Gestion Multi-Sources"));
setLayout(new BorderLayout());
// Box centrePanel = Box.createHorizontalBox();
@@ -137,185 +134,162 @@
menu.add(fermer);
}
-
/**
* Affiche le popup correspondant au fichier cliqu\xE9
+ *
* @param x
* @param y
*/
public void affichePopupNode(final int x, final int y) {
- // Get the tree element under the mouse
- final TreePath clickedElement = listProjets_.getPathForLocation(x, y);
+ // Get the tree element under the mouse
+ final TreePath clickedElement = listProjets_.getPathForLocation(x, y);
-
- MutableTreeTableNode treeNode = null;
- if (clickedElement != null) treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent();
+ MutableTreeTableNode treeNode = null;
+ if (clickedElement != null) treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent();
- if (treeNode != null) {
+ if (treeNode != null) {
- // -- recuperation du node associe --//
- TrPostSource src=null;
- if(treeNode.getUserObject() instanceof TrPostSource)
- src=(TrPostSource) treeNode.getUserObject();
- else
- if(treeNode.getUserObject() instanceof File){
- if(treeNode.getParent().getUserObject() instanceof TrPostSource)
- src=(TrPostSource) treeNode.getParent().getUserObject();
- }
- if(src==null)
- return;
-
-
+ // -- recuperation du node associe --//
+ TrPostSource src = null;
+ if (treeNode.getUserObject() instanceof TrPostSource) src = (TrPostSource) treeNode.getUserObject();
+ else if (treeNode.getUserObject() instanceof File) {
+ if (treeNode.getParent().getUserObject() instanceof TrPostSource) src = (TrPostSource) treeNode.getParent()
+ .getUserObject();
+ }
+ if (src == null) return;
- // -- recuperation de la popup du node et ajout a l element du tree a al
- // bonne location--//
- JPopupMenu popup = null;
+ // -- recuperation de la popup du node et ajout a l element du tree a al
+ // bonne location--//
+ JPopupMenu popup = null;
- popup=new JPopupMenu();
-
- int indexSource=projet_.listeSrc_.indexOf(src);
-
- for(BuMenuItem item:this.projet_.getlisteSousMenuProjets_().get(indexSource)){
- if(item.getId()==null)
- item.setId(CtuluLibGenerator.getInstance().deliverUniqueStringId());
- popup.add(new BuMenuItem(item));
- }
-
- //-- affichage au bon endroit --//
- popup.show(listProjets_, x, y);
+ popup = new JPopupMenu();
-
+ int indexSource = projet_.getSources().getIndexOf(src);
- }
+ for (BuMenuItem item : this.projet_.getlisteSousMenuProjets_().get(indexSource)) {
+ if (item.getId() == null) item.setId(CtuluLibGenerator.getInstance().deliverUniqueStringId());
+ popup.add(new BuMenuItem(item));
+ }
- }
-
-
- public void valueChanged(final ListSelectionEvent e) {
+ // -- affichage au bon endroit --//
+ popup.show(listProjets_, x, y);
-
+ }
}
+ public void valueChanged(final ListSelectionEvent e) {
+
+ }
+
/**
* Construit le model du tableau.
+ *
* @return
*/
public TreeTableModelGraphe constructStructureModel() {
- DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Gestion multi-fichiers");
+ DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Gestion multi-fichiers");
- for (int i = 0; i <projet_.listeSrc_.size(); i++) {
- TrPostSource src= projet_.listeSrc_.get(i);
-
-
- DefaultMutableTreeTableNode nodeCalque = new DefaultMutableTreeTableNode(src);
- root.add(nodeCalque);
-
- //- ajout des fichiers associ\xE9s --//
- for(File f:src.getFiles())
- nodeCalque.add(new DefaultMutableTreeTableNode(f));
- }
- TreeTableModelGraphe model = new TreeTableModelGraphe(projet_);
- model.setRoot(root);
+ for (int i = 0; i < projet_.getSources().getSrcSize(); i++) {
+ TrPostSource src = projet_.getSource(i);
- return model;
- }
-
-
+ DefaultMutableTreeTableNode nodeCalque = new DefaultMutableTreeTableNode(src);
+ root.add(nodeCalque);
+
+ // - ajout des fichiers associ\xE9s --//
+ for (File f : src.getFiles())
+ nodeCalque.add(new DefaultMutableTreeTableNode(f));
+ }
+ TreeTableModelGraphe model = new TreeTableModelGraphe(projet_);
+ model.setRoot(root);
+
+ return model;
+ }
+
public class TreeTableModelGraphe extends DefaultTreeTableModel {
- String[] titre_;
- TrPostProjet projet;
-
-
+ String[] titre_;
+ TrPostProjet projet;
- public Class<?> getColumnClass(final int columnIndex) {
+ public Class<?> getColumnClass(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return Integer.class;
- case 1:
- return String.class;
- }
- return null;
- }
-
- // -- data correspondant au x donn\xE9 --//
- double[] dataY_ = new double[0];
+ switch (columnIndex) {
+ case 0:
+ return Integer.class;
+ case 1:
+ return String.class;
+ }
+ return null;
+ }
- public TreeTableModelGraphe(TrPostProjet p) {
- String[] val = {"Fichiers", "Date modification" };
- titre_ = val;
- projet=p;
- }
+ // -- data correspondant au x donn\xE9 --//
+ double[] dataY_ = new double[0];
- public int getColumnCount() {
+ public TreeTableModelGraphe(TrPostProjet p) {
+ String[] val = { "Fichiers", "Date modification" };
+ titre_ = val;
+ projet = p;
+ }
- return titre_.length;
- }
+ public int getColumnCount() {
- @Override
- public boolean isCellEditable(Object _node, int _column) {
- return false;
- }
+ return titre_.length;
+ }
- public String getColumnName(int _columnIndex) {
- return titre_[_columnIndex];
- }
+ @Override
+ public boolean isCellEditable(Object _node, int _column) {
+ return false;
+ }
- public int getRowCount() {
- return projet.listeSrc_.size();
+ public String getColumnName(int _columnIndex) {
+ return titre_[_columnIndex];
+ }
- }
+ public int getRowCount() {
+ return projet.getSources().getSrcSize();
- public Object getValueAt(Object node, int column) {
- Object res = new DefaultMutableTreeTableNode("n/a");
- if (node instanceof DefaultMutableTreeTableNode) {
- DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node;
- if (defNode.getUserObject() instanceof TrPostSource) {
- TrPostSource src=(TrPostSource)defNode.getUserObject();
- String label=(getRoot().getIndex(defNode)+1)+". "+ projet_.formatName(src.getTitle());
- if (column == 0)
- return label;
- else
- return "";
- } else if (defNode.getUserObject() instanceof File) {
- File fichier = (File) defNode.getUserObject();
-
- if (column == 0)
- return fichier.getAbsolutePath();
- else if (column == 1)
- return new Date(fichier.lastModified());
- else
- return "";
- }
- else
- return "";
- }
- return res;
- }
+ }
- public DefaultMutableTreeTableNode getTreeNode(int i) {
- return (DefaultMutableTreeTableNode) getRoot().getChildAt(i);
-
- }
-
- public void reload() {
-
- this.modelSupport.fireTreeStructureChanged(listProjets_.getPathForRow(0));
+ public Object getValueAt(Object node, int column) {
+ Object res = new DefaultMutableTreeTableNode("n/a");
+ if (node instanceof DefaultMutableTreeTableNode) {
+ DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node;
+ if (defNode.getUserObject() instanceof TrPostSource) {
+ TrPostSource src = (TrPostSource) defNode.getUserObject();
+ String label = (getRoot().getIndex(defNode) + 1) + ". " + projet_.formatName(src.getTitle());
+ if (column == 0) return label;
+ else return "";
+ } else if (defNode.getUserObject() instanceof File) {
+ File fichier = (File) defNode.getUserObject();
- }
-
-
- }
-
+ if (column == 0) return fichier.getAbsolutePath();
+ else if (column == 1) return new Date(fichier.lastModified());
+ else return "";
+ } else return "";
+ }
+ return res;
+ }
+
+ public DefaultMutableTreeTableNode getTreeNode(int i) {
+ return (DefaultMutableTreeTableNode) getRoot().getChildAt(i);
+
+ }
+
+ public void reload() {
+
+ this.modelSupport.fireTreeStructureChanged(listProjets_.getPathForRow(0));
+
+ }
+
+ }
+
public void update(final Observable o, final Object arg) {
// mise a jour de la liste
- if(listProjets_==null)return;
- listProjets_.setTreeTableModel(constructStructureModel());
- listProjets_.expandAll();
-// if(listProjets_.getModel() instanceof TreeTableModelGraphe)
-// ((TreeTableModelGraphe)listProjets_.getModel()).reload();
+ if (listProjets_ == null) return;
+ listProjets_.setTreeTableModel(constructStructureModel());
+ listProjets_.expandAll();
+ // if(listProjets_.getModel() instanceof TreeTableModelGraphe)
+ // ((TreeTableModelGraphe)listProjets_.getModel()).reload();
// selection par defaut de la premiere simul
listProjets_.clearSelection();
this.revalidate();
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSource.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSource.java 2010-01-03 21:48:10 UTC (rev 5586)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSource.java 2010-01-03 21:48:34 UTC (rev 5587)
@@ -14,7 +14,6 @@
import javax.swing.ListModel;
-import com.db4o.ObjectContainer;
import com.memoire.bu.BuMenu;
import org.fudaa.ctulu.*;
@@ -62,12 +61,6 @@
void buildDefaultVarUpdateLists();
- // TrPostInspectorReader createWatcher(TrPostProjet _proj, boolean _auto);
-
- // boolean isInspectable();
-
- // void setInspected(boolean _b);
-
boolean isInspected();
/**
@@ -123,7 +116,7 @@
* @param _int la progression
* @return true si la bd a ete modifiee
*/
- boolean openDatas(ProgressionInterface _int, CtuluAnalyze _analyze, ObjectContainer _db, CtuluUI _ui);
+ boolean openDatas(ProgressionInterface _int, CtuluAnalyze _analyze, CtuluUI _ui);
/**
* @param _variable la variable voulu
@@ -244,6 +237,7 @@
* @return true si creee par l'utilisateur
*/
boolean isUserCreatedVar(H2dVariableType _t);
+
/**
* @param _t la variable a tester
* @return true si definie dans les sources du projet
@@ -329,8 +323,7 @@
* @param _d
*/
void setDefaultPaletteMinPalette(H2dVariableType[] _v, boolean[] _actived, double[] _d);
-
-
- public void fillWithSourceCreationInfo(String _pref, Map _table) ;
-
+
+ public void fillWithSourceCreationInfo(String _pref, Map _table);
+
}
\ No newline at end of file
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2010-01-03 21:48:10 UTC (rev 5586)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2010-01-03 21:48:34 UTC (rev 5587)
@@ -78,10 +78,10 @@
import org.fudaa.fudaa.tr.common.TrResource;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreated;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedDefault;
-import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedExpr;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedFroud;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedMoins;
import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedPlus;
+import org.fudaa.fudaa.tr.post.data.TrPostDataHelper;
import org.fudaa.fudaa.tr.post.data.TrPostDataInfoDoc;
import org.fudaa.fudaa.tr.post.data.TrPostDataListener;
import org.fudaa.fudaa.tr.post.data.TrPostDataMinMaxGlobalItem;
@@ -169,7 +169,7 @@
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.debug("TRP: froud changed");
}
- fireVariableChanged(fr, fr, true, false, TrPostDataCreatedExpr.getAllVarDependingOn(fr,
+ fireVariableChanged(fr, fr, true, false, TrPostDataHelper.getAllVarDependingOn(fr,
TrPostSourceAbstract.this));
}
if (varUserCreateData_ != null) {
@@ -183,7 +183,7 @@
FuLog.debug("TRP: ->" + e.getKey() + " changed");
}
final H2dVariableType vChanged = (H2dVariableType) e.getKey();
- fireVariableChanged(vChanged, vChanged, true, false, TrPostDataCreatedExpr.getAllVarDependingOn(fr,
+ fireVariableChanged(vChanged, vChanged, true, false, TrPostDataHelper.getAllVarDependingOn(fr,
TrPostSourceAbstract.this));
}
}
@@ -1161,49 +1161,19 @@
return -1;
}
- public boolean openDatas(final ProgressionInterface _int, final CtuluAnalyze _analyze, final ObjectContainer _db,
- final CtuluUI _ui) {
- if (_db == null) { return false; }
+ public boolean openDatas(final ProgressionInterface _int, final CtuluAnalyze _analyze, final CtuluUI _ui) {
if (tmpContainer_ != null) {
FuLog.error("the database is already opened", new Throwable());
}
FudaaSaveLib.configureDb4o();
initializeTempDb(_analyze);
- info_ = (TrPostDataInfoDoc) FudaaSaveLib.getUniqueData(TrPostDataInfoDoc.class, _db);
// c'est la premiere fois que l'on ouvre le fichier de post.
// on enregistre les infos
- if (info_ == null) {
- CtuluLibMessage.info("file first open session");
- info_ = new TrPostDataInfoDoc();
- _db.close();
- return true;
- }
- boolean isDbUptodate = false;
- // Le fichier de post a ete modifie: il faut tout effacer
- // if (!readMinMaxSave() || info_.getLastModifiedTime() < f_.lastModified()) {
- // if (Fu.DEBUG && FuLog.isDebug()) {
- // FuLog.warning("FTR: the file " + f_.getName() + " is modified since last opening");
- // FuLog.warning("FTR: can read Min Max " + readMinMaxSave());
- // }
- // isDbUptodate = false;
- // info_.setFile(f_);
- // // getBdTemp().set(info);
- // } else if (tmpContainer_ != null) {
- // final Query q = _db.query();
- // q.constrain(TrPostDataMinMaxGlobalItem.class);
- // for (final ObjectSet s = q.execute(); s.hasNext();) {
- // tmpContainer_.set(s.next());
- // }
- //
- // }
- TrPostUserVariableSaver.loadVars(this, _analyze, _db, _int, _ui);
- TrPostTimeModelSaver.restore(this, _db, _int, isDbUptodate);
- afterOpenDatas(_int, _analyze);
- _db.close();
- return !isDbUptodate;
+
+ return true;
}
protected boolean readMinMaxSave() {
@@ -1383,7 +1353,7 @@
changeUserVar(_old, _new);
}
- fireVariableChanged(_old, _new, isFormuleChanged, false, TrPostDataCreatedExpr.getAllVarDependingOn(_old,
+ fireVariableChanged(_old, _new, isFormuleChanged, false, TrPostDataHelper.getAllVarDependingOn(_old,
TrPostSourceAbstract.this));
if (_cmd != null) {
_cmd.addCmd(new CtuluCommand() {
@@ -1421,8 +1391,6 @@
// }
public String getId() {
- // if(id_==null)
- // id_=generateId();
return id_;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|