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.admin;
025:
026: import java.awt.Color;
027: import java.awt.Component;
028: import java.awt.Container;
029: import java.awt.Dimension;
030: import java.awt.FlowLayout;
031: import java.awt.Frame;
032: import java.awt.event.ActionEvent;
033: import java.awt.event.ActionListener;
034: import java.awt.event.MouseAdapter;
035: import java.awt.event.MouseEvent;
036: import java.awt.event.WindowEvent;
037: import java.awt.event.WindowListener;
038: import java.util.EventObject;
039:
040: import javax.swing.BoxLayout;
041: import javax.swing.JButton;
042: import javax.swing.JCheckBox;
043: import javax.swing.JDialog;
044: import javax.swing.JPanel;
045: import javax.swing.JScrollPane;
046: import javax.swing.JTabbedPane;
047: import javax.swing.JTree;
048: import javax.swing.event.CellEditorListener;
049: import javax.swing.tree.DefaultMutableTreeNode;
050: import javax.swing.tree.DefaultTreeModel;
051: import javax.swing.tree.TreeCellEditor;
052: import javax.swing.tree.TreeCellRenderer;
053:
054: import org.objectweb.salome_tmf.data.Group;
055: import org.objectweb.salome_tmf.ihm.languages.Language;
056:
057: /**
058: * Classe qui permet de cr?er une fen?tre peremttant de g?rer les droits des
059: * groupes.
060:
061: */
062: public class GroupAccess extends JDialog {
063:
064: /**
065: * Le noeud s?lectionn?
066: */
067: DefaultMutableTreeNode selectedNode;
068:
069: //Tests
070: /**
071: * La check box racine de l'arbre des tests
072: */
073: JCheckBox testCheckroot;
074:
075: /**
076: * la racine de l'arbre pour les tests
077: */
078: DefaultMutableTreeNode testRootNode;
079:
080: /**
081: * Mod?le de l'arbre pour les tests
082: */
083: DefaultTreeModel testModel;
084:
085: /**
086: * Arbre pour les tests
087: */
088: JTree testTree;
089:
090: // Campagne
091: /**
092: * La checkBox racine de l'arbre des campagnes
093: */
094: JCheckBox campagneCheckroot;
095:
096: /**
097: * La racine de l'arbre des campagnes
098: */
099: DefaultMutableTreeNode campagneRootNode;
100:
101: /**
102: * Mod?le de donn?es pour l'arbre des campagnes
103: */
104: DefaultTreeModel campagneModel;
105:
106: /**
107: * L'arbre des campagnes
108: */
109: JTree campagneTree;
110:
111: //Admin
112: /**
113: * La checkBox racine de l'arbre de l'admin
114: */
115: JCheckBox adminCheckroot;
116:
117: /**
118: * La racine de l'arbre d'administration
119: */
120: DefaultMutableTreeNode adminRootNode;
121:
122: /**
123: * Le mod?le de donn?es de l'arbre d'administration
124: */
125: DefaultTreeModel adminModel;
126:
127: /**
128: * Arbre d'administration
129: */
130: JTree adminTree;
131:
132: /**
133: * Tableau des permissions pour les suites de tests
134: */
135: boolean[] permissionsOfTest;
136:
137: /**
138: * Tableau pour les permissions pour les campagnes
139: */
140: boolean[] permissionsOfCampaign;
141:
142: /**
143: * Groupe courant
144: */
145: Group observedGroup;
146:
147: /******************************************************************************/
148: /** CONSTRUCTEUR ***/
149: /******************************************************************************/
150:
151: /**
152: * Le constructeur de la vue sur les droits des groupes
153: */
154: public GroupAccess(boolean modify, Group group, Frame owner,
155: boolean canBeModified) {
156:
157: super (owner, true);
158: testCheckroot = new JCheckBox(Language.getInstance().getText(
159: "Toutes_les_permissions"));
160: testRootNode = new DefaultMutableTreeNode(testCheckroot);
161: testModel = new DefaultTreeModel(testRootNode);
162: testTree = new JTree(testModel);
163: campagneCheckroot = new JCheckBox(Language.getInstance()
164: .getText("Toutes_les_permissions"));
165: campagneRootNode = new DefaultMutableTreeNode(campagneCheckroot);
166: campagneModel = new DefaultTreeModel(campagneRootNode);
167: campagneTree = new JTree(campagneModel);
168: // adminCheckroot = new JCheckBox("Toutes les permissions");
169: // adminRootNode = new DefaultMutableTreeNode(adminCheckroot);
170: // adminModel = new DefaultTreeModel(adminRootNode);
171: // adminTree = new JTree(adminModel);
172: JTabbedPane tabs = new JTabbedPane();
173: JPanel tests = new JPanel();
174: tests.setLayout(new BoxLayout(tests, BoxLayout.Y_AXIS));
175: JPanel campagne = new JPanel();
176: campagne.setLayout(new BoxLayout(campagne, BoxLayout.Y_AXIS));
177: JPanel admin = new JPanel();
178: admin.setLayout(new BoxLayout(admin, BoxLayout.Y_AXIS));
179: permissionsOfTest = new boolean[3];
180: permissionsOfCampaign = new boolean[4];
181:
182: // Onglets
183: tabs.addTab(Language.getInstance().getText("Suites_de_test"),
184: tests);
185: tabs.addTab(Language.getInstance().getText("Campagne_de_test"),
186: campagne);
187: // tabs.addTab("Administration", admin);
188: tabs.setPreferredSize(new Dimension(500, 350));
189:
190: JPanel buttonPanel = new JPanel(new FlowLayout(
191: FlowLayout.CENTER));
192:
193: //tests.add(principalListPanel1,BorderLayout.WEST);
194: if (canBeModified) {
195: JButton validateButton = new JButton(Language.getInstance()
196: .getText("Valider"));
197: validateButton.setToolTipText(Language.getInstance()
198: .getText("Valider"));
199: validateButton.addActionListener(new ActionListener() {
200: public void actionPerformed(ActionEvent e) {
201: for (int i = 0; i < testRootNode.getChildCount(); i++) {
202: JCheckBox box = (JCheckBox) ((DefaultMutableTreeNode) testRootNode
203: .getChildAt(i)).getUserObject();
204: observedGroup.changeTestPermissionInModel(i,
205: box.isSelected());
206: }
207: for (int i = 0; i < campagneRootNode
208: .getChildCount(); i++) {
209: JCheckBox box = (JCheckBox) ((DefaultMutableTreeNode) campagneRootNode
210: .getChildAt(i)).getUserObject();
211: observedGroup.changeCampaignPermissionInModel(
212: i, box.isSelected());
213: }
214: GroupAccess.this .dispose();
215: }
216: });
217: buttonPanel.add(validateButton);
218: }
219:
220: JButton cancelButton = new JButton();
221: if (canBeModified) {
222: cancelButton.setText(Language.getInstance().getText(
223: "Annuler"));
224: cancelButton.setToolTipText(Language.getInstance().getText(
225: "Annuler"));
226: } else {
227: cancelButton.setText(Language.getInstance().getText(
228: "Fermer"));
229: cancelButton.setToolTipText(Language.getInstance().getText(
230: "Fermer_la_fenêtre"));
231: }
232:
233: cancelButton.addActionListener(new ActionListener() {
234: public void actionPerformed(ActionEvent e) {
235: observedGroup = null;
236: GroupAccess.this .dispose();
237: }
238: });
239:
240: buttonPanel.add(cancelButton);
241:
242: // Arbre pour les permissions des tests
243:
244: CheckBoxRenderer testRenderer = new CheckBoxRenderer();
245: CheckBoxCellEditor testEditor = new CheckBoxCellEditor();
246: createTestsTree(testRootNode);
247:
248: testTree.setCellRenderer(testRenderer);
249: testTree.setCellEditor(testEditor);
250: if (modify) {
251: testTree.setEditable(true);
252: } else {
253: testTree.setEditable(false);
254: }
255:
256: testTree.setRootVisible(true);
257: testCheckroot.addMouseListener(new checkBoxMouseListener(
258: testTree));
259: JScrollPane testTreeScrollPane = new JScrollPane(testTree);
260:
261: tests.add(testTreeScrollPane);
262:
263: // Arbre pour les permissions des campagnes
264:
265: CheckBoxRenderer campagneRenderer = new CheckBoxRenderer();
266: CheckBoxCellEditor campagneEditor = new CheckBoxCellEditor();
267: createCampagneTree(campagneRootNode);
268:
269: campagneTree.setCellRenderer(campagneRenderer);
270: campagneTree.setCellEditor(campagneEditor);
271: if (modify) {
272: campagneTree.setEditable(true);
273: } else {
274: campagneTree.setEditable(false);
275: }
276:
277: campagneTree.setRootVisible(true);
278: campagneCheckroot.addMouseListener(new checkBoxMouseListener(
279: campagneTree));
280: JScrollPane campagneTreeScrollPane = new JScrollPane(
281: campagneTree);
282:
283: campagne.add(campagneTreeScrollPane);
284:
285: this .addWindowListener(new WindowListener() {
286: public void windowClosing(WindowEvent e) {
287: observedGroup = null;
288: }
289:
290: public void windowDeiconified(WindowEvent e) {
291: }
292:
293: public void windowOpened(WindowEvent e) {
294: }
295:
296: public void windowActivated(WindowEvent e) {
297: }
298:
299: public void windowDeactivated(WindowEvent e) {
300: }
301:
302: public void windowClosed(WindowEvent e) {
303: }
304:
305: public void windowIconified(WindowEvent e) {
306: }
307: });
308:
309: // Initialisation des donn?es
310: initData(group);
311:
312: // Affichage
313: Container contentPaneFrame = this .getContentPane();
314: contentPaneFrame.setLayout(new BoxLayout(contentPaneFrame,
315: BoxLayout.Y_AXIS));
316: contentPaneFrame.add(tabs);
317: contentPaneFrame.add(buttonPanel);
318: this .setTitle(Language.getInstance().getText("Permissions"));
319: //this.setLocation(400,300);
320: this .setLocationRelativeTo(this .getParent());
321: this .pack();
322: this .setVisible(true);
323:
324: } // Fin du constructeur GroupAccess/0
325:
326: /******************************************************************************/
327: /** METHODES PUBLIQUES ***/
328: /******************************************************************************/
329:
330: /**
331: * Cr?ation de l'arbre des tests
332: * @param root la racine de l'arbre
333: */
334: private void createTestsTree(DefaultMutableTreeNode root) {
335: String[] mainNodes = {
336: Language.getInstance().getText("Ajouter"),
337: Language.getInstance().getText("Modifier"),
338: Language.getInstance().getText("Supprimer") };
339:
340: // String[] listTestsModification = {"Nom de la suite", "Attachements", "Description", "Famille de tests", "Ordre de la suite"};
341: // String[] testsModification = {"Nom du test"};
342: for (int i = 0; i < mainNodes.length; i++) {
343: JCheckBox box = new JCheckBox(mainNodes[i]);
344: box.addMouseListener(new checkBoxMouseListener(testTree));
345: DefaultMutableTreeNode node = new DefaultMutableTreeNode(
346: box, true);
347: root.add(node);
348: //
349: }
350: testModel.setRoot(root);
351: } // Fin de la m?thode createTestsTree/1
352:
353: /**
354: * Cr?ation de l'arbre des campagnes
355: * @param root la racine de l'arbre
356: */
357: private void createCampagneTree(DefaultMutableTreeNode root) {
358: String[] mainNodes = {
359: Language.getInstance().getText("Ajouter"),
360: Language.getInstance().getText("Modifier"),
361: Language.getInstance().getText("Supprimer"),
362: Language.getInstance().getText("Exécuter") };
363:
364: // String[] listTestsModification = {"Nom de la suite", "Attachements", "Description", "Famille de tests", "Ordre de la suite"};
365: // String[] testsModification = {"Nom du test"};
366: for (int i = 0; i < mainNodes.length; i++) {
367: JCheckBox box = new JCheckBox(mainNodes[i]);
368: box
369: .addMouseListener(new checkBoxMouseListener(
370: campagneTree));
371: DefaultMutableTreeNode node = new DefaultMutableTreeNode(
372: box, true);
373: root.add(node);
374: //
375: }
376: campagneModel.setRoot(root);
377: } // Fin de la m?thode createCampagneTree/1
378:
379: /**
380: * Cr?ation de l'arbre de l'administration
381: * @param root la racine de l'arbre
382: */
383: /*private void createAdminTree(DefaultMutableTreeNode root) {
384: String[] mainNodes = {"Ajouter un utilisateur", "Suprimer un utilisateur",
385: "Ajouter un groupe", "Supprimer un groupe"};
386:
387: for (int i = 0; i < mainNodes.length; i ++) {
388: JCheckBox box = new JCheckBox(mainNodes[i]);
389: box.addMouseListener(new checkBoxMouseListener(adminTree));
390:
391: DefaultMutableTreeNode node = new DefaultMutableTreeNode(new JCheckBox(mainNodes[i]), true);
392: root.add(node);
393: }
394: adminModel.setRoot(root);
395: } // Fin de la m?thode createAdminTree/1
396: */
397:
398: /**
399: * Classe interne d?finissant le renderer de l'arbre (pour prendre en compte
400: * les checkBox)
401: * @author teaml039
402: * @version : 0.1
403: */
404: class CheckBoxRenderer implements TreeCellRenderer {
405: /**
406: * Surcharge de la m?thode qui calcule le renderer des noeuds de
407: * l'arbre
408: */
409: public Component getTreeCellRendererComponent(JTree tree,
410: Object obj, boolean selected, boolean expanded,
411: boolean leaf, int row, boolean hasFocus) {
412:
413: DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj;
414:
415: JCheckBox box = (JCheckBox) node.getUserObject();
416: box.setBackground(new Color(255, 255, 255));
417: return box;
418: } // Fin de la m?thode getTreeCellRendererComponent/7
419: } // Fin de la classe CheckBoxRenderer
420:
421: /**
422: * Classe interne qui d?finit un listener de la souris qui permet de
423: * g?rer la s?lection des checkbox
424: * @author teaml039
425: * @version : 0.1
426: */
427: class checkBoxMouseListener extends MouseAdapter {
428:
429: /**
430: * l'arbre de checkbox
431: */
432: JTree _tree;
433:
434: /**
435: * Constructeur du listener
436: * @param tree l'arbre sur lequel on place le listener
437: */
438: public checkBoxMouseListener(JTree tree) {
439: _tree = tree;
440: } // Fin du constructeur checkBoxMouseListener/1
441:
442: /**
443: * Appel?e lorsque l'on appuie sur un bouton de la souris
444: * @param e un ?v?nement relatif ? la souris
445: */
446: public void mousePressed(MouseEvent e) {
447: maybeShowPopup(e);
448: } // Fin de la m?thode mousePressed/1
449:
450: /**
451: * Appel?e lorsque l'on relache un bouton de la souris
452: * @param e un ?v?nement relatif ? la souris
453: */
454: public void mouseReleased(MouseEvent e) {
455: maybeShowPopup(e);
456: } // Fin de la m?thode mouseReleased/1
457:
458: /**
459: * Traite les diff?rents clics de la souris
460: * @param e un ?v?nement relatif ? la souris
461: */
462: private void maybeShowPopup(MouseEvent e) {
463: DefaultMutableTreeNode node_actif = (DefaultMutableTreeNode) _tree
464: .getLastSelectedPathComponent();
465: if (e.getButton() == MouseEvent.BUTTON1) {
466: JCheckBox box = (JCheckBox) node_actif.getUserObject();
467: if (node_actif.getChildCount() > 0) {
468: changeCheckBoxValuesDown(node_actif);
469: ((DefaultTreeModel) _tree.getModel())
470: .nodeChanged(node_actif);
471: }
472: DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node_actif
473: .getParent();
474:
475: if (((JCheckBox) node_actif.getUserObject()).getText()
476: .equals(
477: Language.getInstance().getText(
478: "Supprimer"))) {
479: boolean value = ((JCheckBox) node_actif
480: .getUserObject()).isSelected();
481: if (value) {
482: DefaultMutableTreeNode brother = node_actif
483: .getPreviousNode();
484: ((JCheckBox) brother.getUserObject())
485: .setSelected(value);
486: brother = brother.getPreviousNode();
487: ((JCheckBox) brother.getUserObject())
488: .setSelected(value);
489: }
490: } else if (((JCheckBox) node_actif.getUserObject())
491: .getText().equals(
492: Language.getInstance().getText(
493: "Ajouter"))) {
494: boolean value = ((JCheckBox) node_actif
495: .getUserObject()).isSelected();
496: if (value) {
497: DefaultMutableTreeNode brother = node_actif
498: .getNextNode();
499: ((JCheckBox) brother.getUserObject())
500: .setSelected(value);
501: } else {
502: DefaultMutableTreeNode brother = node_actif
503: .getNextNode().getNextNode();
504: ((JCheckBox) brother.getUserObject())
505: .setSelected(value);
506: }
507: } else if (((JCheckBox) node_actif.getUserObject())
508: .getText().equals(
509: Language.getInstance().getText(
510: "Modifier"))) {
511: boolean value = ((JCheckBox) node_actif
512: .getUserObject()).isSelected();
513: if (!value) {
514: DefaultMutableTreeNode brother = node_actif
515: .getPreviousNode();
516: ((JCheckBox) brother.getUserObject())
517: .setSelected(value);
518: brother = node_actif.getNextNode();
519: ((JCheckBox) brother.getUserObject())
520: .setSelected(value);
521: }
522: }
523:
524: if (!box.isSelected()) {
525: if (parent != null) {
526: //((JCheckBox)parent.getUserObject()).setSelected(false);
527: changeValueUp(parent);
528: ((DefaultTreeModel) _tree.getModel())
529: .nodeChanged((DefaultMutableTreeNode) _tree
530: .getModel().getRoot());
531: }
532: } else {
533: DefaultMutableTreeNode upNode = changeCheckBoxValuesUp(parent);
534: if (upNode != null) {
535: ((DefaultTreeModel) _tree.getModel())
536: .nodeChanged(upNode);
537: } else {
538: ((DefaultTreeModel) _tree.getModel())
539: .nodeChanged((DefaultMutableTreeNode) _tree
540: .getModel().getRoot());
541: }
542: }
543: }
544: } // Fin de la m?thode maybeShowPopup/1
545:
546: /**
547: * M?thode qui permet de changer r?cursivement les valeurs des checkbox
548: * d'un noeud vers ses fils.
549: * @param node un noeud dont on change la valeur
550: */
551: public void changeCheckBoxValuesDown(DefaultMutableTreeNode node) {
552: for (int i = 0; i < node.getChildCount(); i++) {
553: boolean value = ((JCheckBox) node.getUserObject())
554: .isSelected();
555: ((JCheckBox) ((DefaultMutableTreeNode) node
556: .getChildAt(i)).getUserObject())
557: .setSelected(value);
558: changeCheckBoxValuesDown((DefaultMutableTreeNode) node
559: .getChildAt(i));
560: }
561: } // Fin de la m?thode changeCheckBoxValuesDown/1
562:
563: /**
564: * Changement des valeurs des checkbox vers les parents lorsque l'on
565: * passe la valeur ? vrai
566: * @param parent le noeud
567: * @return le dernier noeud dans la remont?e
568: */
569: public DefaultMutableTreeNode changeCheckBoxValuesUp(
570: DefaultMutableTreeNode parent) {
571: if (parent != null) {
572: int nb = 0;
573: for (int i = 0; i < parent.getChildCount(); i++) {
574: if (((JCheckBox) ((DefaultMutableTreeNode) parent
575: .getChildAt(i)).getUserObject())
576: .isSelected()) {
577: nb++;
578: }
579: }
580: if (nb == parent.getChildCount()) {
581: ((JCheckBox) parent.getUserObject())
582: .setSelected(true);
583: }
584: return changeCheckBoxValuesUp((DefaultMutableTreeNode) parent
585: .getParent());
586: } else {
587: return null;
588: }
589: } // Fin de la m?thode changeCheckBoxValuesUp/1
590:
591: /**
592: * Changement des valeurs des checkbox vers les parents lorsque l'on
593: * passe la valeur ? faux
594: * @param parent un noeud
595: */
596: public void changeValueUp(DefaultMutableTreeNode parent) {
597: ((JCheckBox) parent.getUserObject()).setSelected(false);
598: if (parent.getParent() != null) {
599: changeValueUp((DefaultMutableTreeNode) parent
600: .getParent());
601: }
602: } // Fin de la m?thode changeValueUp/1
603:
604: }// Fin de la classe checkBoxMouseListener
605:
606: /**
607: * Classe interne d?finissant un nouvel ?diteur pour l'arbre des checkbox
608: * @author teaml039
609: * @version : 0.1
610: */
611: class CheckBoxCellEditor implements TreeCellEditor {
612:
613: public void addCellEditorListener(CellEditorListener l) {
614: }
615:
616: public void cancelCellEditing() {
617: }
618:
619: /**
620: * Retourne la valeur contenue dans l'?diteur
621: * @return la valeur contenue dans l'?diteur
622: */
623: public Object getCellEditorValue() {
624: return this ;
625: } // Fin de la m?thode getCellEditorValue/0
626:
627: /**
628: * Demande ? l'?diteur s'il peut commencer ? ?diter en utilisant un
629: * ?v?nement. On rend vrai, si on d?tecte un clic de souris, faux
630: * sinon.
631: * @param evt un ?v?nement
632: * @return vrai si on d?tecte un clic de souris, faux sinon.
633: */
634: public boolean isCellEditable(EventObject evt) {
635: if (evt instanceof MouseEvent) {
636: MouseEvent mevt = (MouseEvent) evt;
637: if (mevt.getClickCount() == 1) {
638: return true;
639: }
640: }
641: return false;
642: } // Fin de la m?thode isCellEditable/1
643:
644: public void removeCellEditorListener(CellEditorListener l) {
645: }
646:
647: /**
648: * Retourne vrai : la cellule doit toujours ?tre s?lectionn?e.
649: * @param anEvent un ?v?nement
650: * @return toujours vrai
651: */
652: public boolean shouldSelectCell(EventObject anEvent) {
653: return true;
654: } // Fin de la m?thode shouldSelectCell/1
655:
656: /**
657: * Retourne faux : on ne peut pas emp?cher l'?dition
658: * @return toujours faux
659: */
660: public boolean stopCellEditing() {
661: return false;
662: } // Fin de la m?thode stopCellEditing/0
663:
664: /**
665: * Donne une nouvelle valeur ? l'?diteur. Retourne le composant
666: * (checkbox) qui va ?tre ajout? dans l'arbre.
667: * @param tree l'arbre des checkbox;
668: * @param obj objet de la cellule devant ?tre ?diter
669: * @param isSelected vrai si la cellule est s?lectionn?e
670: * @param expanded vrai si le noeud est d?ploy?
671: * @param leaf vrai si le noeud est une feuille
672: * @param row l'indice de la ligne en cours d'?dition
673: */
674: public Component getTreeCellEditorComponent(JTree tree,
675: Object obj, boolean isSelected, boolean expanded,
676: boolean leaf, int row) {
677: DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) obj;
678: JCheckBox box = (JCheckBox) dmtn.getUserObject();
679: box.setEnabled(true);
680: return box;
681: } // Fin de la m?thode getTreeCellEditorComponent/7
682: } // Fin de la classe CheckBoxCellEditor
683:
684: /**
685: * @return
686: */
687: public boolean[] getPermissionsOfCampaign() {
688: return permissionsOfCampaign;
689: }
690:
691: /**
692: * @return
693: */
694: public boolean[] getPermissionsOfTest() {
695: return permissionsOfTest;
696: }
697:
698: private void initData(Group group) {
699: observedGroup = group;
700: boolean oneFalse = false;
701: for (int i = 0; i < group.getTestsPermissionsFromModel().length; i++) {
702: ((JCheckBox) ((DefaultMutableTreeNode) testRootNode
703: .getChildAt(i)).getUserObject()).setSelected(group
704: .getTestsPermissionsFromModel()[i]);
705: if (!group.getTestsPermissionsFromModel()[i]) {
706: oneFalse = true;
707: }
708: }
709: if (!oneFalse) {
710: ((JCheckBox) (testRootNode).getUserObject())
711: .setSelected(true);
712: }
713: for (int i = 0; i < group.getCampaignPermissionsFromModel().length; i++) {
714: ((JCheckBox) ((DefaultMutableTreeNode) campagneRootNode
715: .getChildAt(i)).getUserObject()).setSelected(group
716: .getCampaignPermissionsFromModel()[i]);
717: if (!group.getCampaignPermissionsFromModel()[i]) {
718: oneFalse = true;
719: }
720: }
721: if (!oneFalse) {
722: ((JCheckBox) (campagneRootNode).getUserObject())
723: .setSelected(true);
724: }
725:
726: }
727:
728: /**
729: * @return
730: */
731: public Group getObservedGroup() {
732: return observedGroup;
733: }
734:
735: } // Fin de la classe GroupAccess
|