001: /*
002: * SalomeTMF is a Test Management Framework
003: * Copyright (C) 2005 France Telecom R&D
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *
019: * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: */
023:
024: package org.objectweb.salome_tmf.ihm.main;
025:
026: import java.awt.BorderLayout;
027: import java.awt.Container;
028: import java.awt.Dimension;
029: import java.awt.Rectangle;
030: import java.awt.Toolkit;
031: import java.awt.event.ActionEvent;
032: import java.awt.event.ActionListener;
033: import java.util.ArrayList;
034:
035: import javax.swing.BorderFactory;
036: import javax.swing.Box;
037: import javax.swing.BoxLayout;
038: import javax.swing.JButton;
039: import javax.swing.JDialog;
040: import javax.swing.JPanel;
041: import javax.swing.JScrollPane;
042: import javax.swing.JTree;
043: import javax.swing.event.TreeSelectionEvent;
044: import javax.swing.event.TreeSelectionListener;
045: import javax.swing.tree.DefaultMutableTreeNode;
046: import javax.swing.tree.DefaultTreeModel;
047: import javax.swing.tree.MutableTreeNode;
048: import javax.swing.tree.TreePath;
049:
050: import org.objectweb.salome_tmf.api.Util;
051: import org.objectweb.salome_tmf.data.Family;
052: import org.objectweb.salome_tmf.data.SimpleData;
053: import org.objectweb.salome_tmf.data.Test;
054: import org.objectweb.salome_tmf.data.TestList;
055: import org.objectweb.salome_tmf.ihm.filtre.ISimpleDataFilter;
056: import org.objectweb.salome_tmf.ihm.filtre.TestTreeFiltrePanel;
057: import org.objectweb.salome_tmf.ihm.languages.Language;
058: import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
059: import org.objectweb.salome_tmf.ihm.models.TestTreeModel;
060: import org.objectweb.salome_tmf.ihm.models.TreeRenderer;
061:
062: /**
063: * Classe qui construit la fen?tre permettant de choisir les tests ? ins?rer
064: * dans une campagne
065: */
066: public class FillCampagne extends JDialog {
067: /**
068: * Mod?le de l'arbre des tests
069: */
070: protected TestTreeModel testTreeModel;
071:
072: /**
073: * Mod?le de l'arbre des campagnes
074: */
075: protected TestTreeModel campagneTreeModel;
076:
077: /**
078: * l'arbre des campagnes
079: */
080: JTree campagneTree;
081:
082: /**
083: * l'arbre des tests
084: */
085: JTree testTree;
086: ISimpleDataFilter testFilter;
087: /**
088: * Noeud s?lectionn? dans l'arbre des campagnes
089: */
090: DefaultMutableTreeNode campagneSelectedNode;
091:
092: /**
093: * Noeud s?lectionn? dans l'arbre des tests
094: */
095: DefaultMutableTreeNode testSelectedNode;
096:
097: /**
098: * Racine de l'arbre temporaire des campagnes
099: */
100: DefaultMutableTreeNode temporaryCampagneRootNode;
101:
102: /**
103: * Racine de l'arbre final des campagnes
104: */
105: DefaultMutableTreeNode realCampagneRoot;
106:
107: /**
108: * Toolkit
109: */
110: private Toolkit toolkit = Toolkit.getDefaultToolkit();
111:
112: /**
113: * Liste des tests s?lectionn?s
114: */
115: ArrayList temporaryTestList;
116:
117: /**
118: * Liste des suites s?lectionn?es
119: */
120: //ArrayList temporaryTestListList;
121: /**
122: * Liste des familles s?lectionn?es
123: */
124: //ArrayList temporaryFamilyList;
125: /**
126: * Mod?le de l'arbre qui sera finalement conserv?
127: */
128: TestTreeModel realModel;
129:
130: ArrayList testSelectedNodes;
131:
132: ArrayList campaignSelectedNodes;
133: /******************************************************************************/
134: /** CONSTRUCTEURS ***/
135: /******************************************************************************/
136:
137: boolean okSelected = false;
138:
139: /**
140: * Constructeur de la fen?tre pour l'ajout de tests ? une campagne.
141: * @param campagneRoot le noeud racine de la campagne
142: * @param model le mod?le de donn?es des tests
143: * @param testRoot la racine de l'arbre des tests
144: */
145: public FillCampagne(DefaultMutableTreeNode campagneRoot,
146: TestTreeModel model, DefaultMutableTreeNode testRoot) {
147:
148: super (SalomeTMFContext.getInstance().ptrFrame, true);
149:
150: temporaryTestList = new ArrayList();
151: //temporaryTestListList = new ArrayList();
152: //temporaryFamilyList = new ArrayList();
153:
154: campaignSelectedNodes = new ArrayList();
155: testSelectedNodes = new ArrayList();
156:
157: realCampagneRoot = campagneRoot;
158: realModel = model;
159:
160: TreeRenderer campagneRenderer = new TreeRenderer();
161: TreeRenderer testRenderer = new TreeRenderer();
162:
163: temporaryCampagneRootNode = new DefaultMutableTreeNode(
164: campagneRoot.getUserObject());
165:
166: campagneSelectedNode = temporaryCampagneRootNode;
167: campagneTree = new JTree();
168: campagneTreeModel = new TestTreeModel(
169: temporaryCampagneRootNode, campagneTree, null);
170: campagneTree.setModel(campagneTreeModel);
171:
172: initTemporaryTree(campagneRoot);
173:
174: campagneTree.setCellRenderer(campagneRenderer);
175: campagneTree
176: .addTreeSelectionListener(new TreeSelectionListener() {
177: public void valueChanged(TreeSelectionEvent e) {
178: campaignSelectedNodes.clear();
179: TreePath[] pathTab = campagneTree
180: .getSelectionPaths();
181: if (pathTab != null) {
182: for (int i = 0; i < pathTab.length; i++) {
183: campaignSelectedNodes.add(pathTab[i]
184: .getLastPathComponent());
185: }
186: }
187: }
188: });
189: testTree = new JTree();
190: testTreeModel = new TestTreeModel(testRoot, testTree, null);
191: testTree.setModel(testTreeModel);
192: TestTreeFiltrePanel pTestTreeFiltrePanel = new TestTreeFiltrePanel(
193: testTreeModel);
194: testFilter = pTestTreeFiltrePanel.getFilter();
195: testTree.setCellRenderer(testRenderer);
196: testTree.addTreeSelectionListener(new TreeSelectionListener() {
197: public void valueChanged(TreeSelectionEvent e) {
198: testSelectedNodes.clear();
199: TreePath[] pathTab = testTree.getSelectionPaths();
200: if (pathTab != null) {
201: for (int i = 0; i < pathTab.length; i++) {
202: testSelectedNodes.add(pathTab[i]
203: .getLastPathComponent());
204: }
205: }
206: }
207: });
208:
209: JButton removeButton = new JButton("<");
210: removeButton.setToolTipText(Language.getInstance().getText(
211: "Retirer_de_la_campagne"));
212: removeButton.addActionListener(new ActionListener() {
213: public void actionPerformed(ActionEvent e) {
214: int i = campaignSelectedNodes.size() - 1;
215: while (i >= 0) {
216: DefaultMutableTreeNode node = (DefaultMutableTreeNode) campaignSelectedNodes
217: .get(i);
218: ((DefaultTreeModel) campagneTree.getModel())
219: .removeNodeFromParent(node);
220: removeFromModel(node);
221: i = campaignSelectedNodes.size() - 1;
222: }
223: }
224: });
225:
226: JButton addButton = new JButton(">");
227: addButton.setToolTipText(Language.getInstance().getText(
228: "Ajouter_à_la_campagne"));
229: addButton.addActionListener(new ActionListener() {
230: public void actionPerformed(ActionEvent e) {
231: for (int i = 0; i < testSelectedNodes.size(); i++) {
232: Object nodeValue = ((DefaultMutableTreeNode) testSelectedNodes
233: .get(i)).getUserObject();
234: testSelectedNode = ((DefaultMutableTreeNode) testSelectedNodes
235: .get(i));
236: if (nodeValue instanceof Family) {
237: addNodeToNode(testSelectedNode,
238: temporaryCampagneRootNode);
239:
240: } else if (nodeValue instanceof TestList) {
241: DefaultMutableTreeNode familyNode = findFamilyNodeInCampagneTree(((TestList) nodeValue)
242: .getFamilyFromModel()
243: .getNameFromModel());
244: if (familyNode != null) {
245: addNodeToNode(testSelectedNode, familyNode);
246: } else {
247: DefaultMutableTreeNode newFamilyNode = addObject(
248: temporaryCampagneRootNode,
249: ((TestList) nodeValue)
250: .getFamilyFromModel(), true);
251: addNodeToNode(testSelectedNode,
252: newFamilyNode);
253: }
254: } else if (nodeValue instanceof Test) {
255: DefaultMutableTreeNode testListNode = findTestListNodeInCampagneTree(
256: ((Test) nodeValue)
257: .getTestListFromModel()
258: .getNameFromModel(),
259: ((Test) nodeValue)
260: .getTestListFromModel()
261: .getFamilyFromModel()
262: .getNameFromModel());
263: if (testListNode != null) {
264: addNodeToNode(testSelectedNode,
265: testListNode);
266: } else {
267: DefaultMutableTreeNode familyNode = findFamilyNodeInCampagneTree(((Test) nodeValue)
268: .getTestListFromModel()
269: .getFamilyFromModel()
270: .getNameFromModel());
271: if (familyNode != null) {
272: DefaultMutableTreeNode newListNode = addObject(
273: familyNode,
274: ((Test) nodeValue)
275: .getTestListFromModel(),
276: true);
277: addNodeToNode(testSelectedNode,
278: newListNode);
279: } else {
280: DefaultMutableTreeNode newFamilyNode = addObject(
281: temporaryCampagneRootNode,
282: ((Test) nodeValue)
283: .getTestListFromModel()
284: .getFamilyFromModel(),
285: true);
286: DefaultMutableTreeNode newList = addObject(
287: newFamilyNode,
288: ((Test) nodeValue)
289: .getTestListFromModel(),
290: true);
291: addNodeToNode(testSelectedNode, newList);
292: }
293: }
294: }
295: }
296: }
297: });
298:
299: JPanel buttonSet = new JPanel();
300: buttonSet.setLayout(new BoxLayout(buttonSet, BoxLayout.Y_AXIS));
301: buttonSet.add(addButton);
302: buttonSet.add(Box.createRigidArea(new Dimension(1, 25)));
303: buttonSet.add(removeButton);
304:
305: JScrollPane campagneScrollPane = new JScrollPane(campagneTree);
306: campagneScrollPane.setBorder(BorderFactory
307: .createTitledBorder(Language.getInstance().getText(
308: "Campagne")));
309: campagneScrollPane.setPreferredSize(new Dimension(300, 450));
310:
311: JScrollPane testScrollPane = new JScrollPane(testTree);
312: testScrollPane.setBorder(BorderFactory
313: .createTitledBorder(Language.getInstance().getText(
314: "Tests")));
315: testScrollPane.setPreferredSize(new Dimension(300, 450));
316:
317: JPanel southPanel = new JPanel();
318: southPanel.setLayout(new BorderLayout());
319: southPanel.add(testScrollPane, BorderLayout.CENTER);
320: southPanel.add(pTestTreeFiltrePanel, BorderLayout.SOUTH);
321:
322: JPanel windowPanel = new JPanel();
323: windowPanel.setLayout(new BoxLayout(windowPanel,
324: BoxLayout.X_AXIS));
325: //windowPanel.add(testScrollPane);
326: windowPanel.add(southPanel);
327: windowPanel.add(Box.createRigidArea(new Dimension(20, 50)));
328: windowPanel.add(buttonSet);
329: windowPanel.add(Box.createRigidArea(new Dimension(20, 50)));
330: windowPanel.add(campagneScrollPane);
331:
332: JButton validate = new JButton(Language.getInstance().getText(
333: "Valider"));
334: validate.setToolTipText(Language.getInstance().getText(
335: "Valider"));
336: validate.addActionListener(new ActionListener() {
337: public void actionPerformed(ActionEvent e) {
338: int nbChildren = temporaryCampagneRootNode
339: .getChildCount();
340: for (int k = realCampagneRoot.getChildCount() - 1; k >= 0; k--) {
341: realModel
342: .removeNodeFromParent((DefaultMutableTreeNode) realCampagneRoot
343: .getChildAt(k));
344: }
345: for (int i = 0; i < nbChildren; i++) {
346: //realCampagneRoot.add((DefaultMutableTreeNode)temporaryCampagneRootNode.getChildAt(0));
347: realModel
348: .insertNodeInto(
349: (DefaultMutableTreeNode) temporaryCampagneRootNode
350: .getChildAt(0),
351: realCampagneRoot, realCampagneRoot
352: .getChildCount());
353: //realModel.insertNodeInto((DefaultMutableTreeNode)temporaryCampagneRootNode.getChildAt(0), realCampagneRoot, realCampagneRoot.getChildCount());
354: }
355:
356: cleanTree(realModel, realCampagneRoot);
357: //DataModel.getCurrentCampaign().setFamilyList(temporaryFamilyList);
358: //DataModel.getCurrentCampaign().setTestListList(temporaryTestListList);
359: ArrayList newTestList = new ArrayList();
360:
361: int nbFamille = realCampagneRoot.getChildCount();
362: for (int i = 0; i < nbFamille; i++) {
363: DefaultMutableTreeNode familyNode = (DefaultMutableTreeNode) realCampagneRoot
364: .getChildAt(i);
365: int nbSuite = familyNode.getChildCount();
366: for (int j = 0; j < nbSuite; j++) {
367: DefaultMutableTreeNode suiteNode = (DefaultMutableTreeNode) familyNode
368: .getChildAt(j);
369: Util.log("[FillCampaign] with suite node "
370: + suiteNode.getUserObject());
371: int nbTest = suiteNode.getChildCount();
372: for (int k = 0; k < nbTest; k++) {
373: DefaultMutableTreeNode testNode = (DefaultMutableTreeNode) suiteNode
374: .getChildAt(k);
375: Util.log("[FillCampaign] with test node "
376: + testNode.getUserObject());
377: Test pTest = (Test) testNode
378: .getUserObject();
379: newTestList.add(pTest);
380: }
381: }
382: }
383: //System.out.println("fill campagne " + DataModel.getCurrentCampaign().getNameFromModel());
384: DataModel.getCurrentCampaign().fillCampInModel(
385: newTestList, DataModel.getCurrentUser());
386: //DataModel.getCurrentCampaign().fillCampInModel(temporaryTestList);
387: okSelected = true;
388: FillCampagne.this .dispose();
389: }
390: });
391:
392: JButton cancel = new JButton(Language.getInstance().getText(
393: "Annuler"));
394: cancel
395: .setToolTipText(Language.getInstance().getText(
396: "Annuler"));
397: cancel.addActionListener(new ActionListener() {
398: public void actionPerformed(ActionEvent e) {
399: okSelected = false;
400: FillCampagne.this .dispose();
401: }
402: });
403:
404: JPanel secondButtonSet = new JPanel();
405: secondButtonSet.add(validate);
406: secondButtonSet.add(cancel);
407:
408: JPanel center = new JPanel();
409: center.add(windowPanel);
410:
411: JPanel page = new JPanel();
412: page.setLayout(new BoxLayout(page, BoxLayout.Y_AXIS));
413: page.add(center);
414: page.add(secondButtonSet);
415:
416: Container contentPaneFrame = this .getContentPane();
417: contentPaneFrame.add(page, BorderLayout.CENTER);
418: this .setTitle(Language.getInstance().getText(
419: "AJouter_des_tests_à_une_campagne"));
420: /*this.pack();
421: this.setLocationRelativeTo(this.getParent());
422: this.setVisible(true);
423: */
424: centerScreen();
425: } // Fin du constructeur FillCampagne/2
426:
427: void centerScreen() {
428: Dimension dim = getToolkit().getScreenSize();
429: this .pack();
430: Rectangle abounds = getBounds();
431: setLocation((dim.width - abounds.width) / 2,
432: (dim.height - abounds.height) / 2);
433: this .setVisible(true);
434: requestFocus();
435: }
436:
437: /**
438: * M?thode R?cursive qui ajoute un noeud ? un autre noeud. Tous les fils du
439: * noeud ? ajouter sont aussi ajouter r?cursivement.
440: * @param nodeToBeAdded le noeud ? ajouter
441: * @param nodeToReceive le noeud qui re?oit
442: */
443: private void addNodeToNode(DefaultMutableTreeNode nodeToBeAdded,
444: DefaultMutableTreeNode nodeToReceive) {
445: DefaultMutableTreeNode newNode = null;
446: for (int j = 0; j < nodeToReceive.getChildCount(); j++) {
447: if (((DefaultMutableTreeNode) nodeToReceive.getChildAt(j))
448: .getUserObject().equals(
449: nodeToBeAdded.getUserObject())) {
450: newNode = (DefaultMutableTreeNode) nodeToReceive
451: .getChildAt(j);
452: }
453: }
454: if (newNode == null) {
455: SimpleData data = (SimpleData) nodeToBeAdded
456: .getUserObject();
457: if (testFilter != null) {
458: if (testFilter.isFiltred(data)) {
459: newNode = new DefaultMutableTreeNode(nodeToBeAdded
460: .getUserObject());
461: campagneTreeModel.insertNodeInto(newNode,
462: nodeToReceive, nodeToReceive
463: .getChildCount());
464: campagneTree.scrollPathToVisible(new TreePath(
465: newNode.getPath()));
466: /*if (nodeToBeAdded.getUserObject() instanceof Family) {
467: temporaryFamilyList.add(nodeToBeAdded.getUserObject());
468: } else if (nodeToBeAdded.getUserObject() instanceof TestList) {
469: temporaryTestListList.add(nodeToBeAdded.getUserObject());
470: } else */if (nodeToBeAdded.getUserObject() instanceof Test) {
471: temporaryTestList.add(nodeToBeAdded
472: .getUserObject());
473: }
474: }
475: } else {
476: newNode = new DefaultMutableTreeNode(nodeToBeAdded
477: .getUserObject());
478: campagneTreeModel.insertNodeInto(newNode,
479: nodeToReceive, nodeToReceive.getChildCount());
480: campagneTree.scrollPathToVisible(new TreePath(newNode
481: .getPath()));
482: /*if (nodeToBeAdded.getUserObject() instanceof Family) {
483: temporaryFamilyList.add(nodeToBeAdded.getUserObject());
484: } else if (nodeToBeAdded.getUserObject() instanceof TestList) {
485: temporaryTestListList.add(nodeToBeAdded.getUserObject());
486: } else */if (nodeToBeAdded.getUserObject() instanceof Test) {
487: temporaryTestList
488: .add(nodeToBeAdded.getUserObject());
489: }
490: }
491:
492: }
493: for (int i = 0; i < nodeToBeAdded.getChildCount(); i++) {
494: addNodeToNode((DefaultMutableTreeNode) nodeToBeAdded
495: .getChildAt(i), newNode);
496: }
497: } // Fin de la m?thode addNodeToNode/2
498:
499: /**
500: * M?thode qui retourne le noeud correspondant ? une famille si le nom pass?
501: * en param?tre est le nom d'une famille pr?sente dans l'arbre des campagnes
502: * @param familyName un nom
503: * @return le noeud correspondant ? une famille si le nom pass?
504: * en param?tre est le nom d'une famille pr?sente dans l'arbre des campagnes,
505: * <code>null</code> sinon.
506: */
507: public DefaultMutableTreeNode findFamilyNodeInCampagneTree(
508: String familyName) {
509: DefaultMutableTreeNode root = (DefaultMutableTreeNode) campagneTreeModel
510: .getRoot();
511: for (int j = 0; j < root.getChildCount(); j++) {
512: DefaultMutableTreeNode familyNode = (DefaultMutableTreeNode) root
513: .getChildAt(j);
514: if (familyNode.getUserObject() instanceof Family
515: && ((Family) familyNode.getUserObject())
516: .getNameFromModel().equals(familyName)) {
517: return familyNode;
518: }
519: }
520: return null;
521: } // Fin de la m?thode findFamilyNode/1
522:
523: /**
524: * M?thode qui retourne le noeud correspondant ? une suite si le nom pass?
525: * en param?tre est le nom d'une suite pr?sente dans l'arbre des campagnes
526: * @param testListName un nom
527: * @return le noeud correspondant ? une famille si le nom pass?
528: * en param?tre est le nom d'une famille pr?sente dans l'arbre des campagnes,
529: * <code>null</code> sinon.
530: */
531: public DefaultMutableTreeNode findTestListNodeInCampagneTree(
532: String testListName, String familyName) {
533: DefaultMutableTreeNode root = (DefaultMutableTreeNode) campagneTreeModel
534: .getRoot();
535: for (int j = 0; j < root.getChildCount(); j++) {
536: DefaultMutableTreeNode familyNode = (DefaultMutableTreeNode) root
537: .getChildAt(j);
538: if (familyNode.getUserObject() instanceof Family
539: && ((Family) familyNode.getUserObject())
540: .getNameFromModel().equals(familyName)) {
541: for (int k = 0; k < familyNode.getChildCount(); k++) {
542: DefaultMutableTreeNode testListNode = (DefaultMutableTreeNode) familyNode
543: .getChildAt(k);
544: if (testListNode.getUserObject() instanceof TestList
545: && ((TestList) testListNode.getUserObject())
546: .getNameFromModel().equals(
547: testListName)) {
548: return testListNode;
549: }
550: }
551: }
552: }
553: return null;
554: } // Fin de la m?thode findFamilyNode/1
555:
556: /**
557: * M?thode d'ajout d'un noeud dans l'arbre sous le parent.
558: * @param parent le parent
559: * @param child le noeud ? ajouter
560: * @param shouldBeVisible visible ou non
561: * @return le nouveau noeud de l'arbre
562: */
563: public DefaultMutableTreeNode addObject(
564: DefaultMutableTreeNode parent, Object child,
565: boolean shouldBeVisible) {
566:
567: DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(
568: child);
569: if (parent == null) {
570: parent = temporaryCampagneRootNode;
571: }
572:
573: // Insertion du noeud
574: campagneTreeModel.insertNodeInto(childNode, parent, parent
575: .getChildCount());
576:
577: // on s'assure que le noeud est visible
578: if (shouldBeVisible) {
579: campagneTree.scrollPathToVisible(new TreePath(childNode
580: .getPath()));
581: }
582: return childNode;
583: } // Fin de la classe addObject/3
584:
585: /**
586: * Suppression du noeud courant.
587: */
588: public void removeCurrentNode() {
589: TreePath currentSelection = campagneTree.getSelectionPath();
590: if (currentSelection != null) {
591: DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) (currentSelection
592: .getLastPathComponent());
593: MutableTreeNode parent = (MutableTreeNode) (currentNode
594: .getParent());
595: if (parent != null) {
596: campagneTreeModel.removeNodeFromParent(currentNode);
597: removeFromModel(currentNode);
598: return;
599: }
600: }
601: // Si aucune s?lection ou si la racine est s?lectionn?e
602: toolkit.beep();
603: } // Fin de la classe removeCurrentNode/0
604:
605: /**
606: * Supprime du mod?le les ?l?ments retir?s de la campagne.
607: * @param node le noeud ? partir duquel on retire les ?l?ments
608: */
609: private void removeFromModel(DefaultMutableTreeNode node) {
610: for (int i = 0; i < node.getChildCount(); i++) {
611: removeFromModel((DefaultMutableTreeNode) node.getChildAt(i));
612: }
613: /*if (node.getUserObject() instanceof Family) {
614: temporaryFamilyList.remove(node.getUserObject());
615: } else if (node.getUserObject() instanceof TestList) {
616: temporaryTestListList.remove(node.getUserObject());
617: } else */if (node.getUserObject() instanceof Test) {
618: temporaryTestList.remove(node.getUserObject());
619: }
620: } // Fin de la m?thode removeFromModel/1
621:
622: /**
623: * M?thode qui initialise l'arbre temporaire ? partir de la racine pass?
624: * en param?tre.
625: * @param root la racine du nouvel arbre temporaire
626: */
627: public void initTemporaryTree(DefaultMutableTreeNode root) {
628: for (int i = 0; i < root.getChildCount(); i++) {
629: addNodeToNode((DefaultMutableTreeNode) root.getChildAt(i),
630: temporaryCampagneRootNode);
631: }
632: } // Fin de la m?thode initTemporaryTree/1
633:
634: public void cleanTree(TestTreeModel model,
635: DefaultMutableTreeNode root) {
636:
637: /*for (int i = root.getChildCount()-1; i >=0 ; i--) {
638: DefaultMutableTreeNode familyNode = (DefaultMutableTreeNode)root.getChildAt(i);
639: for (int j = familyNode.getChildCount()-1; j >= 0 ; j--) {
640: if (familyNode.getChildAt(j).getChildCount() == 0) {
641: temporaryTestListList.remove(((DefaultMutableTreeNode)familyNode.getChildAt(j)).getUserObject());
642: ((Family)familyNode.getUserObject()).getTestListList().remove(((DefaultMutableTreeNode)familyNode.getChildAt(j)).getUserObject());
643: model.removeNodeFromParent((DefaultMutableTreeNode)familyNode.getChildAt(j));
644:
645: }
646: }
647: if (familyNode.getChildCount() == 0) {
648: temporaryFamilyList.remove((familyNode).getUserObject());
649: model.removeNodeFromParent(familyNode);
650:
651: }
652: }*/
653: }
654:
655: public boolean okSelected() {
656: return okSelected;
657: }
658: } // Fin de la classe FillCampagne
|