View Javadoc

1   /*
2    * $Id$
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is XML Hammer code. (org.xmlhammer.*)
14   *
15   * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
16   * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. 
17   * All Rights Reserved.
18   *
19   * Contributor(s): Edwin Dankert <edankert@gmail.com>
20   */
21  package org.xmlhammer.gui.util;
22  
23  import java.util.ArrayList;
24  
25  import javax.swing.Icon;
26  import javax.swing.ImageIcon;
27  
28  import org.bounce.image.ImageLoader;
29  import org.xmlhammer.gui.overview.OverviewNode;
30  
31  public class ParameterNode implements OverviewNode {
32      private static final ImageIcon TEXT_FIELD_ICON = ImageLoader.get().getImage( "/org/xmlhammer/gui/icons/elcl16/textfield_obj.gif");
33  
34      private OverviewNode parent = null;
35      private ArrayList<OverviewNode> children = null;
36      private String name     = null;
37      private String value    = null;
38      
39      public ParameterNode(OverviewNode parent, String name, String value) {
40          this.parent = parent;
41          this.name = name;
42          this.value = value;
43          
44          children = new ArrayList<OverviewNode>();
45      }
46      
47      public void setName(String name) {
48          this.name = name;
49      }
50  
51      public void setValue(String value) {
52          this.value = value;
53      }
54  
55      public String getNodeName() {
56          return name +" = "+value;
57      }
58  
59      public ArrayList<OverviewNode> getChildNodes() {
60          return children;
61      }
62  
63      public OverviewNode getParentNode() {
64          return this.parent;
65      }
66      
67      public String getError() {
68          return null;
69      }
70  
71      public Icon getNodeIcon() {
72          return TEXT_FIELD_ICON;
73      }
74  }