View Javadoc

1   // $Id: JTreeValueModelAdapter.java 123 2009-01-13 11:57:56Z agony $
2   /**
3    * 
4    */
5   package de.mindcrimeilab.xsanalyzer.model;
6   
7   import javax.swing.tree.TreePath;
8   
9   import org.springframework.binding.value.support.AbstractValueModelWrapper;
10  
11  /**
12   * @author Michael Engelhardt<me@mindcrime-ilab.de>
13   * @author $Author: agony $
14   * @version $Revision: 123 $
15   * 
16   */
17  public final class JTreeValueModelAdapter extends AbstractValueModelWrapper {
18  
19      public JTreeValueModelAdapter(TreeSelectionValueModelAdapter valueModel) {
20          super(valueModel);
21      }
22  
23      @Override
24      public Object getValue() {
25          TreePath[] path = (TreePath[]) getInnerMostWrappedValueModel().getValue();
26          Object[] result = new Object[path.length];
27          for (int i = 0; i < path.length; ++i) {
28              result[i] = path[i].getLastPathComponent();
29          }
30  
31          return result;
32      }
33  }