View Javadoc

1   package de.matthias_burbach.deputy.core.repository;
2   
3   import javax.swing.tree.DefaultMutableTreeNode;
4   
5   import de.matthias_burbach.deputy.core.project.Project;
6   import de.matthias_burbach.deputy.core.project.ProjectHolderTreeNode;
7   
8   /***
9    * Is a version node in the repositories tree.
10   *
11   * @author Matthias Burbach
12   */
13  public class RepositoryArtifactVersion extends DefaultMutableTreeNode
14      implements ProjectHolderTreeNode {
15  
16      /***
17       * The project represented by this node.
18       */
19      private Project project;
20  
21      /***
22       * Constructs a version node.
23       *
24       * @param groupId The group id of this node's artifact.
25       * @param artifactId The artifact id of this node's artifact.
26       * @param version The version of this node's artifact.
27       */
28      public RepositoryArtifactVersion(
29              final String groupId,
30              final String artifactId,
31              final String version) {
32          this.project = new Project();
33          this.project.setGroupId(groupId);
34          this.project.setArtifactId(artifactId);
35          this.project.setVersion(version);
36      }
37  
38      /*
39       * (non-Javadoc)
40       * @see de.matthias_burbach.deputy.core.ProjectHolderTreeNode#getProject()
41       */
42      /***
43       * {@inheritDoc}
44       */
45      public Project getProject() {
46          return project;
47      }
48  
49      /*(non-Javadoc)
50       * @see javax.swing.tree.TreeNode#isLeaf()
51       */
52      /***
53       * {@inheritDoc}
54       */
55      public boolean isLeaf() {
56          return true;
57      }
58  
59      /*(non-Javadoc)
60       * @see java.lang.Object#toString()
61       */
62      /***
63       * {@inheritDoc}
64       */
65      public String toString() {
66          return "" + project.getVersion();
67      }
68  }