View Javadoc

1   package de.matthias_burbach.mosaique.swing;
2   
3   import javax.swing.tree.DefaultTreeModel;
4   
5   import de.matthias_burbach.mosaique.core.model.AbstractFileItem;
6   import de.matthias_burbach.mosaique.core.model.Put;
7   
8   /***
9    * @author Matthias Burbach
10   */
11  public class PutNode
12      extends AbstractFileItemNode {
13  
14      /***
15       * The put to display.
16       */
17      private Put put;
18  
19      /***
20       * @param put The put to display.
21       * @param treeModel The tree model to delegate change operations to.
22       */
23      public PutNode(
24              final Put put,
25              final DefaultTreeModel treeModel) {
26          this.put = put;
27      }
28  
29      /*
30       * (non-Javadoc)
31       * @see de.matthias_burbach.mosaique.swing.BaseMutableTreeNode
32       *          #initChildren()
33       */
34      /***
35       * {@inheritDoc}
36       */
37      protected void initChildren() {
38          //nothing to do
39      }
40  
41      /*
42       * (non-Javadoc)
43       * @see de.matthias_burbach.mosaique.swing.AbstractFileItemNode
44       *          #getFileItem()
45       */
46      /***
47       * {@inheritDoc}
48       */
49      public AbstractFileItem getFileItem() {
50          return put;
51      }
52  
53      /*
54       * (non-Javadoc)
55       * @see javax.swing.tree.TreeNode#isLeaf()
56       */
57      /***
58       * {@inheritDoc}
59       */
60      public boolean isLeaf() {
61          return true;
62      }
63  
64      /***
65       * @return The put being displayed by this node.
66       */
67      public Put getPut() {
68          return put;
69      }
70  
71      /*(non-Javadoc)
72       * @see java.lang.Object#toString()
73       */
74      /***
75       * {@inheritDoc}
76       */
77      public String toString() {
78          return put.getName();
79      }
80  }