View Javadoc

1   package net.sf.mmapps.applications.developer.project;
2   
3   import java.util.*;
4   
5   import net.sf.mmapps.modules.config.*;
6   /***
7    *
8    * @author Kees Jongenburger
9    * @version $Id: ApplicationConfigurationMutableTreeNode.java,v 1.1.1.1 2004/02/06 08:44:08 keesj Exp $
10   */
11  public class ApplicationConfigurationMutableTreeNode extends ProjectMutableTreeNode {
12      Configuration configuration;
13      ApplicationConfiguration applicationConfiguration;
14  
15      class NodeManagerConifguartionComparator implements Comparator {
16          public int compare(Object o1, Object o2) {
17              NodeManagerConfiguration a = (NodeManagerConfiguration) o1;
18              NodeManagerConfiguration b = (NodeManagerConfiguration) o2;
19              return a.getName().compareTo(b.getName());
20          }
21  
22      }
23      public ApplicationConfigurationMutableTreeNode(Configuration configuration, ApplicationConfiguration applicationConfiguration) {
24          super(PROJECT_TYPE_APPLICATION, applicationConfiguration.getName());
25          this.configuration = configuration;
26          this.applicationConfiguration = applicationConfiguration;
27          NodeManagerConfigurations nodeManagerConfigurations = applicationConfiguration.getNodeManagerConfigurations();
28          Collections.sort(nodeManagerConfigurations, new NodeManagerConifguartionComparator());
29  
30          if (nodeManagerConfigurations.size() > 0) {
31              ProjectDirectoryMutableTreeNode p = new ProjectDirectoryMutableTreeNode("resources");
32              for (int x = 0; x < nodeManagerConfigurations.size(); x++) {
33                  p.add(new NodeManagerConfigurationMutableTreeNode(configuration, applicationConfiguration.getName(), nodeManagerConfigurations.getNodeManagerConfiguration(x)));
34              }
35              add(p);
36          }
37      }
38  
39      public ApplicationConfiguration getApplicationConfiguration() {
40          return applicationConfiguration;
41      }
42  
43      public Configuration getConfiguration() {
44          return configuration;
45      }
46  }